From: Cris Di Sclafani Date: Fri, 12 Mar 2021 13:45:47 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.21 X-Git-Url: http://repos.xcallymotion.com/%27%20e.replace%28///pen//%2C?a=commitdiff_plain;h=202db6afd97c67197be88e62eb82affd1bccc118;p=motion2.git Built motion from commit (unavailable).|2.5.21 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 6d3ff0f..0383480 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:28:36.490Z", "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:38:12.174Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 1c70564..38a2335 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:28:36.490Z", "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:38:12.174Z", "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 23da435..2a0b769 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 _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 +var _0xd76d=['INTEGER','sequelize'];(function(_0x48bc0d,_0x30becd){var _0x35f641=function(_0x136926){while(--_0x136926){_0x48bc0d['push'](_0x48bc0d['shift']());}};_0x35f641(++_0x30becd);}(_0xd76d,0x139));var _0xdd76=function(_0x31eb98,_0x592fa2){_0x31eb98=_0x31eb98-0x0;var _0x20cf3e=_0xd76d[_0x31eb98];return _0x20cf3e;};'use strict';var Sequelize=require(_0xdd76('0x0'));module['exports']={'ChatInteractionId':{'type':Sequelize[_0xdd76('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xdd76('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.controller.js b/server/api/UserChatInteraction/UserChatInteraction.controller.js index 4612de7..45ad261 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 _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 +var _0x38bd=['length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','UserChatInteraction','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','set','apply','reject','save','update','then','get','destroy','sendStatus','error','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields'];(function(_0x1bd85d,_0xdc683f){var _0xd40669=function(_0x318648){while(--_0x318648){_0x1bd85d['push'](_0x1bd85d['shift']());}};_0xd40669(++_0xdc683f);}(_0x38bd,0x6d));var _0xd38b=function(_0xd58adc,_0x40ee73){_0xd58adc=_0xd58adc-0x0;var _0x5badea=_0x38bd[_0xd58adc];return _0x5badea;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd38b('0x0'));var rimraf=require(_0xd38b('0x1'));var zipdir=require(_0xd38b('0x2'));var jsonpatch=require(_0xd38b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd38b('0x4'));var Mustache=require('mustache');var util=require(_0xd38b('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xd38b('0x6'));var ejs=require(_0xd38b('0x7'));var fs=require('fs');var _=require(_0xd38b('0x8'));var squel=require('squel');var crypto=require(_0xd38b('0x9'));var jsforce=require(_0xd38b('0xa'));var deskjs=require(_0xd38b('0xb'));var toCsv=require(_0xd38b('0x6'));var querystring=require(_0xd38b('0xc'));var Papa=require(_0xd38b('0xd'));var Redis=require(_0xd38b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd38b('0xf'));var as=require(_0xd38b('0x10'));var hardwareService=require(_0xd38b('0x11'));var logger=require(_0xd38b('0x12'))(_0xd38b('0x13'));var utils=require('../../config/utils');var config=require(_0xd38b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd38b('0x15'))['db'];function respondWithStatusCode(_0x47770e,_0x465538){_0x465538=_0x465538||0xcc;return function(_0x4755b3){if(_0x4755b3){return _0x47770e['sendStatus'](_0x465538);}return _0x47770e[_0xd38b('0x16')](_0x465538)[_0xd38b('0x17')]();};}function respondWithResult(_0x57ec59,_0x323d8a){_0x323d8a=_0x323d8a||0xc8;return function(_0x245e52){if(_0x245e52){return _0x57ec59[_0xd38b('0x16')](_0x323d8a)[_0xd38b('0x18')](_0x245e52);}};}function respondWithFilteredResult(_0x36f11e,_0x5ce9a3){return function(_0x20b071){if(_0x20b071){var _0x7bff47=_0x20b071['count'],_0x5bd427=_0x5ce9a3[_0xd38b('0x19')],_0x47bc27=_0x5ce9a3[_0xd38b('0x19')]+_0x5ce9a3['limit'],_0x4c8d25;if(_0x47bc27>=_0x7bff47){_0x47bc27=_0x7bff47;_0x4c8d25=0xc8;}else{_0x4c8d25=0xce;}_0x36f11e[_0xd38b('0x16')](_0x4c8d25);return _0x36f11e[_0xd38b('0x1a')]('Content-Range',_0x5bd427+'-'+_0x47bc27+'/'+_0x7bff47)[_0xd38b('0x18')](_0x20b071);}return null;};}function patchUpdates(_0x173af8){return function(_0x4e8f17){try{jsonpatch[_0xd38b('0x1b')](_0x4e8f17,_0x173af8,!![]);}catch(_0x15846f){return BPromise[_0xd38b('0x1c')](_0x15846f);}return _0x4e8f17[_0xd38b('0x1d')]();};}function saveUpdates(_0x1b1b85,_0x3864e1){return function(_0x39a5c5){if(_0x39a5c5){return _0x39a5c5[_0xd38b('0x1e')](_0x1b1b85)[_0xd38b('0x1f')](function(_0x27d279){return _0x27d279;});}return null;};}function removeEntity(_0x4a4037,_0x104e3b){return function(_0x3f3b5e){if(_0x3f3b5e){return _0x3f3b5e['destroy']()['then'](function(){var _0xc33124=_0x3f3b5e[_0xd38b('0x20')]({'plain':!![]});var _0x9df35f='UserChatInteractions';return db['UserProfileResource'][_0xd38b('0x21')]({'where':{'type':_0x9df35f,'resourceId':_0xc33124['id']}})[_0xd38b('0x1f')](function(){return _0x3f3b5e;});})[_0xd38b('0x1f')](function(){_0x4a4037[_0xd38b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5874,_0x48c53c){return function(_0x296087){if(!_0x296087){_0x3c5874[_0xd38b('0x22')](0x194);}return _0x296087;};}function handleError(_0x7a9591,_0x1a5f84){_0x1a5f84=_0x1a5f84||0x1f4;return function(_0x6ea76b){logger[_0xd38b('0x23')](_0x6ea76b['stack']);if(_0x6ea76b['name']){delete _0x6ea76b[_0xd38b('0x24')];}_0x7a9591['status'](_0x1a5f84)[_0xd38b('0x25')](_0x6ea76b);};}exports[_0xd38b('0x26')]=function(_0x5af236,_0x47db03){var _0x304ffc={},_0x424975={},_0x519aea={'count':0x0,'rows':[]};var _0x20a31a=_[_0xd38b('0x27')](db['UserChatInteraction'][_0xd38b('0x28')],function(_0x34ee98){return{'name':_0x34ee98['fieldName'],'type':_0x34ee98[_0xd38b('0x29')][_0xd38b('0x2a')]};});_0x424975[_0xd38b('0x2b')]=_[_0xd38b('0x27')](_0x20a31a,_0xd38b('0x24'));_0x424975[_0xd38b('0x2c')]=_[_0xd38b('0x2d')](_0x5af236[_0xd38b('0x2c')]);_0x424975['filters']=_[_0xd38b('0x2e')](_0x424975[_0xd38b('0x2b')],_0x424975[_0xd38b('0x2c')]);_0x304ffc[_0xd38b('0x2f')]=_[_0xd38b('0x2e')](_0x424975[_0xd38b('0x2b')],qs['fields'](_0x5af236[_0xd38b('0x2c')][_0xd38b('0x30')]));_0x304ffc[_0xd38b('0x2f')]=_0x304ffc[_0xd38b('0x2f')][_0xd38b('0x31')]?_0x304ffc[_0xd38b('0x2f')]:_0x424975['model'];if(!_0x5af236[_0xd38b('0x2c')][_0xd38b('0x32')](_0xd38b('0x33'))){_0x304ffc['limit']=qs[_0xd38b('0x34')](_0x5af236['query'][_0xd38b('0x34')]);_0x304ffc[_0xd38b('0x19')]=qs[_0xd38b('0x19')](_0x5af236[_0xd38b('0x2c')][_0xd38b('0x19')]);}_0x304ffc[_0xd38b('0x35')]=qs[_0xd38b('0x36')](_0x5af236[_0xd38b('0x2c')]['sort']);_0x304ffc[_0xd38b('0x37')]=qs[_0xd38b('0x38')](_[_0xd38b('0x39')](_0x5af236[_0xd38b('0x2c')],_0x424975[_0xd38b('0x38')]),_0x20a31a);if(_0x5af236[_0xd38b('0x2c')][_0xd38b('0x3a')]){_0x304ffc[_0xd38b('0x37')]=_['merge'](_0x304ffc[_0xd38b('0x37')],{'$or':_['map'](_0x20a31a,function(_0x440dda){if(_0x440dda['type']!==_0xd38b('0x3b')){var _0x2c5bb7={};_0x2c5bb7[_0x440dda[_0xd38b('0x24')]]={'$like':'%'+_0x5af236[_0xd38b('0x2c')][_0xd38b('0x3a')]+'%'};return _0x2c5bb7;}})});}_0x304ffc=_[_0xd38b('0x3c')]({},_0x304ffc,_0x5af236[_0xd38b('0x3d')]);var _0x49def0={'where':_0x304ffc[_0xd38b('0x37')]};return db[_0xd38b('0x3e')][_0xd38b('0x3f')](_0x49def0)[_0xd38b('0x1f')](function(_0x5886ce){_0x519aea['count']=_0x5886ce;if(_0x5af236[_0xd38b('0x2c')][_0xd38b('0x40')]){_0x304ffc[_0xd38b('0x41')]=[{'all':!![]}];}return db[_0xd38b('0x3e')][_0xd38b('0x42')](_0x304ffc);})[_0xd38b('0x1f')](function(_0x26a5c8){_0x519aea[_0xd38b('0x43')]=_0x26a5c8;return _0x519aea;})[_0xd38b('0x1f')](respondWithFilteredResult(_0x47db03,_0x304ffc))['catch'](handleError(_0x47db03,null));};exports[_0xd38b('0x44')]=function(_0x37763d,_0x458ead){var _0x2d53a3={'raw':!![],'where':{'id':_0x37763d[_0xd38b('0x45')]['id']}},_0x3df376={};_0x3df376[_0xd38b('0x2b')]=_[_0xd38b('0x2d')](db[_0xd38b('0x3e')][_0xd38b('0x28')]);_0x3df376[_0xd38b('0x2c')]=_[_0xd38b('0x2d')](_0x37763d[_0xd38b('0x2c')]);_0x3df376[_0xd38b('0x38')]=_[_0xd38b('0x2e')](_0x3df376[_0xd38b('0x2b')],_0x3df376['query']);_0x2d53a3['attributes']=_[_0xd38b('0x2e')](_0x3df376[_0xd38b('0x2b')],qs[_0xd38b('0x30')](_0x37763d[_0xd38b('0x2c')][_0xd38b('0x30')]));_0x2d53a3['attributes']=_0x2d53a3[_0xd38b('0x2f')][_0xd38b('0x31')]?_0x2d53a3['attributes']:_0x3df376[_0xd38b('0x2b')];if(_0x37763d[_0xd38b('0x2c')]['includeAll']){_0x2d53a3['include']=[{'all':!![]}];}_0x2d53a3=_[_0xd38b('0x3c')]({},_0x2d53a3,_0x37763d[_0xd38b('0x3d')]);return db['UserChatInteraction'][_0xd38b('0x46')](_0x2d53a3)[_0xd38b('0x1f')](handleEntityNotFound(_0x458ead,null))[_0xd38b('0x1f')](respondWithResult(_0x458ead,null))[_0xd38b('0x47')](handleError(_0x458ead,null));};exports[_0xd38b('0x48')]=function(_0x3a69fe,_0x1e77ec){return db[_0xd38b('0x3e')][_0xd38b('0x48')](_0x3a69fe[_0xd38b('0x49')],{})[_0xd38b('0x1f')](function(_0x375185){var _0x237b7=_0x3a69fe[_0xd38b('0x4a')][_0xd38b('0x20')]({'plain':!![]});if(!_0x237b7)throw new Error(_0xd38b('0x4b'));if(_0x237b7[_0xd38b('0x4c')]===_0xd38b('0x4a')){var _0x31674a=_0x375185[_0xd38b('0x20')]({'plain':!![]});var _0x3f0683='UserChatInteractions';return db[_0xd38b('0x4d')][_0xd38b('0x46')]({'where':{'name':_0x3f0683,'userProfileId':_0x237b7['userProfileId']},'raw':!![]})[_0xd38b('0x1f')](function(_0x52808c){if(_0x52808c&&_0x52808c['autoAssociation']===0x0){return db['UserProfileResource'][_0xd38b('0x48')]({'name':_0x31674a[_0xd38b('0x24')],'resourceId':_0x31674a['id'],'type':_0x52808c[_0xd38b('0x24')],'sectionId':_0x52808c['id']},{})[_0xd38b('0x1f')](function(){return _0x375185;});}else{return _0x375185;}})[_0xd38b('0x47')](function(_0x13f277){logger[_0xd38b('0x23')](_0xd38b('0x4e'),_0x13f277);throw _0x13f277;});}return _0x375185;})[_0xd38b('0x1f')](respondWithResult(_0x1e77ec,0xc9))[_0xd38b('0x47')](handleError(_0x1e77ec,null));};exports['update']=function(_0x506286,_0x1844c4){if(_0x506286[_0xd38b('0x49')]['id']){delete _0x506286[_0xd38b('0x49')]['id'];}return db[_0xd38b('0x3e')][_0xd38b('0x46')]({'where':{'id':_0x506286['params']['id']}})[_0xd38b('0x1f')](handleEntityNotFound(_0x1844c4,null))[_0xd38b('0x1f')](saveUpdates(_0x506286['body'],null))[_0xd38b('0x1f')](respondWithResult(_0x1844c4,null))['catch'](handleError(_0x1844c4,null));};exports[_0xd38b('0x21')]=function(_0x2abe73,_0x10e32b){return db[_0xd38b('0x3e')][_0xd38b('0x46')]({'where':{'id':_0x2abe73[_0xd38b('0x45')]['id']}})[_0xd38b('0x1f')](handleEntityNotFound(_0x10e32b,null))[_0xd38b('0x1f')](removeEntity(_0x10e32b,null))['catch'](handleError(_0x10e32b,null));}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.model.js b/server/api/UserChatInteraction/UserChatInteraction.model.js index afb3f0d..12e6dbf 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 _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 +var _0x626d=['exports','define','user_has_chat_interactions','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0x626d,0xad));var _0xd626=function(_0x4983a2,_0x2491d9){_0x4983a2=_0x4983a2-0x0;var _0x3e3366=_0x626d[_0x4983a2];return _0x3e3366;};'use strict';var _=require(_0xd626('0x0'));var util=require(_0xd626('0x1'));var logger=require(_0xd626('0x2'))(_0xd626('0x3'));var moment=require('moment');var BPromise=require(_0xd626('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd626('0x5'));var config=require(_0xd626('0x6'));var attributes=require('./UserChatInteraction.attributes');module[_0xd626('0x7')]=function(_0x490906,_0x27be9a){return _0x490906[_0xd626('0x8')]('UserChatInteraction',attributes,{'tableName':_0xd626('0x9'),'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 03e7fcb..fa307fd 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 _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 +var _0x9647=['info','debug','UserChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserChatInteraction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0xdbc920,_0x5b6900){var _0x3fbf9a=function(_0x4410b2){while(--_0x4410b2){_0xdbc920['push'](_0xdbc920['shift']());}};_0x3fbf9a(++_0x5b6900);}(_0x9647,0x1bb));var _0x7964=function(_0x51dddb,_0x205508){_0x51dddb=_0x51dddb-0x0;var _0x24770f=_0x9647[_0x51dddb];return _0x24770f;};'use strict';var _=require(_0x7964('0x0'));var util=require(_0x7964('0x1'));var moment=require(_0x7964('0x2'));var BPromise=require(_0x7964('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7964('0x4'));var db=require(_0x7964('0x5'))['db'];var utils=require(_0x7964('0x6'));var logger=require(_0x7964('0x7'))(_0x7964('0x8'));var config=require(_0x7964('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7964('0xa')][_0x7964('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9678,_0xfe8ab6,_0x496e8d){return new BPromise(function(_0x972d31,_0x392d4b){return client[_0x7964('0xc')](_0x3f9678,_0x496e8d)['then'](function(_0x347e8a){logger[_0x7964('0xd')]('UserChatInteraction,\x20%s,\x20%s',_0xfe8ab6,'request\x20sent');logger[_0x7964('0xe')](_0x7964('0xf'),_0xfe8ab6,_0x7964('0x10'),JSON[_0x7964('0x11')](_0x347e8a));if(_0x347e8a[_0x7964('0x12')]){if(_0x347e8a[_0x7964('0x12')][_0x7964('0x13')]===0x1f4){logger[_0x7964('0x12')](_0x7964('0x14'),_0xfe8ab6,_0x347e8a[_0x7964('0x12')][_0x7964('0x15')]);return _0x392d4b(_0x347e8a[_0x7964('0x12')]['message']);}logger[_0x7964('0x12')]('UserChatInteraction,\x20%s,\x20%s',_0xfe8ab6,_0x347e8a[_0x7964('0x12')][_0x7964('0x15')]);return _0x972d31(_0x347e8a[_0x7964('0x12')]['message']);}else{logger['info']('UserChatInteraction,\x20%s,\x20%s',_0xfe8ab6,_0x7964('0x10'));_0x972d31(_0x347e8a[_0x7964('0x16')][_0x7964('0x15')]);}})[_0x7964('0x17')](function(_0x1cbe59){logger[_0x7964('0x12')](_0x7964('0x14'),_0xfe8ab6,_0x1cbe59);_0x392d4b(_0x1cbe59);});});} \ No newline at end of file diff --git a/server/api/UserChatInteraction/index.js b/server/api/UserChatInteraction/index.js index c494256..aa7e3f4 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 _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 +var _0x6baa=['util','express','Router','../../components/interaction/service','./UserChatInteraction.controller','get','index','/:id','isAuthenticated','post','put','update','destroy','exports'];(function(_0x2a5b19,_0x2fc190){var _0x4d2c62=function(_0x4e1d33){while(--_0x4e1d33){_0x2a5b19['push'](_0x2a5b19['shift']());}};_0x4d2c62(++_0x2fc190);}(_0x6baa,0x16c));var _0xa6ba=function(_0x4ec6b1,_0x2d8115){_0x4ec6b1=_0x4ec6b1-0x0;var _0x543841=_0x6baa[_0x4ec6b1];return _0x543841;};'use strict';var multer=require('multer');var util=require(_0xa6ba('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa6ba('0x1'));var router=express[_0xa6ba('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xa6ba('0x3'));var config=require('../../config/environment');var controller=require(_0xa6ba('0x4'));router[_0xa6ba('0x5')]('/',auth['isAuthenticated'](),controller[_0xa6ba('0x6')]);router['get'](_0xa6ba('0x7'),auth[_0xa6ba('0x8')](),controller['show']);router[_0xa6ba('0x9')]('/',auth[_0xa6ba('0x8')](),controller['create']);router[_0xa6ba('0xa')](_0xa6ba('0x7'),auth['isAuthenticated'](),controller[_0xa6ba('0xb')]);router['delete'](_0xa6ba('0x7'),auth[_0xa6ba('0x8')](),controller[_0xa6ba('0xc')]);module[_0xa6ba('0xd')]=router; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js b/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js index 2c20f29..c9ecf72 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 _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 +var _0x4410=['sequelize','INTEGER'];(function(_0x6f72b9,_0x5bf83d){var _0x48161d=function(_0x5a2fcb){while(--_0x5a2fcb){_0x6f72b9['push'](_0x6f72b9['shift']());}};_0x48161d(++_0x5bf83d);}(_0x4410,0x18e));var _0x0441=function(_0x435044,_0x36ab8e){_0x435044=_0x435044-0x0;var _0x33d4c6=_0x4410[_0x435044];return _0x33d4c6;};'use strict';var Sequelize=require(_0x0441('0x0'));module['exports']={'FaxInteractionId':{'type':Sequelize[_0x0441('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x0441('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 fbeee52..0655790 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 _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 +var _0x1104=['jsforce','desk.js','ioredis','../../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','Content-Range','apply','save','update','then','get','UserFaxInteractions','UserProfileResource','error','stack','name','send','index','map','UserFaxInteraction','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','options','where','include','rows','show','params','keys','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash'];(function(_0x5693b9,_0x58e117){var _0x3e85bc=function(_0x25e502){while(--_0x25e502){_0x5693b9['push'](_0x5693b9['shift']());}};_0x3e85bc(++_0x58e117);}(_0x1104,0x184));var _0x4110=function(_0x1c1ad5,_0x19d2cc){_0x1c1ad5=_0x1c1ad5-0x0;var _0x477201=_0x1104[_0x1c1ad5];return _0x477201;};'use strict';var pdf=require(_0x4110('0x0'));var emlformat=require(_0x4110('0x1'));var rimraf=require(_0x4110('0x2'));var zipdir=require(_0x4110('0x3'));var jsonpatch=require(_0x4110('0x4'));var rp=require(_0x4110('0x5'));var moment=require(_0x4110('0x6'));var BPromise=require(_0x4110('0x7'));var Mustache=require(_0x4110('0x8'));var util=require('util');var path=require(_0x4110('0x9'));var sox=require('sox');var csv=require(_0x4110('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4110('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4110('0xc'));var deskjs=require(_0x4110('0xd'));var toCsv=require(_0x4110('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4110('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4110('0xf'));var as=require(_0x4110('0x10'));var hardwareService=require(_0x4110('0x11'));var logger=require(_0x4110('0x12'))('api');var utils=require(_0x4110('0x13'));var config=require(_0x4110('0x14'));var licenseUtil=require(_0x4110('0x15'));var db=require(_0x4110('0x16'))['db'];function respondWithStatusCode(_0x3d1906,_0x1cf04e){_0x1cf04e=_0x1cf04e||0xcc;return function(_0x156c30){if(_0x156c30){return _0x3d1906[_0x4110('0x17')](_0x1cf04e);}return _0x3d1906[_0x4110('0x18')](_0x1cf04e)[_0x4110('0x19')]();};}function respondWithResult(_0x2badd3,_0x116ee2){_0x116ee2=_0x116ee2||0xc8;return function(_0x524258){if(_0x524258){return _0x2badd3['status'](_0x116ee2)['json'](_0x524258);}};}function respondWithFilteredResult(_0xa07858,_0x40801c){return function(_0x36569f){if(_0x36569f){var _0xe72205=_0x36569f[_0x4110('0x1a')],_0x1f57bc=_0x40801c[_0x4110('0x1b')],_0x3589e7=_0x40801c[_0x4110('0x1b')]+_0x40801c[_0x4110('0x1c')],_0x12a6e0;if(_0x3589e7>=_0xe72205){_0x3589e7=_0xe72205;_0x12a6e0=0xc8;}else{_0x12a6e0=0xce;}_0xa07858[_0x4110('0x18')](_0x12a6e0);return _0xa07858[_0x4110('0x1d')](_0x4110('0x1e'),_0x1f57bc+'-'+_0x3589e7+'/'+_0xe72205)['json'](_0x36569f);}return null;};}function patchUpdates(_0x44c5ff){return function(_0x434ddf){try{jsonpatch[_0x4110('0x1f')](_0x434ddf,_0x44c5ff,!![]);}catch(_0x4cbb72){return BPromise['reject'](_0x4cbb72);}return _0x434ddf[_0x4110('0x20')]();};}function saveUpdates(_0x5755a8,_0x46c72e){return function(_0x4a2e1f){if(_0x4a2e1f){return _0x4a2e1f[_0x4110('0x21')](_0x5755a8)[_0x4110('0x22')](function(_0x12b7a9){return _0x12b7a9;});}return null;};}function removeEntity(_0x5e4864,_0xe04ffc){return function(_0x27ca26){if(_0x27ca26){return _0x27ca26['destroy']()[_0x4110('0x22')](function(){var _0x4e22fb=_0x27ca26[_0x4110('0x23')]({'plain':!![]});var _0x95fa66=_0x4110('0x24');return db[_0x4110('0x25')]['destroy']({'where':{'type':_0x95fa66,'resourceId':_0x4e22fb['id']}})[_0x4110('0x22')](function(){return _0x27ca26;});})[_0x4110('0x22')](function(){_0x5e4864[_0x4110('0x18')](0xcc)[_0x4110('0x19')]();});}};}function handleEntityNotFound(_0xfc7277,_0xea4842){return function(_0x3800ed){if(!_0x3800ed){_0xfc7277['sendStatus'](0x194);}return _0x3800ed;};}function handleError(_0x15052b,_0x3c2f3b){_0x3c2f3b=_0x3c2f3b||0x1f4;return function(_0x2c6970){logger[_0x4110('0x26')](_0x2c6970[_0x4110('0x27')]);if(_0x2c6970[_0x4110('0x28')]){delete _0x2c6970[_0x4110('0x28')];}_0x15052b[_0x4110('0x18')](_0x3c2f3b)[_0x4110('0x29')](_0x2c6970);};}exports[_0x4110('0x2a')]=function(_0x2d9689,_0x31c10d){var _0x1367d4={},_0x100e2a={},_0x12958a={'count':0x0,'rows':[]};var _0x212656=_[_0x4110('0x2b')](db[_0x4110('0x2c')][_0x4110('0x2d')],function(_0xb0ad90){return{'name':_0xb0ad90[_0x4110('0x2e')],'type':_0xb0ad90[_0x4110('0x2f')]['key']};});_0x100e2a[_0x4110('0x30')]=_[_0x4110('0x2b')](_0x212656,_0x4110('0x28'));_0x100e2a['query']=_['keys'](_0x2d9689[_0x4110('0x31')]);_0x100e2a[_0x4110('0x32')]=_[_0x4110('0x33')](_0x100e2a[_0x4110('0x30')],_0x100e2a[_0x4110('0x31')]);_0x1367d4[_0x4110('0x34')]=_[_0x4110('0x33')](_0x100e2a[_0x4110('0x30')],qs[_0x4110('0x35')](_0x2d9689['query'][_0x4110('0x35')]));_0x1367d4[_0x4110('0x34')]=_0x1367d4['attributes'][_0x4110('0x36')]?_0x1367d4[_0x4110('0x34')]:_0x100e2a[_0x4110('0x30')];if(!_0x2d9689[_0x4110('0x31')][_0x4110('0x37')]('nolimit')){_0x1367d4[_0x4110('0x1c')]=qs['limit'](_0x2d9689['query'][_0x4110('0x1c')]);_0x1367d4[_0x4110('0x1b')]=qs['offset'](_0x2d9689[_0x4110('0x31')][_0x4110('0x1b')]);}_0x1367d4[_0x4110('0x38')]=qs[_0x4110('0x39')](_0x2d9689[_0x4110('0x31')][_0x4110('0x39')]);_0x1367d4['where']=qs['filters'](_[_0x4110('0x3a')](_0x2d9689[_0x4110('0x31')],_0x100e2a[_0x4110('0x32')]),_0x212656);if(_0x2d9689['query'][_0x4110('0x3b')]){_0x1367d4['where']=_[_0x4110('0x3c')](_0x1367d4['where'],{'$or':_[_0x4110('0x2b')](_0x212656,function(_0x421cff){if(_0x421cff[_0x4110('0x2f')]!==_0x4110('0x3d')){var _0x253d35={};_0x253d35[_0x421cff[_0x4110('0x28')]]={'$like':'%'+_0x2d9689['query']['filter']+'%'};return _0x253d35;}})});}_0x1367d4=_['merge']({},_0x1367d4,_0x2d9689[_0x4110('0x3e')]);var _0x35c99d={'where':_0x1367d4[_0x4110('0x3f')]};return db['UserFaxInteraction']['count'](_0x35c99d)[_0x4110('0x22')](function(_0x4980e7){_0x12958a[_0x4110('0x1a')]=_0x4980e7;if(_0x2d9689[_0x4110('0x31')]['includeAll']){_0x1367d4[_0x4110('0x40')]=[{'all':!![]}];}return db[_0x4110('0x2c')]['findAll'](_0x1367d4);})['then'](function(_0x1ddea2){_0x12958a[_0x4110('0x41')]=_0x1ddea2;return _0x12958a;})[_0x4110('0x22')](respondWithFilteredResult(_0x31c10d,_0x1367d4))['catch'](handleError(_0x31c10d,null));};exports[_0x4110('0x42')]=function(_0x1072df,_0x84328){var _0x3bbded={'raw':!![],'where':{'id':_0x1072df[_0x4110('0x43')]['id']}},_0x6f96f9={};_0x6f96f9['model']=_[_0x4110('0x44')](db[_0x4110('0x2c')]['rawAttributes']);_0x6f96f9[_0x4110('0x31')]=_[_0x4110('0x44')](_0x1072df[_0x4110('0x31')]);_0x6f96f9[_0x4110('0x32')]=_['intersection'](_0x6f96f9[_0x4110('0x30')],_0x6f96f9['query']);_0x3bbded[_0x4110('0x34')]=_['intersection'](_0x6f96f9[_0x4110('0x30')],qs[_0x4110('0x35')](_0x1072df[_0x4110('0x31')][_0x4110('0x35')]));_0x3bbded['attributes']=_0x3bbded[_0x4110('0x34')]['length']?_0x3bbded['attributes']:_0x6f96f9['model'];if(_0x1072df[_0x4110('0x31')]['includeAll']){_0x3bbded['include']=[{'all':!![]}];}_0x3bbded=_[_0x4110('0x3c')]({},_0x3bbded,_0x1072df[_0x4110('0x3e')]);return db[_0x4110('0x2c')][_0x4110('0x45')](_0x3bbded)[_0x4110('0x22')](handleEntityNotFound(_0x84328,null))[_0x4110('0x22')](respondWithResult(_0x84328,null))['catch'](handleError(_0x84328,null));};exports[_0x4110('0x46')]=function(_0x33d681,_0x46a061){return db['UserFaxInteraction'][_0x4110('0x46')](_0x33d681['body'],{})['then'](function(_0x2387e9){var _0x1e9130=_0x33d681[_0x4110('0x47')][_0x4110('0x23')]({'plain':!![]});if(!_0x1e9130)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e9130[_0x4110('0x48')]===_0x4110('0x47')){var _0x4e8547=_0x2387e9[_0x4110('0x23')]({'plain':!![]});var _0x2637d8=_0x4110('0x24');return db[_0x4110('0x49')][_0x4110('0x45')]({'where':{'name':_0x2637d8,'userProfileId':_0x1e9130[_0x4110('0x4a')]},'raw':!![]})[_0x4110('0x22')](function(_0x408bb4){if(_0x408bb4&&_0x408bb4[_0x4110('0x4b')]===0x0){return db['UserProfileResource'][_0x4110('0x46')]({'name':_0x4e8547['name'],'resourceId':_0x4e8547['id'],'type':_0x408bb4[_0x4110('0x28')],'sectionId':_0x408bb4['id']},{})[_0x4110('0x22')](function(){return _0x2387e9;});}else{return _0x2387e9;}})['catch'](function(_0x3379f1){logger[_0x4110('0x26')](_0x4110('0x4c'),_0x3379f1);throw _0x3379f1;});}return _0x2387e9;})[_0x4110('0x22')](respondWithResult(_0x46a061,0xc9))['catch'](handleError(_0x46a061,null));};exports[_0x4110('0x21')]=function(_0x5b1b3e,_0x38a53c){if(_0x5b1b3e[_0x4110('0x4d')]['id']){delete _0x5b1b3e[_0x4110('0x4d')]['id'];}return db[_0x4110('0x2c')][_0x4110('0x45')]({'where':{'id':_0x5b1b3e[_0x4110('0x43')]['id']}})['then'](handleEntityNotFound(_0x38a53c,null))[_0x4110('0x22')](saveUpdates(_0x5b1b3e[_0x4110('0x4d')],null))[_0x4110('0x22')](respondWithResult(_0x38a53c,null))['catch'](handleError(_0x38a53c,null));};exports[_0x4110('0x4e')]=function(_0x125c2c,_0x270169){return db[_0x4110('0x2c')][_0x4110('0x45')]({'where':{'id':_0x125c2c[_0x4110('0x43')]['id']}})[_0x4110('0x22')](handleEntityNotFound(_0x270169,null))[_0x4110('0x22')](removeEntity(_0x270169,null))[_0x4110('0x4f')](handleError(_0x270169,null));}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.model.js b/server/api/UserFaxInteraction/UserFaxInteraction.model.js index 3752044..42cc644 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(_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 +var _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserFaxInteraction','user_has_fax_interactions','lodash','util'];(function(_0x36c569,_0x26f7e2){var _0xf972d7=function(_0x5a9ee8){while(--_0x5a9ee8){_0x36c569['push'](_0x36c569['shift']());}};_0xf972d7(++_0x26f7e2);}(_0xdb28,0x106));var _0x8db2=function(_0x2ad702,_0x55e19a){_0x2ad702=_0x2ad702-0x0;var _0x242ac0=_0xdb28[_0x2ad702];return _0x242ac0;};'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 db90de1..32a5d16 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 _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 +var _0x3f38=['stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','then','UserFaxInteraction,\x20%s,\x20%s','UserFaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x50f9cb,_0x5f4af7){var _0x5d9ab9=function(_0x45321f){while(--_0x45321f){_0x50f9cb['push'](_0x50f9cb['shift']());}};_0x5d9ab9(++_0x5f4af7);}(_0x3f38,0x6a));var _0x83f3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3f38[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x83f3('0x0'));var util=require(_0x83f3('0x1'));var moment=require(_0x83f3('0x2'));var BPromise=require(_0x83f3('0x3'));var rs=require(_0x83f3('0x4'));var fs=require('fs');var Redis=require(_0x83f3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x83f3('0x6'));var logger=require(_0x83f3('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x83f3('0x8'));var client=jayson['client'][_0x83f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37de30,_0x7252f3,_0x6121e1){return new BPromise(function(_0x2505d0,_0x1887b6){return client['request'](_0x37de30,_0x6121e1)[_0x83f3('0xa')](function(_0x3815f5){logger['info'](_0x83f3('0xb'),_0x7252f3,'request\x20sent');logger['debug'](_0x83f3('0xc'),_0x7252f3,_0x83f3('0xd'),JSON[_0x83f3('0xe')](_0x3815f5));if(_0x3815f5[_0x83f3('0xf')]){if(_0x3815f5[_0x83f3('0xf')]['code']===0x1f4){logger[_0x83f3('0xf')](_0x83f3('0xb'),_0x7252f3,_0x3815f5[_0x83f3('0xf')][_0x83f3('0x10')]);return _0x1887b6(_0x3815f5[_0x83f3('0xf')]['message']);}logger[_0x83f3('0xf')](_0x83f3('0xb'),_0x7252f3,_0x3815f5['error'][_0x83f3('0x10')]);return _0x2505d0(_0x3815f5[_0x83f3('0xf')][_0x83f3('0x10')]);}else{logger[_0x83f3('0x11')](_0x83f3('0xb'),_0x7252f3,_0x83f3('0xd'));_0x2505d0(_0x3815f5[_0x83f3('0x12')][_0x83f3('0x10')]);}})[_0x83f3('0x13')](function(_0x210f76){logger[_0x83f3('0xf')](_0x83f3('0xb'),_0x7252f3,_0x210f76);_0x1887b6(_0x210f76);});});} \ No newline at end of file diff --git a/server/api/UserFaxInteraction/index.js b/server/api/UserFaxInteraction/index.js index 89f9974..ecef98d 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 _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 +var _0x6122=['post','put','update','delete','multer','util','path','connect-timeout','express','Router','get','isAuthenticated','index','/:id','show'];(function(_0x49988d,_0x15dae4){var _0x2259f7=function(_0x1c964d){while(--_0x1c964d){_0x49988d['push'](_0x49988d['shift']());}};_0x2259f7(++_0x15dae4);}(_0x6122,0xb8));var _0x2612=function(_0x45fb76,_0x35fd5d){_0x45fb76=_0x45fb76-0x0;var _0x338556=_0x6122[_0x45fb76];return _0x338556;};'use strict';var multer=require(_0x2612('0x0'));var util=require(_0x2612('0x1'));var path=require(_0x2612('0x2'));var timeout=require(_0x2612('0x3'));var express=require(_0x2612('0x4'));var router=express[_0x2612('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./UserFaxInteraction.controller');router[_0x2612('0x6')]('/',auth[_0x2612('0x7')](),controller[_0x2612('0x8')]);router[_0x2612('0x6')](_0x2612('0x9'),auth[_0x2612('0x7')](),controller[_0x2612('0xa')]);router[_0x2612('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2612('0xc')]('/:id',auth[_0x2612('0x7')](),controller[_0x2612('0xd')]);router[_0x2612('0xe')](_0x2612('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.attributes.js b/server/api/UserMailInteraction/UserMailInteraction.attributes.js index 979e828..e6d36ee 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 _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 +var _0xb78d=['sequelize','exports','INTEGER'];(function(_0x50693e,_0x78ac73){var _0xfaa806=function(_0x143ae7){while(--_0x143ae7){_0x50693e['push'](_0x50693e['shift']());}};_0xfaa806(++_0x78ac73);}(_0xb78d,0x126));var _0xdb78=function(_0x4e748d,_0x18dee4){_0x4e748d=_0x4e748d-0x0;var _0x2d786d=_0xb78d[_0x4e748d];return _0x2d786d;};'use strict';var Sequelize=require(_0xdb78('0x0'));module[_0xdb78('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xdb78('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.controller.js b/server/api/UserMailInteraction/UserMailInteraction.controller.js index dec8143..7c6f716 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 _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 +var _0xbf4f=['fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','UserMailInteraction','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','role','autoAssociation','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','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','limit','set','Content-Range','apply','save','update','then','destroy','UserMailInteractions','UserProfileResource','error','name','send','map','rawAttributes'];(function(_0x46f62c,_0x49eb41){var _0x46d994=function(_0x225d69){while(--_0x225d69){_0x46f62c['push'](_0x46f62c['shift']());}};_0x46d994(++_0x49eb41);}(_0xbf4f,0x1c8));var _0xfbf4=function(_0x54691e,_0x28b041){_0x54691e=_0x54691e-0x0;var _0x5520b2=_0xbf4f[_0x54691e];return _0x5520b2;};'use strict';var pdf=require(_0xfbf4('0x0'));var emlformat=require(_0xfbf4('0x1'));var rimraf=require(_0xfbf4('0x2'));var zipdir=require(_0xfbf4('0x3'));var jsonpatch=require(_0xfbf4('0x4'));var rp=require(_0xfbf4('0x5'));var moment=require(_0xfbf4('0x6'));var BPromise=require(_0xfbf4('0x7'));var Mustache=require(_0xfbf4('0x8'));var util=require(_0xfbf4('0x9'));var path=require(_0xfbf4('0xa'));var sox=require(_0xfbf4('0xb'));var csv=require(_0xfbf4('0xc'));var ejs=require(_0xfbf4('0xd'));var fs=require('fs');var _=require(_0xfbf4('0xe'));var squel=require(_0xfbf4('0xf'));var crypto=require(_0xfbf4('0x10'));var jsforce=require(_0xfbf4('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfbf4('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfbf4('0x12'));var authService=require(_0xfbf4('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xfbf4('0x14'));var hardwareService=require(_0xfbf4('0x15'));var logger=require(_0xfbf4('0x16'))(_0xfbf4('0x17'));var utils=require(_0xfbf4('0x18'));var config=require(_0xfbf4('0x19'));var licenseUtil=require(_0xfbf4('0x1a'));var db=require(_0xfbf4('0x1b'))['db'];function respondWithStatusCode(_0xa9a2ec,_0x39eca8){_0x39eca8=_0x39eca8||0xcc;return function(_0x112050){if(_0x112050){return _0xa9a2ec[_0xfbf4('0x1c')](_0x39eca8);}return _0xa9a2ec[_0xfbf4('0x1d')](_0x39eca8)[_0xfbf4('0x1e')]();};}function respondWithResult(_0x29f1cb,_0x15c5be){_0x15c5be=_0x15c5be||0xc8;return function(_0x1b2810){if(_0x1b2810){return _0x29f1cb[_0xfbf4('0x1d')](_0x15c5be)[_0xfbf4('0x1f')](_0x1b2810);}};}function respondWithFilteredResult(_0x4db88f,_0x48e0fc){return function(_0x4614c9){if(_0x4614c9){var _0x5f47a5=_0x4614c9['count'],_0x140954=_0x48e0fc[_0xfbf4('0x20')],_0x37276a=_0x48e0fc[_0xfbf4('0x20')]+_0x48e0fc[_0xfbf4('0x21')],_0x1e6cdf;if(_0x37276a>=_0x5f47a5){_0x37276a=_0x5f47a5;_0x1e6cdf=0xc8;}else{_0x1e6cdf=0xce;}_0x4db88f['status'](_0x1e6cdf);return _0x4db88f[_0xfbf4('0x22')](_0xfbf4('0x23'),_0x140954+'-'+_0x37276a+'/'+_0x5f47a5)[_0xfbf4('0x1f')](_0x4614c9);}return null;};}function patchUpdates(_0x1c0232){return function(_0x239bd5){try{jsonpatch[_0xfbf4('0x24')](_0x239bd5,_0x1c0232,!![]);}catch(_0x5131bb){return BPromise['reject'](_0x5131bb);}return _0x239bd5[_0xfbf4('0x25')]();};}function saveUpdates(_0x323ed0,_0x101a5c){return function(_0x2a43d8){if(_0x2a43d8){return _0x2a43d8[_0xfbf4('0x26')](_0x323ed0)[_0xfbf4('0x27')](function(_0x35d9a6){return _0x35d9a6;});}return null;};}function removeEntity(_0x1b43f0,_0x549acd){return function(_0x46bfdf){if(_0x46bfdf){return _0x46bfdf[_0xfbf4('0x28')]()['then'](function(){var _0x527716=_0x46bfdf['get']({'plain':!![]});var _0x3c408c=_0xfbf4('0x29');return db[_0xfbf4('0x2a')][_0xfbf4('0x28')]({'where':{'type':_0x3c408c,'resourceId':_0x527716['id']}})['then'](function(){return _0x46bfdf;});})[_0xfbf4('0x27')](function(){_0x1b43f0[_0xfbf4('0x1d')](0xcc)[_0xfbf4('0x1e')]();});}};}function handleEntityNotFound(_0x29bab1,_0x474514){return function(_0x46b1fd){if(!_0x46b1fd){_0x29bab1['sendStatus'](0x194);}return _0x46b1fd;};}function handleError(_0x24ce13,_0xb9cc73){_0xb9cc73=_0xb9cc73||0x1f4;return function(_0xe6a2df){logger[_0xfbf4('0x2b')](_0xe6a2df['stack']);if(_0xe6a2df[_0xfbf4('0x2c')]){delete _0xe6a2df[_0xfbf4('0x2c')];}_0x24ce13[_0xfbf4('0x1d')](_0xb9cc73)[_0xfbf4('0x2d')](_0xe6a2df);};}exports['index']=function(_0x2c192a,_0xa05ae7){var _0x2db60d={},_0x45fd96={},_0x3b2b6a={'count':0x0,'rows':[]};var _0x56e867=_[_0xfbf4('0x2e')](db['UserMailInteraction'][_0xfbf4('0x2f')],function(_0x1b2631){return{'name':_0x1b2631[_0xfbf4('0x30')],'type':_0x1b2631[_0xfbf4('0x31')][_0xfbf4('0x32')]};});_0x45fd96[_0xfbf4('0x33')]=_[_0xfbf4('0x2e')](_0x56e867,_0xfbf4('0x2c'));_0x45fd96[_0xfbf4('0x34')]=_[_0xfbf4('0x35')](_0x2c192a[_0xfbf4('0x34')]);_0x45fd96['filters']=_[_0xfbf4('0x36')](_0x45fd96['model'],_0x45fd96[_0xfbf4('0x34')]);_0x2db60d[_0xfbf4('0x37')]=_[_0xfbf4('0x36')](_0x45fd96[_0xfbf4('0x33')],qs[_0xfbf4('0x38')](_0x2c192a[_0xfbf4('0x34')][_0xfbf4('0x38')]));_0x2db60d[_0xfbf4('0x37')]=_0x2db60d[_0xfbf4('0x37')][_0xfbf4('0x39')]?_0x2db60d[_0xfbf4('0x37')]:_0x45fd96[_0xfbf4('0x33')];if(!_0x2c192a[_0xfbf4('0x34')][_0xfbf4('0x3a')](_0xfbf4('0x3b'))){_0x2db60d[_0xfbf4('0x21')]=qs['limit'](_0x2c192a[_0xfbf4('0x34')]['limit']);_0x2db60d[_0xfbf4('0x20')]=qs[_0xfbf4('0x20')](_0x2c192a[_0xfbf4('0x34')][_0xfbf4('0x20')]);}_0x2db60d[_0xfbf4('0x3c')]=qs['sort'](_0x2c192a[_0xfbf4('0x34')][_0xfbf4('0x3d')]);_0x2db60d[_0xfbf4('0x3e')]=qs[_0xfbf4('0x3f')](_[_0xfbf4('0x40')](_0x2c192a['query'],_0x45fd96[_0xfbf4('0x3f')]),_0x56e867);if(_0x2c192a[_0xfbf4('0x34')][_0xfbf4('0x41')]){_0x2db60d[_0xfbf4('0x3e')]=_[_0xfbf4('0x42')](_0x2db60d[_0xfbf4('0x3e')],{'$or':_[_0xfbf4('0x2e')](_0x56e867,function(_0x52a966){if(_0x52a966[_0xfbf4('0x31')]!=='VIRTUAL'){var _0x477460={};_0x477460[_0x52a966[_0xfbf4('0x2c')]]={'$like':'%'+_0x2c192a['query'][_0xfbf4('0x41')]+'%'};return _0x477460;}})});}_0x2db60d=_['merge']({},_0x2db60d,_0x2c192a[_0xfbf4('0x43')]);var _0x1a20bb={'where':_0x2db60d[_0xfbf4('0x3e')]};return db[_0xfbf4('0x44')][_0xfbf4('0x45')](_0x1a20bb)[_0xfbf4('0x27')](function(_0xf698d2){_0x3b2b6a[_0xfbf4('0x45')]=_0xf698d2;if(_0x2c192a[_0xfbf4('0x34')][_0xfbf4('0x46')]){_0x2db60d[_0xfbf4('0x47')]=[{'all':!![]}];}return db[_0xfbf4('0x44')][_0xfbf4('0x48')](_0x2db60d);})[_0xfbf4('0x27')](function(_0x28f877){_0x3b2b6a[_0xfbf4('0x49')]=_0x28f877;return _0x3b2b6a;})[_0xfbf4('0x27')](respondWithFilteredResult(_0xa05ae7,_0x2db60d))[_0xfbf4('0x4a')](handleError(_0xa05ae7,null));};exports[_0xfbf4('0x4b')]=function(_0x124b8b,_0x3126ba){var _0x102166={'raw':!![],'where':{'id':_0x124b8b[_0xfbf4('0x4c')]['id']}},_0x4624d6={};_0x4624d6[_0xfbf4('0x33')]=_[_0xfbf4('0x35')](db[_0xfbf4('0x44')][_0xfbf4('0x2f')]);_0x4624d6[_0xfbf4('0x34')]=_[_0xfbf4('0x35')](_0x124b8b['query']);_0x4624d6[_0xfbf4('0x3f')]=_[_0xfbf4('0x36')](_0x4624d6[_0xfbf4('0x33')],_0x4624d6[_0xfbf4('0x34')]);_0x102166[_0xfbf4('0x37')]=_[_0xfbf4('0x36')](_0x4624d6[_0xfbf4('0x33')],qs[_0xfbf4('0x38')](_0x124b8b['query']['fields']));_0x102166[_0xfbf4('0x37')]=_0x102166[_0xfbf4('0x37')][_0xfbf4('0x39')]?_0x102166[_0xfbf4('0x37')]:_0x4624d6['model'];if(_0x124b8b['query'][_0xfbf4('0x46')]){_0x102166[_0xfbf4('0x47')]=[{'all':!![]}];}_0x102166=_['merge']({},_0x102166,_0x124b8b[_0xfbf4('0x43')]);return db[_0xfbf4('0x44')][_0xfbf4('0x4d')](_0x102166)[_0xfbf4('0x27')](handleEntityNotFound(_0x3126ba,null))[_0xfbf4('0x27')](respondWithResult(_0x3126ba,null))[_0xfbf4('0x4a')](handleError(_0x3126ba,null));};exports[_0xfbf4('0x4e')]=function(_0x241282,_0x10ece0){return db[_0xfbf4('0x44')][_0xfbf4('0x4e')](_0x241282[_0xfbf4('0x4f')],{})[_0xfbf4('0x27')](function(_0x3cc65f){var _0x2954dd=_0x241282[_0xfbf4('0x50')][_0xfbf4('0x51')]({'plain':!![]});if(!_0x2954dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2954dd[_0xfbf4('0x52')]===_0xfbf4('0x50')){var _0x11d875=_0x3cc65f[_0xfbf4('0x51')]({'plain':!![]});var _0x1b0601='UserMailInteractions';return db['UserProfileSection'][_0xfbf4('0x4d')]({'where':{'name':_0x1b0601,'userProfileId':_0x2954dd['userProfileId']},'raw':!![]})[_0xfbf4('0x27')](function(_0x107bbe){if(_0x107bbe&&_0x107bbe[_0xfbf4('0x53')]===0x0){return db[_0xfbf4('0x2a')]['create']({'name':_0x11d875[_0xfbf4('0x2c')],'resourceId':_0x11d875['id'],'type':_0x107bbe['name'],'sectionId':_0x107bbe['id']},{})[_0xfbf4('0x27')](function(){return _0x3cc65f;});}else{return _0x3cc65f;}})[_0xfbf4('0x4a')](function(_0x5e46c2){logger[_0xfbf4('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e46c2);throw _0x5e46c2;});}return _0x3cc65f;})[_0xfbf4('0x27')](respondWithResult(_0x10ece0,0xc9))[_0xfbf4('0x4a')](handleError(_0x10ece0,null));};exports[_0xfbf4('0x26')]=function(_0x21b4f8,_0x46f055){if(_0x21b4f8[_0xfbf4('0x4f')]['id']){delete _0x21b4f8['body']['id'];}return db[_0xfbf4('0x44')][_0xfbf4('0x4d')]({'where':{'id':_0x21b4f8[_0xfbf4('0x4c')]['id']}})[_0xfbf4('0x27')](handleEntityNotFound(_0x46f055,null))[_0xfbf4('0x27')](saveUpdates(_0x21b4f8[_0xfbf4('0x4f')],null))[_0xfbf4('0x27')](respondWithResult(_0x46f055,null))['catch'](handleError(_0x46f055,null));};exports[_0xfbf4('0x28')]=function(_0x32f03c,_0x261643){return db[_0xfbf4('0x44')][_0xfbf4('0x4d')]({'where':{'id':_0x32f03c[_0xfbf4('0x4c')]['id']}})[_0xfbf4('0x27')](handleEntityNotFound(_0x261643,null))['then'](removeEntity(_0x261643,null))['catch'](handleError(_0x261643,null));}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.model.js b/server/api/UserMailInteraction/UserMailInteraction.model.js index 220a393..4e09b71 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 _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 +var _0x4dfc=['define','user_has_mail_interactions','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5e6226,_0x452265){var _0x58b6a5=function(_0x2fd5e3){while(--_0x2fd5e3){_0x5e6226['push'](_0x5e6226['shift']());}};_0x58b6a5(++_0x452265);}(_0x4dfc,0xda));var _0xc4df=function(_0x28f153,_0x4852ed){_0x28f153=_0x28f153-0x0;var _0x56b861=_0x4dfc[_0x28f153];return _0x56b861;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc4df('0x0'));var moment=require(_0xc4df('0x1'));var BPromise=require(_0xc4df('0x2'));var rp=require(_0xc4df('0x3'));var fs=require('fs');var path=require(_0xc4df('0x4'));var rimraf=require(_0xc4df('0x5'));var config=require(_0xc4df('0x6'));var attributes=require('./UserMailInteraction.attributes');module['exports']=function(_0x5814de,_0x27d2b2){return _0x5814de[_0xc4df('0x7')]('UserMailInteraction',attributes,{'tableName':_0xc4df('0x8'),'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 3964fbf..1cc2e27 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 _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 +var _0x91e7=['then','info','request\x20sent','debug','UserMailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','UserMailInteraction,\x20%s,\x20%s','message','result','catch','lodash','moment','ioredis','../../config/utils','client','http','request'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0x91e7,0xf0));var _0x791e=function(_0x20fdc1,_0xde1296){_0x20fdc1=_0x20fdc1-0x0;var _0x25397c=_0x91e7[_0x20fdc1];return _0x25397c;};'use strict';var _=require(_0x791e('0x0'));var util=require('util');var moment=require(_0x791e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x791e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x791e('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x791e('0x4')][_0x791e('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2e4136,_0x10d070,_0x4da38a){return new BPromise(function(_0xb3dd0a,_0x3d2e72){return client[_0x791e('0x6')](_0x2e4136,_0x4da38a)[_0x791e('0x7')](function(_0x2a6703){logger[_0x791e('0x8')]('UserMailInteraction,\x20%s,\x20%s',_0x10d070,_0x791e('0x9'));logger[_0x791e('0xa')](_0x791e('0xb'),_0x10d070,_0x791e('0x9'),JSON[_0x791e('0xc')](_0x2a6703));if(_0x2a6703['error']){if(_0x2a6703[_0x791e('0xd')][_0x791e('0xe')]===0x1f4){logger['error'](_0x791e('0xf'),_0x10d070,_0x2a6703[_0x791e('0xd')]['message']);return _0x3d2e72(_0x2a6703[_0x791e('0xd')][_0x791e('0x10')]);}logger[_0x791e('0xd')](_0x791e('0xf'),_0x10d070,_0x2a6703[_0x791e('0xd')][_0x791e('0x10')]);return _0xb3dd0a(_0x2a6703[_0x791e('0xd')][_0x791e('0x10')]);}else{logger['info']('UserMailInteraction,\x20%s,\x20%s',_0x10d070,_0x791e('0x9'));_0xb3dd0a(_0x2a6703[_0x791e('0x11')][_0x791e('0x10')]);}})[_0x791e('0x12')](function(_0x316552){logger[_0x791e('0xd')](_0x791e('0xf'),_0x10d070,_0x316552);_0x3d2e72(_0x316552);});});} \ No newline at end of file diff --git a/server/api/UserMailInteraction/index.js b/server/api/UserMailInteraction/index.js index 0f3f51f..8701674 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 _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 +var _0x524e=['/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserMailInteraction.controller','get','isAuthenticated'];(function(_0xed1f11,_0x3c467c){var _0x59c722=function(_0x54c3cc){while(--_0x54c3cc){_0xed1f11['push'](_0xed1f11['shift']());}};_0x59c722(++_0x3c467c);}(_0x524e,0x15e));var _0xe524=function(_0x3a5a92,_0x45f630){_0x3a5a92=_0x3a5a92-0x0;var _0x2cad45=_0x524e[_0x3a5a92];return _0x2cad45;};'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 diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js index 511ce83..8be2d75 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 _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 +var _0xc034=['sequelize','exports','INTEGER'];(function(_0x215dc8,_0x52c245){var _0x583ea3=function(_0x32350d){while(--_0x32350d){_0x215dc8['push'](_0x215dc8['shift']());}};_0x583ea3(++_0x52c245);}(_0xc034,0x1d7));var _0x4c03=function(_0x4daee8,_0x4a13d3){_0x4daee8=_0x4daee8-0x0;var _0x53be12=_0xc034[_0x4daee8];return _0x53be12;};'use strict';var Sequelize=require(_0x4c03('0x0'));module[_0x4c03('0x1')]={'OpenchannelInteractionId':{'type':Sequelize[_0x4c03('0x2')],'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 ec2a744..4d87bcc 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 _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 +var _0xa94d=['destroy','UserOpenchannelInteraction','UserProfileResource','end','send','map','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','count','limit','set','json','apply','save','update','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa94d,0x80));var _0xda94=function(_0x54dfd9,_0x1fb870){_0x54dfd9=_0x54dfd9-0x0;var _0x48987e=_0xa94d[_0x54dfd9];return _0x48987e;};'use strict';var pdf=require(_0xda94('0x0'));var emlformat=require(_0xda94('0x1'));var rimraf=require(_0xda94('0x2'));var zipdir=require(_0xda94('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda94('0x4'));var moment=require('moment');var BPromise=require(_0xda94('0x5'));var Mustache=require(_0xda94('0x6'));var util=require(_0xda94('0x7'));var path=require('path');var sox=require(_0xda94('0x8'));var csv=require('to-csv');var ejs=require(_0xda94('0x9'));var fs=require('fs');var _=require(_0xda94('0xa'));var squel=require(_0xda94('0xb'));var crypto=require(_0xda94('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xda94('0xd'));var toCsv=require(_0xda94('0xe'));var querystring=require(_0xda94('0xf'));var Papa=require('papaparse');var Redis=require(_0xda94('0x10'));var authService=require(_0xda94('0x11'));var qs=require(_0xda94('0x12'));var as=require(_0xda94('0x13'));var hardwareService=require(_0xda94('0x14'));var logger=require(_0xda94('0x15'))('api');var utils=require(_0xda94('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xda94('0x17'))['db'];function respondWithStatusCode(_0x192f3d,_0x175143){_0x175143=_0x175143||0xcc;return function(_0x3e117f){if(_0x3e117f){return _0x192f3d[_0xda94('0x18')](_0x175143);}return _0x192f3d[_0xda94('0x19')](_0x175143)['end']();};}function respondWithResult(_0x374913,_0x59a175){_0x59a175=_0x59a175||0xc8;return function(_0x5523dc){if(_0x5523dc){return _0x374913[_0xda94('0x19')](_0x59a175)['json'](_0x5523dc);}};}function respondWithFilteredResult(_0x250631,_0x1e9cab){return function(_0x373196){if(_0x373196){var _0x30b80f=_0x373196[_0xda94('0x1a')],_0x5adb63=_0x1e9cab['offset'],_0x5d6190=_0x1e9cab['offset']+_0x1e9cab[_0xda94('0x1b')],_0x290f94;if(_0x5d6190>=_0x30b80f){_0x5d6190=_0x30b80f;_0x290f94=0xc8;}else{_0x290f94=0xce;}_0x250631['status'](_0x290f94);return _0x250631[_0xda94('0x1c')]('Content-Range',_0x5adb63+'-'+_0x5d6190+'/'+_0x30b80f)[_0xda94('0x1d')](_0x373196);}return null;};}function patchUpdates(_0x258371){return function(_0x4775e1){try{jsonpatch[_0xda94('0x1e')](_0x4775e1,_0x258371,!![]);}catch(_0x3374a9){return BPromise['reject'](_0x3374a9);}return _0x4775e1[_0xda94('0x1f')]();};}function saveUpdates(_0x39d05e,_0x4e8ee8){return function(_0x49bd6c){if(_0x49bd6c){return _0x49bd6c[_0xda94('0x20')](_0x39d05e)[_0xda94('0x21')](function(_0x285914){return _0x285914;});}return null;};}function removeEntity(_0x30369c,_0x3517a5){return function(_0x54fb08){if(_0x54fb08){return _0x54fb08[_0xda94('0x22')]()[_0xda94('0x21')](function(){var _0x38ddfe=_0x54fb08['get']({'plain':!![]});var _0x499805=_0xda94('0x23');return db[_0xda94('0x24')][_0xda94('0x22')]({'where':{'type':_0x499805,'resourceId':_0x38ddfe['id']}})[_0xda94('0x21')](function(){return _0x54fb08;});})[_0xda94('0x21')](function(){_0x30369c[_0xda94('0x19')](0xcc)[_0xda94('0x25')]();});}};}function handleEntityNotFound(_0x55406a,_0x42cb8d){return function(_0x9b4c20){if(!_0x9b4c20){_0x55406a[_0xda94('0x18')](0x194);}return _0x9b4c20;};}function handleError(_0x1be033,_0x3927db){_0x3927db=_0x3927db||0x1f4;return function(_0x3979de){logger['error'](_0x3979de['stack']);if(_0x3979de['name']){delete _0x3979de['name'];}_0x1be033[_0xda94('0x19')](_0x3927db)[_0xda94('0x26')](_0x3979de);};}exports['index']=function(_0x4f5618,_0x403e3b){var _0x4f8468={},_0x601dd2={},_0x241bdf={'count':0x0,'rows':[]};var _0x2846ed=_[_0xda94('0x27')](db[_0xda94('0x23')]['rawAttributes'],function(_0x395220){return{'name':_0x395220[_0xda94('0x28')],'type':_0x395220[_0xda94('0x29')][_0xda94('0x2a')]};});_0x601dd2[_0xda94('0x2b')]=_[_0xda94('0x27')](_0x2846ed,_0xda94('0x2c'));_0x601dd2['query']=_['keys'](_0x4f5618[_0xda94('0x2d')]);_0x601dd2[_0xda94('0x2e')]=_[_0xda94('0x2f')](_0x601dd2['model'],_0x601dd2[_0xda94('0x2d')]);_0x4f8468[_0xda94('0x30')]=_['intersection'](_0x601dd2[_0xda94('0x2b')],qs['fields'](_0x4f5618['query'][_0xda94('0x31')]));_0x4f8468[_0xda94('0x30')]=_0x4f8468['attributes'][_0xda94('0x32')]?_0x4f8468[_0xda94('0x30')]:_0x601dd2[_0xda94('0x2b')];if(!_0x4f5618[_0xda94('0x2d')][_0xda94('0x33')](_0xda94('0x34'))){_0x4f8468[_0xda94('0x1b')]=qs[_0xda94('0x1b')](_0x4f5618['query'][_0xda94('0x1b')]);_0x4f8468[_0xda94('0x35')]=qs['offset'](_0x4f5618[_0xda94('0x2d')][_0xda94('0x35')]);}_0x4f8468[_0xda94('0x36')]=qs['sort'](_0x4f5618[_0xda94('0x2d')][_0xda94('0x37')]);_0x4f8468[_0xda94('0x38')]=qs[_0xda94('0x2e')](_[_0xda94('0x39')](_0x4f5618[_0xda94('0x2d')],_0x601dd2[_0xda94('0x2e')]),_0x2846ed);if(_0x4f5618[_0xda94('0x2d')][_0xda94('0x3a')]){_0x4f8468[_0xda94('0x38')]=_[_0xda94('0x3b')](_0x4f8468[_0xda94('0x38')],{'$or':_[_0xda94('0x27')](_0x2846ed,function(_0x49d5ba){if(_0x49d5ba[_0xda94('0x29')]!==_0xda94('0x3c')){var _0x3b4ed4={};_0x3b4ed4[_0x49d5ba[_0xda94('0x2c')]]={'$like':'%'+_0x4f5618[_0xda94('0x2d')]['filter']+'%'};return _0x3b4ed4;}})});}_0x4f8468=_[_0xda94('0x3b')]({},_0x4f8468,_0x4f5618[_0xda94('0x3d')]);var _0x374817={'where':_0x4f8468[_0xda94('0x38')]};return db[_0xda94('0x23')][_0xda94('0x1a')](_0x374817)[_0xda94('0x21')](function(_0x54d652){_0x241bdf['count']=_0x54d652;if(_0x4f5618[_0xda94('0x2d')][_0xda94('0x3e')]){_0x4f8468[_0xda94('0x3f')]=[{'all':!![]}];}return db[_0xda94('0x23')][_0xda94('0x40')](_0x4f8468);})[_0xda94('0x21')](function(_0x11b53e){_0x241bdf[_0xda94('0x41')]=_0x11b53e;return _0x241bdf;})['then'](respondWithFilteredResult(_0x403e3b,_0x4f8468))[_0xda94('0x42')](handleError(_0x403e3b,null));};exports[_0xda94('0x43')]=function(_0x35b203,_0x5b9cc0){var _0x550e5c={'raw':!![],'where':{'id':_0x35b203[_0xda94('0x44')]['id']}},_0x393e0d={};_0x393e0d[_0xda94('0x2b')]=_[_0xda94('0x45')](db[_0xda94('0x23')][_0xda94('0x46')]);_0x393e0d[_0xda94('0x2d')]=_['keys'](_0x35b203['query']);_0x393e0d[_0xda94('0x2e')]=_['intersection'](_0x393e0d[_0xda94('0x2b')],_0x393e0d[_0xda94('0x2d')]);_0x550e5c[_0xda94('0x30')]=_[_0xda94('0x2f')](_0x393e0d[_0xda94('0x2b')],qs['fields'](_0x35b203[_0xda94('0x2d')][_0xda94('0x31')]));_0x550e5c[_0xda94('0x30')]=_0x550e5c['attributes'][_0xda94('0x32')]?_0x550e5c[_0xda94('0x30')]:_0x393e0d[_0xda94('0x2b')];if(_0x35b203[_0xda94('0x2d')][_0xda94('0x3e')]){_0x550e5c[_0xda94('0x3f')]=[{'all':!![]}];}_0x550e5c=_['merge']({},_0x550e5c,_0x35b203[_0xda94('0x3d')]);return db[_0xda94('0x23')][_0xda94('0x47')](_0x550e5c)[_0xda94('0x21')](handleEntityNotFound(_0x5b9cc0,null))[_0xda94('0x21')](respondWithResult(_0x5b9cc0,null))[_0xda94('0x42')](handleError(_0x5b9cc0,null));};exports[_0xda94('0x48')]=function(_0x6e6aaf,_0x69fe43){return db[_0xda94('0x23')]['create'](_0x6e6aaf[_0xda94('0x49')],{})[_0xda94('0x21')](function(_0x1a682a){var _0x5cca36=_0x6e6aaf[_0xda94('0x4a')][_0xda94('0x4b')]({'plain':!![]});if(!_0x5cca36)throw new Error(_0xda94('0x4c'));if(_0x5cca36[_0xda94('0x4d')]===_0xda94('0x4a')){var _0x480776=_0x1a682a['get']({'plain':!![]});var _0x3d45e0=_0xda94('0x23');return db[_0xda94('0x4e')][_0xda94('0x47')]({'where':{'name':_0x3d45e0,'userProfileId':_0x5cca36[_0xda94('0x4f')]},'raw':!![]})['then'](function(_0x1ccca8){if(_0x1ccca8&&_0x1ccca8[_0xda94('0x50')]===0x0){return db[_0xda94('0x24')][_0xda94('0x48')]({'name':_0x480776[_0xda94('0x2c')],'resourceId':_0x480776['id'],'type':_0x1ccca8[_0xda94('0x2c')],'sectionId':_0x1ccca8['id']},{})[_0xda94('0x21')](function(){return _0x1a682a;});}else{return _0x1a682a;}})[_0xda94('0x42')](function(_0x37e0dd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37e0dd);throw _0x37e0dd;});}return _0x1a682a;})[_0xda94('0x21')](respondWithResult(_0x69fe43,0xc9))[_0xda94('0x42')](handleError(_0x69fe43,null));};exports[_0xda94('0x20')]=function(_0x124acc,_0x9412b1){if(_0x124acc[_0xda94('0x49')]['id']){delete _0x124acc['body']['id'];}return db[_0xda94('0x23')][_0xda94('0x47')]({'where':{'id':_0x124acc[_0xda94('0x44')]['id']}})[_0xda94('0x21')](handleEntityNotFound(_0x9412b1,null))['then'](saveUpdates(_0x124acc[_0xda94('0x49')],null))[_0xda94('0x21')](respondWithResult(_0x9412b1,null))['catch'](handleError(_0x9412b1,null));};exports[_0xda94('0x22')]=function(_0x47e24e,_0x2eb9ef){return db[_0xda94('0x23')][_0xda94('0x47')]({'where':{'id':_0x47e24e[_0xda94('0x44')]['id']}})[_0xda94('0x21')](handleEntityNotFound(_0x2eb9ef,null))[_0xda94('0x21')](removeEntity(_0x2eb9ef,null))[_0xda94('0x42')](handleError(_0x2eb9ef,null));}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js index 0d234a2..4f172ea 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 _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 +var _0x3cd3=['define','UserOpenchannelInteraction','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./UserOpenchannelInteraction.attributes','exports'];(function(_0x1dabb6,_0x1997b8){var _0x3c95e6=function(_0x3f6eb6){while(--_0x3f6eb6){_0x1dabb6['push'](_0x1dabb6['shift']());}};_0x3c95e6(++_0x1997b8);}(_0x3cd3,0x120));var _0x33cd=function(_0x5af4dd,_0x2dfaef){_0x5af4dd=_0x5af4dd-0x0;var _0x5a76b7=_0x3cd3[_0x5af4dd];return _0x5a76b7;};'use strict';var _=require(_0x33cd('0x0'));var util=require(_0x33cd('0x1'));var logger=require(_0x33cd('0x2'))(_0x33cd('0x3'));var moment=require(_0x33cd('0x4'));var BPromise=require('bluebird');var rp=require(_0x33cd('0x5'));var fs=require('fs');var path=require(_0x33cd('0x6'));var rimraf=require(_0x33cd('0x7'));var config=require(_0x33cd('0x8'));var attributes=require(_0x33cd('0x9'));module[_0x33cd('0xa')]=function(_0x18a5ad,_0xb2db4a){return _0x18a5ad[_0x33cd('0xb')](_0x33cd('0xc'),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 2976000..6e0bab5 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 _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 +var _0x5946=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','UserOpenchannelInteraction,\x20%s,\x20%s','debug','UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x2dbe2e,_0x127139){var _0x2d6400=function(_0x344148){while(--_0x344148){_0x2dbe2e['push'](_0x2dbe2e['shift']());}};_0x2d6400(++_0x127139);}(_0x5946,0x8f));var _0x6594=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0x5946[_0x3227c1];return _0x31fd48;};'use strict';var _=require('lodash');var util=require(_0x6594('0x0'));var moment=require('moment');var BPromise=require(_0x6594('0x1'));var rs=require(_0x6594('0x2'));var fs=require('fs');var Redis=require(_0x6594('0x3'));var db=require(_0x6594('0x4'))['db'];var utils=require(_0x6594('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6594('0x6'));var jayson=require(_0x6594('0x7'));var client=jayson[_0x6594('0x8')][_0x6594('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4aab4a,_0x10ff38,_0x578f64){return new BPromise(function(_0x2e6493,_0x49f15f){return client['request'](_0x4aab4a,_0x578f64)[_0x6594('0xa')](function(_0x35656f){logger[_0x6594('0xb')](_0x6594('0xc'),_0x10ff38,'request\x20sent');logger[_0x6594('0xd')](_0x6594('0xe'),_0x10ff38,_0x6594('0xf'),JSON[_0x6594('0x10')](_0x35656f));if(_0x35656f['error']){if(_0x35656f['error']['code']===0x1f4){logger['error'](_0x6594('0xc'),_0x10ff38,_0x35656f[_0x6594('0x11')][_0x6594('0x12')]);return _0x49f15f(_0x35656f[_0x6594('0x11')][_0x6594('0x12')]);}logger[_0x6594('0x11')](_0x6594('0xc'),_0x10ff38,_0x35656f[_0x6594('0x11')][_0x6594('0x12')]);return _0x2e6493(_0x35656f[_0x6594('0x11')][_0x6594('0x12')]);}else{logger[_0x6594('0xb')](_0x6594('0xc'),_0x10ff38,_0x6594('0xf'));_0x2e6493(_0x35656f[_0x6594('0x13')][_0x6594('0x12')]);}})[_0x6594('0x14')](function(_0x3dc798){logger[_0x6594('0x11')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x10ff38,_0x3dc798);_0x49f15f(_0x3dc798);});});} \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/index.js b/server/api/UserOpenchannelInteraction/index.js index 5d7b6d4..62b1080 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 _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 +var _0xf367=['destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./UserOpenchannelInteraction.controller','get','isAuthenticated','post','create','put','update','delete','/:id'];(function(_0x45aa18,_0x412fc5){var _0x26119d=function(_0x68dcc6){while(--_0x68dcc6){_0x45aa18['push'](_0x45aa18['shift']());}};_0x26119d(++_0x412fc5);}(_0xf367,0xab));var _0x7f36=function(_0x1aa54c,_0x578a71){_0x1aa54c=_0x1aa54c-0x0;var _0x1c2801=_0xf367[_0x1aa54c];return _0x1c2801;};'use strict';var multer=require(_0x7f36('0x0'));var util=require(_0x7f36('0x1'));var path=require('path');var timeout=require(_0x7f36('0x2'));var express=require(_0x7f36('0x3'));var router=express[_0x7f36('0x4')]();var auth=require(_0x7f36('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7f36('0x6'));var controller=require(_0x7f36('0x7'));router[_0x7f36('0x8')]('/',auth[_0x7f36('0x9')](),controller['index']);router['get']('/:id',auth[_0x7f36('0x9')](),controller['show']);router[_0x7f36('0xa')]('/',auth['isAuthenticated'](),controller[_0x7f36('0xb')]);router[_0x7f36('0xc')]('/:id',auth[_0x7f36('0x9')](),controller[_0x7f36('0xd')]);router[_0x7f36('0xe')](_0x7f36('0xf'),auth['isAuthenticated'](),controller[_0x7f36('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js b/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js index 6bfb35b..e0e0035 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 _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 +var _0xa6a2=['sequelize','exports','INTEGER'];(function(_0x4c369e,_0x1d9e73){var _0xe7a14d=function(_0x2e81d9){while(--_0x2e81d9){_0x4c369e['push'](_0x4c369e['shift']());}};_0xe7a14d(++_0x1d9e73);}(_0xa6a2,0x168));var _0x2a6a=function(_0x4f3e1e,_0x270c16){_0x4f3e1e=_0x4f3e1e-0x0;var _0x3207ad=_0xa6a2[_0x4f3e1e];return _0x3207ad;};'use strict';var Sequelize=require(_0x2a6a('0x0'));module[_0x2a6a('0x1')]={'SmsInteractionId':{'type':Sequelize[_0x2a6a('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x2a6a('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.controller.js b/server/api/UserSmsInteraction/UserSmsInteraction.controller.js index 57c065b..066727b 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(_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 +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(_0x32384a,_0x49943f){var _0x294574=function(_0x2e908e){while(--_0x2e908e){_0x32384a['push'](_0x32384a['shift']());}};_0x294574(++_0x49943f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 d9fbc18..384edec 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 _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 +var _0x95b7=['path','rimraf','./UserSmsInteraction.attributes','exports','define','UserSmsInteraction','user_has_sms_interactions','lodash','../../config/logger','api','moment','request-promise'];(function(_0x34d1c7,_0x242f5f){var _0x27cb31=function(_0x5c5ee6){while(--_0x5c5ee6){_0x34d1c7['push'](_0x34d1c7['shift']());}};_0x27cb31(++_0x242f5f);}(_0x95b7,0xa3));var _0x795b=function(_0x3401ce,_0x5d1579){_0x3401ce=_0x3401ce-0x0;var _0x1bb79d=_0x95b7[_0x3401ce];return _0x1bb79d;};'use strict';var _=require(_0x795b('0x0'));var util=require('util');var logger=require(_0x795b('0x1'))(_0x795b('0x2'));var moment=require(_0x795b('0x3'));var BPromise=require('bluebird');var rp=require(_0x795b('0x4'));var fs=require('fs');var path=require(_0x795b('0x5'));var rimraf=require(_0x795b('0x6'));var config=require('../../config/environment');var attributes=require(_0x795b('0x7'));module[_0x795b('0x8')]=function(_0x4f2076,_0x530d64){return _0x4f2076[_0x795b('0x9')](_0x795b('0xa'),attributes,{'tableName':_0x795b('0xb'),'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 6a2cb20..5d1eca3 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 _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 +var _0x4475=['../../config/utils','rpc','../../config/environment','client','http','request','then','info','UserSmsInteraction,\x20%s,\x20%s','request\x20sent','debug','UserSmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x148aa9,_0x421ae3){var _0x530a22=function(_0x458499){while(--_0x458499){_0x148aa9['push'](_0x148aa9['shift']());}};_0x530a22(++_0x421ae3);}(_0x4475,0x1f1));var _0x5447=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4475[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x5447('0x0'));var util=require(_0x5447('0x1'));var moment=require(_0x5447('0x2'));var BPromise=require(_0x5447('0x3'));var rs=require(_0x5447('0x4'));var fs=require('fs');var Redis=require(_0x5447('0x5'));var db=require(_0x5447('0x6'))['db'];var utils=require(_0x5447('0x7'));var logger=require('../../config/logger')(_0x5447('0x8'));var config=require(_0x5447('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5447('0xa')][_0x5447('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b5d3d,_0x443586,_0x1c6c78){return new BPromise(function(_0x21cd26,_0x4ea93e){return client[_0x5447('0xc')](_0x5b5d3d,_0x1c6c78)[_0x5447('0xd')](function(_0x2d8c79){logger[_0x5447('0xe')](_0x5447('0xf'),_0x443586,_0x5447('0x10'));logger[_0x5447('0x11')](_0x5447('0x12'),_0x443586,_0x5447('0x10'),JSON[_0x5447('0x13')](_0x2d8c79));if(_0x2d8c79[_0x5447('0x14')]){if(_0x2d8c79[_0x5447('0x14')]['code']===0x1f4){logger['error'](_0x5447('0xf'),_0x443586,_0x2d8c79[_0x5447('0x14')][_0x5447('0x15')]);return _0x4ea93e(_0x2d8c79[_0x5447('0x14')][_0x5447('0x15')]);}logger[_0x5447('0x14')](_0x5447('0xf'),_0x443586,_0x2d8c79[_0x5447('0x14')][_0x5447('0x15')]);return _0x21cd26(_0x2d8c79[_0x5447('0x14')]['message']);}else{logger[_0x5447('0xe')](_0x5447('0xf'),_0x443586,_0x5447('0x10'));_0x21cd26(_0x2d8c79[_0x5447('0x16')][_0x5447('0x15')]);}})[_0x5447('0x17')](function(_0x216cfc){logger[_0x5447('0x14')](_0x5447('0xf'),_0x443586,_0x216cfc);_0x4ea93e(_0x216cfc);});});} \ No newline at end of file diff --git a/server/api/UserSmsInteraction/index.js b/server/api/UserSmsInteraction/index.js index 7e58650..8c81c96 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 _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 +var _0x6553=['express','Router','../../components/auth/service','../../config/environment','./UserSmsInteraction.controller','get','isAuthenticated','index','show','create','put','/:id','update','destroy','exports','util','connect-timeout'];(function(_0x2aef60,_0x299d5d){var _0xa1ee62=function(_0x266428){while(--_0x266428){_0x2aef60['push'](_0x2aef60['shift']());}};_0xa1ee62(++_0x299d5d);}(_0x6553,0x185));var _0x3655=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x6553[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require('multer');var util=require(_0x3655('0x0'));var path=require('path');var timeout=require(_0x3655('0x1'));var express=require(_0x3655('0x2'));var router=express[_0x3655('0x3')]();var auth=require(_0x3655('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3655('0x5'));var controller=require(_0x3655('0x6'));router[_0x3655('0x7')]('/',auth[_0x3655('0x8')](),controller[_0x3655('0x9')]);router[_0x3655('0x7')]('/:id',auth[_0x3655('0x8')](),controller[_0x3655('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3655('0xb')]);router[_0x3655('0xc')](_0x3655('0xd'),auth[_0x3655('0x8')](),controller[_0x3655('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3655('0xf')]);module[_0x3655('0x10')]=router; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js index 755b4f7..fb5669b 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 _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 +var _0x3dc0=['exports','INTEGER','sequelize'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x3dc0,0xad));var _0x03dc=function(_0x3b0867,_0x4031cb){_0x3b0867=_0x3b0867-0x0;var _0x2e0923=_0x3dc0[_0x3b0867];return _0x2e0923;};'use strict';var Sequelize=require(_0x03dc('0x0'));module[_0x03dc('0x1')]={'WhatsappInteractionId':{'type':Sequelize[_0x03dc('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x03dc('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js index 3c02b09..6cc63a7 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 _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 +var _0x2c34=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','UserWhatsappInteractions','UserProfileResource','sendStatus','name','send','index','map','UserWhatsappInteraction','rawAttributes','fieldName','type','model'];(function(_0x28a502,_0x3fb0da){var _0xa67f37=function(_0xd4504b){while(--_0xd4504b){_0x28a502['push'](_0x28a502['shift']());}};_0xa67f37(++_0x3fb0da);}(_0x2c34,0x16c));var _0x42c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2c34[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x42c3('0x0'));var emlformat=require(_0x42c3('0x1'));var rimraf=require(_0x42c3('0x2'));var zipdir=require(_0x42c3('0x3'));var jsonpatch=require(_0x42c3('0x4'));var rp=require(_0x42c3('0x5'));var moment=require(_0x42c3('0x6'));var BPromise=require(_0x42c3('0x7'));var Mustache=require(_0x42c3('0x8'));var util=require(_0x42c3('0x9'));var path=require(_0x42c3('0xa'));var sox=require(_0x42c3('0xb'));var csv=require(_0x42c3('0xc'));var ejs=require(_0x42c3('0xd'));var fs=require('fs');var _=require(_0x42c3('0xe'));var squel=require(_0x42c3('0xf'));var crypto=require(_0x42c3('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x42c3('0xc'));var querystring=require(_0x42c3('0x11'));var Papa=require(_0x42c3('0x12'));var Redis=require(_0x42c3('0x13'));var authService=require(_0x42c3('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x42c3('0x15'));var logger=require('../../config/logger')(_0x42c3('0x16'));var utils=require(_0x42c3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x42c3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57c3d8,_0x5ec45c){_0x5ec45c=_0x5ec45c||0xcc;return function(_0x257ded){if(_0x257ded){return _0x57c3d8['sendStatus'](_0x5ec45c);}return _0x57c3d8[_0x42c3('0x19')](_0x5ec45c)[_0x42c3('0x1a')]();};}function respondWithResult(_0x3c9d0c,_0x386b5b){_0x386b5b=_0x386b5b||0xc8;return function(_0x507800){if(_0x507800){return _0x3c9d0c[_0x42c3('0x19')](_0x386b5b)[_0x42c3('0x1b')](_0x507800);}};}function respondWithFilteredResult(_0x13571d,_0x335495){return function(_0x502561){if(_0x502561){var _0x288c24=_0x502561[_0x42c3('0x1c')],_0x1be7d5=_0x335495[_0x42c3('0x1d')],_0x4f265f=_0x335495[_0x42c3('0x1d')]+_0x335495[_0x42c3('0x1e')],_0x38e43c;if(_0x4f265f>=_0x288c24){_0x4f265f=_0x288c24;_0x38e43c=0xc8;}else{_0x38e43c=0xce;}_0x13571d[_0x42c3('0x19')](_0x38e43c);return _0x13571d['set'](_0x42c3('0x1f'),_0x1be7d5+'-'+_0x4f265f+'/'+_0x288c24)[_0x42c3('0x1b')](_0x502561);}return null;};}function patchUpdates(_0x2e9faf){return function(_0xbccd17){try{jsonpatch[_0x42c3('0x20')](_0xbccd17,_0x2e9faf,!![]);}catch(_0x2f1302){return BPromise[_0x42c3('0x21')](_0x2f1302);}return _0xbccd17[_0x42c3('0x22')]();};}function saveUpdates(_0x10ada9,_0x2f2eec){return function(_0x237a6d){if(_0x237a6d){return _0x237a6d[_0x42c3('0x23')](_0x10ada9)[_0x42c3('0x24')](function(_0x3720fd){return _0x3720fd;});}return null;};}function removeEntity(_0x1f1174,_0x131af5){return function(_0x14f943){if(_0x14f943){return _0x14f943[_0x42c3('0x25')]()[_0x42c3('0x24')](function(){var _0x295831=_0x14f943[_0x42c3('0x26')]({'plain':!![]});var _0x13d7ae=_0x42c3('0x27');return db[_0x42c3('0x28')]['destroy']({'where':{'type':_0x13d7ae,'resourceId':_0x295831['id']}})[_0x42c3('0x24')](function(){return _0x14f943;});})[_0x42c3('0x24')](function(){_0x1f1174[_0x42c3('0x19')](0xcc)[_0x42c3('0x1a')]();});}};}function handleEntityNotFound(_0x20bfd9,_0x35412b){return function(_0x2caeb4){if(!_0x2caeb4){_0x20bfd9[_0x42c3('0x29')](0x194);}return _0x2caeb4;};}function handleError(_0x320383,_0x16176e){_0x16176e=_0x16176e||0x1f4;return function(_0x3f170c){logger['error'](_0x3f170c['stack']);if(_0x3f170c[_0x42c3('0x2a')]){delete _0x3f170c[_0x42c3('0x2a')];}_0x320383[_0x42c3('0x19')](_0x16176e)[_0x42c3('0x2b')](_0x3f170c);};}exports[_0x42c3('0x2c')]=function(_0x533739,_0x1205b8){var _0x51e85c={},_0x2c019e={},_0x5cbf48={'count':0x0,'rows':[]};var _0x34b2d3=_[_0x42c3('0x2d')](db[_0x42c3('0x2e')][_0x42c3('0x2f')],function(_0x47390f){return{'name':_0x47390f[_0x42c3('0x30')],'type':_0x47390f[_0x42c3('0x31')]['key']};});_0x2c019e[_0x42c3('0x32')]=_[_0x42c3('0x2d')](_0x34b2d3,_0x42c3('0x2a'));_0x2c019e[_0x42c3('0x33')]=_[_0x42c3('0x34')](_0x533739[_0x42c3('0x33')]);_0x2c019e[_0x42c3('0x35')]=_[_0x42c3('0x36')](_0x2c019e['model'],_0x2c019e[_0x42c3('0x33')]);_0x51e85c['attributes']=_[_0x42c3('0x36')](_0x2c019e[_0x42c3('0x32')],qs[_0x42c3('0x37')](_0x533739['query'][_0x42c3('0x37')]));_0x51e85c[_0x42c3('0x38')]=_0x51e85c[_0x42c3('0x38')][_0x42c3('0x39')]?_0x51e85c[_0x42c3('0x38')]:_0x2c019e[_0x42c3('0x32')];if(!_0x533739[_0x42c3('0x33')][_0x42c3('0x3a')](_0x42c3('0x3b'))){_0x51e85c[_0x42c3('0x1e')]=qs[_0x42c3('0x1e')](_0x533739[_0x42c3('0x33')][_0x42c3('0x1e')]);_0x51e85c[_0x42c3('0x1d')]=qs[_0x42c3('0x1d')](_0x533739[_0x42c3('0x33')][_0x42c3('0x1d')]);}_0x51e85c['order']=qs[_0x42c3('0x3c')](_0x533739['query'][_0x42c3('0x3c')]);_0x51e85c[_0x42c3('0x3d')]=qs[_0x42c3('0x35')](_[_0x42c3('0x3e')](_0x533739[_0x42c3('0x33')],_0x2c019e[_0x42c3('0x35')]),_0x34b2d3);if(_0x533739['query']['filter']){_0x51e85c[_0x42c3('0x3d')]=_[_0x42c3('0x3f')](_0x51e85c[_0x42c3('0x3d')],{'$or':_['map'](_0x34b2d3,function(_0x454e34){if(_0x454e34[_0x42c3('0x31')]!==_0x42c3('0x40')){var _0x40b0b9={};_0x40b0b9[_0x454e34['name']]={'$like':'%'+_0x533739[_0x42c3('0x33')][_0x42c3('0x41')]+'%'};return _0x40b0b9;}})});}_0x51e85c=_[_0x42c3('0x3f')]({},_0x51e85c,_0x533739[_0x42c3('0x42')]);var _0x3c8b46={'where':_0x51e85c[_0x42c3('0x3d')]};return db[_0x42c3('0x2e')][_0x42c3('0x1c')](_0x3c8b46)[_0x42c3('0x24')](function(_0x3aa0d9){_0x5cbf48['count']=_0x3aa0d9;if(_0x533739[_0x42c3('0x33')][_0x42c3('0x43')]){_0x51e85c[_0x42c3('0x44')]=[{'all':!![]}];}return db[_0x42c3('0x2e')][_0x42c3('0x45')](_0x51e85c);})['then'](function(_0x2a05db){_0x5cbf48[_0x42c3('0x46')]=_0x2a05db;return _0x5cbf48;})[_0x42c3('0x24')](respondWithFilteredResult(_0x1205b8,_0x51e85c))[_0x42c3('0x47')](handleError(_0x1205b8,null));};exports[_0x42c3('0x48')]=function(_0x3050f3,_0x4cc8aa){var _0x18c24c={'raw':!![],'where':{'id':_0x3050f3[_0x42c3('0x49')]['id']}},_0x3c5afd={};_0x3c5afd[_0x42c3('0x32')]=_['keys'](db[_0x42c3('0x2e')][_0x42c3('0x2f')]);_0x3c5afd[_0x42c3('0x33')]=_[_0x42c3('0x34')](_0x3050f3[_0x42c3('0x33')]);_0x3c5afd[_0x42c3('0x35')]=_[_0x42c3('0x36')](_0x3c5afd[_0x42c3('0x32')],_0x3c5afd['query']);_0x18c24c[_0x42c3('0x38')]=_[_0x42c3('0x36')](_0x3c5afd[_0x42c3('0x32')],qs[_0x42c3('0x37')](_0x3050f3[_0x42c3('0x33')]['fields']));_0x18c24c[_0x42c3('0x38')]=_0x18c24c[_0x42c3('0x38')][_0x42c3('0x39')]?_0x18c24c[_0x42c3('0x38')]:_0x3c5afd[_0x42c3('0x32')];if(_0x3050f3['query'][_0x42c3('0x43')]){_0x18c24c[_0x42c3('0x44')]=[{'all':!![]}];}_0x18c24c=_[_0x42c3('0x3f')]({},_0x18c24c,_0x3050f3[_0x42c3('0x42')]);return db[_0x42c3('0x2e')][_0x42c3('0x4a')](_0x18c24c)['then'](handleEntityNotFound(_0x4cc8aa,null))['then'](respondWithResult(_0x4cc8aa,null))[_0x42c3('0x47')](handleError(_0x4cc8aa,null));};exports['create']=function(_0x5cffa5,_0x43ac98){return db['UserWhatsappInteraction'][_0x42c3('0x4b')](_0x5cffa5[_0x42c3('0x4c')],{})[_0x42c3('0x24')](function(_0x4b0160){var _0x2e3ed6=_0x5cffa5[_0x42c3('0x4d')][_0x42c3('0x26')]({'plain':!![]});if(!_0x2e3ed6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e3ed6[_0x42c3('0x4e')]===_0x42c3('0x4d')){var _0x38e31d=_0x4b0160['get']({'plain':!![]});var _0x4729ff='UserWhatsappInteractions';return db['UserProfileSection'][_0x42c3('0x4a')]({'where':{'name':_0x4729ff,'userProfileId':_0x2e3ed6[_0x42c3('0x4f')]},'raw':!![]})[_0x42c3('0x24')](function(_0x5edf21){if(_0x5edf21&&_0x5edf21[_0x42c3('0x50')]===0x0){return db[_0x42c3('0x28')]['create']({'name':_0x38e31d[_0x42c3('0x2a')],'resourceId':_0x38e31d['id'],'type':_0x5edf21[_0x42c3('0x2a')],'sectionId':_0x5edf21['id']},{})[_0x42c3('0x24')](function(){return _0x4b0160;});}else{return _0x4b0160;}})[_0x42c3('0x47')](function(_0x55c793){logger[_0x42c3('0x51')](_0x42c3('0x52'),_0x55c793);throw _0x55c793;});}return _0x4b0160;})['then'](respondWithResult(_0x43ac98,0xc9))[_0x42c3('0x47')](handleError(_0x43ac98,null));};exports[_0x42c3('0x23')]=function(_0x7488db,_0x14d25e){if(_0x7488db['body']['id']){delete _0x7488db[_0x42c3('0x4c')]['id'];}return db[_0x42c3('0x2e')]['find']({'where':{'id':_0x7488db['params']['id']}})['then'](handleEntityNotFound(_0x14d25e,null))['then'](saveUpdates(_0x7488db[_0x42c3('0x4c')],null))[_0x42c3('0x24')](respondWithResult(_0x14d25e,null))[_0x42c3('0x47')](handleError(_0x14d25e,null));};exports['destroy']=function(_0x27f5c1,_0x45f1a3){return db['UserWhatsappInteraction'][_0x42c3('0x4a')]({'where':{'id':_0x27f5c1['params']['id']}})[_0x42c3('0x24')](handleEntityNotFound(_0x45f1a3,null))[_0x42c3('0x24')](removeEntity(_0x45f1a3,null))[_0x42c3('0x47')](handleError(_0x45f1a3,null));}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js index 68ed886..391ce37 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 _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 +var _0x88fd=['bluebird','request-promise','rimraf','./UserWhatsappInteraction.attributes','define','user_has_whatsapp_interactions','lodash','util','../../config/logger','api','moment'];(function(_0x4ef64b,_0x245ad3){var _0x37dce9=function(_0x55208b){while(--_0x55208b){_0x4ef64b['push'](_0x4ef64b['shift']());}};_0x37dce9(++_0x245ad3);}(_0x88fd,0x1df));var _0xd88f=function(_0x1f8331,_0x443900){_0x1f8331=_0x1f8331-0x0;var _0x240dce=_0x88fd[_0x1f8331];return _0x240dce;};'use strict';var _=require(_0xd88f('0x0'));var util=require(_0xd88f('0x1'));var logger=require(_0xd88f('0x2'))(_0xd88f('0x3'));var moment=require(_0xd88f('0x4'));var BPromise=require(_0xd88f('0x5'));var rp=require(_0xd88f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd88f('0x7'));var config=require('../../config/environment');var attributes=require(_0xd88f('0x8'));module['exports']=function(_0x2ccc69,_0x44647d){return _0x2ccc69[_0xd88f('0x9')]('UserWhatsappInteraction',attributes,{'tableName':_0xd88f('0xa'),'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 af2bf05..40295b7 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 _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 +var _0x33f3=['rpc','../../config/environment','jayson/promise','http','request','then','info','UserWhatsappInteraction,\x20%s,\x20%s','debug','UserWhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x395155,_0x192ffd){var _0x179767=function(_0xb18ee3){while(--_0xb18ee3){_0x395155['push'](_0x395155['shift']());}};_0x179767(++_0x192ffd);}(_0x33f3,0x1a1));var _0x333f=function(_0x2cd9e8,_0x3520ed){_0x2cd9e8=_0x2cd9e8-0x0;var _0x2f712f=_0x33f3[_0x2cd9e8];return _0x2f712f;};'use strict';var _=require(_0x333f('0x0'));var util=require(_0x333f('0x1'));var moment=require(_0x333f('0x2'));var BPromise=require('bluebird');var rs=require(_0x333f('0x3'));var fs=require('fs');var Redis=require(_0x333f('0x4'));var db=require(_0x333f('0x5'))['db'];var utils=require(_0x333f('0x6'));var logger=require(_0x333f('0x7'))(_0x333f('0x8'));var config=require(_0x333f('0x9'));var jayson=require(_0x333f('0xa'));var client=jayson['client'][_0x333f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18ef46,_0x2529fd,_0x7f6b08){return new BPromise(function(_0xb677ae,_0x4204bf){return client[_0x333f('0xc')](_0x18ef46,_0x7f6b08)[_0x333f('0xd')](function(_0x496695){logger[_0x333f('0xe')](_0x333f('0xf'),_0x2529fd,'request\x20sent');logger[_0x333f('0x10')](_0x333f('0x11'),_0x2529fd,_0x333f('0x12'),JSON[_0x333f('0x13')](_0x496695));if(_0x496695[_0x333f('0x14')]){if(_0x496695['error'][_0x333f('0x15')]===0x1f4){logger[_0x333f('0x14')](_0x333f('0xf'),_0x2529fd,_0x496695[_0x333f('0x14')]['message']);return _0x4204bf(_0x496695[_0x333f('0x14')]['message']);}logger[_0x333f('0x14')](_0x333f('0xf'),_0x2529fd,_0x496695[_0x333f('0x14')][_0x333f('0x16')]);return _0xb677ae(_0x496695[_0x333f('0x14')][_0x333f('0x16')]);}else{logger[_0x333f('0xe')](_0x333f('0xf'),_0x2529fd,_0x333f('0x12'));_0xb677ae(_0x496695[_0x333f('0x17')][_0x333f('0x16')]);}})[_0x333f('0x18')](function(_0x21b7eb){logger['error']('UserWhatsappInteraction,\x20%s,\x20%s',_0x2529fd,_0x21b7eb);_0x4204bf(_0x21b7eb);});});} \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/index.js b/server/api/UserWhatsappInteraction/index.js index 16b0cfd..e61996c 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 _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 +var _0x3609=['get','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./UserWhatsappInteraction.controller'];(function(_0x3b6688,_0x1f58b1){var _0x1d6d89=function(_0x236c55){while(--_0x236c55){_0x3b6688['push'](_0x3b6688['shift']());}};_0x1d6d89(++_0x1f58b1);}(_0x3609,0x101));var _0x9360=function(_0x498008,_0x60f88d){_0x498008=_0x498008-0x0;var _0x531260=_0x3609[_0x498008];return _0x531260;};'use strict';var multer=require(_0x9360('0x0'));var util=require(_0x9360('0x1'));var path=require(_0x9360('0x2'));var timeout=require(_0x9360('0x3'));var express=require(_0x9360('0x4'));var router=express[_0x9360('0x5')]();var auth=require(_0x9360('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9360('0x7'));var controller=require(_0x9360('0x8'));router[_0x9360('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9360('0xa'),auth[_0x9360('0xb')](),controller['show']);router[_0x9360('0xc')]('/',auth[_0x9360('0xb')](),controller[_0x9360('0xd')]);router[_0x9360('0xe')](_0x9360('0xa'),auth[_0x9360('0xb')](),controller[_0x9360('0xf')]);router[_0x9360('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9360('0x11')]);module[_0x9360('0x12')]=router; \ No newline at end of file diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 7d37f98..1cda36d 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 _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 +var _0xb282=['jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','STRING','contactManager','integration','motionbar'];(function(_0x48a020,_0x492242){var _0x4756f8=function(_0x52c50e){while(--_0x52c50e){_0x48a020['push'](_0x48a020['shift']());}};_0x4756f8(++_0x492242);}(_0xb282,0xf8));var _0x2b28=function(_0x464bdc,_0xb0a019){_0x464bdc=_0x464bdc-0x0;var _0x1b1f84=_0xb282[_0x464bdc];return _0x1b1f84;};'use strict';var Sequelize=require(_0x2b28('0x0'));module[_0x2b28('0x1')]={'name':{'type':Sequelize[_0x2b28('0x2')],'get':function(_0x3722f7){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0x2b28('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x2b28('0x4'),_0x2b28('0x5'),_0x2b28('0x6'),_0x2b28('0x7'),_0x2b28('0x8'),_0x2b28('0x9'),_0x2b28('0xa'),_0x2b28('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x2b28('0xc')},'data1':{'type':Sequelize[_0x2b28('0x3')](0x1000),'comment':_0x2b28('0xd')},'data2':{'type':Sequelize[_0x2b28('0x3')](0x1000),'comment':_0x2b28('0xe')},'data3':{'type':Sequelize[_0x2b28('0x3')](0x1000),'comment':_0x2b28('0xf')},'data4':{'type':Sequelize[_0x2b28('0x3')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x2b28('0x10')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index d4fd953..2cb2935 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 _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 +var _0x15b2=['moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','json','reject','update','then','end','error','stack','name','body','Action','params','catch','find','eml-format','zip-dir','fast-json-patch'];(function(_0x392c8f,_0x7c843c){var _0x389e3c=function(_0x14516b){while(--_0x14516b){_0x392c8f['push'](_0x392c8f['shift']());}};_0x389e3c(++_0x7c843c);}(_0x15b2,0x145));var _0x215b=function(_0x4a45e2,_0x4873af){_0x4a45e2=_0x4a45e2-0x0;var _0x13a8e7=_0x15b2[_0x4a45e2];return _0x13a8e7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x215b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x215b('0x1'));var jsonpatch=require(_0x215b('0x2'));var rp=require('request-promise');var moment=require(_0x215b('0x3'));var BPromise=require(_0x215b('0x4'));var Mustache=require(_0x215b('0x5'));var util=require(_0x215b('0x6'));var path=require('path');var sox=require(_0x215b('0x7'));var csv=require('to-csv');var ejs=require(_0x215b('0x8'));var fs=require('fs');var _=require(_0x215b('0x9'));var squel=require(_0x215b('0xa'));var crypto=require(_0x215b('0xb'));var jsforce=require(_0x215b('0xc'));var deskjs=require(_0x215b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x215b('0xe'));var Papa=require(_0x215b('0xf'));var Redis=require('ioredis');var authService=require(_0x215b('0x10'));var qs=require(_0x215b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x215b('0x12'))('api');var utils=require(_0x215b('0x13'));var config=require(_0x215b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x215b('0x15'))['db'];function respondWithStatusCode(_0x49a9cc,_0x4a9360){_0x4a9360=_0x4a9360||0xcc;return function(_0x1cf40c){if(_0x1cf40c){return _0x49a9cc['sendStatus'](_0x4a9360);}return _0x49a9cc[_0x215b('0x16')](_0x4a9360)['end']();};}function respondWithResult(_0x2aa945,_0xc1d4d1){_0xc1d4d1=_0xc1d4d1||0xc8;return function(_0x38d765){if(_0x38d765){return _0x2aa945['status'](_0xc1d4d1)['json'](_0x38d765);}};}function respondWithFilteredResult(_0x4c39d1,_0x1006fe){return function(_0x1c4030){if(_0x1c4030){var _0x2d04cb=_0x1c4030[_0x215b('0x17')],_0x2e96f5=_0x1006fe['offset'],_0x35508e=_0x1006fe[_0x215b('0x18')]+_0x1006fe[_0x215b('0x19')],_0x31a491;if(_0x35508e>=_0x2d04cb){_0x35508e=_0x2d04cb;_0x31a491=0xc8;}else{_0x31a491=0xce;}_0x4c39d1[_0x215b('0x16')](_0x31a491);return _0x4c39d1[_0x215b('0x1a')](_0x215b('0x1b'),_0x2e96f5+'-'+_0x35508e+'/'+_0x2d04cb)[_0x215b('0x1c')](_0x1c4030);}return null;};}function patchUpdates(_0x3ef620){return function(_0x2a1921){try{jsonpatch['apply'](_0x2a1921,_0x3ef620,!![]);}catch(_0x534e73){return BPromise[_0x215b('0x1d')](_0x534e73);}return _0x2a1921['save']();};}function saveUpdates(_0x16732d,_0xac9792){return function(_0x2f9ed2){if(_0x2f9ed2){return _0x2f9ed2[_0x215b('0x1e')](_0x16732d)[_0x215b('0x1f')](function(_0x1a40a5){return _0x1a40a5;});}return null;};}function removeEntity(_0x7e413c,_0x1a41c0){return function(_0x5cce5d){if(_0x5cce5d){return _0x5cce5d['destroy']()[_0x215b('0x1f')](function(){_0x7e413c['status'](0xcc)[_0x215b('0x20')]();});}};}function handleEntityNotFound(_0x267af9,_0x48568a){return function(_0x91587a){if(!_0x91587a){_0x267af9['sendStatus'](0x194);}return _0x91587a;};}function handleError(_0x43e2dd,_0x286834){_0x286834=_0x286834||0x1f4;return function(_0x1b7c12){logger[_0x215b('0x21')](_0x1b7c12[_0x215b('0x22')]);if(_0x1b7c12[_0x215b('0x23')]){delete _0x1b7c12[_0x215b('0x23')];}_0x43e2dd[_0x215b('0x16')](_0x286834)['send'](_0x1b7c12);};}exports[_0x215b('0x1e')]=function(_0x1f1a6f,_0x47d96d){if(_0x1f1a6f[_0x215b('0x24')]['id']){delete _0x1f1a6f[_0x215b('0x24')]['id'];}return db[_0x215b('0x25')]['find']({'where':{'id':_0x1f1a6f[_0x215b('0x26')]['id']}})[_0x215b('0x1f')](handleEntityNotFound(_0x47d96d,null))[_0x215b('0x1f')](saveUpdates(_0x1f1a6f[_0x215b('0x24')],null))[_0x215b('0x1f')](respondWithResult(_0x47d96d,null))[_0x215b('0x27')](handleError(_0x47d96d,null));};exports['destroy']=function(_0x4698a0,_0x3903b7){return db[_0x215b('0x25')][_0x215b('0x28')]({'where':{'id':_0x4698a0['params']['id']}})['then'](handleEntityNotFound(_0x3903b7,null))['then'](removeEntity(_0x3903b7,null))['catch'](handleError(_0x3903b7,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 6ed76be..c438d69 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 _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 +var _0x1ce5=['./action.attributes','exports','define','Action','tools_actions','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1ce5,0x7a));var _0x51ce=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x1ce5[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x51ce('0x0'));var util=require(_0x51ce('0x1'));var logger=require('../../config/logger')(_0x51ce('0x2'));var moment=require(_0x51ce('0x3'));var BPromise=require('bluebird');var rp=require(_0x51ce('0x4'));var fs=require('fs');var path=require(_0x51ce('0x5'));var rimraf=require(_0x51ce('0x6'));var config=require(_0x51ce('0x7'));var attributes=require(_0x51ce('0x8'));module[_0x51ce('0x9')]=function(_0x24c858,_0x37cc3b){return _0x24c858[_0x51ce('0xa')](_0x51ce('0xb'),attributes,{'tableName':_0x51ce('0xc'),'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 fe23ed0..b2c8d18 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 _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 +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x4cea31,_0x54ef05){var _0x30bf16=function(_0x1530a7){while(--_0x1530a7){_0x4cea31['push'](_0x4cea31['shift']());}};_0x30bf16(++_0x54ef05);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index b1c5b1c..b04bc0d 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 _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 +var _0x0855=['isAuthenticated','delete','destroy','exports','util','path','express','Router','../../config/environment','put','/:id'];(function(_0x4c1c0f,_0x4606d2){var _0x300028=function(_0x2084a8){while(--_0x2084a8){_0x4c1c0f['push'](_0x4c1c0f['shift']());}};_0x300028(++_0x4606d2);}(_0x0855,0xe0));var _0x5085=function(_0x451681,_0x5136f9){_0x451681=_0x451681-0x0;var _0x5d08c0=_0x0855[_0x451681];return _0x5d08c0;};'use strict';var multer=require('multer');var util=require(_0x5085('0x0'));var path=require(_0x5085('0x1'));var timeout=require('connect-timeout');var express=require(_0x5085('0x2'));var router=express[_0x5085('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5085('0x4'));var controller=require('./action.controller');router[_0x5085('0x5')](_0x5085('0x6'),auth[_0x5085('0x7')](),controller['update']);router[_0x5085('0x8')](_0x5085('0x6'),auth[_0x5085('0x7')](),controller[_0x5085('0x9')]);module[_0x5085('0xa')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index f7a34d9..b0b62a0 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 _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 +var _0x9ac1=['sequelize','exports','STRING','TEXT'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x9ac1,0x1ac));var _0x19ac=function(_0x36d96b,_0x440d86){_0x36d96b=_0x36d96b-0x0;var _0x323ba0=_0x9ac1[_0x36d96b];return _0x323ba0;};'use strict';var Sequelize=require(_0x19ac('0x0'));module[_0x19ac('0x1')]={'name':{'type':Sequelize[_0x19ac('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x19ac('0x2')]},'parent':{'type':Sequelize[_0x19ac('0x2')]},'table':{'type':Sequelize[_0x19ac('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x19ac('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 10b9e13..ed89a01 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 _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 +var _0x02fe=['AnalyticCustomReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','params','keys','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%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','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','metric','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','value','ValidationErrorItem','function','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','startDate','endDate','info','child_process','../../components/export/','savename','countTable','COUNT(*)','run','keyBy','eml-format','rimraf','zip-dir','fast-json-patch','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','api','../../config/utils','../../config/environment','../../mysqldb','dbH','status','end','json','offset','limit','apply','reject','save','then','destroy','get','CustomReports','UserProfileResource','sendStatus','error','stack','name','send','index','map'];(function(_0x573281,_0x38947c){var _0x414f1a=function(_0x2320db){while(--_0x2320db){_0x573281['push'](_0x573281['shift']());}};_0x414f1a(++_0x38947c);}(_0x02fe,0x1b8));var _0xe02f=function(_0x5ef8fa,_0x2f753a){_0x5ef8fa=_0x5ef8fa-0x0;var _0x29e9dd=_0x02fe[_0x5ef8fa];return _0x29e9dd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe02f('0x0'));var rimraf=require(_0xe02f('0x1'));var zipdir=require(_0xe02f('0x2'));var jsonpatch=require(_0xe02f('0x3'));var rp=require(_0xe02f('0x4'));var moment=require(_0xe02f('0x5'));var BPromise=require(_0xe02f('0x6'));var Mustache=require(_0xe02f('0x7'));var util=require(_0xe02f('0x8'));var path=require(_0xe02f('0x9'));var sox=require(_0xe02f('0xa'));var csv=require(_0xe02f('0xb'));var ejs=require(_0xe02f('0xc'));var fs=require('fs');var _=require(_0xe02f('0xd'));var squel=require(_0xe02f('0xe'));var crypto=require(_0xe02f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xe02f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe02f('0x11'));var Papa=require(_0xe02f('0x12'));var Redis=require(_0xe02f('0x13'));var authService=require(_0xe02f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe02f('0x15'));var hardwareService=require(_0xe02f('0x16'));var logger=require(_0xe02f('0x17'))(_0xe02f('0x18'));var utils=require(_0xe02f('0x19'));var config=require(_0xe02f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe02f('0x1b'))['db'];var dbH=require(_0xe02f('0x1b'))[_0xe02f('0x1c')];function respondWithStatusCode(_0x2e0b21,_0x445c46){_0x445c46=_0x445c46||0xcc;return function(_0x4e6c5d){if(_0x4e6c5d){return _0x2e0b21['sendStatus'](_0x445c46);}return _0x2e0b21[_0xe02f('0x1d')](_0x445c46)[_0xe02f('0x1e')]();};}function respondWithResult(_0x35fe54,_0x5ed618){_0x5ed618=_0x5ed618||0xc8;return function(_0x5b5e3b){if(_0x5b5e3b){return _0x35fe54[_0xe02f('0x1d')](_0x5ed618)[_0xe02f('0x1f')](_0x5b5e3b);}};}function respondWithFilteredResult(_0x5ece1c,_0x489434){return function(_0x4f1198){if(_0x4f1198){var _0x3b1ff1=_0x4f1198['count'],_0x20d376=_0x489434[_0xe02f('0x20')],_0x4c5ed0=_0x489434[_0xe02f('0x20')]+_0x489434[_0xe02f('0x21')],_0x1ded9d;if(_0x4c5ed0>=_0x3b1ff1){_0x4c5ed0=_0x3b1ff1;_0x1ded9d=0xc8;}else{_0x1ded9d=0xce;}_0x5ece1c[_0xe02f('0x1d')](_0x1ded9d);return _0x5ece1c['set']('Content-Range',_0x20d376+'-'+_0x4c5ed0+'/'+_0x3b1ff1)[_0xe02f('0x1f')](_0x4f1198);}return null;};}function patchUpdates(_0x488d1e){return function(_0x1703aa){try{jsonpatch[_0xe02f('0x22')](_0x1703aa,_0x488d1e,!![]);}catch(_0x2d9b4d){return BPromise[_0xe02f('0x23')](_0x2d9b4d);}return _0x1703aa[_0xe02f('0x24')]();};}function saveUpdates(_0x2e8cdb,_0x4067e2){return function(_0x4b8ad8){if(_0x4b8ad8){return _0x4b8ad8['update'](_0x2e8cdb)[_0xe02f('0x25')](function(_0x1197fb){return _0x1197fb;});}return null;};}function removeEntity(_0x252385,_0x246c73){return function(_0x5eb0b9){if(_0x5eb0b9){return _0x5eb0b9[_0xe02f('0x26')]()[_0xe02f('0x25')](function(){var _0x53dfaa=_0x5eb0b9[_0xe02f('0x27')]({'plain':!![]});var _0xf17f29=_0xe02f('0x28');return db[_0xe02f('0x29')][_0xe02f('0x26')]({'where':{'type':_0xf17f29,'resourceId':_0x53dfaa['id']}})['then'](function(){return _0x5eb0b9;});})[_0xe02f('0x25')](function(){_0x252385['status'](0xcc)[_0xe02f('0x1e')]();});}};}function handleEntityNotFound(_0x4fa9ea,_0xd35be5){return function(_0x314ecf){if(!_0x314ecf){_0x4fa9ea[_0xe02f('0x2a')](0x194);}return _0x314ecf;};}function handleError(_0xa8d9ee,_0x18ce7c){_0x18ce7c=_0x18ce7c||0x1f4;return function(_0x35b481){logger[_0xe02f('0x2b')](_0x35b481[_0xe02f('0x2c')]);if(_0x35b481[_0xe02f('0x2d')]){delete _0x35b481[_0xe02f('0x2d')];}_0xa8d9ee['status'](_0x18ce7c)[_0xe02f('0x2e')](_0x35b481);};}exports[_0xe02f('0x2f')]=function(_0xf06764,_0x29ede1){var _0x389d59={},_0x17ff3e={},_0x25601c={'count':0x0,'rows':[]};var _0x98d21e=_[_0xe02f('0x30')](db[_0xe02f('0x31')]['rawAttributes'],function(_0x4d5c23){return{'name':_0x4d5c23[_0xe02f('0x32')],'type':_0x4d5c23[_0xe02f('0x33')][_0xe02f('0x34')]};});_0x17ff3e[_0xe02f('0x35')]=_['map'](_0x98d21e,_0xe02f('0x2d'));_0x17ff3e[_0xe02f('0x36')]=_['keys'](_0xf06764['query']);_0x17ff3e[_0xe02f('0x37')]=_[_0xe02f('0x38')](_0x17ff3e[_0xe02f('0x35')],_0x17ff3e['query']);_0x389d59[_0xe02f('0x39')]=_[_0xe02f('0x38')](_0x17ff3e[_0xe02f('0x35')],qs['fields'](_0xf06764[_0xe02f('0x36')][_0xe02f('0x3a')]));_0x389d59['attributes']=_0x389d59[_0xe02f('0x39')][_0xe02f('0x3b')]?_0x389d59['attributes']:_0x17ff3e[_0xe02f('0x35')];if(!_0xf06764['query']['hasOwnProperty'](_0xe02f('0x3c'))){_0x389d59['limit']=qs[_0xe02f('0x21')](_0xf06764['query'][_0xe02f('0x21')]);_0x389d59[_0xe02f('0x20')]=qs['offset'](_0xf06764['query'][_0xe02f('0x20')]);}_0x389d59[_0xe02f('0x3d')]=qs[_0xe02f('0x3e')](_0xf06764[_0xe02f('0x36')][_0xe02f('0x3e')]);_0x389d59[_0xe02f('0x3f')]=qs[_0xe02f('0x37')](_[_0xe02f('0x40')](_0xf06764[_0xe02f('0x36')],_0x17ff3e[_0xe02f('0x37')]),_0x98d21e);if(_0xf06764['query'][_0xe02f('0x41')]){_0x389d59[_0xe02f('0x3f')]=_[_0xe02f('0x42')](_0x389d59[_0xe02f('0x3f')],{'$or':_[_0xe02f('0x30')](_0x98d21e,function(_0x211c18){if(_0x211c18['type']!==_0xe02f('0x43')){var _0x27f6b1={};_0x27f6b1[_0x211c18[_0xe02f('0x2d')]]={'$like':'%'+_0xf06764[_0xe02f('0x36')][_0xe02f('0x41')]+'%'};return _0x27f6b1;}})});}_0x389d59=_[_0xe02f('0x42')]({},_0x389d59,_0xf06764[_0xe02f('0x44')]);var _0x7646db={'where':_0x389d59[_0xe02f('0x3f')]};return db[_0xe02f('0x31')][_0xe02f('0x45')](_0x7646db)['then'](function(_0x5e62f0){_0x25601c[_0xe02f('0x45')]=_0x5e62f0;if(_0xf06764[_0xe02f('0x36')]['includeAll']){_0x389d59[_0xe02f('0x46')]=[{'all':!![]}];}return db[_0xe02f('0x31')][_0xe02f('0x47')](_0x389d59);})[_0xe02f('0x25')](function(_0x8ea357){_0x25601c[_0xe02f('0x48')]=_0x8ea357;return _0x25601c;})['then'](respondWithFilteredResult(_0x29ede1,_0x389d59))['catch'](handleError(_0x29ede1,null));};exports['show']=function(_0x45cbab,_0x47b5a3){var _0x2e842f={'raw':![],'where':{'id':_0x45cbab[_0xe02f('0x49')]['id']}},_0x2318a0={};_0x2318a0['model']=_[_0xe02f('0x4a')](db[_0xe02f('0x31')]['rawAttributes']);_0x2318a0[_0xe02f('0x36')]=_[_0xe02f('0x4a')](_0x45cbab[_0xe02f('0x36')]);_0x2318a0['filters']=_[_0xe02f('0x38')](_0x2318a0[_0xe02f('0x35')],_0x2318a0['query']);_0x2e842f[_0xe02f('0x39')]=_[_0xe02f('0x38')](_0x2318a0[_0xe02f('0x35')],qs[_0xe02f('0x3a')](_0x45cbab[_0xe02f('0x36')][_0xe02f('0x3a')]));_0x2e842f[_0xe02f('0x39')]=_0x2e842f[_0xe02f('0x39')][_0xe02f('0x3b')]?_0x2e842f['attributes']:_0x2318a0[_0xe02f('0x35')];if(_0x45cbab['query'][_0xe02f('0x4b')]){_0x2e842f['include']=[{'all':!![]}];}_0x2e842f=_[_0xe02f('0x42')]({},_0x2e842f,_0x45cbab[_0xe02f('0x44')]);return db[_0xe02f('0x31')][_0xe02f('0x4c')](_0x2e842f)[_0xe02f('0x25')](handleEntityNotFound(_0x47b5a3,null))[_0xe02f('0x25')](respondWithResult(_0x47b5a3,null))[_0xe02f('0x4d')](handleError(_0x47b5a3,null));};exports[_0xe02f('0x4e')]=function(_0x17fc8b,_0x4ca463){return db[_0xe02f('0x31')][_0xe02f('0x4e')](_0x17fc8b['body'],{})[_0xe02f('0x25')](function(_0x45b0c9){var _0x33ad0c=_0x17fc8b[_0xe02f('0x4f')][_0xe02f('0x27')]({'plain':!![]});if(!_0x33ad0c)throw new Error(_0xe02f('0x50'));if(_0x33ad0c['role']===_0xe02f('0x4f')){var _0x55d6c1=_0x45b0c9[_0xe02f('0x27')]({'plain':!![]});var _0x2649cd='Reports';return db['UserProfileSection'][_0xe02f('0x4c')]({'where':{'name':_0x2649cd,'userProfileId':_0x33ad0c['userProfileId']},'raw':!![]})['then'](function(_0x21f7f8){if(_0x21f7f8&&_0x21f7f8[_0xe02f('0x51')]===0x0){return db[_0xe02f('0x29')][_0xe02f('0x4e')]({'name':_0x55d6c1[_0xe02f('0x2d')],'resourceId':_0x55d6c1['id'],'type':_0xe02f('0x28'),'sectionId':_0x21f7f8['id']},{})['then'](function(){return _0x45b0c9;});}else{return _0x45b0c9;}})['catch'](function(_0x1470dc){logger[_0xe02f('0x2b')](_0xe02f('0x52'),_0x1470dc);throw _0x1470dc;});}return _0x45b0c9;})[_0xe02f('0x25')](respondWithResult(_0x4ca463,0xc9))['catch'](handleError(_0x4ca463,null));};exports[_0xe02f('0x53')]=function(_0x1e8169,_0x3f8e92){if(_0x1e8169[_0xe02f('0x54')]['id']){delete _0x1e8169[_0xe02f('0x54')]['id'];}return db[_0xe02f('0x31')][_0xe02f('0x4c')]({'where':{'id':_0x1e8169[_0xe02f('0x49')]['id']}})[_0xe02f('0x25')](handleEntityNotFound(_0x3f8e92,null))[_0xe02f('0x25')](saveUpdates(_0x1e8169[_0xe02f('0x54')],null))[_0xe02f('0x25')](respondWithResult(_0x3f8e92,null))[_0xe02f('0x4d')](handleError(_0x3f8e92,null));};exports[_0xe02f('0x26')]=function(_0x4bc4fa,_0x561924){return db[_0xe02f('0x31')]['find']({'where':{'id':_0x4bc4fa[_0xe02f('0x49')]['id']}})['then'](handleEntityNotFound(_0x561924,null))[_0xe02f('0x25')](removeEntity(_0x561924,null))['catch'](handleError(_0x561924,null));};exports[_0xe02f('0x55')]=function(_0x261de3,_0x8ed22b){var _0x35ffcb=0xa;var _0x5233fa=[_0xe02f('0x56'),'left_join',_0xe02f('0x57'),'cross_join'];var _0x3bba20={'SUM':_0xe02f('0x58'),'COUNT':_0xe02f('0x59'),'COUNT DISTINCT':_0xe02f('0x5a'),'MAX':'MAX(%s)','MIN':_0xe02f('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xe02f('0x5c'),'GROUP_CONCAT ASC':_0xe02f('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4dd6f7={'SEC_TO_TIME':_0xe02f('0x5e'),'DATE':_0xe02f('0x5f'),'HOUR':_0xe02f('0x60'),'ROUND':_0xe02f('0x61'),'UNIX_TIMESTAMP':_0xe02f('0x62')};var _0x221e12=function(_0x4d67b8){return!_[_0xe02f('0x63')]([_0xe02f('0x64'),_0xe02f('0x65'),_0xe02f('0x66'),_0xe02f('0x67')],_0x4d67b8);};var _0x1930b9=function(_0x4fe505){if(!_0x4fe505||!_0x4fe505[_0xe02f('0x68')][_0xe02f('0x3b')]){return'';}for(var _0x51e886='(',_0x341285=0x0;_0x341285<_0x4fe505[_0xe02f('0x68')][_0xe02f('0x3b')];_0x341285+=0x1){_0x341285>0x0&&(_0x51e886+='\x20'+_0x4fe505[_0xe02f('0x69')]+'\x20');_0x51e886+=_0x4fe505[_0xe02f('0x68')][_0x341285][_0xe02f('0x6a')]?_0x1930b9(_0x4fe505[_0xe02f('0x68')][_0x341285]['group']):_0x4fe505['rules'][_0x341285][_0xe02f('0x6b')]+'\x20'+_0x4fe505[_0xe02f('0x68')][_0x341285][_0xe02f('0x6c')]+(_0x221e12(_0x4fe505[_0xe02f('0x68')][_0x341285][_0xe02f('0x6c')])?'\x20'+_0x4fe505[_0xe02f('0x68')][_0x341285]['value']:'');}return _0x51e886+')';};var _0x40ea13={'where':{'id':_0x261de3[_0xe02f('0x49')]['id']}},_0x211b2a,_0x207c40,_0x237ddd,_0x5732fd,_0x5343c9;_0x40ea13=_[_0xe02f('0x42')]({},_0x40ea13,_0x261de3[_0xe02f('0x44')]);return db['AnalyticCustomReport']['find'](_0x40ea13)['then'](function(_0x46ac4f){if(_0x46ac4f){_0x211b2a=_0x46ac4f;return _0x46ac4f[_0xe02f('0x6d')]();}return null;})['then'](function(_0x3a05e5){if(_0x3a05e5){if(!_0x3a05e5[_0xe02f('0x3b')]){throw new db[(_0xe02f('0x6e'))]['ValidationErrorItem'](_0xe02f('0x6f'),0x193);}_0x207c40=_0x3a05e5;return db[_0xe02f('0x70')][_0xe02f('0x47')]({'raw':!![]});}return null;})[_0xe02f('0x25')](function(_0x453260){if(_0x453260){_0x237ddd=_['keyBy'](_0x453260,'id');var _0x296e5e;var _0x525f90=squel[_0xe02f('0x71')]();_0x525f90[_0xe02f('0x72')](_0x211b2a[_0xe02f('0x73')]);for(var _0x4d566e=0x0;_0x4d566e<_0x207c40['length'];_0x4d566e+=0x1){_0x296e5e=_0x207c40[_0x4d566e][_0xe02f('0x74')]?_0x237ddd[_0x207c40[_0x4d566e][_0xe02f('0x74')]][_0xe02f('0x75')]:_0x207c40[_0x4d566e]['field'];_0x296e5e=_0x207c40[_0x4d566e]['function']?_[_0xe02f('0x76')](_0x3bba20[_0x207c40[_0x4d566e]['function']],'%s',_0x296e5e):_0x296e5e;_0x296e5e=_0x207c40[_0x4d566e]['format']?_[_0xe02f('0x76')](_0x4dd6f7[_0x207c40[_0x4d566e]['format']],'%s',_0x296e5e):_0x296e5e;if(_0x207c40[_0x4d566e][_0xe02f('0x77')]){_0x525f90[_0xe02f('0x6a')](_0x296e5e);}_0x207c40[_0x4d566e][_0xe02f('0x78')]&&_0x525f90[_0xe02f('0x3d')](_0x296e5e,_0x207c40[_0x4d566e][_0xe02f('0x78')]===_0xe02f('0x79')?![]:!![]);_0x525f90[_0xe02f('0x6b')](_0x296e5e,_0x207c40[_0x4d566e][_0xe02f('0x7a')]||_0x296e5e);}if(_0x211b2a[_0xe02f('0x7b')]){_0x211b2a['joins']=JSON[_0xe02f('0x7c')](_0x211b2a['joins']);for(var _0x3eb6b3=0x0;_0x3eb6b3<_0x211b2a[_0xe02f('0x7b')][_0xe02f('0x3b')];_0x3eb6b3+=0x1){if(_0x211b2a[_0xe02f('0x7b')][_0x3eb6b3][_0xe02f('0x33')]&&_['includes'](_0x5233fa,_0x211b2a[_0xe02f('0x7b')][_0x3eb6b3]['type'])&&_0x211b2a['joins'][_0x3eb6b3][_0xe02f('0x7d')]&&_0x211b2a[_0xe02f('0x7b')][_0x3eb6b3][_0xe02f('0x7e')]&&_0x211b2a[_0xe02f('0x7b')][_0x3eb6b3][_0xe02f('0x7f')]){_0x525f90[_0x211b2a['joins'][_0x3eb6b3]['type']](_0x211b2a[_0xe02f('0x7b')][_0x3eb6b3]['foreignTable'],null,util[_0xe02f('0x80')](_0xe02f('0x81'),_0x211b2a['table'],_0x211b2a[_0xe02f('0x7b')][_0x3eb6b3][_0xe02f('0x7d')],_0x211b2a[_0xe02f('0x7b')][_0x3eb6b3][_0xe02f('0x7e')],_0x211b2a[_0xe02f('0x7b')][_0x3eb6b3]['foreignKey']));}}}if(_0x211b2a[_0xe02f('0x82')]){_0x211b2a['conditions']=JSON[_0xe02f('0x7c')](_0x211b2a['conditions']);_0x525f90[_0xe02f('0x3f')](_0x1930b9(_0x211b2a[_0xe02f('0x82')][_0xe02f('0x6a')]));}_0x5343c9=_0x525f90[_0xe02f('0x83')]();_0x525f90[_0xe02f('0x21')](_0x35ffcb);_0x525f90['offset'](0x0);logger[_0xe02f('0x84')](_0xe02f('0x85'),_0x525f90[_0xe02f('0x86')]());return dbH['sequelize'][_0xe02f('0x36')](_0x525f90[_0xe02f('0x86')](),{'type':dbH[_0xe02f('0x87')][_0xe02f('0x88')][_0xe02f('0x89')]});}})['then'](respondWithResult(_0x8ed22b,null))['catch'](handleError(_0x8ed22b,null));};function runReport(_0x160c72,_0x5e1fc6,_0x3e1ca2){var _0xbab504=_0x5e1fc6[_0xe02f('0x2d')];var _0x5de61d=0xa;var _0x3c6472=[_0xe02f('0x56'),'left_join',_0xe02f('0x57'),_0xe02f('0x8a')];var _0x4a7190={'SUM':_0xe02f('0x58'),'COUNT':_0xe02f('0x59'),'COUNT DISTINCT':_0xe02f('0x5a'),'MAX':_0xe02f('0x8b'),'MIN':_0xe02f('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xe02f('0x5c'),'GROUP_CONCAT ASC':_0xe02f('0x5d'),'GROUP_CONCAT DESC':_0xe02f('0x8c')};var _0x4f4ed1={'SEC_TO_TIME':_0xe02f('0x5e'),'DATE':'DATE(%s)','HOUR':_0xe02f('0x60'),'ROUND':_0xe02f('0x61'),'UNIX_TIMESTAMP':_0xe02f('0x62')};var _0x3598c9=function(_0x166ef9){return!_[_0xe02f('0x63')]([_0xe02f('0x64'),_0xe02f('0x65'),'IS\x20EMPTY',_0xe02f('0x67')],_0x166ef9);};var _0x5dfc51=function(_0x31f6ad){if(!_0x31f6ad||!_0x31f6ad[_0xe02f('0x68')][_0xe02f('0x3b')]){return'';}for(var _0x4b78cb='(',_0x147e5f=0x0;_0x147e5f<_0x31f6ad[_0xe02f('0x68')][_0xe02f('0x3b')];_0x147e5f+=0x1){_0x147e5f>0x0&&(_0x4b78cb+='\x20'+_0x31f6ad[_0xe02f('0x69')]+'\x20');_0x4b78cb+=_0x31f6ad[_0xe02f('0x68')][_0x147e5f][_0xe02f('0x6a')]?_0x5dfc51(_0x31f6ad[_0xe02f('0x68')][_0x147e5f][_0xe02f('0x6a')]):_0x31f6ad[_0xe02f('0x68')][_0x147e5f][_0xe02f('0x6b')]+'\x20'+_0x31f6ad['rules'][_0x147e5f]['condition']+(_0x3598c9(_0x31f6ad[_0xe02f('0x68')][_0x147e5f][_0xe02f('0x6c')])?'\x20'+_0x31f6ad[_0xe02f('0x68')][_0x147e5f][_0xe02f('0x8d')]:'');}return _0x4b78cb+')';};var _0x2ebc93={'where':{'id':_0x160c72['id']}},_0x3a0f9b,_0x5a762c,_0x489775,_0x4377db,_0x5221de;_0x2ebc93=_[_0xe02f('0x42')]({},_0x2ebc93,_0x3e1ca2);return db[_0xe02f('0x31')][_0xe02f('0x4c')](_0x2ebc93)[_0xe02f('0x25')](function(_0x543007){if(_0x543007){_0x3a0f9b=_0x543007;return _0x543007[_0xe02f('0x6d')]();}return null;})[_0xe02f('0x25')](function(_0x839b05){if(_0x839b05){if(!_0x839b05[_0xe02f('0x3b')]){throw new db[(_0xe02f('0x6e'))][(_0xe02f('0x8e'))](_0xe02f('0x6f'),0x193);}_0x5a762c=_0x839b05;return db['AnalyticMetric'][_0xe02f('0x47')]({'raw':!![]});}return null;})[_0xe02f('0x25')](function(_0x428164){if(_0x428164){_0x489775=_['keyBy'](_0x428164,'id');var _0x10c1c6;var _0x2101c3=squel['select']();_0x2101c3[_0xe02f('0x72')](_0x3a0f9b['table']);for(var _0x233296=0x0;_0x233296<_0x5a762c[_0xe02f('0x3b')];_0x233296+=0x1){_0x10c1c6=_0x5a762c[_0x233296][_0xe02f('0x74')]?_0x489775[_0x5a762c[_0x233296][_0xe02f('0x74')]][_0xe02f('0x75')]:_0x5a762c[_0x233296][_0xe02f('0x6b')];_0x10c1c6=_0x5a762c[_0x233296][_0xe02f('0x8f')]?_['replace'](_0x4a7190[_0x5a762c[_0x233296][_0xe02f('0x8f')]],'%s',_0x10c1c6):_0x10c1c6;_0x10c1c6=_0x5a762c[_0x233296]['format']?_[_0xe02f('0x76')](_0x4f4ed1[_0x5a762c[_0x233296][_0xe02f('0x80')]],'%s',_0x10c1c6):_0x10c1c6;if(_0x5a762c[_0x233296][_0xe02f('0x77')]){_0x2101c3[_0xe02f('0x6a')](_0x10c1c6);}_0x5a762c[_0x233296]['orderBy']&&_0x2101c3[_0xe02f('0x3d')](_0x10c1c6,_0x5a762c[_0x233296][_0xe02f('0x78')]===_0xe02f('0x79')?![]:!![]);_0x2101c3[_0xe02f('0x6b')](_0x10c1c6,_0x5a762c[_0x233296]['alias']||_0x10c1c6);}if(_0x3a0f9b[_0xe02f('0x7b')]){_0x3a0f9b['joins']=JSON['parse'](_0x3a0f9b['joins']);for(var _0x272f0c=0x0;_0x272f0c<_0x3a0f9b[_0xe02f('0x7b')][_0xe02f('0x3b')];_0x272f0c+=0x1){if(_0x3a0f9b[_0xe02f('0x7b')][_0x272f0c]['type']&&_[_0xe02f('0x63')](_0x3c6472,_0x3a0f9b[_0xe02f('0x7b')][_0x272f0c][_0xe02f('0x33')])&&_0x3a0f9b[_0xe02f('0x7b')][_0x272f0c]['parentKey']&&_0x3a0f9b[_0xe02f('0x7b')][_0x272f0c]['foreignTable']&&_0x3a0f9b[_0xe02f('0x7b')][_0x272f0c][_0xe02f('0x7f')]){_0x2101c3[_0x3a0f9b[_0xe02f('0x7b')][_0x272f0c][_0xe02f('0x33')]](_0x3a0f9b[_0xe02f('0x7b')][_0x272f0c][_0xe02f('0x7e')],null,util['format'](_0xe02f('0x81'),_0x3a0f9b[_0xe02f('0x73')],_0x3a0f9b['joins'][_0x272f0c]['parentKey'],_0x3a0f9b[_0xe02f('0x7b')][_0x272f0c][_0xe02f('0x7e')],_0x3a0f9b[_0xe02f('0x7b')][_0x272f0c][_0xe02f('0x7f')]));}}}if(_0x3a0f9b[_0xe02f('0x82')]){_0x3a0f9b[_0xe02f('0x82')]=JSON[_0xe02f('0x7c')](_0x3a0f9b[_0xe02f('0x82')]);_0x2101c3[_0xe02f('0x3f')](_0x5dfc51(_0x3a0f9b[_0xe02f('0x82')][_0xe02f('0x6a')]));}_0x5221de=_0x2101c3['clone']();_0x2101c3[_0xe02f('0x21')](_0x5de61d);_0x2101c3[_0xe02f('0x20')](0x0);return;}})[_0xe02f('0x25')](function(){if(_0x5e1fc6[_0xe02f('0x90')]==='web'){return null;}var _0x5651f4=_[_0xe02f('0x42')](_0x5e1fc6,{'name':_0x5e1fc6[_0xe02f('0x91')]||_0x5e1fc6[_0xe02f('0x2d')]||_0x3a0f9b['name'],'basename':_0xbab504,'savename':util[_0xe02f('0x80')](_0xe02f('0x92'),_0x5e1fc6[_0xe02f('0x2d')]||_0x3a0f9b[_0xe02f('0x2d')],require(_0xe02f('0x93'))[_0xe02f('0x94')](0x4),_0x5e1fc6['output']||_0xe02f('0x95')),'reportId':_0x3a0f9b['id'],'reportType':_0xe02f('0x96')});return db[_0xe02f('0x97')][_0xe02f('0x4e')](_0x5651f4,{'raw':!![]});})[_0xe02f('0x25')](function(_0x4b0c67){if(_0x3a0f9b[_0xe02f('0x73')]===_0xe02f('0x98')){_0x5221de[_0xe02f('0x3f')](_0x3a0f9b['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x5e1fc6['startDate'],_0x5e1fc6['endDate']);}else{_0x5221de[_0xe02f('0x3f')](_0x3a0f9b[_0xe02f('0x73')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5e1fc6[_0xe02f('0x99')],_0x5e1fc6[_0xe02f('0x9a')]);}if(_0x4b0c67){logger[_0xe02f('0x9b')]('Run\x20Query:',_0x5221de['toString']());require(_0xe02f('0x9c'))['fork'](path[_0xe02f('0x56')](__dirname,_0xe02f('0x9d'),_0x4b0c67[_0xe02f('0x90')]),[_0x4b0c67['id'],_0x5221de[_0xe02f('0x86')](),path[_0xe02f('0x56')](__dirname,'../../files/reports',_0x4b0c67[_0xe02f('0x9e')]),_0xbab504]);return _0x4b0c67;}else{var _0x157c73=squel[_0xe02f('0x71')]();_0x157c73[_0xe02f('0x72')]('('+_0x5221de[_0xe02f('0x86')]()+')',_0xe02f('0x9f'));_0x157c73[_0xe02f('0x6b')](_0xe02f('0xa0'),'count');_0x5221de['limit'](_0x5e1fc6[_0xe02f('0x21')]||_0x5de61d);_0x5221de[_0xe02f('0x20')](_0x5e1fc6['offset']||0x0);return dbH[_0xe02f('0x87')]['query'](_0x157c73[_0xe02f('0x86')](),{'type':dbH['sequelize'][_0xe02f('0x88')][_0xe02f('0x89')]})['then'](function(_0x5c26f0){if(!_0x5c26f0[_0xe02f('0x3b')]){_0x4377db=0x0;}else{_0x4377db=_0x5c26f0[0x0][_0xe02f('0x45')]||0x0;}return dbH[_0xe02f('0x87')][_0xe02f('0x36')](_0x5221de['toString'](),{'type':dbH[_0xe02f('0x87')][_0xe02f('0x88')][_0xe02f('0x89')]});})['then'](function(_0x44e734){return{'rows':_0x44e734||[],'count':_0x4377db};});}});}exports[_0xe02f('0xa1')]=function(_0x281253,_0x4ee4fe){return runReport(_0x281253[_0xe02f('0x49')],_0x281253[_0xe02f('0x36')],_0x281253[_0xe02f('0x44')])[_0xe02f('0x25')](respondWithResult(_0x4ee4fe,null))[_0xe02f('0x4d')](handleError(_0x4ee4fe,null));};exports['runReport']=runReport;exports[_0xe02f('0x36')]=function(_0x14d6c9,_0x43eeff){var _0x12dc13=0xa;var _0x1ae9db=[_0xe02f('0x56'),'left_join',_0xe02f('0x57'),_0xe02f('0x8a')];var _0xdf384a={'SUM':'SUM(%s)','COUNT':_0xe02f('0x59'),'COUNT DISTINCT':_0xe02f('0x5a'),'MAX':_0xe02f('0x8b'),'MIN':_0xe02f('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xe02f('0x5c'),'GROUP_CONCAT ASC':_0xe02f('0x5d'),'GROUP_CONCAT DESC':_0xe02f('0x8c')};var _0x5979df={'SEC_TO_TIME':_0xe02f('0x5e'),'DATE':_0xe02f('0x5f'),'HOUR':_0xe02f('0x60'),'ROUND':_0xe02f('0x61'),'UNIX_TIMESTAMP':_0xe02f('0x62')};var _0x5a0f3b=function(_0x3c050a){return!_[_0xe02f('0x63')]([_0xe02f('0x64'),_0xe02f('0x65'),_0xe02f('0x66'),'IS\x20NOT\x20EMPTY'],_0x3c050a);};var _0x244585=function(_0x18440e){if(!_0x18440e||!_0x18440e[_0xe02f('0x68')][_0xe02f('0x3b')]){return'';}for(var _0x1820fb='(',_0x18b286=0x0;_0x18b286<_0x18440e[_0xe02f('0x68')][_0xe02f('0x3b')];_0x18b286+=0x1){_0x18b286>0x0&&(_0x1820fb+='\x20'+_0x18440e['operator']+'\x20');_0x1820fb+=_0x18440e[_0xe02f('0x68')][_0x18b286][_0xe02f('0x6a')]?_0x244585(_0x18440e[_0xe02f('0x68')][_0x18b286][_0xe02f('0x6a')]):_0x18440e[_0xe02f('0x68')][_0x18b286]['field']+'\x20'+_0x18440e[_0xe02f('0x68')][_0x18b286][_0xe02f('0x6c')]+(_0x5a0f3b(_0x18440e[_0xe02f('0x68')][_0x18b286]['condition'])?'\x20'+_0x18440e[_0xe02f('0x68')][_0x18b286][_0xe02f('0x8d')]:'');}return _0x1820fb+')';};var _0x31cd1f={'where':{'id':_0x14d6c9[_0xe02f('0x49')]['id']}},_0x5dab89,_0x3a4460,_0x2b3ef5,_0x2a0355,_0x338489;_0x31cd1f=_[_0xe02f('0x42')]({},_0x31cd1f,_0x14d6c9[_0xe02f('0x44')]);return db[_0xe02f('0x31')]['find'](_0x31cd1f)[_0xe02f('0x25')](function(_0x579311){if(_0x579311){_0x5dab89=_0x579311;return _0x579311[_0xe02f('0x6d')]();}return null;})[_0xe02f('0x25')](function(_0x573385){if(_0x573385){if(!_0x573385['length']){throw new db[(_0xe02f('0x6e'))][(_0xe02f('0x8e'))](_0xe02f('0x6f'),0x193);}_0x3a4460=_0x573385;return db['AnalyticMetric'][_0xe02f('0x47')]({'raw':!![]});}return null;})[_0xe02f('0x25')](function(_0x12595c){if(_0x12595c){_0x2b3ef5=_[_0xe02f('0xa2')](_0x12595c,'id');var _0x1ac3f7;var _0x398c05=squel[_0xe02f('0x71')]();_0x398c05[_0xe02f('0x72')](_0x5dab89['table']);for(var _0x12609b=0x0;_0x12609b<_0x3a4460['length'];_0x12609b+=0x1){_0x1ac3f7=_0x3a4460[_0x12609b][_0xe02f('0x74')]?_0x2b3ef5[_0x3a4460[_0x12609b][_0xe02f('0x74')]][_0xe02f('0x75')]:_0x3a4460[_0x12609b][_0xe02f('0x6b')];_0x1ac3f7=_0x3a4460[_0x12609b][_0xe02f('0x8f')]?_[_0xe02f('0x76')](_0xdf384a[_0x3a4460[_0x12609b][_0xe02f('0x8f')]],'%s',_0x1ac3f7):_0x1ac3f7;_0x1ac3f7=_0x3a4460[_0x12609b][_0xe02f('0x80')]?_[_0xe02f('0x76')](_0x5979df[_0x3a4460[_0x12609b]['format']],'%s',_0x1ac3f7):_0x1ac3f7;if(_0x3a4460[_0x12609b][_0xe02f('0x77')]){_0x398c05[_0xe02f('0x6a')](_0x1ac3f7);}_0x3a4460[_0x12609b][_0xe02f('0x78')]&&_0x398c05[_0xe02f('0x3d')](_0x1ac3f7,_0x3a4460[_0x12609b][_0xe02f('0x78')]===_0xe02f('0x79')?![]:!![]);_0x398c05[_0xe02f('0x6b')](_0x1ac3f7,_0x3a4460[_0x12609b]['alias']||_0x1ac3f7);}if(_0x5dab89['joins']){_0x5dab89[_0xe02f('0x7b')]=JSON['parse'](_0x5dab89[_0xe02f('0x7b')]);for(var _0x565056=0x0;_0x565056<_0x5dab89[_0xe02f('0x7b')][_0xe02f('0x3b')];_0x565056+=0x1){if(_0x5dab89['joins'][_0x565056][_0xe02f('0x33')]&&_[_0xe02f('0x63')](_0x1ae9db,_0x5dab89[_0xe02f('0x7b')][_0x565056][_0xe02f('0x33')])&&_0x5dab89['joins'][_0x565056][_0xe02f('0x7d')]&&_0x5dab89[_0xe02f('0x7b')][_0x565056][_0xe02f('0x7e')]&&_0x5dab89['joins'][_0x565056]['foreignKey']){_0x398c05[_0x5dab89['joins'][_0x565056][_0xe02f('0x33')]](_0x5dab89[_0xe02f('0x7b')][_0x565056]['foreignTable'],null,util['format'](_0xe02f('0x81'),_0x5dab89[_0xe02f('0x73')],_0x5dab89[_0xe02f('0x7b')][_0x565056][_0xe02f('0x7d')],_0x5dab89[_0xe02f('0x7b')][_0x565056][_0xe02f('0x7e')],_0x5dab89[_0xe02f('0x7b')][_0x565056]['foreignKey']));}}}if(_0x5dab89['conditions']){_0x5dab89[_0xe02f('0x82')]=JSON[_0xe02f('0x7c')](_0x5dab89[_0xe02f('0x82')]);_0x398c05[_0xe02f('0x3f')](_0x244585(_0x5dab89[_0xe02f('0x82')][_0xe02f('0x6a')]));}_0x338489=_0x398c05[_0xe02f('0x83')]();_0x398c05['limit'](_0x12dc13);_0x398c05['offset'](0x0);logger[_0xe02f('0x84')](_0xe02f('0x85'),_0x398c05['toString']());return dbH[_0xe02f('0x87')][_0xe02f('0x36')](_0x398c05[_0xe02f('0x86')](),{'type':dbH[_0xe02f('0x87')][_0xe02f('0x88')][_0xe02f('0x89')]});}})[_0xe02f('0x25')](function(){return{'sql':_0x338489[_0xe02f('0x86')]()};})[_0xe02f('0x25')](respondWithResult(_0x43eeff,null))[_0xe02f('0x4d')](handleError(_0x43eeff,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index dfd4133..e14fa78 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 _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 +var _0x1f7b=['bluebird','request-promise','path','rimraf','define','analytics_custom_reports','lodash','../../config/logger','api','moment'];(function(_0x33a364,_0x4b904a){var _0x34fa78=function(_0x37aef6){while(--_0x37aef6){_0x33a364['push'](_0x33a364['shift']());}};_0x34fa78(++_0x4b904a);}(_0x1f7b,0x1b4));var _0xb1f7=function(_0x532685,_0x1a38c2){_0x532685=_0x532685-0x0;var _0x21426a=_0x1f7b[_0x532685];return _0x21426a;};'use strict';var _=require(_0xb1f7('0x0'));var util=require('util');var logger=require(_0xb1f7('0x1'))(_0xb1f7('0x2'));var moment=require(_0xb1f7('0x3'));var BPromise=require(_0xb1f7('0x4'));var rp=require(_0xb1f7('0x5'));var fs=require('fs');var path=require(_0xb1f7('0x6'));var rimraf=require(_0xb1f7('0x7'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x19cc78,_0x287664){return _0x19cc78[_0xb1f7('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0xb1f7('0x9'),'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 3f825a7..0cd0da1 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 _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 +var _0xd4f5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment'];(function(_0x28fa8f,_0x110107){var _0x520903=function(_0x5ba257){while(--_0x5ba257){_0x28fa8f['push'](_0x28fa8f['shift']());}};_0x520903(++_0x110107);}(_0xd4f5,0x1d8));var _0x5d4f=function(_0x265468,_0xcf7439){_0x265468=_0x265468-0x0;var _0x37d555=_0xd4f5[_0x265468];return _0x37d555;};'use strict';var _=require(_0x5d4f('0x0'));var util=require(_0x5d4f('0x1'));var moment=require(_0x5d4f('0x2'));var BPromise=require(_0x5d4f('0x3'));var rs=require(_0x5d4f('0x4'));var fs=require('fs');var Redis=require(_0x5d4f('0x5'));var db=require(_0x5d4f('0x6'))['db'];var utils=require(_0x5d4f('0x7'));var logger=require(_0x5d4f('0x8'))('rpc');var config=require(_0x5d4f('0x9'));var jayson=require(_0x5d4f('0xa'));var client=jayson[_0x5d4f('0xb')][_0x5d4f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ccd25,_0x4dac21,_0x4833ab){return new BPromise(function(_0x1bf35e,_0x3f64dc){return client[_0x5d4f('0xd')](_0x2ccd25,_0x4833ab)[_0x5d4f('0xe')](function(_0xa2625){logger[_0x5d4f('0xf')](_0x5d4f('0x10'),_0x4dac21,_0x5d4f('0x11'));logger['debug'](_0x5d4f('0x12'),_0x4dac21,_0x5d4f('0x11'),JSON[_0x5d4f('0x13')](_0xa2625));if(_0xa2625['error']){if(_0xa2625['error'][_0x5d4f('0x14')]===0x1f4){logger[_0x5d4f('0x15')](_0x5d4f('0x10'),_0x4dac21,_0xa2625[_0x5d4f('0x15')]['message']);return _0x3f64dc(_0xa2625[_0x5d4f('0x15')][_0x5d4f('0x16')]);}logger[_0x5d4f('0x15')](_0x5d4f('0x10'),_0x4dac21,_0xa2625[_0x5d4f('0x15')]['message']);return _0x1bf35e(_0xa2625[_0x5d4f('0x15')][_0x5d4f('0x16')]);}else{logger['info'](_0x5d4f('0x10'),_0x4dac21,'request\x20sent');_0x1bf35e(_0xa2625[_0x5d4f('0x17')][_0x5d4f('0x16')]);}})[_0x5d4f('0x18')](function(_0x36ee32){logger[_0x5d4f('0x15')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4dac21,_0x36ee32);_0x3f64dc(_0x36ee32);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 9fddc69..2726e0f 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 _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 +var _0x983e=['../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','query','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x279755,_0x42ad77){var _0x138178=function(_0x462033){while(--_0x462033){_0x279755['push'](_0x279755['shift']());}};_0x138178(++_0x42ad77);}(_0x983e,0x1c0));var _0xe983=function(_0x285252,_0x113b0f){_0x285252=_0x285252-0x0;var _0xbb1266=_0x983e[_0x285252];return _0xbb1266;};'use strict';var multer=require(_0xe983('0x0'));var util=require(_0xe983('0x1'));var path=require(_0xe983('0x2'));var timeout=require(_0xe983('0x3'));var express=require(_0xe983('0x4'));var router=express[_0xe983('0x5')]();var auth=require(_0xe983('0x6'));var interaction=require(_0xe983('0x7'));var config=require(_0xe983('0x8'));var controller=require(_0xe983('0x9'));router[_0xe983('0xa')]('/',auth[_0xe983('0xb')](),controller[_0xe983('0xc')]);router[_0xe983('0xa')](_0xe983('0xd'),auth[_0xe983('0xb')](),controller[_0xe983('0xe')]);router['get'](_0xe983('0xf'),auth[_0xe983('0xb')](),controller[_0xe983('0x10')]);router[_0xe983('0xa')](_0xe983('0x11'),auth[_0xe983('0xb')](),controller['run']);router[_0xe983('0xa')]('/:id/query',auth[_0xe983('0xb')](),controller[_0xe983('0x12')]);router['post']('/',auth[_0xe983('0xb')](),controller[_0xe983('0x13')]);router['put'](_0xe983('0xd'),auth[_0xe983('0xb')](),controller[_0xe983('0x14')]);router[_0xe983('0x15')](_0xe983('0xd'),auth[_0xe983('0xb')](),controller[_0xe983('0x16')]);module[_0xe983('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 32e3eba..3fa2c88 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 _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 +var _0x49b6=['TEXT','sequelize','exports','STRING'];(function(_0x300e3f,_0x34637a){var _0x2c008a=function(_0x1d55e7){while(--_0x1d55e7){_0x300e3f['push'](_0x300e3f['shift']());}};_0x2c008a(++_0x34637a);}(_0x49b6,0x1a1));var _0x649b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x49b6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x649b('0x0'));module[_0x649b('0x1')]={'name':{'type':Sequelize[_0x649b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x649b('0x2')]},'parent':{'type':Sequelize[_0x649b('0x2')]},'table':{'type':Sequelize[_0x649b('0x2')]},'conditions':{'type':Sequelize[_0x649b('0x3')]},'joins':{'type':Sequelize[_0x649b('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 12d105e..c16d218 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 _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 +var _0x8cb8=['html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','user','Reports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','MetricId','metric','function','replace','format','groupBy','order','orderBy','DESC','alias','joins','parentKey','foreignKey','foreignTable','table','conditions','parse','clone','debug','toString','sequelize','QueryTypes','SELECT','left_join','SUM(%s)','GROUP_CONCAT(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','value','AnalyticMetric','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','count','run','runReport'];(function(_0x5e27f2,_0x434e8d){var _0x51f4c6=function(_0x2fdcbe){while(--_0x2fdcbe){_0x5e27f2['push'](_0x5e27f2['shift']());}};_0x51f4c6(++_0x434e8d);}(_0x8cb8,0xa8));var _0x88cb=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0x8cb8[_0x9e0cb3];return _0x5926b7;};'use strict';var pdf=require(_0x88cb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x88cb('0x1'));var zipdir=require(_0x88cb('0x2'));var jsonpatch=require(_0x88cb('0x3'));var rp=require(_0x88cb('0x4'));var moment=require('moment');var BPromise=require(_0x88cb('0x5'));var Mustache=require(_0x88cb('0x6'));var util=require(_0x88cb('0x7'));var path=require(_0x88cb('0x8'));var sox=require(_0x88cb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x88cb('0xa'));var crypto=require(_0x88cb('0xb'));var jsforce=require(_0x88cb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x88cb('0xd'));var querystring=require(_0x88cb('0xe'));var Papa=require(_0x88cb('0xf'));var Redis=require(_0x88cb('0x10'));var authService=require(_0x88cb('0x11'));var qs=require(_0x88cb('0x12'));var as=require(_0x88cb('0x13'));var hardwareService=require(_0x88cb('0x14'));var logger=require(_0x88cb('0x15'))(_0x88cb('0x16'));var utils=require(_0x88cb('0x17'));var config=require(_0x88cb('0x18'));var licenseUtil=require(_0x88cb('0x19'));var db=require('../../mysqldb')['db'];var dbH=require(_0x88cb('0x1a'))['dbH'];function respondWithStatusCode(_0x5aca59,_0x871f91){_0x871f91=_0x871f91||0xcc;return function(_0x5253a4){if(_0x5253a4){return _0x5aca59[_0x88cb('0x1b')](_0x871f91);}return _0x5aca59[_0x88cb('0x1c')](_0x871f91)[_0x88cb('0x1d')]();};}function respondWithResult(_0x11a3f3,_0x516e27){_0x516e27=_0x516e27||0xc8;return function(_0x54fdb7){if(_0x54fdb7){return _0x11a3f3[_0x88cb('0x1c')](_0x516e27)[_0x88cb('0x1e')](_0x54fdb7);}};}function respondWithFilteredResult(_0x4aa05a,_0x26576f){return function(_0xebfad7){if(_0xebfad7){var _0x3dc46f=_0xebfad7['count'],_0x5a5d96=_0x26576f['offset'],_0x57be73=_0x26576f[_0x88cb('0x1f')]+_0x26576f[_0x88cb('0x20')],_0x515bf1;if(_0x57be73>=_0x3dc46f){_0x57be73=_0x3dc46f;_0x515bf1=0xc8;}else{_0x515bf1=0xce;}_0x4aa05a['status'](_0x515bf1);return _0x4aa05a[_0x88cb('0x21')]('Content-Range',_0x5a5d96+'-'+_0x57be73+'/'+_0x3dc46f)['json'](_0xebfad7);}return null;};}function patchUpdates(_0x4cbec5){return function(_0x1e468e){try{jsonpatch[_0x88cb('0x22')](_0x1e468e,_0x4cbec5,!![]);}catch(_0x24a3a5){return BPromise[_0x88cb('0x23')](_0x24a3a5);}return _0x1e468e[_0x88cb('0x24')]();};}function saveUpdates(_0x34dd10,_0x1e5061){return function(_0x1f3740){if(_0x1f3740){return _0x1f3740[_0x88cb('0x25')](_0x34dd10)[_0x88cb('0x26')](function(_0x20fd83){return _0x20fd83;});}return null;};}function removeEntity(_0x231aee,_0xef70fe){return function(_0x3996c0){if(_0x3996c0){return _0x3996c0['destroy']()[_0x88cb('0x26')](function(){var _0x2fa769=_0x3996c0[_0x88cb('0x27')]({'plain':!![]});var _0x5f1a48=_0x88cb('0x28');return db[_0x88cb('0x29')][_0x88cb('0x2a')]({'where':{'type':_0x5f1a48,'resourceId':_0x2fa769['id']}})['then'](function(){return _0x3996c0;});})['then'](function(){_0x231aee[_0x88cb('0x1c')](0xcc)[_0x88cb('0x1d')]();});}};}function handleEntityNotFound(_0xc338f6,_0x129903){return function(_0x4db179){if(!_0x4db179){_0xc338f6[_0x88cb('0x1b')](0x194);}return _0x4db179;};}function handleError(_0x32da7f,_0x46b472){_0x46b472=_0x46b472||0x1f4;return function(_0x1d54aa){logger[_0x88cb('0x2b')](_0x1d54aa[_0x88cb('0x2c')]);if(_0x1d54aa[_0x88cb('0x2d')]){delete _0x1d54aa[_0x88cb('0x2d')];}_0x32da7f[_0x88cb('0x1c')](_0x46b472)[_0x88cb('0x2e')](_0x1d54aa);};}exports['index']=function(_0x2ab08b,_0x2667b6){var _0x59b9f0={},_0x42b3a8={},_0x5869a0={'count':0x0,'rows':[]};var _0x3b1f6a=_[_0x88cb('0x2f')](db[_0x88cb('0x30')][_0x88cb('0x31')],function(_0x62f864){return{'name':_0x62f864[_0x88cb('0x32')],'type':_0x62f864[_0x88cb('0x33')][_0x88cb('0x34')]};});_0x42b3a8[_0x88cb('0x35')]=_[_0x88cb('0x2f')](_0x3b1f6a,_0x88cb('0x2d'));_0x42b3a8[_0x88cb('0x36')]=_['keys'](_0x2ab08b[_0x88cb('0x36')]);_0x42b3a8[_0x88cb('0x37')]=_['intersection'](_0x42b3a8[_0x88cb('0x35')],_0x42b3a8[_0x88cb('0x36')]);_0x59b9f0[_0x88cb('0x38')]=_[_0x88cb('0x39')](_0x42b3a8[_0x88cb('0x35')],qs[_0x88cb('0x3a')](_0x2ab08b[_0x88cb('0x36')]['fields']));_0x59b9f0[_0x88cb('0x38')]=_0x59b9f0[_0x88cb('0x38')][_0x88cb('0x3b')]?_0x59b9f0[_0x88cb('0x38')]:_0x42b3a8['model'];if(!_0x2ab08b[_0x88cb('0x36')][_0x88cb('0x3c')](_0x88cb('0x3d'))){_0x59b9f0['limit']=qs[_0x88cb('0x20')](_0x2ab08b[_0x88cb('0x36')]['limit']);_0x59b9f0['offset']=qs[_0x88cb('0x1f')](_0x2ab08b[_0x88cb('0x36')][_0x88cb('0x1f')]);}_0x59b9f0['order']=qs[_0x88cb('0x3e')](_0x2ab08b[_0x88cb('0x36')]['sort']);_0x59b9f0[_0x88cb('0x3f')]=qs['filters'](_[_0x88cb('0x40')](_0x2ab08b[_0x88cb('0x36')],_0x42b3a8[_0x88cb('0x37')]),_0x3b1f6a);if(_0x2ab08b[_0x88cb('0x36')][_0x88cb('0x41')]){_0x59b9f0[_0x88cb('0x3f')]=_[_0x88cb('0x42')](_0x59b9f0[_0x88cb('0x3f')],{'$or':_[_0x88cb('0x2f')](_0x3b1f6a,function(_0x1ff4f2){if(_0x1ff4f2[_0x88cb('0x33')]!==_0x88cb('0x43')){var _0x36260b={};_0x36260b[_0x1ff4f2[_0x88cb('0x2d')]]={'$like':'%'+_0x2ab08b[_0x88cb('0x36')]['filter']+'%'};return _0x36260b;}})});}_0x59b9f0=_[_0x88cb('0x42')]({},_0x59b9f0,_0x2ab08b[_0x88cb('0x44')]);var _0x5e96bb={'where':_0x59b9f0[_0x88cb('0x3f')]};return db['AnalyticDefaultReport']['count'](_0x5e96bb)[_0x88cb('0x26')](function(_0x8dd351){_0x5869a0['count']=_0x8dd351;if(_0x2ab08b['query'][_0x88cb('0x45')]){_0x59b9f0['include']=[{'all':!![]}];}return db[_0x88cb('0x30')][_0x88cb('0x46')](_0x59b9f0);})['then'](function(_0x36dbfe){_0x5869a0[_0x88cb('0x47')]=_0x36dbfe;return _0x5869a0;})[_0x88cb('0x26')](respondWithFilteredResult(_0x2667b6,_0x59b9f0))['catch'](handleError(_0x2667b6,null));};exports[_0x88cb('0x48')]=function(_0x163c7f,_0x3ffaa2){var _0x11928f={'raw':!![],'where':{'id':_0x163c7f[_0x88cb('0x49')]['id']}},_0xe34825={};_0xe34825[_0x88cb('0x35')]=_[_0x88cb('0x4a')](db['AnalyticDefaultReport']['rawAttributes']);_0xe34825[_0x88cb('0x36')]=_[_0x88cb('0x4a')](_0x163c7f[_0x88cb('0x36')]);_0xe34825[_0x88cb('0x37')]=_[_0x88cb('0x39')](_0xe34825[_0x88cb('0x35')],_0xe34825[_0x88cb('0x36')]);_0x11928f[_0x88cb('0x38')]=_['intersection'](_0xe34825[_0x88cb('0x35')],qs[_0x88cb('0x3a')](_0x163c7f[_0x88cb('0x36')][_0x88cb('0x3a')]));_0x11928f[_0x88cb('0x38')]=_0x11928f['attributes'][_0x88cb('0x3b')]?_0x11928f['attributes']:_0xe34825[_0x88cb('0x35')];if(_0x163c7f[_0x88cb('0x36')][_0x88cb('0x45')]){_0x11928f[_0x88cb('0x4b')]=[{'all':!![]}];}_0x11928f=_[_0x88cb('0x42')]({},_0x11928f,_0x163c7f[_0x88cb('0x44')]);return db[_0x88cb('0x30')][_0x88cb('0x4c')](_0x11928f)[_0x88cb('0x26')](handleEntityNotFound(_0x3ffaa2,null))[_0x88cb('0x26')](respondWithResult(_0x3ffaa2,null))[_0x88cb('0x4d')](handleError(_0x3ffaa2,null));};exports[_0x88cb('0x4e')]=function(_0x3774ee,_0x37502c){return db[_0x88cb('0x30')][_0x88cb('0x4e')](_0x3774ee[_0x88cb('0x4f')],{})[_0x88cb('0x26')](function(_0x48ffad){var _0x1cf200=_0x3774ee[_0x88cb('0x50')][_0x88cb('0x27')]({'plain':!![]});if(!_0x1cf200)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1cf200['role']===_0x88cb('0x50')){var _0x436532=_0x48ffad[_0x88cb('0x27')]({'plain':!![]});var _0x5aa6c4=_0x88cb('0x51');return db['UserProfileSection']['find']({'where':{'name':_0x5aa6c4,'userProfileId':_0x1cf200['userProfileId']},'raw':!![]})[_0x88cb('0x26')](function(_0x49a9b9){if(_0x49a9b9&&_0x49a9b9['autoAssociation']===0x0){return db[_0x88cb('0x29')]['create']({'name':_0x436532[_0x88cb('0x2d')],'resourceId':_0x436532['id'],'type':_0x88cb('0x28'),'sectionId':_0x49a9b9['id']},{})[_0x88cb('0x26')](function(){return _0x48ffad;});}else{return _0x48ffad;}})[_0x88cb('0x4d')](function(_0x519f8d){logger[_0x88cb('0x2b')](_0x88cb('0x52'),_0x519f8d);throw _0x519f8d;});}return _0x48ffad;})['then'](respondWithResult(_0x37502c,0xc9))['catch'](handleError(_0x37502c,null));};exports[_0x88cb('0x25')]=function(_0x1408b6,_0x345273){if(_0x1408b6['body']['id']){delete _0x1408b6[_0x88cb('0x4f')]['id'];}return db[_0x88cb('0x30')][_0x88cb('0x4c')]({'where':{'id':_0x1408b6[_0x88cb('0x49')]['id']}})[_0x88cb('0x26')](handleEntityNotFound(_0x345273,null))['then'](saveUpdates(_0x1408b6['body'],null))[_0x88cb('0x26')](respondWithResult(_0x345273,null))[_0x88cb('0x4d')](handleError(_0x345273,null));};exports[_0x88cb('0x2a')]=function(_0x1dbf01,_0x3adf8a){return db[_0x88cb('0x30')][_0x88cb('0x4c')]({'where':{'id':_0x1dbf01[_0x88cb('0x49')]['id']}})[_0x88cb('0x26')](handleEntityNotFound(_0x3adf8a,null))['then'](removeEntity(_0x3adf8a,null))[_0x88cb('0x4d')](handleError(_0x3adf8a,null));};exports[_0x88cb('0x53')]=function(_0x25dfac,_0x296444){var _0x555116=0xa;var _0x3a6f3a=[_0x88cb('0x54'),'left_join',_0x88cb('0x55'),_0x88cb('0x56')];var _0x135900={'SUM':'SUM(%s)','COUNT':_0x88cb('0x57'),'COUNT DISTINCT':_0x88cb('0x58'),'MAX':_0x88cb('0x59'),'MIN':_0x88cb('0x5a'),'AVG':_0x88cb('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x88cb('0x5c'),'GROUP_CONCAT DESC':_0x88cb('0x5d')};var _0x57c278={'SEC_TO_TIME':_0x88cb('0x5e'),'DATE':'DATE(%s)','HOUR':_0x88cb('0x5f'),'ROUND':_0x88cb('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x52ecd8=function(_0x5a519a){return!_[_0x88cb('0x61')](['IS\x20NULL',_0x88cb('0x62'),_0x88cb('0x63'),_0x88cb('0x64')],_0x5a519a);};var _0x10ab55=function(_0x10a038){if(!_0x10a038||!_0x10a038[_0x88cb('0x65')][_0x88cb('0x3b')]){return'';}for(var _0x55962f='(',_0x17d695=0x0;_0x17d695<_0x10a038[_0x88cb('0x65')][_0x88cb('0x3b')];_0x17d695+=0x1){_0x17d695>0x0&&(_0x55962f+='\x20'+_0x10a038[_0x88cb('0x66')]+'\x20');_0x55962f+=_0x10a038[_0x88cb('0x65')][_0x17d695][_0x88cb('0x67')]?_0x10ab55(_0x10a038['rules'][_0x17d695][_0x88cb('0x67')]):_0x10a038['rules'][_0x17d695][_0x88cb('0x68')]+'\x20'+_0x10a038[_0x88cb('0x65')][_0x17d695][_0x88cb('0x69')]+(_0x52ecd8(_0x10a038['rules'][_0x17d695]['condition'])?'\x20'+_0x10a038[_0x88cb('0x65')][_0x17d695]['value']:'');}return _0x55962f+')';};var _0x576048={'where':{'id':_0x25dfac[_0x88cb('0x49')]['id']}},_0x20d02d,_0x1bdb79,_0xfcfbdd,_0x1cfcb3,_0x2eb08f;_0x576048=_['merge']({},_0x576048,_0x25dfac[_0x88cb('0x44')]);return db['AnalyticDefaultReport']['find'](_0x576048)[_0x88cb('0x26')](function(_0x4f8bd6){if(_0x4f8bd6){_0x20d02d=_0x4f8bd6;return _0x4f8bd6[_0x88cb('0x6a')]();}return null;})[_0x88cb('0x26')](function(_0x33a8c6){if(_0x33a8c6){if(!_0x33a8c6['length']){throw new db[(_0x88cb('0x6b'))][(_0x88cb('0x6c'))](_0x88cb('0x6d'),0x193);}_0x1bdb79=_0x33a8c6;return db['AnalyticMetric'][_0x88cb('0x46')]({'raw':!![]});}return null;})[_0x88cb('0x26')](function(_0x13a0fd){if(_0x13a0fd){_0xfcfbdd=_[_0x88cb('0x6e')](_0x13a0fd,'id');var _0x55a089;var _0x1f29f1=squel[_0x88cb('0x6f')]();_0x1f29f1[_0x88cb('0x70')](_0x20d02d['table']);for(var _0x4a2f20=0x0;_0x4a2f20<_0x1bdb79[_0x88cb('0x3b')];_0x4a2f20+=0x1){_0x55a089=_0x1bdb79[_0x4a2f20]['MetricId']?_0xfcfbdd[_0x1bdb79[_0x4a2f20][_0x88cb('0x71')]][_0x88cb('0x72')]:_0x1bdb79[_0x4a2f20][_0x88cb('0x68')];_0x55a089=_0x1bdb79[_0x4a2f20][_0x88cb('0x73')]?_[_0x88cb('0x74')](_0x135900[_0x1bdb79[_0x4a2f20][_0x88cb('0x73')]],'%s',_0x55a089):_0x55a089;_0x55a089=_0x1bdb79[_0x4a2f20]['format']?_[_0x88cb('0x74')](_0x57c278[_0x1bdb79[_0x4a2f20][_0x88cb('0x75')]],'%s',_0x55a089):_0x55a089;if(_0x1bdb79[_0x4a2f20][_0x88cb('0x76')]){_0x1f29f1[_0x88cb('0x67')](_0x55a089);}_0x1bdb79[_0x4a2f20]['orderBy']&&_0x1f29f1[_0x88cb('0x77')](_0x55a089,_0x1bdb79[_0x4a2f20][_0x88cb('0x78')]===_0x88cb('0x79')?![]:!![]);_0x1f29f1['field'](_0x55a089,_0x1bdb79[_0x4a2f20][_0x88cb('0x7a')]||_0x55a089);}if(_0x20d02d[_0x88cb('0x7b')]){_0x20d02d[_0x88cb('0x7b')]=JSON['parse'](_0x20d02d[_0x88cb('0x7b')]);for(var _0x136274=0x0;_0x136274<_0x20d02d[_0x88cb('0x7b')][_0x88cb('0x3b')];_0x136274+=0x1){if(_0x20d02d[_0x88cb('0x7b')][_0x136274]['type']&&_[_0x88cb('0x61')](_0x3a6f3a,_0x20d02d['joins'][_0x136274]['type'])&&_0x20d02d[_0x88cb('0x7b')][_0x136274][_0x88cb('0x7c')]&&_0x20d02d['joins'][_0x136274]['foreignTable']&&_0x20d02d[_0x88cb('0x7b')][_0x136274][_0x88cb('0x7d')]){_0x1f29f1[_0x20d02d[_0x88cb('0x7b')][_0x136274][_0x88cb('0x33')]](_0x20d02d[_0x88cb('0x7b')][_0x136274][_0x88cb('0x7e')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x20d02d[_0x88cb('0x7f')],_0x20d02d['joins'][_0x136274][_0x88cb('0x7c')],_0x20d02d[_0x88cb('0x7b')][_0x136274][_0x88cb('0x7e')],_0x20d02d['joins'][_0x136274][_0x88cb('0x7d')]));}}}if(_0x20d02d['conditions']){_0x20d02d[_0x88cb('0x80')]=JSON[_0x88cb('0x81')](_0x20d02d[_0x88cb('0x80')]);_0x1f29f1[_0x88cb('0x3f')](_0x10ab55(_0x20d02d[_0x88cb('0x80')][_0x88cb('0x67')]));}_0x2eb08f=_0x1f29f1[_0x88cb('0x82')]();_0x1f29f1[_0x88cb('0x20')](_0x555116);_0x1f29f1[_0x88cb('0x1f')](0x0);logger[_0x88cb('0x83')]('Limited\x20Query:',_0x1f29f1[_0x88cb('0x84')]());return dbH[_0x88cb('0x85')]['query'](_0x1f29f1[_0x88cb('0x84')](),{'type':dbH[_0x88cb('0x85')][_0x88cb('0x86')][_0x88cb('0x87')]});}})['then'](respondWithResult(_0x296444,null))[_0x88cb('0x4d')](handleError(_0x296444,null));};function runReport(_0x30dfb8,_0x4f3f8e,_0x5857c3){var _0x34d78f=_0x4f3f8e[_0x88cb('0x2d')];var _0x1f6fb7=0xa;var _0x2f8a2d=['join',_0x88cb('0x88'),'right_join',_0x88cb('0x56')];var _0x1b0579={'SUM':_0x88cb('0x89'),'COUNT':_0x88cb('0x57'),'COUNT DISTINCT':_0x88cb('0x58'),'MAX':_0x88cb('0x59'),'MIN':_0x88cb('0x5a'),'AVG':_0x88cb('0x5b'),'GROUP_CONCAT':_0x88cb('0x8a'),'GROUP_CONCAT ASC':_0x88cb('0x5c'),'GROUP_CONCAT DESC':_0x88cb('0x5d')};var _0x22a7ae={'SEC_TO_TIME':_0x88cb('0x5e'),'DATE':_0x88cb('0x8b'),'HOUR':_0x88cb('0x5f'),'ROUND':_0x88cb('0x60'),'UNIX_TIMESTAMP':_0x88cb('0x8c')};var _0x4f47cc=function(_0x1ea32b){return!_[_0x88cb('0x61')]([_0x88cb('0x8d'),'IS\x20NOT\x20NULL',_0x88cb('0x63'),_0x88cb('0x64')],_0x1ea32b);};var _0x454fac=function(_0x42d37f){if(!_0x42d37f||!_0x42d37f[_0x88cb('0x65')][_0x88cb('0x3b')]){return'';}for(var _0x550468='(',_0x1b19e6=0x0;_0x1b19e6<_0x42d37f[_0x88cb('0x65')][_0x88cb('0x3b')];_0x1b19e6+=0x1){_0x1b19e6>0x0&&(_0x550468+='\x20'+_0x42d37f[_0x88cb('0x66')]+'\x20');_0x550468+=_0x42d37f[_0x88cb('0x65')][_0x1b19e6][_0x88cb('0x67')]?_0x454fac(_0x42d37f[_0x88cb('0x65')][_0x1b19e6][_0x88cb('0x67')]):_0x42d37f[_0x88cb('0x65')][_0x1b19e6]['field']+'\x20'+_0x42d37f[_0x88cb('0x65')][_0x1b19e6][_0x88cb('0x69')]+(_0x4f47cc(_0x42d37f[_0x88cb('0x65')][_0x1b19e6][_0x88cb('0x69')])?'\x20'+_0x42d37f[_0x88cb('0x65')][_0x1b19e6][_0x88cb('0x8e')]:'');}return _0x550468+')';};var _0x12fbf9={'where':{'id':_0x30dfb8['id']}},_0x2bafd4,_0xdaff87,_0x513af6,_0x25ccec,_0x2f72a5;_0x12fbf9=_[_0x88cb('0x42')]({},_0x12fbf9,_0x5857c3);return db[_0x88cb('0x30')][_0x88cb('0x4c')](_0x12fbf9)[_0x88cb('0x26')](function(_0x27b5b1){if(_0x27b5b1){_0x2bafd4=_0x27b5b1;return _0x27b5b1[_0x88cb('0x6a')]();}return null;})[_0x88cb('0x26')](function(_0x2a062c){if(_0x2a062c){if(!_0x2a062c['length']){throw new db['Sequelize'][(_0x88cb('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xdaff87=_0x2a062c;return db[_0x88cb('0x8f')][_0x88cb('0x46')]({'raw':!![]});}return null;})[_0x88cb('0x26')](function(_0x538d3c){if(_0x538d3c){_0x513af6=_[_0x88cb('0x6e')](_0x538d3c,'id');var _0x51e615;var _0x3c37e1=squel[_0x88cb('0x6f')]();_0x3c37e1[_0x88cb('0x70')](_0x2bafd4[_0x88cb('0x7f')]);for(var _0x494c1b=0x0;_0x494c1b<_0xdaff87[_0x88cb('0x3b')];_0x494c1b+=0x1){_0x51e615=_0xdaff87[_0x494c1b][_0x88cb('0x71')]?_0x513af6[_0xdaff87[_0x494c1b]['MetricId']][_0x88cb('0x72')]:_0xdaff87[_0x494c1b]['field'];_0x51e615=_0xdaff87[_0x494c1b][_0x88cb('0x73')]?_[_0x88cb('0x74')](_0x1b0579[_0xdaff87[_0x494c1b][_0x88cb('0x73')]],'%s',_0x51e615):_0x51e615;_0x51e615=_0xdaff87[_0x494c1b][_0x88cb('0x75')]?_[_0x88cb('0x74')](_0x22a7ae[_0xdaff87[_0x494c1b]['format']],'%s',_0x51e615):_0x51e615;if(_0xdaff87[_0x494c1b]['groupBy']){_0x3c37e1[_0x88cb('0x67')](_0x51e615);}_0xdaff87[_0x494c1b]['orderBy']&&_0x3c37e1[_0x88cb('0x77')](_0x51e615,_0xdaff87[_0x494c1b][_0x88cb('0x78')]===_0x88cb('0x79')?![]:!![]);_0x3c37e1[_0x88cb('0x68')](_0x51e615,_0xdaff87[_0x494c1b][_0x88cb('0x7a')]||_0x51e615);}if(_0x2bafd4['joins']){_0x2bafd4[_0x88cb('0x7b')]=JSON['parse'](_0x2bafd4['joins']);for(var _0xc33a9f=0x0;_0xc33a9f<_0x2bafd4[_0x88cb('0x7b')][_0x88cb('0x3b')];_0xc33a9f+=0x1){if(_0x2bafd4[_0x88cb('0x7b')][_0xc33a9f]['type']&&_[_0x88cb('0x61')](_0x2f8a2d,_0x2bafd4[_0x88cb('0x7b')][_0xc33a9f]['type'])&&_0x2bafd4[_0x88cb('0x7b')][_0xc33a9f]['parentKey']&&_0x2bafd4[_0x88cb('0x7b')][_0xc33a9f][_0x88cb('0x7e')]&&_0x2bafd4[_0x88cb('0x7b')][_0xc33a9f]['foreignKey']){_0x3c37e1[_0x2bafd4[_0x88cb('0x7b')][_0xc33a9f][_0x88cb('0x33')]](_0x2bafd4[_0x88cb('0x7b')][_0xc33a9f]['foreignTable'],null,util[_0x88cb('0x75')](_0x88cb('0x90'),_0x2bafd4['table'],_0x2bafd4[_0x88cb('0x7b')][_0xc33a9f]['parentKey'],_0x2bafd4['joins'][_0xc33a9f][_0x88cb('0x7e')],_0x2bafd4[_0x88cb('0x7b')][_0xc33a9f]['foreignKey']));}}}if(_0x2bafd4[_0x88cb('0x80')]){_0x2bafd4[_0x88cb('0x80')]=JSON[_0x88cb('0x81')](_0x2bafd4['conditions']);_0x3c37e1['where'](_0x454fac(_0x2bafd4[_0x88cb('0x80')][_0x88cb('0x67')]));}_0x2f72a5=_0x3c37e1[_0x88cb('0x82')]();_0x3c37e1['limit'](_0x1f6fb7);_0x3c37e1[_0x88cb('0x1f')](0x0);return;}})[_0x88cb('0x26')](function(){if(_0x4f3f8e[_0x88cb('0x91')]===_0x88cb('0x92')){return null;}var _0x2d174c=_[_0x88cb('0x42')](_0x4f3f8e,{'name':_0x4f3f8e[_0x88cb('0x93')]||_0x4f3f8e[_0x88cb('0x2d')]||_0x2bafd4[_0x88cb('0x2d')],'basename':_0x34d78f,'savename':util[_0x88cb('0x75')](_0x88cb('0x94'),_0x4f3f8e[_0x88cb('0x2d')]||_0x2bafd4['name'],require(_0x88cb('0x95'))[_0x88cb('0x96')](0x4),_0x4f3f8e[_0x88cb('0x91')]||'csv'),'reportId':_0x2bafd4['id'],'reportType':_0x88cb('0x97')});return db[_0x88cb('0x98')][_0x88cb('0x4e')](_0x2d174c,{'raw':!![]});})[_0x88cb('0x26')](function(_0x2b8e95){if(_0x2bafd4[_0x88cb('0x7f')]===_0x88cb('0x99')){_0x2f72a5[_0x88cb('0x3f')](_0x2bafd4[_0x88cb('0x7f')]+_0x88cb('0x9a'),_0x4f3f8e[_0x88cb('0x9b')],_0x4f3f8e[_0x88cb('0x9c')]);}else{_0x2f72a5[_0x88cb('0x3f')](_0x2bafd4[_0x88cb('0x7f')]+_0x88cb('0x9d'),_0x4f3f8e['startDate'],_0x4f3f8e[_0x88cb('0x9c')]);}if(_0x2b8e95){logger['info'](_0x88cb('0x9e'),_0x2f72a5[_0x88cb('0x84')]());require(_0x88cb('0x9f'))[_0x88cb('0xa0')](path[_0x88cb('0x54')](__dirname,_0x88cb('0xa1'),_0x2b8e95[_0x88cb('0x91')]),[_0x2b8e95['id'],_0x2f72a5[_0x88cb('0x84')](),path[_0x88cb('0x54')](__dirname,_0x88cb('0xa2'),_0x2b8e95[_0x88cb('0xa3')]),_0x34d78f]);return _0x2b8e95;}else{var _0x109d79=squel[_0x88cb('0x6f')]();_0x109d79[_0x88cb('0x70')]('('+_0x2f72a5[_0x88cb('0x84')]()+')','countTable');_0x109d79[_0x88cb('0x68')](_0x88cb('0xa4'),_0x88cb('0xa5'));_0x2f72a5[_0x88cb('0x20')](_0x4f3f8e[_0x88cb('0x20')]||_0x1f6fb7);_0x2f72a5[_0x88cb('0x1f')](_0x4f3f8e[_0x88cb('0x1f')]||0x0);return dbH[_0x88cb('0x85')][_0x88cb('0x36')](_0x109d79[_0x88cb('0x84')](),{'type':dbH['sequelize'][_0x88cb('0x86')][_0x88cb('0x87')]})[_0x88cb('0x26')](function(_0x4cf0ba){if(!_0x4cf0ba['length']){_0x25ccec=0x0;}else{_0x25ccec=_0x4cf0ba[0x0][_0x88cb('0xa5')]||0x0;}return dbH[_0x88cb('0x85')]['query'](_0x2f72a5[_0x88cb('0x84')](),{'type':dbH[_0x88cb('0x85')]['QueryTypes']['SELECT']});})[_0x88cb('0x26')](function(_0x15d9b4){return{'rows':_0x15d9b4||[],'count':_0x25ccec};});}});}exports[_0x88cb('0xa6')]=function(_0x17710d,_0x47be1a){return runReport(_0x17710d[_0x88cb('0x49')],_0x17710d['query'],_0x17710d[_0x88cb('0x44')])[_0x88cb('0x26')](respondWithResult(_0x47be1a,null))[_0x88cb('0x4d')](handleError(_0x47be1a,null));};exports[_0x88cb('0xa7')]=runReport;exports['query']=function(_0x2c06ef,_0x5f29e9){var _0x1f2a24=0xa;var _0x2d89f9=[_0x88cb('0x54'),'left_join',_0x88cb('0x55'),_0x88cb('0x56')];var _0x144afe={'SUM':_0x88cb('0x89'),'COUNT':_0x88cb('0x57'),'COUNT DISTINCT':_0x88cb('0x58'),'MAX':_0x88cb('0x59'),'MIN':_0x88cb('0x5a'),'AVG':_0x88cb('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x88cb('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4625b1={'SEC_TO_TIME':_0x88cb('0x5e'),'DATE':_0x88cb('0x8b'),'HOUR':'HOUR(%s)','ROUND':_0x88cb('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xe2029b=function(_0x4d3e8f){return!_[_0x88cb('0x61')]([_0x88cb('0x8d'),_0x88cb('0x62'),_0x88cb('0x63'),'IS\x20NOT\x20EMPTY'],_0x4d3e8f);};var _0xf43ad=function(_0x5947f6){if(!_0x5947f6||!_0x5947f6[_0x88cb('0x65')][_0x88cb('0x3b')]){return'';}for(var _0x6c963f='(',_0x23b487=0x0;_0x23b487<_0x5947f6['rules'][_0x88cb('0x3b')];_0x23b487+=0x1){_0x23b487>0x0&&(_0x6c963f+='\x20'+_0x5947f6['operator']+'\x20');_0x6c963f+=_0x5947f6[_0x88cb('0x65')][_0x23b487]['group']?_0xf43ad(_0x5947f6[_0x88cb('0x65')][_0x23b487][_0x88cb('0x67')]):_0x5947f6[_0x88cb('0x65')][_0x23b487][_0x88cb('0x68')]+'\x20'+_0x5947f6['rules'][_0x23b487][_0x88cb('0x69')]+(_0xe2029b(_0x5947f6[_0x88cb('0x65')][_0x23b487][_0x88cb('0x69')])?'\x20'+_0x5947f6['rules'][_0x23b487][_0x88cb('0x8e')]:'');}return _0x6c963f+')';};var _0x394672={'where':{'id':_0x2c06ef[_0x88cb('0x49')]['id']}},_0x22c3f1,_0x1ca3de,_0x16ceb2,_0x5d2a40,_0x54e043;_0x394672=_[_0x88cb('0x42')]({},_0x394672,_0x2c06ef['options']);return db[_0x88cb('0x30')][_0x88cb('0x4c')](_0x394672)[_0x88cb('0x26')](function(_0x25cd44){if(_0x25cd44){_0x22c3f1=_0x25cd44;return _0x25cd44[_0x88cb('0x6a')]();}return null;})[_0x88cb('0x26')](function(_0x36486a){if(_0x36486a){if(!_0x36486a['length']){throw new db[(_0x88cb('0x6b'))][(_0x88cb('0x6c'))](_0x88cb('0x6d'),0x193);}_0x1ca3de=_0x36486a;return db['AnalyticMetric'][_0x88cb('0x46')]({'raw':!![]});}return null;})[_0x88cb('0x26')](function(_0x6047f1){if(_0x6047f1){_0x16ceb2=_[_0x88cb('0x6e')](_0x6047f1,'id');var _0x340a1d;var _0x4fd8c8=squel[_0x88cb('0x6f')]();_0x4fd8c8[_0x88cb('0x70')](_0x22c3f1[_0x88cb('0x7f')]);for(var _0x4d071d=0x0;_0x4d071d<_0x1ca3de[_0x88cb('0x3b')];_0x4d071d+=0x1){_0x340a1d=_0x1ca3de[_0x4d071d][_0x88cb('0x71')]?_0x16ceb2[_0x1ca3de[_0x4d071d]['MetricId']][_0x88cb('0x72')]:_0x1ca3de[_0x4d071d]['field'];_0x340a1d=_0x1ca3de[_0x4d071d][_0x88cb('0x73')]?_[_0x88cb('0x74')](_0x144afe[_0x1ca3de[_0x4d071d][_0x88cb('0x73')]],'%s',_0x340a1d):_0x340a1d;_0x340a1d=_0x1ca3de[_0x4d071d][_0x88cb('0x75')]?_[_0x88cb('0x74')](_0x4625b1[_0x1ca3de[_0x4d071d][_0x88cb('0x75')]],'%s',_0x340a1d):_0x340a1d;if(_0x1ca3de[_0x4d071d][_0x88cb('0x76')]){_0x4fd8c8[_0x88cb('0x67')](_0x340a1d);}_0x1ca3de[_0x4d071d][_0x88cb('0x78')]&&_0x4fd8c8['order'](_0x340a1d,_0x1ca3de[_0x4d071d][_0x88cb('0x78')]===_0x88cb('0x79')?![]:!![]);_0x4fd8c8[_0x88cb('0x68')](_0x340a1d,_0x1ca3de[_0x4d071d][_0x88cb('0x7a')]||_0x340a1d);}if(_0x22c3f1[_0x88cb('0x7b')]){_0x22c3f1[_0x88cb('0x7b')]=JSON[_0x88cb('0x81')](_0x22c3f1[_0x88cb('0x7b')]);for(var _0x3eaec4=0x0;_0x3eaec4<_0x22c3f1[_0x88cb('0x7b')]['length'];_0x3eaec4+=0x1){if(_0x22c3f1[_0x88cb('0x7b')][_0x3eaec4][_0x88cb('0x33')]&&_[_0x88cb('0x61')](_0x2d89f9,_0x22c3f1[_0x88cb('0x7b')][_0x3eaec4]['type'])&&_0x22c3f1[_0x88cb('0x7b')][_0x3eaec4]['parentKey']&&_0x22c3f1[_0x88cb('0x7b')][_0x3eaec4][_0x88cb('0x7e')]&&_0x22c3f1['joins'][_0x3eaec4][_0x88cb('0x7d')]){_0x4fd8c8[_0x22c3f1[_0x88cb('0x7b')][_0x3eaec4][_0x88cb('0x33')]](_0x22c3f1[_0x88cb('0x7b')][_0x3eaec4][_0x88cb('0x7e')],null,util['format'](_0x88cb('0x90'),_0x22c3f1[_0x88cb('0x7f')],_0x22c3f1[_0x88cb('0x7b')][_0x3eaec4][_0x88cb('0x7c')],_0x22c3f1['joins'][_0x3eaec4][_0x88cb('0x7e')],_0x22c3f1[_0x88cb('0x7b')][_0x3eaec4][_0x88cb('0x7d')]));}}}if(_0x22c3f1['conditions']){_0x22c3f1[_0x88cb('0x80')]=JSON[_0x88cb('0x81')](_0x22c3f1[_0x88cb('0x80')]);_0x4fd8c8['where'](_0xf43ad(_0x22c3f1['conditions'][_0x88cb('0x67')]));}_0x54e043=_0x4fd8c8[_0x88cb('0x82')]();_0x4fd8c8['limit'](_0x1f2a24);_0x4fd8c8['offset'](0x0);logger[_0x88cb('0x83')]('Limited\x20Query:',_0x4fd8c8[_0x88cb('0x84')]());return dbH['sequelize'][_0x88cb('0x36')](_0x4fd8c8[_0x88cb('0x84')](),{'type':dbH[_0x88cb('0x85')][_0x88cb('0x86')][_0x88cb('0x87')]});}})[_0x88cb('0x26')](function(){return{'sql':_0x54e043[_0x88cb('0x84')]()};})[_0x88cb('0x26')](respondWithResult(_0x5f29e9,null))[_0x88cb('0x4d')](handleError(_0x5f29e9,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 965e795..0386faa 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 _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 +var _0xb1f6=['exports','define','AnalyticDefaultReport','util','../../config/logger','rimraf'];(function(_0x5b1364,_0x284d9d){var _0x542b87=function(_0x2fde18){while(--_0x2fde18){_0x5b1364['push'](_0x5b1364['shift']());}};_0x542b87(++_0x284d9d);}(_0xb1f6,0x14d));var _0x6b1f=function(_0x53d8f8,_0x3c029c){_0x53d8f8=_0x53d8f8-0x0;var _0x3b53fe=_0xb1f6[_0x53d8f8];return _0x3b53fe;};'use strict';var _=require('lodash');var util=require(_0x6b1f('0x0'));var logger=require(_0x6b1f('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6b1f('0x2'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0x6b1f('0x3')]=function(_0x78923f,_0x5bbcad){return _0x78923f[_0x6b1f('0x4')](_0x6b1f('0x5'),attributes,{'tableName':'analytics_default_reports','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 ca38016..9a87dce 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 _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 +var _0x0439=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0xbec422,_0x1c92fe){var _0x495053=function(_0x4dd2b9){while(--_0x4dd2b9){_0xbec422['push'](_0xbec422['shift']());}};_0x495053(++_0x1c92fe);}(_0x0439,0xdd));var _0x9043=function(_0x34bb68,_0x5b0079){_0x34bb68=_0x34bb68-0x0;var _0x3db9fb=_0x0439[_0x34bb68];return _0x3db9fb;};'use strict';var _=require(_0x9043('0x0'));var util=require(_0x9043('0x1'));var moment=require(_0x9043('0x2'));var BPromise=require(_0x9043('0x3'));var rs=require(_0x9043('0x4'));var fs=require('fs');var Redis=require(_0x9043('0x5'));var db=require(_0x9043('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9043('0x7'))(_0x9043('0x8'));var config=require(_0x9043('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9043('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f79c2,_0x2fe4da,_0x19bf02){return new BPromise(function(_0x5bea98,_0x135a40){return client['request'](_0x4f79c2,_0x19bf02)[_0x9043('0xb')](function(_0x36a5cb){logger['info'](_0x9043('0xc'),_0x2fe4da,_0x9043('0xd'));logger[_0x9043('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x2fe4da,'request\x20sent',JSON[_0x9043('0xf')](_0x36a5cb));if(_0x36a5cb[_0x9043('0x10')]){if(_0x36a5cb['error'][_0x9043('0x11')]===0x1f4){logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x36a5cb[_0x9043('0x10')][_0x9043('0x12')]);return _0x135a40(_0x36a5cb[_0x9043('0x10')]['message']);}logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x36a5cb['error'][_0x9043('0x12')]);return _0x5bea98(_0x36a5cb[_0x9043('0x10')]['message']);}else{logger[_0x9043('0x13')](_0x9043('0xc'),_0x2fe4da,_0x9043('0xd'));_0x5bea98(_0x36a5cb[_0x9043('0x14')][_0x9043('0x12')]);}})[_0x9043('0x15')](function(_0x13b613){logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x13b613);_0x135a40(_0x13b613);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 17d0161..6a32fbf 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 _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 +var _0xfb5e=['delete','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','index','show','/:id/run','isAuthenticated','run','/:id/query','query','post','create','/:id'];(function(_0x1b9043,_0x322520){var _0x314150=function(_0x357334){while(--_0x357334){_0x1b9043['push'](_0x1b9043['shift']());}};_0x314150(++_0x322520);}(_0xfb5e,0x144));var _0xefb5=function(_0x3a16d4,_0x23ecda){_0x3a16d4=_0x3a16d4-0x0;var _0x31ea9c=_0xfb5e[_0x3a16d4];return _0x31ea9c;};'use strict';var multer=require(_0xefb5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xefb5('0x1'));var express=require(_0xefb5('0x2'));var router=express['Router']();var auth=require(_0xefb5('0x3'));var interaction=require(_0xefb5('0x4'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0xefb5('0x5')]('/',auth['isAuthenticated'](),controller[_0xefb5('0x6')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xefb5('0x7')]);router['get']('/:id/preview',auth['isAuthenticated'](),controller['preview']);router[_0xefb5('0x5')](_0xefb5('0x8'),auth[_0xefb5('0x9')](),controller[_0xefb5('0xa')]);router['get'](_0xefb5('0xb'),auth[_0xefb5('0x9')](),controller[_0xefb5('0xc')]);router[_0xefb5('0xd')]('/',auth['isAuthenticated'](),controller[_0xefb5('0xe')]);router['put'](_0xefb5('0xf'),auth[_0xefb5('0x9')](),controller['update']);router[_0xefb5('0x10')](_0xefb5('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 01fcf0e..c33f82d 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 _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 +var _0xb822=['STRING','ENUM','csv','xlsx','DATE','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment'];(function(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0xb822,0x17f));var _0x2b82=function(_0xfc02fc,_0x4ff80b){_0xfc02fc=_0xfc02fc-0x0;var _0x13a51f=_0xb822[_0xfc02fc];return _0x13a51f;};'use strict';var Sequelize=require(_0x2b82('0x0'));var moment=require(_0x2b82('0x1'));module['exports']={'name':{'type':Sequelize[_0x2b82('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x2b82('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x2b82('0x3')](_0x2b82('0x4'),'pdf',_0x2b82('0x5')),'allowNull':![],'defaultValue':_0x2b82('0x4')},'savename':{'type':Sequelize[_0x2b82('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x2b82('0x6')]},'endDate':{'type':Sequelize[_0x2b82('0x6')]},'status':{'type':Sequelize[_0x2b82('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x2b82('0x7'),_0x2b82('0x8')),'allowNull':![],'defaultValue':_0x2b82('0x7')},'reportId':{'type':Sequelize[_0x2b82('0x9')](0xb)[_0x2b82('0xa')]},'reportType':{'type':Sequelize[_0x2b82('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 4b83f42..bd8e581 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 _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 +var _0x809a=['filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','download','format','%s.%s','toLowerCase','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','key','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x809a,0x14d));var _0xa809=function(_0xbf6458,_0x5b4fcd){_0xbf6458=_0xbf6458-0x0;var _0x9a93b3=_0x809a[_0xbf6458];return _0x9a93b3;};'use strict';var pdf=require(_0xa809('0x0'));var emlformat=require(_0xa809('0x1'));var rimraf=require(_0xa809('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa809('0x3'));var rp=require(_0xa809('0x4'));var moment=require(_0xa809('0x5'));var BPromise=require(_0xa809('0x6'));var Mustache=require(_0xa809('0x7'));var util=require(_0xa809('0x8'));var path=require(_0xa809('0x9'));var sox=require(_0xa809('0xa'));var csv=require(_0xa809('0xb'));var ejs=require(_0xa809('0xc'));var fs=require('fs');var _=require(_0xa809('0xd'));var squel=require(_0xa809('0xe'));var crypto=require(_0xa809('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa809('0xb'));var querystring=require(_0xa809('0x10'));var Papa=require('papaparse');var Redis=require(_0xa809('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa809('0x12'));var as=require(_0xa809('0x13'));var hardwareService=require(_0xa809('0x14'));var logger=require('../../config/logger')(_0xa809('0x15'));var utils=require(_0xa809('0x16'));var config=require(_0xa809('0x17'));var licenseUtil=require(_0xa809('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xabc14a,_0x9a53b5){_0x9a53b5=_0x9a53b5||0xcc;return function(_0x4abceb){if(_0x4abceb){return _0xabc14a[_0xa809('0x19')](_0x9a53b5);}return _0xabc14a[_0xa809('0x1a')](_0x9a53b5)[_0xa809('0x1b')]();};}function respondWithResult(_0xf9b290,_0x2d2842){_0x2d2842=_0x2d2842||0xc8;return function(_0xf5f93c){if(_0xf5f93c){return _0xf9b290['status'](_0x2d2842)[_0xa809('0x1c')](_0xf5f93c);}};}function respondWithFilteredResult(_0x34d970,_0x555ea9){return function(_0x20bd36){if(_0x20bd36){var _0x4e0cf4=_0x20bd36[_0xa809('0x1d')],_0x10001f=_0x555ea9[_0xa809('0x1e')],_0x46baf0=_0x555ea9[_0xa809('0x1e')]+_0x555ea9[_0xa809('0x1f')],_0x1f7915;if(_0x46baf0>=_0x4e0cf4){_0x46baf0=_0x4e0cf4;_0x1f7915=0xc8;}else{_0x1f7915=0xce;}_0x34d970['status'](_0x1f7915);return _0x34d970['set'](_0xa809('0x20'),_0x10001f+'-'+_0x46baf0+'/'+_0x4e0cf4)['json'](_0x20bd36);}return null;};}function patchUpdates(_0x139e38){return function(_0x33f673){try{jsonpatch[_0xa809('0x21')](_0x33f673,_0x139e38,!![]);}catch(_0x46560f){return BPromise[_0xa809('0x22')](_0x46560f);}return _0x33f673['save']();};}function saveUpdates(_0x58a528,_0xe55f0b){return function(_0x81e980){if(_0x81e980){return _0x81e980[_0xa809('0x23')](_0x58a528)[_0xa809('0x24')](function(_0xc675a){return _0xc675a;});}return null;};}function removeEntity(_0x169b95,_0x1b6c99){return function(_0x40d9c8){if(_0x40d9c8){return _0x40d9c8[_0xa809('0x25')]()['then'](function(){var _0x55adb7=_0x40d9c8[_0xa809('0x26')]({'plain':!![]});var _0x179da7=_0xa809('0x27');return db[_0xa809('0x28')]['destroy']({'where':{'type':_0x179da7,'resourceId':_0x55adb7['id']}})['then'](function(){return _0x40d9c8;});})[_0xa809('0x24')](function(){_0x169b95[_0xa809('0x1a')](0xcc)[_0xa809('0x1b')]();});}};}function handleEntityNotFound(_0xe348fe,_0xbe55d4){return function(_0x51139e){if(!_0x51139e){_0xe348fe[_0xa809('0x19')](0x194);}return _0x51139e;};}function handleError(_0x377241,_0x15a733){_0x15a733=_0x15a733||0x1f4;return function(_0x491741){logger[_0xa809('0x29')](_0x491741[_0xa809('0x2a')]);if(_0x491741['name']){delete _0x491741[_0xa809('0x2b')];}_0x377241['status'](_0x15a733)[_0xa809('0x2c')](_0x491741);};}exports[_0xa809('0x2d')]=function(_0xb84eaa,_0x4769e1){var _0x4d5aeb={},_0x38c9d8={},_0xb57fbb={'count':0x0,'rows':[]};var _0x234ad7=_[_0xa809('0x2e')](db[_0xa809('0x2f')][_0xa809('0x30')],function(_0x1c9bfa){return{'name':_0x1c9bfa['fieldName'],'type':_0x1c9bfa['type'][_0xa809('0x31')]};});_0x38c9d8[_0xa809('0x32')]=_[_0xa809('0x2e')](_0x234ad7,_0xa809('0x2b'));_0x38c9d8['query']=_[_0xa809('0x33')](_0xb84eaa[_0xa809('0x34')]);_0x38c9d8[_0xa809('0x35')]=_[_0xa809('0x36')](_0x38c9d8[_0xa809('0x32')],_0x38c9d8[_0xa809('0x34')]);_0x4d5aeb['attributes']=_['intersection'](_0x38c9d8['model'],qs[_0xa809('0x37')](_0xb84eaa[_0xa809('0x34')][_0xa809('0x37')]));_0x4d5aeb['attributes']=_0x4d5aeb['attributes'][_0xa809('0x38')]?_0x4d5aeb[_0xa809('0x39')]:_0x38c9d8['model'];if(!_0xb84eaa[_0xa809('0x34')][_0xa809('0x3a')](_0xa809('0x3b'))){_0x4d5aeb[_0xa809('0x1f')]=qs[_0xa809('0x1f')](_0xb84eaa[_0xa809('0x34')]['limit']);_0x4d5aeb['offset']=qs['offset'](_0xb84eaa[_0xa809('0x34')][_0xa809('0x1e')]);}_0x4d5aeb[_0xa809('0x3c')]=qs[_0xa809('0x3d')](_0xb84eaa[_0xa809('0x34')]['sort']);_0x4d5aeb['where']=qs[_0xa809('0x35')](_[_0xa809('0x3e')](_0xb84eaa[_0xa809('0x34')],_0x38c9d8[_0xa809('0x35')]),_0x234ad7);if(_0xb84eaa['query'][_0xa809('0x3f')]){_0x4d5aeb['where']=_['merge'](_0x4d5aeb[_0xa809('0x40')],{'$or':_['map'](_0x234ad7,function(_0xa34697){if(_0xa34697[_0xa809('0x41')]!==_0xa809('0x42')){var _0x41b3ff={};_0x41b3ff[_0xa34697['name']]={'$like':'%'+_0xb84eaa[_0xa809('0x34')][_0xa809('0x3f')]+'%'};return _0x41b3ff;}})});}_0x4d5aeb=_[_0xa809('0x43')]({},_0x4d5aeb,_0xb84eaa[_0xa809('0x44')]);var _0x3ebfa0={'where':_0x4d5aeb[_0xa809('0x40')]};return db[_0xa809('0x2f')][_0xa809('0x1d')](_0x3ebfa0)[_0xa809('0x24')](function(_0x5534f3){_0xb57fbb['count']=_0x5534f3;if(_0xb84eaa[_0xa809('0x34')][_0xa809('0x45')]){_0x4d5aeb[_0xa809('0x46')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xa809('0x47')](_0x4d5aeb);})['then'](function(_0x70e734){_0xb57fbb[_0xa809('0x48')]=_0x70e734;return _0xb57fbb;})[_0xa809('0x24')](respondWithFilteredResult(_0x4769e1,_0x4d5aeb))[_0xa809('0x49')](handleError(_0x4769e1,null));};exports[_0xa809('0x4a')]=function(_0xd13d26,_0x203f2d){var _0xbd02c3={'raw':!![],'where':{'id':_0xd13d26[_0xa809('0x4b')]['id']}},_0xae08d0={};_0xae08d0[_0xa809('0x32')]=_['keys'](db[_0xa809('0x2f')]['rawAttributes']);_0xae08d0['query']=_[_0xa809('0x33')](_0xd13d26[_0xa809('0x34')]);_0xae08d0[_0xa809('0x35')]=_[_0xa809('0x36')](_0xae08d0[_0xa809('0x32')],_0xae08d0[_0xa809('0x34')]);_0xbd02c3['attributes']=_[_0xa809('0x36')](_0xae08d0[_0xa809('0x32')],qs['fields'](_0xd13d26[_0xa809('0x34')]['fields']));_0xbd02c3[_0xa809('0x39')]=_0xbd02c3[_0xa809('0x39')]['length']?_0xbd02c3['attributes']:_0xae08d0[_0xa809('0x32')];if(_0xd13d26['query']['includeAll']){_0xbd02c3[_0xa809('0x46')]=[{'all':!![]}];}_0xbd02c3=_['merge']({},_0xbd02c3,_0xd13d26[_0xa809('0x44')]);return db['AnalyticExtractedReport'][_0xa809('0x4c')](_0xbd02c3)[_0xa809('0x24')](handleEntityNotFound(_0x203f2d,null))[_0xa809('0x24')](respondWithResult(_0x203f2d,null))[_0xa809('0x49')](handleError(_0x203f2d,null));};exports[_0xa809('0x4d')]=function(_0x1719c8,_0x3b41fc){return db[_0xa809('0x2f')]['create'](_0x1719c8['body'],{})[_0xa809('0x24')](function(_0x49b252){var _0x28558e=_0x1719c8[_0xa809('0x4e')]['get']({'plain':!![]});if(!_0x28558e)throw new Error(_0xa809('0x4f'));if(_0x28558e['role']===_0xa809('0x4e')){var _0x5cefc5=_0x49b252['get']({'plain':!![]});var _0x3c48c2=_0xa809('0x27');return db[_0xa809('0x50')]['find']({'where':{'name':_0x3c48c2,'userProfileId':_0x28558e[_0xa809('0x51')]},'raw':!![]})[_0xa809('0x24')](function(_0x59012c){if(_0x59012c&&_0x59012c[_0xa809('0x52')]===0x0){return db[_0xa809('0x28')][_0xa809('0x4d')]({'name':_0x5cefc5[_0xa809('0x2b')],'resourceId':_0x5cefc5['id'],'type':_0x59012c[_0xa809('0x2b')],'sectionId':_0x59012c['id']},{})[_0xa809('0x24')](function(){return _0x49b252;});}else{return _0x49b252;}})['catch'](function(_0x492034){logger['error'](_0xa809('0x53'),_0x492034);throw _0x492034;});}return _0x49b252;})[_0xa809('0x24')](respondWithResult(_0x3b41fc,0xc9))['catch'](handleError(_0x3b41fc,null));};exports[_0xa809('0x23')]=function(_0x15737f,_0x15e35b){if(_0x15737f[_0xa809('0x54')]['id']){delete _0x15737f['body']['id'];}return db[_0xa809('0x2f')][_0xa809('0x4c')]({'where':{'id':_0x15737f[_0xa809('0x4b')]['id']}})['then'](handleEntityNotFound(_0x15e35b,null))['then'](saveUpdates(_0x15737f[_0xa809('0x54')],null))[_0xa809('0x24')](respondWithResult(_0x15e35b,null))[_0xa809('0x49')](handleError(_0x15e35b,null));};exports[_0xa809('0x25')]=function(_0x5bc0c0,_0x2a44a8){return db[_0xa809('0x2f')]['find']({'where':{'id':_0x5bc0c0[_0xa809('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2a44a8,null))[_0xa809('0x24')](removeEntity(_0x2a44a8,null))[_0xa809('0x49')](handleError(_0x2a44a8,null));};exports['download']=function(_0x74691e,_0x11dff2,_0x2e01b2){return db[_0xa809('0x2f')]['find']({'where':{'id':_0x74691e[_0xa809('0x4b')]['id']},'attributes':[_0xa809('0x2b'),_0xa809('0x55'),_0xa809('0x56'),_0xa809('0x57')],'raw':!![]})[_0xa809('0x24')](handleEntityNotFound(_0x11dff2,null))[_0xa809('0x24')](function(_0x304c13){if(_0x304c13){if(!fs[_0xa809('0x58')](path[_0xa809('0x59')](config[_0xa809('0x5a')],_0xa809('0x5b'),_0x304c13[_0xa809('0x56')]))){throw new db[(_0xa809('0x5c'))]['ValidationError'](_0xa809('0x5d'));}if(_0x74691e[_0xa809('0x34')][_0xa809('0x5e')]){return _0x11dff2[_0xa809('0x19')](0xc8);}return _0x11dff2[_0xa809('0x5f')](path[_0xa809('0x59')](config[_0xa809('0x5a')],_0xa809('0x5b'),_0x304c13['savename']),util[_0xa809('0x60')](_0xa809('0x61'),_0x304c13[_0xa809('0x55')]||_0x304c13[_0xa809('0x2b')],_0x304c13[_0xa809('0x57')][_0xa809('0x62')]()));}})[_0xa809('0x49')](handleError(_0x11dff2,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 5a2339c..be67bab 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 _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 +var _0xb6dd=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','lodash','util'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xb6dd,0xd6));var _0xdb6d=function(_0x34af08,_0x1cad6b){_0x34af08=_0x34af08-0x0;var _0x28ec57=_0xb6dd[_0x34af08];return _0x28ec57;};'use strict';var _=require(_0xdb6d('0x0'));var util=require(_0xdb6d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdb6d('0x2'));var BPromise=require(_0xdb6d('0x3'));var rp=require(_0xdb6d('0x4'));var fs=require('fs');var path=require(_0xdb6d('0x5'));var rimraf=require(_0xdb6d('0x6'));var config=require(_0xdb6d('0x7'));var attributes=require(_0xdb6d('0x8'));module[_0xdb6d('0x9')]=function(_0x59d286,_0x5c8e6a){return _0x59d286[_0xdb6d('0xa')]('AnalyticExtractedReport',attributes,{'tableName':_0xdb6d('0xb'),'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 0da6bc0..3a33949 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 _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 +var _0x0b06=['info','request\x20sent','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x29dfdd,_0x3c5313){var _0x505c74=function(_0x4d2262){while(--_0x4d2262){_0x29dfdd['push'](_0x29dfdd['shift']());}};_0x505c74(++_0x3c5313);}(_0x0b06,0xb1));var _0x60b0=function(_0x301bf7,_0x58d5cb){_0x301bf7=_0x301bf7-0x0;var _0x2237cf=_0x0b06[_0x301bf7];return _0x2237cf;};'use strict';var _=require(_0x60b0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x60b0('0x1'));var fs=require('fs');var Redis=require(_0x60b0('0x2'));var db=require(_0x60b0('0x3'))['db'];var utils=require(_0x60b0('0x4'));var logger=require(_0x60b0('0x5'))('rpc');var config=require(_0x60b0('0x6'));var jayson=require(_0x60b0('0x7'));var client=jayson[_0x60b0('0x8')][_0x60b0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ed59d,_0x3b9365,_0x151439){return new BPromise(function(_0x9d4448,_0x786f84){return client['request'](_0x4ed59d,_0x151439)['then'](function(_0x2414fe){logger[_0x60b0('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3b9365,_0x60b0('0xb'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x3b9365,'request\x20sent',JSON[_0x60b0('0xc')](_0x2414fe));if(_0x2414fe[_0x60b0('0xd')]){if(_0x2414fe[_0x60b0('0xd')][_0x60b0('0xe')]===0x1f4){logger[_0x60b0('0xd')](_0x60b0('0xf'),_0x3b9365,_0x2414fe[_0x60b0('0xd')][_0x60b0('0x10')]);return _0x786f84(_0x2414fe[_0x60b0('0xd')][_0x60b0('0x10')]);}logger[_0x60b0('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3b9365,_0x2414fe[_0x60b0('0xd')][_0x60b0('0x10')]);return _0x9d4448(_0x2414fe[_0x60b0('0xd')][_0x60b0('0x10')]);}else{logger[_0x60b0('0xa')](_0x60b0('0xf'),_0x3b9365,'request\x20sent');_0x9d4448(_0x2414fe['result'][_0x60b0('0x10')]);}})['catch'](function(_0x37ca2e){logger['error'](_0x60b0('0xf'),_0x3b9365,_0x37ca2e);_0x786f84(_0x37ca2e);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 95b3020..f92f792 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 _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 +var _0xdf46=['download','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','/:id/download'];(function(_0xf74c5f,_0x4ba01e){var _0x26c6b0=function(_0xef0c16){while(--_0xef0c16){_0xf74c5f['push'](_0xf74c5f['shift']());}};_0x26c6b0(++_0x4ba01e);}(_0xdf46,0x16f));var _0x6df4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xdf46[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x6df4('0x0'));var util=require(_0x6df4('0x1'));var path=require(_0x6df4('0x2'));var timeout=require(_0x6df4('0x3'));var express=require('express');var router=express[_0x6df4('0x4')]();var auth=require(_0x6df4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6df4('0x6'));var controller=require(_0x6df4('0x7'));router[_0x6df4('0x8')]('/',auth[_0x6df4('0x9')](),controller[_0x6df4('0xa')]);router[_0x6df4('0x8')](_0x6df4('0xb'),auth[_0x6df4('0x9')](),controller['show']);router[_0x6df4('0x8')](_0x6df4('0xc'),auth[_0x6df4('0x9')](),controller[_0x6df4('0xd')]);router['post']('/',auth[_0x6df4('0x9')](),controller[_0x6df4('0xe')]);router['put'](_0x6df4('0xb'),auth[_0x6df4('0x9')](),controller[_0x6df4('0xf')]);router[_0x6df4('0x10')](_0x6df4('0xb'),auth[_0x6df4('0x9')](),controller[_0x6df4('0x11')]);module[_0x6df4('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 3cbd17c..3ff6467 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 _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 +var _0x814b=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x533676,_0x2be01c){var _0x32f7bd=function(_0x5b28fd){while(--_0x5b28fd){_0x533676['push'](_0x533676['shift']());}};_0x32f7bd(++_0x2be01c);}(_0x814b,0x1a2));var _0xb814=function(_0x4ddfe1,_0x35939d){_0x4ddfe1=_0x4ddfe1-0x0;var _0x4aaf51=_0x814b[_0x4ddfe1];return _0x4aaf51;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'field':{'type':Sequelize[_0xb814('0x2')]},'alias':{'type':Sequelize[_0xb814('0x3')]},'function':{'type':Sequelize[_0xb814('0x3')]},'format':{'type':Sequelize[_0xb814('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb814('0x3')]},'custom':{'type':Sequelize[_0xb814('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index d22c86c..9d930c0 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 _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 +var _0x96ad=['status','json','count','offset','limit','set','save','update','then','destroy','stack','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','filter','merge','VIRTUAL','name','options','include','rows','catch','params','includeAll','create','body','bulkCreate','find','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','CustomReportId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x29947d,_0x2a50ae){var _0x897f64=function(_0x1db59f){while(--_0x1db59f){_0x29947d['push'](_0x29947d['shift']());}};_0x897f64(++_0x2a50ae);}(_0x96ad,0xcd));var _0xd96a=function(_0x2181fc,_0x7283aa){_0x2181fc=_0x2181fc-0x0;var _0x315da1=_0x96ad[_0x2181fc];return _0x315da1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd96a('0x0'));var rimraf=require(_0xd96a('0x1'));var zipdir=require(_0xd96a('0x2'));var jsonpatch=require(_0xd96a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd96a('0x4'));var Mustache=require(_0xd96a('0x5'));var util=require(_0xd96a('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd96a('0x7'));var ejs=require(_0xd96a('0x8'));var fs=require('fs');var _=require(_0xd96a('0x9'));var squel=require(_0xd96a('0xa'));var crypto=require(_0xd96a('0xb'));var jsforce=require(_0xd96a('0xc'));var deskjs=require(_0xd96a('0xd'));var toCsv=require(_0xd96a('0x7'));var querystring=require(_0xd96a('0xe'));var Papa=require(_0xd96a('0xf'));var Redis=require(_0xd96a('0x10'));var authService=require(_0xd96a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd96a('0x12'));var hardwareService=require(_0xd96a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd96a('0x14'));var config=require(_0xd96a('0x15'));var licenseUtil=require(_0xd96a('0x16'));var db=require(_0xd96a('0x17'))['db'];function respondWithStatusCode(_0x1c7b9f,_0x37c2c7){_0x37c2c7=_0x37c2c7||0xcc;return function(_0x35efa4){if(_0x35efa4){return _0x1c7b9f[_0xd96a('0x18')](_0x37c2c7);}return _0x1c7b9f['status'](_0x37c2c7)[_0xd96a('0x19')]();};}function respondWithResult(_0x4d295d,_0x22313f){_0x22313f=_0x22313f||0xc8;return function(_0xc36411){if(_0xc36411){return _0x4d295d[_0xd96a('0x1a')](_0x22313f)[_0xd96a('0x1b')](_0xc36411);}};}function respondWithFilteredResult(_0x12de91,_0x4f485d){return function(_0x4d353e){if(_0x4d353e){var _0x590bce=_0x4d353e[_0xd96a('0x1c')],_0x10e9e4=_0x4f485d[_0xd96a('0x1d')],_0x33356c=_0x4f485d[_0xd96a('0x1d')]+_0x4f485d[_0xd96a('0x1e')],_0x862c36;if(_0x33356c>=_0x590bce){_0x33356c=_0x590bce;_0x862c36=0xc8;}else{_0x862c36=0xce;}_0x12de91[_0xd96a('0x1a')](_0x862c36);return _0x12de91[_0xd96a('0x1f')]('Content-Range',_0x10e9e4+'-'+_0x33356c+'/'+_0x590bce)[_0xd96a('0x1b')](_0x4d353e);}return null;};}function patchUpdates(_0x160547){return function(_0x3cd64d){try{jsonpatch['apply'](_0x3cd64d,_0x160547,!![]);}catch(_0x2786cc){return BPromise['reject'](_0x2786cc);}return _0x3cd64d[_0xd96a('0x20')]();};}function saveUpdates(_0x46a13c,_0x28f876){return function(_0x43b4f6){if(_0x43b4f6){return _0x43b4f6[_0xd96a('0x21')](_0x46a13c)[_0xd96a('0x22')](function(_0x19076c){return _0x19076c;});}return null;};}function removeEntity(_0x28bb79,_0x3176f4){return function(_0x55f4ba){if(_0x55f4ba){return _0x55f4ba[_0xd96a('0x23')]()['then'](function(){_0x28bb79[_0xd96a('0x1a')](0xcc)[_0xd96a('0x19')]();});}};}function handleEntityNotFound(_0x2cf664,_0x49bdf9){return function(_0x51a25d){if(!_0x51a25d){_0x2cf664['sendStatus'](0x194);}return _0x51a25d;};}function handleError(_0x14d186,_0x3b7d69){_0x3b7d69=_0x3b7d69||0x1f4;return function(_0x457a14){logger['error'](_0x457a14[_0xd96a('0x24')]);if(_0x457a14['name']){delete _0x457a14['name'];}_0x14d186['status'](_0x3b7d69)[_0xd96a('0x25')](_0x457a14);};}exports[_0xd96a('0x26')]=function(_0x18bed8,_0x44fdca){var _0x3478d3={},_0x201c0e={},_0x426809={'count':0x0,'rows':[]};var _0x214098=_[_0xd96a('0x27')](db[_0xd96a('0x28')][_0xd96a('0x29')],function(_0x265d8b){return{'name':_0x265d8b[_0xd96a('0x2a')],'type':_0x265d8b[_0xd96a('0x2b')][_0xd96a('0x2c')]};});_0x201c0e[_0xd96a('0x2d')]=_[_0xd96a('0x27')](_0x214098,'name');_0x201c0e[_0xd96a('0x2e')]=_[_0xd96a('0x2f')](_0x18bed8[_0xd96a('0x2e')]);_0x201c0e[_0xd96a('0x30')]=_['intersection'](_0x201c0e[_0xd96a('0x2d')],_0x201c0e[_0xd96a('0x2e')]);_0x3478d3[_0xd96a('0x31')]=_[_0xd96a('0x32')](_0x201c0e[_0xd96a('0x2d')],qs[_0xd96a('0x33')](_0x18bed8['query'][_0xd96a('0x33')]));_0x3478d3[_0xd96a('0x31')]=_0x3478d3[_0xd96a('0x31')][_0xd96a('0x34')]?_0x3478d3[_0xd96a('0x31')]:_0x201c0e['model'];if(!_0x18bed8['query'][_0xd96a('0x35')]('nolimit')){_0x3478d3[_0xd96a('0x1e')]=qs[_0xd96a('0x1e')](_0x18bed8[_0xd96a('0x2e')][_0xd96a('0x1e')]);_0x3478d3['offset']=qs[_0xd96a('0x1d')](_0x18bed8[_0xd96a('0x2e')][_0xd96a('0x1d')]);}_0x3478d3[_0xd96a('0x36')]=qs['sort'](_0x18bed8['query']['sort']);_0x3478d3[_0xd96a('0x37')]=qs[_0xd96a('0x30')](_['pick'](_0x18bed8[_0xd96a('0x2e')],_0x201c0e[_0xd96a('0x30')]),_0x214098);if(_0x18bed8[_0xd96a('0x2e')][_0xd96a('0x38')]){_0x3478d3[_0xd96a('0x37')]=_[_0xd96a('0x39')](_0x3478d3['where'],{'$or':_[_0xd96a('0x27')](_0x214098,function(_0x259958){if(_0x259958[_0xd96a('0x2b')]!==_0xd96a('0x3a')){var _0x4859e5={};_0x4859e5[_0x259958[_0xd96a('0x3b')]]={'$like':'%'+_0x18bed8['query'][_0xd96a('0x38')]+'%'};return _0x4859e5;}})});}_0x3478d3=_['merge']({},_0x3478d3,_0x18bed8[_0xd96a('0x3c')]);var _0x1537f2={'where':_0x3478d3[_0xd96a('0x37')]};return db[_0xd96a('0x28')][_0xd96a('0x1c')](_0x1537f2)[_0xd96a('0x22')](function(_0x1423d2){_0x426809[_0xd96a('0x1c')]=_0x1423d2;if(_0x18bed8[_0xd96a('0x2e')]['includeAll']){_0x3478d3[_0xd96a('0x3d')]=[{'all':!![]}];}return db[_0xd96a('0x28')]['findAll'](_0x3478d3);})[_0xd96a('0x22')](function(_0xa8fdb9){_0x426809[_0xd96a('0x3e')]=_0xa8fdb9;return _0x426809;})['then'](respondWithFilteredResult(_0x44fdca,_0x3478d3))[_0xd96a('0x3f')](handleError(_0x44fdca,null));};exports['show']=function(_0x1dba54,_0x33a779){var _0x3b95e6={'raw':![],'where':{'id':_0x1dba54[_0xd96a('0x40')]['id']}},_0x48624e={};_0x48624e[_0xd96a('0x2d')]=_[_0xd96a('0x2f')](db[_0xd96a('0x28')][_0xd96a('0x29')]);_0x48624e[_0xd96a('0x2e')]=_[_0xd96a('0x2f')](_0x1dba54[_0xd96a('0x2e')]);_0x48624e[_0xd96a('0x30')]=_['intersection'](_0x48624e['model'],_0x48624e[_0xd96a('0x2e')]);_0x3b95e6[_0xd96a('0x31')]=_[_0xd96a('0x32')](_0x48624e[_0xd96a('0x2d')],qs[_0xd96a('0x33')](_0x1dba54['query'][_0xd96a('0x33')]));_0x3b95e6[_0xd96a('0x31')]=_0x3b95e6[_0xd96a('0x31')][_0xd96a('0x34')]?_0x3b95e6['attributes']:_0x48624e[_0xd96a('0x2d')];if(_0x1dba54[_0xd96a('0x2e')][_0xd96a('0x41')]){_0x3b95e6[_0xd96a('0x3d')]=[{'all':!![]}];}_0x3b95e6=_[_0xd96a('0x39')]({},_0x3b95e6,_0x1dba54[_0xd96a('0x3c')]);return db['AnalyticFieldReport']['find'](_0x3b95e6)['then'](handleEntityNotFound(_0x33a779,null))[_0xd96a('0x22')](respondWithResult(_0x33a779,null))[_0xd96a('0x3f')](handleError(_0x33a779,null));};exports[_0xd96a('0x42')]=function(_0x1ded40,_0x157fb6){return db[_0xd96a('0x28')]['create'](_0x1ded40[_0xd96a('0x43')],{})[_0xd96a('0x22')](respondWithResult(_0x157fb6,0xc9))[_0xd96a('0x3f')](handleError(_0x157fb6,null));};exports['bulkCreate']=function(_0x314d2c,_0x4c2a49){return db[_0xd96a('0x28')][_0xd96a('0x44')](_0x314d2c[_0xd96a('0x43')],{'raw':![],'individualHooks':!![]})[_0xd96a('0x22')](respondWithResult(_0x4c2a49,0xc9))['catch'](handleError(_0x4c2a49,null));};exports[_0xd96a('0x21')]=function(_0x28b92c,_0x519ff6){if(_0x28b92c[_0xd96a('0x43')]['id']){delete _0x28b92c[_0xd96a('0x43')]['id'];}return db[_0xd96a('0x28')]['find']({'where':{'id':_0x28b92c[_0xd96a('0x40')]['id']}})['then'](handleEntityNotFound(_0x519ff6,null))[_0xd96a('0x22')](saveUpdates(_0x28b92c[_0xd96a('0x43')],null))['then'](respondWithResult(_0x519ff6,null))[_0xd96a('0x3f')](handleError(_0x519ff6,null));};exports['destroy']=function(_0x589ffb,_0x5f4f02){return db[_0xd96a('0x28')][_0xd96a('0x45')]({'where':{'id':_0x589ffb[_0xd96a('0x40')]['id']}})['then'](handleEntityNotFound(_0x5f4f02,null))[_0xd96a('0x22')](removeEntity(_0x5f4f02,null))[_0xd96a('0x3f')](handleError(_0x5f4f02,null));};exports[_0xd96a('0x46')]=function(_0xb3d02,_0xe5ba47){return db['AnalyticFieldReport'][_0xd96a('0x23')]({'where':{'id':_0xb3d02[_0xd96a('0x2e')][_0xd96a('0x47')]||[]},'raw':![],'individualHooks':!![]})[_0xd96a('0x22')](respondWithResult(_0xe5ba47,0xcc))[_0xd96a('0x3f')](handleError(_0xe5ba47,null));};exports[_0xd96a('0x48')]=function(_0x4fdfa5,_0x579111,_0x2d0a37){return db[_0xd96a('0x49')][_0xd96a('0x4a')]({'where':{'id':_0x4fdfa5[_0xd96a('0x40')]['id']}})[_0xd96a('0x22')](handleEntityNotFound(_0x579111,null))[_0xd96a('0x22')](function(_0x7e8b98){if(_0x7e8b98){return db['sequelize']['transaction'](function(_0x255f28){return db[_0xd96a('0x28')][_0xd96a('0x23')]({'where':{'CustomReportId':_0x4fdfa5[_0xd96a('0x40')]['id']},'transaction':_0x255f28})[_0xd96a('0x22')](function(_0x34954b){var _0x4fe728=_['map'](_0x4fdfa5[_0xd96a('0x43')],function(_0x44a94b){delete _0x44a94b['id'];_0x44a94b[_0xd96a('0x4b')]=_0x4fdfa5[_0xd96a('0x40')]['id'];return _0x44a94b;});return db['AnalyticFieldReport'][_0xd96a('0x44')](_0x4fe728,{'transaction':_0x255f28});});})[_0xd96a('0x22')](function(){return db[_0xd96a('0x28')][_0xd96a('0x4c')]({'where':{'CustomReportId':_0x4fdfa5[_0xd96a('0x40')]['id']}});});}})[_0xd96a('0x22')](respondWithResult(_0x579111,null))[_0xd96a('0x3f')](handleError(_0x579111,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 3a1f697..b69f856 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 _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 +var _0xf1dd=['exports','define','AnalyticFieldReport','analytics_report_fields','util','bluebird','path','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x2627f8,_0x3c372c){var _0x573bf3=function(_0x501da6){while(--_0x501da6){_0x2627f8['push'](_0x2627f8['shift']());}};_0x573bf3(++_0x3c372c);}(_0xf1dd,0x176));var _0xdf1d=function(_0x54f7c0,_0x27af83){_0x54f7c0=_0x54f7c0-0x0;var _0x245d03=_0xf1dd[_0x54f7c0];return _0x245d03;};'use strict';var _=require('lodash');var util=require(_0xdf1d('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xdf1d('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf1d('0x2'));var rimraf=require(_0xdf1d('0x3'));var config=require(_0xdf1d('0x4'));var attributes=require(_0xdf1d('0x5'));module[_0xdf1d('0x6')]=function(_0x34ea0c,_0x135f68){return _0x34ea0c[_0xdf1d('0x7')](_0xdf1d('0x8'),attributes,{'tableName':_0xdf1d('0x9'),'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 587f474..c2f5459 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 _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 +var _0xd152=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xd152,0x18a));var _0x2d15=function(_0x1f257c,_0x231de4){_0x1f257c=_0x1f257c-0x0;var _0x3d1bcd=_0xd152[_0x1f257c];return _0x3d1bcd;};'use strict';var _=require('lodash');var util=require(_0x2d15('0x0'));var moment=require('moment');var BPromise=require(_0x2d15('0x1'));var rs=require(_0x2d15('0x2'));var fs=require('fs');var Redis=require(_0x2d15('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2d15('0x4'))(_0x2d15('0x5'));var config=require(_0x2d15('0x6'));var jayson=require(_0x2d15('0x7'));var client=jayson[_0x2d15('0x8')][_0x2d15('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c0f86,_0x43bc1d,_0x4eee02){return new BPromise(function(_0x2cbdf1,_0x31ffa8){return client['request'](_0x5c0f86,_0x4eee02)[_0x2d15('0xa')](function(_0x4593f3){logger[_0x2d15('0xb')](_0x2d15('0xc'),_0x43bc1d,'request\x20sent');logger[_0x2d15('0xd')](_0x2d15('0xe'),_0x43bc1d,_0x2d15('0xf'),JSON[_0x2d15('0x10')](_0x4593f3));if(_0x4593f3[_0x2d15('0x11')]){if(_0x4593f3[_0x2d15('0x11')][_0x2d15('0x12')]===0x1f4){logger[_0x2d15('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x43bc1d,_0x4593f3[_0x2d15('0x11')][_0x2d15('0x13')]);return _0x31ffa8(_0x4593f3[_0x2d15('0x11')][_0x2d15('0x13')]);}logger[_0x2d15('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x43bc1d,_0x4593f3[_0x2d15('0x11')][_0x2d15('0x13')]);return _0x2cbdf1(_0x4593f3[_0x2d15('0x11')][_0x2d15('0x13')]);}else{logger[_0x2d15('0xb')](_0x2d15('0xc'),_0x43bc1d,_0x2d15('0xf'));_0x2cbdf1(_0x4593f3[_0x2d15('0x14')][_0x2d15('0x13')]);}})[_0x2d15('0x15')](function(_0x114119){logger[_0x2d15('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x43bc1d,_0x114119);_0x31ffa8(_0x114119);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 2d40ea4..b9ea647 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 _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 +var _0x7217=['put','update','delete','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','/create_many','bulkCreate','/:id/create_many','addFields'];(function(_0x5d1305,_0x316ad2){var _0x3368aa=function(_0x403aeb){while(--_0x403aeb){_0x5d1305['push'](_0x5d1305['shift']());}};_0x3368aa(++_0x316ad2);}(_0x7217,0x19e));var _0x7721=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x7217[_0x138f59];return _0x3d114d;};'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')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xc')](_0x7721('0xe'),auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['post'](_0x7721('0x10'),auth[_0x7721('0x8')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x13')]);router[_0x7721('0x14')]('/destroy_many',auth[_0x7721('0x8')](),controller[_0x7721('0x15')]);router['delete'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 8547f4c..f0fa63e 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 _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 +var _0xf04c=['name','sequelize','exports','STRING'];(function(_0xa84f31,_0x261b6f){var _0x4cc842=function(_0x33a31d){while(--_0x33a31d){_0xa84f31['push'](_0xa84f31['shift']());}};_0x4cc842(++_0x261b6f);}(_0xf04c,0xfd));var _0xcf04=function(_0x1b811b,_0x27b538){_0x1b811b=_0x1b811b-0x0;var _0x28dd36=_0xf04c[_0x1b811b];return _0x28dd36;};'use strict';var Sequelize=require(_0xcf04('0x0'));module[_0xcf04('0x1')]={'name':{'type':Sequelize[_0xcf04('0x2')],'allowNull':![],'unique':_0xcf04('0x3')},'table':{'type':Sequelize[_0xcf04('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xcf04('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 37aa401..8abda27 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 _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 +var _0x30a7=['AnalyticMetric','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','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','sendStatus','status','end','json','count','offset','limit','reject','update','then','destroy','get','Metrics','UserProfileResource','stack','name','send','index','map','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','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'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x30a7,0xf4));var _0x730a=function(_0x267cd8,_0x2adc6d){_0x267cd8=_0x267cd8-0x0;var _0x232ab1=_0x30a7[_0x267cd8];return _0x232ab1;};'use strict';var pdf=require(_0x730a('0x0'));var emlformat=require(_0x730a('0x1'));var rimraf=require(_0x730a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x730a('0x3'));var rp=require(_0x730a('0x4'));var moment=require(_0x730a('0x5'));var BPromise=require(_0x730a('0x6'));var Mustache=require('mustache');var util=require(_0x730a('0x7'));var path=require(_0x730a('0x8'));var sox=require(_0x730a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x730a('0xa'));var squel=require('squel');var crypto=require(_0x730a('0xb'));var jsforce=require(_0x730a('0xc'));var deskjs=require(_0x730a('0xd'));var toCsv=require(_0x730a('0xe'));var querystring=require(_0x730a('0xf'));var Papa=require(_0x730a('0x10'));var Redis=require(_0x730a('0x11'));var authService=require(_0x730a('0x12'));var qs=require(_0x730a('0x13'));var as=require(_0x730a('0x14'));var hardwareService=require(_0x730a('0x15'));var logger=require(_0x730a('0x16'))(_0x730a('0x17'));var utils=require(_0x730a('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x730a('0x19'));var db=require(_0x730a('0x1a'))['db'];function respondWithStatusCode(_0x4afbbf,_0x3ab82a){_0x3ab82a=_0x3ab82a||0xcc;return function(_0x2faa30){if(_0x2faa30){return _0x4afbbf[_0x730a('0x1b')](_0x3ab82a);}return _0x4afbbf[_0x730a('0x1c')](_0x3ab82a)[_0x730a('0x1d')]();};}function respondWithResult(_0x3171c0,_0x1fd5f2){_0x1fd5f2=_0x1fd5f2||0xc8;return function(_0x2502a3){if(_0x2502a3){return _0x3171c0['status'](_0x1fd5f2)[_0x730a('0x1e')](_0x2502a3);}};}function respondWithFilteredResult(_0x4622ad,_0x369408){return function(_0x2970a7){if(_0x2970a7){var _0x22a8d9=_0x2970a7[_0x730a('0x1f')],_0x368786=_0x369408[_0x730a('0x20')],_0x39737b=_0x369408[_0x730a('0x20')]+_0x369408[_0x730a('0x21')],_0x5e1b59;if(_0x39737b>=_0x22a8d9){_0x39737b=_0x22a8d9;_0x5e1b59=0xc8;}else{_0x5e1b59=0xce;}_0x4622ad[_0x730a('0x1c')](_0x5e1b59);return _0x4622ad['set']('Content-Range',_0x368786+'-'+_0x39737b+'/'+_0x22a8d9)[_0x730a('0x1e')](_0x2970a7);}return null;};}function patchUpdates(_0x217619){return function(_0x7089fb){try{jsonpatch['apply'](_0x7089fb,_0x217619,!![]);}catch(_0x418de7){return BPromise[_0x730a('0x22')](_0x418de7);}return _0x7089fb['save']();};}function saveUpdates(_0xbc8149,_0x3fd623){return function(_0x455183){if(_0x455183){return _0x455183[_0x730a('0x23')](_0xbc8149)[_0x730a('0x24')](function(_0x2392e5){return _0x2392e5;});}return null;};}function removeEntity(_0x486e38,_0x52fdbd){return function(_0x372351){if(_0x372351){return _0x372351[_0x730a('0x25')]()[_0x730a('0x24')](function(){var _0x3b8696=_0x372351[_0x730a('0x26')]({'plain':!![]});var _0x598308=_0x730a('0x27');return db[_0x730a('0x28')][_0x730a('0x25')]({'where':{'type':_0x598308,'resourceId':_0x3b8696['id']}})[_0x730a('0x24')](function(){return _0x372351;});})[_0x730a('0x24')](function(){_0x486e38[_0x730a('0x1c')](0xcc)[_0x730a('0x1d')]();});}};}function handleEntityNotFound(_0x317d3c,_0x5eff4a){return function(_0x8ad44c){if(!_0x8ad44c){_0x317d3c[_0x730a('0x1b')](0x194);}return _0x8ad44c;};}function handleError(_0x43f018,_0x164b92){_0x164b92=_0x164b92||0x1f4;return function(_0x420cbc){logger['error'](_0x420cbc[_0x730a('0x29')]);if(_0x420cbc[_0x730a('0x2a')]){delete _0x420cbc[_0x730a('0x2a')];}_0x43f018[_0x730a('0x1c')](_0x164b92)[_0x730a('0x2b')](_0x420cbc);};}exports[_0x730a('0x2c')]=function(_0x1cfa1b,_0x18698a){var _0x9531bf={},_0xd26626={},_0x2744d9={'count':0x0,'rows':[]};var _0x261865=_[_0x730a('0x2d')](db['AnalyticMetric']['rawAttributes'],function(_0x123c40){return{'name':_0x123c40[_0x730a('0x2e')],'type':_0x123c40[_0x730a('0x2f')]['key']};});_0xd26626['model']=_[_0x730a('0x2d')](_0x261865,_0x730a('0x2a'));_0xd26626[_0x730a('0x30')]=_['keys'](_0x1cfa1b[_0x730a('0x30')]);_0xd26626[_0x730a('0x31')]=_[_0x730a('0x32')](_0xd26626[_0x730a('0x33')],_0xd26626[_0x730a('0x30')]);_0x9531bf[_0x730a('0x34')]=_[_0x730a('0x32')](_0xd26626['model'],qs[_0x730a('0x35')](_0x1cfa1b['query'][_0x730a('0x35')]));_0x9531bf[_0x730a('0x34')]=_0x9531bf[_0x730a('0x34')][_0x730a('0x36')]?_0x9531bf[_0x730a('0x34')]:_0xd26626[_0x730a('0x33')];if(!_0x1cfa1b[_0x730a('0x30')][_0x730a('0x37')]('nolimit')){_0x9531bf[_0x730a('0x21')]=qs['limit'](_0x1cfa1b[_0x730a('0x30')][_0x730a('0x21')]);_0x9531bf[_0x730a('0x20')]=qs[_0x730a('0x20')](_0x1cfa1b[_0x730a('0x30')]['offset']);}_0x9531bf['order']=qs[_0x730a('0x38')](_0x1cfa1b[_0x730a('0x30')]['sort']);_0x9531bf[_0x730a('0x39')]=qs[_0x730a('0x31')](_['pick'](_0x1cfa1b[_0x730a('0x30')],_0xd26626['filters']),_0x261865);if(_0x1cfa1b['query']['filter']){_0x9531bf[_0x730a('0x39')]=_[_0x730a('0x3a')](_0x9531bf[_0x730a('0x39')],{'$or':_[_0x730a('0x2d')](_0x261865,function(_0x9ae461){if(_0x9ae461['type']!==_0x730a('0x3b')){var _0x379e34={};_0x379e34[_0x9ae461[_0x730a('0x2a')]]={'$like':'%'+_0x1cfa1b['query'][_0x730a('0x3c')]+'%'};return _0x379e34;}})});}_0x9531bf=_[_0x730a('0x3a')]({},_0x9531bf,_0x1cfa1b[_0x730a('0x3d')]);var _0x15473c={'where':_0x9531bf[_0x730a('0x39')]};return db['AnalyticMetric'][_0x730a('0x1f')](_0x15473c)[_0x730a('0x24')](function(_0x532bc9){_0x2744d9[_0x730a('0x1f')]=_0x532bc9;if(_0x1cfa1b[_0x730a('0x30')][_0x730a('0x3e')]){_0x9531bf[_0x730a('0x3f')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x9531bf);})[_0x730a('0x24')](function(_0x5a313c){_0x2744d9[_0x730a('0x40')]=_0x5a313c;return _0x2744d9;})[_0x730a('0x24')](respondWithFilteredResult(_0x18698a,_0x9531bf))[_0x730a('0x41')](handleError(_0x18698a,null));};exports[_0x730a('0x42')]=function(_0x2f1a14,_0x4c769d){var _0x1e40df={'raw':!![],'where':{'id':_0x2f1a14[_0x730a('0x43')]['id']}},_0x14b13f={};_0x14b13f[_0x730a('0x33')]=_[_0x730a('0x44')](db['AnalyticMetric'][_0x730a('0x45')]);_0x14b13f['query']=_[_0x730a('0x44')](_0x2f1a14[_0x730a('0x30')]);_0x14b13f[_0x730a('0x31')]=_[_0x730a('0x32')](_0x14b13f[_0x730a('0x33')],_0x14b13f[_0x730a('0x30')]);_0x1e40df['attributes']=_[_0x730a('0x32')](_0x14b13f['model'],qs[_0x730a('0x35')](_0x2f1a14['query'][_0x730a('0x35')]));_0x1e40df['attributes']=_0x1e40df[_0x730a('0x34')]['length']?_0x1e40df[_0x730a('0x34')]:_0x14b13f['model'];if(_0x2f1a14[_0x730a('0x30')]['includeAll']){_0x1e40df['include']=[{'all':!![]}];}_0x1e40df=_['merge']({},_0x1e40df,_0x2f1a14['options']);return db['AnalyticMetric'][_0x730a('0x46')](_0x1e40df)['then'](handleEntityNotFound(_0x4c769d,null))['then'](respondWithResult(_0x4c769d,null))['catch'](handleError(_0x4c769d,null));};exports['create']=function(_0x11d1ab,_0x477815){return db['AnalyticMetric'][_0x730a('0x47')](_0x11d1ab[_0x730a('0x48')],{})[_0x730a('0x24')](function(_0x5e7207){var _0x55f953=_0x11d1ab[_0x730a('0x49')][_0x730a('0x26')]({'plain':!![]});if(!_0x55f953)throw new Error(_0x730a('0x4a'));if(_0x55f953[_0x730a('0x4b')]===_0x730a('0x49')){var _0x56eded=_0x5e7207[_0x730a('0x26')]({'plain':!![]});var _0x46354a='Metrics';return db[_0x730a('0x4c')][_0x730a('0x46')]({'where':{'name':_0x46354a,'userProfileId':_0x55f953[_0x730a('0x4d')]},'raw':!![]})[_0x730a('0x24')](function(_0x3c9c08){if(_0x3c9c08&&_0x3c9c08[_0x730a('0x4e')]===0x0){return db[_0x730a('0x28')]['create']({'name':_0x56eded['name'],'resourceId':_0x56eded['id'],'type':_0x3c9c08[_0x730a('0x2a')],'sectionId':_0x3c9c08['id']},{})[_0x730a('0x24')](function(){return _0x5e7207;});}else{return _0x5e7207;}})['catch'](function(_0x283840){logger['error'](_0x730a('0x4f'),_0x283840);throw _0x283840;});}return _0x5e7207;})[_0x730a('0x24')](respondWithResult(_0x477815,0xc9))[_0x730a('0x41')](handleError(_0x477815,null));};exports['update']=function(_0x323725,_0x1df085){if(_0x323725[_0x730a('0x48')]['id']){delete _0x323725['body']['id'];}return db[_0x730a('0x50')][_0x730a('0x46')]({'where':{'id':_0x323725[_0x730a('0x43')]['id']}})['then'](handleEntityNotFound(_0x1df085,null))[_0x730a('0x24')](saveUpdates(_0x323725[_0x730a('0x48')],null))[_0x730a('0x24')](respondWithResult(_0x1df085,null))['catch'](handleError(_0x1df085,null));};exports['destroy']=function(_0x2687fa,_0x4ec525){return db['AnalyticMetric']['find']({'where':{'id':_0x2687fa[_0x730a('0x43')]['id']}})[_0x730a('0x24')](handleEntityNotFound(_0x4ec525,null))[_0x730a('0x24')](removeEntity(_0x4ec525,null))[_0x730a('0x41')](handleError(_0x4ec525,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index f934732..864df8a 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 _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 +var _0xcb94=['exports','define','AnalyticMetric','analytics_metrics','lodash','api','moment','path','rimraf','../../config/environment','./analyticMetric.attributes'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0xcb94,0x101));var _0x4cb9=function(_0x113386,_0x2fef03){_0x113386=_0x113386-0x0;var _0x369fe0=_0xcb94[_0x113386];return _0x369fe0;};'use strict';var _=require(_0x4cb9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4cb9('0x1'));var moment=require(_0x4cb9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4cb9('0x3'));var rimraf=require(_0x4cb9('0x4'));var config=require(_0x4cb9('0x5'));var attributes=require(_0x4cb9('0x6'));module[_0x4cb9('0x7')]=function(_0x593f05,_0x5760a6){return _0x593f05[_0x4cb9('0x8')](_0x4cb9('0x9'),attributes,{'tableName':_0x4cb9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index efddade..4da86c9 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 _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 +var _0x1396=['then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x1a7011,_0x44b2c2){var _0x5c1c7a=function(_0x5ae062){while(--_0x5ae062){_0x1a7011['push'](_0x1a7011['shift']());}};_0x5c1c7a(++_0x44b2c2);}(_0x1396,0x11d));var _0x6139=function(_0x46d87a,_0x5183db){_0x46d87a=_0x46d87a-0x0;var _0x115296=_0x1396[_0x46d87a];return _0x115296;};'use strict';var _=require(_0x6139('0x0'));var util=require('util');var moment=require(_0x6139('0x1'));var BPromise=require('bluebird');var rs=require(_0x6139('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6139('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6139('0x4'))(_0x6139('0x5'));var config=require('../../config/environment');var jayson=require(_0x6139('0x6'));var client=jayson[_0x6139('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a8a99,_0x27e347,_0x2b9fc8){return new BPromise(function(_0x1dc387,_0x49dfd4){return client[_0x6139('0x8')](_0x1a8a99,_0x2b9fc8)[_0x6139('0x9')](function(_0xd64464){logger[_0x6139('0xa')](_0x6139('0xb'),_0x27e347,_0x6139('0xc'));logger[_0x6139('0xd')](_0x6139('0xe'),_0x27e347,'request\x20sent',JSON[_0x6139('0xf')](_0xd64464));if(_0xd64464[_0x6139('0x10')]){if(_0xd64464[_0x6139('0x10')][_0x6139('0x11')]===0x1f4){logger[_0x6139('0x10')](_0x6139('0xb'),_0x27e347,_0xd64464['error'][_0x6139('0x12')]);return _0x49dfd4(_0xd64464[_0x6139('0x10')][_0x6139('0x12')]);}logger['error'](_0x6139('0xb'),_0x27e347,_0xd64464['error'][_0x6139('0x12')]);return _0x1dc387(_0xd64464[_0x6139('0x10')][_0x6139('0x12')]);}else{logger[_0x6139('0xa')](_0x6139('0xb'),_0x27e347,'request\x20sent');_0x1dc387(_0xd64464[_0x6139('0x13')][_0x6139('0x12')]);}})[_0x6139('0x14')](function(_0xb59d1a){logger[_0x6139('0x10')](_0x6139('0xb'),_0x27e347,_0xb59d1a);_0x49dfd4(_0xb59d1a);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 84d4a30..b210543 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 _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 +var _0x53ec=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./analyticMetric.controller','get','index','/:id','isAuthenticated'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x53ec,0x192));var _0xc53e=function(_0x33f3db,_0x19a892){_0x33f3db=_0x33f3db-0x0;var _0x2f7cbb=_0x53ec[_0x33f3db];return _0x2f7cbb;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc53e('0x6'));var config=require('../../config/environment');var controller=require(_0xc53e('0x7'));router[_0xc53e('0x8')]('/',auth['isAuthenticated'](),controller[_0xc53e('0x9')]);router['get'](_0xc53e('0xa'),auth[_0xc53e('0xb')](),controller['show']);router[_0xc53e('0xc')]('/',auth[_0xc53e('0xb')](),controller[_0xc53e('0xd')]);router[_0xc53e('0xe')](_0xc53e('0xa'),auth[_0xc53e('0xb')](),controller[_0xc53e('0xf')]);router[_0xc53e('0x10')](_0xc53e('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc53e('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index f5b48f3..578cf53 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 _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 +var _0x1479=['exports','TEXT'];(function(_0x3b8a3b,_0x1a7652){var _0x504541=function(_0x3d0337){while(--_0x3d0337){_0x3b8a3b['push'](_0x3b8a3b['shift']());}};_0x504541(++_0x1a7652);}(_0x1479,0x1ce));var _0x9147=function(_0x1d2432,_0x52efd5){_0x1d2432=_0x1d2432-0x0;var _0x3e0ae1=_0x1479[_0x1d2432];return _0x3e0ae1;};'use strict';var Sequelize=require('sequelize');module[_0x9147('0x0')]={'tree':{'type':Sequelize[_0x9147('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 132ab1c..6d6352f 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 _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 +var _0x4744=['moment','mustache','util','sox','ejs','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','html-pdf','eml-format','zip-dir','fast-json-patch'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4744,0x1be));var _0x4474=function(_0x2757ad,_0x4cf1b8){_0x2757ad=_0x2757ad-0x0;var _0x2cab19=_0x4744[_0x2757ad];return _0x2cab19;};'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('request-promise');var moment=require(_0x4474('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4474('0x5'));var util=require(_0x4474('0x6'));var path=require('path');var sox=require(_0x4474('0x7'));var csv=require('to-csv');var ejs=require(_0x4474('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4474('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4474('0xa'));var toCsv=require(_0x4474('0xb'));var querystring=require(_0x4474('0xc'));var Papa=require(_0x4474('0xd'));var Redis=require(_0x4474('0xe'));var authService=require(_0x4474('0xf'));var qs=require(_0x4474('0x10'));var as=require(_0x4474('0x11'));var hardwareService=require(_0x4474('0x12'));var logger=require(_0x4474('0x13'))(_0x4474('0x14'));var utils=require(_0x4474('0x15'));var config=require(_0x4474('0x16'));var licenseUtil=require(_0x4474('0x17'));var db=require(_0x4474('0x18'))['db'];function respondWithStatusCode(_0x2ce251,_0x440a37){_0x440a37=_0x440a37||0xcc;return function(_0x33b5b9){if(_0x33b5b9){return _0x2ce251[_0x4474('0x19')](_0x440a37);}return _0x2ce251[_0x4474('0x1a')](_0x440a37)[_0x4474('0x1b')]();};}function respondWithResult(_0xb26158,_0x58ef8c){_0x58ef8c=_0x58ef8c||0xc8;return function(_0x2a85fe){if(_0x2a85fe){return _0xb26158[_0x4474('0x1a')](_0x58ef8c)[_0x4474('0x1c')](_0x2a85fe);}};}function respondWithFilteredResult(_0x2100fc,_0x27a690){return function(_0x449800){if(_0x449800){var _0x4acb46=_0x449800[_0x4474('0x1d')],_0x1d9f5d=_0x27a690[_0x4474('0x1e')],_0x5dd2a6=_0x27a690[_0x4474('0x1e')]+_0x27a690[_0x4474('0x1f')],_0x536df9;if(_0x5dd2a6>=_0x4acb46){_0x5dd2a6=_0x4acb46;_0x536df9=0xc8;}else{_0x536df9=0xce;}_0x2100fc[_0x4474('0x1a')](_0x536df9);return _0x2100fc[_0x4474('0x20')](_0x4474('0x21'),_0x1d9f5d+'-'+_0x5dd2a6+'/'+_0x4acb46)[_0x4474('0x1c')](_0x449800);}return null;};}function patchUpdates(_0x4c7d8f){return function(_0x169ba0){try{jsonpatch['apply'](_0x169ba0,_0x4c7d8f,!![]);}catch(_0x726f5){return BPromise[_0x4474('0x22')](_0x726f5);}return _0x169ba0[_0x4474('0x23')]();};}function saveUpdates(_0x128ca5,_0x22b87f){return function(_0x4545f7){if(_0x4545f7){return _0x4545f7[_0x4474('0x24')](_0x128ca5)[_0x4474('0x25')](function(_0x4c63b1){return _0x4c63b1;});}return null;};}function removeEntity(_0xfdf8ca,_0x2fbaac){return function(_0x5dc399){if(_0x5dc399){return _0x5dc399[_0x4474('0x26')]()['then'](function(){_0xfdf8ca[_0x4474('0x1a')](0xcc)[_0x4474('0x1b')]();});}};}function handleEntityNotFound(_0x100d87,_0x3da054){return function(_0x48df19){if(!_0x48df19){_0x100d87[_0x4474('0x19')](0x194);}return _0x48df19;};}function handleError(_0x9979e6,_0x2ee587){_0x2ee587=_0x2ee587||0x1f4;return function(_0x2143ca){logger['error'](_0x2143ca['stack']);if(_0x2143ca[_0x4474('0x27')]){delete _0x2143ca[_0x4474('0x27')];}_0x9979e6['status'](_0x2ee587)[_0x4474('0x28')](_0x2143ca);};}exports[_0x4474('0x29')]=function(_0xf29a82,_0x1b97af){var _0x383458={},_0x35925e={},_0x1f69a4={'count':0x0,'rows':[]};var _0x363e56=_['map'](db[_0x4474('0x2a')][_0x4474('0x2b')],function(_0x198c5b){return{'name':_0x198c5b[_0x4474('0x2c')],'type':_0x198c5b['type'][_0x4474('0x2d')]};});_0x35925e[_0x4474('0x2e')]=_['map'](_0x363e56,'name');_0x35925e[_0x4474('0x2f')]=_[_0x4474('0x30')](_0xf29a82[_0x4474('0x2f')]);_0x35925e[_0x4474('0x31')]=_[_0x4474('0x32')](_0x35925e[_0x4474('0x2e')],_0x35925e['query']);_0x383458['attributes']=_['intersection'](_0x35925e[_0x4474('0x2e')],qs['fields'](_0xf29a82[_0x4474('0x2f')][_0x4474('0x33')]));_0x383458[_0x4474('0x34')]=_0x383458['attributes'][_0x4474('0x35')]?_0x383458[_0x4474('0x34')]:_0x35925e[_0x4474('0x2e')];if(!_0xf29a82[_0x4474('0x2f')][_0x4474('0x36')](_0x4474('0x37'))){_0x383458['limit']=qs[_0x4474('0x1f')](_0xf29a82[_0x4474('0x2f')][_0x4474('0x1f')]);_0x383458[_0x4474('0x1e')]=qs[_0x4474('0x1e')](_0xf29a82[_0x4474('0x2f')][_0x4474('0x1e')]);}_0x383458[_0x4474('0x38')]=qs[_0x4474('0x39')](_0xf29a82[_0x4474('0x2f')][_0x4474('0x39')]);_0x383458[_0x4474('0x3a')]=qs[_0x4474('0x31')](_['pick'](_0xf29a82[_0x4474('0x2f')],_0x35925e[_0x4474('0x31')]),_0x363e56);if(_0xf29a82[_0x4474('0x2f')][_0x4474('0x3b')]){_0x383458['where']=_[_0x4474('0x3c')](_0x383458['where'],{'$or':_[_0x4474('0x3d')](_0x363e56,function(_0x396061){if(_0x396061[_0x4474('0x3e')]!==_0x4474('0x3f')){var _0x18de40={};_0x18de40[_0x396061[_0x4474('0x27')]]={'$like':'%'+_0xf29a82[_0x4474('0x2f')][_0x4474('0x3b')]+'%'};return _0x18de40;}})});}_0x383458=_[_0x4474('0x3c')]({},_0x383458,_0xf29a82[_0x4474('0x40')]);var _0x39a886={'where':_0x383458['where']};return db[_0x4474('0x2a')]['count'](_0x39a886)[_0x4474('0x25')](function(_0x1580e7){_0x1f69a4[_0x4474('0x1d')]=_0x1580e7;if(_0xf29a82[_0x4474('0x2f')]['includeAll']){_0x383458[_0x4474('0x41')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x4474('0x42')](_0x383458);})[_0x4474('0x25')](function(_0xff424e){_0x1f69a4[_0x4474('0x43')]=_0xff424e;return _0x1f69a4;})[_0x4474('0x25')](respondWithFilteredResult(_0x1b97af,_0x383458))[_0x4474('0x44')](handleError(_0x1b97af,null));};exports[_0x4474('0x45')]=function(_0x1664a1,_0x54b263){var _0x430a64={'raw':!![],'where':{'id':_0x1664a1[_0x4474('0x46')]['id']}},_0x21ae40={};_0x21ae40['model']=_[_0x4474('0x30')](db[_0x4474('0x2a')][_0x4474('0x2b')]);_0x21ae40[_0x4474('0x2f')]=_['keys'](_0x1664a1['query']);_0x21ae40[_0x4474('0x31')]=_[_0x4474('0x32')](_0x21ae40['model'],_0x21ae40[_0x4474('0x2f')]);_0x430a64[_0x4474('0x34')]=_[_0x4474('0x32')](_0x21ae40['model'],qs[_0x4474('0x33')](_0x1664a1[_0x4474('0x2f')]['fields']));_0x430a64['attributes']=_0x430a64[_0x4474('0x34')][_0x4474('0x35')]?_0x430a64[_0x4474('0x34')]:_0x21ae40[_0x4474('0x2e')];if(_0x1664a1[_0x4474('0x2f')][_0x4474('0x47')]){_0x430a64['include']=[{'all':!![]}];}_0x430a64=_[_0x4474('0x3c')]({},_0x430a64,_0x1664a1[_0x4474('0x40')]);return db['AnalyticTreeReport']['find'](_0x430a64)[_0x4474('0x25')](handleEntityNotFound(_0x54b263,null))[_0x4474('0x25')](respondWithResult(_0x54b263,null))[_0x4474('0x44')](handleError(_0x54b263,null));};exports[_0x4474('0x48')]=function(_0x1dec10,_0x18c486){return db[_0x4474('0x2a')][_0x4474('0x48')](_0x1dec10[_0x4474('0x49')],{})['then'](respondWithResult(_0x18c486,0xc9))[_0x4474('0x44')](handleError(_0x18c486,null));};exports['update']=function(_0x2ff020,_0x25b143){if(_0x2ff020[_0x4474('0x49')]['id']){delete _0x2ff020['body']['id'];}return db[_0x4474('0x2a')][_0x4474('0x4a')]({'where':{'id':_0x2ff020[_0x4474('0x46')]['id']}})[_0x4474('0x25')](handleEntityNotFound(_0x25b143,null))[_0x4474('0x25')](saveUpdates(_0x2ff020[_0x4474('0x49')],null))['then'](respondWithResult(_0x25b143,null))[_0x4474('0x44')](handleError(_0x25b143,null));};exports[_0x4474('0x26')]=function(_0x449786,_0x5837ae){return db[_0x4474('0x2a')][_0x4474('0x4a')]({'where':{'id':_0x449786['params']['id']}})[_0x4474('0x25')](handleEntityNotFound(_0x5837ae,null))[_0x4474('0x25')](removeEntity(_0x5837ae,null))['catch'](handleError(_0x5837ae,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index dfe7d4d..83aa3c9 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 _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 +var _0x3f35=['AnalyticTreeReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./analyticTreeReport.attributes','define'];(function(_0x30af1c,_0x4b7424){var _0x13f11c=function(_0x43e21b){while(--_0x43e21b){_0x30af1c['push'](_0x30af1c['shift']());}};_0x13f11c(++_0x4b7424);}(_0x3f35,0x1ae));var _0x53f3=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x3f35[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x53f3('0x0'));var util=require(_0x53f3('0x1'));var logger=require(_0x53f3('0x2'))(_0x53f3('0x3'));var moment=require(_0x53f3('0x4'));var BPromise=require(_0x53f3('0x5'));var rp=require(_0x53f3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53f3('0x7'));var config=require('../../config/environment');var attributes=require(_0x53f3('0x8'));module['exports']=function(_0x1b84bf,_0x325130){return _0x1b84bf[_0x53f3('0x9')](_0x53f3('0xa'),attributes,{'tableName':'analytics_report_trees','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 0432e43..11b146a 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 _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 +var _0x6cde=['info','request\x20sent','stringify','error','message','AnalyticTreeReport,\x20%s,\x20%s','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x10d4e4,_0x9ff071){var _0x2c6238=function(_0xfe5a96){while(--_0xfe5a96){_0x10d4e4['push'](_0x10d4e4['shift']());}};_0x2c6238(++_0x9ff071);}(_0x6cde,0x79));var _0xe6cd=function(_0x5cb393,_0x2ce7cd){_0x5cb393=_0x5cb393-0x0;var _0x135d7d=_0x6cde[_0x5cb393];return _0x135d7d;};'use strict';var _=require('lodash');var util=require(_0xe6cd('0x0'));var moment=require(_0xe6cd('0x1'));var BPromise=require('bluebird');var rs=require(_0xe6cd('0x2'));var fs=require('fs');var Redis=require(_0xe6cd('0x3'));var db=require(_0xe6cd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe6cd('0x5'))(_0xe6cd('0x6'));var config=require(_0xe6cd('0x7'));var jayson=require(_0xe6cd('0x8'));var client=jayson['client'][_0xe6cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53051f,_0x28296e,_0xb19abd){return new BPromise(function(_0x284963,_0x1e3106){return client[_0xe6cd('0xa')](_0x53051f,_0xb19abd)[_0xe6cd('0xb')](function(_0x493941){logger[_0xe6cd('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x28296e,_0xe6cd('0xd'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x28296e,_0xe6cd('0xd'),JSON[_0xe6cd('0xe')](_0x493941));if(_0x493941['error']){if(_0x493941[_0xe6cd('0xf')]['code']===0x1f4){logger[_0xe6cd('0xf')]('AnalyticTreeReport,\x20%s,\x20%s',_0x28296e,_0x493941[_0xe6cd('0xf')]['message']);return _0x1e3106(_0x493941[_0xe6cd('0xf')][_0xe6cd('0x10')]);}logger[_0xe6cd('0xf')](_0xe6cd('0x11'),_0x28296e,_0x493941[_0xe6cd('0xf')][_0xe6cd('0x10')]);return _0x284963(_0x493941[_0xe6cd('0xf')][_0xe6cd('0x10')]);}else{logger[_0xe6cd('0xc')](_0xe6cd('0x11'),_0x28296e,_0xe6cd('0xd'));_0x284963(_0x493941[_0xe6cd('0x12')][_0xe6cd('0x10')]);}})['catch'](function(_0x58eace){logger[_0xe6cd('0xf')](_0xe6cd('0x11'),_0x28296e,_0x58eace);_0x1e3106(_0x58eace);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 00c5b9d..2906f51 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 _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 +var _0xb1a7=['isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x555164,_0x13e97c){var _0x541861=function(_0x55d3c3){while(--_0x55d3c3){_0x555164['push'](_0x555164['shift']());}};_0x541861(++_0x13e97c);}(_0xb1a7,0xc7));var _0x7b1a=function(_0x57ceb8,_0x387c7b){_0x57ceb8=_0x57ceb8-0x0;var _0x3a071f=_0xb1a7[_0x57ceb8];return _0x3a071f;};'use strict';var multer=require(_0x7b1a('0x0'));var util=require(_0x7b1a('0x1'));var path=require(_0x7b1a('0x2'));var timeout=require(_0x7b1a('0x3'));var express=require(_0x7b1a('0x4'));var router=express[_0x7b1a('0x5')]();var auth=require(_0x7b1a('0x6'));var interaction=require(_0x7b1a('0x7'));var config=require(_0x7b1a('0x8'));var controller=require('./analyticTreeReport.controller');router[_0x7b1a('0x9')]('/',auth[_0x7b1a('0xa')](),controller[_0x7b1a('0xb')]);router[_0x7b1a('0x9')](_0x7b1a('0xc'),auth[_0x7b1a('0xa')](),controller[_0x7b1a('0xd')]);router[_0x7b1a('0xe')]('/',auth[_0x7b1a('0xa')](),controller[_0x7b1a('0xf')]);router[_0x7b1a('0x10')]('/:id',auth[_0x7b1a('0xa')](),controller[_0x7b1a('0x11')]);router[_0x7b1a('0x12')](_0x7b1a('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index dc64406..93ee632 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 _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 +var _0x5cf2=['exports','STRING','sequelize'];(function(_0x5c0e68,_0x3b7fbb){var _0x47c21e=function(_0x4e5e6b){while(--_0x4e5e6b){_0x5c0e68['push'](_0x5c0e68['shift']());}};_0x47c21e(++_0x3b7fbb);}(_0x5cf2,0x116));var _0x25cf=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0x5cf2[_0x383356];return _0x32ee5a;};'use strict';var Sequelize=require(_0x25cf('0x0'));module[_0x25cf('0x1')]={'name':{'type':Sequelize[_0x25cf('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x25cf('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 5bde69c..ebfc219 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 _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 +var _0xe47a=['basename','filename','download','findOne','join','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','stack','name','send','index','Attachment','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','order','sort','pick','filter','where','merge','map','findAll','catch','show','params','includeAll','options','find','clone','include','get','omit','createdAt','updatedAt','body','create','destroy','file'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0xe47a,0xff));var _0xae47=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xe47a[_0x2dea24];return _0x309d58;};'use strict';var pdf=require(_0xae47('0x0'));var emlformat=require(_0xae47('0x1'));var rimraf=require(_0xae47('0x2'));var zipdir=require(_0xae47('0x3'));var jsonpatch=require(_0xae47('0x4'));var rp=require(_0xae47('0x5'));var moment=require(_0xae47('0x6'));var BPromise=require(_0xae47('0x7'));var Mustache=require(_0xae47('0x8'));var util=require(_0xae47('0x9'));var path=require('path');var sox=require(_0xae47('0xa'));var csv=require(_0xae47('0xb'));var ejs=require(_0xae47('0xc'));var fs=require('fs');var _=require(_0xae47('0xd'));var squel=require(_0xae47('0xe'));var crypto=require('crypto');var jsforce=require(_0xae47('0xf'));var deskjs=require(_0xae47('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xae47('0x11'));var authService=require(_0xae47('0x12'));var qs=require(_0xae47('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae47('0x14'));var logger=require(_0xae47('0x15'))('api');var utils=require(_0xae47('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xae47('0x17'))['db'];function respondWithStatusCode(_0x58832e,_0x5e172a){_0x5e172a=_0x5e172a||0xcc;return function(_0x2bbd09){if(_0x2bbd09){return _0x58832e[_0xae47('0x18')](_0x5e172a);}return _0x58832e[_0xae47('0x19')](_0x5e172a)[_0xae47('0x1a')]();};}function respondWithResult(_0x404cc7,_0x268c36){_0x268c36=_0x268c36||0xc8;return function(_0x4c8dc3){if(_0x4c8dc3){return _0x404cc7[_0xae47('0x19')](_0x268c36)[_0xae47('0x1b')](_0x4c8dc3);}};}function respondWithFilteredResult(_0x2b1d2a,_0xf39992){return function(_0x5c8110){if(_0x5c8110){var _0x4fc460=_0x5c8110[_0xae47('0x1c')],_0x1072bb=_0xf39992[_0xae47('0x1d')],_0x5e1407=_0xf39992[_0xae47('0x1d')]+_0xf39992[_0xae47('0x1e')],_0x51159c;if(_0x5e1407>=_0x4fc460){_0x5e1407=_0x4fc460;_0x51159c=0xc8;}else{_0x51159c=0xce;}_0x2b1d2a[_0xae47('0x19')](_0x51159c);return _0x2b1d2a[_0xae47('0x1f')](_0xae47('0x20'),_0x1072bb+'-'+_0x5e1407+'/'+_0x4fc460)[_0xae47('0x1b')](_0x5c8110);}return null;};}function patchUpdates(_0x457347){return function(_0x16ca59){try{jsonpatch[_0xae47('0x21')](_0x16ca59,_0x457347,!![]);}catch(_0x2b81fa){return BPromise['reject'](_0x2b81fa);}return _0x16ca59[_0xae47('0x22')]();};}function saveUpdates(_0x375259,_0x27df3b){return function(_0x35abd2){if(_0x35abd2){return _0x35abd2[_0xae47('0x23')](_0x375259)[_0xae47('0x24')](function(_0x475608){return _0x475608;});}return null;};}function removeEntity(_0x3f78ae,_0x587373){return function(_0x42d63d){if(_0x42d63d){return _0x42d63d['destroy']()[_0xae47('0x24')](function(){_0x3f78ae[_0xae47('0x19')](0xcc)[_0xae47('0x1a')]();});}};}function handleEntityNotFound(_0x52c366,_0x2d0773){return function(_0x1ebe5a){if(!_0x1ebe5a){_0x52c366['sendStatus'](0x194);}return _0x1ebe5a;};}function handleError(_0x4c063b,_0x1e9cbf){_0x1e9cbf=_0x1e9cbf||0x1f4;return function(_0x2845de){logger['error'](_0x2845de[_0xae47('0x25')]);if(_0x2845de[_0xae47('0x26')]){delete _0x2845de[_0xae47('0x26')];}_0x4c063b[_0xae47('0x19')](_0x1e9cbf)[_0xae47('0x27')](_0x2845de);};}exports[_0xae47('0x28')]=function(_0x3cacbd,_0x4338ca){var _0x4e181c={},_0x2670d6={},_0xf8d891={'count':0x0,'rows':[]};var _0x41d49a=_['map'](db[_0xae47('0x29')][_0xae47('0x2a')],function(_0x426578){return{'name':_0x426578[_0xae47('0x2b')],'type':_0x426578[_0xae47('0x2c')]['key']};});_0x2670d6[_0xae47('0x2d')]=_['map'](_0x41d49a,_0xae47('0x26'));_0x2670d6['query']=_[_0xae47('0x2e')](_0x3cacbd['query']);_0x2670d6[_0xae47('0x2f')]=_[_0xae47('0x30')](_0x2670d6[_0xae47('0x2d')],_0x2670d6[_0xae47('0x31')]);_0x4e181c['attributes']=_[_0xae47('0x30')](_0x2670d6[_0xae47('0x2d')],qs[_0xae47('0x32')](_0x3cacbd[_0xae47('0x31')][_0xae47('0x32')]));_0x4e181c['attributes']=_0x4e181c[_0xae47('0x33')][_0xae47('0x34')]?_0x4e181c[_0xae47('0x33')]:_0x2670d6[_0xae47('0x2d')];if(!_0x3cacbd[_0xae47('0x31')]['hasOwnProperty']('nolimit')){_0x4e181c[_0xae47('0x1e')]=qs[_0xae47('0x1e')](_0x3cacbd[_0xae47('0x31')]['limit']);_0x4e181c[_0xae47('0x1d')]=qs['offset'](_0x3cacbd[_0xae47('0x31')][_0xae47('0x1d')]);}_0x4e181c[_0xae47('0x35')]=qs[_0xae47('0x36')](_0x3cacbd[_0xae47('0x31')]['sort']);_0x4e181c['where']=qs['filters'](_[_0xae47('0x37')](_0x3cacbd['query'],_0x2670d6['filters']),_0x41d49a);if(_0x3cacbd[_0xae47('0x31')][_0xae47('0x38')]){_0x4e181c[_0xae47('0x39')]=_[_0xae47('0x3a')](_0x4e181c[_0xae47('0x39')],{'$or':_[_0xae47('0x3b')](_0x41d49a,function(_0x11e70e){if(_0x11e70e['type']!=='VIRTUAL'){var _0x428d21={};_0x428d21[_0x11e70e['name']]={'$like':'%'+_0x3cacbd['query'][_0xae47('0x38')]+'%'};return _0x428d21;}})});}_0x4e181c=_['merge']({},_0x4e181c,_0x3cacbd['options']);var _0x5a40ef={'where':_0x4e181c[_0xae47('0x39')]};return db[_0xae47('0x29')]['count'](_0x5a40ef)[_0xae47('0x24')](function(_0x25cc40){_0xf8d891['count']=_0x25cc40;if(_0x3cacbd[_0xae47('0x31')]['includeAll']){_0x4e181c['include']=[{'all':!![]}];}return db[_0xae47('0x29')][_0xae47('0x3c')](_0x4e181c);})[_0xae47('0x24')](function(_0x1a30dc){_0xf8d891['rows']=_0x1a30dc;return _0xf8d891;})[_0xae47('0x24')](respondWithFilteredResult(_0x4338ca,_0x4e181c))[_0xae47('0x3d')](handleError(_0x4338ca,null));};exports[_0xae47('0x3e')]=function(_0x685e5a,_0x26fb75){var _0x4e51d8={'raw':!![],'where':{'id':_0x685e5a[_0xae47('0x3f')]['id']}},_0x52b30e={};_0x52b30e[_0xae47('0x2d')]=_['keys'](db[_0xae47('0x29')][_0xae47('0x2a')]);_0x52b30e[_0xae47('0x31')]=_['keys'](_0x685e5a[_0xae47('0x31')]);_0x52b30e[_0xae47('0x2f')]=_[_0xae47('0x30')](_0x52b30e[_0xae47('0x2d')],_0x52b30e[_0xae47('0x31')]);_0x4e51d8['attributes']=_[_0xae47('0x30')](_0x52b30e[_0xae47('0x2d')],qs[_0xae47('0x32')](_0x685e5a[_0xae47('0x31')][_0xae47('0x32')]));_0x4e51d8['attributes']=_0x4e51d8[_0xae47('0x33')][_0xae47('0x34')]?_0x4e51d8[_0xae47('0x33')]:_0x52b30e['model'];if(_0x685e5a[_0xae47('0x31')][_0xae47('0x40')]){_0x4e51d8['include']=[{'all':!![]}];}_0x4e51d8=_['merge']({},_0x4e51d8,_0x685e5a[_0xae47('0x41')]);return db[_0xae47('0x29')][_0xae47('0x42')](_0x4e51d8)[_0xae47('0x24')](handleEntityNotFound(_0x26fb75,null))['then'](respondWithResult(_0x26fb75,null))[_0xae47('0x3d')](handleError(_0x26fb75,null));};exports[_0xae47('0x43')]=function(_0x33af32,_0x46fe6b){var _0x18c25c={'where':{'id':_0x33af32[_0xae47('0x3f')]['id']}},_0x459a5e={};_0x459a5e[_0xae47('0x2d')]=_['keys'](db[_0xae47('0x29')][_0xae47('0x2a')]);_0x18c25c['attributes']=_[_0xae47('0x30')](_0x459a5e[_0xae47('0x2d')],qs['fields'](_0x33af32['query'][_0xae47('0x32')]));_0x18c25c[_0xae47('0x33')]=_0x18c25c['attributes'][_0xae47('0x34')]?_0x18c25c[_0xae47('0x33')]:_0x459a5e[_0xae47('0x2d')];if(_0x33af32[_0xae47('0x31')]['includeAll']){_0x18c25c[_0xae47('0x44')]=[{'all':!![]}];}_0x18c25c=_[_0xae47('0x3a')]({},_0x18c25c,_0x33af32['options']);return db[_0xae47('0x29')][_0xae47('0x42')](_0x18c25c)['then'](handleEntityNotFound(_0x46fe6b,null))[_0xae47('0x24')](function(_0x2e6603){if(_0x2e6603){var _0x346bb1=_0x2e6603[_0xae47('0x45')]({'plain':!![]});_0x346bb1=qs[_0xae47('0x46')](_0x346bb1,['id',_0xae47('0x47'),_0xae47('0x48')]);_0x33af32[_0xae47('0x49')]=_[_0xae47('0x46')](_0x33af32[_0xae47('0x49')],['id','createdAt',_0xae47('0x48')]);return db['Attachment'][_0xae47('0x4a')](_[_0xae47('0x3a')](_0x346bb1,_0x33af32[_0xae47('0x49')]),{'include':_0x33af32[_0xae47('0x31')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xae47('0x24')](respondWithResult(_0x46fe6b,0xc9))[_0xae47('0x3d')](handleError(_0x46fe6b,null));};exports['update']=function(_0x2267b4,_0x4771cd){if(_0x2267b4[_0xae47('0x49')]['id']){delete _0x2267b4[_0xae47('0x49')]['id'];}return db[_0xae47('0x29')][_0xae47('0x42')]({'where':{'id':_0x2267b4[_0xae47('0x3f')]['id']}})[_0xae47('0x24')](handleEntityNotFound(_0x4771cd,null))['then'](saveUpdates(_0x2267b4[_0xae47('0x49')],null))[_0xae47('0x24')](respondWithResult(_0x4771cd,null))[_0xae47('0x3d')](handleError(_0x4771cd,null));};exports[_0xae47('0x4b')]=function(_0x18ef9a,_0x385eaf){return db['Attachment'][_0xae47('0x42')]({'where':{'id':_0x18ef9a['params']['id']}})['then'](handleEntityNotFound(_0x385eaf,null))[_0xae47('0x24')](removeEntity(_0x385eaf,null))[_0xae47('0x3d')](handleError(_0x385eaf,null));};exports['create']=function(_0x17f00e,_0x40eb30,_0x322072){_0x17f00e[_0xae47('0x49')]['name']=_0x17f00e[_0xae47('0x4c')]['originalname'];_0x17f00e[_0xae47('0x49')][_0xae47('0x4d')]=_0x17f00e[_0xae47('0x4c')][_0xae47('0x4e')];_0x17f00e[_0xae47('0x49')][_0xae47('0x2c')]=_0x17f00e[_0xae47('0x4c')]['mimetype'];return db[_0xae47('0x29')][_0xae47('0x4a')](_0x17f00e[_0xae47('0x49')])['then'](respondWithResult(_0x40eb30,0xc9))[_0xae47('0x3d')](handleError(_0x40eb30,null));};exports[_0xae47('0x4f')]=function(_0x4750a7,_0x115ca4,_0x175a81){return db[_0xae47('0x29')][_0xae47('0x50')]({'where':{'id':_0x4750a7[_0xae47('0x3f')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x115ca4,null))[_0xae47('0x24')](function(_0x5aa169){if(_0x5aa169){return _0x115ca4['download'](path[_0xae47('0x51')](config['root'],_0xae47('0x52'),_0x5aa169[_0xae47('0x4d')]));}})[_0xae47('0x3d')](handleError(_0x115ca4,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index c81c28d..3d72cdf 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 _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 +var _0x8a5c=['Attachment','attachments','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./attachment.attributes','exports','define'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0x8a5c,0x136));var _0xc8a5=function(_0x57cd26,_0x8d5f64){_0x57cd26=_0x57cd26-0x0;var _0x36267c=_0x8a5c[_0x57cd26];return _0x36267c;};'use strict';var _=require(_0xc8a5('0x0'));var util=require(_0xc8a5('0x1'));var logger=require(_0xc8a5('0x2'))(_0xc8a5('0x3'));var moment=require(_0xc8a5('0x4'));var BPromise=require(_0xc8a5('0x5'));var rp=require(_0xc8a5('0x6'));var fs=require('fs');var path=require(_0xc8a5('0x7'));var rimraf=require(_0xc8a5('0x8'));var config=require('../../config/environment');var attributes=require(_0xc8a5('0x9'));module[_0xc8a5('0xa')]=function(_0x5b6cc2,_0x1b4ed4){return _0x5b6cc2[_0xc8a5('0xb')](_0xc8a5('0xc'),attributes,{'tableName':_0xc8a5('0xd'),'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 b4d4385..076902b 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 _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 +var _0x7886=['Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','CreateAttachment','body','options','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1e94cb,_0x11ad28){var _0x18d02e=function(_0xcd580b){while(--_0xcd580b){_0x1e94cb['push'](_0x1e94cb['shift']());}};_0x18d02e(++_0x11ad28);}(_0x7886,0x70));var _0x6788=function(_0x412c40,_0x4a4b34){_0x412c40=_0x412c40-0x0;var _0x5710be=_0x7886[_0x412c40];return _0x5710be;};'use strict';var _=require(_0x6788('0x0'));var util=require(_0x6788('0x1'));var moment=require(_0x6788('0x2'));var BPromise=require(_0x6788('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6788('0x4'));var logger=require(_0x6788('0x5'))(_0x6788('0x6'));var config=require(_0x6788('0x7'));var jayson=require(_0x6788('0x8'));var client=jayson[_0x6788('0x9')][_0x6788('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a9d7e,_0x43330b,_0x1c45af){return new BPromise(function(_0x30fcf3,_0x351617){return client[_0x6788('0xb')](_0x2a9d7e,_0x1c45af)[_0x6788('0xc')](function(_0x109c54){logger['info'](_0x6788('0xd'),_0x43330b,_0x6788('0xe'));logger[_0x6788('0xf')]('Attachment,\x20%s,\x20%s,\x20%s',_0x43330b,'request\x20sent',JSON[_0x6788('0x10')](_0x109c54));if(_0x109c54[_0x6788('0x11')]){if(_0x109c54[_0x6788('0x11')]['code']===0x1f4){logger['error'](_0x6788('0xd'),_0x43330b,_0x109c54[_0x6788('0x11')][_0x6788('0x12')]);return _0x351617(_0x109c54[_0x6788('0x11')][_0x6788('0x12')]);}logger[_0x6788('0x11')](_0x6788('0xd'),_0x43330b,_0x109c54[_0x6788('0x11')][_0x6788('0x12')]);return _0x30fcf3(_0x109c54[_0x6788('0x11')][_0x6788('0x12')]);}else{logger[_0x6788('0x13')]('Attachment,\x20%s,\x20%s',_0x43330b,_0x6788('0xe'));_0x30fcf3(_0x109c54[_0x6788('0x14')]['message']);}})[_0x6788('0x15')](function(_0x5de950){logger[_0x6788('0x11')](_0x6788('0xd'),_0x43330b,_0x5de950);_0x351617(_0x5de950);});});}exports[_0x6788('0x16')]=function(_0x1fafd3){var _0x435c7e=this;return new Promise(function(_0x13e54d,_0x19af99){return db['Attachment']['create'](_0x1fafd3[_0x6788('0x17')],{'raw':_0x1fafd3[_0x6788('0x18')]?_0x1fafd3[_0x6788('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x6788('0xc')](function(_0x45b4b1){logger[_0x6788('0x13')](_0x6788('0x16'),_0x1fafd3);logger['debug'](_0x6788('0x16'),_0x1fafd3,JSON[_0x6788('0x10')](_0x45b4b1));_0x13e54d(_0x45b4b1);})[_0x6788('0x15')](function(_0x1b4c8c){logger[_0x6788('0x11')](_0x6788('0x16'),_0x1b4c8c[_0x6788('0x12')],_0x1fafd3);_0x19af99(_0x435c7e[_0x6788('0x11')](0x1f4,_0x1b4c8c[_0x6788('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 8168e37..7625546 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 _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 +var _0x68ee=['replace','single','file','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./attachment.controller','isAuthenticated','index','/:id','get','/:id/download','download','post','clone','diskStorage','server/files/attachments/','format','now'];(function(_0x3e4f6b,_0x30625d){var _0x548c85=function(_0x53dc7b){while(--_0x53dc7b){_0x3e4f6b['push'](_0x3e4f6b['shift']());}};_0x548c85(++_0x30625d);}(_0x68ee,0xd3));var _0xe68e=function(_0x5c5627,_0x29bd68){_0x5c5627=_0x5c5627-0x0;var _0x33a625=_0x68ee[_0x5c5627];return _0x33a625;};'use strict';var multer=require(_0xe68e('0x0'));var util=require(_0xe68e('0x1'));var path=require(_0xe68e('0x2'));var timeout=require(_0xe68e('0x3'));var express=require(_0xe68e('0x4'));var router=express[_0xe68e('0x5')]();var auth=require(_0xe68e('0x6'));var interaction=require(_0xe68e('0x7'));var config=require('../../config/environment');var controller=require(_0xe68e('0x8'));router['get']('/',auth[_0xe68e('0x9')](),controller[_0xe68e('0xa')]);router['get'](_0xe68e('0xb'),auth[_0xe68e('0x9')](),controller['show']);router[_0xe68e('0xc')](_0xe68e('0xd'),auth['isAuthenticated'](),controller[_0xe68e('0xe')]);router[_0xe68e('0xf')]('/:id/clone',auth[_0xe68e('0x9')](),controller[_0xe68e('0x10')]);var upload=multer({'storage':multer[_0xe68e('0x11')]({'destination':function(_0x3c89e9,_0x17805e,_0x44c2a4){_0x44c2a4(null,path['join'](config['root'],_0xe68e('0x12')));},'filename':function(_0x4348e3,_0x4706a3,_0x1dea52){_0x1dea52(null,util[_0xe68e('0x13')]('%s-%s',Date[_0xe68e('0x14')](),_0x4706a3['originalname'][_0xe68e('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe68e('0xf')]('/',upload[_0xe68e('0x16')](_0xe68e('0x17')),controller[_0xe68e('0x18')]);router['put'](_0xe68e('0xb'),auth[_0xe68e('0x9')](),controller[_0xe68e('0x19')]);router[_0xe68e('0x1a')]('/:id',auth[_0xe68e('0x9')](),controller[_0xe68e('0x1b')]);module[_0xe68e('0x1c')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 82827e8..d1293a3 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 _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 +var _0xc986=['getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../components/auth/service','signToken','login','authenticate','google','profile','email','callback','/login','clientSecret','secret','callbackURL','Setting','findOne','blockDuration','then','User','find','emails','admin','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','clearBlockUser'];(function(_0xa861aa,_0x2895a4){var _0x1e34de=function(_0x41ed53){while(--_0x41ed53){_0xa861aa['push'](_0xa861aa['shift']());}};_0x1e34de(++_0x2895a4);}(_0xc986,0xac));var _0x6c98=function(_0x50f674,_0xbe0e00){_0x50f674=_0x50f674-0x0;var _0x45a676=_0xc986[_0x50f674];return _0x45a676;};'use strict';var _=require(_0x6c98('0x0'));var passport=require(_0x6c98('0x1'));var GoogleStrategy=require(_0x6c98('0x2'))['Strategy'];var moment=require(_0x6c98('0x3'));var db=require(_0x6c98('0x4'))['db'];var config=require('../../config/environment');var signToken=require(_0x6c98('0x5'))[_0x6c98('0x6')];var utils=require('../../config/utils');exports[_0x6c98('0x7')]=passport[_0x6c98('0x8')](_0x6c98('0x9'),{'failureRedirect':'/login','scope':[_0x6c98('0xa'),_0x6c98('0xb')],'session':![]});exports[_0x6c98('0xc')]=passport[_0x6c98('0x8')](_0x6c98('0x9'),{'failureRedirect':_0x6c98('0xd'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0x6c98('0x9')]?config[_0x6c98('0x9')]['clientID']:'id','clientSecret':config['google']?config[_0x6c98('0x9')][_0x6c98('0xe')]:_0x6c98('0xf'),'callbackURL':config['google']?config[_0x6c98('0x9')][_0x6c98('0x10')]:''},function(_0x4d9c44,_0x530027,_0x165933,_0x5521db){var _0x50f98d,_0x309042;return db[_0x6c98('0x11')][_0x6c98('0x12')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x6c98('0x13')],'raw':!![]})[_0x6c98('0x14')](function(_0x4631fd){_0x50f98d=_0x4631fd;return db[_0x6c98('0x15')][_0x6c98('0x16')]({'where':{'email':_['map'](_0x165933[_0x6c98('0x17')],'value'),'role':{'$or':[_0x6c98('0x18'),'user',_0x6c98('0x19')]}}});})[_0x6c98('0x14')](function(_0x164058){_0x309042=_0x164058;if(_0x309042){if(_0x309042[_0x6c98('0x1a')]){return _0x5521db(_0x6c98('0x1b'));}else if(_0x50f98d[_0x6c98('0x13')]>0x0){if(_0x309042[_0x6c98('0x1c')]){if(moment(_0x309042[_0x6c98('0x1d')])[_0x6c98('0x1e')](_0x50f98d['blockDuration'],'minutes')>moment()){return _0x5521db('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0x6c98('0x1f')](_0x309042,0x0,![],null)[_0x6c98('0x14')](function(){return utils[_0x6c98('0x20')](_0x309042);})['then'](function(){return _0x5521db(null,_0x309042);});}}else{return utils[_0x6c98('0x20')](_0x309042)['then'](function(){return _0x5521db(null,_0x309042);});}}else{return utils[_0x6c98('0x20')](_0x309042)[_0x6c98('0x14')](function(){return _0x5521db(null,_0x309042);});}}return _0x5521db(_0x6c98('0x1b'));})[_0x6c98('0x21')](function(_0x1f905f){_0x5521db(_0x1f905f);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index ddd8f08..f05d5ca 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 _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 +var _0xdb76=['get','login','/callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0xd21fe7,_0x225a39){var _0x14d570=function(_0x3c0674){while(--_0x3c0674){_0xd21fe7['push'](_0xd21fe7['shift']());}};_0x14d570(++_0x225a39);}(_0xdb76,0x1be));var _0x6db7=function(_0x1feaed,_0x23e5dd){_0x1feaed=_0x1feaed-0x0;var _0x5f2d3e=_0xdb76[_0x1feaed];return _0x5f2d3e;};'use strict';var express=require(_0x6db7('0x0'));var passport=require(_0x6db7('0x1'));var router=express[_0x6db7('0x2')]();var controller=require(_0x6db7('0x3'));var userController=require(_0x6db7('0x4'));var authService=require('../../components/auth/service');router[_0x6db7('0x5')]('/',controller[_0x6db7('0x6')]);router[_0x6db7('0x5')](_0x6db7('0x7'),controller['callback'],authService[_0x6db7('0x8')],userController[_0x6db7('0x6')],authService[_0x6db7('0x9')]);module[_0x6db7('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 52b3bda..bb0c5a0 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 _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 +var _0x7278=['../../mysqldb','../../components/auth/service','../../config/utils','client','http','blockDuration','then','findOne','name','password','salt','role','blocked','blockedAt','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','allowedLoginAttempts','add','clearBlockUser','getLicense','catch','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','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','enforcePasswordHistory','validatePasswordPattern','previousPasswords','validatePasswordHistory','passwordHistoryLimit','resetPasswordToken','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','moment'];(function(_0x5d6335,_0xa7acbd){var _0x200f4a=function(_0x2192ae){while(--_0x2192ae){_0x5d6335['push'](_0x5d6335['shift']());}};_0x200f4a(++_0xa7acbd);}(_0x7278,0x161));var _0x8727=function(_0x656484,_0x5c83e6){_0x656484=_0x656484-0x0;var _0xe08f14=_0x7278[_0x656484];return _0xe08f14;};'use strict';var util=require(_0x8727('0x0'));var passport=require(_0x8727('0x1'));var LocalStrategy=require(_0x8727('0x2'))[_0x8727('0x3')];var jayson=require(_0x8727('0x4'));var _=require('lodash');var rs=require(_0x8727('0x5'));var moment=require(_0x8727('0x6'));var db=require(_0x8727('0x7'))['db'];var authService=require(_0x8727('0x8'));var utils=require(_0x8727('0x9'));var client=jayson[_0x8727('0xa')][_0x8727('0xb')]({'port':0x232b});function localAuthenticate(_0x5549d5,_0xfd1902,_0x2f491c,_0xffd783){var _0x435911,_0x4160c3;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x8727('0xc')],'raw':!![]})[_0x8727('0xd')](function(_0x3a6c9b){_0x435911=_0x3a6c9b;return _0x5549d5[_0x8727('0xe')]({'attributes':['id',_0x8727('0xf'),_0x8727('0x10'),_0x8727('0x11'),_0x8727('0x12'),'disabled',_0x8727('0x13'),_0x8727('0x14'),_0x8727('0x15')],'where':{'name':_0xfd1902,'role':{'$or':['admin',_0x8727('0x16'),_0x8727('0x17')]}}});})['then'](function(_0xbcde13){if(!_0xbcde13||_0xbcde13&&_0xbcde13[_0x8727('0xf')]!==_0xfd1902){throw new Error(_0x8727('0x18'));}else{_0x4160c3=_0xbcde13;return _0x4160c3;}})[_0x8727('0xd')](function(){_0x4160c3[_0x8727('0x19')](_0x2f491c,function(_0x3d84db,_0x3865e9){var _0x1916f7=_0x4160c3[_0x8727('0x15')]+0x1;if(_0x3d84db){return _0xffd783(_0x3d84db);}else if(!_0x3865e9){if(_0x4160c3[_0x8727('0x1a')]){return _0xffd783(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x435911[_0x8727('0x1b')]>0x0){if(_0x4160c3[_0x8727('0x13')]){if(_0x435911[_0x8727('0xc')]>0x0){if(moment(_0x4160c3[_0x8727('0x14')])[_0x8727('0x1c')](_0x435911[_0x8727('0xc')],'minutes')>moment()){return _0xffd783(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x8727('0x1d')](_0x4160c3,_0x1916f7,![],null)['then'](function(){return _0xffd783(null,![],{'message':_0x8727('0x18')});});}}else{return _0xffd783(null,![],{'message':_0x8727('0x18')});}}else{if(_0x1916f7>=_0x435911[_0x8727('0x1b')]){return utils[_0x8727('0x1d')](_0x4160c3,0x0,!![],moment())[_0x8727('0xd')](function(){return _0xffd783(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x8727('0x1d')](_0x4160c3,_0x1916f7,![],null)[_0x8727('0xd')](function(){return _0xffd783(null,![],{'message':_0x8727('0x18')});});}}}else{return _0xffd783(null,![],{'message':_0x8727('0x18')});}}else{if(_0x4160c3[_0x8727('0x1a')]){return _0xffd783(null,![],{'message':_0x8727('0x18')});}else if(_0x435911[_0x8727('0x1b')]>0x0){if(_0x4160c3[_0x8727('0x13')]){if(_0x435911[_0x8727('0xc')]>0x0){if(moment(_0x4160c3[_0x8727('0x14')])[_0x8727('0x1c')](_0x435911[_0x8727('0xc')],'minutes')>moment()){return _0xffd783(null,![],{'message':_0x8727('0x18')});}else{return utils[_0x8727('0x1d')](_0x4160c3,0x0,![],null)['then'](function(){return utils['getLicense'](_0x4160c3);})[_0x8727('0xd')](function(){return _0xffd783(null,_0x4160c3);});}}else{return _0xffd783(null,![],{'message':_0x8727('0x18')});}}else{return utils[_0x8727('0x1d')](_0x4160c3,0x0,![],null)['then'](function(){return utils[_0x8727('0x1e')](_0x4160c3);})[_0x8727('0xd')](function(){return _0xffd783(null,_0x4160c3);})[_0x8727('0x1f')](function(_0x440ff5){return _0xffd783(null,![],_0x440ff5);});}}else{if(_0x4160c3[_0x8727('0x13')]){return _0xffd783(null,![],{'message':_0x8727('0x18')});}else{return utils[_0x8727('0x1e')](_0x4160c3)[_0x8727('0xd')](function(){return _0xffd783(null,_0x4160c3);});}}}});})['catch'](function(_0x243f15){return _0xffd783(null,![],_0x243f15);});}function sendServiceMail(_0x307055){return db['MailAccount'][_0x8727('0x20')]({'where':{'service':!![]},'attributes':['id',_0x8727('0xf'),_0x8727('0x21')],'include':[{'model':db[_0x8727('0x22')],'as':_0x8727('0x23')}]})[_0x8727('0xd')](function(_0x57733d){if(!_0x57733d){throw new Error(_0x8727('0x24'));}var _0x563201={'tls':{'rejectUnauthorized':![]}};if(_0x57733d[_0x8727('0x23')]['service']){_0x563201[_0x8727('0x25')]=_0x57733d[_0x8727('0x23')][_0x8727('0x25')];}else{_0x563201[_0x8727('0x26')]=_0x57733d[_0x8727('0x23')][_0x8727('0x26')];_0x563201[_0x8727('0x27')]=_0x57733d['Smtp'][_0x8727('0x27')];_0x563201[_0x8727('0x28')]=_0x57733d[_0x8727('0x23')][_0x8727('0x28')];}if(_0x57733d[_0x8727('0x23')][_0x8727('0x29')]){_0x563201[_0x8727('0x2a')]={'user':_0x57733d[_0x8727('0x23')][_0x8727('0x16')],'pass':_0x57733d[_0x8727('0x23')][_0x8727('0x2b')]};}var _0x184905={'account':_0x563201,'message':_['merge']({'from':util['format'](_0x8727('0x2c'),_0x57733d[_0x8727('0xf')],_0x57733d[_0x8727('0x21')]||_0x57733d[_0x8727('0x23')]['user'])},_0x307055)};return client[_0x8727('0x2d')](_0x8727('0x2e'),_0x184905);})[_0x8727('0xd')](function(_0x26c545){if(_0x26c545[_0x8727('0x2f')]){throw new Error(util['format'](_0x8727('0x30'),_0x26c545[_0x8727('0x2f')][_0x8727('0x31')]||JSON[_0x8727('0x32')](_0x26c545[_0x8727('0x2f')])));}return!![];});}function handleError(_0x3b1022,_0x27b950,_0x30c0d0){return _0x3b1022[_0x8727('0x33')](_0x27b950||0x1f4)[_0x8727('0x34')]({'message':_0x30c0d0?_0x30c0d0[_0x8727('0x31')]||_0x30c0d0:''});}exports[_0x8727('0x35')]=function(_0x5e1ea1,_0x51c66d,_0x792419){passport[_0x8727('0x19')](_0x8727('0x36'),function(_0x703078,_0x2c60b0,_0x308035){var _0x41b08e=_0x703078||_0x308035;if(_0x41b08e){return handleError(_0x51c66d,0x191,_0x41b08e);}if(!_0x2c60b0){return handleError(_0x51c66d,0x194,{'message':_0x8727('0x37')});}else{var _0x2a1bd8={'payload':{'id':_0x2c60b0['id'],'role':_0x2c60b0[_0x8727('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0x8727('0x38')](_0x2a1bd8)[_0x8727('0xd')](function(_0x7e3454){_0x51c66d['json']({'id':_0x2c60b0['id'],'token':_0x7e3454,'statusCall':'','isAlreadyLogged':_0x2c60b0[_0x8727('0x39')]});});}})(_0x5e1ea1,_0x51c66d,_0x792419);};exports[_0x8727('0x3a')]=function(_0x19d08a,_0x4ac9d2,_0x2a506f){if(!_0x19d08a[_0x8727('0x3b')][_0x8727('0x21')]){return handleError(_0x4ac9d2,0x1f4,{'message':_0x8727('0x3c')});}var _0x57817f=rs[_0x8727('0x3d')]();_0x19d08a[_0x8727('0x3b')][_0x8727('0x21')]=_0x19d08a[_0x8727('0x3b')][_0x8727('0x21')][_0x8727('0x3e')]()[_0x8727('0x3f')]();var _0x15b764;return db[_0x8727('0x40')][_0x8727('0xe')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x8727('0xc')],'raw':!![]})[_0x8727('0xd')](function(_0x21bfe8){_0x15b764=_0x21bfe8;return db[_0x8727('0x41')][_0x8727('0x20')]({'where':{'email':_0x19d08a['body'][_0x8727('0x21')]}});})[_0x8727('0xd')](function(_0x116e05){if(!_0x116e05){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x116e05[_0x8727('0x1a')]){throw new Error(_0x8727('0x42'));}if(_0x116e05[_0x8727('0x13')]){if(moment(_0x116e05[_0x8727('0x14')])[_0x8727('0x1c')](_0x15b764[_0x8727('0xc')],'minutes')>moment()){throw new Error(_0x8727('0x43'));}else{_0x116e05[_0x8727('0x13')]=![];_0x116e05[_0x8727('0x14')]=null;}}_0x116e05['resetPasswordToken']=_0x57817f;_0x116e05[_0x8727('0x44')]=Date[_0x8727('0x45')]()+0x36ee80;return _0x116e05[_0x8727('0x46')]();})[_0x8727('0xd')](function(){return sendServiceMail({'to':_0x19d08a[_0x8727('0x3b')][_0x8727('0x21')],'subject':_0x8727('0x47'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x8727('0x48')+_0x8727('0x49')+_0x19d08a[_0x8727('0x4a')][_0x8727('0x26')]+_0x8727('0x4b')+_0x57817f+'\x0a\x0a'+_0x8727('0x4c')});})[_0x8727('0xd')](function(){_0x4ac9d2['status'](0xc8)[_0x8727('0x34')]({'message':_0x8727('0x4d')});})[_0x8727('0x1f')](function(_0x5d6c81){return handleError(_0x4ac9d2,0x1f4,_0x5d6c81);});};exports[_0x8727('0x4e')]=function(_0x22cd31,_0x24fd60,_0x4367e8){return db[_0x8727('0x41')][_0x8727('0x20')]({'where':{'resetPasswordToken':_0x22cd31[_0x8727('0x4f')]['token'],'resetPasswordExpires':{'$gt':Date[_0x8727('0x45')]()}}})['then'](function(_0x207893){if(!_0x207893){throw new Error(_0x8727('0x50'));}return db['Setting'][_0x8727('0xe')]({'attributes':['id',_0x8727('0x51'),_0x8727('0x52'),'passwordHistoryLimit']})['then'](function(_0x13f70f){if(_0x13f70f[_0x8727('0x51')])authService[_0x8727('0x53')](_0x22cd31['body'][_0x8727('0x10')]);if(!_0x13f70f[_0x8727('0x52')]||!_0x207893[_0x8727('0x54')])return _0x207893;authService[_0x8727('0x55')](_0x22cd31[_0x8727('0x3b')][_0x8727('0x10')],_0x207893[_0x8727('0x54')],_0x13f70f[_0x8727('0x56')]);return _0x207893;})['then'](function(){_0x207893[_0x8727('0x10')]=_0x22cd31[_0x8727('0x3b')][_0x8727('0x10')];_0x207893[_0x8727('0x57')]=null;_0x207893['resetPasswordExpires']=null;return _0x207893[_0x8727('0x46')]();});})[_0x8727('0xd')](function(){_0x24fd60[_0x8727('0x33')](0xc8)[_0x8727('0x34')]({'message':_0x8727('0x58')});})[_0x8727('0x1f')](function(_0x28b9c0){return handleError(_0x24fd60,0x1f4,_0x28b9c0);});};passport[_0x8727('0x59')](new LocalStrategy({'usernameField':'name','passwordField':_0x8727('0x10')},function(_0x291b3e,_0x168953,_0x47a9f0){return localAuthenticate(db[_0x8727('0x41')],_0x291b3e,_0x168953,_0x47a9f0);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index ce6da12..ca64e7f 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 _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 +var _0xcc89=['/reset/:token','reset','exports','express','Router','post','login','/forgot'];(function(_0x3f94f9,_0x42774b){var _0x46f84f=function(_0xa080d8){while(--_0xa080d8){_0x3f94f9['push'](_0x3f94f9['shift']());}};_0x46f84f(++_0x42774b);}(_0xcc89,0x19b));var _0x9cc8=function(_0x2962a4,_0x38ce64){_0x2962a4=_0x2962a4-0x0;var _0x53d872=_0xcc89[_0x2962a4];return _0x53d872;};'use strict';var express=require(_0x9cc8('0x0'));var router=express[_0x9cc8('0x1')]();var controller=require('./authLocal.controller');router[_0x9cc8('0x2')]('/',controller[_0x9cc8('0x3')]);router[_0x9cc8('0x2')](_0x9cc8('0x4'),controller['forgot']);router['post'](_0x9cc8('0x5'),controller[_0x9cc8('0x6')]);module[_0x9cc8('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index a226a00..b8637b1 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 _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 +var _0x8aca=['INTEGER','exports','STRING','BOOLEAN'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x8aca,0x15d));var _0xa8ac=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x8aca[_0x4eafed];return _0x159c85;};'use strict';var Sequelize=require('sequelize');module[_0xa8ac('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xa8ac('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xa8ac('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xa8ac('0x3')],'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 0c43c4a..820ef56 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(_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 +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(_0x156303,_0x39b5dc){var _0x3bf9af=function(_0x46fee9){while(--_0x46fee9){_0x156303['push'](_0x156303['shift']());}};_0x3bf9af(++_0x39b5dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 a71f5b9..6f94017 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 _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 +var _0x6918=['exports','define','Automation','tools_automations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x6918,0xc8));var _0x8691=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6918[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x8691('0x0'));var logger=require(_0x8691('0x1'))(_0x8691('0x2'));var moment=require(_0x8691('0x3'));var BPromise=require(_0x8691('0x4'));var rp=require(_0x8691('0x5'));var fs=require('fs');var path=require(_0x8691('0x6'));var rimraf=require(_0x8691('0x7'));var config=require(_0x8691('0x8'));var attributes=require(_0x8691('0x9'));module[_0x8691('0xa')]=function(_0x49a440,_0x4a5f14){return _0x49a440[_0x8691('0xb')](_0x8691('0xc'),attributes,{'tableName':_0x8691('0xd'),'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 2299661..ad32d73 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 _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 +var _0xe091=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','randomstring'];(function(_0x256580,_0xc458ba){var _0x34ea2a=function(_0x18f383){while(--_0x18f383){_0x256580['push'](_0x256580['shift']());}};_0x34ea2a(++_0xc458ba);}(_0xe091,0x123));var _0x1e09=function(_0x40ee01,_0x485b90){_0x40ee01=_0x40ee01-0x0;var _0x4ea3e7=_0xe091[_0x40ee01];return _0x4ea3e7;};'use strict';var _=require(_0x1e09('0x0'));var util=require('util');var moment=require(_0x1e09('0x1'));var BPromise=require('bluebird');var rs=require(_0x1e09('0x2'));var fs=require('fs');var Redis=require(_0x1e09('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1e09('0x4'));var logger=require(_0x1e09('0x5'))(_0x1e09('0x6'));var config=require(_0x1e09('0x7'));var jayson=require(_0x1e09('0x8'));var client=jayson[_0x1e09('0x9')][_0x1e09('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x179ba5,_0x34826e,_0x4109d2){return new BPromise(function(_0x140a8e,_0x1e625c){return client[_0x1e09('0xb')](_0x179ba5,_0x4109d2)['then'](function(_0x4844f9){logger['info'](_0x1e09('0xc'),_0x34826e,_0x1e09('0xd'));logger['debug'](_0x1e09('0xe'),_0x34826e,_0x1e09('0xd'),JSON[_0x1e09('0xf')](_0x4844f9));if(_0x4844f9[_0x1e09('0x10')]){if(_0x4844f9[_0x1e09('0x10')][_0x1e09('0x11')]===0x1f4){logger['error'](_0x1e09('0xc'),_0x34826e,_0x4844f9[_0x1e09('0x10')][_0x1e09('0x12')]);return _0x1e625c(_0x4844f9[_0x1e09('0x10')][_0x1e09('0x12')]);}logger[_0x1e09('0x10')]('Automation,\x20%s,\x20%s',_0x34826e,_0x4844f9[_0x1e09('0x10')][_0x1e09('0x12')]);return _0x140a8e(_0x4844f9[_0x1e09('0x10')][_0x1e09('0x12')]);}else{logger[_0x1e09('0x13')](_0x1e09('0xc'),_0x34826e,_0x1e09('0xd'));_0x140a8e(_0x4844f9['result'][_0x1e09('0x12')]);}})[_0x1e09('0x14')](function(_0x1bee01){logger['error'](_0x1e09('0xc'),_0x34826e,_0x1bee01);_0x1e625c(_0x1bee01);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index d7f8e15..f4aa6d3 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 _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 +var _0xb51d=['getActions','post','create','addConditions','addActions','put','/:id','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/conditions','/:id/actions'];(function(_0x65455c,_0x11d8be){var _0x5a251c=function(_0x56c5d2){while(--_0x56c5d2){_0x65455c['push'](_0x65455c['shift']());}};_0x5a251c(++_0x11d8be);}(_0xb51d,0x159));var _0xdb51=function(_0x3ed976,_0x20ebe0){_0x3ed976=_0x3ed976-0x0;var _0x44fa29=_0xb51d[_0x3ed976];return _0x44fa29;};'use strict';var multer=require('multer');var util=require(_0xdb51('0x0'));var path=require('path');var timeout=require(_0xdb51('0x1'));var express=require(_0xdb51('0x2'));var router=express[_0xdb51('0x3')]();var auth=require(_0xdb51('0x4'));var interaction=require(_0xdb51('0x5'));var config=require(_0xdb51('0x6'));var controller=require('./automation.controller');router[_0xdb51('0x7')]('/',auth[_0xdb51('0x8')](),controller[_0xdb51('0x9')]);router['get']('/:id',auth[_0xdb51('0x8')](),controller['show']);router['get'](_0xdb51('0xa'),auth[_0xdb51('0x8')](),controller['getConditions']);router[_0xdb51('0x7')](_0xdb51('0xb'),auth[_0xdb51('0x8')](),controller[_0xdb51('0xc')]);router[_0xdb51('0xd')]('/',auth[_0xdb51('0x8')](),controller[_0xdb51('0xe')]);router['post'](_0xdb51('0xa'),auth[_0xdb51('0x8')](),controller[_0xdb51('0xf')]);router[_0xdb51('0xd')](_0xdb51('0xb'),auth['isAuthenticated'](),controller[_0xdb51('0x10')]);router[_0xdb51('0x11')](_0xdb51('0x12'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xdb51('0x12'),auth[_0xdb51('0x8')](),controller[_0xdb51('0x13')]);module[_0xdb51('0x14')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 7c6a4d7..0e5526e 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 _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 +var _0xb270=['#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','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)','sequelize','STRING','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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,*,*,*','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words'];(function(_0x409a12,_0x440ec8){var _0x585ce5=function(_0x5601ac){while(--_0x5601ac){_0x409a12['push'](_0x409a12['shift']());}};_0x585ce5(++_0x440ec8);}(_0xb270,0x182));var _0x0b27=function(_0xac72f7,_0x237a87){_0xac72f7=_0xac72f7-0x0;var _0x5b1c13=_0xb270[_0xac72f7];return _0x5b1c13;};'use strict';var Sequelize=require(_0x0b27('0x0'));module['exports']={'name':{'type':Sequelize[_0x0b27('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x0b27('0x2')](_0x0b27('0x3')),'allowNull':![],'defaultValue':_0x0b27('0x3')},'description':{'type':Sequelize[_0x0b27('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x0b27('0x4')},'limitCalls':{'type':Sequelize[_0x0b27('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0b27('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0b27('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x0b27('0x5')](0x3)[_0x0b27('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x0b27('0x5')](0x3)[_0x0b27('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b27('0x7')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0b27('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b27('0x8')},'dialBusyMaxRetry':{'type':Sequelize[_0x0b27('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x0b27('0x5')](0x5)[_0x0b27('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b27('0x9')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0b27('0x5')](0x3)[_0x0b27('0x6')],'defaultValue':0x3,'comment':_0x0b27('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0b27('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b27('0xb')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0b27('0x5')](0x3)[_0x0b27('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0b27('0xc')},'dialTimezone':{'type':Sequelize[_0x0b27('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0b27('0x1')],'defaultValue':_0x0b27('0xd')},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never',_0x0b27('0xe')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x0b27('0xf')],'defaultValue':0x0,'comment':_0x0b27('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0x0b27('0x5')](0x9)[_0x0b27('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0b27('0x11')},'dialAMDGreeting':{'type':Sequelize[_0x0b27('0x5')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0b27('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0b27('0x5')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0b27('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0b27('0x5')](0x9)[_0x0b27('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x0b27('0x5')](0x9)[_0x0b27('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0b27('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0b27('0x5')](0x9)[_0x0b27('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0b27('0x5')](0x9)[_0x0b27('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0b27('0x15')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0b27('0x5')](0x5)[_0x0b27('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0b27('0x16')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0b27('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x0b27('0x2')]('DESC','ASC'),'defaultValue':_0x0b27('0x17')},'dialPrefix':{'type':Sequelize[_0x0b27('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0b27('0x5')](0x3)[_0x0b27('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0b27('0x18')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0b27('0x19')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0b27('0x5')](0x3)[_0x0b27('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b27('0x1a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0b27('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x0b27('0x5')](0x3)[_0x0b27('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b27('0x1b')},'dialDropRetryFrequency':{'type':Sequelize[_0x0b27('0x5')](0x5)[_0x0b27('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b27('0x1c')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0b27('0x5')](0x3)[_0x0b27('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b27('0x1d')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0b27('0x5')](0x5)[_0x0b27('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0b27('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b27('0x1e')},'dialMachineRetryFrequency':{'type':Sequelize[_0x0b27('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b27('0x1f')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0b27('0x5')](0x3)[_0x0b27('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b27('0x20')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0b27('0x5')](0x5)[_0x0b27('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b27('0x21')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 6ce9119..495010b 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 _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 +var _0x15d7=['eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','IvrCampaigns','UserProfileResource','end','error','stack','name','send','index','map','Campaign','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','show','params','rawAttributes','include','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','role','userProfileId','update','getHoppers','findOne','CmHopper','CampaignId','findAll','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','CampaignId\x20=\x20?','onlyIfOpen','cm_contacts','push','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','html-pdf'];(function(_0x1de0f8,_0xb4e238){var _0x529f11=function(_0x4c86b6){while(--_0x4c86b6){_0x1de0f8['push'](_0x1de0f8['shift']());}};_0x529f11(++_0xb4e238);}(_0x15d7,0x19d));var _0x715d=function(_0x108ab4,_0x1720ec){_0x108ab4=_0x108ab4-0x0;var _0x485b37=_0x15d7[_0x108ab4];return _0x485b37;};'use strict';var pdf=require(_0x715d('0x0'));var emlformat=require(_0x715d('0x1'));var rimraf=require(_0x715d('0x2'));var zipdir=require(_0x715d('0x3'));var jsonpatch=require(_0x715d('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x715d('0x5'));var Mustache=require(_0x715d('0x6'));var util=require(_0x715d('0x7'));var path=require(_0x715d('0x8'));var sox=require(_0x715d('0x9'));var csv=require(_0x715d('0xa'));var ejs=require(_0x715d('0xb'));var fs=require('fs');var _=require(_0x715d('0xc'));var squel=require(_0x715d('0xd'));var crypto=require(_0x715d('0xe'));var jsforce=require(_0x715d('0xf'));var deskjs=require(_0x715d('0x10'));var toCsv=require(_0x715d('0xa'));var querystring=require(_0x715d('0x11'));var Papa=require(_0x715d('0x12'));var Redis=require(_0x715d('0x13'));var authService=require(_0x715d('0x14'));var qs=require(_0x715d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x715d('0x16'))(_0x715d('0x17'));var utils=require('../../config/utils');var config=require(_0x715d('0x18'));var licenseUtil=require(_0x715d('0x19'));var db=require(_0x715d('0x1a'))['db'];function respondWithStatusCode(_0x48fcd0,_0x4e3279){_0x4e3279=_0x4e3279||0xcc;return function(_0x4fa67e){if(_0x4fa67e){return _0x48fcd0['sendStatus'](_0x4e3279);}return _0x48fcd0[_0x715d('0x1b')](_0x4e3279)['end']();};}function respondWithResult(_0x513de9,_0x2c1f5b){_0x2c1f5b=_0x2c1f5b||0xc8;return function(_0x58000f){if(_0x58000f){return _0x513de9[_0x715d('0x1b')](_0x2c1f5b)[_0x715d('0x1c')](_0x58000f);}};}function respondWithFilteredResult(_0x250d98,_0x735b9b){return function(_0x39cdb5){if(_0x39cdb5){var _0x2cc343=_0x39cdb5[_0x715d('0x1d')],_0x371103=_0x735b9b[_0x715d('0x1e')],_0x2d5b1b=_0x735b9b['offset']+_0x735b9b[_0x715d('0x1f')],_0x32943b;if(_0x2d5b1b>=_0x2cc343){_0x2d5b1b=_0x2cc343;_0x32943b=0xc8;}else{_0x32943b=0xce;}_0x250d98[_0x715d('0x1b')](_0x32943b);return _0x250d98[_0x715d('0x20')](_0x715d('0x21'),_0x371103+'-'+_0x2d5b1b+'/'+_0x2cc343)[_0x715d('0x1c')](_0x39cdb5);}return null;};}function patchUpdates(_0x4fc587){return function(_0x422409){try{jsonpatch['apply'](_0x422409,_0x4fc587,!![]);}catch(_0x3f65e4){return BPromise[_0x715d('0x22')](_0x3f65e4);}return _0x422409[_0x715d('0x23')]();};}function saveUpdates(_0x8182b1,_0x383120){return function(_0x2bfe89){if(_0x2bfe89){return _0x2bfe89['update'](_0x8182b1)[_0x715d('0x24')](function(_0xf4bd62){return _0xf4bd62;});}return null;};}function removeEntity(_0x367e21,_0x5ab705){return function(_0x2a6bb3){if(_0x2a6bb3){return _0x2a6bb3[_0x715d('0x25')]()[_0x715d('0x24')](function(){var _0x4c321e=_0x2a6bb3['get']({'plain':!![]});var _0x454e29=_0x715d('0x26');return db[_0x715d('0x27')][_0x715d('0x25')]({'where':{'type':_0x454e29,'resourceId':_0x4c321e['id']}})[_0x715d('0x24')](function(){return _0x2a6bb3;});})['then'](function(){_0x367e21[_0x715d('0x1b')](0xcc)[_0x715d('0x28')]();});}};}function handleEntityNotFound(_0x54d8ff,_0x5cb566){return function(_0x3e6a45){if(!_0x3e6a45){_0x54d8ff['sendStatus'](0x194);}return _0x3e6a45;};}function handleError(_0x471ad1,_0x260f81){_0x260f81=_0x260f81||0x1f4;return function(_0x1551fb){logger[_0x715d('0x29')](_0x1551fb[_0x715d('0x2a')]);if(_0x1551fb['name']){delete _0x1551fb[_0x715d('0x2b')];}_0x471ad1[_0x715d('0x1b')](_0x260f81)[_0x715d('0x2c')](_0x1551fb);};}exports[_0x715d('0x2d')]=function(_0x410f6b,_0x4bdf27){var _0x2b0508={},_0xf53fe1={},_0x493eb6={'count':0x0,'rows':[]};var _0x4a4737=_[_0x715d('0x2e')](db[_0x715d('0x2f')]['rawAttributes'],function(_0x162e35){return{'name':_0x162e35['fieldName'],'type':_0x162e35[_0x715d('0x30')][_0x715d('0x31')]};});_0xf53fe1[_0x715d('0x32')]=_['map'](_0x4a4737,_0x715d('0x2b'));_0xf53fe1[_0x715d('0x33')]=_[_0x715d('0x34')](_0x410f6b['query']);_0xf53fe1[_0x715d('0x35')]=_[_0x715d('0x36')](_0xf53fe1[_0x715d('0x32')],_0xf53fe1[_0x715d('0x33')]);_0x2b0508['attributes']=_['intersection'](_0xf53fe1['model'],qs[_0x715d('0x37')](_0x410f6b[_0x715d('0x33')][_0x715d('0x37')]));_0x2b0508[_0x715d('0x38')]=_0x2b0508[_0x715d('0x38')][_0x715d('0x39')]?_0x2b0508[_0x715d('0x38')]:_0xf53fe1['model'];if(!_0x410f6b[_0x715d('0x33')][_0x715d('0x3a')](_0x715d('0x3b'))){_0x2b0508['limit']=qs[_0x715d('0x1f')](_0x410f6b['query']['limit']);_0x2b0508[_0x715d('0x1e')]=qs[_0x715d('0x1e')](_0x410f6b[_0x715d('0x33')][_0x715d('0x1e')]);}_0x2b0508[_0x715d('0x3c')]=qs[_0x715d('0x3d')](_0x410f6b[_0x715d('0x33')][_0x715d('0x3d')]);_0x2b0508['where']=qs[_0x715d('0x35')](_[_0x715d('0x3e')](_0x410f6b[_0x715d('0x33')],_0xf53fe1[_0x715d('0x35')]),_0x4a4737);if(_0x410f6b['query'][_0x715d('0x3f')]){_0x2b0508[_0x715d('0x40')]=_[_0x715d('0x41')](_0x2b0508[_0x715d('0x40')],{'$or':_[_0x715d('0x2e')](_0x4a4737,function(_0x1ddf5a){if(_0x1ddf5a[_0x715d('0x30')]!==_0x715d('0x42')){var _0x4c7b65={};_0x4c7b65[_0x1ddf5a[_0x715d('0x2b')]]={'$like':'%'+_0x410f6b[_0x715d('0x33')]['filter']+'%'};return _0x4c7b65;}})});}_0x2b0508=_[_0x715d('0x41')]({},_0x2b0508,_0x410f6b[_0x715d('0x43')]);var _0xdb7000={'where':_0x2b0508[_0x715d('0x40')]};return db['Campaign']['count'](_0xdb7000)[_0x715d('0x24')](function(_0x1b6e2c){_0x493eb6['count']=_0x1b6e2c;if(_0x410f6b['query'][_0x715d('0x44')]){_0x2b0508['include']=[{'all':!![]}];}return db[_0x715d('0x2f')]['findAll'](_0x2b0508);})[_0x715d('0x24')](function(_0x2ef8a0){_0x493eb6[_0x715d('0x45')]=_0x2ef8a0;return _0x493eb6;})['then'](respondWithFilteredResult(_0x4bdf27,_0x2b0508))['catch'](handleError(_0x4bdf27,null));};exports[_0x715d('0x46')]=function(_0x2b5343,_0xb64145){var _0x4228ad={'raw':![],'where':{'id':_0x2b5343[_0x715d('0x47')]['id']}},_0x431afd={};_0x431afd[_0x715d('0x32')]=_[_0x715d('0x34')](db[_0x715d('0x2f')][_0x715d('0x48')]);_0x431afd[_0x715d('0x33')]=_['keys'](_0x2b5343[_0x715d('0x33')]);_0x431afd[_0x715d('0x35')]=_[_0x715d('0x36')](_0x431afd[_0x715d('0x32')],_0x431afd[_0x715d('0x33')]);_0x4228ad['attributes']=_[_0x715d('0x36')](_0x431afd[_0x715d('0x32')],qs['fields'](_0x2b5343[_0x715d('0x33')][_0x715d('0x37')]));_0x4228ad[_0x715d('0x38')]=_0x4228ad['attributes'][_0x715d('0x39')]?_0x4228ad['attributes']:_0x431afd[_0x715d('0x32')];if(_0x2b5343[_0x715d('0x33')]['includeAll']){_0x4228ad[_0x715d('0x49')]=[{'all':!![]}];}_0x4228ad=_['merge']({},_0x4228ad,_0x2b5343['options']);return db[_0x715d('0x2f')][_0x715d('0x4a')](_0x4228ad)[_0x715d('0x24')](handleEntityNotFound(_0xb64145,null))[_0x715d('0x24')](respondWithResult(_0xb64145,null))[_0x715d('0x4b')](handleError(_0xb64145,null));};exports[_0x715d('0x4c')]=function(_0xb9a757,_0x1d8211){return db['Campaign'][_0x715d('0x4c')](_0xb9a757[_0x715d('0x4d')],{})[_0x715d('0x24')](function(_0x584545){var _0x51e793=_0xb9a757[_0x715d('0x4e')][_0x715d('0x4f')]({'plain':!![]});if(!_0x51e793)throw new Error(_0x715d('0x50'));if(_0x51e793['role']==='user'){var _0x105128=_0x584545[_0x715d('0x4f')]({'plain':!![]});var _0x1d084e=_0x715d('0x26');return db[_0x715d('0x51')][_0x715d('0x4a')]({'where':{'name':_0x1d084e,'userProfileId':_0x51e793['userProfileId']},'raw':!![]})[_0x715d('0x24')](function(_0x5a254e){if(_0x5a254e&&_0x5a254e[_0x715d('0x52')]===0x0){return db[_0x715d('0x27')]['create']({'name':_0x105128[_0x715d('0x2b')],'resourceId':_0x105128['id'],'type':_0x5a254e[_0x715d('0x2b')],'sectionId':_0x5a254e['id']},{})[_0x715d('0x24')](function(){return _0x584545;});}else{return _0x584545;}})['catch'](function(_0x229106){logger[_0x715d('0x29')](_0x715d('0x53'),_0x229106);throw _0x229106;});}return _0x584545;})[_0x715d('0x24')](respondWithResult(_0x1d8211,0xc9))[_0x715d('0x4b')](handleError(_0x1d8211,null));};exports[_0x715d('0x54')]=function(_0x4149ea,_0x21f0dc){var _0x173781={'where':{'id':_0x4149ea[_0x715d('0x47')]['id']}},_0xc5f954={};_0xc5f954[_0x715d('0x32')]=_[_0x715d('0x34')](db[_0x715d('0x2f')]['rawAttributes']);_0x173781[_0x715d('0x38')]=_[_0x715d('0x36')](_0xc5f954['model'],qs[_0x715d('0x37')](_0x4149ea['query'][_0x715d('0x37')]));_0x173781[_0x715d('0x38')]=_0x173781[_0x715d('0x38')][_0x715d('0x39')]?_0x173781['attributes']:_0xc5f954['model'];if(_0x4149ea[_0x715d('0x33')][_0x715d('0x44')]){_0x173781[_0x715d('0x49')]=[{'all':!![]}];}_0x173781=_[_0x715d('0x41')]({},_0x173781,_0x4149ea[_0x715d('0x43')]);return db[_0x715d('0x2f')][_0x715d('0x4a')](_0x173781)[_0x715d('0x24')](handleEntityNotFound(_0x21f0dc,null))[_0x715d('0x24')](function(_0x4265e5){if(_0x4265e5){var _0x241ae7=_0x4265e5[_0x715d('0x4f')]({'plain':!![]});_0x241ae7=qs[_0x715d('0x55')](_0x241ae7,['id','createdAt',_0x715d('0x56')]);_0x4149ea[_0x715d('0x4d')]=_[_0x715d('0x55')](_0x4149ea[_0x715d('0x4d')],['id',_0x715d('0x57'),_0x715d('0x56')]);return db[_0x715d('0x2f')][_0x715d('0x4c')](_[_0x715d('0x41')](_0x241ae7,_0x4149ea[_0x715d('0x4d')]),{'include':_0x4149ea[_0x715d('0x33')][_0x715d('0x44')]?[{'all':!![]}]:undefined})[_0x715d('0x24')](function(_0x59db16){var _0x133f9e=_0x4149ea[_0x715d('0x4e')][_0x715d('0x4f')]({'plain':!![]});if(!_0x133f9e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x133f9e[_0x715d('0x58')]==='user'){var _0xbfb486=_0x59db16[_0x715d('0x4f')]({'plain':!![]});var _0x25a8d1='IvrCampaigns';return db['UserProfileSection'][_0x715d('0x4a')]({'where':{'name':_0x25a8d1,'userProfileId':_0x133f9e[_0x715d('0x59')]},'raw':!![]})[_0x715d('0x24')](function(_0x2964d5){if(_0x2964d5&&_0x2964d5[_0x715d('0x52')]===0x0){return db[_0x715d('0x27')][_0x715d('0x4c')]({'name':_0xbfb486['name'],'resourceId':_0xbfb486['id'],'type':_0x2964d5[_0x715d('0x2b')],'sectionId':_0x2964d5['id']},{})[_0x715d('0x24')](function(){return _0x59db16;});}else{return _0x59db16;}})[_0x715d('0x4b')](function(_0x9680d8){logger[_0x715d('0x29')](_0x715d('0x53'),_0x9680d8);throw _0x9680d8;});}return _0x59db16;});}})[_0x715d('0x24')](respondWithResult(_0x21f0dc,0xc9))[_0x715d('0x4b')](handleError(_0x21f0dc,null));};exports[_0x715d('0x5a')]=function(_0x4b1607,_0x1d8493){if(_0x4b1607[_0x715d('0x4d')]['id']){delete _0x4b1607['body']['id'];}return db[_0x715d('0x2f')][_0x715d('0x4a')]({'where':{'id':_0x4b1607[_0x715d('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d8493,null))[_0x715d('0x24')](saveUpdates(_0x4b1607[_0x715d('0x4d')],null))['then'](respondWithResult(_0x1d8493,null))[_0x715d('0x4b')](handleError(_0x1d8493,null));};exports['destroy']=function(_0x4e1ae2,_0x3788d5){return db[_0x715d('0x2f')][_0x715d('0x4a')]({'where':{'id':_0x4e1ae2['params']['id']}})[_0x715d('0x24')](handleEntityNotFound(_0x3788d5,null))[_0x715d('0x24')](removeEntity(_0x3788d5,null))['catch'](handleError(_0x3788d5,null));};exports[_0x715d('0x5b')]=function(_0x4e1006,_0x19c0d5,_0x3af0ae){var _0x1349d7={'raw':!![],'where':{}};var _0x28ed73={};var _0x97bf0d={'count':0x0,'rows':[]};return db[_0x715d('0x2f')][_0x715d('0x5c')]({'where':{'id':_0x4e1006[_0x715d('0x47')]['id']}})['then'](handleEntityNotFound(_0x19c0d5,null))[_0x715d('0x24')](function(_0x59b4dd){if(_0x59b4dd){_0x28ed73['model']=_[_0x715d('0x34')](db[_0x715d('0x5d')][_0x715d('0x48')]);_0x28ed73['query']=_[_0x715d('0x34')](_0x4e1006['query']);_0x28ed73[_0x715d('0x35')]=_[_0x715d('0x36')](_0x28ed73[_0x715d('0x32')],_0x28ed73['query']);_0x1349d7['attributes']=_['intersection'](_0x28ed73[_0x715d('0x32')],qs['fields'](_0x4e1006[_0x715d('0x33')]['fields']));_0x1349d7[_0x715d('0x38')]=_0x1349d7['attributes'][_0x715d('0x39')]?_0x1349d7[_0x715d('0x38')]:_0x28ed73['model'];if(!_0x4e1006['query'][_0x715d('0x3a')](_0x715d('0x3b'))){_0x1349d7[_0x715d('0x1f')]=qs['limit'](_0x4e1006[_0x715d('0x33')][_0x715d('0x1f')]);_0x1349d7[_0x715d('0x1e')]=qs[_0x715d('0x1e')](_0x4e1006[_0x715d('0x33')][_0x715d('0x1e')]);}_0x1349d7[_0x715d('0x3c')]=qs[_0x715d('0x3d')](_0x4e1006[_0x715d('0x33')][_0x715d('0x3d')]);_0x1349d7[_0x715d('0x40')]=qs[_0x715d('0x35')](_['pick'](_0x4e1006[_0x715d('0x33')],_0x28ed73['filters']));_0x1349d7[_0x715d('0x40')][_0x715d('0x5e')]=_0x59b4dd['id'];if(_0x4e1006[_0x715d('0x33')]['filter']){_0x1349d7[_0x715d('0x40')]=_[_0x715d('0x41')](_0x1349d7[_0x715d('0x40')],{'$or':_[_0x715d('0x2e')](_0x1349d7[_0x715d('0x38')],function(_0x3ed8a0){var _0x3a65e6={};_0x3a65e6[_0x3ed8a0]={'$like':'%'+_0x4e1006[_0x715d('0x33')][_0x715d('0x3f')]+'%'};return _0x3a65e6;})});}_0x1349d7=_[_0x715d('0x41')]({},_0x1349d7,_0x4e1006[_0x715d('0x43')]);return db[_0x715d('0x5d')]['count']({'where':_0x1349d7['where']})[_0x715d('0x24')](function(_0x1e4b07){_0x97bf0d[_0x715d('0x1d')]=_0x1e4b07;if(_0x4e1006[_0x715d('0x33')][_0x715d('0x44')]){_0x1349d7[_0x715d('0x49')]=[{'all':!![]}];}return db['CmHopper'][_0x715d('0x5f')](_0x1349d7);})[_0x715d('0x24')](function(_0x7ad952){_0x97bf0d[_0x715d('0x45')]=_0x7ad952;return _0x97bf0d;});}})[_0x715d('0x24')](respondWithFilteredResult(_0x19c0d5,_0x1349d7))[_0x715d('0x4b')](handleError(_0x19c0d5,null));};exports['getHopperHistories']=function(_0x1c21c2,_0x576e8c,_0x541ba4){var _0x113c61={'raw':!![],'where':{}};var _0x41f501={};var _0x16b12b={'count':0x0,'rows':[]};return db[_0x715d('0x2f')]['findOne']({'where':{'id':_0x1c21c2[_0x715d('0x47')]['id']}})['then'](handleEntityNotFound(_0x576e8c,null))[_0x715d('0x24')](function(_0x4e7202){if(_0x4e7202){_0x41f501[_0x715d('0x32')]=_[_0x715d('0x34')](db[_0x715d('0x60')][_0x715d('0x48')]);_0x41f501['query']=_[_0x715d('0x34')](_0x1c21c2[_0x715d('0x33')]);_0x41f501['filters']=_[_0x715d('0x36')](_0x41f501[_0x715d('0x32')],_0x41f501[_0x715d('0x33')]);_0x113c61[_0x715d('0x38')]=_[_0x715d('0x36')](_0x41f501[_0x715d('0x32')],qs['fields'](_0x1c21c2[_0x715d('0x33')][_0x715d('0x37')]));_0x113c61['attributes']=_0x113c61['attributes']['length']?_0x113c61[_0x715d('0x38')]:_0x41f501[_0x715d('0x32')];if(!_0x1c21c2[_0x715d('0x33')][_0x715d('0x3a')](_0x715d('0x3b'))){_0x113c61[_0x715d('0x1f')]=qs[_0x715d('0x1f')](_0x1c21c2[_0x715d('0x33')][_0x715d('0x1f')]);_0x113c61[_0x715d('0x1e')]=qs[_0x715d('0x1e')](_0x1c21c2[_0x715d('0x33')][_0x715d('0x1e')]);}_0x113c61[_0x715d('0x3c')]=qs[_0x715d('0x3d')](_0x1c21c2[_0x715d('0x33')][_0x715d('0x3d')]);_0x113c61[_0x715d('0x40')]=qs[_0x715d('0x35')](_['pick'](_0x1c21c2['query'],_0x41f501[_0x715d('0x35')]));_0x113c61['where'][_0x715d('0x5e')]=_0x4e7202['id'];if(_0x1c21c2[_0x715d('0x33')][_0x715d('0x3f')]){_0x113c61[_0x715d('0x40')]=_[_0x715d('0x41')](_0x113c61[_0x715d('0x40')],{'$or':_[_0x715d('0x2e')](_0x113c61[_0x715d('0x38')],function(_0x30adea){var _0x55960f={};_0x55960f[_0x30adea]={'$like':'%'+_0x1c21c2[_0x715d('0x33')]['filter']+'%'};return _0x55960f;})});}_0x113c61=_['merge']({},_0x113c61,_0x1c21c2['options']);return db['CmHopperHistory']['count']({'where':_0x113c61[_0x715d('0x40')]})[_0x715d('0x24')](function(_0x30d1c8){_0x16b12b['count']=_0x30d1c8;if(_0x1c21c2[_0x715d('0x33')][_0x715d('0x44')]){_0x113c61[_0x715d('0x49')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x715d('0x5f')](_0x113c61);})[_0x715d('0x24')](function(_0x2761b3){_0x16b12b[_0x715d('0x45')]=_0x2761b3;return _0x16b12b;});}})['then'](respondWithFilteredResult(_0x576e8c,_0x113c61))[_0x715d('0x4b')](handleError(_0x576e8c,null));};exports[_0x715d('0x61')]=function(_0xb121fd,_0x437265,_0x54f89b){var _0x1ef345={'raw':!![],'where':{}};var _0x39f365={};var _0x43fab4={'count':0x0,'rows':[]};return db[_0x715d('0x2f')][_0x715d('0x5c')]({'where':{'id':_0xb121fd['params']['id']}})[_0x715d('0x24')](handleEntityNotFound(_0x437265,null))[_0x715d('0x24')](function(_0x36ddde){if(_0x36ddde){_0x39f365[_0x715d('0x32')]=_[_0x715d('0x34')](db[_0x715d('0x62')][_0x715d('0x48')]);_0x39f365[_0x715d('0x33')]=_[_0x715d('0x34')](_0xb121fd[_0x715d('0x33')]);_0x39f365['filters']=_[_0x715d('0x36')](_0x39f365[_0x715d('0x32')],_0x39f365[_0x715d('0x33')]);_0x1ef345[_0x715d('0x38')]=_[_0x715d('0x36')](_0x39f365[_0x715d('0x32')],qs[_0x715d('0x37')](_0xb121fd[_0x715d('0x33')][_0x715d('0x37')]));_0x1ef345[_0x715d('0x38')]=_0x1ef345[_0x715d('0x38')][_0x715d('0x39')]?_0x1ef345[_0x715d('0x38')]:_0x39f365['model'];if(!_0xb121fd[_0x715d('0x33')][_0x715d('0x3a')](_0x715d('0x3b'))){_0x1ef345[_0x715d('0x1f')]=qs[_0x715d('0x1f')](_0xb121fd[_0x715d('0x33')][_0x715d('0x1f')]);_0x1ef345[_0x715d('0x1e')]=qs['offset'](_0xb121fd[_0x715d('0x33')]['offset']);}_0x1ef345['order']=qs[_0x715d('0x3d')](_0xb121fd['query'][_0x715d('0x3d')]);_0x1ef345['where']=qs[_0x715d('0x35')](_[_0x715d('0x3e')](_0xb121fd['query'],_0x39f365[_0x715d('0x35')]));_0x1ef345['where']['CampaignId']=_0x36ddde['id'];if(_0xb121fd['query'][_0x715d('0x3f')]){_0x1ef345[_0x715d('0x40')]=_[_0x715d('0x41')](_0x1ef345[_0x715d('0x40')],{'$or':_[_0x715d('0x2e')](_0x1ef345[_0x715d('0x38')],function(_0x24bb7f){var _0x58660a={};_0x58660a[_0x24bb7f]={'$like':'%'+_0xb121fd[_0x715d('0x33')]['filter']+'%'};return _0x58660a;})});}_0x1ef345=_['merge']({},_0x1ef345,_0xb121fd[_0x715d('0x43')]);return db[_0x715d('0x62')]['count']({'where':_0x1ef345[_0x715d('0x40')]})[_0x715d('0x24')](function(_0x58d886){_0x43fab4[_0x715d('0x1d')]=_0x58d886;if(_0xb121fd[_0x715d('0x33')][_0x715d('0x44')]){_0x1ef345[_0x715d('0x49')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x1ef345);})[_0x715d('0x24')](function(_0x1d60df){_0x43fab4[_0x715d('0x45')]=_0x1d60df;return _0x43fab4;});}})[_0x715d('0x24')](respondWithFilteredResult(_0x437265,_0x1ef345))[_0x715d('0x4b')](handleError(_0x437265,null));};exports[_0x715d('0x63')]=function(_0x268762,_0x31b50b,_0x8a4d13){var _0x167996={'raw':!![],'where':{}};var _0x169c0b={};var _0x1a089a={'count':0x0,'rows':[]};return db['Campaign'][_0x715d('0x5c')]({'where':{'id':_0x268762['params']['id']}})['then'](handleEntityNotFound(_0x31b50b,null))[_0x715d('0x24')](function(_0x38c9b6){if(_0x38c9b6){_0x169c0b[_0x715d('0x32')]=_[_0x715d('0x34')](db['CmHopperBlack'][_0x715d('0x48')]);_0x169c0b['query']=_['keys'](_0x268762[_0x715d('0x33')]);_0x169c0b[_0x715d('0x35')]=_['intersection'](_0x169c0b['model'],_0x169c0b[_0x715d('0x33')]);_0x167996[_0x715d('0x38')]=_['intersection'](_0x169c0b[_0x715d('0x32')],qs[_0x715d('0x37')](_0x268762[_0x715d('0x33')][_0x715d('0x37')]));_0x167996[_0x715d('0x38')]=_0x167996[_0x715d('0x38')][_0x715d('0x39')]?_0x167996['attributes']:_0x169c0b[_0x715d('0x32')];if(!_0x268762['query'][_0x715d('0x3a')]('nolimit')){_0x167996['limit']=qs['limit'](_0x268762[_0x715d('0x33')][_0x715d('0x1f')]);_0x167996[_0x715d('0x1e')]=qs[_0x715d('0x1e')](_0x268762[_0x715d('0x33')]['offset']);}_0x167996['order']=qs[_0x715d('0x3d')](_0x268762[_0x715d('0x33')][_0x715d('0x3d')]);_0x167996['where']=qs[_0x715d('0x35')](_[_0x715d('0x3e')](_0x268762[_0x715d('0x33')],_0x169c0b[_0x715d('0x35')]));_0x167996[_0x715d('0x40')][_0x715d('0x5e')]=_0x38c9b6['id'];if(_0x268762[_0x715d('0x33')][_0x715d('0x3f')]){_0x167996[_0x715d('0x40')]=_[_0x715d('0x41')](_0x167996['where'],{'$or':_['map'](_0x167996[_0x715d('0x38')],function(_0x3e0bd7){var _0x493aa6={};_0x493aa6[_0x3e0bd7]={'$like':'%'+_0x268762[_0x715d('0x33')][_0x715d('0x3f')]+'%'};return _0x493aa6;})});}_0x167996=_['merge']({},_0x167996,_0x268762[_0x715d('0x43')]);return db[_0x715d('0x64')][_0x715d('0x1d')]({'where':_0x167996[_0x715d('0x40')]})['then'](function(_0x4afbef){_0x1a089a[_0x715d('0x1d')]=_0x4afbef;if(_0x268762[_0x715d('0x33')][_0x715d('0x44')]){_0x167996['include']=[{'all':!![]}];}return db[_0x715d('0x64')][_0x715d('0x5f')](_0x167996);})[_0x715d('0x24')](function(_0x4d6121){_0x1a089a[_0x715d('0x45')]=_0x4d6121;return _0x1a089a;});}})[_0x715d('0x24')](respondWithFilteredResult(_0x31b50b,_0x167996))[_0x715d('0x4b')](handleError(_0x31b50b,null));};exports[_0x715d('0x65')]=function(_0x596fd7,_0x3582d5,_0x2deac1){var _0x23b8f9={};var _0x75d2f0={};var _0x50ba0a;var _0x3c5895;return db[_0x715d('0x2f')][_0x715d('0x5c')]({'where':{'id':_0x596fd7['params']['id']}})['then'](handleEntityNotFound(_0x3582d5,null))[_0x715d('0x24')](function(_0xe97383){if(_0xe97383){_0x50ba0a=_0xe97383;_0x75d2f0['model']=_['keys'](db[_0x715d('0x66')][_0x715d('0x48')]);_0x75d2f0['query']=_[_0x715d('0x34')](_0x596fd7['query']);_0x75d2f0[_0x715d('0x35')]=_[_0x715d('0x36')](_0x75d2f0[_0x715d('0x32')],_0x75d2f0['query']);_0x23b8f9[_0x715d('0x38')]=_[_0x715d('0x36')](_0x75d2f0[_0x715d('0x32')],qs[_0x715d('0x37')](_0x596fd7[_0x715d('0x33')][_0x715d('0x37')]));_0x23b8f9[_0x715d('0x38')]=_0x23b8f9[_0x715d('0x38')][_0x715d('0x39')]?_0x23b8f9[_0x715d('0x38')]:_0x75d2f0[_0x715d('0x32')];_0x23b8f9[_0x715d('0x3c')]=qs['sort'](_0x596fd7['query'][_0x715d('0x3d')]);_0x23b8f9[_0x715d('0x40')]=qs[_0x715d('0x35')](_[_0x715d('0x3e')](_0x596fd7[_0x715d('0x33')],_0x75d2f0[_0x715d('0x35')]));if(_0x596fd7['query'][_0x715d('0x3f')]){_0x23b8f9[_0x715d('0x40')]=_[_0x715d('0x41')](_0x23b8f9['where'],{'$or':_[_0x715d('0x2e')](_0x23b8f9[_0x715d('0x38')],function(_0x45ec84){var _0x248327={};_0x248327[_0x45ec84]={'$like':'%'+_0x596fd7[_0x715d('0x33')][_0x715d('0x3f')]+'%'};return _0x248327;})});}_0x23b8f9=_[_0x715d('0x41')]({},_0x23b8f9,_0x596fd7['options']);return _0x50ba0a[_0x715d('0x65')](_0x23b8f9);}})[_0x715d('0x24')](function(_0x6b8f44){if(_0x6b8f44){_0x3c5895=_0x6b8f44[_0x715d('0x39')];if(!_0x596fd7[_0x715d('0x33')][_0x715d('0x3a')](_0x715d('0x3b'))){_0x23b8f9[_0x715d('0x1f')]=qs[_0x715d('0x1f')](_0x596fd7[_0x715d('0x33')]['limit']);_0x23b8f9[_0x715d('0x1e')]=qs['offset'](_0x596fd7[_0x715d('0x33')][_0x715d('0x1e')]);}return _0x50ba0a[_0x715d('0x65')](_0x23b8f9);}})['then'](function(_0x33b5f3){if(_0x33b5f3){return _0x33b5f3?{'count':_0x3c5895,'rows':_0x33b5f3}:null;}})[_0x715d('0x24')](respondWithResult(_0x3582d5,null))[_0x715d('0x4b')](handleError(_0x3582d5,null));};exports[_0x715d('0x67')]=function(_0x17b26e,_0x242413,_0x2a2b09){var _0x33defa,_0x498b49;return db['Campaign'][_0x715d('0x4a')]({'where':{'id':_0x17b26e[_0x715d('0x47')]['id']}})[_0x715d('0x24')](handleEntityNotFound(_0x242413,null))[_0x715d('0x24')](function(_0x2d9a3c){if(_0x2d9a3c){_0x498b49=_0x2d9a3c;return _0x2d9a3c[_0x715d('0x67')](_0x17b26e[_0x715d('0x4d')]['ids'],_[_0x715d('0x55')](_0x17b26e['body'],[_0x715d('0x68'),'id'])||{});}return null;})[_0x715d('0x69')](function(_0x5eba2e){var _0x51a61e;_0x33defa=_0x5eba2e||[];var _0x23ace2=[];if(_0x5eba2e){for(var _0x227746=0x0;_0x227746<_0x5eba2e['length'];_0x227746+=0x1){var _0x1a87c4=_0x5eba2e[_0x227746]['get']({'plain':!![]});_0x498b49[_0x715d('0x6a')]=_0x17b26e[_0x715d('0x4d')][_0x715d('0x6a')]?_0x17b26e['body'][_0x715d('0x6a')]:_0x498b49['dialCheckDuplicateType'];switch(_0x498b49[_0x715d('0x6a')]){case'always':_0x51a61e=squel[_0x715d('0x6b')]()[_0x715d('0x6c')]('cm_hopper')[_0x715d('0x6d')]([_0x715d('0x6e'),_0x715d('0x6f'),_0x715d('0x70'),_0x715d('0x71'),_0x715d('0x5e'),_0x715d('0x57'),_0x715d('0x56')],squel['select']()[_0x715d('0x72')](_0x715d('0x6e'),_0x715d('0x6e'))[_0x715d('0x72')](_0x715d('0x73'),_0x715d('0x6f'))['field']('id',_0x715d('0x70'))[_0x715d('0x72')](_0x1a87c4[_0x715d('0x74')]['toString'](),_0x715d('0x71'))['field'](_0x17b26e[_0x715d('0x47')]['id'][_0x715d('0x75')](),_0x715d('0x5e'))[_0x715d('0x72')]('NOW()',_0x715d('0x57'))[_0x715d('0x72')]('NOW()','updatedAt')[_0x715d('0x76')]('cm_contacts')[_0x715d('0x40')](_0x715d('0x77'))[_0x715d('0x40')](_0x715d('0x78'),_0x1a87c4['CmListId'][_0x715d('0x75')]())[_0x715d('0x40')](_0x715d('0x79'))[_0x715d('0x40')](_0x715d('0x7a'),squel[_0x715d('0x7b')]()[_0x715d('0x72')](_0x715d('0x7c'))['from'](_0x715d('0x7d'))[_0x715d('0x40')]('CampaignId\x20=\x20?',_0x17b26e[_0x715d('0x47')]['id'][_0x715d('0x75')]()))[_0x715d('0x40')](_0x715d('0x7a'),squel[_0x715d('0x7b')]()['field'](_0x715d('0x7e'))[_0x715d('0x76')](_0x715d('0x7f'))[_0x715d('0x40')](_0x715d('0x80'),_0x17b26e[_0x715d('0x47')]['id']['toString']())))[_0x715d('0x75')]();break;case _0x715d('0x81'):_0x51a61e=squel[_0x715d('0x6b')]()[_0x715d('0x6c')](_0x715d('0x7f'))['fromQuery']([_0x715d('0x6e'),_0x715d('0x6f'),_0x715d('0x70'),_0x715d('0x71'),_0x715d('0x5e'),'createdAt','updatedAt'],squel[_0x715d('0x7b')]()[_0x715d('0x72')](_0x715d('0x6e'),_0x715d('0x6e'))[_0x715d('0x72')](_0x715d('0x73'),_0x715d('0x6f'))[_0x715d('0x72')]('id','ContactId')[_0x715d('0x72')](_0x1a87c4[_0x715d('0x74')][_0x715d('0x75')](),'ListId')[_0x715d('0x72')](_0x17b26e[_0x715d('0x47')]['id'][_0x715d('0x75')](),'CampaignId')[_0x715d('0x72')](_0x715d('0x73'),_0x715d('0x57'))[_0x715d('0x72')](_0x715d('0x73'),_0x715d('0x56'))['from']('cm_contacts')[_0x715d('0x40')](_0x715d('0x77'))['where'](_0x715d('0x78'),_0x1a87c4['CmListId'][_0x715d('0x75')]())[_0x715d('0x40')](_0x715d('0x79'))[_0x715d('0x40')](_0x715d('0x7a'),squel['select']()['field'](_0x715d('0x7e'))[_0x715d('0x76')](_0x715d('0x7f'))[_0x715d('0x40')]('CampaignId\x20=\x20?',_0x17b26e[_0x715d('0x47')]['id'][_0x715d('0x75')]())))[_0x715d('0x75')]();break;default:_0x51a61e=squel[_0x715d('0x6b')]()[_0x715d('0x6c')](_0x715d('0x7f'))[_0x715d('0x6d')]([_0x715d('0x6e'),'scheduledAt',_0x715d('0x70'),_0x715d('0x71'),'CampaignId',_0x715d('0x57'),_0x715d('0x56')],squel[_0x715d('0x7b')]()['field'](_0x715d('0x6e'),_0x715d('0x6e'))['field'](_0x715d('0x73'),'scheduledAt')['field']('id',_0x715d('0x70'))[_0x715d('0x72')](_0x1a87c4[_0x715d('0x74')][_0x715d('0x75')](),_0x715d('0x71'))[_0x715d('0x72')](_0x17b26e[_0x715d('0x47')]['id'][_0x715d('0x75')](),_0x715d('0x5e'))[_0x715d('0x72')]('NOW()',_0x715d('0x57'))[_0x715d('0x72')](_0x715d('0x73'),_0x715d('0x56'))[_0x715d('0x76')](_0x715d('0x82'))[_0x715d('0x40')](_0x715d('0x77'))[_0x715d('0x40')](_0x715d('0x78'),_0x1a87c4[_0x715d('0x74')]['toString']())[_0x715d('0x40')](_0x715d('0x79')))['toString']();}_0x23ace2[_0x715d('0x83')](db['sequelize'][_0x715d('0x33')](_0x51a61e));}return BPromise['all'](_0x23ace2);}})[_0x715d('0x24')](function(){return _0x33defa;})[_0x715d('0x24')](respondWithResult(_0x242413,null))[_0x715d('0x4b')](handleError(_0x242413,null));};exports[_0x715d('0x84')]=function(_0x2f7535,_0x455ed1,_0x45a4a9){return db[_0x715d('0x2f')][_0x715d('0x4a')]({'where':{'id':_0x2f7535[_0x715d('0x47')]['id']}})['then'](handleEntityNotFound(_0x455ed1,null))['then'](function(_0x2f6e1b){if(_0x2f6e1b){return _0x2f6e1b[_0x715d('0x84')](_0x2f7535['query']['ids']);}})[_0x715d('0x24')](function(_0x352ee2){if(_0x352ee2){return db[_0x715d('0x5d')][_0x715d('0x25')]({'where':{'ListId':_0x2f7535['query'][_0x715d('0x68')],'CampaignId':_0x2f7535['params']['id']}})[_0x715d('0x24')](function(){return _0x352ee2;});}})[_0x715d('0x24')](respondWithStatusCode(_0x455ed1,null))[_0x715d('0x4b')](handleError(_0x455ed1,null));};exports['getBlackLists']=function(_0x60fd84,_0x164f06,_0x245a49){var _0x31a834={};var _0x336e5e={};var _0xcf797c;var _0x22d998;return db['Campaign'][_0x715d('0x5c')]({'where':{'id':_0x60fd84[_0x715d('0x47')]['id']}})[_0x715d('0x24')](handleEntityNotFound(_0x164f06,null))[_0x715d('0x24')](function(_0x2c1a40){if(_0x2c1a40){_0xcf797c=_0x2c1a40;_0x336e5e[_0x715d('0x32')]=_[_0x715d('0x34')](db[_0x715d('0x66')][_0x715d('0x48')]);_0x336e5e[_0x715d('0x33')]=_[_0x715d('0x34')](_0x60fd84[_0x715d('0x33')]);_0x336e5e[_0x715d('0x35')]=_[_0x715d('0x36')](_0x336e5e['model'],_0x336e5e[_0x715d('0x33')]);_0x31a834[_0x715d('0x38')]=_[_0x715d('0x36')](_0x336e5e[_0x715d('0x32')],qs[_0x715d('0x37')](_0x60fd84[_0x715d('0x33')][_0x715d('0x37')]));_0x31a834[_0x715d('0x38')]=_0x31a834[_0x715d('0x38')][_0x715d('0x39')]?_0x31a834['attributes']:_0x336e5e['model'];_0x31a834[_0x715d('0x3c')]=qs['sort'](_0x60fd84[_0x715d('0x33')]['sort']);_0x31a834['where']=qs[_0x715d('0x35')](_['pick'](_0x60fd84[_0x715d('0x33')],_0x336e5e['filters']));if(_0x60fd84['query'][_0x715d('0x3f')]){_0x31a834[_0x715d('0x40')]=_['merge'](_0x31a834['where'],{'$or':_[_0x715d('0x2e')](_0x31a834[_0x715d('0x38')],function(_0x454bba){var _0x2ef9de={};_0x2ef9de[_0x454bba]={'$like':'%'+_0x60fd84['query'][_0x715d('0x3f')]+'%'};return _0x2ef9de;})});}_0x31a834=_['merge']({},_0x31a834,_0x60fd84[_0x715d('0x43')]);return _0xcf797c[_0x715d('0x85')](_0x31a834);}})[_0x715d('0x24')](function(_0x2768cb){if(_0x2768cb){_0x22d998=_0x2768cb[_0x715d('0x39')];if(!_0x60fd84[_0x715d('0x33')][_0x715d('0x3a')]('nolimit')){_0x31a834[_0x715d('0x1f')]=qs[_0x715d('0x1f')](_0x60fd84[_0x715d('0x33')][_0x715d('0x1f')]);_0x31a834[_0x715d('0x1e')]=qs[_0x715d('0x1e')](_0x60fd84[_0x715d('0x33')]['offset']);}return _0xcf797c['getBlackLists'](_0x31a834);}})[_0x715d('0x24')](function(_0x3c9fb6){if(_0x3c9fb6){return _0x3c9fb6?{'count':_0x22d998,'rows':_0x3c9fb6}:null;}})['then'](respondWithResult(_0x164f06,null))['catch'](handleError(_0x164f06,null));};exports[_0x715d('0x86')]=function(_0xb62f42,_0xd187c4,_0x28b7e9){var _0x30c7d6,_0x3adf9f;return db[_0x715d('0x2f')][_0x715d('0x4a')]({'where':{'id':_0xb62f42['params']['id']}})['then'](handleEntityNotFound(_0xd187c4,null))['then'](function(_0x52278a){if(_0x52278a){_0x3adf9f=_0x52278a;return _0x52278a[_0x715d('0x86')](_0xb62f42[_0x715d('0x4d')][_0x715d('0x68')],_[_0x715d('0x55')](_0xb62f42['body'],[_0x715d('0x68'),'id'])||{});}return null;})['spread'](function(_0x4a3d53){var _0x4aa5b2;_0x30c7d6=_0x4a3d53||[];var _0x223582=[];if(_0x4a3d53){for(var _0x569a55=0x0;_0x569a55<_0x4a3d53[_0x715d('0x39')];_0x569a55+=0x1){var _0x1c37c6=_0x4a3d53[_0x569a55][_0x715d('0x4f')]({'plain':!![]});_0x4aa5b2=squel[_0x715d('0x6b')]()['into'](_0x715d('0x87'))[_0x715d('0x6d')]([_0x715d('0x6e'),_0x715d('0x70'),_0x715d('0x71'),_0x715d('0x5e'),_0x715d('0x57'),_0x715d('0x56')],squel['select']()[_0x715d('0x72')](_0x715d('0x6e'),'phone')[_0x715d('0x72')]('id','ContactId')['field'](_0x1c37c6[_0x715d('0x74')][_0x715d('0x75')](),_0x715d('0x71'))[_0x715d('0x72')](_0xb62f42['params']['id']['toString'](),_0x715d('0x5e'))['field']('NOW()',_0x715d('0x57'))[_0x715d('0x72')](_0x715d('0x73'),'updatedAt')[_0x715d('0x76')](_0x715d('0x82'))[_0x715d('0x40')](_0x715d('0x77'))['where'](_0x715d('0x78'),_0x1c37c6[_0x715d('0x74')][_0x715d('0x75')]())[_0x715d('0x40')](_0x715d('0x79')))[_0x715d('0x75')]();_0x223582[_0x715d('0x83')](db['sequelize']['query'](_0x4aa5b2));}return BPromise[_0x715d('0x88')](_0x223582);}})['then'](function(){return _0x30c7d6;})['then'](respondWithResult(_0xd187c4,null))[_0x715d('0x4b')](handleError(_0xd187c4,null));};exports[_0x715d('0x89')]=function(_0x1acf2e,_0xe59bcf,_0x546a5f){return db['Campaign'][_0x715d('0x4a')]({'where':{'id':_0x1acf2e[_0x715d('0x47')]['id']}})[_0x715d('0x24')](handleEntityNotFound(_0xe59bcf,null))[_0x715d('0x24')](function(_0xf09fd7){if(_0xf09fd7){return _0xf09fd7[_0x715d('0x89')](_0x1acf2e[_0x715d('0x33')][_0x715d('0x68')]);}})[_0x715d('0x24')](function(_0x3f8b7b){if(_0x3f8b7b){return db['CmHopperBlack'][_0x715d('0x25')]({'where':{'ListId':_0x1acf2e[_0x715d('0x33')][_0x715d('0x68')],'CampaignId':_0x1acf2e[_0x715d('0x47')]['id']}})[_0x715d('0x24')](function(){return _0x3f8b7b;});}})[_0x715d('0x24')](respondWithStatusCode(_0xe59bcf,null))[_0x715d('0x4b')](handleError(_0xe59bcf,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 29d8f66..bc11b94 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 _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 +var _0x7bca=['campaigns','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign'];(function(_0x479488,_0x14c951){var _0x26ca36=function(_0x3b2b87){while(--_0x3b2b87){_0x479488['push'](_0x479488['shift']());}};_0x26ca36(++_0x14c951);}(_0x7bca,0x1b1));var _0xa7bc=function(_0x2e2c1b,_0x94deaf){_0x2e2c1b=_0x2e2c1b-0x0;var _0x43a4f2=_0x7bca[_0x2e2c1b];return _0x43a4f2;};'use strict';var _=require(_0xa7bc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa7bc('0x1'));var moment=require(_0xa7bc('0x2'));var BPromise=require(_0xa7bc('0x3'));var rp=require(_0xa7bc('0x4'));var fs=require('fs');var path=require(_0xa7bc('0x5'));var rimraf=require(_0xa7bc('0x6'));var config=require(_0xa7bc('0x7'));var attributes=require(_0xa7bc('0x8'));module[_0xa7bc('0x9')]=function(_0x49e061,_0x6a5f44){return _0x49e061['define'](_0xa7bc('0xa'),attributes,{'tableName':_0xa7bc('0xb'),'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 513e1c7..eb5e699 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_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 +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(_0x52db26,_0x5cf4cb){var _0xb82798=function(_0x5ddf87){while(--_0x5ddf87){_0x52db26['push'](_0x52db26['shift']());}};_0xb82798(++_0x5cf4cb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 ff83502..e9a354f 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 _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 +var _0x8389=['../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','getHopperBlacks','/:id/lists','/:id/blacklists','create','post','/:id/clone','clone','addLists','addBlackLists','put','update','delete','/:id','destroy','removeLists','removeBlackLists','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x502f0e,_0x3463b3){var _0x2522e8=function(_0x51c202){while(--_0x51c202){_0x502f0e['push'](_0x502f0e['shift']());}};_0x2522e8(++_0x3463b3);}(_0x8389,0x158));var _0x9838=function(_0x421745,_0x29979d){_0x421745=_0x421745-0x0;var _0x57127e=_0x8389[_0x421745];return _0x57127e;};'use strict';var multer=require(_0x9838('0x0'));var util=require(_0x9838('0x1'));var path=require('path');var timeout=require(_0x9838('0x2'));var express=require(_0x9838('0x3'));var router=express[_0x9838('0x4')]();var auth=require(_0x9838('0x5'));var interaction=require(_0x9838('0x6'));var config=require(_0x9838('0x7'));var controller=require(_0x9838('0x8'));router[_0x9838('0x9')]('/',auth[_0x9838('0xa')](),controller[_0x9838('0xb')]);router[_0x9838('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9838('0xc')]);router[_0x9838('0x9')](_0x9838('0xd'),auth[_0x9838('0xa')](),controller[_0x9838('0xe')]);router['get'](_0x9838('0xf'),auth[_0x9838('0xa')](),controller[_0x9838('0x10')]);router['get']('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x9838('0x11')]);router[_0x9838('0x9')]('/:id/hopper_black',auth[_0x9838('0xa')](),controller[_0x9838('0x12')]);router[_0x9838('0x9')](_0x9838('0x13'),auth['isAuthenticated'](),controller['getLists']);router[_0x9838('0x9')](_0x9838('0x14'),auth['isAuthenticated'](),controller['getBlackLists']);router['post']('/',auth[_0x9838('0xa')](),controller[_0x9838('0x15')]);router[_0x9838('0x16')](_0x9838('0x17'),auth[_0x9838('0xa')](),controller[_0x9838('0x18')]);router[_0x9838('0x16')](_0x9838('0x13'),auth['isAuthenticated'](),controller[_0x9838('0x19')]);router[_0x9838('0x16')]('/:id/blacklists',auth[_0x9838('0xa')](),controller[_0x9838('0x1a')]);router[_0x9838('0x1b')]('/:id',auth[_0x9838('0xa')](),controller[_0x9838('0x1c')]);router[_0x9838('0x1d')](_0x9838('0x1e'),auth['isAuthenticated'](),controller[_0x9838('0x1f')]);router[_0x9838('0x1d')](_0x9838('0x13'),auth[_0x9838('0xa')](),controller[_0x9838('0x20')]);router['delete'](_0x9838('0x14'),auth[_0x9838('0xa')](),controller[_0x9838('0x21')]);module[_0x9838('0x22')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index c7b71c7..a5c4fb2 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 _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 +var _0x9e09=['key','sequelize','exports','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x723861,_0x3c721d){var _0x4374cb=function(_0x501f5b){while(--_0x501f5b){_0x723861['push'](_0x723861['shift']());}};_0x4374cb(++_0x3c721d);}(_0x9e09,0x94));var _0x99e0=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x9e09[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x99e0('0x0'));module[_0x99e0('0x1')]={'key':{'type':Sequelize[_0x99e0('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x99e0('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x99e0('0x2')]},'name':{'type':Sequelize[_0x99e0('0x4')],'get':function(){return this[_0x99e0('0x5')](_0x99e0('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 56ea1e8..397cc8c 100644 --- a/server/api/cannedAnswer/cannedAnswer.controller.js +++ b/server/api/cannedAnswer/cannedAnswer.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['set','reject','update','then','get','CannedAnswers','UserProfileResource','destroy','end','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','catch','show','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_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 +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(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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 18f2acd..586767e 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 _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 +var _0xc79f=['exports','define','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x27b77f,_0x381ac8){var _0xd790d6=function(_0x8f3511){while(--_0x8f3511){_0x27b77f['push'](_0x27b77f['shift']());}};_0xd790d6(++_0x381ac8);}(_0xc79f,0x82));var _0xfc79=function(_0x4d9442,_0x1e784a){_0x4d9442=_0x4d9442-0x0;var _0x5b0d83=_0xc79f[_0x4d9442];return _0x5b0d83;};'use strict';var _=require(_0xfc79('0x0'));var util=require(_0xfc79('0x1'));var logger=require(_0xfc79('0x2'))(_0xfc79('0x3'));var moment=require(_0xfc79('0x4'));var BPromise=require('bluebird');var rp=require(_0xfc79('0x5'));var fs=require('fs');var path=require(_0xfc79('0x6'));var rimraf=require(_0xfc79('0x7'));var config=require(_0xfc79('0x8'));var attributes=require(_0xfc79('0x9'));module[_0xfc79('0xa')]=function(_0x660769,_0x1ba054){return _0x660769[_0xfc79('0xb')]('CannedAnswer',attributes,{'tableName':_0xfc79('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xfc79('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 124ae4f..b7c7e85 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 _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 +var _0x2cd6=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x5a5d46,_0x2f5e7e){var _0x1538c6=function(_0x4eca05){while(--_0x4eca05){_0x5a5d46['push'](_0x5a5d46['shift']());}};_0x1538c6(++_0x2f5e7e);}(_0x2cd6,0x10a));var _0x62cd=function(_0x296d30,_0x1b0a67){_0x296d30=_0x296d30-0x0;var _0x598073=_0x2cd6[_0x296d30];return _0x598073;};'use strict';var _=require(_0x62cd('0x0'));var util=require(_0x62cd('0x1'));var moment=require(_0x62cd('0x2'));var BPromise=require('bluebird');var rs=require(_0x62cd('0x3'));var fs=require('fs');var Redis=require(_0x62cd('0x4'));var db=require(_0x62cd('0x5'))['db'];var utils=require(_0x62cd('0x6'));var logger=require('../../config/logger')(_0x62cd('0x7'));var config=require(_0x62cd('0x8'));var jayson=require(_0x62cd('0x9'));var client=jayson['client'][_0x62cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f84c2,_0x56a5db,_0x1cef1b){return new BPromise(function(_0x35b4b,_0x15638d){return client[_0x62cd('0xb')](_0x3f84c2,_0x1cef1b)[_0x62cd('0xc')](function(_0x33ae4e){logger[_0x62cd('0xd')](_0x62cd('0xe'),_0x56a5db,_0x62cd('0xf'));logger[_0x62cd('0x10')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x56a5db,_0x62cd('0xf'),JSON['stringify'](_0x33ae4e));if(_0x33ae4e[_0x62cd('0x11')]){if(_0x33ae4e['error'][_0x62cd('0x12')]===0x1f4){logger[_0x62cd('0x11')]('CannedAnswer,\x20%s,\x20%s',_0x56a5db,_0x33ae4e[_0x62cd('0x11')][_0x62cd('0x13')]);return _0x15638d(_0x33ae4e[_0x62cd('0x11')][_0x62cd('0x13')]);}logger['error'](_0x62cd('0xe'),_0x56a5db,_0x33ae4e['error'][_0x62cd('0x13')]);return _0x35b4b(_0x33ae4e[_0x62cd('0x11')][_0x62cd('0x13')]);}else{logger[_0x62cd('0xd')](_0x62cd('0xe'),_0x56a5db,_0x62cd('0xf'));_0x35b4b(_0x33ae4e[_0x62cd('0x14')][_0x62cd('0x13')]);}})[_0x62cd('0x15')](function(_0x35caa4){logger[_0x62cd('0x11')](_0x62cd('0xe'),_0x56a5db,_0x35caa4);_0x15638d(_0x35caa4);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 33523da..29339c9 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 _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 +var _0xd32c=['isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller'];(function(_0x556516,_0x1a1d03){var _0x41e8d7=function(_0x393930){while(--_0x393930){_0x556516['push'](_0x556516['shift']());}};_0x41e8d7(++_0x1a1d03);}(_0xd32c,0x64));var _0xcd32=function(_0x75b25d,_0x3fbae3){_0x75b25d=_0x75b25d-0x0;var _0x3400de=_0xd32c[_0x75b25d];return _0x3400de;};'use strict';var multer=require(_0xcd32('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcd32('0x1'));var express=require(_0xcd32('0x2'));var router=express[_0xcd32('0x3')]();var auth=require(_0xcd32('0x4'));var interaction=require(_0xcd32('0x5'));var config=require(_0xcd32('0x6'));var controller=require(_0xcd32('0x7'));router['get']('/',auth[_0xcd32('0x8')](),controller[_0xcd32('0x9')]);router['get']('/:id',auth[_0xcd32('0x8')](),controller[_0xcd32('0xa')]);router[_0xcd32('0xb')]('/',auth[_0xcd32('0x8')](),controller[_0xcd32('0xc')]);router[_0xcd32('0xd')](_0xcd32('0xe'),auth[_0xcd32('0x8')](),controller[_0xcd32('0xf')]);router[_0xcd32('0x10')]('/:id',auth[_0xcd32('0x8')](),controller['destroy']);module[_0xcd32('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 1e68d5e..f50b4c8 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 _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 +var _0x7ebf=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x7ae4b7,_0x59b111){var _0x4a13ef=function(_0x320853){while(--_0x320853){_0x7ae4b7['push'](_0x7ae4b7['shift']());}};_0x4a13ef(++_0x59b111);}(_0x7ebf,0x10e));var _0xf7eb=function(_0x5a07d4,_0x501d6c){_0x5a07d4=_0x5a07d4-0x0;var _0xacb3e3=_0x7ebf[_0x5a07d4];return _0xacb3e3;};'use strict';var Sequelize=require(_0xf7eb('0x0'));module[_0xf7eb('0x1')]={'calldate':{'type':Sequelize[_0xf7eb('0x2')],'allowNull':![],'defaultValue':_0xf7eb('0x3')},'clid':{'type':Sequelize[_0xf7eb('0x4')]},'src':{'type':Sequelize[_0xf7eb('0x4')]},'dst':{'type':Sequelize[_0xf7eb('0x4')]},'dcontext':{'type':Sequelize[_0xf7eb('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xf7eb('0x4')]},'lastdata':{'type':Sequelize[_0xf7eb('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xf7eb('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf7eb('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xf7eb('0x4')]},'userfield':{'type':Sequelize[_0xf7eb('0x4')]},'uniqueid':{'type':Sequelize[_0xf7eb('0x4')]},'linkedid':{'type':Sequelize[_0xf7eb('0x4')]},'sequence':{'type':Sequelize[_0xf7eb('0x4')]},'peeraccount':{'type':Sequelize[_0xf7eb('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xf7eb('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 9fb897b..69dc85e 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 _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 +var _0xef21=['options','count','includeAll','findAll','catch','params','length','include','find','create','body','describe','html-pdf','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/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','map','Cdr','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge'];(function(_0x53310b,_0x1ac4a3){var _0x2f0db4=function(_0x464a33){while(--_0x464a33){_0x53310b['push'](_0x53310b['shift']());}};_0x2f0db4(++_0x1ac4a3);}(_0xef21,0x16a));var _0x1ef2=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xef21[_0x5f3f88];return _0xd08119;};'use strict';var pdf=require(_0x1ef2('0x0'));var emlformat=require(_0x1ef2('0x1'));var rimraf=require(_0x1ef2('0x2'));var zipdir=require(_0x1ef2('0x3'));var jsonpatch=require(_0x1ef2('0x4'));var rp=require(_0x1ef2('0x5'));var moment=require(_0x1ef2('0x6'));var BPromise=require(_0x1ef2('0x7'));var Mustache=require(_0x1ef2('0x8'));var util=require(_0x1ef2('0x9'));var path=require('path');var sox=require(_0x1ef2('0xa'));var csv=require(_0x1ef2('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1ef2('0xc'));var squel=require(_0x1ef2('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1ef2('0xe'));var toCsv=require(_0x1ef2('0xb'));var querystring=require(_0x1ef2('0xf'));var Papa=require(_0x1ef2('0x10'));var Redis=require(_0x1ef2('0x11'));var authService=require(_0x1ef2('0x12'));var qs=require(_0x1ef2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ef2('0x14'));var logger=require(_0x1ef2('0x15'))('api');var utils=require(_0x1ef2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1ef2('0x17'));var db=require(_0x1ef2('0x18'))['db'];function respondWithStatusCode(_0x5a6028,_0xd1fda2){_0xd1fda2=_0xd1fda2||0xcc;return function(_0x281f5b){if(_0x281f5b){return _0x5a6028[_0x1ef2('0x19')](_0xd1fda2);}return _0x5a6028['status'](_0xd1fda2)[_0x1ef2('0x1a')]();};}function respondWithResult(_0x1060af,_0x3427b0){_0x3427b0=_0x3427b0||0xc8;return function(_0x32d0f7){if(_0x32d0f7){return _0x1060af[_0x1ef2('0x1b')](_0x3427b0)[_0x1ef2('0x1c')](_0x32d0f7);}};}function respondWithFilteredResult(_0xeb8894,_0x39a50a){return function(_0x3f9ff2){if(_0x3f9ff2){var _0x5b2a8d=_0x3f9ff2['count'],_0x2cf0db=_0x39a50a[_0x1ef2('0x1d')],_0x52fc83=_0x39a50a[_0x1ef2('0x1d')]+_0x39a50a[_0x1ef2('0x1e')],_0xb3f212;if(_0x52fc83>=_0x5b2a8d){_0x52fc83=_0x5b2a8d;_0xb3f212=0xc8;}else{_0xb3f212=0xce;}_0xeb8894[_0x1ef2('0x1b')](_0xb3f212);return _0xeb8894[_0x1ef2('0x1f')](_0x1ef2('0x20'),_0x2cf0db+'-'+_0x52fc83+'/'+_0x5b2a8d)[_0x1ef2('0x1c')](_0x3f9ff2);}return null;};}function patchUpdates(_0x52824d){return function(_0x334b9d){try{jsonpatch[_0x1ef2('0x21')](_0x334b9d,_0x52824d,!![]);}catch(_0x2b6e08){return BPromise[_0x1ef2('0x22')](_0x2b6e08);}return _0x334b9d[_0x1ef2('0x23')]();};}function saveUpdates(_0xffbdf3,_0x88682d){return function(_0x1fba26){if(_0x1fba26){return _0x1fba26[_0x1ef2('0x24')](_0xffbdf3)[_0x1ef2('0x25')](function(_0x69ffa6){return _0x69ffa6;});}return null;};}function removeEntity(_0x1d78f1,_0x50e20c){return function(_0x52c29d){if(_0x52c29d){return _0x52c29d[_0x1ef2('0x26')]()[_0x1ef2('0x25')](function(){_0x1d78f1[_0x1ef2('0x1b')](0xcc)[_0x1ef2('0x1a')]();});}};}function handleEntityNotFound(_0x4d0a38,_0x4c801b){return function(_0x2f25f2){if(!_0x2f25f2){_0x4d0a38[_0x1ef2('0x19')](0x194);}return _0x2f25f2;};}function handleError(_0x493151,_0x1c2550){_0x1c2550=_0x1c2550||0x1f4;return function(_0x2d1d9e){logger[_0x1ef2('0x27')](_0x2d1d9e['stack']);if(_0x2d1d9e[_0x1ef2('0x28')]){delete _0x2d1d9e[_0x1ef2('0x28')];}_0x493151[_0x1ef2('0x1b')](_0x1c2550)['send'](_0x2d1d9e);};}exports['index']=function(_0x353505,_0x39a632){var _0x5a5079={},_0x3ef90b={},_0x1aa0f0={'count':0x0,'rows':[]};var _0x4dfdfc=_[_0x1ef2('0x29')](db[_0x1ef2('0x2a')][_0x1ef2('0x2b')],function(_0x189e64){return{'name':_0x189e64['fieldName'],'type':_0x189e64[_0x1ef2('0x2c')]['key']};});_0x3ef90b[_0x1ef2('0x2d')]=_[_0x1ef2('0x29')](_0x4dfdfc,'name');_0x3ef90b[_0x1ef2('0x2e')]=_[_0x1ef2('0x2f')](_0x353505[_0x1ef2('0x2e')]);_0x3ef90b[_0x1ef2('0x30')]=_[_0x1ef2('0x31')](_0x3ef90b[_0x1ef2('0x2d')],_0x3ef90b[_0x1ef2('0x2e')]);_0x5a5079['attributes']=_[_0x1ef2('0x31')](_0x3ef90b[_0x1ef2('0x2d')],qs[_0x1ef2('0x32')](_0x353505[_0x1ef2('0x2e')][_0x1ef2('0x32')]));_0x5a5079[_0x1ef2('0x33')]=_0x5a5079[_0x1ef2('0x33')]['length']?_0x5a5079['attributes']:_0x3ef90b[_0x1ef2('0x2d')];if(!_0x353505[_0x1ef2('0x2e')]['hasOwnProperty']('nolimit')){_0x5a5079[_0x1ef2('0x1e')]=qs[_0x1ef2('0x1e')](_0x353505[_0x1ef2('0x2e')][_0x1ef2('0x1e')]);_0x5a5079['offset']=qs[_0x1ef2('0x1d')](_0x353505[_0x1ef2('0x2e')][_0x1ef2('0x1d')]);}_0x5a5079[_0x1ef2('0x34')]=qs[_0x1ef2('0x35')](_0x353505['query']['sort']);_0x5a5079[_0x1ef2('0x36')]=qs[_0x1ef2('0x30')](_[_0x1ef2('0x37')](_0x353505[_0x1ef2('0x2e')],_0x3ef90b[_0x1ef2('0x30')]),_0x4dfdfc);if(_0x353505[_0x1ef2('0x2e')]['filter']){_0x5a5079['where']=_['merge'](_0x5a5079[_0x1ef2('0x36')],{'$or':_[_0x1ef2('0x29')](_0x4dfdfc,function(_0x4efd18){if(_0x4efd18[_0x1ef2('0x2c')]!=='VIRTUAL'){var _0x15b6a2={};_0x15b6a2[_0x4efd18[_0x1ef2('0x28')]]={'$like':'%'+_0x353505[_0x1ef2('0x2e')][_0x1ef2('0x38')]+'%'};return _0x15b6a2;}})});}_0x5a5079=_[_0x1ef2('0x39')]({},_0x5a5079,_0x353505[_0x1ef2('0x3a')]);var _0x2197f4={'where':_0x5a5079[_0x1ef2('0x36')]};return db[_0x1ef2('0x2a')][_0x1ef2('0x3b')](_0x2197f4)[_0x1ef2('0x25')](function(_0x23ff0b){_0x1aa0f0['count']=_0x23ff0b;if(_0x353505[_0x1ef2('0x2e')][_0x1ef2('0x3c')]){_0x5a5079['include']=[{'all':!![]}];}return db[_0x1ef2('0x2a')][_0x1ef2('0x3d')](_0x5a5079);})[_0x1ef2('0x25')](function(_0x422412){_0x1aa0f0['rows']=_0x422412;return _0x1aa0f0;})['then'](respondWithFilteredResult(_0x39a632,_0x5a5079))[_0x1ef2('0x3e')](handleError(_0x39a632,null));};exports['show']=function(_0x484cca,_0x41fa4a){var _0x3e45d3={'raw':!![],'where':{'id':_0x484cca[_0x1ef2('0x3f')]['id']}},_0x106d81={};_0x106d81[_0x1ef2('0x2d')]=_[_0x1ef2('0x2f')](db[_0x1ef2('0x2a')][_0x1ef2('0x2b')]);_0x106d81[_0x1ef2('0x2e')]=_['keys'](_0x484cca[_0x1ef2('0x2e')]);_0x106d81[_0x1ef2('0x30')]=_[_0x1ef2('0x31')](_0x106d81[_0x1ef2('0x2d')],_0x106d81[_0x1ef2('0x2e')]);_0x3e45d3['attributes']=_[_0x1ef2('0x31')](_0x106d81[_0x1ef2('0x2d')],qs['fields'](_0x484cca['query'][_0x1ef2('0x32')]));_0x3e45d3[_0x1ef2('0x33')]=_0x3e45d3[_0x1ef2('0x33')][_0x1ef2('0x40')]?_0x3e45d3['attributes']:_0x106d81[_0x1ef2('0x2d')];if(_0x484cca['query'][_0x1ef2('0x3c')]){_0x3e45d3[_0x1ef2('0x41')]=[{'all':!![]}];}_0x3e45d3=_[_0x1ef2('0x39')]({},_0x3e45d3,_0x484cca[_0x1ef2('0x3a')]);return db[_0x1ef2('0x2a')][_0x1ef2('0x42')](_0x3e45d3)[_0x1ef2('0x25')](handleEntityNotFound(_0x41fa4a,null))[_0x1ef2('0x25')](respondWithResult(_0x41fa4a,null))['catch'](handleError(_0x41fa4a,null));};exports[_0x1ef2('0x43')]=function(_0x703122,_0x458db1){return db['Cdr'][_0x1ef2('0x43')](_0x703122['body'],{})[_0x1ef2('0x25')](respondWithResult(_0x458db1,0xc9))[_0x1ef2('0x3e')](handleError(_0x458db1,null));};exports[_0x1ef2('0x24')]=function(_0x37ad1d,_0x1ae3d7){if(_0x37ad1d[_0x1ef2('0x44')]['id']){delete _0x37ad1d[_0x1ef2('0x44')]['id'];}return db['Cdr'][_0x1ef2('0x42')]({'where':{'id':_0x37ad1d[_0x1ef2('0x3f')]['id']}})[_0x1ef2('0x25')](handleEntityNotFound(_0x1ae3d7,null))[_0x1ef2('0x25')](saveUpdates(_0x37ad1d[_0x1ef2('0x44')],null))[_0x1ef2('0x25')](respondWithResult(_0x1ae3d7,null))['catch'](handleError(_0x1ae3d7,null));};exports['destroy']=function(_0xc11201,_0x39100a){return db[_0x1ef2('0x2a')]['find']({'where':{'id':_0xc11201['params']['id']}})[_0x1ef2('0x25')](handleEntityNotFound(_0x39100a,null))['then'](removeEntity(_0x39100a,null))[_0x1ef2('0x3e')](handleError(_0x39100a,null));};exports[_0x1ef2('0x45')]=function(_0x2acfaf,_0x3bf7c5){return db[_0x1ef2('0x2a')][_0x1ef2('0x45')]()[_0x1ef2('0x25')](respondWithResult(_0x3bf7c5,null))[_0x1ef2('0x3e')](handleError(_0x3bf7c5,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 877d334..12cf5f7 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 _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 +var _0x2675=['path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','moment','bluebird'];(function(_0x311cf2,_0x1af59a){var _0x449e5d=function(_0x1417f9){while(--_0x1417f9){_0x311cf2['push'](_0x311cf2['shift']());}};_0x449e5d(++_0x1af59a);}(_0x2675,0x75));var _0x5267=function(_0xaba5bf,_0x1f81e4){_0xaba5bf=_0xaba5bf-0x0;var _0x4f2a54=_0x2675[_0xaba5bf];return _0x4f2a54;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));module[_0x5267('0x6')]=function(_0x4bd042,_0x10f92c){return _0x4bd042[_0x5267('0x7')](_0x5267('0x8'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x5267('0x9'),'fields':[_0x5267('0x9')]},{'name':'calldate','fields':[_0x5267('0xa')]},{'name':'disposition','fields':[_0x5267('0xb')]},{'name':_0x5267('0xc'),'fields':[_0x5267('0xc')]},{'name':'src','fields':[_0x5267('0xd')]},{'name':'uniqueid','fields':[_0x5267('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index c4218ab..0c5b637 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 _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 +var _0x24e5=['message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','request','info','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s'];(function(_0x231fcf,_0x57f8b3){var _0x140322=function(_0x4e81af){while(--_0x4e81af){_0x231fcf['push'](_0x231fcf['shift']());}};_0x140322(++_0x57f8b3);}(_0x24e5,0x1cb));var _0x524e=function(_0x528036,_0x5630a9){_0x528036=_0x528036-0x0;var _0xc9f7af=_0x24e5[_0x528036];return _0xc9f7af;};'use strict';var _=require(_0x524e('0x0'));var util=require('util');var moment=require(_0x524e('0x1'));var BPromise=require(_0x524e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x524e('0x3'));var db=require(_0x524e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x524e('0x5'));var config=require(_0x524e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x524e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30face,_0x88a97a,_0x1c92b2){return new BPromise(function(_0x4b061b,_0xcbe24e){return client[_0x524e('0x8')](_0x30face,_0x1c92b2)['then'](function(_0x5067a1){logger[_0x524e('0x9')]('Cdr,\x20%s,\x20%s',_0x88a97a,_0x524e('0xa'));logger['debug'](_0x524e('0xb'),_0x88a97a,'request\x20sent',JSON[_0x524e('0xc')](_0x5067a1));if(_0x5067a1[_0x524e('0xd')]){if(_0x5067a1['error'][_0x524e('0xe')]===0x1f4){logger[_0x524e('0xd')](_0x524e('0xf'),_0x88a97a,_0x5067a1['error'][_0x524e('0x10')]);return _0xcbe24e(_0x5067a1['error'][_0x524e('0x10')]);}logger['error']('Cdr,\x20%s,\x20%s',_0x88a97a,_0x5067a1[_0x524e('0xd')][_0x524e('0x10')]);return _0x4b061b(_0x5067a1[_0x524e('0xd')]['message']);}else{logger['info'](_0x524e('0xf'),_0x88a97a,_0x524e('0xa'));_0x4b061b(_0x5067a1[_0x524e('0x11')][_0x524e('0x10')]);}})[_0x524e('0x12')](function(_0x115d26){logger[_0x524e('0xd')](_0x524e('0xf'),_0x88a97a,_0x115d26);_0xcbe24e(_0x115d26);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 2c99ea6..277efd1 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 _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 +var _0x8366=['/describe','isAuthenticated','describe','/:id','show','put','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get'];(function(_0x47e3c1,_0x4126ad){var _0x34dc4f=function(_0x1916c1){while(--_0x1916c1){_0x47e3c1['push'](_0x47e3c1['shift']());}};_0x34dc4f(++_0x4126ad);}(_0x8366,0xf7));var _0x6836=function(_0x7dbcdc,_0x29a870){_0x7dbcdc=_0x7dbcdc-0x0;var _0x78cb11=_0x8366[_0x7dbcdc];return _0x78cb11;};'use strict';var multer=require('multer');var util=require(_0x6836('0x0'));var path=require('path');var timeout=require(_0x6836('0x1'));var express=require(_0x6836('0x2'));var router=express['Router']();var auth=require(_0x6836('0x3'));var interaction=require(_0x6836('0x4'));var config=require(_0x6836('0x5'));var controller=require(_0x6836('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6836('0x7')](_0x6836('0x8'),auth[_0x6836('0x9')](),controller[_0x6836('0xa')]);router['get'](_0x6836('0xb'),auth[_0x6836('0x9')](),controller[_0x6836('0xc')]);router['post']('/',auth[_0x6836('0x9')](),controller['create']);router[_0x6836('0xd')](_0x6836('0xb'),auth[_0x6836('0x9')](),controller['update']);router[_0x6836('0xe')]('/:id',auth[_0x6836('0x9')](),controller[_0x6836('0xf')]);module[_0x6836('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index e6fba89..e017a5e 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 _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 +var _0x1c33=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x55c708,_0x52344f){var _0x1ec499=function(_0x16fffd){while(--_0x16fffd){_0x55c708['push'](_0x55c708['shift']());}};_0x1ec499(++_0x52344f);}(_0x1c33,0xf6));var _0x31c3=function(_0x5b1488,_0x6a16d7){_0x5b1488=_0x5b1488-0x0;var _0x1adddf=_0x1c33[_0x5b1488];return _0x1adddf;};'use strict';var Sequelize=require(_0x31c3('0x0'));module[_0x31c3('0x1')]={'priority':{'type':Sequelize[_0x31c3('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x31c3('0x3')],'allowNull':![],'defaultValue':_0x31c3('0x4')},'appdata':{'type':Sequelize[_0x31c3('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x31c3('0x3')],'defaultValue':_0x31c3('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index a348a40..27fcf23 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 _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 +var _0x55b3=['save','update','then','error','name','send','show','params','model','ChatApplication','rawAttributes','query','keys','filters','attributes','intersection','fields','length','include','options','find','catch','body','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range'];(function(_0x4dc2a2,_0x48ed9d){var _0x33ed52=function(_0x40823e){while(--_0x40823e){_0x4dc2a2['push'](_0x4dc2a2['shift']());}};_0x33ed52(++_0x48ed9d);}(_0x55b3,0x17d));var _0x355b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x55b3[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x355b('0x0'));var emlformat=require(_0x355b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x355b('0x2'));var jsonpatch=require(_0x355b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x355b('0x4'));var Mustache=require(_0x355b('0x5'));var util=require(_0x355b('0x6'));var path=require(_0x355b('0x7'));var sox=require(_0x355b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x355b('0x9'));var squel=require(_0x355b('0xa'));var crypto=require(_0x355b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x355b('0xc'));var Papa=require(_0x355b('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x355b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x355b('0xf'));var logger=require(_0x355b('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x355b('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x355b('0x12'))['db'];function respondWithStatusCode(_0x5ad9db,_0x55766d){_0x55766d=_0x55766d||0xcc;return function(_0x4d1433){if(_0x4d1433){return _0x5ad9db[_0x355b('0x13')](_0x55766d);}return _0x5ad9db[_0x355b('0x14')](_0x55766d)[_0x355b('0x15')]();};}function respondWithResult(_0x36da8b,_0x1255d7){_0x1255d7=_0x1255d7||0xc8;return function(_0x154daa){if(_0x154daa){return _0x36da8b[_0x355b('0x14')](_0x1255d7)[_0x355b('0x16')](_0x154daa);}};}function respondWithFilteredResult(_0x99cc3e,_0x2ac80f){return function(_0x37635d){if(_0x37635d){var _0x2567ea=_0x37635d['count'],_0x5d6c6=_0x2ac80f[_0x355b('0x17')],_0x59775b=_0x2ac80f['offset']+_0x2ac80f[_0x355b('0x18')],_0x570080;if(_0x59775b>=_0x2567ea){_0x59775b=_0x2567ea;_0x570080=0xc8;}else{_0x570080=0xce;}_0x99cc3e['status'](_0x570080);return _0x99cc3e[_0x355b('0x19')](_0x355b('0x1a'),_0x5d6c6+'-'+_0x59775b+'/'+_0x2567ea)[_0x355b('0x16')](_0x37635d);}return null;};}function patchUpdates(_0x3024f5){return function(_0xccff82){try{jsonpatch['apply'](_0xccff82,_0x3024f5,!![]);}catch(_0x49a325){return BPromise['reject'](_0x49a325);}return _0xccff82[_0x355b('0x1b')]();};}function saveUpdates(_0x59e0a0,_0x4c30a3){return function(_0x43d391){if(_0x43d391){return _0x43d391[_0x355b('0x1c')](_0x59e0a0)[_0x355b('0x1d')](function(_0x1a2a1c){return _0x1a2a1c;});}return null;};}function removeEntity(_0xdd81e7,_0x77466c){return function(_0x7574bf){if(_0x7574bf){return _0x7574bf['destroy']()['then'](function(){_0xdd81e7[_0x355b('0x14')](0xcc)[_0x355b('0x15')]();});}};}function handleEntityNotFound(_0x52209b,_0x14cb6e){return function(_0x3b1549){if(!_0x3b1549){_0x52209b[_0x355b('0x13')](0x194);}return _0x3b1549;};}function handleError(_0x363883,_0x410eab){_0x410eab=_0x410eab||0x1f4;return function(_0x4d800c){logger[_0x355b('0x1e')](_0x4d800c['stack']);if(_0x4d800c[_0x355b('0x1f')]){delete _0x4d800c[_0x355b('0x1f')];}_0x363883[_0x355b('0x14')](_0x410eab)[_0x355b('0x20')](_0x4d800c);};}exports[_0x355b('0x21')]=function(_0x4d4a1b,_0x4c46da){var _0x68a6d0={'raw':!![],'where':{'id':_0x4d4a1b[_0x355b('0x22')]['id']}},_0x28d501={};_0x28d501[_0x355b('0x23')]=_['keys'](db[_0x355b('0x24')][_0x355b('0x25')]);_0x28d501[_0x355b('0x26')]=_[_0x355b('0x27')](_0x4d4a1b[_0x355b('0x26')]);_0x28d501[_0x355b('0x28')]=_['intersection'](_0x28d501['model'],_0x28d501[_0x355b('0x26')]);_0x68a6d0[_0x355b('0x29')]=_[_0x355b('0x2a')](_0x28d501['model'],qs[_0x355b('0x2b')](_0x4d4a1b['query'][_0x355b('0x2b')]));_0x68a6d0[_0x355b('0x29')]=_0x68a6d0['attributes'][_0x355b('0x2c')]?_0x68a6d0[_0x355b('0x29')]:_0x28d501[_0x355b('0x23')];if(_0x4d4a1b['query']['includeAll']){_0x68a6d0[_0x355b('0x2d')]=[{'all':!![]}];}_0x68a6d0=_['merge']({},_0x68a6d0,_0x4d4a1b[_0x355b('0x2e')]);return db['ChatApplication'][_0x355b('0x2f')](_0x68a6d0)[_0x355b('0x1d')](handleEntityNotFound(_0x4c46da,null))[_0x355b('0x1d')](respondWithResult(_0x4c46da,null))[_0x355b('0x30')](handleError(_0x4c46da,null));};exports[_0x355b('0x1c')]=function(_0x1a6f94,_0x34b95d){if(_0x1a6f94[_0x355b('0x31')]['id']){delete _0x1a6f94[_0x355b('0x31')]['id'];}return db[_0x355b('0x24')][_0x355b('0x2f')]({'where':{'id':_0x1a6f94[_0x355b('0x22')]['id']}})[_0x355b('0x1d')](handleEntityNotFound(_0x34b95d,null))['then'](saveUpdates(_0x1a6f94[_0x355b('0x31')],null))[_0x355b('0x1d')](respondWithResult(_0x34b95d,null))[_0x355b('0x30')](handleError(_0x34b95d,null));};exports[_0x355b('0x32')]=function(_0x30b605,_0x509406){return db[_0x355b('0x24')][_0x355b('0x2f')]({'where':{'id':_0x30b605[_0x355b('0x22')]['id']}})['then'](handleEntityNotFound(_0x509406,null))[_0x355b('0x1d')](removeEntity(_0x509406,null))['catch'](handleError(_0x509406,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 7f93a33..1348f72 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(_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 +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 4844729..556935c 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 _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 +var _0x14c9=['request','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','ChatApplication,\x20%s,\x20%s','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0xe6feaf,_0x3ddce4){var _0x57ae9a=function(_0x32d3ac){while(--_0x32d3ac){_0xe6feaf['push'](_0xe6feaf['shift']());}};_0x57ae9a(++_0x3ddce4);}(_0x14c9,0xe6));var _0x914c=function(_0x290fe7,_0x10c1ff){_0x290fe7=_0x290fe7-0x0;var _0x27483e=_0x14c9[_0x290fe7];return _0x27483e;};'use strict';var _=require('lodash');var util=require(_0x914c('0x0'));var moment=require('moment');var BPromise=require(_0x914c('0x1'));var rs=require(_0x914c('0x2'));var fs=require('fs');var Redis=require(_0x914c('0x3'));var db=require(_0x914c('0x4'))['db'];var utils=require(_0x914c('0x5'));var logger=require(_0x914c('0x6'))('rpc');var config=require(_0x914c('0x7'));var jayson=require(_0x914c('0x8'));var client=jayson['client'][_0x914c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33f01b,_0x27728a,_0x444406){return new BPromise(function(_0x48b8f1,_0x52f2fb){return client[_0x914c('0xa')](_0x33f01b,_0x444406)['then'](function(_0x5fd003){logger[_0x914c('0xb')]('ChatApplication,\x20%s,\x20%s',_0x27728a,_0x914c('0xc'));logger[_0x914c('0xd')](_0x914c('0xe'),_0x27728a,'request\x20sent',JSON[_0x914c('0xf')](_0x5fd003));if(_0x5fd003['error']){if(_0x5fd003[_0x914c('0x10')]['code']===0x1f4){logger[_0x914c('0x10')](_0x914c('0x11'),_0x27728a,_0x5fd003[_0x914c('0x10')][_0x914c('0x12')]);return _0x52f2fb(_0x5fd003[_0x914c('0x10')]['message']);}logger[_0x914c('0x10')](_0x914c('0x11'),_0x27728a,_0x5fd003[_0x914c('0x10')][_0x914c('0x12')]);return _0x48b8f1(_0x5fd003[_0x914c('0x10')]['message']);}else{logger[_0x914c('0xb')]('ChatApplication,\x20%s,\x20%s',_0x27728a,_0x914c('0xc'));_0x48b8f1(_0x5fd003[_0x914c('0x13')][_0x914c('0x12')]);}})['catch'](function(_0x3a7be6){logger[_0x914c('0x10')](_0x914c('0x11'),_0x27728a,_0x3a7be6);_0x52f2fb(_0x3a7be6);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index f5056e0..ab89c9f 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 _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 +var _0x2e6a=['Router','../../components/auth/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x533dd3,_0x35b59a){var _0x500636=function(_0x8633a3){while(--_0x8633a3){_0x533dd3['push'](_0x533dd3['shift']());}};_0x500636(++_0x35b59a);}(_0x2e6a,0xb1));var _0xa2e6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2e6a[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0xa2e6('0x0'));var path=require(_0xa2e6('0x1'));var timeout=require(_0xa2e6('0x2'));var express=require('express');var router=express[_0xa2e6('0x3')]();var auth=require(_0xa2e6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa2e6('0x5'));var controller=require(_0xa2e6('0x6'));router[_0xa2e6('0x7')](_0xa2e6('0x8'),auth[_0xa2e6('0x9')](),controller[_0xa2e6('0xa')]);router[_0xa2e6('0xb')](_0xa2e6('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xa2e6('0xc')]('/:id',auth[_0xa2e6('0x9')](),controller[_0xa2e6('0xd')]);module[_0xa2e6('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 6d34284..bae9eeb 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 _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 +var _0xef08=['exports','STRING','BOOLEAN','sequelize'];(function(_0x333ee4,_0x47da07){var _0x580eee=function(_0x34fe4d){while(--_0x34fe4d){_0x333ee4['push'](_0x333ee4['shift']());}};_0x580eee(++_0x47da07);}(_0xef08,0x7b));var _0x8ef0=function(_0x53788f,_0x1bd496){_0x53788f=_0x53788f-0x0;var _0x2a0821=_0xef08[_0x53788f];return _0x2a0821;};'use strict';var Sequelize=require(_0x8ef0('0x0'));module[_0x8ef0('0x1')]={'name':{'type':Sequelize[_0x8ef0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8ef0('0x2')]},'write':{'type':Sequelize[_0x8ef0('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index a8a746f..dea4138 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 _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 +var _0x2ebd=['findAll','rows','show','params','keys','find','create','body','update','destroy','describe','getUnread','toInteger','addMembers','ids','omit','getMembers','findOne','User','pick','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','nolimit','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../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','./chatGroup.socket','jayson/promise','client','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','name','send','index','ChatGroup','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include'];(function(_0x9a41f1,_0x26a48b){var _0x1d2eab=function(_0x520a48){while(--_0x520a48){_0x9a41f1['push'](_0x9a41f1['shift']());}};_0x1d2eab(++_0x26a48b);}(_0x2ebd,0x1c8));var _0xd2eb=function(_0x13706a,_0xca0917){_0x13706a=_0x13706a-0x0;var _0x97e6ad=_0x2ebd[_0x13706a];return _0x97e6ad;};'use strict';var pdf=require(_0xd2eb('0x0'));var emlformat=require(_0xd2eb('0x1'));var rimraf=require(_0xd2eb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd2eb('0x3'));var moment=require(_0xd2eb('0x4'));var BPromise=require(_0xd2eb('0x5'));var Mustache=require(_0xd2eb('0x6'));var util=require(_0xd2eb('0x7'));var path=require(_0xd2eb('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd2eb('0x9'));var fs=require('fs');var _=require(_0xd2eb('0xa'));var squel=require(_0xd2eb('0xb'));var crypto=require(_0xd2eb('0xc'));var jsforce=require(_0xd2eb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd2eb('0xe'));var querystring=require(_0xd2eb('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd2eb('0x10'));var qs=require(_0xd2eb('0x11'));var as=require(_0xd2eb('0x12'));var hardwareService=require(_0xd2eb('0x13'));var logger=require(_0xd2eb('0x14'))(_0xd2eb('0x15'));var utils=require(_0xd2eb('0x16'));var config=require(_0xd2eb('0x17'));var licenseUtil=require(_0xd2eb('0x18'));var db=require(_0xd2eb('0x19'))['db'];config[_0xd2eb('0x1a')]=_[_0xd2eb('0x1b')](config['redis'],{'host':_0xd2eb('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd2eb('0x1a')]));require(_0xd2eb('0x1d'))['register'](socket);var jayson=require(_0xd2eb('0x1e'));var client=jayson[_0xd2eb('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa4f6c4,_0xa042c9,_0x216f82,_0x4bf46e){return new BPromise(function(_0x5a4db7,_0x80d2eb){var _0x5086ab=_0x4bf46e||client;return _0x5086ab['request'](_0xa4f6c4,_0x216f82)[_0xd2eb('0x20')](function(_0xda8ac1){logger['info'](_0xd2eb('0x21'),_0xa042c9,_0xd2eb('0x22'));logger[_0xd2eb('0x23')](_0xd2eb('0x24'),_0xa042c9,_0xd2eb('0x22'),JSON[_0xd2eb('0x25')](_0xda8ac1));if(_0xda8ac1[_0xd2eb('0x26')]){if(_0xda8ac1[_0xd2eb('0x26')]['code']===0x1f4){logger[_0xd2eb('0x26')]('ChatGroup,\x20%s,\x20%s',_0xa042c9,_0xda8ac1[_0xd2eb('0x26')][_0xd2eb('0x27')]);return _0x80d2eb(_0xda8ac1[_0xd2eb('0x26')][_0xd2eb('0x27')]);}logger['error'](_0xd2eb('0x21'),_0xa042c9,_0xda8ac1[_0xd2eb('0x26')]['message']);return _0x5a4db7(_0xda8ac1[_0xd2eb('0x26')][_0xd2eb('0x27')]);}else{logger[_0xd2eb('0x28')](_0xd2eb('0x21'),_0xa042c9,_0xd2eb('0x22'));_0x5a4db7(_0xda8ac1[_0xd2eb('0x29')][_0xd2eb('0x27')]);}})[_0xd2eb('0x2a')](function(_0x517536){logger[_0xd2eb('0x26')](_0xd2eb('0x21'),_0xa042c9,_0x517536);_0x80d2eb(_0x517536);});});}function respondWithStatusCode(_0x22329f,_0x3e6eb1){_0x3e6eb1=_0x3e6eb1||0xcc;return function(_0x33832f){if(_0x33832f){return _0x22329f[_0xd2eb('0x2b')](_0x3e6eb1);}return _0x22329f[_0xd2eb('0x2c')](_0x3e6eb1)[_0xd2eb('0x2d')]();};}function respondWithResult(_0x1c6c1b,_0x3db184){_0x3db184=_0x3db184||0xc8;return function(_0xd1154){if(_0xd1154){return _0x1c6c1b[_0xd2eb('0x2c')](_0x3db184)[_0xd2eb('0x2e')](_0xd1154);}};}function respondWithFilteredResult(_0x375c0e,_0x38b271){return function(_0x39ee3d){if(_0x39ee3d){var _0x448973=_0x39ee3d[_0xd2eb('0x2f')],_0x6996b=_0x38b271['offset'],_0x6998b1=_0x38b271[_0xd2eb('0x30')]+_0x38b271[_0xd2eb('0x31')],_0x39ed9d;if(_0x6998b1>=_0x448973){_0x6998b1=_0x448973;_0x39ed9d=0xc8;}else{_0x39ed9d=0xce;}_0x375c0e[_0xd2eb('0x2c')](_0x39ed9d);return _0x375c0e['set'](_0xd2eb('0x32'),_0x6996b+'-'+_0x6998b1+'/'+_0x448973)['json'](_0x39ee3d);}return null;};}function patchUpdates(_0x2e4559){return function(_0x1225f8){try{jsonpatch['apply'](_0x1225f8,_0x2e4559,!![]);}catch(_0x33abaa){return BPromise[_0xd2eb('0x33')](_0x33abaa);}return _0x1225f8[_0xd2eb('0x34')]();};}function saveUpdates(_0x13af38,_0x19b833){return function(_0x10a247){if(_0x10a247){return _0x10a247['update'](_0x13af38)['then'](function(_0x15d396){return _0x15d396;});}return null;};}function removeEntity(_0x4f573a,_0x4d6187){return function(_0x3e9efa){if(_0x3e9efa){return _0x3e9efa['destroy']()[_0xd2eb('0x20')](function(){_0x4f573a['status'](0xcc)[_0xd2eb('0x2d')]();});}};}function handleEntityNotFound(_0x3f9020,_0x4df58a){return function(_0x47a942){if(!_0x47a942){_0x3f9020[_0xd2eb('0x2b')](0x194);}return _0x47a942;};}function handleError(_0x564c76,_0x455011){_0x455011=_0x455011||0x1f4;return function(_0x38877b){logger[_0xd2eb('0x26')](_0x38877b['stack']);if(_0x38877b['name']){delete _0x38877b[_0xd2eb('0x35')];}_0x564c76['status'](_0x455011)[_0xd2eb('0x36')](_0x38877b);};}exports[_0xd2eb('0x37')]=function(_0x3d0be3,_0x2e0975){var _0x5c3070={},_0x7d4daa={},_0x5a6d73={'count':0x0,'rows':[]};var _0x46de47=_['map'](db[_0xd2eb('0x38')][_0xd2eb('0x39')],function(_0x45ada1){return{'name':_0x45ada1[_0xd2eb('0x3a')],'type':_0x45ada1[_0xd2eb('0x3b')][_0xd2eb('0x3c')]};});_0x7d4daa[_0xd2eb('0x3d')]=_[_0xd2eb('0x3e')](_0x46de47,_0xd2eb('0x35'));_0x7d4daa[_0xd2eb('0x3f')]=_['keys'](_0x3d0be3[_0xd2eb('0x3f')]);_0x7d4daa[_0xd2eb('0x40')]=_['intersection'](_0x7d4daa[_0xd2eb('0x3d')],_0x7d4daa[_0xd2eb('0x3f')]);_0x5c3070[_0xd2eb('0x41')]=_[_0xd2eb('0x42')](_0x7d4daa['model'],qs[_0xd2eb('0x43')](_0x3d0be3['query'][_0xd2eb('0x43')]));_0x5c3070[_0xd2eb('0x41')]=_0x5c3070['attributes'][_0xd2eb('0x44')]?_0x5c3070[_0xd2eb('0x41')]:_0x7d4daa[_0xd2eb('0x3d')];if(!_0x3d0be3[_0xd2eb('0x3f')][_0xd2eb('0x45')]('nolimit')){_0x5c3070[_0xd2eb('0x31')]=qs[_0xd2eb('0x31')](_0x3d0be3[_0xd2eb('0x3f')][_0xd2eb('0x31')]);_0x5c3070[_0xd2eb('0x30')]=qs['offset'](_0x3d0be3[_0xd2eb('0x3f')][_0xd2eb('0x30')]);}_0x5c3070[_0xd2eb('0x46')]=qs[_0xd2eb('0x47')](_0x3d0be3['query'][_0xd2eb('0x47')]);_0x5c3070['where']=qs[_0xd2eb('0x40')](_['pick'](_0x3d0be3[_0xd2eb('0x3f')],_0x7d4daa[_0xd2eb('0x40')]),_0x46de47);if(_0x3d0be3[_0xd2eb('0x3f')][_0xd2eb('0x48')]){_0x5c3070[_0xd2eb('0x49')]=_['merge'](_0x5c3070[_0xd2eb('0x49')],{'$or':_[_0xd2eb('0x3e')](_0x46de47,function(_0x5e5883){if(_0x5e5883[_0xd2eb('0x3b')]!==_0xd2eb('0x4a')){var _0x2ffceb={};_0x2ffceb[_0x5e5883[_0xd2eb('0x35')]]={'$like':'%'+_0x3d0be3[_0xd2eb('0x3f')][_0xd2eb('0x48')]+'%'};return _0x2ffceb;}})});}_0x5c3070=_[_0xd2eb('0x4b')]({},_0x5c3070,_0x3d0be3[_0xd2eb('0x4c')]);var _0x6fc4aa={'where':_0x5c3070['where']};return db[_0xd2eb('0x38')]['count'](_0x6fc4aa)[_0xd2eb('0x20')](function(_0x22f0fc){_0x5a6d73[_0xd2eb('0x2f')]=_0x22f0fc;if(_0x3d0be3[_0xd2eb('0x3f')][_0xd2eb('0x4d')]){_0x5c3070[_0xd2eb('0x4e')]=[{'all':!![]}];}return db[_0xd2eb('0x38')][_0xd2eb('0x4f')](_0x5c3070);})[_0xd2eb('0x20')](function(_0x10da6d){_0x5a6d73[_0xd2eb('0x50')]=_0x10da6d;return _0x5a6d73;})[_0xd2eb('0x20')](respondWithFilteredResult(_0x2e0975,_0x5c3070))[_0xd2eb('0x2a')](handleError(_0x2e0975,null));};exports[_0xd2eb('0x51')]=function(_0x375da1,_0x2f079c){var _0xe15d62={'raw':!![],'where':{'id':_0x375da1[_0xd2eb('0x52')]['id']}},_0x412b70={};_0x412b70[_0xd2eb('0x3d')]=_[_0xd2eb('0x53')](db[_0xd2eb('0x38')][_0xd2eb('0x39')]);_0x412b70['query']=_[_0xd2eb('0x53')](_0x375da1[_0xd2eb('0x3f')]);_0x412b70[_0xd2eb('0x40')]=_['intersection'](_0x412b70[_0xd2eb('0x3d')],_0x412b70['query']);_0xe15d62['attributes']=_[_0xd2eb('0x42')](_0x412b70[_0xd2eb('0x3d')],qs['fields'](_0x375da1[_0xd2eb('0x3f')]['fields']));_0xe15d62[_0xd2eb('0x41')]=_0xe15d62[_0xd2eb('0x41')][_0xd2eb('0x44')]?_0xe15d62[_0xd2eb('0x41')]:_0x412b70[_0xd2eb('0x3d')];if(_0x375da1[_0xd2eb('0x3f')]['includeAll']){_0xe15d62['include']=[{'all':!![]}];}_0xe15d62=_['merge']({},_0xe15d62,_0x375da1[_0xd2eb('0x4c')]);return db[_0xd2eb('0x38')][_0xd2eb('0x54')](_0xe15d62)[_0xd2eb('0x20')](handleEntityNotFound(_0x2f079c,null))[_0xd2eb('0x20')](respondWithResult(_0x2f079c,null))['catch'](handleError(_0x2f079c,null));};exports['create']=function(_0x5b2579,_0xeddd97){return db['ChatGroup'][_0xd2eb('0x55')](_0x5b2579[_0xd2eb('0x56')],{})[_0xd2eb('0x20')](respondWithResult(_0xeddd97,0xc9))['catch'](handleError(_0xeddd97,null));};exports[_0xd2eb('0x57')]=function(_0x4292b3,_0x4f98ce){if(_0x4292b3['body']['id']){delete _0x4292b3[_0xd2eb('0x56')]['id'];}return db[_0xd2eb('0x38')][_0xd2eb('0x54')]({'where':{'id':_0x4292b3[_0xd2eb('0x52')]['id']}})['then'](handleEntityNotFound(_0x4f98ce,null))['then'](saveUpdates(_0x4292b3[_0xd2eb('0x56')],null))[_0xd2eb('0x20')](respondWithResult(_0x4f98ce,null))[_0xd2eb('0x2a')](handleError(_0x4f98ce,null));};exports[_0xd2eb('0x58')]=function(_0x5840ab,_0x3ff2a8){return db[_0xd2eb('0x38')]['find']({'where':{'id':_0x5840ab['params']['id']}})['then'](handleEntityNotFound(_0x3ff2a8,null))[_0xd2eb('0x20')](removeEntity(_0x3ff2a8,null))[_0xd2eb('0x2a')](handleError(_0x3ff2a8,null));};exports[_0xd2eb('0x59')]=function(_0x3954de,_0x130e39){return db['ChatGroup'][_0xd2eb('0x59')]()[_0xd2eb('0x20')](respondWithResult(_0x130e39,null))[_0xd2eb('0x2a')](handleError(_0x130e39,null));};exports[_0xd2eb('0x5a')]=function(_0x329210,_0x33b5c6,_0x39352d){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x329210[_0xd2eb('0x52')]['id'],'ToId':_0x329210['user']['id'],'read':![]}})[_0xd2eb('0x20')](function(_0x15531c){return{'id':_[_0xd2eb('0x5b')](_0x329210['params']['id']),'count':_0x15531c};})[_0xd2eb('0x20')](respondWithResult(_0x33b5c6,null))[_0xd2eb('0x2a')](handleError(_0x33b5c6,null));};exports[_0xd2eb('0x5c')]=function(_0x3d1faf,_0x3775bf,_0x5a8cc8){return db[_0xd2eb('0x38')][_0xd2eb('0x54')]({'where':{'id':_0x3d1faf[_0xd2eb('0x52')]['id']}})[_0xd2eb('0x20')](handleEntityNotFound(_0x3775bf,null))[_0xd2eb('0x20')](function(_0x3db519){if(_0x3db519){return _0x3db519[_0xd2eb('0x5c')](_0x3d1faf[_0xd2eb('0x56')][_0xd2eb('0x5d')],_[_0xd2eb('0x5e')](_0x3d1faf['body'],[_0xd2eb('0x5d'),'id'])||{});}})['then'](respondWithResult(_0x3775bf,null))[_0xd2eb('0x2a')](handleError(_0x3775bf,null));};exports[_0xd2eb('0x5f')]=function(_0x425e32,_0x4c5eb7,_0x507556){var _0x48eb34={};var _0x306837={};var _0x2151df;var _0x420ec5;return db[_0xd2eb('0x38')][_0xd2eb('0x60')]({'where':{'id':_0x425e32[_0xd2eb('0x52')]['id']}})[_0xd2eb('0x20')](handleEntityNotFound(_0x4c5eb7,null))[_0xd2eb('0x20')](function(_0x2ea3fe){if(_0x2ea3fe){_0x2151df=_0x2ea3fe;_0x306837[_0xd2eb('0x3d')]=_[_0xd2eb('0x53')](db[_0xd2eb('0x61')][_0xd2eb('0x39')]);_0x306837[_0xd2eb('0x3f')]=_['keys'](_0x425e32[_0xd2eb('0x3f')]);_0x306837[_0xd2eb('0x40')]=_['intersection'](_0x306837[_0xd2eb('0x3d')],_0x306837[_0xd2eb('0x3f')]);_0x48eb34['attributes']=_[_0xd2eb('0x42')](_0x306837[_0xd2eb('0x3d')],qs[_0xd2eb('0x43')](_0x425e32[_0xd2eb('0x3f')]['fields']));_0x48eb34[_0xd2eb('0x41')]=_0x48eb34[_0xd2eb('0x41')][_0xd2eb('0x44')]?_0x48eb34['attributes']:_0x306837[_0xd2eb('0x3d')];_0x48eb34['order']=qs[_0xd2eb('0x47')](_0x425e32['query']['sort']);_0x48eb34['where']=qs['filters'](_[_0xd2eb('0x62')](_0x425e32['query'],_0x306837[_0xd2eb('0x40')]));if(_0x425e32['query'][_0xd2eb('0x48')]){_0x48eb34[_0xd2eb('0x49')]=_['merge'](_0x48eb34[_0xd2eb('0x49')],{'$or':_[_0xd2eb('0x3e')](_0x48eb34[_0xd2eb('0x41')],function(_0xbba508){var _0x4b27cc={};_0x4b27cc[_0xbba508]={'$like':'%'+_0x425e32[_0xd2eb('0x3f')][_0xd2eb('0x48')]+'%'};return _0x4b27cc;})});}_0x48eb34=_['merge']({},_0x48eb34,_0x425e32['options']);return _0x2151df[_0xd2eb('0x5f')](_0x48eb34);}})['then'](function(_0x3034d2){if(_0x3034d2){_0x420ec5=_0x3034d2['length'];if(!_0x425e32[_0xd2eb('0x3f')]['hasOwnProperty']('nolimit')){_0x48eb34[_0xd2eb('0x31')]=qs[_0xd2eb('0x31')](_0x425e32['query'][_0xd2eb('0x31')]);_0x48eb34['offset']=qs[_0xd2eb('0x30')](_0x425e32[_0xd2eb('0x3f')][_0xd2eb('0x30')]);}return _0x2151df[_0xd2eb('0x5f')](_0x48eb34);}})[_0xd2eb('0x20')](function(_0x33ce41){if(_0x33ce41){return _0x33ce41?{'count':_0x420ec5,'rows':_0x33ce41}:null;}})[_0xd2eb('0x20')](respondWithResult(_0x4c5eb7,null))[_0xd2eb('0x2a')](handleError(_0x4c5eb7,null));};exports[_0xd2eb('0x63')]=function(_0x3df54e,_0x446acf,_0x475c57){return db[_0xd2eb('0x38')][_0xd2eb('0x54')]({'where':{'id':_0x3df54e[_0xd2eb('0x52')]['id']}})[_0xd2eb('0x20')](handleEntityNotFound(_0x446acf,null))[_0xd2eb('0x20')](function(_0x5d4963){if(_0x5d4963){return _0x5d4963['removeMembers'](_0x3df54e[_0xd2eb('0x3f')]['ids']);}})[_0xd2eb('0x20')](respondWithStatusCode(_0x446acf,null))['catch'](handleError(_0x446acf,null));};exports[_0xd2eb('0x64')]=function(_0x4c0a96,_0x43c9b6,_0x18d317){if(_0x4c0a96['body']['id']){delete _0x4c0a96[_0xd2eb('0x56')]['id'];}return db[_0xd2eb('0x38')][_0xd2eb('0x54')]({'where':{'id':_0x4c0a96[_0xd2eb('0x52')]['id']}})[_0xd2eb('0x20')](handleEntityNotFound(_0x43c9b6,null))[_0xd2eb('0x20')](function(_0x10882c){if(_0x10882c){_0x4c0a96['body'][_0xd2eb('0x65')]=_0x10882c['id'];return db[_0xd2eb('0x66')][_0xd2eb('0x55')](_0x4c0a96['body']);}})[_0xd2eb('0x20')](respondWithResult(_0x43c9b6,null))[_0xd2eb('0x2a')](handleError(_0x43c9b6,null));};exports[_0xd2eb('0x67')]=function(_0xd93e33,_0x118c29,_0x232c4e){var _0x4108a2={};var _0xf28c6e={};var _0x3cb8d2;var _0xb1e3e0;return db[_0xd2eb('0x38')]['findOne']({'where':{'id':_0xd93e33['params']['id']}})[_0xd2eb('0x20')](handleEntityNotFound(_0x118c29,null))['then'](function(_0x53e6af){if(_0x53e6af){_0x3cb8d2=_0x53e6af;_0xf28c6e[_0xd2eb('0x3d')]=_[_0xd2eb('0x53')](db[_0xd2eb('0x66')][_0xd2eb('0x39')]);_0xf28c6e[_0xd2eb('0x3f')]=_['keys'](_0xd93e33[_0xd2eb('0x3f')]);_0xf28c6e[_0xd2eb('0x40')]=_[_0xd2eb('0x42')](_0xf28c6e[_0xd2eb('0x3d')],_0xf28c6e[_0xd2eb('0x3f')]);_0x4108a2[_0xd2eb('0x41')]=_['intersection'](_0xf28c6e[_0xd2eb('0x3d')],qs[_0xd2eb('0x43')](_0xd93e33[_0xd2eb('0x3f')][_0xd2eb('0x43')]));_0x4108a2[_0xd2eb('0x41')]=_0x4108a2[_0xd2eb('0x41')][_0xd2eb('0x44')]?_0x4108a2[_0xd2eb('0x41')]:_0xf28c6e['model'];_0x4108a2[_0xd2eb('0x46')]=qs[_0xd2eb('0x47')](_0xd93e33['query'][_0xd2eb('0x47')]);_0x4108a2[_0xd2eb('0x49')]=qs[_0xd2eb('0x40')](_[_0xd2eb('0x62')](_0xd93e33[_0xd2eb('0x3f')],_0xf28c6e[_0xd2eb('0x40')]));if(_0xd93e33[_0xd2eb('0x3f')][_0xd2eb('0x48')]){_0x4108a2[_0xd2eb('0x49')]=_['merge'](_0x4108a2['where'],{'$or':_[_0xd2eb('0x3e')](_0x4108a2[_0xd2eb('0x41')],function(_0xb56cc9){var _0x3737fa={};_0x3737fa[_0xb56cc9]={'$like':'%'+_0xd93e33[_0xd2eb('0x3f')][_0xd2eb('0x48')]+'%'};return _0x3737fa;})});}if(_0xd93e33[_0xd2eb('0x3f')]['$gte']){var _0x56c2a9=_0xd93e33['query'][_0xd2eb('0x68')]['split'](',');var _0x504edc={};_0x504edc[_0x56c2a9[0x0]]={'$gte':moment(_0x56c2a9[0x1])['format'](_0xd2eb('0x69'))};_0x4108a2[_0xd2eb('0x49')]=_['merge'](_0x4108a2[_0xd2eb('0x49')],_0x504edc);}_0x4108a2=_[_0xd2eb('0x4b')]({},_0x4108a2,_0xd93e33[_0xd2eb('0x4c')]);return _0x3cb8d2[_0xd2eb('0x67')](_0x4108a2);}})[_0xd2eb('0x20')](function(_0x56495d){if(_0x56495d){_0xb1e3e0=_0x56495d[_0xd2eb('0x44')];if(!_0xd93e33[_0xd2eb('0x3f')][_0xd2eb('0x45')](_0xd2eb('0x6a'))){_0x4108a2[_0xd2eb('0x31')]=qs['limit'](_0xd93e33[_0xd2eb('0x3f')][_0xd2eb('0x31')]);_0x4108a2[_0xd2eb('0x30')]=qs['offset'](_0xd93e33[_0xd2eb('0x3f')][_0xd2eb('0x30')]);}return _0x3cb8d2[_0xd2eb('0x67')](_0x4108a2);}})[_0xd2eb('0x20')](function(_0x4204f3){if(_0x4204f3){return _0x4204f3?{'count':_0xb1e3e0,'rows':_0x4204f3}:null;}})[_0xd2eb('0x20')](respondWithResult(_0x118c29,null))[_0xd2eb('0x2a')](handleError(_0x118c29,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index c9946f2..3f37a4e 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 _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 +var _0xb10b=['hasOwnProperty','hook','events','ChatGroup','setMaxListeners','save','remove','emit'];(function(_0xbc83d,_0x1cb8a3){var _0x591299=function(_0x33cd8c){while(--_0x33cd8c){_0xbc83d['push'](_0xbc83d['shift']());}};_0x591299(++_0x1cb8a3);}(_0xb10b,0x12a));var _0xbb10=function(_0x50e0c5,_0x49351f){_0x50e0c5=_0x50e0c5-0x0;var _0x11d623=_0xb10b[_0x50e0c5];return _0x11d623;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatGroupEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatGroupEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatGroup[_0xbb10('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 c90df6c..af665b8 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 _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 +var _0x4a80=['api','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','chat_groups','lodash','../../config/logger'];(function(_0x40ec05,_0x39ff94){var _0x34dd43=function(_0x29a6de){while(--_0x29a6de){_0x40ec05['push'](_0x40ec05['shift']());}};_0x34dd43(++_0x39ff94);}(_0x4a80,0xbe));var _0x04a8=function(_0x154ecd,_0x152847){_0x154ecd=_0x154ecd-0x0;var _0x3b2edf=_0x4a80[_0x154ecd];return _0x3b2edf;};'use strict';var _=require(_0x04a8('0x0'));var util=require('util');var logger=require(_0x04a8('0x1'))(_0x04a8('0x2'));var moment=require('moment');var BPromise=require(_0x04a8('0x3'));var rp=require(_0x04a8('0x4'));var fs=require('fs');var path=require(_0x04a8('0x5'));var rimraf=require(_0x04a8('0x6'));var config=require(_0x04a8('0x7'));var attributes=require(_0x04a8('0x8'));module[_0x04a8('0x9')]=function(_0x353b43,_0x709eea){return _0x353b43[_0x04a8('0xa')]('ChatGroup',attributes,{'tableName':_0x04a8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index bff3d69..6ecd490 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 _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 +var _0xd509=['debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','ChatGroup,\x20%s,\x20%s'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0xd509,0xf9));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x9d50('0x0'));var moment=require(_0x9d50('0x1'));var BPromise=require(_0x9d50('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d50('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9d50('0x4'))(_0x9d50('0x5'));var config=require(_0x9d50('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9d50('0x7')]['http']({'port':0x232a});config[_0x9d50('0x8')]=_[_0x9d50('0x9')](config['redis'],{'host':_0x9d50('0xa'),'port':0x18eb});var socket=require(_0x9d50('0xb'))(new Redis(config['redis']));require(_0x9d50('0xc'))[_0x9d50('0xd')](socket);function respondWithRpcPromise(_0x1e3527,_0x1279e4,_0x1cf263){return new BPromise(function(_0x550cee,_0x9f47d2){return client['request'](_0x1e3527,_0x1cf263)['then'](function(_0x65256){logger['info'](_0x9d50('0xe'),_0x1279e4,'request\x20sent');logger[_0x9d50('0xf')](_0x9d50('0x10'),_0x1279e4,_0x9d50('0x11'),JSON['stringify'](_0x65256));if(_0x65256[_0x9d50('0x12')]){if(_0x65256[_0x9d50('0x12')][_0x9d50('0x13')]===0x1f4){logger[_0x9d50('0x12')]('ChatGroup,\x20%s,\x20%s',_0x1279e4,_0x65256[_0x9d50('0x12')]['message']);return _0x9f47d2(_0x65256[_0x9d50('0x12')][_0x9d50('0x14')]);}logger[_0x9d50('0x12')](_0x9d50('0xe'),_0x1279e4,_0x65256[_0x9d50('0x12')][_0x9d50('0x14')]);return _0x550cee(_0x65256[_0x9d50('0x12')][_0x9d50('0x14')]);}else{logger[_0x9d50('0x15')](_0x9d50('0xe'),_0x1279e4,_0x9d50('0x11'));_0x550cee(_0x65256[_0x9d50('0x16')][_0x9d50('0x14')]);}})[_0x9d50('0x17')](function(_0x3ce756){logger['error'](_0x9d50('0xe'),_0x1279e4,_0x3ce756);_0x9f47d2(_0x3ce756);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 751abce..601a8f8 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 _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 +var _0xf45c=['remove','update','emit','register','chatGroup:','./chatGroup.events','save'];(function(_0x3fec04,_0x3bc634){var _0x48abe4=function(_0x46ca05){while(--_0x46ca05){_0x3fec04['push'](_0x3fec04['shift']());}};_0x48abe4(++_0x3bc634);}(_0xf45c,0x1e1));var _0xcf45=function(_0xa673ff,_0x4fc5f2){_0xa673ff=_0xa673ff-0x0;var _0x4271f9=_0xf45c[_0xa673ff];return _0x4271f9;};'use strict';var ChatGroupEvents=require(_0xcf45('0x0'));var events=[_0xcf45('0x1'),_0xcf45('0x2'),_0xcf45('0x3')];function createListener(_0x5764f1,_0x5b1a60){return function(_0x5efb21){_0x5b1a60[_0xcf45('0x4')](_0x5764f1,_0x5efb21);};}function removeListener(_0x28b52b,_0x57e4e6){return function(){ChatGroupEvents['removeListener'](_0x28b52b,_0x57e4e6);};}exports[_0xcf45('0x5')]=function(_0x16b014){for(var _0x347667=0x0,_0x6f3ff=events['length'];_0x347667<_0x6f3ff;_0x347667++){var _0x5abac2=events[_0x347667];var _0xe8682c=createListener(_0xcf45('0x6')+_0x5abac2,_0x16b014);ChatGroupEvents['on'](_0x5abac2,_0xe8682c);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 5cc406e..8f8d765 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 _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 +var _0x19c1=['isAuthenticated','describe','get','/:id','show','/:id/unread','/:id/members','getMembers','/:id/messages','post','create','addMembers','put','update','delete','removeMembers','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','index','/describe'];(function(_0x22608c,_0x5575da){var _0x50bfa2=function(_0x514222){while(--_0x514222){_0x22608c['push'](_0x22608c['shift']());}};_0x50bfa2(++_0x5575da);}(_0x19c1,0x7d));var _0x119c=function(_0x1183ae,_0x2e9e0f){_0x1183ae=_0x1183ae-0x0;var _0x45ac44=_0x19c1[_0x1183ae];return _0x45ac44;};'use strict';var multer=require(_0x119c('0x0'));var util=require('util');var path=require(_0x119c('0x1'));var timeout=require(_0x119c('0x2'));var express=require(_0x119c('0x3'));var router=express[_0x119c('0x4')]();var auth=require(_0x119c('0x5'));var interaction=require(_0x119c('0x6'));var config=require('../../config/environment');var controller=require(_0x119c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x119c('0x8')]);router['get'](_0x119c('0x9'),auth[_0x119c('0xa')](),controller[_0x119c('0xb')]);router[_0x119c('0xc')](_0x119c('0xd'),auth['isAuthenticated'](),controller[_0x119c('0xe')]);router[_0x119c('0xc')](_0x119c('0xf'),auth['isAuthenticated'](),controller['getUnread']);router[_0x119c('0xc')](_0x119c('0x10'),auth['isAuthenticated'](),controller[_0x119c('0x11')]);router[_0x119c('0xc')](_0x119c('0x12'),auth[_0x119c('0xa')](),controller['getMessages']);router[_0x119c('0x13')]('/',auth['isAuthenticated'](),controller[_0x119c('0x14')]);router['post']('/:id/members',auth[_0x119c('0xa')](),controller[_0x119c('0x15')]);router['post'](_0x119c('0x12'),auth[_0x119c('0xa')](),controller['addMessage']);router[_0x119c('0x16')](_0x119c('0xd'),auth[_0x119c('0xa')](),controller[_0x119c('0x17')]);router[_0x119c('0x18')](_0x119c('0xd'),auth[_0x119c('0xa')](),controller['destroy']);router[_0x119c('0x18')](_0x119c('0x10'),auth[_0x119c('0xa')](),controller[_0x119c('0x19')]);module[_0x119c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index c7c11a5..16e3fff 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 _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 +var _0x0691=['DATE','sequelize','exports','INTEGER','ENUM','star','thumb','TEXT','STRING','long'];(function(_0x2d092c,_0x1cac44){var _0x4c4061=function(_0x177eb5){while(--_0x177eb5){_0x2d092c['push'](_0x2d092c['shift']());}};_0x4c4061(++_0x1cac44);}(_0x0691,0x97));var _0x1069=function(_0x55c48b,_0x13a9c1){_0x55c48b=_0x55c48b-0x0;var _0x5d36a8=_0x0691[_0x55c48b];return _0x5d36a8;};'use strict';var Sequelize=require(_0x1069('0x0'));module[_0x1069('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1069('0x2')]},'ratingType':{'type':Sequelize[_0x1069('0x3')](_0x1069('0x4'),_0x1069('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x1069('0x6')]},'mailTranscript':{'type':Sequelize[_0x1069('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1069('0x7')]},'secondDisposition':{'type':Sequelize[_0x1069('0x7')]},'thirdDisposition':{'type':Sequelize[_0x1069('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x1069('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x1069('0x7')]},'osVersion':{'type':Sequelize[_0x1069('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x1069('0x7')]},'deviceType':{'type':Sequelize[_0x1069('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x1069('0x7')]},'formData':{'type':Sequelize[_0x1069('0x6')](_0x1069('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x1069('0x9')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x1069('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x1069('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 97da402..20dcfa7 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 _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 +var _0x7b23=['error','message','result','catch','sendStatus','status','count','offset','limit','Content-Range','apply','reject','save','update','end','stack','name','send','Tags','TagIds','split','push','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','select','field','from','u.id','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','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','it.ChatInteractionId\x20=\x20i.id','tools_tags','expr','parseSearch','search','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','isEmpty','forEach','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.id','Sequelize','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','resolve','role','agent','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','groupBy','ChatInteractionId','all','show','params','options','create','destroy','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','filename','mimetype','Attachment','attachmentDownload','json','Unauthorized','attachId','server/files/attachments/','basename','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','User','CmContact','Messages','%s%d','customer','agentIdentifier','website_alias','System','agent_alias','fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','Smtp','service','host','port','secure','auth','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','ids','omit','getMessages','pick','YYYY-MM-DD\x20HH:mm:ss','include','findAll','getMyMessages','secret','includeAgent','alias','includeAll','rows','addTags','setTags','spread','color','chatInteractionTags:save','removeTags','join','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','Account','Owner','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','N.A.','closedAt','browserName','osName','customerIp','customerPort','tail','existsSync','renderFile','toFile','transcript-','.pdf','download','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./chatInteraction.socket','register','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2d73ea,_0x3bdef6){var _0x11310a=function(_0xe7648a){while(--_0xe7648a){_0x2d73ea['push'](_0x2d73ea['shift']());}};_0x11310a(++_0x3bdef6);}(_0x7b23,0x10b));var _0x37b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7b23[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x37b2('0x0'));var emlformat=require(_0x37b2('0x1'));var rimraf=require(_0x37b2('0x2'));var zipdir=require(_0x37b2('0x3'));var jsonpatch=require(_0x37b2('0x4'));var rp=require(_0x37b2('0x5'));var moment=require(_0x37b2('0x6'));var BPromise=require(_0x37b2('0x7'));var Mustache=require(_0x37b2('0x8'));var util=require(_0x37b2('0x9'));var path=require(_0x37b2('0xa'));var sox=require(_0x37b2('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x37b2('0xc'));var squel=require(_0x37b2('0xd'));var crypto=require('crypto');var jsforce=require(_0x37b2('0xe'));var deskjs=require(_0x37b2('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x37b2('0x10'));var qs=require(_0x37b2('0x11'));var as=require(_0x37b2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x37b2('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x37b2('0x14'));var db=require(_0x37b2('0x15'))['db'];config[_0x37b2('0x16')]=_[_0x37b2('0x17')](config[_0x37b2('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x37b2('0x16')]));require(_0x37b2('0x18'))[_0x37b2('0x19')](socket);var jayson=require(_0x37b2('0x1a'));var client=jayson[_0x37b2('0x1b')]['http']({'port':0x232b});var client9004=jayson[_0x37b2('0x1b')][_0x37b2('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x5e91a3,_0x37db1a,_0xacc349,_0x18fd5a){return new BPromise(function(_0x174d25,_0x2df145){var _0x56f604=_0x18fd5a||client;return _0x56f604['request'](_0x5e91a3,_0xacc349)[_0x37b2('0x1d')](function(_0x380c25){logger[_0x37b2('0x1e')](_0x37b2('0x1f'),_0x37db1a,_0x37b2('0x20'));logger[_0x37b2('0x21')](_0x37b2('0x22'),_0x37db1a,_0x37b2('0x20'),JSON[_0x37b2('0x23')](_0x380c25));if(_0x380c25['error']){if(_0x380c25[_0x37b2('0x24')]['code']===0x1f4){logger['error'](_0x37b2('0x1f'),_0x37db1a,_0x380c25[_0x37b2('0x24')][_0x37b2('0x25')]);return _0x2df145(_0x380c25['error'][_0x37b2('0x25')]);}logger['error'](_0x37b2('0x1f'),_0x37db1a,_0x380c25[_0x37b2('0x24')][_0x37b2('0x25')]);return _0x174d25(_0x380c25['error'][_0x37b2('0x25')]);}else{logger[_0x37b2('0x1e')](_0x37b2('0x1f'),_0x37db1a,_0x37b2('0x20'));_0x174d25(_0x380c25[_0x37b2('0x26')][_0x37b2('0x25')]);}})[_0x37b2('0x27')](function(_0x27ec21){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x37db1a,_0x27ec21);_0x2df145(_0x27ec21);});});}function respondWithStatusCode(_0x3783c9,_0x585fba){_0x585fba=_0x585fba||0xcc;return function(_0x425b46){if(_0x425b46){return _0x3783c9[_0x37b2('0x28')](_0x585fba);}return _0x3783c9[_0x37b2('0x29')](_0x585fba)['end']();};}function respondWithResult(_0x492c9e,_0x13765b){_0x13765b=_0x13765b||0xc8;return function(_0x5cd463){if(_0x5cd463){return _0x492c9e[_0x37b2('0x29')](_0x13765b)['json'](_0x5cd463);}};}function respondWithFilteredResult(_0xb5800b,_0x4e3f97){return function(_0x471216){if(_0x471216){var _0x336fec=_0x471216[_0x37b2('0x2a')],_0x15dc37=_0x4e3f97[_0x37b2('0x2b')],_0x53b8c4=_0x4e3f97[_0x37b2('0x2b')]+_0x4e3f97[_0x37b2('0x2c')],_0x3296e2;if(_0x53b8c4>=_0x336fec){_0x53b8c4=_0x336fec;_0x3296e2=0xc8;}else{_0x3296e2=0xce;}_0xb5800b[_0x37b2('0x29')](_0x3296e2);return _0xb5800b['set'](_0x37b2('0x2d'),_0x15dc37+'-'+_0x53b8c4+'/'+_0x336fec)['json'](_0x471216);}return null;};}function patchUpdates(_0x2497bb){return function(_0x28877e){try{jsonpatch[_0x37b2('0x2e')](_0x28877e,_0x2497bb,!![]);}catch(_0x5b0082){return BPromise[_0x37b2('0x2f')](_0x5b0082);}return _0x28877e[_0x37b2('0x30')]();};}function saveUpdates(_0x5b8107,_0x4b7b3d){return function(_0x3c3d2e){if(_0x3c3d2e){return _0x3c3d2e[_0x37b2('0x31')](_0x5b8107)[_0x37b2('0x1d')](function(_0x2916a4){return _0x2916a4;});}return null;};}function removeEntity(_0x5563fd,_0x368fe8){return function(_0x52785d){if(_0x52785d){return _0x52785d['destroy']()[_0x37b2('0x1d')](function(){_0x5563fd[_0x37b2('0x29')](0xcc)[_0x37b2('0x32')]();});}};}function handleEntityNotFound(_0x25c16a,_0x4c33c1){return function(_0x15bd03){if(!_0x15bd03){_0x25c16a[_0x37b2('0x28')](0x194);}return _0x15bd03;};}function handleError(_0x2cfb97,_0x1f3d9a){_0x1f3d9a=_0x1f3d9a||0x1f4;return function(_0x128bbf){logger[_0x37b2('0x24')](_0x128bbf[_0x37b2('0x33')]);if(_0x128bbf[_0x37b2('0x34')]){delete _0x128bbf[_0x37b2('0x34')];}_0x2cfb97[_0x37b2('0x29')](_0x1f3d9a)[_0x37b2('0x35')](_0x128bbf);};}function getInteractionUsers(_0x142612,_0x5dc5d6){return new BPromise(function(_0x3e0259,_0x10cd13){try{if(_0x5dc5d6[_0x142612['id']]){_0x142612['Users']=_['map'](_0x5dc5d6[_0x142612['id']],function(_0x2ad476){return{'id':_0x2ad476['id'],'fullname':_0x2ad476['fullname']};});}}catch(_0x190959){_0x10cd13(_0x190959);}_0x3e0259(_0x142612);});}function getInteractionTags(_0x28eb23,_0x3280a6){return new BPromise(function(_0x585251,_0x361f2b){try{if(_0x28eb23['TagIds']){_0x28eb23[_0x37b2('0x36')]=[];_0x28eb23[_0x37b2('0x37')][_0x37b2('0x38')](',')['forEach'](function(_0x3fbc91){_0x28eb23['Tags'][_0x37b2('0x39')](_0x3280a6[_0x3fbc91]);});}delete _0x28eb23['TagIds'];}catch(_0x7187f3){_0x361f2b(_0x7187f3);}_0x585251(_0x28eb23);});}function updateChatInteraction(_0x5d19f6,_0x9ee973,_0x472004){return new BPromise(function(_0xf0f814,_0x22b16e){return getInteractionUsers(_0x5d19f6,_0x472004)[_0x37b2('0x1d')](function(_0x28f9d7){return getInteractionTags(_0x28f9d7,_0x9ee973);})['then'](function(_0x38bd90){_0xf0f814(_0x38bd90);})[_0x37b2('0x27')](function(_0x5ab6fd){_0x22b16e(_0x5ab6fd);});});}exports[_0x37b2('0x3a')]=function(_0x498d89,_0x35333){var _0xcb08d8={},_0x985929={},_0x56b0a0={'count':0x0,'rows':[]};var _0x419930=_[_0x37b2('0x3b')](db['ChatInteraction'][_0x37b2('0x3c')],function(_0x5bea0c){return{'name':_0x5bea0c[_0x37b2('0x3d')],'type':_0x5bea0c[_0x37b2('0x3e')]['key']};});_0x985929[_0x37b2('0x3f')]=_[_0x37b2('0x3b')](_0x419930,_0x37b2('0x34'));_0x985929[_0x37b2('0x40')]=_['keys'](_0x498d89[_0x37b2('0x40')]);_0x985929[_0x37b2('0x41')]=_[_0x37b2('0x42')](_0x985929['model'],_0x985929[_0x37b2('0x40')]);_0xcb08d8['attributes']=_[_0x37b2('0x42')](_0x985929[_0x37b2('0x3f')],qs[_0x37b2('0x43')](_0x498d89['query']['fields']));_0xcb08d8[_0x37b2('0x44')]=_0xcb08d8[_0x37b2('0x44')][_0x37b2('0x45')]?_0xcb08d8[_0x37b2('0x44')]:_0x985929[_0x37b2('0x3f')];if(!_0x498d89['query'][_0x37b2('0x46')](_0x37b2('0x47'))){_0xcb08d8[_0x37b2('0x2c')]=qs[_0x37b2('0x2c')](_0x498d89[_0x37b2('0x40')][_0x37b2('0x2c')]);_0xcb08d8[_0x37b2('0x2b')]=qs[_0x37b2('0x2b')](_0x498d89[_0x37b2('0x40')][_0x37b2('0x2b')]);}_0xcb08d8[_0x37b2('0x48')]=qs['sort'](_0x498d89['query'][_0x37b2('0x49')]);_0xcb08d8[_0x37b2('0x4a')]=qs[_0x37b2('0x41')](_['pick'](_0x498d89[_0x37b2('0x40')],_0x985929[_0x37b2('0x41')]),_0x419930);var _0x12f9c8=[];var _0xa230d3=squel[_0x37b2('0x4b')]()[_0x37b2('0x4c')]('id')[_0x37b2('0x4c')](_0x37b2('0x34'))[_0x37b2('0x4c')]('color')[_0x37b2('0x4d')]('tools_tags');var _0x5d3cbc=squel['select']()[_0x37b2('0x4c')](_0x37b2('0x4e'))[_0x37b2('0x4c')]('u.fullname')[_0x37b2('0x4c')](_0x37b2('0x4f'))[_0x37b2('0x4d')](_0x37b2('0x50'),'ui')[_0x37b2('0x51')](_0x37b2('0x52'),'u',_0x37b2('0x53'));var _0x5ef49f=squel[_0x37b2('0x4b')]()['from'](_0x37b2('0x54'),'i')['left_join'](_0x37b2('0x55'),'c',_0x37b2('0x56'))[_0x37b2('0x51')](_0x37b2('0x52'),'o',_0x37b2('0x57'))[_0x37b2('0x51')](_0x37b2('0x58'),'a',_0x37b2('0x59'))[_0x37b2('0x51')](_0x37b2('0x5a'),'me',_0x37b2('0x5b'))['left_join']('chat_interaction_has_tags','it',_0x37b2('0x5c'))[_0x37b2('0x51')](_0x37b2('0x5d'),'t','t.id\x20=\x20it.TagId');var _0x2cef7b=squel[_0x37b2('0x5e')]();var _0xe215d6=[];var _0x5cd785=squel[_0x37b2('0x5e')]();var _0x45dccb;if(_0x498d89[_0x37b2('0x40')]['search']){_0x45dccb=as[_0x37b2('0x5f')](_0x498d89[_0x37b2('0x40')][_0x37b2('0x60')]);var _0x5a5386=_0x45dccb[_0x37b2('0x61')];for(var _0x52098b=0x0;_0x52098b<_0x45dccb[_0x37b2('0x62')][_0x37b2('0x45')];_0x52098b++){var _0x1ff746=_0x45dccb[_0x37b2('0x62')][_0x52098b];var _0x3b2deb='i';var _0x4e91ed=_['find'](_0x419930,['name',_0x1ff746[_0x37b2('0x4c')]]);if(!_0x4e91ed){switch(_0x1ff746['field']){case _0x37b2('0x63'):if(_0x1ff746[_0x37b2('0x64')]==0x1){_0x5ef49f[_0x37b2('0x65')]('`'+_0x1ff746['field']+'`\x20=\x200');}else{_0x5ef49f[_0x37b2('0x65')]('`'+_0x1ff746[_0x37b2('0x4c')]+_0x37b2('0x66'));}break;case'Contact':if(_0x1ff746[_0x37b2('0x67')]===_0x37b2('0x68')){if(_0x1ff746['value'][_0x37b2('0x38')]('\x20')[_0x37b2('0x45')]>0x1){_0x2cef7b[_0x5a5386](_0x37b2('0x69'),qs['getFullTextValue'](_0x1ff746[_0x37b2('0x64')]),null);}else{var _0x5c95ea='%'+_0x1ff746[_0x37b2('0x64')]+'%';_0x2cef7b[_0x5a5386](_0x37b2('0x6a'),_0x5c95ea,_0x5c95ea,_0x5c95ea);}}else{_0x4e91ed=_[_0x37b2('0x6b')](_0x419930,[_0x37b2('0x34'),_0x37b2('0x6c')]);_0x1ff746[_0x37b2('0x4c')]='ContactId';_0x2aabf7=as[_0x37b2('0x6d')](_0x3b2deb,_0x4e91ed['type'],_0x1ff746);_0x2cef7b[_0x5a5386](_0x2aabf7[_0x37b2('0x6e')],_0x2aabf7['value'][_0x37b2('0x6f')],_0x2aabf7[_0x37b2('0x64')][_0x37b2('0x32')]);}break;case _0x37b2('0x70'):var _0x42c6f1=_0x1ff746[_0x37b2('0x64')][_0x37b2('0x38')](',')[_0x37b2('0x3b')](function(_0x47c5a7){return Number(_0x47c5a7);});_0x42c6f1['forEach'](function(_0xdd032c){_0x5cd785['or'](_0x37b2('0x71'),'%,'+_0xdd032c+',%');});_0xe215d6=_[_0x37b2('0x72')](_0xe215d6,_0x42c6f1);break;case'User':if(_0x1ff746[_0x37b2('0x67')]===_0x37b2('0x68')){_0x2cef7b[_0x5a5386](_0x37b2('0x73'),'%'+_0x1ff746[_0x37b2('0x64')]+'%',null);}else{_0x4e91ed=_['find'](_0x419930,[_0x37b2('0x34'),'UserId']);_0x1ff746[_0x37b2('0x4c')]=_0x37b2('0x74');_0x2aabf7=as[_0x37b2('0x6d')](_0x3b2deb,_0x4e91ed['type'],_0x1ff746);_0x2cef7b[_0x5a5386](_0x2aabf7[_0x37b2('0x6e')],_0x2aabf7[_0x37b2('0x64')][_0x37b2('0x6f')],_0x2aabf7[_0x37b2('0x64')][_0x37b2('0x32')]);}break;case _0x37b2('0x75'):_0x2aabf7=as[_0x37b2('0x6d')]('me',null,_0x1ff746);_0x2cef7b[_0x5a5386](_0x2aabf7['text'],_0x2aabf7[_0x37b2('0x64')][_0x37b2('0x6f')],_0x2aabf7[_0x37b2('0x64')]['end']);break;}}else{var _0x2aabf7=as[_0x37b2('0x6d')](_0x3b2deb,_0x4e91ed['type'],_0x1ff746);_0x2cef7b[_0x5a5386](_0x2aabf7[_0x37b2('0x6e')],_0x2aabf7[_0x37b2('0x64')][_0x37b2('0x6f')],_0x2aabf7[_0x37b2('0x64')][_0x37b2('0x32')]);}}}else{var _0x232c63=_(_0x498d89[_0x37b2('0x40')])[_0x37b2('0x76')]()[_0x37b2('0x3b')](function(_0x2fd8ab){return _[_0x37b2('0x77')](_0x419930,[_0x37b2('0x34'),_0x2fd8ab])?_0x2fd8ab:undefined;})['compact']()[_0x37b2('0x64')]();if(!_[_0x37b2('0x78')](_0x232c63)){_0x232c63[_0x37b2('0x79')](function(_0x15ab03){if(_0x15ab03===_0x37b2('0x7a')){_0x5ef49f[_0x37b2('0x4a')](_0x37b2('0x7b'),[][_0x37b2('0x7c')](_0x498d89[_0x37b2('0x40')][_0x15ab03]));}else if(_0x15ab03===_0x37b2('0x7d')){var _0x416c87=JSON['parse'](_0x498d89[_0x37b2('0x40')][_0x15ab03])[_0x37b2('0x7e')];var _0x3fbf47=JSON[_0x37b2('0x7f')](_0x498d89['query'][_0x15ab03])[_0x37b2('0x80')];_0x5ef49f[_0x37b2('0x4a')](_0x37b2('0x81'),_0x416c87,_0x3fbf47);}else{if(_0x498d89[_0x37b2('0x40')][_0x15ab03]===_0x37b2('0x82')){_0x5ef49f[_0x37b2('0x4a')]('i.'+_0x15ab03+_0x37b2('0x83'));}else{_0x5ef49f['where']('i.'+_0x15ab03+'\x20=\x20?',_0x498d89[_0x37b2('0x40')][_0x15ab03]);}}});}if(_0x498d89[_0x37b2('0x40')][_0x37b2('0x84')]){if(_0x498d89[_0x37b2('0x40')][_0x37b2('0x84')]==0x1){_0x5ef49f['having'](_0x37b2('0x85'));}else{_0x5ef49f[_0x37b2('0x65')](_0x37b2('0x86'));}}if(_0x498d89[_0x37b2('0x40')][_0x37b2('0x87')]){_0xe215d6=_['isArray'](_0x498d89[_0x37b2('0x40')][_0x37b2('0x87')])?_0x498d89[_0x37b2('0x40')][_0x37b2('0x87')]:new Array(_0x498d89[_0x37b2('0x40')][_0x37b2('0x87')]);_0xe215d6[_0x37b2('0x79')](function(_0x1e3262){_0x5cd785['or'](_0x37b2('0x71'),'%,'+_0x1e3262+',%');});}if(_0x498d89[_0x37b2('0x40')][_0x37b2('0x88')]){var _0x3be479=_0x498d89['query'][_0x37b2('0x88')][_0x37b2('0x89')]('\x5c','\x5c\x5c')[_0x37b2('0x89')](/'/g,'\x27\x27');if(qs[_0x37b2('0x8a')](_0x3be479)){_0x2cef7b['or']('i.id\x20LIKE\x20?',_0x3be479+'%');}else{_0x2cef7b['or'](_0x37b2('0x8b'),qs[_0x37b2('0x8c')](_0x3be479))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3be479+'%');}}}_0x5ef49f[_0x37b2('0x4a')](_0x2cef7b);_0x5ef49f['group'](_0x37b2('0x8d'));var _0x4c8a68={'type':db[_0x37b2('0x8e')]['QueryTypes'][_0x37b2('0x8f')],'raw':!![]};var _0x30dcb0=_0x5ef49f[_0x37b2('0x90')]();_0x30dcb0[_0x37b2('0x4c')](_0x37b2('0x8d'));_0x30dcb0[_0x37b2('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x37b2('0x63'));if(_0xcb08d8[_0x37b2('0x48')]){_0xcb08d8[_0x37b2('0x48')][_0x37b2('0x79')](function(_0x372e60){var _0x5bb600=_0x372e60[0x0]===_0x37b2('0x91')?_0x372e60[0x0]:'i.'+_0x372e60[0x0];_0x5ef49f[_0x37b2('0x48')](_0x5bb600,_0x372e60[0x1]===_0x37b2('0x92')?![]:!![]);});}if(!_[_0x37b2('0x78')](_0xe215d6)){_0x5ef49f[_0x37b2('0x65')](_0x5cd785);_0x30dcb0['where'](_0x37b2('0x93'),_0xe215d6);}BPromise[_0x37b2('0x94')]()[_0x37b2('0x1d')](function(){if(!_0x45dccb){if(_0x498d89[_0x37b2('0x40')][_0x37b2('0x7a')])return;_0x30dcb0[_0x37b2('0x4a')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x5ef49f[_0x37b2('0x4a')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x498d89['user'][_0x37b2('0x95')]!==_0x37b2('0x96'))return;return _0x498d89[_0x37b2('0x97')][_0x37b2('0x98')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1dfc1){if(_[_0x37b2('0x78')](_0x1dfc1)){_0x30dcb0[_0x37b2('0x4a')]('i.ChatWebsiteId\x20IS\x20NULL');_0x5ef49f[_0x37b2('0x4a')](_0x37b2('0x99'));}else{_0x30dcb0['where'](_0x37b2('0x7b'),_[_0x37b2('0x3b')](_0x1dfc1,'id'));_0x5ef49f[_0x37b2('0x4a')](_0x37b2('0x7b'),_[_0x37b2('0x3b')](_0x1dfc1,'id'));}});})['then'](function(){if(_0x498d89['user'][_0x37b2('0x95')]===_0x37b2('0x96')&&!_0x45dccb&&!_0x498d89[_0x37b2('0x40')][_0x37b2('0x7a')])return[];return db[_0x37b2('0x9a')][_0x37b2('0x40')](_0x30dcb0['toString'](),_0x4c8a68);})[_0x37b2('0x1d')](function(_0x20d2bf){_0x56b0a0['count']=_0x20d2bf[_0x37b2('0x45')];if(_0x56b0a0[_0x37b2('0x2a')]===0x0)return[];return db[_0x37b2('0x9a')]['query'](_0xa230d3[_0x37b2('0x9b')](),_0x4c8a68)[_0x37b2('0x1d')](function(_0x267b9c){_0x12f9c8=_[_0x37b2('0x9c')](_0x267b9c,'id');_0x4c8a68=_[_0x37b2('0x9d')](_0x4c8a68,{'model':db[_0x37b2('0x9e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x498d89[_0x37b2('0x40')]['fields']){_0xcb08d8[_0x37b2('0x44')]['forEach'](function(_0x4abbbf){_0x5ef49f[_0x37b2('0x4c')]('i.'+_0x4abbbf);});}else{_0x5ef49f[_0x37b2('0x4c')](_0x37b2('0x9f'),_0x37b2('0x63'));_0x5ef49f[_0x37b2('0x4c')]('a.key','Account.key');_0x5ef49f[_0x37b2('0x4c')](_0x37b2('0xa0'),_0x37b2('0xa1'));_0x5ef49f[_0x37b2('0x4c')](_0x37b2('0xa2'),_0x37b2('0x91'));_0x5ef49f[_0x37b2('0x4c')]('i.*');_0x5ef49f[_0x37b2('0x4c')](_0x37b2('0xa3'),_0x37b2('0xa4'));_0x5ef49f[_0x37b2('0x4c')](_0x37b2('0xa5'),'Contact.lastName');_0x5ef49f[_0x37b2('0x4c')](_0x37b2('0xa6'),_0x37b2('0xa7'));_0x5ef49f[_0x37b2('0x4c')]('c.phone',_0x37b2('0xa8'));_0x5ef49f[_0x37b2('0x4c')](_0x37b2('0xa9'),_0x37b2('0xaa'));_0x5ef49f[_0x37b2('0x4c')](_0x37b2('0xab'),_0x37b2('0xac'));_0x5ef49f[_0x37b2('0x4c')](_0x37b2('0xad'),_0x37b2('0xae'));_0x5ef49f[_0x37b2('0x4c')](_0x37b2('0xaf'),_0x37b2('0xb0'));_0x5ef49f[_0x37b2('0x4c')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x37b2('0x37'));}if(_0xcb08d8[_0x37b2('0x2c')])_0x5ef49f[_0x37b2('0x2c')](_0xcb08d8[_0x37b2('0x2c')]);if(_0xcb08d8[_0x37b2('0x2b')])_0x5ef49f['offset'](_0xcb08d8[_0x37b2('0x2b')]);return db[_0x37b2('0x9a')]['query'](_0x5ef49f[_0x37b2('0x9b')](),_0x4c8a68);})[_0x37b2('0x1d')](function(_0x59ed4f){_0x5d3cbc[_0x37b2('0x4a')]('ui.ChatInteractionId\x20IN\x20?',_['map'](_0x59ed4f,'id'));return db[_0x37b2('0x9a')][_0x37b2('0x40')](_0x5d3cbc[_0x37b2('0x9b')](),_0x4c8a68)[_0x37b2('0x1d')](function(_0x416707){var _0x5c9da2=_[_0x37b2('0xb1')](_0x416707,_0x37b2('0xb2'));var _0x5d70f5=[];_0x59ed4f[_0x37b2('0x79')](function(_0x5666be){_0x5d70f5['push'](updateChatInteraction(_0x5666be,_0x12f9c8,_0x5c9da2));});return BPromise[_0x37b2('0xb3')](_0x5d70f5);});});})['then'](function(_0x3b7225){_0x56b0a0['rows']=_0x3b7225;return _0x56b0a0;})[_0x37b2('0x1d')](respondWithFilteredResult(_0x35333,_0xcb08d8))[_0x37b2('0x27')](handleError(_0x35333,null));};exports[_0x37b2('0xb4')]=function(_0x58799f,_0x21c145){var _0x39d4e9={'raw':![],'where':{'id':_0x58799f[_0x37b2('0xb5')]['id']}},_0x5c073a={};_0x5c073a[_0x37b2('0x3f')]=_[_0x37b2('0x76')](db[_0x37b2('0x9e')]['rawAttributes']);_0x5c073a[_0x37b2('0x40')]=_['keys'](_0x58799f[_0x37b2('0x40')]);_0x5c073a[_0x37b2('0x41')]=_[_0x37b2('0x42')](_0x5c073a[_0x37b2('0x3f')],_0x5c073a[_0x37b2('0x40')]);_0x39d4e9[_0x37b2('0x44')]=_[_0x37b2('0x42')](_0x5c073a[_0x37b2('0x3f')],qs[_0x37b2('0x43')](_0x58799f[_0x37b2('0x40')]['fields']));_0x39d4e9['attributes']=_0x39d4e9[_0x37b2('0x44')][_0x37b2('0x45')]?_0x39d4e9[_0x37b2('0x44')]:_0x5c073a[_0x37b2('0x3f')];if(_0x58799f[_0x37b2('0x40')]['includeAll']){_0x39d4e9['include']=[{'all':!![]}];}_0x39d4e9=_[_0x37b2('0x9d')]({},_0x39d4e9,_0x58799f[_0x37b2('0xb6')]);return db[_0x37b2('0x9e')]['find'](_0x39d4e9)[_0x37b2('0x1d')](handleEntityNotFound(_0x21c145,null))[_0x37b2('0x1d')](respondWithResult(_0x21c145,null))[_0x37b2('0x27')](handleError(_0x21c145,null));};exports[_0x37b2('0xb7')]=function(_0x2510fd,_0x514d89){return db[_0x37b2('0x9e')]['create'](_0x2510fd[_0x37b2('0x75')],{})[_0x37b2('0x1d')](respondWithResult(_0x514d89,0xc9))[_0x37b2('0x27')](handleError(_0x514d89,null));};exports[_0x37b2('0x31')]=function(_0x233114,_0x2c090b){if(_0x233114['body']['id']){delete _0x233114[_0x37b2('0x75')]['id'];}return db[_0x37b2('0x9e')]['find']({'where':{'id':_0x233114[_0x37b2('0xb5')]['id']}})[_0x37b2('0x1d')](handleEntityNotFound(_0x2c090b,null))[_0x37b2('0x1d')](saveUpdates(_0x233114['body'],null))[_0x37b2('0x1d')](respondWithResult(_0x2c090b,null))[_0x37b2('0x27')](handleError(_0x2c090b,null));};exports[_0x37b2('0xb8')]=function(_0x125bb8,_0x5163ee){return db[_0x37b2('0x9e')][_0x37b2('0x6b')]({'where':{'id':_0x125bb8[_0x37b2('0xb5')]['id']}})[_0x37b2('0x1d')](handleEntityNotFound(_0x5163ee,null))[_0x37b2('0x1d')](removeEntity(_0x5163ee,null))['catch'](handleError(_0x5163ee,null));};exports[_0x37b2('0xb9')]=function(_0x164f39,_0x3f1830){return db[_0x37b2('0x9e')][_0x37b2('0xb9')]()[_0x37b2('0x1d')](respondWithResult(_0x3f1830,null))[_0x37b2('0x27')](handleError(_0x3f1830,null));};exports['createVidaooSession']=function(_0x53b960,_0x59bfc3){var _0x4677f9=_0x53b960[_0x37b2('0xb5')]['id'];var _0x35f2e8;var _0x5c05f5;var _0x28cfb8;return db[_0x37b2('0x9e')][_0x37b2('0xba')]({'where':{'id':_0x4677f9}})['then'](function(_0x382474){_0x35f2e8=_0x382474;return db[_0x37b2('0xbb')][_0x37b2('0xba')]({'where':{'id':_0x382474[_0x37b2('0x7a')]},'attributes':['id',_0x37b2('0xbc'),_0x37b2('0xbd')],'raw':!![]});})['then'](function(_0x4464a1){if(_0x4464a1&&_0x4464a1[_0x37b2('0xbc')]&&_0x4464a1[_0x37b2('0xbd')]){_0x5c05f5=_0x4464a1;var _0x5893ad={'rejectUnauthorized':![],'method':_0x37b2('0xbe'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x4464a1[_0x37b2('0xbc')]},'body':{'name':_0x37b2('0xbf')+_0x4677f9},'redirect':_0x37b2('0xc0'),'json':!![]};return rp(_0x5893ad);}else{throw new db[(_0x37b2('0x8e'))][(_0x37b2('0xc1'))](_0x37b2('0xc2'));}})[_0x37b2('0x1d')](function(_0x3d8908){_0x28cfb8=_0x3d8908;if(_0x28cfb8['id']){var _0x486e2a={'body':_0x28cfb8[_0x37b2('0xc3')],'ChatWebsiteId':_0x5c05f5['id'],'ChatInteractionId':_0x35f2e8['id'],'direction':_0x37b2('0xc4'),'UserId':_0x53b960[_0x37b2('0x97')]['id']};return db['ChatMessage'][_0x37b2('0xb7')](_0x486e2a,{});}else{throw new db[(_0x37b2('0x8e'))][(_0x37b2('0xc1'))](_0x37b2('0xc5'));}})[_0x37b2('0x1d')](function(){return _0x35f2e8[_0x37b2('0xc6')]({'vidaooSessionId':_0x28cfb8['id']});})['then'](respondWithResult(_0x59bfc3,null))['catch'](handleError(_0x59bfc3,null));};exports[_0x37b2('0xc7')]=function(_0x2b3094,_0x5e8ab4){if(_0x2b3094[_0x37b2('0x75')]['id']){delete _0x2b3094[_0x37b2('0x75')]['id'];}return db[_0x37b2('0x9e')][_0x37b2('0x6b')]({'where':{'id':_0x2b3094[_0x37b2('0xb5')]['id']}})[_0x37b2('0x1d')](handleEntityNotFound(_0x5e8ab4,null))[_0x37b2('0x1d')](saveUpdates(_0x2b3094[_0x37b2('0x75')],null))[_0x37b2('0x1d')](respondWithResult(_0x5e8ab4,null))[_0x37b2('0x27')](handleError(_0x5e8ab4,null));};exports[_0x37b2('0xc8')]=function(_0x384253,_0x19fc21,_0x224e6d){if(_0x384253[_0x37b2('0x75')]['id']){delete _0x384253['body']['id'];}return db['ChatInteraction'][_0x37b2('0x6b')]({'where':{'id':_0x384253[_0x37b2('0xb5')]['id']}})['then'](function(_0x1da6fe){if(!_0x1da6fe){logger[_0x37b2('0x24')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x37b2('0xc8'),0x194,'entity\x20not\x20found');_0x19fc21[_0x37b2('0x28')](0x194);}else{if(_0x1da6fe[_0x37b2('0x74')]){throw new db[(_0x37b2('0x8e'))][(_0x37b2('0xc1'))](_0x37b2('0xc9'));}}return _0x1da6fe;})['then'](function(_0x5aa720){if(_0x5aa720){return _0x5aa720['update']({'closed':_0x384253['body'][_0x37b2('0xca')],'disposition':_0x384253[_0x37b2('0x75')][_0x37b2('0xcb')]})[_0x37b2('0x1d')](function(_0x50f84a){return _0x50f84a;});}})['then'](function(_0xc2da67){return respondWithRpcPromise(_0x37b2('0xcc'),_0x37b2('0xc8'),_0x384253[_0x37b2('0x75')],client9004);})[_0x37b2('0x1d')](respondWithResult(_0x19fc21,null))[_0x37b2('0x27')](handleError(_0x19fc21,null));};exports[_0x37b2('0xcd')]=function(_0xd8d644,_0x30f780,_0x30795d){_0xd8d644[_0x37b2('0x75')][_0x37b2('0x34')]=_0xd8d644[_0x37b2('0xce')]['originalname'];_0xd8d644['body']['basename']=_0xd8d644[_0x37b2('0xce')][_0x37b2('0xcf')];_0xd8d644[_0x37b2('0x75')][_0x37b2('0x3e')]=_0xd8d644[_0x37b2('0xce')][_0x37b2('0xd0')];return db[_0x37b2('0xd1')][_0x37b2('0xb7')](_0xd8d644[_0x37b2('0x75')])[_0x37b2('0x1d')](respondWithResult(_0x30f780,0xc9))[_0x37b2('0x27')](handleError(_0x30f780,null));};exports[_0x37b2('0xd2')]=function(_0xd2ad7d,_0x2475f1,_0x2edacc){return db[_0x37b2('0x9e')]['findOne']({'where':{'id':_0xd2ad7d[_0x37b2('0xb5')]['id']},'raw':!![]})[_0x37b2('0x1d')](handleEntityNotFound(_0x2475f1,null))[_0x37b2('0x1d')](function(_0x17eb2e){if(_0x17eb2e){if(_0x17eb2e[_0x37b2('0xca')]){return _0x2475f1['status'](0x193)[_0x37b2('0xd3')]({'status':0x193,'message':_0x37b2('0xd4')});}return db[_0x37b2('0xd1')][_0x37b2('0xba')]({'where':{'id':_0xd2ad7d[_0x37b2('0x40')][_0x37b2('0xd5')]},'raw':!![]})[_0x37b2('0x1d')](handleEntityNotFound(_0x2475f1,null));}})[_0x37b2('0x1d')](function(_0x518f15){if(_0x518f15){return _0x2475f1['download'](path['join'](config['root'],_0x37b2('0xd6'),_0x518f15[_0x37b2('0xd7')]));}})['catch'](handleError(_0x2475f1,null));};exports[_0x37b2('0xd8')]=function(_0xe977bb,_0x3f2b12){var _0x46625f=null;var _0x1a9fd6=null;var _0x1adff5=null;var _0x34371b=null;if(_0xe977bb[_0x37b2('0x75')]['id']){delete _0xe977bb[_0x37b2('0x75')]['id'];}if(_0xe977bb[_0x37b2('0x75')][_0x37b2('0xd9')]){_0x34371b=path['join'](config[_0x37b2('0xda')],_0x37b2('0xdb'),util[_0x37b2('0xdc')](_0x37b2('0xdd'),Date[_0x37b2('0xde')]()));_0xe977bb[_0x37b2('0x75')][_0x37b2('0xdf')]=_0x34371b;}return db[_0x37b2('0x9e')][_0x37b2('0x6b')]({'where':{'id':_0xe977bb[_0x37b2('0xb5')]['id']},'include':[{'model':db[_0x37b2('0xe0')],'as':'Messages','include':[{'model':db['User'],'as':_0x37b2('0xe1')}]}]})[_0x37b2('0x1d')](handleEntityNotFound(_0x3f2b12,null))[_0x37b2('0x1d')](saveUpdates(_0xe977bb['body'],null))[_0x37b2('0x1d')](function(_0x1a6f19){if(_0x1a6f19){_0x46625f=_0x1a6f19;return db[_0x37b2('0xbb')][_0x37b2('0x6b')]({'where':{'id':_0x46625f[_0x37b2('0x7a')]}});}})[_0x37b2('0x1d')](function(_0x5a194d){if(_0x5a194d){_0x1adff5=_0x5a194d;return db[_0x37b2('0xe2')][_0x37b2('0x6b')]({'where':{'id':_0x46625f[_0x37b2('0x6c')]}});}})['then'](function(_0x38ef17){if(_0x38ef17){_0x1a9fd6=_0x38ef17;if(_0x34371b){var _0x44ac7a=null;for(var _0xf5dbd4=0x1;_0xf5dbd4<_0x46625f[_0x37b2('0xe3')]['length'];++_0xf5dbd4){_0x44ac7a=_0x46625f['Messages'][_0xf5dbd4];var _0x597759=_0x44ac7a['UserId']?util[_0x37b2('0xdc')](_0x37b2('0xe4'),_0x1adff5['agentAlias'],_0x44ac7a[_0x37b2('0x74')]):'System';var _0x150e68=_0xe977bb[_0x37b2('0x75')][_0x37b2('0xe5')]||util[_0x37b2('0xdc')](_0x37b2('0xe4'),'Visitor',_0x44ac7a['ContactId']);switch(_0x1adff5[_0x37b2('0xe6')]){case _0x37b2('0xe7'):_0x597759=_0x44ac7a['UserId']?util[_0x37b2('0xdc')](_0x37b2('0xe4'),_0x1adff5['agentAlias'],_0x44ac7a['UserId']):_0x37b2('0xe8');break;case _0x37b2('0xe9'):_0x597759=_0x44ac7a[_0x37b2('0x74')]?_0x44ac7a[_0x37b2('0xe1')]['alias']||_0x44ac7a[_0x37b2('0xe1')][_0x37b2('0xea')]:_0x37b2('0xe8');break;case'agent_fullname':_0x597759=_0x44ac7a['UserId']?_0x44ac7a['User']['fullname']:_0x37b2('0xe8');break;default:_0x597759=_0x44ac7a[_0x37b2('0x74')]?util[_0x37b2('0xdc')](_0x37b2('0xe4'),_0x1adff5['agentAlias'],_0x44ac7a['UserId']):'System';}var _0x31c5ec=util['format'](_0x37b2('0xeb'),moment(_0x44ac7a[_0x37b2('0x7d')])[_0x37b2('0xdc')](_0x37b2('0xec')),_0x44ac7a[_0x37b2('0xed')]==='in'?_0x150e68:_0x597759,_0x44ac7a[_0x37b2('0x75')]);if(!_0x44ac7a['secret']){fs[_0x37b2('0xee')](_0x34371b,_0x31c5ec);}}return db[_0x37b2('0xef')][_0x37b2('0xba')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}}})[_0x37b2('0x1d')](function(_0x1fae30){if(_0x1fae30&&_0x1fae30[_0x37b2('0xf0')]&&_0xe977bb[_0x37b2('0x75')]){var _0x11ea25={'tls':{'rejectUnauthorized':![]}};if(_0x1fae30[_0x37b2('0xf0')][_0x37b2('0xf1')]){_0x11ea25[_0x37b2('0xf1')]=_0x1fae30[_0x37b2('0xf0')][_0x37b2('0xf1')];}else{_0x11ea25[_0x37b2('0xf2')]=_0x1fae30['Smtp'][_0x37b2('0xf2')];_0x11ea25['port']=_0x1fae30[_0x37b2('0xf0')][_0x37b2('0xf3')];_0x11ea25[_0x37b2('0xf4')]=_0x1fae30[_0x37b2('0xf0')][_0x37b2('0xf4')];}if(_0x1fae30['Smtp']['authentication']){_0x11ea25[_0x37b2('0xf5')]={'user':_0x1fae30[_0x37b2('0xf0')][_0x37b2('0x97')],'pass':_0x1fae30[_0x37b2('0xf0')]['pass']};}return respondWithRpcPromise('SendMail',_0x37b2('0xf6'),{'account':_0x11ea25,'message':{'from':util[_0x37b2('0xdc')](_0x37b2('0xf7'),_0x1fae30[_0x37b2('0x34')],_0x1fae30[_0x37b2('0xf8')]||_0x1fae30[_0x37b2('0xf0')][_0x37b2('0x97')]),'to':_0xe977bb[_0x37b2('0x75')]['mailTranscript'],'subject':_0x37b2('0xf9'),'text':util[_0x37b2('0xdc')](_0x37b2('0xfa'),_0xe977bb['body'][_0x37b2('0xd9')]),'attachments':[{'path':_0x34371b}]}})[_0x37b2('0x1d')](function(){return _0x46625f;})[_0x37b2('0x27')](function(_0x38dbf1){console['error'](_0x38dbf1);});}else{return _0x46625f;}})[_0x37b2('0x1d')](respondWithStatusCode(_0x3f2b12,0xc8))[_0x37b2('0x27')](handleError(_0x3f2b12,null));};exports['addMessage']=function(_0x37916f,_0x179689,_0x751edd){return db['ChatMessage']['find']({'where':{'id':_0x37916f['params']['id']}})[_0x37b2('0x1d')](handleEntityNotFound(_0x179689,null))[_0x37b2('0x1d')](function(_0x1460f9){if(_0x1460f9){return _0x1460f9['addMessage'](_0x37916f['body'][_0x37b2('0xfb')],_[_0x37b2('0xfc')](_0x37916f[_0x37b2('0x75')],['ids','id'])||{});}})[_0x37b2('0x1d')](respondWithResult(_0x179689,null))[_0x37b2('0x27')](handleError(_0x179689,null));};exports[_0x37b2('0xfd')]=function(_0x39a3b2,_0x27ded4,_0x5de598){var _0x1b7484={'raw':![],'where':{}};var _0x33ae57={};var _0x244360={'count':0x0,'rows':[]};return db[_0x37b2('0x9e')][_0x37b2('0xba')]({'where':{'id':_0x39a3b2[_0x37b2('0xb5')]['id']}})[_0x37b2('0x1d')](handleEntityNotFound(_0x27ded4,null))[_0x37b2('0x1d')](function(_0x2d301d){if(_0x2d301d){_0x33ae57[_0x37b2('0x3f')]=_[_0x37b2('0x76')](db[_0x37b2('0xe0')][_0x37b2('0x3c')]);_0x33ae57[_0x37b2('0x40')]=_[_0x37b2('0x76')](_0x39a3b2[_0x37b2('0x40')]);_0x33ae57[_0x37b2('0x41')]=_[_0x37b2('0x42')](_0x33ae57[_0x37b2('0x3f')],_0x33ae57['query']);_0x1b7484['attributes']=_[_0x37b2('0x42')](_0x33ae57[_0x37b2('0x3f')],qs['fields'](_0x39a3b2[_0x37b2('0x40')][_0x37b2('0x43')]));_0x1b7484[_0x37b2('0x44')]=_0x1b7484[_0x37b2('0x44')]['length']?_0x1b7484[_0x37b2('0x44')]:_0x33ae57[_0x37b2('0x3f')];if(!_0x39a3b2['query'][_0x37b2('0x46')](_0x37b2('0x47'))){_0x1b7484[_0x37b2('0x2c')]=qs['limit'](_0x39a3b2[_0x37b2('0x40')]['limit']);_0x1b7484[_0x37b2('0x2b')]=qs[_0x37b2('0x2b')](_0x39a3b2['query'][_0x37b2('0x2b')]);}_0x1b7484[_0x37b2('0x48')]=qs[_0x37b2('0x49')](_0x39a3b2[_0x37b2('0x40')][_0x37b2('0x49')]);_0x1b7484[_0x37b2('0x4a')]=qs[_0x37b2('0x41')](_[_0x37b2('0xfe')](_0x39a3b2[_0x37b2('0x40')],_0x33ae57[_0x37b2('0x41')]));_0x1b7484[_0x37b2('0x4a')]['ChatInteractionId']=_0x2d301d['id'];if(_0x39a3b2[_0x37b2('0x40')][_0x37b2('0x88')]){_0x1b7484[_0x37b2('0x4a')]=_[_0x37b2('0x9d')](_0x1b7484[_0x37b2('0x4a')],{'$or':_[_0x37b2('0x3b')](_0x1b7484[_0x37b2('0x44')],function(_0x45a267){var _0x5629f4={};_0x5629f4[_0x45a267]={'$like':'%'+_0x39a3b2[_0x37b2('0x40')][_0x37b2('0x88')]+'%'};return _0x5629f4;})});}if(_0x39a3b2[_0x37b2('0x40')]['$gte']){var _0xc9bfd7=_0x39a3b2[_0x37b2('0x40')][_0x37b2('0x7e')][_0x37b2('0x38')](',');var _0x4a0bf8={};_0x4a0bf8[_0xc9bfd7[0x0]]={'$gte':moment(_0xc9bfd7[0x1])['format'](_0x37b2('0xff'))};_0x1b7484[_0x37b2('0x4a')]=_[_0x37b2('0x9d')](_0x1b7484[_0x37b2('0x4a')],_0x4a0bf8);}_0x1b7484=_[_0x37b2('0x9d')]({},_0x1b7484,_0x39a3b2[_0x37b2('0xb6')]);return db['ChatMessage'][_0x37b2('0x2a')]({'where':_0x1b7484[_0x37b2('0x4a')]})['then'](function(_0x48da82){_0x244360[_0x37b2('0x2a')]=_0x48da82;if(_0x39a3b2[_0x37b2('0x40')]['includeAll']){_0x1b7484[_0x37b2('0x100')]=[{'all':!![]}];}return db[_0x37b2('0xe0')][_0x37b2('0x101')](_0x1b7484);})[_0x37b2('0x1d')](function(_0x3f0fd7){_0x244360['rows']=_0x3f0fd7;return _0x244360;});}})[_0x37b2('0x1d')](respondWithFilteredResult(_0x27ded4,_0x1b7484))[_0x37b2('0x27')](handleError(_0x27ded4,null));};exports[_0x37b2('0x102')]=function(_0x36f3e,_0x496b92,_0xb1b5ba){var _0x19597b={'where':{}},_0x4f475c={},_0x23c4f1={'count':0x0,'rows':[]};return db[_0x37b2('0x9e')][_0x37b2('0xba')]({'where':{'id':_0x36f3e[_0x37b2('0xb5')]['id']}})['then'](handleEntityNotFound(_0x496b92,null))[_0x37b2('0x1d')](function(_0x113a87){if(_0x113a87){_0x4f475c['model']=_[_0x37b2('0x76')](db[_0x37b2('0xe0')][_0x37b2('0x3c')]);_0x4f475c[_0x37b2('0x40')]=_['keys'](_0x36f3e[_0x37b2('0x40')]);_0x4f475c[_0x37b2('0x41')]=_[_0x37b2('0x42')](_0x4f475c[_0x37b2('0x3f')],_0x4f475c['query']);_0x19597b['attributes']=_[_0x37b2('0x42')](_0x4f475c[_0x37b2('0x3f')],qs[_0x37b2('0x43')](_0x36f3e[_0x37b2('0x40')]['fields']));_0x19597b[_0x37b2('0x44')]=_0x19597b[_0x37b2('0x44')][_0x37b2('0x45')]?_0x19597b[_0x37b2('0x44')]:_0x4f475c[_0x37b2('0x3f')];if(!_0x36f3e['query'][_0x37b2('0x46')](_0x37b2('0x47'))){_0x19597b[_0x37b2('0x2c')]=qs['limit'](_0x36f3e[_0x37b2('0x40')][_0x37b2('0x2c')]);_0x19597b['offset']=qs[_0x37b2('0x2b')](_0x36f3e[_0x37b2('0x40')]['offset']);}_0x19597b['order']=qs['sort'](_0x36f3e[_0x37b2('0x40')][_0x37b2('0x49')]);_0x19597b[_0x37b2('0x4a')]=qs[_0x37b2('0x41')](_[_0x37b2('0xfe')](_0x36f3e[_0x37b2('0x40')],_0x4f475c['filters']));_0x19597b[_0x37b2('0x4a')][_0x37b2('0xb2')]=_0x113a87['id'];if(_0x36f3e[_0x37b2('0x40')][_0x37b2('0x88')]){_0x19597b['where']=_[_0x37b2('0x9d')](_0x19597b['where'],{'$or':_[_0x37b2('0x3b')](_0x19597b[_0x37b2('0x44')],function(_0x2280dd){var _0x466226={};_0x466226[_0x2280dd]={'$like':'%'+_0x36f3e[_0x37b2('0x40')][_0x37b2('0x88')]+'%'};return _0x466226;})});}_0x19597b[_0x37b2('0x4a')][_0x37b2('0x103')]=![];if(_0x36f3e['query']['id']){_0x19597b[_0x37b2('0x4a')]['id']={'$gt':_0x36f3e[_0x37b2('0x40')]['id']};}_0x19597b=_[_0x37b2('0x9d')]({},_0x19597b,_0x36f3e['options']);return db['ChatMessage']['count']({'where':_0x19597b['where']})['then'](function(_0x2d98e2){_0x23c4f1[_0x37b2('0x2a')]=_0x2d98e2;_0x19597b[_0x37b2('0x100')]=[];if(_0x36f3e['query'][_0x37b2('0x104')]){_0x19597b['include'][_0x37b2('0x39')]({'model':db['User'],'as':_0x37b2('0xe1'),'attributes':['id',_0x37b2('0xea'),_0x37b2('0x105')]});}if(_0x36f3e[_0x37b2('0x40')][_0x37b2('0x106')]){_0x19597b['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x19597b);})[_0x37b2('0x1d')](function(_0x13a5b1){_0x23c4f1[_0x37b2('0x107')]=_0x13a5b1;return _0x23c4f1;});}})[_0x37b2('0x1d')](respondWithFilteredResult(_0x496b92,_0x19597b))[_0x37b2('0x27')](handleError(_0x496b92,null));};exports[_0x37b2('0x108')]=function(_0x104f1f,_0x2873da,_0x414401){return db['ChatInteraction'][_0x37b2('0x6b')]({'where':{'id':_0x104f1f['params']['id']}})[_0x37b2('0x1d')](handleEntityNotFound(_0x2873da,null))['then'](function(_0x4d61db){if(_0x4d61db){return _0x4d61db[_0x37b2('0x109')](_0x104f1f[_0x37b2('0x75')]['ids'],_[_0x37b2('0xfc')](_0x104f1f[_0x37b2('0x75')],[_0x37b2('0xfb'),'id'])||{})[_0x37b2('0x10a')](function(){return db[_0x37b2('0x70')][_0x37b2('0x101')]({'attributes':['id',_0x37b2('0x34'),_0x37b2('0x10b')],'where':{'id':_0x104f1f[_0x37b2('0x75')]['ids']}});})['then'](function(_0x1a1179){socket['emit'](_0x37b2('0x10c'),{'id':Number(_0x104f1f[_0x37b2('0xb5')]['id']),'tags':_0x1a1179||[]});return{'id':Number(_0x104f1f[_0x37b2('0xb5')]['id']),'tags':_0x1a1179||[]};});}})[_0x37b2('0x1d')](respondWithResult(_0x2873da,null))[_0x37b2('0x27')](handleError(_0x2873da,null));};exports[_0x37b2('0x10d')]=function(_0x235843,_0x3f0526,_0x245ef7){return db[_0x37b2('0x9e')][_0x37b2('0x6b')]({'where':{'id':_0x235843[_0x37b2('0xb5')]['id']}})[_0x37b2('0x1d')](handleEntityNotFound(_0x3f0526,null))['then'](function(_0x54897b){if(_0x54897b){return _0x54897b[_0x37b2('0x10d')](_0x235843[_0x37b2('0x40')][_0x37b2('0xfb')]);}})[_0x37b2('0x1d')](respondWithStatusCode(_0x3f0526,null))['catch'](handleError(_0x3f0526,null));};exports['download']=function(_0x44658c,_0x3b03f7){var _0x15fe21=moment()['unix']()['toString']();var _0x53c36f=path[_0x37b2('0x10e')](config[_0x37b2('0xda')],_0x37b2('0x10f'),_0x37b2('0x110'),_0x37b2('0x111'));var _0x48cc21=path[_0x37b2('0x10e')](config[_0x37b2('0xda')],_0x37b2('0x10f'),'files',_0x37b2('0x112'));var _0x1a88eb=path['join'](_0x53c36f,_0x15fe21);var _0x275920=util['format'](_0x37b2('0x113'),_0x44658c[_0x37b2('0xb5')]['id'],_0x15fe21);var _0x36dec0=path[_0x37b2('0x10e')](_0x53c36f,_0x275920);var _0x4584a9=[];_0x4584a9[_0x37b2('0x39')]({'model':db['User'],'as':_0x37b2('0xe1'),'attributes':['id',_0x37b2('0xea')],'raw':!![]});_0x4584a9['push']({'model':db['CmContact'],'as':_0x37b2('0x114'),'attributes':['id',_0x37b2('0x115'),_0x37b2('0x116')],'raw':!![]});if(_0x44658c[_0x37b2('0x40')]['attachments']){_0x4584a9[_0x37b2('0x39')]({'model':db[_0x37b2('0xd1')],'as':_0x37b2('0xd1'),'raw':!![]});}var _0x450c81=[{'model':db[_0x37b2('0xe0')],'as':_0x37b2('0xe3'),'attributes':['id','body',_0x37b2('0x7d'),_0x37b2('0xed'),_0x37b2('0x103'),'read'],'include':_0x4584a9}];_0x450c81[_0x37b2('0x39')]({'model':db[_0x37b2('0xbb')],'as':_0x37b2('0x117'),'attributes':['id',_0x37b2('0x34')]});_0x450c81['push']({'model':db['User'],'as':_0x37b2('0x118'),'attributes':['id','fullname']});return db[_0x37b2('0x9e')][_0x37b2('0x6b')]({'where':{'id':_0x44658c[_0x37b2('0xb5')]['id']},'include':_0x450c81})[_0x37b2('0x1d')](handleEntityNotFound(_0x3b03f7,null))[_0x37b2('0x1d')](function(_0x27aceb){if(_0x27aceb){var _0xc0ace3=_0x27aceb['get']({'plain':!![]});fs[_0x37b2('0x119')](_0x1a88eb);var _0x14b0e5={'format':'A4','border':_0x37b2('0x11a'),'header':{'height':_0x37b2('0x11b'),'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':_0x37b2('0x11c'),'contents':{'default':util[_0x37b2('0xdc')](_0x37b2('0x11d'),util[_0x37b2('0xdc')](_0x37b2('0x11e'),'Chat',_0xc0ace3['id']),moment()[_0x37b2('0xdc')]('YYYY-MM-DD')[_0x37b2('0x9b')]())}}};var _0x5ba727={'channel':_0x37b2('0x11f'),'account':_0xc0ace3['Account'][_0x37b2('0x34')],'agent':_0xc0ace3[_0x37b2('0x118')]?_0xc0ace3[_0x37b2('0x118')]['fullname']:_0x37b2('0x120'),'createdAt':moment(_0xc0ace3[_0x37b2('0x7d')])[_0x37b2('0xdc')](_0x37b2('0xff'))[_0x37b2('0x9b')](),'closedAt':_0xc0ace3[_0x37b2('0xca')]?moment(_0xc0ace3[_0x37b2('0x121')])[_0x37b2('0xdc')]('YYYY-MM-DD\x20HH:mm:ss')[_0x37b2('0x9b')]():'','disposition':_0xc0ace3['disposition'],'chatInfo':{'browser':_0xc0ace3[_0x37b2('0x122')],'os':_0xc0ace3[_0x37b2('0x123')],'referer':_0xc0ace3['referer'],'customerIp':_0xc0ace3[_0x37b2('0x124')],'customerPort':_0xc0ace3[_0x37b2('0x125')]?_0xc0ace3[_0x37b2('0x125')]:_0x37b2('0x120')},'messages':_(_0xc0ace3[_0x37b2('0xe3')])[_0x37b2('0x126')]()[_0x37b2('0x88')]({'secret':![]})[_0x37b2('0x3b')](function(_0xcac6f2){if(_0xcac6f2[_0x37b2('0xd1')]){var _0xb26f81=path[_0x37b2('0x10e')](_0x48cc21,_0xcac6f2['Attachment'][_0x37b2('0xd7')]);if(fs[_0x37b2('0x127')](_0xb26f81)){fs['createReadStream'](_0xb26f81)['pipe'](fs['createWriteStream'](path[_0x37b2('0x10e')](_0x1a88eb,_0xcac6f2[_0x37b2('0xd1')][_0x37b2('0xd7')])));}}return{'date':moment(_0xcac6f2['createdAt'])[_0x37b2('0xdc')](_0x37b2('0xff'))['toString'](),'sender':_0xcac6f2[_0x37b2('0xed')]===_0x37b2('0xc4')?_0xcac6f2[_0x37b2('0xe1')]?_0xcac6f2['User'][_0x37b2('0xea')]:_0x37b2('0xe8'):_0xcac6f2['Contact']['firstName']+(_0xcac6f2['Contact'][_0x37b2('0x116')]?'\x20'+_0xcac6f2[_0x37b2('0x114')]['lastName']:''),'body':_0xcac6f2[_0x37b2('0xd1')]?_0xcac6f2[_0x37b2('0xd1')]['basename']:_0xcac6f2[_0x37b2('0x75')],'direction':_0xcac6f2[_0x37b2('0xed')]===_0x37b2('0xc4')?'A':'C','secret':_0xcac6f2[_0x37b2('0x103')],'read':_0xcac6f2[_0x37b2('0x84')],'attachment':_0xcac6f2['Attachment']};})[_0x37b2('0x64')]()};return ejs[_0x37b2('0x128')](path['join'](config[_0x37b2('0xda')],'server','views','downloadInteraction.html'),{'interaction':_0x5ba727})[_0x37b2('0x1d')](function(_0x569222){return new BPromise(function(_0x9be16,_0x395823){pdf[_0x37b2('0xb7')](_0x569222,_0x14b0e5)[_0x37b2('0x129')](path[_0x37b2('0x10e')](_0x1a88eb,_0x37b2('0x12a')+_0xc0ace3['id']+'-'+_0x15fe21+_0x37b2('0x12b')),function(_0x136776,_0x392292){if(_0x136776)return _0x395823(_0x136776);_0x9be16(_0x392292);});});})[_0x37b2('0x1d')](function(){return new BPromise(function(_0x258928,_0x7f1e29){zipdir(_0x1a88eb,{'saveTo':_0x36dec0},function(_0x3c5c01,_0x17f410){if(_0x3c5c01)return _0x7f1e29(_0x3c5c01);return _0x258928(_0x17f410);});})[_0x37b2('0x1d')](function(){return new BPromise(function(_0x4212d1,_0x1afd60){rimraf(_0x1a88eb,function(_0x3eff2a){if(_0x3eff2a)_0x1afd60(_0x3eff2a);return _0x4212d1();});});})[_0x37b2('0x1d')](function(){return _0x3b03f7[_0x37b2('0x12c')](_0x36dec0,_0x275920,function(_0x36d9de){if(_0x36d9de){console['log'](_0x37b2('0x12d'),_0x36d9de);}else{fs[_0x37b2('0x12e')](_0x36dec0);}});});});}else{return _0x3b03f7['sendStatus'](0xc8);}})['catch'](handleError(_0x3b03f7,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 24e07f9..77f4039 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 _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 +var _0x992b=['unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','remove','setDataValue','map','findAll','then'];(function(_0x1e0f42,_0x2567e5){var _0x4e9c54=function(_0x519f2d){while(--_0x519f2d){_0x1e0f42['push'](_0x1e0f42['shift']());}};_0x4e9c54(++_0x2567e5);}(_0x992b,0x127));var _0xb992=function(_0x42683a,_0x52c135){_0x42683a=_0x42683a-0x0;var _0x493076=_0x992b[_0x42683a];return _0x493076;};'use strict';var EventEmitter=require(_0xb992('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xb992('0x1')];var ChatMessage=require(_0xb992('0x2'))['db'][_0xb992('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb992('0x4')](0x0);var events={'afterCreate':_0xb992('0x5'),'afterUpdate':'update','afterDestroy':_0xb992('0x6')};function emitEvent(_0x4f7579){return function(_0x9fabba,_0x53aa29,_0x20d122){_0x9fabba['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x303b7a){_0x9fabba[_0xb992('0x7')]('Users',_0x303b7a[_0xb992('0x8')](function(_0x72a54){return{'id':_0x72a54['id']};}));return ChatMessage[_0xb992('0x9')]({'where':{'ChatInteractionId':_0x9fabba['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb992('0xa')](function(_0x235d02){_0x9fabba[_0xb992('0x7')](_0xb992('0xb'),_0x235d02['length']);ChatInteractionEvents[_0xb992('0xc')](_0x4f7579+':'+_0x9fabba['id'],_0x9fabba);ChatInteractionEvents[_0xb992('0xc')](_0x4f7579,_0x9fabba);_0x20d122(null);})[_0xb992('0xd')](_0x20d122(null));};}for(var e in events){if(events[_0xb992('0xe')](e)){var event=events[e];ChatInteraction[_0xb992('0xf')](e,emitEvent(event));}}module[_0xb992('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 4339764..add914e 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 _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 +var _0xdb43=['rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','closed','format','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x2e4d38,_0x341adb){var _0x550e6d=function(_0x53d463){while(--_0x53d463){_0x2e4d38['push'](_0x2e4d38['shift']());}};_0x550e6d(++_0x341adb);}(_0xdb43,0xba));var _0x3db4=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xdb43[_0x46d0c9];return _0x174506;};'use strict';var _=require(_0x3db4('0x0'));var util=require('util');var logger=require(_0x3db4('0x1'))(_0x3db4('0x2'));var moment=require(_0x3db4('0x3'));var BPromise=require(_0x3db4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3db4('0x5'));var rimraf=require(_0x3db4('0x6'));var config=require(_0x3db4('0x7'));var attributes=require(_0x3db4('0x8'));module[_0x3db4('0x9')]=function(_0x1ea599,_0x3e4453){return _0x1ea599[_0x3db4('0xa')](_0x3db4('0xb'),attributes,{'tableName':_0x3db4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x403c9c,_0x116d5a,_0x188149){if(_0x403c9c['changed'](_0x3db4('0xd'))){_0x403c9c['closedAt']=moment()[_0x3db4('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x188149(null,_0x403c9c);}},'charset':'utf8mb4','collate':_0x3db4('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index d887217..944d7e2 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 _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 +var _0x78a9=['spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','UpdateChatInteraction','ChatInteraction','body','options','raw','where','attributes','limit','catch','AddTagsToChatInteraction','find','addTags','ids','omit'];(function(_0x9ec31f,_0x2ba206){var _0x93391f=function(_0x5f2d16){while(--_0x5f2d16){_0x9ec31f['push'](_0x9ec31f['shift']());}};_0x93391f(++_0x2ba206);}(_0x78a9,0xde));var _0x978a=function(_0x5c4d56,_0x3889f0){_0x5c4d56=_0x5c4d56-0x0;var _0x2b8e9f=_0x78a9[_0x5c4d56];return _0x2b8e9f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x978a('0x0'));var BPromise=require(_0x978a('0x1'));var rs=require(_0x978a('0x2'));var fs=require('fs');var Redis=require(_0x978a('0x3'));var db=require(_0x978a('0x4'))['db'];var utils=require(_0x978a('0x5'));var logger=require(_0x978a('0x6'))(_0x978a('0x7'));var config=require(_0x978a('0x8'));var jayson=require(_0x978a('0x9'));var client=jayson['client'][_0x978a('0xa')]({'port':0x232a});config[_0x978a('0xb')]=_[_0x978a('0xc')](config[_0x978a('0xb')],{'host':_0x978a('0xd'),'port':0x18eb});var socket=require(_0x978a('0xe'))(new Redis(config[_0x978a('0xb')]));require('./chatInteraction.socket')[_0x978a('0xf')](socket);function respondWithRpcPromise(_0x1dea76,_0x309e74,_0x121816){return new BPromise(function(_0x5d81e1,_0x59eb02){return client[_0x978a('0x10')](_0x1dea76,_0x121816)[_0x978a('0x11')](function(_0x528c01){logger[_0x978a('0x12')](_0x978a('0x13'),_0x309e74,'request\x20sent');logger[_0x978a('0x14')](_0x978a('0x15'),_0x309e74,'request\x20sent',JSON[_0x978a('0x16')](_0x528c01));if(_0x528c01[_0x978a('0x17')]){if(_0x528c01[_0x978a('0x17')][_0x978a('0x18')]===0x1f4){logger[_0x978a('0x17')](_0x978a('0x13'),_0x309e74,_0x528c01[_0x978a('0x17')][_0x978a('0x19')]);return _0x59eb02(_0x528c01[_0x978a('0x17')][_0x978a('0x19')]);}logger[_0x978a('0x17')](_0x978a('0x13'),_0x309e74,_0x528c01['error'][_0x978a('0x19')]);return _0x5d81e1(_0x528c01[_0x978a('0x17')]['message']);}else{logger['info'](_0x978a('0x13'),_0x309e74,_0x978a('0x1a'));_0x5d81e1(_0x528c01[_0x978a('0x1b')]['message']);}})['catch'](function(_0x34d404){logger[_0x978a('0x17')](_0x978a('0x13'),_0x309e74,_0x34d404);_0x59eb02(_0x34d404);});});}exports[_0x978a('0x1c')]=function(_0x5b20b2){var _0x1202ba=this;return new Promise(function(_0x2554cd,_0x38ca8b){return db[_0x978a('0x1d')]['update'](_0x5b20b2[_0x978a('0x1e')],{'raw':_0x5b20b2[_0x978a('0x1f')]?_0x5b20b2[_0x978a('0x1f')][_0x978a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b20b2[_0x978a('0x1f')]?_0x5b20b2[_0x978a('0x1f')][_0x978a('0x21')]||null:null,'attributes':_0x5b20b2[_0x978a('0x1f')]?_0x5b20b2[_0x978a('0x1f')][_0x978a('0x22')]||null:null,'limit':_0x5b20b2[_0x978a('0x1f')]?_0x5b20b2[_0x978a('0x1f')][_0x978a('0x23')]||null:null})[_0x978a('0x11')](function(_0x3f3a36){logger[_0x978a('0x12')](_0x978a('0x1c'),_0x5b20b2);logger[_0x978a('0x14')](_0x978a('0x1c'),_0x5b20b2,JSON['stringify'](_0x3f3a36));_0x2554cd(_0x3f3a36);})[_0x978a('0x24')](function(_0x493e58){logger[_0x978a('0x17')](_0x978a('0x1c'),_0x493e58[_0x978a('0x19')],_0x5b20b2);_0x38ca8b(_0x1202ba[_0x978a('0x17')](0x1f4,_0x493e58['message']));});});};exports[_0x978a('0x25')]=function(_0x42c8e9){return new Promise(function(_0x511887,_0x3720d2){return db[_0x978a('0x1d')][_0x978a('0x26')]({'where':_0x42c8e9[_0x978a('0x1f')]?_0x42c8e9[_0x978a('0x1f')][_0x978a('0x21')]||null:null})[_0x978a('0x11')](function(_0x38b453){if(_0x38b453){return _0x38b453[_0x978a('0x27')](_0x42c8e9['body'][_0x978a('0x28')],_[_0x978a('0x29')](_0x42c8e9['body'],[_0x978a('0x28'),'id'])||{});}})[_0x978a('0x2a')](function(_0x20b0fc){logger[_0x978a('0x12')](_0x978a('0x2b'),_0x42c8e9);logger[_0x978a('0x14')](_0x978a('0x2b'),_0x42c8e9,JSON[_0x978a('0x16')](_0x20b0fc));_0x511887(_0x20b0fc);})['catch'](function(_0xa80b7f){logger[_0x978a('0x17')](_0x978a('0x2b'),_0xa80b7f['message'],_0x42c8e9);_0x3720d2(_this[_0x978a('0x17')](0x1f4,_0xa80b7f['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index f94064c..a1043f9 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 _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 +var _0xc924=['register','chatInteraction:','./chatInteraction.events','save','update','emit','removeListener'];(function(_0x2a1d1d,_0x5cb96c){var _0x32f0b9=function(_0x2bdcea){while(--_0x2bdcea){_0x2a1d1d['push'](_0x2a1d1d['shift']());}};_0x32f0b9(++_0x5cb96c);}(_0xc924,0x1f3));var _0x4c92=function(_0x22c0cd,_0x3650e6){_0x22c0cd=_0x22c0cd-0x0;var _0x4d0b1f=_0xc924[_0x22c0cd];return _0x4d0b1f;};'use strict';var ChatInteractionEvents=require(_0x4c92('0x0'));var events=[_0x4c92('0x1'),'remove',_0x4c92('0x2')];function createListener(_0x4b3463,_0x507a18){return function(_0x48b11a){_0x507a18[_0x4c92('0x3')](_0x4b3463,_0x48b11a);};}function removeListener(_0x11a6c3,_0x23a479){return function(){ChatInteractionEvents[_0x4c92('0x4')](_0x11a6c3,_0x23a479);};}exports[_0x4c92('0x5')]=function(_0x564126){for(var _0x39f0ed=0x0,_0x3ef58f=events['length'];_0x39f0ed<_0x3ef58f;_0x39f0ed++){var _0x2d33ad=events[_0x39f0ed];var _0x1c9163=createListener(_0x4c92('0x6')+_0x2d33ad,_0x564126);ChatInteractionEvents['on'](_0x2d33ad,_0x1c9163);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index f252f04..4c7964a 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 _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 +var _0x5cf3=['getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','%s-%s','now','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages'];(function(_0x3caeb5,_0x219363){var _0x5eca7e=function(_0x4cae6b){while(--_0x4cae6b){_0x3caeb5['push'](_0x3caeb5['shift']());}};_0x5eca7e(++_0x219363);}(_0x5cf3,0x92));var _0x35cf=function(_0x4dc4bd,_0x490bf0){_0x4dc4bd=_0x4dc4bd-0x0;var _0x22a362=_0x5cf3[_0x4dc4bd];return _0x22a362;};'use strict';var multer=require(_0x35cf('0x0'));var util=require(_0x35cf('0x1'));var path=require(_0x35cf('0x2'));var timeout=require(_0x35cf('0x3'));var express=require(_0x35cf('0x4'));var router=express[_0x35cf('0x5')]();var auth=require(_0x35cf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35cf('0x7'));var controller=require(_0x35cf('0x8'));router[_0x35cf('0x9')]('/',auth[_0x35cf('0xa')](),controller[_0x35cf('0xb')]);router['get'](_0x35cf('0xc'),auth[_0x35cf('0xa')](),controller['describe']);router[_0x35cf('0x9')](_0x35cf('0xd'),auth[_0x35cf('0xe')](),controller[_0x35cf('0xf')]);router['get'](_0x35cf('0x10'),auth[_0x35cf('0xe')](),controller[_0x35cf('0x11')]);router[_0x35cf('0x9')](_0x35cf('0x12'),auth[_0x35cf('0xa')](),controller[_0x35cf('0x13')]);router[_0x35cf('0x9')](_0x35cf('0x14'),auth[_0x35cf('0xe')](),controller[_0x35cf('0x15')]);router[_0x35cf('0x9')](_0x35cf('0x16'),auth['isAuthenticated'](),controller[_0x35cf('0x17')]);router[_0x35cf('0x18')]('/',auth[_0x35cf('0xa')](),controller[_0x35cf('0x19')]);router['post'](_0x35cf('0x1a'),auth[_0x35cf('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x35cf('0x1b')]({'destination':function(_0x716f00,_0x1b064c,_0x2b4cf2){_0x2b4cf2(null,path[_0x35cf('0x1c')](config[_0x35cf('0x1d')],_0x35cf('0x1e')));},'filename':function(_0x479c09,_0x3004b8,_0x608cb2){_0x608cb2(null,util['format'](_0x35cf('0x1f'),Date[_0x35cf('0x20')](),_0x3004b8['originalname'][_0x35cf('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x35cf('0x18')](_0x35cf('0x22'),upload[_0x35cf('0x23')](_0x35cf('0x24')),controller[_0x35cf('0x25')]);router[_0x35cf('0x18')](_0x35cf('0x12'),auth[_0x35cf('0xe')](),controller['addMessage']);router[_0x35cf('0x18')](_0x35cf('0x26'),auth['isAuthenticated'](),interaction[_0x35cf('0x27')](_0x35cf('0x28'),_0x35cf('0x29')),controller[_0x35cf('0x2a')]);router[_0x35cf('0x2b')](_0x35cf('0xd'),auth[_0x35cf('0xa')](),interaction[_0x35cf('0x27')](_0x35cf('0x28'),'chatinteraction:update'),controller[_0x35cf('0x2c')]);router[_0x35cf('0x2b')](_0x35cf('0x2d'),controller[_0x35cf('0x2e')]);router[_0x35cf('0x2b')](_0x35cf('0x2f'),auth['isChatInteractionAuthorized'](),controller[_0x35cf('0x30')]);router['put'](_0x35cf('0x31'),controller[_0x35cf('0x32')]);router[_0x35cf('0x33')](_0x35cf('0xd'),auth[_0x35cf('0xa')](),interaction[_0x35cf('0x27')](_0x35cf('0x28'),_0x35cf('0x34')),controller[_0x35cf('0x35')]);router[_0x35cf('0x33')](_0x35cf('0x26'),auth[_0x35cf('0xa')](),controller['removeTags']);module[_0x35cf('0x36')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 6291766..efa73db 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 _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 +var _0xdb28=['medium','INTEGER','sequelize','exports','TEXT'];(function(_0x40280e,_0x4df3d5){var _0x4aa46c=function(_0x86ccd0){while(--_0x86ccd0){_0x40280e['push'](_0x40280e['shift']());}};_0x4aa46c(++_0x4df3d5);}(_0xdb28,0x106));var _0x8db2=function(_0x1ec8c2,_0x3f2622){_0x1ec8c2=_0x1ec8c2-0x0;var _0x5a15f8=_0xdb28[_0x1ec8c2];return _0x5a15f8;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8db2('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 6d39b2f..4207abd 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 _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 +var _0x5874=['body','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','findAll','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','isEmpty','resourceId','push','createdAt','FromId','read','-createdAt','all','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','localhost','./chatInternalMessage.socket','register','status','json','offset','limit','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatInternalMessage','count','include','rows','catch','show','params','rawAttributes','includeAll','find','then','create'];(function(_0x506172,_0xbc3a3){var _0x2723c0=function(_0x57c3d9){while(--_0x57c3d9){_0x506172['push'](_0x506172['shift']());}};_0x2723c0(++_0xbc3a3);}(_0x5874,0x92));var _0x4587=function(_0x50bab4,_0x3e670f){_0x50bab4=_0x50bab4-0x0;var _0x4cc7f9=_0x5874[_0x50bab4];return _0x4cc7f9;};'use strict';var pdf=require(_0x4587('0x0'));var emlformat=require(_0x4587('0x1'));var rimraf=require(_0x4587('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4587('0x3'));var rp=require(_0x4587('0x4'));var moment=require(_0x4587('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4587('0x6'));var util=require(_0x4587('0x7'));var path=require(_0x4587('0x8'));var sox=require(_0x4587('0x9'));var csv=require(_0x4587('0xa'));var ejs=require(_0x4587('0xb'));var fs=require('fs');var _=require(_0x4587('0xc'));var squel=require(_0x4587('0xd'));var crypto=require(_0x4587('0xe'));var jsforce=require(_0x4587('0xf'));var deskjs=require(_0x4587('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4587('0x11'));var authService=require(_0x4587('0x12'));var qs=require(_0x4587('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4587('0x14'));var logger=require(_0x4587('0x15'))(_0x4587('0x16'));var utils=require('../../config/utils');var config=require(_0x4587('0x17'));var licenseUtil=require(_0x4587('0x18'));var db=require(_0x4587('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x4587('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4587('0x1b'))[_0x4587('0x1c')](socket);function respondWithStatusCode(_0x309b60,_0x182a5d){_0x182a5d=_0x182a5d||0xcc;return function(_0x291115){if(_0x291115){return _0x309b60['sendStatus'](_0x182a5d);}return _0x309b60[_0x4587('0x1d')](_0x182a5d)['end']();};}function respondWithResult(_0x4fb083,_0x4aa7e0){_0x4aa7e0=_0x4aa7e0||0xc8;return function(_0x175e9b){if(_0x175e9b){return _0x4fb083['status'](_0x4aa7e0)[_0x4587('0x1e')](_0x175e9b);}};}function respondWithFilteredResult(_0x47a80b,_0x11a75f){return function(_0x2e13d1){if(_0x2e13d1){var _0x4361cc=_0x2e13d1['count'],_0x42248a=_0x11a75f['offset'],_0x44e7c2=_0x11a75f[_0x4587('0x1f')]+_0x11a75f[_0x4587('0x20')],_0x201ae6;if(_0x44e7c2>=_0x4361cc){_0x44e7c2=_0x4361cc;_0x201ae6=0xc8;}else{_0x201ae6=0xce;}_0x47a80b['status'](_0x201ae6);return _0x47a80b['set'](_0x4587('0x21'),_0x42248a+'-'+_0x44e7c2+'/'+_0x4361cc)[_0x4587('0x1e')](_0x2e13d1);}return null;};}function patchUpdates(_0xb02809){return function(_0x52689b){try{jsonpatch[_0x4587('0x22')](_0x52689b,_0xb02809,!![]);}catch(_0x36ec39){return BPromise[_0x4587('0x23')](_0x36ec39);}return _0x52689b['save']();};}function saveUpdates(_0x430d24,_0x16a89e){return function(_0x46e5f4){if(_0x46e5f4){return _0x46e5f4[_0x4587('0x24')](_0x430d24)['then'](function(_0x394fa9){return _0x394fa9;});}return null;};}function removeEntity(_0xd92c49,_0x2d8376){return function(_0x2236b3){if(_0x2236b3){return _0x2236b3[_0x4587('0x25')]()['then'](function(){_0xd92c49[_0x4587('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5658c0,_0x2353eb){return function(_0x48dc16){if(!_0x48dc16){_0x5658c0[_0x4587('0x26')](0x194);}return _0x48dc16;};}function handleError(_0x398870,_0x44fd4d){_0x44fd4d=_0x44fd4d||0x1f4;return function(_0x477a9b){logger['error'](_0x477a9b[_0x4587('0x27')]);if(_0x477a9b[_0x4587('0x28')]){delete _0x477a9b['name'];}_0x398870['status'](_0x44fd4d)[_0x4587('0x29')](_0x477a9b);};}exports[_0x4587('0x2a')]=function(_0x1f0ebb,_0x552878){var _0x4e6d6e={},_0x41fafa={},_0x111d65={'count':0x0,'rows':[]};var _0x3598a8=_[_0x4587('0x2b')](db['ChatInternalMessage']['rawAttributes'],function(_0x147c0a){return{'name':_0x147c0a['fieldName'],'type':_0x147c0a[_0x4587('0x2c')][_0x4587('0x2d')]};});_0x41fafa[_0x4587('0x2e')]=_[_0x4587('0x2b')](_0x3598a8,'name');_0x41fafa[_0x4587('0x2f')]=_[_0x4587('0x30')](_0x1f0ebb[_0x4587('0x2f')]);_0x41fafa[_0x4587('0x31')]=_[_0x4587('0x32')](_0x41fafa[_0x4587('0x2e')],_0x41fafa[_0x4587('0x2f')]);_0x4e6d6e[_0x4587('0x33')]=_[_0x4587('0x32')](_0x41fafa[_0x4587('0x2e')],qs['fields'](_0x1f0ebb[_0x4587('0x2f')][_0x4587('0x34')]));_0x4e6d6e[_0x4587('0x33')]=_0x4e6d6e['attributes'][_0x4587('0x35')]?_0x4e6d6e[_0x4587('0x33')]:_0x41fafa[_0x4587('0x2e')];if(!_0x1f0ebb[_0x4587('0x2f')][_0x4587('0x36')](_0x4587('0x37'))){_0x4e6d6e['limit']=qs[_0x4587('0x20')](_0x1f0ebb['query'][_0x4587('0x20')]);_0x4e6d6e[_0x4587('0x1f')]=qs['offset'](_0x1f0ebb['query'][_0x4587('0x1f')]);}_0x4e6d6e[_0x4587('0x38')]=qs[_0x4587('0x39')](_0x1f0ebb[_0x4587('0x2f')][_0x4587('0x39')]);_0x4e6d6e[_0x4587('0x3a')]=qs[_0x4587('0x31')](_[_0x4587('0x3b')](_0x1f0ebb[_0x4587('0x2f')],_0x41fafa[_0x4587('0x31')]),_0x3598a8);if(_0x1f0ebb[_0x4587('0x2f')][_0x4587('0x3c')]){_0x4e6d6e[_0x4587('0x3a')]=_[_0x4587('0x3d')](_0x4e6d6e['where'],{'$or':_[_0x4587('0x2b')](_0x3598a8,function(_0x482669){if(_0x482669[_0x4587('0x2c')]!==_0x4587('0x3e')){var _0x5bc327={};_0x5bc327[_0x482669[_0x4587('0x28')]]={'$like':'%'+_0x1f0ebb[_0x4587('0x2f')][_0x4587('0x3c')]+'%'};return _0x5bc327;}})});}_0x4e6d6e=_[_0x4587('0x3d')]({},_0x4e6d6e,_0x1f0ebb[_0x4587('0x3f')]);var _0x2711e4={'where':_0x4e6d6e[_0x4587('0x3a')]};return db[_0x4587('0x40')][_0x4587('0x41')](_0x2711e4)['then'](function(_0x5d703b){_0x111d65[_0x4587('0x41')]=_0x5d703b;if(_0x1f0ebb[_0x4587('0x2f')]['includeAll']){_0x4e6d6e[_0x4587('0x42')]=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x4e6d6e);})['then'](function(_0x234fb9){_0x111d65[_0x4587('0x43')]=_0x234fb9;return _0x111d65;})['then'](respondWithFilteredResult(_0x552878,_0x4e6d6e))[_0x4587('0x44')](handleError(_0x552878,null));};exports[_0x4587('0x45')]=function(_0x359d08,_0x47b281){var _0x2ef821={'raw':!![],'where':{'id':_0x359d08[_0x4587('0x46')]['id']}},_0x145f34={};_0x145f34['model']=_[_0x4587('0x30')](db['ChatInternalMessage'][_0x4587('0x47')]);_0x145f34[_0x4587('0x2f')]=_[_0x4587('0x30')](_0x359d08[_0x4587('0x2f')]);_0x145f34['filters']=_['intersection'](_0x145f34[_0x4587('0x2e')],_0x145f34[_0x4587('0x2f')]);_0x2ef821['attributes']=_[_0x4587('0x32')](_0x145f34[_0x4587('0x2e')],qs[_0x4587('0x34')](_0x359d08[_0x4587('0x2f')][_0x4587('0x34')]));_0x2ef821['attributes']=_0x2ef821[_0x4587('0x33')]['length']?_0x2ef821[_0x4587('0x33')]:_0x145f34[_0x4587('0x2e')];if(_0x359d08[_0x4587('0x2f')][_0x4587('0x48')]){_0x2ef821[_0x4587('0x42')]=[{'all':!![]}];}_0x2ef821=_[_0x4587('0x3d')]({},_0x2ef821,_0x359d08['options']);return db[_0x4587('0x40')][_0x4587('0x49')](_0x2ef821)[_0x4587('0x4a')](handleEntityNotFound(_0x47b281,null))['then'](respondWithResult(_0x47b281,null))[_0x4587('0x44')](handleError(_0x47b281,null));};exports[_0x4587('0x4b')]=function(_0x426c1a,_0x29a710){return db[_0x4587('0x40')][_0x4587('0x4b')](_0x426c1a['body'],{})['then'](respondWithResult(_0x29a710,0xc9))[_0x4587('0x44')](handleError(_0x29a710,null));};exports[_0x4587('0x24')]=function(_0x35a1f9,_0x369f8c){if(_0x35a1f9[_0x4587('0x4c')]['id']){delete _0x35a1f9['body']['id'];}return db[_0x4587('0x40')][_0x4587('0x49')]({'where':{'id':_0x35a1f9[_0x4587('0x46')]['id']}})['then'](handleEntityNotFound(_0x369f8c,null))[_0x4587('0x4a')](saveUpdates(_0x35a1f9[_0x4587('0x4c')],null))[_0x4587('0x4a')](respondWithResult(_0x369f8c,null))[_0x4587('0x44')](handleError(_0x369f8c,null));};exports[_0x4587('0x25')]=function(_0x1cb9f5,_0x5aa8c8){return db[_0x4587('0x40')]['find']({'where':{'id':_0x1cb9f5[_0x4587('0x46')]['id']}})['then'](handleEntityNotFound(_0x5aa8c8,null))[_0x4587('0x4a')](removeEntity(_0x5aa8c8,null))[_0x4587('0x44')](handleError(_0x5aa8c8,null));};exports[_0x4587('0x4d')]=function(_0x2d74b1,_0x3d11ac){return db[_0x4587('0x40')][_0x4587('0x4d')]()['then'](respondWithResult(_0x3d11ac,null))['catch'](handleError(_0x3d11ac,null));};function wrapUser(_0x15d3a0){return function(_0x32155b){var _0x3831c8=_0x15d3a0[_0x4587('0x4e')]({'plain':!![]});_0x3831c8[_0x4587('0x4f')]=[];if(_0x32155b){_0x3831c8[_0x4587('0x50')]=_0x32155b['createdAt'];_0x3831c8[_0x4587('0x51')]=_0x32155b;}else{_0x3831c8[_0x4587('0x50')]=moment(0x0)[_0x4587('0x52')](_0x4587('0x53'));_0x3831c8[_0x4587('0x51')]={};}return _0x3831c8;};}exports['getUsers']=function(_0x58c4d1,_0x425ede,_0x588e05){var _0x1ccd0d=[];return db[_0x4587('0x54')][_0x4587('0x55')]({'where':{'role':[_0x4587('0x56'),_0x4587('0x57'),_0x4587('0x58')]},'attributes':['id',_0x4587('0x59'),_0x4587('0x28'),_0x4587('0x5a'),_0x4587('0x5b'),_0x4587('0x5c'),_0x4587('0x5d'),_0x4587('0x5e'),_0x4587('0x5f'),_0x4587('0x60')],'order':qs[_0x4587('0x39')]('-online'),'include':[{'model':db[_0x4587('0x61')],'as':_0x4587('0x62'),'attributes':['id',_0x4587('0x28'),'type'],'through':{'attributes':[]}}]})[_0x4587('0x4a')](function(_0x2a3ab9){if(_0x2a3ab9){var _0x5b1326=_0x58c4d1[_0x4587('0x58')]['get']({'plain':!![]});if(!_0x5b1326)throw new Error(_0x4587('0x63'));if(_0x5b1326[_0x4587('0x5a')]===_0x4587('0x58')){return db[_0x4587('0x64')][_0x4587('0x49')]({'where':{'name':'Agents','userProfileId':_0x5b1326['userProfileId']},'raw':!![]})['then'](function(_0x128bfe){if(_0x128bfe){if(_0x128bfe[_0x4587('0x65')]===0x0){return db[_0x4587('0x66')][_0x4587('0x55')]({'where':{'sectionId':_0x128bfe['id']},'raw':!![]})[_0x4587('0x4a')](function(_0x2bf856){var _0x16cb47=[];if(_[_0x4587('0x67')](_0x2bf856)){_0x16cb47=_['filter'](_0x2a3ab9,function(_0x2cb438){if(_0x2cb438[_0x4587('0x5a')]!==_0x4587('0x56')){return _0x2cb438;}});return _0x16cb47;}else{for(var _0x1262a0=0x0;_0x1262a0<_0x2a3ab9[_0x4587('0x35')];_0x1262a0++){var _0x1da3dd=_0x2a3ab9[_0x1262a0];if(_0x1da3dd[_0x4587('0x5a')]===_0x4587('0x56')){var _0x27c581=_[_0x4587('0x49')](_0x2bf856,function(_0x1c929c){return _0x1c929c[_0x4587('0x68')]===_0x1da3dd['id'];});if(_0x27c581)_0x16cb47[_0x4587('0x69')](_0x1da3dd);}else{_0x16cb47[_0x4587('0x69')](_0x1da3dd);}}return _0x16cb47;}});}else{return _0x2a3ab9;}}else{var _0x2c326a=_[_0x4587('0x3c')](_0x2a3ab9,function(_0x1c4c0e){if(_0x1c4c0e[_0x4587('0x5a')]!==_0x4587('0x56')){return _0x1c4c0e;}});return _0x2c326a;}});}else{return _0x2a3ab9;}}})['then'](function(_0x45ebc7){var _0x1c3a1f=[];if(_0x45ebc7){_0x1ccd0d=_0x45ebc7;for(var _0x5a5026=0x0;_0x5a5026<_0x45ebc7[_0x4587('0x35')];_0x5a5026+=0x1){_0x1ccd0d[_0x5a5026][_0x4587('0x4f')]=[];_0x1c3a1f[_0x4587('0x69')](db[_0x4587('0x40')][_0x4587('0x49')]({'where':{'FromId':[_0x58c4d1[_0x4587('0x58')]['id'],_0x45ebc7[_0x5a5026]['id']],'ToId':[_0x58c4d1['user']['id'],_0x45ebc7[_0x5a5026]['id']],'ChatGroupId':null},'attributes':['id',_0x4587('0x6a'),_0x4587('0x6b'),'ToId',_0x4587('0x6c'),'body'],'order':qs[_0x4587('0x39')](_0x4587('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x4587('0x4a')](wrapUser(_0x45ebc7[_0x5a5026])));}return BPromise[_0x4587('0x6e')](_0x1c3a1f);}return[];})[_0x4587('0x4a')](function(_0x1e5c40){return{'rows':_0x1e5c40,'count':_0x1e5c40[_0x4587('0x35')]};})[_0x4587('0x4a')](respondWithResult(_0x425ede,null))[_0x4587('0x44')](handleError(_0x425ede,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 64a7cbc..e987aaa 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.events.js +++ b/server/api/chatInternalMessage/chatInternalMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd84b=['remove','emit','hasOwnProperty','hook','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_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 +var _0xa992=['events','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x5a5fb8,_0x3d22ad){var _0x126ef2=function(_0x41020b){while(--_0x41020b){_0x5a5fb8['push'](_0x5a5fb8['shift']());}};_0x126ef2(++_0x3d22ad);}(_0xa992,0xc4));var _0x2a99=function(_0x16345b,_0x164c21){_0x16345b=_0x16345b-0x0;var _0xcf6924=_0xa992[_0x16345b];return _0xcf6924;};'use strict';var EventEmitter=require(_0x2a99('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2a99('0x1'),'afterUpdate':_0x2a99('0x2'),'afterDestroy':'remove'};function emitEvent(_0x209156){return function(_0x4cb7d7,_0x89f03d,_0x4c79e8){ChatInternalMessageEvents[_0x2a99('0x3')](_0x209156+':'+_0x4cb7d7['id'],_0x4cb7d7);ChatInternalMessageEvents['emit'](_0x209156,_0x4cb7d7);_0x4c79e8(null);};}for(var e in events){if(events[_0x2a99('0x4')](e)){var event=events[e];ChatInternalMessage[_0x2a99('0x5')](e,emitEvent(event));}}module[_0x2a99('0x6')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 095391b..5f0675a 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 _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 +var _0xbdb7=['define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes'];(function(_0x5959c9,_0x2ed153){var _0x4ffcbc=function(_0x459b7a){while(--_0x459b7a){_0x5959c9['push'](_0x5959c9['shift']());}};_0x4ffcbc(++_0x2ed153);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1e40df,_0x18b1a5){_0x1e40df=_0x1e40df-0x0;var _0x4bfb7b=_0xbdb7[_0x1e40df];return _0x4bfb7b;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var moment=require(_0x7bdb('0x4'));var BPromise=require(_0x7bdb('0x5'));var rp=require(_0x7bdb('0x6'));var fs=require('fs');var path=require(_0x7bdb('0x7'));var rimraf=require(_0x7bdb('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bdb('0x9'));module['exports']=function(_0x4b5fff,_0xffdc86){return _0x4b5fff[_0x7bdb('0xa')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7bdb('0xb'),'collate':_0x7bdb('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index b62e893..bf395a0 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 _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 +var _0x2c10=['defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','info','ChatInternalMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5aaeac,_0x1dd663){var _0x2986de=function(_0x2f154a){while(--_0x2f154a){_0x5aaeac['push'](_0x5aaeac['shift']());}};_0x2986de(++_0x1dd663);}(_0x2c10,0xaf));var _0x02c1=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x2c10[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require(_0x02c1('0x0'));var moment=require(_0x02c1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02c1('0x2'))['db'];var utils=require(_0x02c1('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x02c1('0x4'));var jayson=require(_0x02c1('0x5'));var client=jayson[_0x02c1('0x6')][_0x02c1('0x7')]({'port':0x232a});config[_0x02c1('0x8')]=_[_0x02c1('0x9')](config[_0x02c1('0x8')],{'host':_0x02c1('0xa'),'port':0x18eb});var socket=require(_0x02c1('0xb'))(new Redis(config[_0x02c1('0x8')]));require(_0x02c1('0xc'))['register'](socket);function respondWithRpcPromise(_0x160f73,_0x44602a,_0x438b2d){return new BPromise(function(_0x26c27d,_0x491e7e){return client['request'](_0x160f73,_0x438b2d)['then'](function(_0x1a31c9){logger[_0x02c1('0xd')](_0x02c1('0xe'),_0x44602a,'request\x20sent');logger[_0x02c1('0xf')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x44602a,_0x02c1('0x10'),JSON[_0x02c1('0x11')](_0x1a31c9));if(_0x1a31c9[_0x02c1('0x12')]){if(_0x1a31c9[_0x02c1('0x12')][_0x02c1('0x13')]===0x1f4){logger[_0x02c1('0x12')](_0x02c1('0xe'),_0x44602a,_0x1a31c9[_0x02c1('0x12')][_0x02c1('0x14')]);return _0x491e7e(_0x1a31c9[_0x02c1('0x12')]['message']);}logger[_0x02c1('0x12')](_0x02c1('0xe'),_0x44602a,_0x1a31c9['error'][_0x02c1('0x14')]);return _0x26c27d(_0x1a31c9[_0x02c1('0x12')][_0x02c1('0x14')]);}else{logger[_0x02c1('0xd')]('ChatInternalMessage,\x20%s,\x20%s',_0x44602a,_0x02c1('0x10'));_0x26c27d(_0x1a31c9[_0x02c1('0x15')][_0x02c1('0x14')]);}})[_0x02c1('0x16')](function(_0x1e17d1){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x44602a,_0x1e17d1);_0x491e7e(_0x1e17d1);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index f96f45a..fc9b260 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 _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 +var _0xf874=['removeListener','register','remove','update','emit'];(function(_0x19d8d5,_0x50da50){var _0x3edb4e=function(_0x116198){while(--_0x116198){_0x19d8d5['push'](_0x19d8d5['shift']());}};_0x3edb4e(++_0x50da50);}(_0xf874,0xed));var _0x4f87=function(_0x2db40b,_0x150175){_0x2db40b=_0x2db40b-0x0;var _0xcbef95=_0xf874[_0x2db40b];return _0xcbef95;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0x4f87('0x0'),_0x4f87('0x1')];function createListener(_0x298de3,_0x3fd8d5){return function(_0x36699b){_0x3fd8d5[_0x4f87('0x2')](_0x298de3,_0x36699b);};}function removeListener(_0x5b10c6,_0x402bfc){return function(){ChatInternalMessageEvents[_0x4f87('0x3')](_0x5b10c6,_0x402bfc);};}exports[_0x4f87('0x4')]=function(_0xf0ffb3){for(var _0x104682=0x0,_0x44fea6=events['length'];_0x104682<_0x44fea6;_0x104682++){var _0x3a89e3=events[_0x104682];var _0x194853=createListener('chatInternalMessage:'+_0x3a89e3,_0xf0ffb3);ChatInternalMessageEvents['on'](_0x3a89e3,_0x194853);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 7a3d596..13f08fb 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 _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 +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(_0x489730,_0x5226b9){var _0x7855d1=function(_0x3bce57){while(--_0x3bce57){_0x489730['push'](_0x489730['shift']());}};_0x7855d1(++_0x5226b9);}(_0x70e0,0x17b));var _0x070e=function(_0x19566a,_0x4615ab){_0x19566a=_0x19566a-0x0;var _0x1b75b6=_0x70e0[_0x19566a];return _0x1b75b6;};'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 diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 9bc5d8f..a98f847 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 _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 +var _0x50f9=['sequelize','exports','medium','BOOLEAN','out','DATE','STRING'];(function(_0x2b9efa,_0x1af483){var _0x48d857=function(_0x5b6415){while(--_0x5b6415){_0x2b9efa['push'](_0x2b9efa['shift']());}};_0x48d857(++_0x1af483);}(_0x50f9,0x1ce));var _0x950f=function(_0x366547,_0x54a1e7){_0x366547=_0x366547-0x0;var _0x5ca4e5=_0x50f9[_0x366547];return _0x5ca4e5;};'use strict';var Sequelize=require(_0x950f('0x0'));module[_0x950f('0x1')]={'body':{'type':Sequelize['TEXT'](_0x950f('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x950f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x950f('0x4')),'defaultValue':_0x950f('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x950f('0x5')]},'providerName':{'type':Sequelize[_0x950f('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index ba8cb3f..a5f8248 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 _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 +var _0x0901=['fast-json-patch','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','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','show','include','find','body','params','describe','chat-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','AcceptMessage','acceptMessage','channel','EventManager','acceptmessage','parse','formData','reject','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','interface','SIP/%s','rejectmessage','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x39e164,_0x2cb93b){var _0x13fa6b=function(_0x511cb2){while(--_0x511cb2){_0x39e164['push'](_0x39e164['shift']());}};_0x13fa6b(++_0x2cb93b);}(_0x0901,0x7c));var _0x1090=function(_0x23e142,_0x3b0749){_0x23e142=_0x23e142-0x0;var _0x57937e=_0x0901[_0x23e142];return _0x57937e;};'use strict';var pdf=require(_0x1090('0x0'));var emlformat=require(_0x1090('0x1'));var rimraf=require(_0x1090('0x2'));var zipdir=require(_0x1090('0x3'));var jsonpatch=require(_0x1090('0x4'));var rp=require('request-promise');var moment=require(_0x1090('0x5'));var BPromise=require(_0x1090('0x6'));var Mustache=require('mustache');var util=require(_0x1090('0x7'));var path=require('path');var sox=require(_0x1090('0x8'));var csv=require(_0x1090('0x9'));var ejs=require(_0x1090('0xa'));var fs=require('fs');var _=require(_0x1090('0xb'));var squel=require(_0x1090('0xc'));var crypto=require(_0x1090('0xd'));var jsforce=require(_0x1090('0xe'));var deskjs=require(_0x1090('0xf'));var toCsv=require(_0x1090('0x9'));var querystring=require(_0x1090('0x10'));var Papa=require(_0x1090('0x11'));var Redis=require(_0x1090('0x12'));var authService=require(_0x1090('0x13'));var qs=require(_0x1090('0x14'));var as=require(_0x1090('0x15'));var hardwareService=require(_0x1090('0x16'));var logger=require(_0x1090('0x17'))(_0x1090('0x18'));var utils=require('../../config/utils');var config=require(_0x1090('0x19'));var licenseUtil=require(_0x1090('0x1a'));var db=require(_0x1090('0x1b'))['db'];config[_0x1090('0x1c')]=_[_0x1090('0x1d')](config[_0x1090('0x1c')],{'host':_0x1090('0x1e'),'port':0x18eb});var socket=require(_0x1090('0x1f'))(new Redis(config[_0x1090('0x1c')]));require(_0x1090('0x20'))['register'](socket);var jayson=require(_0x1090('0x21'));var client=jayson[_0x1090('0x22')][_0x1090('0x23')]({'port':0x232c});var client9002=jayson[_0x1090('0x22')][_0x1090('0x23')]({'port':0x232a});function respondWithRpcPromise(_0xf6b29e,_0x152ca2,_0x29b306,_0x375100){return new BPromise(function(_0x2b2b8c,_0xdece3b){var _0x1da7ac=_0x375100||client;return _0x1da7ac[_0x1090('0x24')](_0xf6b29e,_0x29b306)[_0x1090('0x25')](function(_0xc21c9d){logger['info'](_0x1090('0x26'),_0x152ca2,_0x1090('0x27'));logger[_0x1090('0x28')](_0x1090('0x29'),_0x152ca2,'request\x20sent',JSON['stringify'](_0xc21c9d));if(_0xc21c9d['error']){if(_0xc21c9d['error'][_0x1090('0x2a')]===0x1f4){logger['error'](_0x1090('0x26'),_0x152ca2,_0xc21c9d[_0x1090('0x2b')][_0x1090('0x2c')]);return _0xdece3b(_0xc21c9d[_0x1090('0x2b')][_0x1090('0x2c')]);}logger[_0x1090('0x2b')](_0x1090('0x26'),_0x152ca2,_0xc21c9d[_0x1090('0x2b')][_0x1090('0x2c')]);return _0x2b2b8c(_0xc21c9d['error']['message']);}else{logger[_0x1090('0x2d')]('ChatMessage,\x20%s,\x20%s',_0x152ca2,_0x1090('0x27'));_0x2b2b8c(_0xc21c9d[_0x1090('0x2e')][_0x1090('0x2c')]);}})[_0x1090('0x2f')](function(_0x1ca405){logger['error']('ChatMessage,\x20%s,\x20%s',_0x152ca2,_0x1ca405);_0xdece3b(_0x1ca405);});});}function respondWithStatusCode(_0x4da309,_0x36f76b){_0x36f76b=_0x36f76b||0xcc;return function(_0x599e76){if(_0x599e76){return _0x4da309[_0x1090('0x30')](_0x36f76b);}return _0x4da309[_0x1090('0x31')](_0x36f76b)[_0x1090('0x32')]();};}function respondWithResult(_0x2692b0,_0xa60415){_0xa60415=_0xa60415||0xc8;return function(_0x5af10b){if(_0x5af10b){return _0x2692b0[_0x1090('0x31')](_0xa60415)[_0x1090('0x33')](_0x5af10b);}};}function respondWithFilteredResult(_0x49e4af,_0x4854e8){return function(_0x1b4c18){if(_0x1b4c18){var _0xa5e16f=_0x1b4c18[_0x1090('0x34')],_0x448847=_0x4854e8[_0x1090('0x35')],_0x59441a=_0x4854e8[_0x1090('0x35')]+_0x4854e8['limit'],_0x1695c5;if(_0x59441a>=_0xa5e16f){_0x59441a=_0xa5e16f;_0x1695c5=0xc8;}else{_0x1695c5=0xce;}_0x49e4af[_0x1090('0x31')](_0x1695c5);return _0x49e4af[_0x1090('0x36')](_0x1090('0x37'),_0x448847+'-'+_0x59441a+'/'+_0xa5e16f)[_0x1090('0x33')](_0x1b4c18);}return null;};}function patchUpdates(_0x554767){return function(_0x12bd30){try{jsonpatch['apply'](_0x12bd30,_0x554767,!![]);}catch(_0x29e366){return BPromise['reject'](_0x29e366);}return _0x12bd30[_0x1090('0x38')]();};}function saveUpdates(_0x16c4f1,_0x4f3e9b){return function(_0x1f5e7b){if(_0x1f5e7b){return _0x1f5e7b[_0x1090('0x39')](_0x16c4f1)[_0x1090('0x25')](function(_0x28c495){return _0x28c495;});}return null;};}function removeEntity(_0x5f2d99,_0x14a337){return function(_0x52be11){if(_0x52be11){return _0x52be11[_0x1090('0x3a')]()[_0x1090('0x25')](function(){_0x5f2d99[_0x1090('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b3617,_0x414d27){return function(_0x5deeb1){if(!_0x5deeb1){_0x1b3617[_0x1090('0x30')](0x194);}return _0x5deeb1;};}function handleError(_0x302962,_0x574646){_0x574646=_0x574646||0x1f4;return function(_0x36614e){logger[_0x1090('0x2b')](_0x36614e[_0x1090('0x3b')]);if(_0x36614e[_0x1090('0x3c')]){delete _0x36614e[_0x1090('0x3c')];}_0x302962['status'](_0x574646)[_0x1090('0x3d')](_0x36614e);};}exports[_0x1090('0x3e')]=function(_0x49e902,_0x34afe2){var _0x12b61c={},_0x42c6ca={},_0x300c74={'count':0x0,'rows':[]};var _0x10a1ca=_[_0x1090('0x3f')](db[_0x1090('0x40')][_0x1090('0x41')],function(_0x2d831d){return{'name':_0x2d831d['fieldName'],'type':_0x2d831d[_0x1090('0x42')]['key']};});_0x42c6ca[_0x1090('0x43')]=_[_0x1090('0x3f')](_0x10a1ca,'name');_0x42c6ca['query']=_[_0x1090('0x44')](_0x49e902[_0x1090('0x45')]);_0x42c6ca[_0x1090('0x46')]=_[_0x1090('0x47')](_0x42c6ca['model'],_0x42c6ca[_0x1090('0x45')]);_0x12b61c[_0x1090('0x48')]=_[_0x1090('0x47')](_0x42c6ca[_0x1090('0x43')],qs[_0x1090('0x49')](_0x49e902['query']['fields']));_0x12b61c['attributes']=_0x12b61c[_0x1090('0x48')][_0x1090('0x4a')]?_0x12b61c['attributes']:_0x42c6ca[_0x1090('0x43')];if(!_0x49e902['query']['hasOwnProperty'](_0x1090('0x4b'))){_0x12b61c['limit']=qs[_0x1090('0x4c')](_0x49e902[_0x1090('0x45')][_0x1090('0x4c')]);_0x12b61c[_0x1090('0x35')]=qs[_0x1090('0x35')](_0x49e902[_0x1090('0x45')]['offset']);}_0x12b61c['order']=qs[_0x1090('0x4d')](_0x49e902[_0x1090('0x45')][_0x1090('0x4d')]);_0x12b61c['where']=qs['filters'](_[_0x1090('0x4e')](_0x49e902[_0x1090('0x45')],_0x42c6ca['filters']),_0x10a1ca);if(_0x49e902[_0x1090('0x45')][_0x1090('0x4f')]){_0x12b61c['where']=_[_0x1090('0x50')](_0x12b61c[_0x1090('0x51')],{'$or':_['map'](_0x10a1ca,function(_0x4c93e8){if(_0x4c93e8[_0x1090('0x42')]!==_0x1090('0x52')){var _0x7859f2={};_0x7859f2[_0x4c93e8[_0x1090('0x3c')]]={'$like':'%'+_0x49e902[_0x1090('0x45')]['filter']+'%'};return _0x7859f2;}})});}_0x12b61c=_[_0x1090('0x50')]({},_0x12b61c,_0x49e902[_0x1090('0x53')]);var _0x193e5d={'where':_0x12b61c['where']};return db['ChatMessage'][_0x1090('0x34')](_0x193e5d)[_0x1090('0x25')](function(_0x7ab0ae){_0x300c74['count']=_0x7ab0ae;if(_0x49e902[_0x1090('0x45')][_0x1090('0x54')]){_0x12b61c['include']=[{'all':!![]}];}return db[_0x1090('0x40')][_0x1090('0x55')](_0x12b61c);})[_0x1090('0x25')](function(_0x314d86){_0x300c74[_0x1090('0x56')]=_0x314d86;return _0x300c74;})[_0x1090('0x25')](respondWithFilteredResult(_0x34afe2,_0x12b61c))['catch'](handleError(_0x34afe2,null));};exports[_0x1090('0x57')]=function(_0x1d2cf1,_0x988e14){var _0x5cdc39={'raw':!![],'where':{'id':_0x1d2cf1['params']['id']}},_0x2d2008={};_0x2d2008[_0x1090('0x43')]=_[_0x1090('0x44')](db[_0x1090('0x40')][_0x1090('0x41')]);_0x2d2008[_0x1090('0x45')]=_[_0x1090('0x44')](_0x1d2cf1[_0x1090('0x45')]);_0x2d2008['filters']=_[_0x1090('0x47')](_0x2d2008['model'],_0x2d2008[_0x1090('0x45')]);_0x5cdc39['attributes']=_[_0x1090('0x47')](_0x2d2008['model'],qs[_0x1090('0x49')](_0x1d2cf1[_0x1090('0x45')]['fields']));_0x5cdc39[_0x1090('0x48')]=_0x5cdc39[_0x1090('0x48')][_0x1090('0x4a')]?_0x5cdc39['attributes']:_0x2d2008['model'];if(_0x1d2cf1[_0x1090('0x45')][_0x1090('0x54')]){_0x5cdc39[_0x1090('0x58')]=[{'all':!![]}];}_0x5cdc39=_[_0x1090('0x50')]({},_0x5cdc39,_0x1d2cf1[_0x1090('0x53')]);return db['ChatMessage'][_0x1090('0x59')](_0x5cdc39)[_0x1090('0x25')](handleEntityNotFound(_0x988e14,null))[_0x1090('0x25')](respondWithResult(_0x988e14,null))[_0x1090('0x2f')](handleError(_0x988e14,null));};exports['create']=function(_0x4da269,_0x589243){return db[_0x1090('0x40')]['create'](_0x4da269[_0x1090('0x5a')],{})[_0x1090('0x25')](respondWithResult(_0x589243,0xc9))[_0x1090('0x2f')](handleError(_0x589243,null));};exports['update']=function(_0x420527,_0x25cc4d){if(_0x420527[_0x1090('0x5a')]['id']){delete _0x420527['body']['id'];}return db[_0x1090('0x40')][_0x1090('0x59')]({'where':{'id':_0x420527[_0x1090('0x5b')]['id']}})[_0x1090('0x25')](handleEntityNotFound(_0x25cc4d,null))[_0x1090('0x25')](saveUpdates(_0x420527[_0x1090('0x5a')],null))['then'](respondWithResult(_0x25cc4d,null))['catch'](handleError(_0x25cc4d,null));};exports[_0x1090('0x3a')]=function(_0x20013e,_0x494ccf){return db['ChatMessage'][_0x1090('0x59')]({'where':{'id':_0x20013e[_0x1090('0x5b')]['id']}})[_0x1090('0x25')](handleEntityNotFound(_0x494ccf,null))['then'](removeEntity(_0x494ccf,null))[_0x1090('0x2f')](handleError(_0x494ccf,null));};exports[_0x1090('0x5c')]=function(_0x1f54a0,_0x21da6e){return db['ChatMessage'][_0x1090('0x5c')]()[_0x1090('0x25')](respondWithResult(_0x21da6e,null))[_0x1090('0x2f')](handleError(_0x21da6e,null));};var interaction_log=require(_0x1090('0x17'))(_0x1090('0x5d'));exports[_0x1090('0x5e')]=function(_0x2afa07,_0x17dfbd,_0x339d37){var _0x1432b0={'agent':{},'channel':'chat'};if(_0x2afa07[_0x1090('0x5a')]['id']){delete _0x2afa07['body']['id'];}_0x2afa07[_0x1090('0x5a')][_0x1090('0x5f')]=!![];_0x2afa07['body'][_0x1090('0x60')]=moment()[_0x1090('0x61')](_0x1090('0x62'));_0x2afa07['body']['UserId']=_0x2afa07[_0x1090('0x5a')][_0x1090('0x63')]||_0x2afa07['user']['id'];_0x1432b0[_0x1090('0x64')]['id']=_0x2afa07['body'][_0x1090('0x63')];return db[_0x1090('0x40')]['find']({'where':{'id':_0x2afa07['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x1090('0x65')}]})['then'](handleEntityNotFound(_0x17dfbd,null))[_0x1090('0x25')](saveUpdates(_0x2afa07[_0x1090('0x5a')],null))[_0x1090('0x25')](function(_0x356967){if(_0x356967){_0x1432b0[_0x1090('0x2c')]=_0x356967[_0x1090('0x66')]({'plain':!![]});return db[_0x1090('0x67')]['find']({'where':{'id':_0x356967[_0x1090('0x68')]}});}return null;})[_0x1090('0x25')](handleEntityNotFound(_0x17dfbd,null))['then'](function(_0x34a315){if(_0x34a315){return _0x34a315[_0x1090('0x39')]({'UserId':_0x2afa07[_0x1090('0x5a')][_0x1090('0x63')],'read1stAt':_[_0x1090('0x69')](_0x34a315[_0x1090('0x6a')])?moment()[_0x1090('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x1090('0x25')](function(_0x40842f){if(_0x40842f){_0x1432b0[_0x1090('0x6b')]=_0x40842f['get']({'plain':!![]});interaction_log['info'](_0x1090('0x6c'),_0x2afa07[_0x1090('0x6d')]['id'],_0x2afa07[_0x1090('0x6d')]['name'],_0x2afa07[_0x1090('0x6d')][_0x1090('0x6e')],_0x1432b0[_0x1090('0x6b')]['id'],_0x2afa07[_0x1090('0x5a')]?JSON[_0x1090('0x6f')](_0x2afa07[_0x1090('0x5a')]):'null');return respondWithRpcPromise(_0x1090('0x70'),_0x1090('0x71'),_0x1432b0);}return null;})[_0x1090('0x25')](function(_0x4fd166){if(_0x4fd166){if(_0x2afa07[_0x1090('0x5a')]['manual']){_0x1432b0['message']['interface']=util['format']('SIP/%s',_0x2afa07[_0x1090('0x6d')][_0x1090('0x3c')]);_0x1432b0[_0x1090('0x2c')][_0x1090('0x72')]=_0x1432b0['channel'];_0x1432b0[_0x1090('0x2c')]['event']=_0x1090('0x5e');return respondWithRpcPromise('EventManager',_0x1090('0x73'),{'event':_0x1090('0x74'),'message':_[_0x1090('0x50')](_0x1432b0[_0x1090('0x2c')],JSON[_0x1090('0x75')](_0x1432b0[_0x1090('0x6b')][_0x1090('0x76')]))},client9002)[_0x1090('0x25')](function(){return _0x1432b0;});}return _0x1432b0;}return null;})[_0x1090('0x25')](respondWithResult(_0x17dfbd,null))['catch'](handleError(_0x17dfbd,null));};var interaction_log=require(_0x1090('0x17'))(_0x1090('0x5d'));exports[_0x1090('0x77')]=function(_0x2a70fa,_0x4be2e0,_0x45ed58){var _0x53b945={'agent':{},'channel':_0x1090('0x78')};if(_0x2a70fa[_0x1090('0x5a')]['id']){delete _0x2a70fa[_0x1090('0x5a')]['id'];}_0x2a70fa[_0x1090('0x5a')][_0x1090('0x63')]=_0x2a70fa['body'][_0x1090('0x63')]||_0x2a70fa[_0x1090('0x6d')]['id'];_0x53b945[_0x1090('0x64')]['id']=_0x2a70fa[_0x1090('0x5a')][_0x1090('0x63')];return db['ChatMessage']['find']({'where':{'id':_0x2a70fa[_0x1090('0x5b')]['id'],'UserId':null}})[_0x1090('0x25')](handleEntityNotFound(_0x4be2e0,null))['then'](function(_0x185b25){if(_0x185b25){_0x53b945[_0x1090('0x2c')]=_0x185b25[_0x1090('0x66')]({'plain':!![]});return db[_0x1090('0x67')][_0x1090('0x59')]({'where':{'id':_0x185b25[_0x1090('0x68')]}});}return null;})[_0x1090('0x25')](handleEntityNotFound(_0x4be2e0,null))[_0x1090('0x25')](function(_0x4147e2){if(_0x4147e2){_0x53b945['interaction']=_0x4147e2[_0x1090('0x66')]({'plain':!![]});interaction_log[_0x1090('0x2d')](_0x1090('0x79'),_0x2a70fa[_0x1090('0x6d')]['id'],_0x2a70fa['user']['name'],_0x2a70fa['user']['role'],_0x53b945['interaction']['id'],_0x2a70fa[_0x1090('0x5a')]?JSON['stringify'](_0x2a70fa[_0x1090('0x5a')]):_0x1090('0x7a'));return respondWithRpcPromise(_0x1090('0x7b'),_0x1090('0x7c'),_0x53b945);}return null;})[_0x1090('0x25')](function(_0x505766){if(_0x505766){_0x505766[_0x1090('0x2c')][_0x1090('0x7d')]=util['format'](_0x1090('0x7e'),_0x2a70fa[_0x1090('0x6d')]['name']);_0x505766[_0x1090('0x2c')][_0x1090('0x72')]=_0x53b945[_0x1090('0x72')];_0x505766['message']['event']=_0x1090('0x77');respondWithRpcPromise(_0x1090('0x73'),_0x1090('0x73'),{'event':_0x1090('0x7f'),'message':_0x505766[_0x1090('0x2c')]},client9002);return _0x53b945;}return null;})['then'](respondWithResult(_0x4be2e0,null))[_0x1090('0x2f')](handleError(_0x4be2e0,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 220bb37..4cd8300 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 _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 +var _0xc9c3=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1d19d8,_0x2239e1){var _0x33a1d3=function(_0x152ed4){while(--_0x152ed4){_0x1d19d8['push'](_0x1d19d8['shift']());}};_0x33a1d3(++_0x2239e1);}(_0xc9c3,0xbe));var _0x3c9c=function(_0x27d8b3,_0xb73b0c){_0x27d8b3=_0x27d8b3-0x0;var _0x2c7ccb=_0xc9c3[_0x27d8b3];return _0x2c7ccb;};'use strict';var EventEmitter=require(_0x3c9c('0x0'));var ChatMessage=require(_0x3c9c('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x3c9c('0x2')](0x0);var events={'afterCreate':_0x3c9c('0x3'),'afterUpdate':_0x3c9c('0x4'),'afterDestroy':_0x3c9c('0x5')};function emitEvent(_0x421a83){return function(_0x46ed8f,_0x3ff900,_0x32f529){ChatMessageEvents[_0x3c9c('0x6')](_0x421a83+':'+_0x46ed8f['id'],_0x46ed8f);ChatMessageEvents['emit'](_0x421a83,_0x46ed8f);_0x32f529(null);};}for(var e in events){if(events[_0x3c9c('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x3c9c('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 fd2ce5f..01aa9b6 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 _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 +var _0xae26=['catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','exports','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','isNil','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt'];(function(_0x1a4014,_0x47ccba){var _0xa502fa=function(_0xe61de3){while(--_0xe61de3){_0x1a4014['push'](_0x1a4014['shift']());}};_0xa502fa(++_0x47ccba);}(_0xae26,0x111));var _0x6ae2=function(_0x291830,_0x386bb0){_0x291830=_0x291830-0x0;var _0x4713e2=_0xae26[_0x291830];return _0x4713e2;};'use strict';var _=require(_0x6ae2('0x0'));var util=require(_0x6ae2('0x1'));var logger=require(_0x6ae2('0x2'))(_0x6ae2('0x3'));var moment=require('moment');var BPromise=require(_0x6ae2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ae2('0x5'));var rimraf=require(_0x6ae2('0x6'));var config=require(_0x6ae2('0x7'));var attributes=require(_0x6ae2('0x8'));module[_0x6ae2('0x9')]=function(_0x245fc0,_0x488a80){return _0x245fc0['define']('ChatMessage',attributes,{'tableName':_0x6ae2('0xa'),'paranoid':![],'indexes':[{'name':_0x6ae2('0xb'),'fields':[_0x6ae2('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x20d7b0,_0x1f1dbf,_0xc0b56d){var _0x4c6d9e=_0x245fc0[_0x6ae2('0xd')];var _0x5d88d7=_0x20d7b0[_0x6ae2('0xe')]({'plain':!![]});if(_0x5d88d7[_0x6ae2('0xf')][_0x6ae2('0x10')]()==='in'||_0x5d88d7['direction'][_0x6ae2('0x10')]()==='out'&&!_0x5d88d7['secret']&&!_[_0x6ae2('0x11')](_0x5d88d7['UserId'])){_0x4c6d9e[_0x6ae2('0x12')][_0x6ae2('0x13')]({'where':{'id':_0x5d88d7[_0x6ae2('0x14')]}})[_0x6ae2('0x15')](function(_0x47ab72){if(_0x47ab72){_0x47ab72[_0x6ae2('0x16')]({'lastMsgAt':_0x5d88d7[_0x6ae2('0x17')],'lastMsgDirection':_0x5d88d7[_0x6ae2('0xf')][_0x6ae2('0x10')]()});}})[_0x6ae2('0x18')](function(_0x1cd108){console['error'](_0x1cd108);});}_0xc0b56d();}},'charset':_0x6ae2('0x19'),'collate':_0x6ae2('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index d86be03..bc7b587 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 _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 +var _0x6990=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','ChatMessage,\x20%s,\x20%s','error','message','info','request\x20sent','result','catch','create','body','options','raw','CreateChatMessage','stringify','moment','randomstring'];(function(_0x155382,_0x42defb){var _0x33aac2=function(_0x23a349){while(--_0x23a349){_0x155382['push'](_0x155382['shift']());}};_0x33aac2(++_0x42defb);}(_0x6990,0x186));var _0x0699=function(_0x518847,_0x482287){_0x518847=_0x518847-0x0;var _0x5089c4=_0x6990[_0x518847];return _0x5089c4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0699('0x0'));var BPromise=require('bluebird');var rs=require(_0x0699('0x1'));var fs=require('fs');var Redis=require(_0x0699('0x2'));var db=require(_0x0699('0x3'))['db'];var utils=require(_0x0699('0x4'));var logger=require('../../config/logger')(_0x0699('0x5'));var config=require('../../config/environment');var jayson=require(_0x0699('0x6'));var client=jayson['client'][_0x0699('0x7')]({'port':0x232a});config[_0x0699('0x8')]=_[_0x0699('0x9')](config[_0x0699('0x8')],{'host':_0x0699('0xa'),'port':0x18eb});var socket=require(_0x0699('0xb'))(new Redis(config[_0x0699('0x8')]));require('./chatMessage.socket')[_0x0699('0xc')](socket);function respondWithRpcPromise(_0x314935,_0x3c5661,_0x3de9f9){return new BPromise(function(_0x4d7035,_0x57b397){return client[_0x0699('0xd')](_0x314935,_0x3de9f9)[_0x0699('0xe')](function(_0x4d0929){logger['info'](_0x0699('0xf'),_0x3c5661,'request\x20sent');logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3c5661,'request\x20sent',JSON['stringify'](_0x4d0929));if(_0x4d0929[_0x0699('0x10')]){if(_0x4d0929[_0x0699('0x10')]['code']===0x1f4){logger['error'](_0x0699('0xf'),_0x3c5661,_0x4d0929[_0x0699('0x10')]['message']);return _0x57b397(_0x4d0929['error']['message']);}logger[_0x0699('0x10')](_0x0699('0xf'),_0x3c5661,_0x4d0929[_0x0699('0x10')][_0x0699('0x11')]);return _0x4d7035(_0x4d0929[_0x0699('0x10')]['message']);}else{logger[_0x0699('0x12')]('ChatMessage,\x20%s,\x20%s',_0x3c5661,_0x0699('0x13'));_0x4d7035(_0x4d0929[_0x0699('0x14')][_0x0699('0x11')]);}})[_0x0699('0x15')](function(_0x54b7ba){logger[_0x0699('0x10')]('ChatMessage,\x20%s,\x20%s',_0x3c5661,_0x54b7ba);_0x57b397(_0x54b7ba);});});}exports['CreateChatMessage']=function(_0x54e585){var _0x2343d8=this;return new Promise(function(_0x4181b8,_0x10ba1d){return db['ChatMessage'][_0x0699('0x16')](_0x54e585[_0x0699('0x17')],{'raw':_0x54e585[_0x0699('0x18')]?_0x54e585['options'][_0x0699('0x19')]===undefined?!![]:![]:!![]})[_0x0699('0xe')](function(_0x3149ff){logger[_0x0699('0x12')](_0x0699('0x1a'),_0x54e585);logger['debug']('CreateChatMessage',_0x54e585,JSON[_0x0699('0x1b')](_0x3149ff));_0x4181b8(_0x3149ff);})['catch'](function(_0x465f3e){logger[_0x0699('0x10')](_0x0699('0x1a'),_0x465f3e[_0x0699('0x11')],_0x54e585);_0x10ba1d(_0x2343d8[_0x0699('0x10')](0x1f4,_0x465f3e['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 9346fff..2a53638 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 _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 +var _0x90b1=['save','remove','emit','length','chatMessage:','./chatMessage.events'];(function(_0x55ab4d,_0x23c88d){var _0x173566=function(_0xcdee8a){while(--_0xcdee8a){_0x55ab4d['push'](_0x55ab4d['shift']());}};_0x173566(++_0x23c88d);}(_0x90b1,0x1bb));var _0x190b=function(_0x5d008b,_0x12b7b2){_0x5d008b=_0x5d008b-0x0;var _0x381807=_0x90b1[_0x5d008b];return _0x381807;};'use strict';var ChatMessageEvents=require(_0x190b('0x0'));var events=[_0x190b('0x1'),_0x190b('0x2'),'update'];function createListener(_0x487731,_0x1e5984){return function(_0x44ca85){_0x1e5984[_0x190b('0x3')](_0x487731,_0x44ca85);};}function removeListener(_0x120ddc,_0x4fbcad){return function(){ChatMessageEvents['removeListener'](_0x120ddc,_0x4fbcad);};}exports['register']=function(_0x5da9c1){for(var _0x27ff8c=0x0,_0x34a689=events[_0x190b('0x4')];_0x27ff8c<_0x34a689;_0x27ff8c++){var _0x626aa1=events[_0x27ff8c];var _0x311161=createListener(_0x190b('0x5')+_0x626aa1,_0x5da9c1);ChatMessageEvents['on'](_0x626aa1,_0x311161);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 92a80ea..51021b8 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 _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 +var _0xd85f=['destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','describe','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','/:id'];(function(_0x256ab5,_0xf48d8c){var _0x2d2dd7=function(_0x1d0af5){while(--_0x1d0af5){_0x256ab5['push'](_0x256ab5['shift']());}};_0x2d2dd7(++_0xf48d8c);}(_0xd85f,0x1c4));var _0xfd85=function(_0x76e88e,_0x4058cd){_0x76e88e=_0x76e88e-0x0;var _0x1a0b45=_0xd85f[_0x76e88e];return _0x1a0b45;};'use strict';var multer=require(_0xfd85('0x0'));var util=require(_0xfd85('0x1'));var path=require(_0xfd85('0x2'));var timeout=require(_0xfd85('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfd85('0x4'));var config=require(_0xfd85('0x5'));var controller=require(_0xfd85('0x6'));router[_0xfd85('0x7')]('/',auth[_0xfd85('0x8')](),controller[_0xfd85('0x9')]);router[_0xfd85('0x7')]('/describe',auth[_0xfd85('0x8')](),controller[_0xfd85('0xa')]);router[_0xfd85('0x7')]('/:id',auth[_0xfd85('0x8')](),controller['show']);router[_0xfd85('0xb')]('/',auth[_0xfd85('0x8')](),interaction[_0xfd85('0xc')](_0xfd85('0xd'),_0xfd85('0xe')),controller[_0xfd85('0xf')]);router[_0xfd85('0x10')]('/:id',controller[_0xfd85('0x11')]);router['put'](_0xfd85('0x12'),auth[_0xfd85('0x8')](),controller[_0xfd85('0x13')]);router[_0xfd85('0x10')](_0xfd85('0x14'),auth[_0xfd85('0x8')](),controller['reject']);router[_0xfd85('0x15')](_0xfd85('0x16'),auth[_0xfd85('0x8')](),controller[_0xfd85('0x17')]);module[_0xfd85('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 2f4001d..56b0ac6 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 _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 +var _0x279c=['exports','medium'];(function(_0x1499c4,_0x57c5c3){var _0x3cf45a=function(_0x4bb7cb){while(--_0x4bb7cb){_0x1499c4['push'](_0x1499c4['shift']());}};_0x3cf45a(++_0x57c5c3);}(_0x279c,0x1de));var _0xc279=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x279c[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require('sequelize');module[_0xc279('0x0')]={'body':{'type':Sequelize['TEXT'](_0xc279('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 5cd4cc3..f32a6d2 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 _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 +var _0x0b37=['fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatOfflineMessage','fieldName','type','model','keys','query','filters','intersection','attributes'];(function(_0x401db5,_0x513be2){var _0xe70993=function(_0x539381){while(--_0x539381){_0x401db5['push'](_0x401db5['shift']());}};_0xe70993(++_0x513be2);}(_0x0b37,0x1d7));var _0x70b3=function(_0x40a7e6,_0x286c40){_0x40a7e6=_0x40a7e6-0x0;var _0xddf317=_0x0b37[_0x40a7e6];return _0xddf317;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x70b3('0x0'));var rimraf=require(_0x70b3('0x1'));var zipdir=require(_0x70b3('0x2'));var jsonpatch=require(_0x70b3('0x3'));var rp=require('request-promise');var moment=require(_0x70b3('0x4'));var BPromise=require(_0x70b3('0x5'));var Mustache=require(_0x70b3('0x6'));var util=require(_0x70b3('0x7'));var path=require(_0x70b3('0x8'));var sox=require(_0x70b3('0x9'));var csv=require('to-csv');var ejs=require(_0x70b3('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x70b3('0xb'));var crypto=require(_0x70b3('0xc'));var jsforce=require(_0x70b3('0xd'));var deskjs=require(_0x70b3('0xe'));var toCsv=require(_0x70b3('0xf'));var querystring=require('querystring');var Papa=require(_0x70b3('0x10'));var Redis=require('ioredis');var authService=require(_0x70b3('0x11'));var qs=require(_0x70b3('0x12'));var as=require(_0x70b3('0x13'));var hardwareService=require(_0x70b3('0x14'));var logger=require(_0x70b3('0x15'))('api');var utils=require(_0x70b3('0x16'));var config=require(_0x70b3('0x17'));var licenseUtil=require(_0x70b3('0x18'));var db=require(_0x70b3('0x19'))['db'];function respondWithStatusCode(_0x419c0b,_0xe0df0c){_0xe0df0c=_0xe0df0c||0xcc;return function(_0x306244){if(_0x306244){return _0x419c0b['sendStatus'](_0xe0df0c);}return _0x419c0b['status'](_0xe0df0c)[_0x70b3('0x1a')]();};}function respondWithResult(_0x5b9c4a,_0x3c035d){_0x3c035d=_0x3c035d||0xc8;return function(_0x23dddd){if(_0x23dddd){return _0x5b9c4a[_0x70b3('0x1b')](_0x3c035d)[_0x70b3('0x1c')](_0x23dddd);}};}function respondWithFilteredResult(_0x357a7a,_0x42bcd2){return function(_0x182819){if(_0x182819){var _0x33acbd=_0x182819[_0x70b3('0x1d')],_0x363007=_0x42bcd2[_0x70b3('0x1e')],_0x58cf8f=_0x42bcd2['offset']+_0x42bcd2[_0x70b3('0x1f')],_0x22a017;if(_0x58cf8f>=_0x33acbd){_0x58cf8f=_0x33acbd;_0x22a017=0xc8;}else{_0x22a017=0xce;}_0x357a7a[_0x70b3('0x1b')](_0x22a017);return _0x357a7a[_0x70b3('0x20')]('Content-Range',_0x363007+'-'+_0x58cf8f+'/'+_0x33acbd)['json'](_0x182819);}return null;};}function patchUpdates(_0x4b512f){return function(_0x339407){try{jsonpatch['apply'](_0x339407,_0x4b512f,!![]);}catch(_0x4828ae){return BPromise[_0x70b3('0x21')](_0x4828ae);}return _0x339407[_0x70b3('0x22')]();};}function saveUpdates(_0x22db68,_0x4cf2c3){return function(_0x3d38c5){if(_0x3d38c5){return _0x3d38c5[_0x70b3('0x23')](_0x22db68)[_0x70b3('0x24')](function(_0x23c7f6){return _0x23c7f6;});}return null;};}function removeEntity(_0x37ee57,_0x183481){return function(_0x51faf8){if(_0x51faf8){return _0x51faf8[_0x70b3('0x25')]()[_0x70b3('0x24')](function(){_0x37ee57['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x336d7d,_0xa530ab){return function(_0x1b7c6c){if(!_0x1b7c6c){_0x336d7d[_0x70b3('0x26')](0x194);}return _0x1b7c6c;};}function handleError(_0x4f15d3,_0x530d7d){_0x530d7d=_0x530d7d||0x1f4;return function(_0x2c6682){logger[_0x70b3('0x27')](_0x2c6682[_0x70b3('0x28')]);if(_0x2c6682['name']){delete _0x2c6682[_0x70b3('0x29')];}_0x4f15d3[_0x70b3('0x1b')](_0x530d7d)[_0x70b3('0x2a')](_0x2c6682);};}exports[_0x70b3('0x2b')]=function(_0x26b2b3,_0x44a25f){var _0x1c1fc0={},_0x4ed57b={},_0x14b6a5={'count':0x0,'rows':[]};var _0x1b9727=_[_0x70b3('0x2c')](db[_0x70b3('0x2d')]['rawAttributes'],function(_0x41204e){return{'name':_0x41204e[_0x70b3('0x2e')],'type':_0x41204e[_0x70b3('0x2f')]['key']};});_0x4ed57b[_0x70b3('0x30')]=_['map'](_0x1b9727,_0x70b3('0x29'));_0x4ed57b['query']=_[_0x70b3('0x31')](_0x26b2b3[_0x70b3('0x32')]);_0x4ed57b[_0x70b3('0x33')]=_[_0x70b3('0x34')](_0x4ed57b['model'],_0x4ed57b['query']);_0x1c1fc0[_0x70b3('0x35')]=_[_0x70b3('0x34')](_0x4ed57b['model'],qs[_0x70b3('0x36')](_0x26b2b3[_0x70b3('0x32')][_0x70b3('0x36')]));_0x1c1fc0[_0x70b3('0x35')]=_0x1c1fc0[_0x70b3('0x35')][_0x70b3('0x37')]?_0x1c1fc0[_0x70b3('0x35')]:_0x4ed57b[_0x70b3('0x30')];if(!_0x26b2b3[_0x70b3('0x32')]['hasOwnProperty']('nolimit')){_0x1c1fc0['limit']=qs['limit'](_0x26b2b3[_0x70b3('0x32')][_0x70b3('0x1f')]);_0x1c1fc0[_0x70b3('0x1e')]=qs[_0x70b3('0x1e')](_0x26b2b3[_0x70b3('0x32')][_0x70b3('0x1e')]);}_0x1c1fc0[_0x70b3('0x38')]=qs['sort'](_0x26b2b3['query'][_0x70b3('0x39')]);_0x1c1fc0[_0x70b3('0x3a')]=qs['filters'](_[_0x70b3('0x3b')](_0x26b2b3[_0x70b3('0x32')],_0x4ed57b[_0x70b3('0x33')]),_0x1b9727);if(_0x26b2b3[_0x70b3('0x32')][_0x70b3('0x3c')]){_0x1c1fc0['where']=_[_0x70b3('0x3d')](_0x1c1fc0[_0x70b3('0x3a')],{'$or':_['map'](_0x1b9727,function(_0x3ce3ba){if(_0x3ce3ba[_0x70b3('0x2f')]!==_0x70b3('0x3e')){var _0xd5b951={};_0xd5b951[_0x3ce3ba[_0x70b3('0x29')]]={'$like':'%'+_0x26b2b3['query'][_0x70b3('0x3c')]+'%'};return _0xd5b951;}})});}_0x1c1fc0=_[_0x70b3('0x3d')]({},_0x1c1fc0,_0x26b2b3['options']);var _0x4635cb={'where':_0x1c1fc0[_0x70b3('0x3a')]};return db['ChatOfflineMessage']['count'](_0x4635cb)[_0x70b3('0x24')](function(_0x4b8928){_0x14b6a5[_0x70b3('0x1d')]=_0x4b8928;if(_0x26b2b3[_0x70b3('0x32')][_0x70b3('0x3f')]){_0x1c1fc0['include']=[{'all':!![]}];}return db[_0x70b3('0x2d')][_0x70b3('0x40')](_0x1c1fc0);})[_0x70b3('0x24')](function(_0x454de6){_0x14b6a5[_0x70b3('0x41')]=_0x454de6;return _0x14b6a5;})[_0x70b3('0x24')](respondWithFilteredResult(_0x44a25f,_0x1c1fc0))['catch'](handleError(_0x44a25f,null));};exports[_0x70b3('0x42')]=function(_0x4cbcb4,_0x56a88e){var _0x49f6b6={'raw':!![],'where':{'id':_0x4cbcb4[_0x70b3('0x43')]['id']}},_0x22b2c6={};_0x22b2c6['model']=_[_0x70b3('0x31')](db[_0x70b3('0x2d')][_0x70b3('0x44')]);_0x22b2c6['query']=_[_0x70b3('0x31')](_0x4cbcb4['query']);_0x22b2c6['filters']=_[_0x70b3('0x34')](_0x22b2c6[_0x70b3('0x30')],_0x22b2c6[_0x70b3('0x32')]);_0x49f6b6['attributes']=_[_0x70b3('0x34')](_0x22b2c6[_0x70b3('0x30')],qs[_0x70b3('0x36')](_0x4cbcb4[_0x70b3('0x32')]['fields']));_0x49f6b6[_0x70b3('0x35')]=_0x49f6b6[_0x70b3('0x35')][_0x70b3('0x37')]?_0x49f6b6[_0x70b3('0x35')]:_0x22b2c6[_0x70b3('0x30')];if(_0x4cbcb4['query'][_0x70b3('0x3f')]){_0x49f6b6['include']=[{'all':!![]}];}_0x49f6b6=_[_0x70b3('0x3d')]({},_0x49f6b6,_0x4cbcb4[_0x70b3('0x45')]);return db['ChatOfflineMessage'][_0x70b3('0x46')](_0x49f6b6)['then'](handleEntityNotFound(_0x56a88e,null))[_0x70b3('0x24')](respondWithResult(_0x56a88e,null))[_0x70b3('0x47')](handleError(_0x56a88e,null));};exports[_0x70b3('0x48')]=function(_0x1e9482,_0x2ed44a){return db['ChatOfflineMessage'][_0x70b3('0x48')](_0x1e9482[_0x70b3('0x49')],{})[_0x70b3('0x24')](respondWithResult(_0x2ed44a,0xc9))[_0x70b3('0x47')](handleError(_0x2ed44a,null));};exports[_0x70b3('0x23')]=function(_0x44b6ab,_0x20ca14){if(_0x44b6ab[_0x70b3('0x49')]['id']){delete _0x44b6ab[_0x70b3('0x49')]['id'];}return db[_0x70b3('0x2d')][_0x70b3('0x46')]({'where':{'id':_0x44b6ab[_0x70b3('0x43')]['id']}})[_0x70b3('0x24')](handleEntityNotFound(_0x20ca14,null))[_0x70b3('0x24')](saveUpdates(_0x44b6ab[_0x70b3('0x49')],null))[_0x70b3('0x24')](respondWithResult(_0x20ca14,null))['catch'](handleError(_0x20ca14,null));};exports[_0x70b3('0x25')]=function(_0xfb50aa,_0x329f99){return db[_0x70b3('0x2d')][_0x70b3('0x46')]({'where':{'id':_0xfb50aa[_0x70b3('0x43')]['id']}})[_0x70b3('0x24')](handleEntityNotFound(_0x329f99,null))[_0x70b3('0x24')](removeEntity(_0x329f99,null))[_0x70b3('0x47')](handleError(_0x329f99,null));};exports['describe']=function(_0x38dcba,_0x1deec1){return db[_0x70b3('0x2d')][_0x70b3('0x4a')]()[_0x70b3('0x24')](respondWithResult(_0x1deec1,null))[_0x70b3('0x47')](handleError(_0x1deec1,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index eba9be5..10f11e2 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 _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 +var _0xcea2=['rimraf','../../config/environment','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x4e2198,_0x399d54){var _0x22fdd7=function(_0x2fc7d0){while(--_0x2fc7d0){_0x4e2198['push'](_0x4e2198['shift']());}};_0x22fdd7(++_0x399d54);}(_0xcea2,0x15a));var _0x2cea=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xcea2[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x2cea('0x0'));var util=require('util');var logger=require(_0x2cea('0x1'))('api');var moment=require(_0x2cea('0x2'));var BPromise=require(_0x2cea('0x3'));var rp=require(_0x2cea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var attributes=require(_0x2cea('0x7'));module['exports']=function(_0x34f0f2,_0x485c26){return _0x34f0f2[_0x2cea('0x8')](_0x2cea('0x9'),attributes,{'tableName':_0x2cea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2cea('0xb'),'collate':_0x2cea('0xc')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 25073da..a5c06a3 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 _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 +var _0xbd92=['then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xbd92,0x1ed));var _0x2bd9=function(_0x1f854e,_0x22eaa9){_0x1f854e=_0x1f854e-0x0;var _0x5a64ed=_0xbd92[_0x1f854e];return _0x5a64ed;};'use strict';var _=require('lodash');var util=require(_0x2bd9('0x0'));var moment=require(_0x2bd9('0x1'));var BPromise=require(_0x2bd9('0x2'));var rs=require(_0x2bd9('0x3'));var fs=require('fs');var Redis=require(_0x2bd9('0x4'));var db=require(_0x2bd9('0x5'))['db'];var utils=require(_0x2bd9('0x6'));var logger=require(_0x2bd9('0x7'))(_0x2bd9('0x8'));var config=require(_0x2bd9('0x9'));var jayson=require(_0x2bd9('0xa'));var client=jayson[_0x2bd9('0xb')][_0x2bd9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x223e89,_0x4a6b62,_0x5c2ce3){return new BPromise(function(_0x584a63,_0x57d700){return client['request'](_0x223e89,_0x5c2ce3)[_0x2bd9('0xd')](function(_0x194040){logger['info'](_0x2bd9('0xe'),_0x4a6b62,_0x2bd9('0xf'));logger[_0x2bd9('0x10')](_0x2bd9('0x11'),_0x4a6b62,_0x2bd9('0xf'),JSON[_0x2bd9('0x12')](_0x194040));if(_0x194040[_0x2bd9('0x13')]){if(_0x194040['error']['code']===0x1f4){logger['error'](_0x2bd9('0xe'),_0x4a6b62,_0x194040[_0x2bd9('0x13')]['message']);return _0x57d700(_0x194040[_0x2bd9('0x13')]['message']);}logger[_0x2bd9('0x13')](_0x2bd9('0xe'),_0x4a6b62,_0x194040['error'][_0x2bd9('0x14')]);return _0x584a63(_0x194040['error'][_0x2bd9('0x14')]);}else{logger['info'](_0x2bd9('0xe'),_0x4a6b62,'request\x20sent');_0x584a63(_0x194040[_0x2bd9('0x15')][_0x2bd9('0x14')]);}})['catch'](function(_0xc7eb79){logger[_0x2bd9('0x13')](_0x2bd9('0xe'),_0x4a6b62,_0xc7eb79);_0x57d700(_0xc7eb79);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 4793be8..66903ec 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 _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 +var _0x92ce=['show','post','put','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5230ed,_0x2eb03e){var _0x43bb42=function(_0x407331){while(--_0x407331){_0x5230ed['push'](_0x5230ed['shift']());}};_0x43bb42(++_0x2eb03e);}(_0x92ce,0xcb));var _0xe92c=function(_0x803404,_0xb37f66){_0x803404=_0x803404-0x0;var _0x397a4e=_0x92ce[_0x803404];return _0x397a4e;};'use strict';var multer=require(_0xe92c('0x0'));var util=require(_0xe92c('0x1'));var path=require(_0xe92c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe92c('0x3')]();var auth=require(_0xe92c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe92c('0x5'));var controller=require(_0xe92c('0x6'));router[_0xe92c('0x7')]('/',auth[_0xe92c('0x8')](),controller[_0xe92c('0x9')]);router[_0xe92c('0x7')](_0xe92c('0xa'),auth[_0xe92c('0x8')](),controller[_0xe92c('0xb')]);router[_0xe92c('0x7')](_0xe92c('0xc'),auth[_0xe92c('0x8')](),controller[_0xe92c('0xd')]);router[_0xe92c('0xe')]('/',auth[_0xe92c('0x8')](),controller['create']);router[_0xe92c('0xf')](_0xe92c('0xc'),auth[_0xe92c('0x8')](),controller['update']);router['delete']('/:id',auth[_0xe92c('0x8')](),controller[_0xe92c('0x10')]);module[_0xe92c('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 2d0d905..35db528 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 _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 +var _0xe709=['timeout','INTEGER','STRING','ENUM','mouseOver'];(function(_0x7d46b8,_0x1f01c0){var _0x559072=function(_0xd878f7){while(--_0xd878f7){_0x7d46b8['push'](_0x7d46b8['shift']());}};_0x559072(++_0x1f01c0);}(_0xe709,0x11f));var _0x9e70=function(_0x2915cb,_0x2fb7c7){_0x2915cb=_0x2915cb-0x0;var _0xfbcdf9=_0xe709[_0x2915cb];return _0xfbcdf9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9e70('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x9e70('0x1')](_0x9e70('0x2'),_0x9e70('0x3')),'defaultValue':_0x9e70('0x2')},'selector':{'type':Sequelize[_0x9e70('0x0')]},'timeout':{'type':Sequelize[_0x9e70('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 9d7d1b7..7dca910 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 _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 +var _0xd7ee=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','show','model','keys','ChatProactiveAction','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse'];(function(_0x43cee2,_0x4fe8c4){var _0x1538eb=function(_0x10d228){while(--_0x10d228){_0x43cee2['push'](_0x43cee2['shift']());}};_0x1538eb(++_0x4fe8c4);}(_0xd7ee,0x16a));var _0xed7e=function(_0x29a08d,_0x551eca){_0x29a08d=_0x29a08d-0x0;var _0x10fc1a=_0xd7ee[_0x29a08d];return _0x10fc1a;};'use strict';var pdf=require(_0xed7e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xed7e('0x1'));var zipdir=require(_0xed7e('0x2'));var jsonpatch=require(_0xed7e('0x3'));var rp=require('request-promise');var moment=require(_0xed7e('0x4'));var BPromise=require(_0xed7e('0x5'));var Mustache=require(_0xed7e('0x6'));var util=require(_0xed7e('0x7'));var path=require(_0xed7e('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xed7e('0x9'));var fs=require('fs');var _=require(_0xed7e('0xa'));var squel=require('squel');var crypto=require(_0xed7e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xed7e('0xc'));var toCsv=require(_0xed7e('0xd'));var querystring=require(_0xed7e('0xe'));var Papa=require(_0xed7e('0xf'));var Redis=require(_0xed7e('0x10'));var authService=require(_0xed7e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xed7e('0x12'));var hardwareService=require(_0xed7e('0x13'));var logger=require(_0xed7e('0x14'))(_0xed7e('0x15'));var utils=require(_0xed7e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xed7e('0x17'));var db=require(_0xed7e('0x18'))['db'];function respondWithStatusCode(_0x35c7ff,_0x43809c){_0x43809c=_0x43809c||0xcc;return function(_0x2a1844){if(_0x2a1844){return _0x35c7ff['sendStatus'](_0x43809c);}return _0x35c7ff[_0xed7e('0x19')](_0x43809c)['end']();};}function respondWithResult(_0x408f5c,_0x5398c6){_0x5398c6=_0x5398c6||0xc8;return function(_0x27b523){if(_0x27b523){return _0x408f5c['status'](_0x5398c6)['json'](_0x27b523);}};}function respondWithFilteredResult(_0x44609b,_0x544336){return function(_0x2ca8f6){if(_0x2ca8f6){var _0x14ddb3=_0x2ca8f6[_0xed7e('0x1a')],_0x58576f=_0x544336[_0xed7e('0x1b')],_0x25dc01=_0x544336[_0xed7e('0x1b')]+_0x544336[_0xed7e('0x1c')],_0x2f4197;if(_0x25dc01>=_0x14ddb3){_0x25dc01=_0x14ddb3;_0x2f4197=0xc8;}else{_0x2f4197=0xce;}_0x44609b[_0xed7e('0x19')](_0x2f4197);return _0x44609b[_0xed7e('0x1d')](_0xed7e('0x1e'),_0x58576f+'-'+_0x25dc01+'/'+_0x14ddb3)[_0xed7e('0x1f')](_0x2ca8f6);}return null;};}function patchUpdates(_0x25dacb){return function(_0x5be69f){try{jsonpatch[_0xed7e('0x20')](_0x5be69f,_0x25dacb,!![]);}catch(_0x560da4){return BPromise[_0xed7e('0x21')](_0x560da4);}return _0x5be69f[_0xed7e('0x22')]();};}function saveUpdates(_0x1f5e95,_0x143e16){return function(_0xf4ff88){if(_0xf4ff88){return _0xf4ff88[_0xed7e('0x23')](_0x1f5e95)[_0xed7e('0x24')](function(_0x2bf920){return _0x2bf920;});}return null;};}function removeEntity(_0x41bea0,_0x3eb96a){return function(_0x4cab91){if(_0x4cab91){return _0x4cab91[_0xed7e('0x25')]()[_0xed7e('0x24')](function(){_0x41bea0[_0xed7e('0x19')](0xcc)[_0xed7e('0x26')]();});}};}function handleEntityNotFound(_0x43f7e4,_0xbc8c04){return function(_0x830e64){if(!_0x830e64){_0x43f7e4[_0xed7e('0x27')](0x194);}return _0x830e64;};}function handleError(_0x53ac84,_0x2010cb){_0x2010cb=_0x2010cb||0x1f4;return function(_0x2e9db9){logger[_0xed7e('0x28')](_0x2e9db9[_0xed7e('0x29')]);if(_0x2e9db9[_0xed7e('0x2a')]){delete _0x2e9db9[_0xed7e('0x2a')];}_0x53ac84['status'](_0x2010cb)[_0xed7e('0x2b')](_0x2e9db9);};}exports[_0xed7e('0x2c')]=function(_0x2fd3ef,_0x50bedb){var _0x1745f7={'raw':!![],'where':{'id':_0x2fd3ef['params']['id']}},_0x303b3c={};_0x303b3c[_0xed7e('0x2d')]=_[_0xed7e('0x2e')](db[_0xed7e('0x2f')]['rawAttributes']);_0x303b3c[_0xed7e('0x30')]=_[_0xed7e('0x2e')](_0x2fd3ef[_0xed7e('0x30')]);_0x303b3c[_0xed7e('0x31')]=_['intersection'](_0x303b3c[_0xed7e('0x2d')],_0x303b3c[_0xed7e('0x30')]);_0x1745f7[_0xed7e('0x32')]=_[_0xed7e('0x33')](_0x303b3c[_0xed7e('0x2d')],qs['fields'](_0x2fd3ef['query'][_0xed7e('0x34')]));_0x1745f7[_0xed7e('0x32')]=_0x1745f7[_0xed7e('0x32')][_0xed7e('0x35')]?_0x1745f7[_0xed7e('0x32')]:_0x303b3c[_0xed7e('0x2d')];if(_0x2fd3ef['query'][_0xed7e('0x36')]){_0x1745f7[_0xed7e('0x37')]=[{'all':!![]}];}_0x1745f7=_[_0xed7e('0x38')]({},_0x1745f7,_0x2fd3ef[_0xed7e('0x39')]);return db['ChatProactiveAction'][_0xed7e('0x3a')](_0x1745f7)[_0xed7e('0x24')](handleEntityNotFound(_0x50bedb,null))[_0xed7e('0x24')](respondWithResult(_0x50bedb,null))[_0xed7e('0x3b')](handleError(_0x50bedb,null));};exports[_0xed7e('0x3c')]=function(_0x1881ec,_0x1d0a1c){return db[_0xed7e('0x2f')][_0xed7e('0x3c')](_0x1881ec[_0xed7e('0x3d')],{})['then'](respondWithResult(_0x1d0a1c,0xc9))[_0xed7e('0x3b')](handleError(_0x1d0a1c,null));};exports['update']=function(_0xd309ae,_0x10e66c){if(_0xd309ae[_0xed7e('0x3d')]['id']){delete _0xd309ae[_0xed7e('0x3d')]['id'];}return db[_0xed7e('0x2f')][_0xed7e('0x3a')]({'where':{'id':_0xd309ae['params']['id']}})[_0xed7e('0x24')](handleEntityNotFound(_0x10e66c,null))['then'](saveUpdates(_0xd309ae[_0xed7e('0x3d')],null))[_0xed7e('0x24')](respondWithResult(_0x10e66c,null))[_0xed7e('0x3b')](handleError(_0x10e66c,null));};exports[_0xed7e('0x25')]=function(_0x424b08,_0xbf6140){return db[_0xed7e('0x2f')][_0xed7e('0x3a')]({'where':{'id':_0x424b08[_0xed7e('0x3e')]['id']}})['then'](handleEntityNotFound(_0xbf6140,null))['then'](removeEntity(_0xbf6140,null))[_0xed7e('0x3b')](handleError(_0xbf6140,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 3461ccb..af14d02 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 _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 +var _0xa87f=['path','rimraf','../../config/environment','exports','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment','bluebird'];(function(_0x354164,_0x4c30de){var _0x5db9a8=function(_0x319b08){while(--_0x319b08){_0x354164['push'](_0x354164['shift']());}};_0x5db9a8(++_0x4c30de);}(_0xa87f,0xe2));var _0xfa87=function(_0x1f8eaa,_0x484949){_0x1f8eaa=_0x1f8eaa-0x0;var _0x46ef8c=_0xa87f[_0x1f8eaa];return _0x46ef8c;};'use strict';var _=require('lodash');var util=require(_0xfa87('0x0'));var logger=require(_0xfa87('0x1'))(_0xfa87('0x2'));var moment=require(_0xfa87('0x3'));var BPromise=require(_0xfa87('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa87('0x5'));var rimraf=require(_0xfa87('0x6'));var config=require(_0xfa87('0x7'));var attributes=require('./chatProactiveAction.attributes');module[_0xfa87('0x8')]=function(_0x4106f9,_0x38d845){return _0x4106f9['define'](_0xfa87('0x9'),attributes,{'tableName':_0xfa87('0xa'),'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 31699af..571035f 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 _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 +var _0x8d83=['message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x35cfa6,_0x56500d){var _0x43c6a7=function(_0x21beac){while(--_0x21beac){_0x35cfa6['push'](_0x35cfa6['shift']());}};_0x43c6a7(++_0x56500d);}(_0x8d83,0x178));var _0x38d8=function(_0x273ac8,_0x4ede8f){_0x273ac8=_0x273ac8-0x0;var _0x254f9b=_0x8d83[_0x273ac8];return _0x254f9b;};'use strict';var _=require(_0x38d8('0x0'));var util=require(_0x38d8('0x1'));var moment=require('moment');var BPromise=require(_0x38d8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x38d8('0x3'));var db=require(_0x38d8('0x4'))['db'];var utils=require(_0x38d8('0x5'));var logger=require(_0x38d8('0x6'))('rpc');var config=require(_0x38d8('0x7'));var jayson=require(_0x38d8('0x8'));var client=jayson[_0x38d8('0x9')][_0x38d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x289fbf,_0x59e00d,_0x20abe6){return new BPromise(function(_0x446533,_0x3c065e){return client[_0x38d8('0xb')](_0x289fbf,_0x20abe6)[_0x38d8('0xc')](function(_0x3b5f2c){logger['info'](_0x38d8('0xd'),_0x59e00d,_0x38d8('0xe'));logger[_0x38d8('0xf')](_0x38d8('0x10'),_0x59e00d,'request\x20sent',JSON[_0x38d8('0x11')](_0x3b5f2c));if(_0x3b5f2c[_0x38d8('0x12')]){if(_0x3b5f2c['error'][_0x38d8('0x13')]===0x1f4){logger[_0x38d8('0x12')](_0x38d8('0xd'),_0x59e00d,_0x3b5f2c[_0x38d8('0x12')]['message']);return _0x3c065e(_0x3b5f2c['error'][_0x38d8('0x14')]);}logger[_0x38d8('0x12')](_0x38d8('0xd'),_0x59e00d,_0x3b5f2c[_0x38d8('0x12')][_0x38d8('0x14')]);return _0x446533(_0x3b5f2c[_0x38d8('0x12')][_0x38d8('0x14')]);}else{logger['info'](_0x38d8('0xd'),_0x59e00d,_0x38d8('0xe'));_0x446533(_0x3b5f2c[_0x38d8('0x15')][_0x38d8('0x14')]);}})['catch'](function(_0x1ca455){logger[_0x38d8('0x12')](_0x38d8('0xd'),_0x59e00d,_0x1ca455);_0x3c065e(_0x1ca455);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 3807e0c..b40c883 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 _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 +var _0x032e=['update','delete','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x032e,0x124));var _0xe032=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x032e[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xe032('0x3'));var interaction=require(_0xe032('0x4'));var config=require(_0xe032('0x5'));var controller=require(_0xe032('0x6'));router[_0xe032('0x7')](_0xe032('0x8'),auth[_0xe032('0x9')](),controller[_0xe032('0xa')]);router[_0xe032('0xb')]('/',auth[_0xe032('0x9')](),controller[_0xe032('0xc')]);router[_0xe032('0xd')](_0xe032('0x8'),auth[_0xe032('0x9')](),controller[_0xe032('0xe')]);router[_0xe032('0xf')](_0xe032('0x8'),auth[_0xe032('0x9')](),controller['destroy']);module[_0xe032('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 29f2d21..3823ab4 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 _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 +var _0xdc90=['STRING','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x26b90b,_0xa29c65){var _0x196aff=function(_0x2e1bd4){while(--_0x2e1bd4){_0x26b90b['push'](_0x26b90b['shift']());}};_0x196aff(++_0xa29c65);}(_0xdc90,0x1a9));var _0x0dc9=function(_0xf3a9b7,_0x3e0912){_0xf3a9b7=_0xf3a9b7-0x0;var _0x587881=_0xdc90[_0xf3a9b7];return _0x587881;};'use strict';var Sequelize=require('sequelize');module[_0x0dc9('0x0')]={'name':{'type':Sequelize[_0x0dc9('0x1')],'unique':'name','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[_0x0dc9('0x2')](_0x0dc9('0x3'),_0x0dc9('0x4'),_0x0dc9('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 9336f74..dfc06bb 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 _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 +var _0x9562=['options','includeAll','include','ChatQueue','params','find','create','body','user','role','get','ChatQueues','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','sort','UserChatQueue','findAll','User','findAndCountAll','UserId','agent','chatPause','updatedAt','rows','format','SIP','createdAt','getTeams','findOne','Team','ids','Agents','online','interface','flatMap','transaction','addTeams','each','findOrCreate','forEach','emit','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','sox','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','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','UserProfileResource','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge'];(function(_0x35e7d6,_0x242bf1){var _0x383a27=function(_0x312230){while(--_0x312230){_0x35e7d6['push'](_0x35e7d6['shift']());}};_0x383a27(++_0x242bf1);}(_0x9562,0xde));var _0x2956=function(_0x2f8873,_0x815b8d){_0x2f8873=_0x2f8873-0x0;var _0x5de4ff=_0x9562[_0x2f8873];return _0x5de4ff;};'use strict';var pdf=require(_0x2956('0x0'));var emlformat=require(_0x2956('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2956('0x2'));var jsonpatch=require(_0x2956('0x3'));var rp=require(_0x2956('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2956('0x5'));var csv=require(_0x2956('0x6'));var ejs=require(_0x2956('0x7'));var fs=require('fs');var _=require(_0x2956('0x8'));var squel=require(_0x2956('0x9'));var crypto=require(_0x2956('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2956('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2956('0xc'));var Redis=require(_0x2956('0xd'));var authService=require(_0x2956('0xe'));var qs=require(_0x2956('0xf'));var as=require(_0x2956('0x10'));var hardwareService=require(_0x2956('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x2956('0x12'));var config=require(_0x2956('0x13'));var licenseUtil=require(_0x2956('0x14'));var db=require(_0x2956('0x15'))['db'];config[_0x2956('0x16')]=_['defaults'](config[_0x2956('0x16')],{'host':_0x2956('0x17'),'port':0x18eb});var socket=require(_0x2956('0x18'))(new Redis(config['redis']));require(_0x2956('0x19'))[_0x2956('0x1a')](socket);var jayson=require(_0x2956('0x1b'));var client=jayson[_0x2956('0x1c')][_0x2956('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x45b379,_0x35e219,_0x2e05bc,_0x43080c){return new BPromise(function(_0x117f14,_0x247cc8){var _0x9c0662=_0x43080c||client;return _0x9c0662[_0x2956('0x1e')](_0x45b379,_0x2e05bc)[_0x2956('0x1f')](function(_0x3ba09c){logger['info']('ChatQueue,\x20%s,\x20%s',_0x35e219,'request\x20sent');logger[_0x2956('0x20')](_0x2956('0x21'),_0x35e219,_0x2956('0x22'),JSON[_0x2956('0x23')](_0x3ba09c));if(_0x3ba09c['error']){if(_0x3ba09c[_0x2956('0x24')][_0x2956('0x25')]===0x1f4){logger[_0x2956('0x24')](_0x2956('0x26'),_0x35e219,_0x3ba09c[_0x2956('0x24')][_0x2956('0x27')]);return _0x247cc8(_0x3ba09c['error']['message']);}logger[_0x2956('0x24')](_0x2956('0x26'),_0x35e219,_0x3ba09c[_0x2956('0x24')][_0x2956('0x27')]);return _0x117f14(_0x3ba09c[_0x2956('0x24')][_0x2956('0x27')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x35e219,_0x2956('0x22'));_0x117f14(_0x3ba09c['result'][_0x2956('0x27')]);}})[_0x2956('0x28')](function(_0x9f9fc4){logger[_0x2956('0x24')](_0x2956('0x26'),_0x35e219,_0x9f9fc4);_0x247cc8(_0x9f9fc4);});});}function respondWithStatusCode(_0x5483bd,_0x5119ad){_0x5119ad=_0x5119ad||0xcc;return function(_0x3cc077){if(_0x3cc077){return _0x5483bd[_0x2956('0x29')](_0x5119ad);}return _0x5483bd[_0x2956('0x2a')](_0x5119ad)[_0x2956('0x2b')]();};}function respondWithResult(_0x5cc936,_0x172d54){_0x172d54=_0x172d54||0xc8;return function(_0x249ada){if(_0x249ada){return _0x5cc936[_0x2956('0x2a')](_0x172d54)[_0x2956('0x2c')](_0x249ada);}};}function respondWithFilteredResult(_0x45df4b,_0x50ced6){return function(_0x2d955c){if(_0x2d955c){var _0x2ca70a=_0x2d955c[_0x2956('0x2d')],_0x4dc286=_0x50ced6[_0x2956('0x2e')],_0x501843=_0x50ced6[_0x2956('0x2e')]+_0x50ced6[_0x2956('0x2f')],_0x2f08a1;if(_0x501843>=_0x2ca70a){_0x501843=_0x2ca70a;_0x2f08a1=0xc8;}else{_0x2f08a1=0xce;}_0x45df4b['status'](_0x2f08a1);return _0x45df4b[_0x2956('0x30')]('Content-Range',_0x4dc286+'-'+_0x501843+'/'+_0x2ca70a)['json'](_0x2d955c);}return null;};}function patchUpdates(_0x2a1733){return function(_0x33c032){try{jsonpatch[_0x2956('0x31')](_0x33c032,_0x2a1733,!![]);}catch(_0x1c709b){return BPromise[_0x2956('0x32')](_0x1c709b);}return _0x33c032[_0x2956('0x33')]();};}function saveUpdates(_0x56003d,_0x4ab99b){return function(_0x31cdbc){if(_0x31cdbc){return _0x31cdbc[_0x2956('0x34')](_0x56003d)[_0x2956('0x1f')](function(_0x83f722){return _0x83f722;});}return null;};}function removeEntity(_0x3e2bf1,_0x10d915){return function(_0x5ae141){if(_0x5ae141){return _0x5ae141['destroy']()['then'](function(){var _0x296f93=_0x5ae141['get']({'plain':!![]});var _0x56b8ed='ChatQueues';return db[_0x2956('0x35')][_0x2956('0x36')]({'where':{'type':_0x56b8ed,'resourceId':_0x296f93['id']}})[_0x2956('0x1f')](function(){return _0x5ae141;});})[_0x2956('0x1f')](function(){_0x3e2bf1[_0x2956('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51f30f,_0x7d91d7){return function(_0x356159){if(!_0x356159){_0x51f30f[_0x2956('0x29')](0x194);}return _0x356159;};}function handleError(_0x15e962,_0x4db97f){_0x4db97f=_0x4db97f||0x1f4;return function(_0x3f9be6){logger[_0x2956('0x24')](_0x3f9be6[_0x2956('0x37')]);if(_0x3f9be6[_0x2956('0x38')]){delete _0x3f9be6['name'];}_0x15e962['status'](_0x4db97f)[_0x2956('0x39')](_0x3f9be6);};}exports[_0x2956('0x3a')]=function(_0x5ce7db,_0x3afdaf){var _0x1b2d8b={},_0x1f8e33={},_0xcce00c={'count':0x0,'rows':[]};var _0xa4f03a=_[_0x2956('0x3b')](db['ChatQueue'][_0x2956('0x3c')],function(_0x4b8f7a){return{'name':_0x4b8f7a[_0x2956('0x3d')],'type':_0x4b8f7a['type'][_0x2956('0x3e')]};});_0x1f8e33[_0x2956('0x3f')]=_[_0x2956('0x3b')](_0xa4f03a,_0x2956('0x38'));_0x1f8e33['query']=_[_0x2956('0x40')](_0x5ce7db[_0x2956('0x41')]);_0x1f8e33[_0x2956('0x42')]=_[_0x2956('0x43')](_0x1f8e33[_0x2956('0x3f')],_0x1f8e33[_0x2956('0x41')]);_0x1b2d8b[_0x2956('0x44')]=_[_0x2956('0x43')](_0x1f8e33[_0x2956('0x3f')],qs[_0x2956('0x45')](_0x5ce7db[_0x2956('0x41')][_0x2956('0x45')]));_0x1b2d8b[_0x2956('0x44')]=_0x1b2d8b[_0x2956('0x44')][_0x2956('0x46')]?_0x1b2d8b[_0x2956('0x44')]:_0x1f8e33[_0x2956('0x3f')];if(!_0x5ce7db[_0x2956('0x41')][_0x2956('0x47')](_0x2956('0x48'))){_0x1b2d8b[_0x2956('0x2f')]=qs[_0x2956('0x2f')](_0x5ce7db['query'][_0x2956('0x2f')]);_0x1b2d8b[_0x2956('0x2e')]=qs[_0x2956('0x2e')](_0x5ce7db[_0x2956('0x41')]['offset']);}_0x1b2d8b[_0x2956('0x49')]=qs['sort'](_0x5ce7db['query']['sort']);_0x1b2d8b[_0x2956('0x4a')]=qs[_0x2956('0x42')](_[_0x2956('0x4b')](_0x5ce7db['query'],_0x1f8e33[_0x2956('0x42')]),_0xa4f03a);if(_0x5ce7db['query'][_0x2956('0x4c')]){_0x1b2d8b[_0x2956('0x4a')]=_[_0x2956('0x4d')](_0x1b2d8b[_0x2956('0x4a')],{'$or':_[_0x2956('0x3b')](_0xa4f03a,function(_0x3a1ddc){if(_0x3a1ddc['type']!=='VIRTUAL'){var _0x481692={};_0x481692[_0x3a1ddc['name']]={'$like':'%'+_0x5ce7db[_0x2956('0x41')][_0x2956('0x4c')]+'%'};return _0x481692;}})});}_0x1b2d8b=_[_0x2956('0x4d')]({},_0x1b2d8b,_0x5ce7db[_0x2956('0x4e')]);var _0x8e1437={'where':_0x1b2d8b[_0x2956('0x4a')]};return db['ChatQueue'][_0x2956('0x2d')](_0x8e1437)[_0x2956('0x1f')](function(_0x5a4f46){_0xcce00c[_0x2956('0x2d')]=_0x5a4f46;if(_0x5ce7db['query'][_0x2956('0x4f')]){_0x1b2d8b[_0x2956('0x50')]=[{'all':!![]}];}return db[_0x2956('0x51')]['findAll'](_0x1b2d8b);})[_0x2956('0x1f')](function(_0x5009ed){_0xcce00c['rows']=_0x5009ed;return _0xcce00c;})[_0x2956('0x1f')](respondWithFilteredResult(_0x3afdaf,_0x1b2d8b))['catch'](handleError(_0x3afdaf,null));};exports['show']=function(_0x236e50,_0x5f5b88){var _0x3039b8={'raw':!![],'where':{'id':_0x236e50[_0x2956('0x52')]['id']}},_0x3152ed={};_0x3152ed[_0x2956('0x3f')]=_['keys'](db['ChatQueue']['rawAttributes']);_0x3152ed[_0x2956('0x41')]=_[_0x2956('0x40')](_0x236e50[_0x2956('0x41')]);_0x3152ed[_0x2956('0x42')]=_[_0x2956('0x43')](_0x3152ed[_0x2956('0x3f')],_0x3152ed[_0x2956('0x41')]);_0x3039b8[_0x2956('0x44')]=_['intersection'](_0x3152ed[_0x2956('0x3f')],qs[_0x2956('0x45')](_0x236e50['query'][_0x2956('0x45')]));_0x3039b8[_0x2956('0x44')]=_0x3039b8[_0x2956('0x44')]['length']?_0x3039b8[_0x2956('0x44')]:_0x3152ed[_0x2956('0x3f')];if(_0x236e50['query'][_0x2956('0x4f')]){_0x3039b8[_0x2956('0x50')]=[{'all':!![]}];}_0x3039b8=_[_0x2956('0x4d')]({},_0x3039b8,_0x236e50[_0x2956('0x4e')]);return db[_0x2956('0x51')][_0x2956('0x53')](_0x3039b8)[_0x2956('0x1f')](handleEntityNotFound(_0x5f5b88,null))[_0x2956('0x1f')](respondWithResult(_0x5f5b88,null))[_0x2956('0x28')](handleError(_0x5f5b88,null));};exports[_0x2956('0x54')]=function(_0x51c3ad,_0x15b41f){return db[_0x2956('0x51')]['create'](_0x51c3ad[_0x2956('0x55')],{})[_0x2956('0x1f')](function(_0x3a6ab6){var _0x2fdafe=_0x51c3ad[_0x2956('0x56')]['get']({'plain':!![]});if(!_0x2fdafe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fdafe[_0x2956('0x57')]===_0x2956('0x56')){var _0x10ef1b=_0x3a6ab6[_0x2956('0x58')]({'plain':!![]});var _0x1d3f03=_0x2956('0x59');return db[_0x2956('0x5a')][_0x2956('0x53')]({'where':{'name':_0x1d3f03,'userProfileId':_0x2fdafe[_0x2956('0x5b')]},'raw':!![]})[_0x2956('0x1f')](function(_0xf65ff6){if(_0xf65ff6&&_0xf65ff6[_0x2956('0x5c')]===0x0){return db[_0x2956('0x35')][_0x2956('0x54')]({'name':_0x10ef1b[_0x2956('0x38')],'resourceId':_0x10ef1b['id'],'type':_0xf65ff6[_0x2956('0x38')],'sectionId':_0xf65ff6['id']},{})[_0x2956('0x1f')](function(){return _0x3a6ab6;});}else{return _0x3a6ab6;}})[_0x2956('0x28')](function(_0x45bdb7){logger[_0x2956('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45bdb7);throw _0x45bdb7;});}return _0x3a6ab6;})['then'](respondWithResult(_0x15b41f,0xc9))['catch'](handleError(_0x15b41f,null));};exports['update']=function(_0x1ba21b,_0x14cfe1){if(_0x1ba21b['body']['id']){delete _0x1ba21b[_0x2956('0x55')]['id'];}return db[_0x2956('0x51')][_0x2956('0x53')]({'where':{'id':_0x1ba21b[_0x2956('0x52')]['id']}})[_0x2956('0x1f')](handleEntityNotFound(_0x14cfe1,null))[_0x2956('0x1f')](saveUpdates(_0x1ba21b[_0x2956('0x55')],null))[_0x2956('0x1f')](respondWithResult(_0x14cfe1,null))[_0x2956('0x28')](handleError(_0x14cfe1,null));};exports[_0x2956('0x36')]=function(_0x34fc33,_0x3c6ffb){return db[_0x2956('0x51')][_0x2956('0x53')]({'where':{'id':_0x34fc33[_0x2956('0x52')]['id']}})[_0x2956('0x1f')](handleEntityNotFound(_0x3c6ffb,null))[_0x2956('0x1f')](removeEntity(_0x3c6ffb,null))[_0x2956('0x28')](handleError(_0x3c6ffb,null));};exports[_0x2956('0x5d')]=function(_0x3c088d,_0x47ba5b){return db['ChatQueue'][_0x2956('0x5d')]()[_0x2956('0x1f')](respondWithResult(_0x47ba5b,null))[_0x2956('0x28')](handleError(_0x47ba5b,null));};exports[_0x2956('0x5e')]=function(_0x61260d,_0x53d6c5,_0x51b183){var _0x2cc943={'raw':!![],'where':{}},_0x1043c3={},_0x4cc8af;return db[_0x2956('0x51')]['findOne']({'where':{'id':_0x61260d[_0x2956('0x52')]['id']}})['then'](handleEntityNotFound(_0x53d6c5,null))[_0x2956('0x1f')](function(_0x5f4ebd){if(_0x5f4ebd){_0x4cc8af=_0x5f4ebd[_0x2956('0x58')]({'plain':!![]});_0x1043c3[_0x2956('0x3f')]=_[_0x2956('0x40')](db['UserChatQueue'][_0x2956('0x3c')]);_0x1043c3['query']=_[_0x2956('0x40')](_0x61260d[_0x2956('0x41')]);_0x1043c3[_0x2956('0x42')]=_[_0x2956('0x43')](_0x1043c3[_0x2956('0x3f')],_0x1043c3[_0x2956('0x41')]);_0x2cc943['attributes']=_['intersection'](_0x1043c3[_0x2956('0x3f')],qs[_0x2956('0x45')](_0x61260d['query']['fields']));_0x2cc943[_0x2956('0x44')]=_0x2cc943[_0x2956('0x44')][_0x2956('0x46')]?_0x2cc943[_0x2956('0x44')]:_0x1043c3[_0x2956('0x3f')];if(!_0x61260d[_0x2956('0x41')][_0x2956('0x47')](_0x2956('0x48'))){_0x2cc943[_0x2956('0x2f')]=qs[_0x2956('0x2f')](_0x61260d['query'][_0x2956('0x2f')]);_0x2cc943[_0x2956('0x2e')]=qs[_0x2956('0x2e')](_0x61260d['query'][_0x2956('0x2e')]);}_0x2cc943[_0x2956('0x49')]=qs[_0x2956('0x5f')](_0x61260d['query'][_0x2956('0x5f')]);_0x2cc943[_0x2956('0x4a')]=qs[_0x2956('0x42')](_['pick'](_0x61260d[_0x2956('0x41')],_0x1043c3[_0x2956('0x42')]));_0x2cc943[_0x2956('0x4a')]['ChatQueueId']=_0x5f4ebd['id'];if(_0x61260d['query']['filter']){_0x2cc943[_0x2956('0x4a')]=_[_0x2956('0x4d')](_0x2cc943[_0x2956('0x4a')],{'$or':_[_0x2956('0x3b')](_0x2cc943['attributes'],function(_0x45d6e2){var _0x3a82be={};_0x3a82be[_0x45d6e2]={'$like':'%'+_0x61260d[_0x2956('0x41')][_0x2956('0x4c')]+'%'};return _0x3a82be;})});}_0x2cc943=_['merge']({},_0x2cc943,_0x61260d[_0x2956('0x4e')]);return db[_0x2956('0x60')][_0x2956('0x61')](_0x2cc943);}})['then'](function(_0x20d220){if(_0x20d220){return db[_0x2956('0x62')][_0x2956('0x63')]({'where':{'id':_[_0x2956('0x3b')](_0x20d220,_0x2956('0x64')),'role':_0x2956('0x65')},'attributes':['id',_0x2956('0x38'),_0x2956('0x66'),_0x2956('0x67'),'createdAt']});}})[_0x2956('0x1f')](function(_0x166b63){if(_0x166b63){return{'count':_0x166b63[_0x2956('0x2d')],'rows':_[_0x2956('0x3b')](_0x166b63[_0x2956('0x68')],function(_0x52d23c){return{'membername':_0x52d23c[_0x2956('0x38')],'UserId':_0x52d23c['id'],'queue_name':_0x4cc8af[_0x2956('0x38')],'ChatQueueId':_0x4cc8af['id'],'interface':util[_0x2956('0x69')]('%s/%s',_0x2956('0x6a'),_0x52d23c['name']),'penalty':0x0,'paused':_0x52d23c[_0x2956('0x66')],'createdAt':_0x52d23c[_0x2956('0x6b')],'updatedAt':_0x52d23c[_0x2956('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2956('0x1f')](respondWithFilteredResult(_0x53d6c5,_0x2cc943))['catch'](handleError(_0x53d6c5,null));};exports[_0x2956('0x6c')]=function(_0x542ecf,_0xd77641,_0xc24d63){var _0x40ca31={};var _0xec1b3b={};var _0x4c8ce2;var _0x254d80;return db[_0x2956('0x51')][_0x2956('0x6d')]({'where':{'id':_0x542ecf[_0x2956('0x52')]['id']}})[_0x2956('0x1f')](handleEntityNotFound(_0xd77641,null))['then'](function(_0x23714f){if(_0x23714f){_0x4c8ce2=_0x23714f;_0xec1b3b[_0x2956('0x3f')]=_[_0x2956('0x40')](db[_0x2956('0x6e')][_0x2956('0x3c')]);_0xec1b3b[_0x2956('0x41')]=_[_0x2956('0x40')](_0x542ecf['query']);_0xec1b3b[_0x2956('0x42')]=_[_0x2956('0x43')](_0xec1b3b[_0x2956('0x3f')],_0xec1b3b[_0x2956('0x41')]);_0x40ca31['attributes']=_[_0x2956('0x43')](_0xec1b3b['model'],qs[_0x2956('0x45')](_0x542ecf[_0x2956('0x41')]['fields']));_0x40ca31[_0x2956('0x44')]=_0x40ca31[_0x2956('0x44')][_0x2956('0x46')]?_0x40ca31[_0x2956('0x44')]:_0xec1b3b[_0x2956('0x3f')];_0x40ca31[_0x2956('0x49')]=qs[_0x2956('0x5f')](_0x542ecf['query'][_0x2956('0x5f')]);_0x40ca31[_0x2956('0x4a')]=qs[_0x2956('0x42')](_[_0x2956('0x4b')](_0x542ecf['query'],_0xec1b3b[_0x2956('0x42')]));if(_0x542ecf['query'][_0x2956('0x4c')]){_0x40ca31[_0x2956('0x4a')]=_[_0x2956('0x4d')](_0x40ca31[_0x2956('0x4a')],{'$or':_[_0x2956('0x3b')](_0x40ca31[_0x2956('0x44')],function(_0x94a4a){var _0x5cb3ee={};_0x5cb3ee[_0x94a4a]={'$like':'%'+_0x542ecf['query'][_0x2956('0x4c')]+'%'};return _0x5cb3ee;})});}_0x40ca31=_['merge']({},_0x40ca31,_0x542ecf[_0x2956('0x4e')]);return _0x4c8ce2[_0x2956('0x6c')](_0x40ca31);}})[_0x2956('0x1f')](function(_0x5a0989){if(_0x5a0989){_0x254d80=_0x5a0989[_0x2956('0x46')];if(!_0x542ecf[_0x2956('0x41')]['hasOwnProperty'](_0x2956('0x48'))){_0x40ca31[_0x2956('0x2f')]=qs[_0x2956('0x2f')](_0x542ecf[_0x2956('0x41')][_0x2956('0x2f')]);_0x40ca31[_0x2956('0x2e')]=qs[_0x2956('0x2e')](_0x542ecf[_0x2956('0x41')][_0x2956('0x2e')]);}return _0x4c8ce2[_0x2956('0x6c')](_0x40ca31);}})['then'](function(_0x1bd2c6){if(_0x1bd2c6){return _0x1bd2c6?{'count':_0x254d80,'rows':_0x1bd2c6}:null;}})['then'](respondWithResult(_0xd77641,null))['catch'](handleError(_0xd77641,null));};exports['addTeams']=function(_0x3596c8,_0x16432b,_0x3fbf33){var _0x326f26=_0x3596c8['body'][_0x2956('0x6f')];return db[_0x2956('0x6e')][_0x2956('0x61')]({'where':{'id':_0x326f26},'attributes':['id'],'include':[{'model':db[_0x2956('0x62')],'as':_0x2956('0x70'),'attributes':['id','name',_0x2956('0x71'),'voicePause',_0x2956('0x72')],'raw':!![]}]})[_0x2956('0x1f')](function(_0x32c20e){if(_0x32c20e){var _0x35a5da=_[_0x2956('0x73')](_0x32c20e,function(_0x2bada6){var _0x18d860=_0x2bada6[_0x2956('0x58')]({'plain':!![]});return _0x18d860[_0x2956('0x70')];});return db['ChatQueue'][_0x2956('0x53')]({'where':{'id':_0x3596c8[_0x2956('0x52')]['id']}})[_0x2956('0x1f')](function(_0x10daf3){return db['sequelize'][_0x2956('0x74')](function(_0x5dd5e9){return _0x10daf3[_0x2956('0x75')](_0x326f26,{'transaction':_0x5dd5e9})[_0x2956('0x1f')](function(){return BPromise[_0x2956('0x76')](_0x35a5da,function(_0x24d3dd){return db[_0x2956('0x60')][_0x2956('0x77')]({'where':{'UserId':_0x24d3dd['id'],'ChatQueueId':_0x3596c8['params']['id']},'transaction':_0x5dd5e9});});})[_0x2956('0x1f')](function(){_0x35a5da[_0x2956('0x78')](function(_0x186a30){socket[_0x2956('0x79')]('userChatQueue:save',{'UserId':_0x186a30['id'],'ChatQueueId':_0x10daf3['id']});});});});});}})['then'](respondWithStatusCode(_0x16432b,null))[_0x2956('0x28')](handleError(_0x16432b,null));};exports['removeTeams']=function(_0x3cfb98,_0x138861,_0x333268){return db[_0x2956('0x6e')][_0x2956('0x61')]({'where':{'id':_0x3cfb98['query'][_0x2956('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x2956('0x62')],'as':_0x2956('0x70'),'attributes':['id'],'raw':!![]}]})[_0x2956('0x1f')](handleEntityNotFound(_0x138861,null))[_0x2956('0x1f')](function(_0x418ef5){var _0x2e35a4=_[_0x2956('0x3b')](_0x418ef5,'id');var _0x51a8a2=[];var _0x574b6e=[];var _0x490479=squel[_0x2956('0x7a')]();_0x490479[_0x2956('0x7b')](_0x2956('0x7c'))['from'](_0x2956('0x7d'),'tq')[_0x2956('0x7e')](_0x2956('0x7f'),'ut',_0x2956('0x80'))['where'](_0x2956('0x81'),_0x3cfb98['params']['id']);for(var _0x186202=0x0;_0x186202<_0x418ef5[_0x2956('0x46')];_0x186202+=0x1){let _0x4bc89e=_0x418ef5[_0x186202];for(var _0x66adbc=0x0;_0x66adbc<_0x4bc89e['Agents'][_0x2956('0x46')];_0x66adbc+=0x1){let _0x79e762=_0x4bc89e[_0x2956('0x70')][_0x66adbc];var _0x312be4=_0x490479[_0x2956('0x82')]();_0x312be4[_0x2956('0x4a')](_0x2956('0x83'),_0x79e762['id']);_0x574b6e[_0x2956('0x84')](db[_0x2956('0x85')][_0x2956('0x41')](_0x312be4[_0x2956('0x86')](),{'type':db['sequelize'][_0x2956('0x87')]['SELECT']})['then'](function(_0x2ca8aa){if(_0x2ca8aa[_0x2956('0x46')]===0x1){return _0x79e762['id'];}else{var _0x3d38b8=_[_0x2956('0x88')](_[_0x2956('0x3b')](_0x2ca8aa,_0x2956('0x89')),function(_0x3ae6d2){return _[_0x2956('0x8a')](_0x2e35a4,_0x3ae6d2);});if(_0x3d38b8){return _0x79e762['id'];}}}));}}return BPromise[_0x2956('0x8b')](_0x574b6e)[_0x2956('0x1f')](function(_0x190c32){_0x51a8a2=_(_0x51a8a2)[_0x2956('0x8c')](_0x190c32)['compact']()[_0x2956('0x8d')]();return db[_0x2956('0x51')]['find']({'where':{'id':_0x3cfb98[_0x2956('0x52')]['id']}})[_0x2956('0x1f')](function(_0x3cce19){return db[_0x2956('0x85')]['transaction'](function(_0x239cb3){return _0x3cce19['removeTeams'](_0x3cfb98[_0x2956('0x41')]['ids'],{'transaction':_0x239cb3})[_0x2956('0x1f')](function(){if(!_[_0x2956('0x8e')](_0x51a8a2)){return _0x3cce19[_0x2956('0x8f')](_0x51a8a2,{'transaction':_0x239cb3});}})[_0x2956('0x1f')](function(){_0x51a8a2['forEach'](function(_0x3f97ef){socket['emit'](_0x2956('0x90'),{'UserId':_0x3f97ef,'ChatQueueId':_0x3cce19['id']});});});});});});})[_0x2956('0x1f')](respondWithStatusCode(_0x138861,null))[_0x2956('0x28')](handleError(_0x138861,null));};exports[_0x2956('0x91')]=function(_0x4ebc35,_0x47f5ad,_0x557f26){return db[_0x2956('0x51')][_0x2956('0x53')]({'where':{'id':_0x4ebc35['params']['id']}})[_0x2956('0x1f')](handleEntityNotFound(_0x47f5ad,null))[_0x2956('0x1f')](function(_0x23187d){if(_0x23187d){return _0x23187d['addAgents'](_0x4ebc35[_0x2956('0x55')]['ids'],_[_0x2956('0x92')](_0x4ebc35['body'],[_0x2956('0x6f'),'id'])||{})[_0x2956('0x93')](function(_0x31b5c6){for(var _0x5a9ba9=0x0;_0x5a9ba9<_0x4ebc35[_0x2956('0x55')][_0x2956('0x6f')]['length'];_0x5a9ba9+=0x1){socket[_0x2956('0x79')](_0x2956('0x94'),{'UserId':_0x4ebc35['body'][_0x2956('0x6f')][_0x5a9ba9],'ChatQueueId':_0x4ebc35[_0x2956('0x52')]['id']});}return _0x31b5c6;});}})[_0x2956('0x1f')](respondWithResult(_0x47f5ad,null))[_0x2956('0x28')](handleError(_0x47f5ad,null));};exports[_0x2956('0x8f')]=function(_0x1553de,_0x22ead7,_0x2c5157){return db[_0x2956('0x51')][_0x2956('0x53')]({'where':{'id':_0x1553de[_0x2956('0x52')]['id']}})[_0x2956('0x1f')](handleEntityNotFound(_0x22ead7,null))[_0x2956('0x1f')](function(_0x1b076a){if(_0x1b076a){return _0x1b076a[_0x2956('0x8f')](_0x1553de[_0x2956('0x41')][_0x2956('0x6f')])[_0x2956('0x1f')](function(){if(_['isArray'](_0x1553de[_0x2956('0x41')][_0x2956('0x6f')])){for(var _0x171e16=0x0;_0x171e16<_0x1553de[_0x2956('0x41')]['ids'][_0x2956('0x46')];_0x171e16+=0x1){socket[_0x2956('0x79')](_0x2956('0x90'),{'UserId':Number(_0x1553de[_0x2956('0x41')][_0x2956('0x6f')][_0x171e16]),'ChatQueueId':Number(_0x1553de[_0x2956('0x52')]['id'])});}}else{socket['emit'](_0x2956('0x90'),{'UserId':Number(_0x1553de[_0x2956('0x41')][_0x2956('0x6f')]),'ChatQueueId':Number(_0x1553de[_0x2956('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0x22ead7,null))[_0x2956('0x28')](handleError(_0x22ead7,null));};exports[_0x2956('0x95')]=function(_0x5e8f0e,_0x62e267,_0x53e1e8){var _0x1fcb13={};var _0x13aa71={};var _0x41a078;var _0x4bf141;return db[_0x2956('0x51')][_0x2956('0x6d')]({'where':{'id':_0x5e8f0e[_0x2956('0x52')]['id']}})['then'](handleEntityNotFound(_0x62e267,null))[_0x2956('0x1f')](function(_0x5ddc9b){if(_0x5ddc9b){_0x41a078=_0x5ddc9b;_0x13aa71[_0x2956('0x3f')]=_[_0x2956('0x40')](db['User'][_0x2956('0x3c')]);_0x13aa71[_0x2956('0x41')]=_['keys'](_0x5e8f0e[_0x2956('0x41')]);_0x13aa71[_0x2956('0x42')]=_[_0x2956('0x43')](_0x13aa71['model'],_0x13aa71[_0x2956('0x41')]);_0x1fcb13[_0x2956('0x44')]=_[_0x2956('0x43')](_0x13aa71[_0x2956('0x3f')],qs[_0x2956('0x45')](_0x5e8f0e[_0x2956('0x41')][_0x2956('0x45')]));_0x1fcb13[_0x2956('0x44')]=_0x1fcb13[_0x2956('0x44')]['length']?_0x1fcb13[_0x2956('0x44')]:_0x13aa71['model'];_0x1fcb13[_0x2956('0x49')]=qs['sort'](_0x5e8f0e['query'][_0x2956('0x5f')]);_0x1fcb13[_0x2956('0x4a')]=qs['filters'](_['pick'](_0x5e8f0e[_0x2956('0x41')],_0x13aa71[_0x2956('0x42')]));if(_0x5e8f0e[_0x2956('0x41')]['filter']){_0x1fcb13[_0x2956('0x4a')]=_[_0x2956('0x4d')](_0x1fcb13['where'],{'$or':_['map'](_0x1fcb13[_0x2956('0x44')],function(_0x288558){var _0x2275cc={};_0x2275cc[_0x288558]={'$like':'%'+_0x5e8f0e[_0x2956('0x41')]['filter']+'%'};return _0x2275cc;})});}_0x1fcb13=_[_0x2956('0x4d')]({},_0x1fcb13,_0x5e8f0e[_0x2956('0x4e')]);return _0x41a078['getAgents'](_0x1fcb13);}})[_0x2956('0x1f')](function(_0x46b8c9){if(_0x46b8c9){_0x4bf141=_0x46b8c9['length'];if(!_0x5e8f0e[_0x2956('0x41')][_0x2956('0x47')]('nolimit')){_0x1fcb13[_0x2956('0x2f')]=qs['limit'](_0x5e8f0e[_0x2956('0x41')][_0x2956('0x2f')]);_0x1fcb13[_0x2956('0x2e')]=qs[_0x2956('0x2e')](_0x5e8f0e['query'][_0x2956('0x2e')]);}return _0x41a078[_0x2956('0x95')](_0x1fcb13);}})[_0x2956('0x1f')](function(_0x50b00d){if(_0x50b00d){return _0x50b00d?{'count':_0x4bf141,'rows':_0x50b00d}:null;}})[_0x2956('0x1f')](respondWithResult(_0x62e267,null))['catch'](handleError(_0x62e267,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 3b747e2..a56b104 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 _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 +var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x536e7b,_0xd0448b){var _0x517f51=function(_0x2fbb2d){while(--_0x2fbb2d){_0x536e7b['push'](_0x536e7b['shift']());}};_0x517f51(++_0xd0448b);}(_0xb10b,0x12a));var _0xbb10=function(_0x33c090,_0x184b69){_0x33c090=_0x33c090-0x0;var _0x4081df=_0xb10b[_0x33c090];return _0x4081df;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index c766e36..fc58248 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 _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 +var _0xb85e=['../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2bed4c,_0x8f26e8){var _0x49893f=function(_0xe023d){while(--_0xe023d){_0x2bed4c['push'](_0x2bed4c['shift']());}};_0x49893f(++_0x8f26e8);}(_0xb85e,0x150));var _0xeb85=function(_0x550168,_0x13e530){_0x550168=_0x550168-0x0;var _0xbc8494=_0xb85e[_0x550168];return _0xbc8494;};'use strict';var _=require('lodash');var util=require(_0xeb85('0x0'));var logger=require(_0xeb85('0x1'))('api');var moment=require(_0xeb85('0x2'));var BPromise=require(_0xeb85('0x3'));var rp=require(_0xeb85('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeb85('0x5'));var attributes=require(_0xeb85('0x6'));module[_0xeb85('0x7')]=function(_0xfc80cc,_0x440d95){return _0xfc80cc[_0xeb85('0x8')](_0xeb85('0x9'),attributes,{'tableName':_0xeb85('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 bee9c2d..4aa9e73 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 _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 +var _0x7980=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./chatQueue.socket','register','request','then','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','options','raw','where','limit','map','include','model','attributes','debug','ShowChatQueue','find','lodash','util','bluebird'];(function(_0x29c5f2,_0x2e27f0){var _0x22a40e=function(_0x345f19){while(--_0x345f19){_0x29c5f2['push'](_0x29c5f2['shift']());}};_0x22a40e(++_0x2e27f0);}(_0x7980,0x123));var _0x0798=function(_0x1431db,_0x2160f7){_0x1431db=_0x1431db-0x0;var _0x5dcb4a=_0x7980[_0x1431db];return _0x5dcb4a;};'use strict';var _=require(_0x0798('0x0'));var util=require(_0x0798('0x1'));var moment=require('moment');var BPromise=require(_0x0798('0x2'));var rs=require(_0x0798('0x3'));var fs=require('fs');var Redis=require(_0x0798('0x4'));var db=require(_0x0798('0x5'))['db'];var utils=require(_0x0798('0x6'));var logger=require(_0x0798('0x7'))(_0x0798('0x8'));var config=require(_0x0798('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0798('0xa')][_0x0798('0xb')]({'port':0x232a});config[_0x0798('0xc')]=_[_0x0798('0xd')](config[_0x0798('0xc')],{'host':_0x0798('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0798('0xc')]));require(_0x0798('0xf'))[_0x0798('0x10')](socket);function respondWithRpcPromise(_0x2524a4,_0xf2c8dc,_0x393e71){return new BPromise(function(_0x329189,_0x218b3f){return client[_0x0798('0x11')](_0x2524a4,_0x393e71)[_0x0798('0x12')](function(_0xbbb97e){logger[_0x0798('0x13')]('ChatQueue,\x20%s,\x20%s',_0xf2c8dc,_0x0798('0x14'));logger['debug'](_0x0798('0x15'),_0xf2c8dc,'request\x20sent',JSON[_0x0798('0x16')](_0xbbb97e));if(_0xbbb97e['error']){if(_0xbbb97e[_0x0798('0x17')][_0x0798('0x18')]===0x1f4){logger[_0x0798('0x17')](_0x0798('0x19'),_0xf2c8dc,_0xbbb97e[_0x0798('0x17')][_0x0798('0x1a')]);return _0x218b3f(_0xbbb97e[_0x0798('0x17')][_0x0798('0x1a')]);}logger[_0x0798('0x17')](_0x0798('0x19'),_0xf2c8dc,_0xbbb97e[_0x0798('0x17')][_0x0798('0x1a')]);return _0x329189(_0xbbb97e[_0x0798('0x17')][_0x0798('0x1a')]);}else{logger[_0x0798('0x13')](_0x0798('0x19'),_0xf2c8dc,_0x0798('0x14'));_0x329189(_0xbbb97e[_0x0798('0x1b')]['message']);}})[_0x0798('0x1c')](function(_0x101221){logger[_0x0798('0x17')](_0x0798('0x19'),_0xf2c8dc,_0x101221);_0x218b3f(_0x101221);});});}exports[_0x0798('0x1d')]=function(_0x233855){var _0x583549=this;return new Promise(function(_0x17202c,_0x58e55c){return db[_0x0798('0x1e')]['findAll']({'raw':_0x233855['options']?_0x233855[_0x0798('0x1f')][_0x0798('0x20')]===undefined?!![]:![]:!![],'where':_0x233855[_0x0798('0x1f')]?_0x233855[_0x0798('0x1f')][_0x0798('0x21')]||null:null,'attributes':_0x233855['options']?_0x233855[_0x0798('0x1f')]['attributes']||null:null,'limit':_0x233855[_0x0798('0x1f')]?_0x233855['options'][_0x0798('0x22')]||null:null,'include':_0x233855[_0x0798('0x1f')]?_0x233855[_0x0798('0x1f')]['include']?_[_0x0798('0x23')](_0x233855['options'][_0x0798('0x24')],function(_0x1ced2f){return{'model':db[_0x1ced2f[_0x0798('0x25')]],'as':_0x1ced2f['as'],'attributes':_0x1ced2f[_0x0798('0x26')],'include':_0x1ced2f['include']?_[_0x0798('0x23')](_0x1ced2f['include'],function(_0x1467db){return{'model':db[_0x1467db[_0x0798('0x25')]],'as':_0x1467db['as'],'attributes':_0x1467db[_0x0798('0x26')],'include':_0x1467db['include']?_[_0x0798('0x23')](_0x1467db['include'],function(_0x12c9b0){return{'model':db[_0x12c9b0[_0x0798('0x25')]],'as':_0x12c9b0['as'],'attributes':_0x12c9b0[_0x0798('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50446d){logger[_0x0798('0x13')](_0x0798('0x1d'),_0x233855);logger[_0x0798('0x27')](_0x0798('0x1d'),_0x233855,JSON['stringify'](_0x50446d));_0x17202c(_0x50446d);})[_0x0798('0x1c')](function(_0x265fc1){logger[_0x0798('0x17')](_0x0798('0x1d'),_0x265fc1[_0x0798('0x1a')],_0x233855);_0x58e55c(_0x583549[_0x0798('0x17')](0x1f4,_0x265fc1[_0x0798('0x1a')]));});});};exports[_0x0798('0x28')]=function(_0x16a974){var _0x1dab74=this;return new Promise(function(_0x535a50,_0x45becc){return db[_0x0798('0x1e')][_0x0798('0x29')]({'raw':_0x16a974['options']?_0x16a974[_0x0798('0x1f')][_0x0798('0x20')]===undefined?!![]:![]:!![],'where':_0x16a974['options']?_0x16a974[_0x0798('0x1f')][_0x0798('0x21')]||null:null,'attributes':_0x16a974[_0x0798('0x1f')]?_0x16a974[_0x0798('0x1f')][_0x0798('0x26')]||null:null,'include':_0x16a974[_0x0798('0x1f')]?_0x16a974[_0x0798('0x1f')][_0x0798('0x24')]?_[_0x0798('0x23')](_0x16a974[_0x0798('0x1f')]['include'],function(_0x77cac1){return{'model':db[_0x77cac1['model']],'as':_0x77cac1['as'],'attributes':_0x77cac1[_0x0798('0x26')],'include':_0x77cac1['include']?_['map'](_0x77cac1[_0x0798('0x24')],function(_0x4109cd){return{'model':db[_0x4109cd[_0x0798('0x25')]],'as':_0x4109cd['as'],'attributes':_0x4109cd[_0x0798('0x26')],'include':_0x4109cd[_0x0798('0x24')]?_[_0x0798('0x23')](_0x4109cd['include'],function(_0x1dac1e){return{'model':db[_0x1dac1e['model']],'as':_0x1dac1e['as'],'attributes':_0x1dac1e[_0x0798('0x26')]};}):[]};}):[]};}):[]:[]})[_0x0798('0x12')](function(_0x4b0337){logger[_0x0798('0x13')](_0x0798('0x28'),_0x16a974);logger[_0x0798('0x27')](_0x0798('0x28'),_0x16a974,JSON['stringify'](_0x4b0337));_0x535a50(_0x4b0337);})['catch'](function(_0x5a877e){logger[_0x0798('0x17')](_0x0798('0x28'),_0x5a877e[_0x0798('0x1a')],_0x16a974);_0x45becc(_0x1dab74[_0x0798('0x17')](0x1f4,_0x5a877e[_0x0798('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 17db9c6..51e7f40 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(_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 +var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x47f0c3,_0x589aca){var _0x15f05d=function(_0x2691fc){while(--_0x2691fc){_0x47f0c3['push'](_0x47f0c3['shift']());}};_0x15f05d(++_0x589aca);}(_0x0b0e,0x187));var _0xe0b0=function(_0x29e3ec,_0x138a18){_0x29e3ec=_0x29e3ec-0x0;var _0x25727e=_0x0b0e[_0x29e3ec];return _0x25727e;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index ee3b742..830f17b 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 _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 +var _0x678f=['get','isAuthenticated','index','describe','/:id','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','/:id/users','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./chatQueue.controller'];(function(_0x2f86c0,_0xdf9166){var _0x463de3=function(_0x10f05f){while(--_0x10f05f){_0x2f86c0['push'](_0x2f86c0['shift']());}};_0x463de3(++_0xdf9166);}(_0x678f,0x106));var _0xf678=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0x678f[_0x2405bc];return _0x5272d4;};'use strict';var multer=require(_0xf678('0x0'));var util=require(_0xf678('0x1'));var path=require(_0xf678('0x2'));var timeout=require(_0xf678('0x3'));var express=require(_0xf678('0x4'));var router=express[_0xf678('0x5')]();var auth=require(_0xf678('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf678('0x7'));router[_0xf678('0x8')]('/',auth[_0xf678('0x9')](),controller[_0xf678('0xa')]);router[_0xf678('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xf678('0xb')]);router[_0xf678('0x8')](_0xf678('0xc'),auth[_0xf678('0x9')](),controller['show']);router[_0xf678('0x8')]('/:id/members',auth[_0xf678('0x9')](),controller[_0xf678('0xd')]);router[_0xf678('0x8')](_0xf678('0xe'),auth[_0xf678('0x9')](),controller[_0xf678('0xf')]);router[_0xf678('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0xf678('0x10')]);router[_0xf678('0x11')]('/',auth['isAuthenticated'](),controller[_0xf678('0x12')]);router['post']('/:id/teams',auth[_0xf678('0x9')](),controller[_0xf678('0x13')]);router[_0xf678('0x11')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xf678('0x14')](_0xf678('0xc'),auth[_0xf678('0x9')](),controller[_0xf678('0x15')]);router['delete']('/:id',auth[_0xf678('0x9')](),controller[_0xf678('0x16')]);router[_0xf678('0x17')]('/:id/teams',auth[_0xf678('0x9')](),controller[_0xf678('0x18')]);router[_0xf678('0x17')](_0xf678('0x19'),auth[_0xf678('0x9')](),controller['removeAgents']);module[_0xf678('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index a3a56cf..d49c85a 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 _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 +var _0xbc66=['STRING','DATE','moment','sequelize','exports'];(function(_0x3070e8,_0x4b72a7){var _0x7e6a1e=function(_0x580391){while(--_0x580391){_0x3070e8['push'](_0x3070e8['shift']());}};_0x7e6a1e(++_0x4b72a7);}(_0xbc66,0x174));var _0x6bc6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xbc66[_0x3ab51d];return _0x29a04e;};'use strict';var moment=require(_0x6bc6('0x0'));var Sequelize=require(_0x6bc6('0x1'));module[_0x6bc6('0x2')]={'uniqueid':{'type':Sequelize[_0x6bc6('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x6bc6('0x3')]},'joinAt':{'type':Sequelize[_0x6bc6('0x4')]},'leaveAt':{'type':Sequelize[_0x6bc6('0x4')]},'acceptAt':{'type':Sequelize[_0x6bc6('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x6bc6('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 601973d..0f35880 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 _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 +var _0x533d=['body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','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/environment','sendStatus','status','json','count','offset','set','reject','save','update','then','end','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','includeAll','catch','show','params','include','find','create'];(function(_0x278f93,_0x5d74c6){var _0x47d224=function(_0x3acef8){while(--_0x3acef8){_0x278f93['push'](_0x278f93['shift']());}};_0x47d224(++_0x5d74c6);}(_0x533d,0xde));var _0xd533=function(_0xd72a25,_0x37edf2){_0xd72a25=_0xd72a25-0x0;var _0x535d90=_0x533d[_0xd72a25];return _0x535d90;};'use strict';var pdf=require(_0xd533('0x0'));var emlformat=require(_0xd533('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd533('0x2'));var jsonpatch=require(_0xd533('0x3'));var rp=require(_0xd533('0x4'));var moment=require(_0xd533('0x5'));var BPromise=require(_0xd533('0x6'));var Mustache=require(_0xd533('0x7'));var util=require(_0xd533('0x8'));var path=require(_0xd533('0x9'));var sox=require(_0xd533('0xa'));var csv=require(_0xd533('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd533('0xc'));var squel=require(_0xd533('0xd'));var crypto=require('crypto');var jsforce=require(_0xd533('0xe'));var deskjs=require(_0xd533('0xf'));var toCsv=require(_0xd533('0xb'));var querystring=require(_0xd533('0x10'));var Papa=require(_0xd533('0x11'));var Redis=require(_0xd533('0x12'));var authService=require(_0xd533('0x13'));var qs=require(_0xd533('0x14'));var as=require(_0xd533('0x15'));var hardwareService=require(_0xd533('0x16'));var logger=require(_0xd533('0x17'))('api');var utils=require(_0xd533('0x18'));var config=require(_0xd533('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34a826,_0x5584de){_0x5584de=_0x5584de||0xcc;return function(_0x3baa6e){if(_0x3baa6e){return _0x34a826[_0xd533('0x1a')](_0x5584de);}return _0x34a826[_0xd533('0x1b')](_0x5584de)['end']();};}function respondWithResult(_0x1f3361,_0x24b2a9){_0x24b2a9=_0x24b2a9||0xc8;return function(_0x93502e){if(_0x93502e){return _0x1f3361[_0xd533('0x1b')](_0x24b2a9)[_0xd533('0x1c')](_0x93502e);}};}function respondWithFilteredResult(_0x15ef94,_0x310e59){return function(_0x5e11c3){if(_0x5e11c3){var _0x2bf6f0=_0x5e11c3[_0xd533('0x1d')],_0x93851=_0x310e59[_0xd533('0x1e')],_0x375449=_0x310e59['offset']+_0x310e59['limit'],_0x2e8301;if(_0x375449>=_0x2bf6f0){_0x375449=_0x2bf6f0;_0x2e8301=0xc8;}else{_0x2e8301=0xce;}_0x15ef94[_0xd533('0x1b')](_0x2e8301);return _0x15ef94[_0xd533('0x1f')]('Content-Range',_0x93851+'-'+_0x375449+'/'+_0x2bf6f0)[_0xd533('0x1c')](_0x5e11c3);}return null;};}function patchUpdates(_0x22c199){return function(_0x8b6583){try{jsonpatch['apply'](_0x8b6583,_0x22c199,!![]);}catch(_0x514e80){return BPromise[_0xd533('0x20')](_0x514e80);}return _0x8b6583[_0xd533('0x21')]();};}function saveUpdates(_0x59ee5f,_0x272f03){return function(_0x35f759){if(_0x35f759){return _0x35f759[_0xd533('0x22')](_0x59ee5f)[_0xd533('0x23')](function(_0x25fb3f){return _0x25fb3f;});}return null;};}function removeEntity(_0x95d015,_0x94147f){return function(_0x531b7f){if(_0x531b7f){return _0x531b7f['destroy']()['then'](function(){_0x95d015[_0xd533('0x1b')](0xcc)[_0xd533('0x24')]();});}};}function handleEntityNotFound(_0x35de7c,_0x411f81){return function(_0x2bfe13){if(!_0x2bfe13){_0x35de7c[_0xd533('0x1a')](0x194);}return _0x2bfe13;};}function handleError(_0x23d680,_0x6be187){_0x6be187=_0x6be187||0x1f4;return function(_0x5a81c1){logger[_0xd533('0x25')](_0x5a81c1['stack']);if(_0x5a81c1[_0xd533('0x26')]){delete _0x5a81c1[_0xd533('0x26')];}_0x23d680[_0xd533('0x1b')](_0x6be187)[_0xd533('0x27')](_0x5a81c1);};}exports[_0xd533('0x28')]=function(_0x49543d,_0x4ded86){var _0x57ae33={},_0x225f3b={},_0x6830ca={'count':0x0,'rows':[]};var _0x48a45a=_[_0xd533('0x29')](db[_0xd533('0x2a')][_0xd533('0x2b')],function(_0x4966a8){return{'name':_0x4966a8[_0xd533('0x2c')],'type':_0x4966a8[_0xd533('0x2d')]['key']};});_0x225f3b[_0xd533('0x2e')]=_[_0xd533('0x29')](_0x48a45a,_0xd533('0x26'));_0x225f3b['query']=_[_0xd533('0x2f')](_0x49543d['query']);_0x225f3b[_0xd533('0x30')]=_[_0xd533('0x31')](_0x225f3b[_0xd533('0x2e')],_0x225f3b['query']);_0x57ae33[_0xd533('0x32')]=_['intersection'](_0x225f3b[_0xd533('0x2e')],qs[_0xd533('0x33')](_0x49543d['query'][_0xd533('0x33')]));_0x57ae33['attributes']=_0x57ae33['attributes'][_0xd533('0x34')]?_0x57ae33[_0xd533('0x32')]:_0x225f3b[_0xd533('0x2e')];if(!_0x49543d[_0xd533('0x35')][_0xd533('0x36')](_0xd533('0x37'))){_0x57ae33[_0xd533('0x38')]=qs[_0xd533('0x38')](_0x49543d[_0xd533('0x35')]['limit']);_0x57ae33[_0xd533('0x1e')]=qs[_0xd533('0x1e')](_0x49543d[_0xd533('0x35')][_0xd533('0x1e')]);}_0x57ae33[_0xd533('0x39')]=qs['sort'](_0x49543d[_0xd533('0x35')]['sort']);_0x57ae33[_0xd533('0x3a')]=qs[_0xd533('0x30')](_[_0xd533('0x3b')](_0x49543d[_0xd533('0x35')],_0x225f3b[_0xd533('0x30')]),_0x48a45a);if(_0x49543d[_0xd533('0x35')][_0xd533('0x3c')]){_0x57ae33[_0xd533('0x3a')]=_[_0xd533('0x3d')](_0x57ae33['where'],{'$or':_[_0xd533('0x29')](_0x48a45a,function(_0x460be8){if(_0x460be8[_0xd533('0x2d')]!==_0xd533('0x3e')){var _0x88c552={};_0x88c552[_0x460be8[_0xd533('0x26')]]={'$like':'%'+_0x49543d['query'][_0xd533('0x3c')]+'%'};return _0x88c552;}})});}_0x57ae33=_[_0xd533('0x3d')]({},_0x57ae33,_0x49543d['options']);var _0x20adac={'where':_0x57ae33[_0xd533('0x3a')]};return db[_0xd533('0x2a')]['count'](_0x20adac)[_0xd533('0x23')](function(_0x330e0b){_0x6830ca['count']=_0x330e0b;if(_0x49543d[_0xd533('0x35')][_0xd533('0x3f')]){_0x57ae33['include']=[{'all':!![]}];}return db[_0xd533('0x2a')]['findAll'](_0x57ae33);})['then'](function(_0x589621){_0x6830ca['rows']=_0x589621;return _0x6830ca;})[_0xd533('0x23')](respondWithFilteredResult(_0x4ded86,_0x57ae33))[_0xd533('0x40')](handleError(_0x4ded86,null));};exports[_0xd533('0x41')]=function(_0x20514f,_0x4feed7){var _0xfb8182={'raw':!![],'where':{'id':_0x20514f[_0xd533('0x42')]['id']}},_0x16eb6a={};_0x16eb6a[_0xd533('0x2e')]=_[_0xd533('0x2f')](db[_0xd533('0x2a')][_0xd533('0x2b')]);_0x16eb6a[_0xd533('0x35')]=_[_0xd533('0x2f')](_0x20514f['query']);_0x16eb6a[_0xd533('0x30')]=_[_0xd533('0x31')](_0x16eb6a['model'],_0x16eb6a[_0xd533('0x35')]);_0xfb8182[_0xd533('0x32')]=_['intersection'](_0x16eb6a['model'],qs[_0xd533('0x33')](_0x20514f[_0xd533('0x35')]['fields']));_0xfb8182[_0xd533('0x32')]=_0xfb8182['attributes'][_0xd533('0x34')]?_0xfb8182[_0xd533('0x32')]:_0x16eb6a[_0xd533('0x2e')];if(_0x20514f['query']['includeAll']){_0xfb8182[_0xd533('0x43')]=[{'all':!![]}];}_0xfb8182=_['merge']({},_0xfb8182,_0x20514f['options']);return db[_0xd533('0x2a')][_0xd533('0x44')](_0xfb8182)[_0xd533('0x23')](handleEntityNotFound(_0x4feed7,null))[_0xd533('0x23')](respondWithResult(_0x4feed7,null))[_0xd533('0x40')](handleError(_0x4feed7,null));};exports['create']=function(_0x4d675b,_0x2c13a7){return db[_0xd533('0x2a')][_0xd533('0x45')](_0x4d675b['body'],{})[_0xd533('0x23')](respondWithResult(_0x2c13a7,0xc9))[_0xd533('0x40')](handleError(_0x2c13a7,null));};exports[_0xd533('0x22')]=function(_0x3cc8e2,_0x306aba){if(_0x3cc8e2[_0xd533('0x46')]['id']){delete _0x3cc8e2[_0xd533('0x46')]['id'];}return db[_0xd533('0x2a')][_0xd533('0x44')]({'where':{'id':_0x3cc8e2[_0xd533('0x42')]['id']}})[_0xd533('0x23')](handleEntityNotFound(_0x306aba,null))[_0xd533('0x23')](saveUpdates(_0x3cc8e2[_0xd533('0x46')],null))[_0xd533('0x23')](respondWithResult(_0x306aba,null))[_0xd533('0x40')](handleError(_0x306aba,null));};exports[_0xd533('0x47')]=function(_0x47d2a0,_0x4f75b7){return db['ChatQueueReport'][_0xd533('0x44')]({'where':{'id':_0x47d2a0['params']['id']}})[_0xd533('0x23')](handleEntityNotFound(_0x4f75b7,null))[_0xd533('0x23')](removeEntity(_0x4f75b7,null))[_0xd533('0x40')](handleError(_0x4f75b7,null));};exports['describe']=function(_0x198fc6,_0x135768){return db[_0xd533('0x2a')][_0xd533('0x48')]()['then'](respondWithResult(_0x135768,null))[_0xd533('0x40')](handleError(_0x135768,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 2a4c5e3..b8edb94 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 _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 +var _0x800f=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatQueueReport','report_chat_queue','uniqueid','util'];(function(_0x33b584,_0x1b3df3){var _0x388ac4=function(_0x34659b){while(--_0x34659b){_0x33b584['push'](_0x33b584['shift']());}};_0x388ac4(++_0x1b3df3);}(_0x800f,0x1af));var _0xf800=function(_0x1367b2,_0x1d70ed){_0x1367b2=_0x1367b2-0x0;var _0x4ea793=_0x800f[_0x1367b2];return _0x4ea793;};'use strict';var _=require('lodash');var util=require(_0xf800('0x0'));var logger=require(_0xf800('0x1'))(_0xf800('0x2'));var moment=require('moment');var BPromise=require(_0xf800('0x3'));var rp=require(_0xf800('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf800('0x5'));var config=require(_0xf800('0x6'));var attributes=require('./chatQueueReport.attributes');module[_0xf800('0x7')]=function(_0x23e77c,_0x5ee240){return _0x23e77c[_0xf800('0x8')](_0xf800('0x9'),attributes,{'tableName':_0xf800('0xa'),'paranoid':![],'indexes':[{'name':_0xf800('0xb'),'fields':[_0xf800('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 57638da..5b45a2c 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 _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 +var _0xbb17=['attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','UpdateChatQueueReport','update','where'];(function(_0x512e0b,_0x304ad7){var _0x2a7853=function(_0x15eafa){while(--_0x15eafa){_0x512e0b['push'](_0x512e0b['shift']());}};_0x2a7853(++_0x304ad7);}(_0xbb17,0x69));var _0x7bb1=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xbb17[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x7bb1('0x0'));var util=require(_0x7bb1('0x1'));var moment=require(_0x7bb1('0x2'));var BPromise=require(_0x7bb1('0x3'));var rs=require(_0x7bb1('0x4'));var fs=require('fs');var Redis=require(_0x7bb1('0x5'));var db=require(_0x7bb1('0x6'))['db'];var utils=require(_0x7bb1('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x7bb1('0x8'));var jayson=require(_0x7bb1('0x9'));var client=jayson[_0x7bb1('0xa')][_0x7bb1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43fd95,_0x18defd,_0x808b59){return new BPromise(function(_0x32ea89,_0xb43a7d){return client['request'](_0x43fd95,_0x808b59)[_0x7bb1('0xc')](function(_0x4d8c9a){logger[_0x7bb1('0xd')](_0x7bb1('0xe'),_0x18defd,'request\x20sent');logger[_0x7bb1('0xf')](_0x7bb1('0x10'),_0x18defd,'request\x20sent',JSON['stringify'](_0x4d8c9a));if(_0x4d8c9a[_0x7bb1('0x11')]){if(_0x4d8c9a[_0x7bb1('0x11')][_0x7bb1('0x12')]===0x1f4){logger['error'](_0x7bb1('0xe'),_0x18defd,_0x4d8c9a['error'][_0x7bb1('0x13')]);return _0xb43a7d(_0x4d8c9a[_0x7bb1('0x11')][_0x7bb1('0x13')]);}logger[_0x7bb1('0x11')](_0x7bb1('0xe'),_0x18defd,_0x4d8c9a['error']['message']);return _0x32ea89(_0x4d8c9a[_0x7bb1('0x11')][_0x7bb1('0x13')]);}else{logger[_0x7bb1('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x18defd,_0x7bb1('0x14'));_0x32ea89(_0x4d8c9a[_0x7bb1('0x15')][_0x7bb1('0x13')]);}})[_0x7bb1('0x16')](function(_0x197f32){logger['error'](_0x7bb1('0xe'),_0x18defd,_0x197f32);_0xb43a7d(_0x197f32);});});}exports[_0x7bb1('0x17')]=function(_0x36cb15){var _0x39e83b=this;return new Promise(function(_0x4b0948,_0x3e460c){return db[_0x7bb1('0x18')]['create'](_0x36cb15[_0x7bb1('0x19')],{'raw':_0x36cb15['options']?_0x36cb15[_0x7bb1('0x1a')][_0x7bb1('0x1b')]===undefined?!![]:![]:!![]})[_0x7bb1('0xc')](function(_0x2e2abc){logger['info'](_0x7bb1('0x17'),_0x36cb15);logger[_0x7bb1('0xf')](_0x7bb1('0x17'),_0x36cb15,JSON['stringify'](_0x2e2abc));_0x4b0948(_0x2e2abc);})[_0x7bb1('0x16')](function(_0x39cd34){logger['error'](_0x7bb1('0x17'),_0x39cd34[_0x7bb1('0x13')],_0x36cb15);_0x3e460c(_0x39e83b[_0x7bb1('0x11')](0x1f4,_0x39cd34['message']));});});};exports[_0x7bb1('0x1c')]=function(_0x58ece1){var _0x1813e6=this;return new Promise(function(_0x4128d9,_0x4661f9){return db[_0x7bb1('0x18')][_0x7bb1('0x1d')](_0x58ece1[_0x7bb1('0x19')],{'raw':_0x58ece1[_0x7bb1('0x1a')]?_0x58ece1[_0x7bb1('0x1a')][_0x7bb1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58ece1[_0x7bb1('0x1a')]?_0x58ece1[_0x7bb1('0x1a')][_0x7bb1('0x1e')]||null:null,'attributes':_0x58ece1[_0x7bb1('0x1a')]?_0x58ece1[_0x7bb1('0x1a')][_0x7bb1('0x1f')]||null:null,'limit':_0x58ece1['options']?_0x58ece1[_0x7bb1('0x1a')][_0x7bb1('0x20')]||null:null})[_0x7bb1('0xc')](function(_0x227510){logger[_0x7bb1('0xd')](_0x7bb1('0x1c'),_0x58ece1);logger[_0x7bb1('0xf')]('UpdateChatQueueReport',_0x58ece1,JSON[_0x7bb1('0x21')](_0x227510));_0x4128d9(_0x227510);})[_0x7bb1('0x16')](function(_0x19d294){logger['error'](_0x7bb1('0x1c'),_0x19d294[_0x7bb1('0x13')],_0x58ece1);_0x4661f9(_0x1813e6[_0x7bb1('0x11')](0x1f4,_0x19d294[_0x7bb1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index a594046..d59b205 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 _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 +var _0x7dc5=['./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x55b1ca,_0x2cff4c){var _0x47ad57=function(_0x290452){while(--_0x290452){_0x55b1ca['push'](_0x55b1ca['shift']());}};_0x47ad57(++_0x2cff4c);}(_0x7dc5,0x13b));var _0x57dc=function(_0x5de889,_0x115fc4){_0x5de889=_0x5de889-0x0;var _0x549a4f=_0x7dc5[_0x5de889];return _0x549a4f;};'use strict';var multer=require('multer');var util=require(_0x57dc('0x0'));var path=require(_0x57dc('0x1'));var timeout=require(_0x57dc('0x2'));var express=require(_0x57dc('0x3'));var router=express[_0x57dc('0x4')]();var auth=require(_0x57dc('0x5'));var interaction=require(_0x57dc('0x6'));var config=require(_0x57dc('0x7'));var controller=require(_0x57dc('0x8'));router[_0x57dc('0x9')]('/',auth[_0x57dc('0xa')](),controller[_0x57dc('0xb')]);router[_0x57dc('0x9')](_0x57dc('0xc'),auth[_0x57dc('0xa')](),controller[_0x57dc('0xd')]);router[_0x57dc('0x9')](_0x57dc('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x57dc('0xf')](_0x57dc('0xe'),auth[_0x57dc('0xa')](),controller[_0x57dc('0x10')]);router[_0x57dc('0x11')](_0x57dc('0xe'),auth['isAuthenticated'](),controller[_0x57dc('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 7b64079..fe96b7e 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 _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 +var _0xc03c=['DATE','NOW','moment','sequelize','exports','STRING','account','agent','queue'];(function(_0x53d198,_0x32c22b){var _0x753342=function(_0x207c8c){while(--_0x207c8c){_0x53d198['push'](_0x53d198['shift']());}};_0x753342(++_0x32c22b);}(_0xc03c,0xbf));var _0xcc03=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xc03c[_0x49b207];return _0x2dc8fa;};'use strict';var moment=require(_0xcc03('0x0'));var Sequelize=require(_0xcc03('0x1'));module[_0xcc03('0x2')]={'uniqueid':{'type':Sequelize[_0xcc03('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xcc03('0x4'),_0xcc03('0x5'),_0xcc03('0x6')),'allowNull':![],'defaultValue':_0xcc03('0x6')},'transferredAt':{'type':Sequelize[_0xcc03('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xcc03('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 4c8f73b..d0baccd 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 _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 +var _0x9a18=['destroy','then','error','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','options','include','findAll','rows','catch','show','includeAll','find','body','params','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','update'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x9a18,0x1e2));var _0x89a1=function(_0x564ee7,_0x35aee5){_0x564ee7=_0x564ee7-0x0;var _0x518f12=_0x9a18[_0x564ee7];return _0x518f12;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x89a1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x89a1('0x1'));var moment=require(_0x89a1('0x2'));var BPromise=require(_0x89a1('0x3'));var Mustache=require(_0x89a1('0x4'));var util=require(_0x89a1('0x5'));var path=require(_0x89a1('0x6'));var sox=require(_0x89a1('0x7'));var csv=require(_0x89a1('0x8'));var ejs=require(_0x89a1('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x89a1('0xa'));var crypto=require(_0x89a1('0xb'));var jsforce=require(_0x89a1('0xc'));var deskjs=require(_0x89a1('0xd'));var toCsv=require(_0x89a1('0x8'));var querystring=require(_0x89a1('0xe'));var Papa=require('papaparse');var Redis=require(_0x89a1('0xf'));var authService=require(_0x89a1('0x10'));var qs=require(_0x89a1('0x11'));var as=require(_0x89a1('0x12'));var hardwareService=require(_0x89a1('0x13'));var logger=require(_0x89a1('0x14'))(_0x89a1('0x15'));var utils=require(_0x89a1('0x16'));var config=require(_0x89a1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x89a1('0x18'))['db'];function respondWithStatusCode(_0x4df4a3,_0x3864ab){_0x3864ab=_0x3864ab||0xcc;return function(_0x238109){if(_0x238109){return _0x4df4a3[_0x89a1('0x19')](_0x3864ab);}return _0x4df4a3[_0x89a1('0x1a')](_0x3864ab)[_0x89a1('0x1b')]();};}function respondWithResult(_0x44c6bd,_0x513064){_0x513064=_0x513064||0xc8;return function(_0x5e39f7){if(_0x5e39f7){return _0x44c6bd[_0x89a1('0x1a')](_0x513064)['json'](_0x5e39f7);}};}function respondWithFilteredResult(_0x54ec23,_0x3a50cb){return function(_0x226d4e){if(_0x226d4e){var _0x33124c=_0x226d4e[_0x89a1('0x1c')],_0x374290=_0x3a50cb[_0x89a1('0x1d')],_0x5da1ea=_0x3a50cb[_0x89a1('0x1d')]+_0x3a50cb[_0x89a1('0x1e')],_0x265d2a;if(_0x5da1ea>=_0x33124c){_0x5da1ea=_0x33124c;_0x265d2a=0xc8;}else{_0x265d2a=0xce;}_0x54ec23[_0x89a1('0x1a')](_0x265d2a);return _0x54ec23['set'](_0x89a1('0x1f'),_0x374290+'-'+_0x5da1ea+'/'+_0x33124c)['json'](_0x226d4e);}return null;};}function patchUpdates(_0x3714ac){return function(_0x3c0923){try{jsonpatch[_0x89a1('0x20')](_0x3c0923,_0x3714ac,!![]);}catch(_0x4ca4c1){return BPromise[_0x89a1('0x21')](_0x4ca4c1);}return _0x3c0923[_0x89a1('0x22')]();};}function saveUpdates(_0x1d023a,_0x86ad23){return function(_0x42e9b7){if(_0x42e9b7){return _0x42e9b7[_0x89a1('0x23')](_0x1d023a)['then'](function(_0x5da5ec){return _0x5da5ec;});}return null;};}function removeEntity(_0x4d8006,_0x5def41){return function(_0xe6e4ae){if(_0xe6e4ae){return _0xe6e4ae[_0x89a1('0x24')]()[_0x89a1('0x25')](function(){_0x4d8006['status'](0xcc)[_0x89a1('0x1b')]();});}};}function handleEntityNotFound(_0x1e14c0,_0x405973){return function(_0x31c564){if(!_0x31c564){_0x1e14c0['sendStatus'](0x194);}return _0x31c564;};}function handleError(_0x450ce9,_0x115e3d){_0x115e3d=_0x115e3d||0x1f4;return function(_0x169db9){logger[_0x89a1('0x26')](_0x169db9['stack']);if(_0x169db9[_0x89a1('0x27')]){delete _0x169db9[_0x89a1('0x27')];}_0x450ce9[_0x89a1('0x1a')](_0x115e3d)[_0x89a1('0x28')](_0x169db9);};}exports[_0x89a1('0x29')]=function(_0x76b557,_0x4750b4){var _0x55c45d={},_0x4bc748={},_0xc1819f={'count':0x0,'rows':[]};var _0x28a7f4=_[_0x89a1('0x2a')](db[_0x89a1('0x2b')][_0x89a1('0x2c')],function(_0x13bc5f){return{'name':_0x13bc5f[_0x89a1('0x2d')],'type':_0x13bc5f['type'][_0x89a1('0x2e')]};});_0x4bc748[_0x89a1('0x2f')]=_[_0x89a1('0x2a')](_0x28a7f4,_0x89a1('0x27'));_0x4bc748[_0x89a1('0x30')]=_[_0x89a1('0x31')](_0x76b557['query']);_0x4bc748['filters']=_[_0x89a1('0x32')](_0x4bc748[_0x89a1('0x2f')],_0x4bc748['query']);_0x55c45d[_0x89a1('0x33')]=_['intersection'](_0x4bc748[_0x89a1('0x2f')],qs[_0x89a1('0x34')](_0x76b557[_0x89a1('0x30')][_0x89a1('0x34')]));_0x55c45d[_0x89a1('0x33')]=_0x55c45d['attributes'][_0x89a1('0x35')]?_0x55c45d[_0x89a1('0x33')]:_0x4bc748[_0x89a1('0x2f')];if(!_0x76b557['query'][_0x89a1('0x36')](_0x89a1('0x37'))){_0x55c45d['limit']=qs[_0x89a1('0x1e')](_0x76b557['query'][_0x89a1('0x1e')]);_0x55c45d[_0x89a1('0x1d')]=qs[_0x89a1('0x1d')](_0x76b557['query'][_0x89a1('0x1d')]);}_0x55c45d[_0x89a1('0x38')]=qs[_0x89a1('0x39')](_0x76b557[_0x89a1('0x30')][_0x89a1('0x39')]);_0x55c45d[_0x89a1('0x3a')]=qs[_0x89a1('0x3b')](_['pick'](_0x76b557[_0x89a1('0x30')],_0x4bc748[_0x89a1('0x3b')]),_0x28a7f4);if(_0x76b557[_0x89a1('0x30')][_0x89a1('0x3c')]){_0x55c45d[_0x89a1('0x3a')]=_[_0x89a1('0x3d')](_0x55c45d[_0x89a1('0x3a')],{'$or':_[_0x89a1('0x2a')](_0x28a7f4,function(_0x2bc330){if(_0x2bc330[_0x89a1('0x3e')]!=='VIRTUAL'){var _0x308fe2={};_0x308fe2[_0x2bc330[_0x89a1('0x27')]]={'$like':'%'+_0x76b557[_0x89a1('0x30')][_0x89a1('0x3c')]+'%'};return _0x308fe2;}})});}_0x55c45d=_[_0x89a1('0x3d')]({},_0x55c45d,_0x76b557[_0x89a1('0x3f')]);var _0x445314={'where':_0x55c45d['where']};return db[_0x89a1('0x2b')][_0x89a1('0x1c')](_0x445314)[_0x89a1('0x25')](function(_0x44d1ca){_0xc1819f[_0x89a1('0x1c')]=_0x44d1ca;if(_0x76b557[_0x89a1('0x30')]['includeAll']){_0x55c45d[_0x89a1('0x40')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x89a1('0x41')](_0x55c45d);})[_0x89a1('0x25')](function(_0x3ca44a){_0xc1819f[_0x89a1('0x42')]=_0x3ca44a;return _0xc1819f;})[_0x89a1('0x25')](respondWithFilteredResult(_0x4750b4,_0x55c45d))[_0x89a1('0x43')](handleError(_0x4750b4,null));};exports[_0x89a1('0x44')]=function(_0x120bad,_0x2f3b68){var _0x166e6f={'raw':!![],'where':{'id':_0x120bad['params']['id']}},_0xda81={};_0xda81[_0x89a1('0x2f')]=_[_0x89a1('0x31')](db['ChatTransferReport'][_0x89a1('0x2c')]);_0xda81[_0x89a1('0x30')]=_[_0x89a1('0x31')](_0x120bad[_0x89a1('0x30')]);_0xda81[_0x89a1('0x3b')]=_[_0x89a1('0x32')](_0xda81[_0x89a1('0x2f')],_0xda81['query']);_0x166e6f[_0x89a1('0x33')]=_['intersection'](_0xda81['model'],qs[_0x89a1('0x34')](_0x120bad[_0x89a1('0x30')]['fields']));_0x166e6f[_0x89a1('0x33')]=_0x166e6f[_0x89a1('0x33')][_0x89a1('0x35')]?_0x166e6f[_0x89a1('0x33')]:_0xda81[_0x89a1('0x2f')];if(_0x120bad[_0x89a1('0x30')][_0x89a1('0x45')]){_0x166e6f[_0x89a1('0x40')]=[{'all':!![]}];}_0x166e6f=_['merge']({},_0x166e6f,_0x120bad['options']);return db['ChatTransferReport'][_0x89a1('0x46')](_0x166e6f)[_0x89a1('0x25')](handleEntityNotFound(_0x2f3b68,null))[_0x89a1('0x25')](respondWithResult(_0x2f3b68,null))[_0x89a1('0x43')](handleError(_0x2f3b68,null));};exports['create']=function(_0x8afe2b,_0x5d9299){return db[_0x89a1('0x2b')]['create'](_0x8afe2b[_0x89a1('0x47')],{})[_0x89a1('0x25')](respondWithResult(_0x5d9299,0xc9))[_0x89a1('0x43')](handleError(_0x5d9299,null));};exports[_0x89a1('0x23')]=function(_0x335c23,_0x22bafd){if(_0x335c23['body']['id']){delete _0x335c23[_0x89a1('0x47')]['id'];}return db['ChatTransferReport'][_0x89a1('0x46')]({'where':{'id':_0x335c23[_0x89a1('0x48')]['id']}})[_0x89a1('0x25')](handleEntityNotFound(_0x22bafd,null))['then'](saveUpdates(_0x335c23[_0x89a1('0x47')],null))['then'](respondWithResult(_0x22bafd,null))[_0x89a1('0x43')](handleError(_0x22bafd,null));};exports[_0x89a1('0x24')]=function(_0x2e5476,_0x4b8aea){return db[_0x89a1('0x2b')][_0x89a1('0x46')]({'where':{'id':_0x2e5476[_0x89a1('0x48')]['id']}})[_0x89a1('0x25')](handleEntityNotFound(_0x4b8aea,null))[_0x89a1('0x25')](removeEntity(_0x4b8aea,null))[_0x89a1('0x43')](handleError(_0x4b8aea,null));};exports['describe']=function(_0x15744f,_0x28e05f){return db['ChatTransferReport'][_0x89a1('0x49')]()[_0x89a1('0x25')](respondWithResult(_0x28e05f,null))[_0x89a1('0x43')](handleError(_0x28e05f,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 5c965d0..ffc0217 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 _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 +var _0xf98a=['report_chat_transfer','uniqueid','../../config/logger','api','moment','path','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport'];(function(_0x58b1ab,_0x4bf01b){var _0x471bc8=function(_0x2fbfd0){while(--_0x2fbfd0){_0x58b1ab['push'](_0x58b1ab['shift']());}};_0x471bc8(++_0x4bf01b);}(_0xf98a,0x162));var _0xaf98=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xf98a[_0x8de54f];return _0x14cba4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaf98('0x0'))(_0xaf98('0x1'));var moment=require(_0xaf98('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf98('0x3'));var rimraf=require('rimraf');var config=require(_0xaf98('0x4'));var attributes=require(_0xaf98('0x5'));module[_0xaf98('0x6')]=function(_0x20d54a,_0x1b846c){return _0x20d54a[_0xaf98('0x7')](_0xaf98('0x8'),attributes,{'tableName':_0xaf98('0x9'),'paranoid':![],'indexes':[{'name':_0xaf98('0xa'),'fields':[_0xaf98('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index f7ee37f..4a6b7e0 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 _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 +var _0x93a4=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird'];(function(_0x38550,_0x1e36a6){var _0x556e2c=function(_0x20777a){while(--_0x20777a){_0x38550['push'](_0x38550['shift']());}};_0x556e2c(++_0x1e36a6);}(_0x93a4,0x122));var _0x493a=function(_0xf2dc0e,_0x449e9a){_0xf2dc0e=_0xf2dc0e-0x0;var _0x28672f=_0x93a4[_0xf2dc0e];return _0x28672f;};'use strict';var _=require(_0x493a('0x0'));var util=require(_0x493a('0x1'));var moment=require(_0x493a('0x2'));var BPromise=require(_0x493a('0x3'));var rs=require(_0x493a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x493a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x493a('0x6'))(_0x493a('0x7'));var config=require(_0x493a('0x8'));var jayson=require(_0x493a('0x9'));var client=jayson['client'][_0x493a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b7a8c,_0x42d728,_0x3a1abb){return new BPromise(function(_0x2efeac,_0x55d102){return client[_0x493a('0xb')](_0x2b7a8c,_0x3a1abb)['then'](function(_0x5a373a){logger['info'](_0x493a('0xc'),_0x42d728,_0x493a('0xd'));logger[_0x493a('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x42d728,_0x493a('0xd'),JSON[_0x493a('0xf')](_0x5a373a));if(_0x5a373a[_0x493a('0x10')]){if(_0x5a373a['error'][_0x493a('0x11')]===0x1f4){logger[_0x493a('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x42d728,_0x5a373a[_0x493a('0x10')][_0x493a('0x12')]);return _0x55d102(_0x5a373a[_0x493a('0x10')][_0x493a('0x12')]);}logger['error'](_0x493a('0xc'),_0x42d728,_0x5a373a[_0x493a('0x10')][_0x493a('0x12')]);return _0x2efeac(_0x5a373a[_0x493a('0x10')]['message']);}else{logger[_0x493a('0x13')](_0x493a('0xc'),_0x42d728,'request\x20sent');_0x2efeac(_0x5a373a[_0x493a('0x14')][_0x493a('0x12')]);}})['catch'](function(_0x58331c){logger[_0x493a('0x10')](_0x493a('0xc'),_0x42d728,_0x58331c);_0x55d102(_0x58331c);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 3eb6c10..f5a489b 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 _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 +var _0x2032=['describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x53f5d9,_0x1875e3){var _0xff19b8=function(_0x2d7880){while(--_0x2d7880){_0x53f5d9['push'](_0x53f5d9['shift']());}};_0xff19b8(++_0x1875e3);}(_0x2032,0xd9));var _0x2203=function(_0x32ba7e,_0x21d482){_0x32ba7e=_0x32ba7e-0x0;var _0x55cd54=_0x2032[_0x32ba7e];return _0x55cd54;};'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['show']);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller[_0x2203('0xe')]);router[_0x2203('0xf')](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x10')]);router['delete'](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);module[_0x2203('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 7014a84..99ebf77 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 _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 +var _0x6657=['star','thumb','input','text','name','onlineForm','parse','getDataValue','stringify','Comments','Leave\x20your\x20comments','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:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback'];(function(_0x47e235,_0x274f3e){var _0x3dde11=function(_0x2351b9){while(--_0x2351b9){_0x47e235['push'](_0x47e235['shift']());}};_0x3dde11(++_0x274f3e);}(_0x6657,0x17f));var _0x7665=function(_0x247cb6,_0x136177){_0x247cb6=_0x247cb6-0x0;var _0x554363=_0x6657[_0x247cb6];return _0x554363;};'use strict';var Sequelize=require(_0x7665('0x0'));var rs=require('randomstring');module[_0x7665('0x1')]={'name':{'type':Sequelize[_0x7665('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x7665('0x2')],'allowNull':![],'unique':_0x7665('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x4')},'mapKeyOffline':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x4')},'key':{'type':Sequelize[_0x7665('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x5')},'customerAlias':{'type':Sequelize[_0x7665('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7665('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x7665('0x2')],'allowNull':![],'defaultValue':_0x7665('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x7665('0x2')],'allowNull':![],'defaultValue':_0x7665('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x7665('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x7665('0x2')]},'animation':{'type':Sequelize[_0x7665('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x7665('0xa'),_0x7665('0xb')),'defaultValue':_0x7665('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x7665('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x7665('0xd')},'offline_chat_button':{'type':Sequelize[_0x7665('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x7665('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x7665('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x7665('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x7665('0xf')]},'closingQuestion':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x12')},'noteTitle':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x13')},'placeholderMessage':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x14')},'closingMessage':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x15')},'closingMessageButton':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x16')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x7665('0x17')},'conditionAgreement':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x18')},'ratingType':{'type':Sequelize['ENUM'](_0x7665('0x19'),_0x7665('0x1a')),'defaultValue':_0x7665('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x7665('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x7665('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x7665('0x1b'),'variable':null,'config':{'placeholder':'name','type':_0x7665('0x1c'),'required':!![]},'props':{'title':_0x7665('0x1d'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x7665('0x4'),'type':_0x7665('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x7665('0x1e'))?JSON[_0x7665('0x1f')](this[_0x7665('0x20')]('onlineForm')):{};},'set':function(_0x5b5be6){return this['setDataValue']('onlineForm',JSON[_0x7665('0x21')](_0x5b5be6));}},'offlineForm':{'type':Sequelize[_0x7665('0xf')],'defaultValue':function(){return JSON[_0x7665('0x21')]({'items':[{'type':'input','props':{'title':_0x7665('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x7665('0x4'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':_0x7665('0x22')},'props':{'title':_0x7665('0x22'),'helpText':_0x7665('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x7665('0x20')](_0x7665('0x24'))?JSON[_0x7665('0x1f')](this['getDataValue'](_0x7665('0x24'))):{};},'set':function(_0x55d046){return this['setDataValue'](_0x7665('0x24'),JSON[_0x7665('0x21')](_0x55d046));}},'token':{'type':Sequelize[_0x7665('0x2')],'defaultValue':function(){return rs[_0x7665('0x25')]();}},'autoclose':{'type':Sequelize[_0x7665('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x7665('0x2')]},'forwardOffline':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x7665('0x2')]},'waitingTitle':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x26')},'waitingMessage':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x28')},'offlineMessageBody':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x7665('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x7665('0x2a')},'skipUnmanaged':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x17')},'sendUnmanaged':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x16')},'enableCustomerAttachment':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x7665('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x7665('0x2')]},'notificationTemplate':{'type':Sequelize[_0x7665('0xf')],'defaultValue':function(){return _0x7665('0x2b');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x7665('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x7665('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x2c')},'verticalAlignment':{'type':Sequelize[_0x7665('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x2d')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x7665('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x7665('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x7665('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7665('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7665('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x7665('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x7665('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7665('0x8')],'comment':_0x7665('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![],'comment':_0x7665('0x2f'),'set':function(_0x30d450){if(!_0x30d450)this[_0x7665('0x30')](_0x7665('0x31'),null);this[_0x7665('0x30')](_0x7665('0x32'),_0x30d450);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 3286e5b..1c6bba4 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 _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 +var _0xd9c3=['autoAssociation','catch','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','options','removeDispositions','addAnswer','CannedAnswer','pick','removeAnswers','ids','sitepic','addAvatar','agentAvatar','addCustomerAvatar','file','filename','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey','CmList','List','Contacts','ChatApplication','Applications','account','applications','orderBy','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','type','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','lastName','messageId','created','autoclose','close','unmanaged','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','offline','difference','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','MailAccount','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','timezone','interval','indexOf','true','info','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','custom','License','increment','chatLicenseExceeded','push','all','some','server/files/chat/iframe.js','remote','x-real-ip','connection','remoteAddress','virtual','replace','alignment','verticalAlignment','textColor','addApplications','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','userChatWebsite:save','removeAgents','emit','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd9c3,0xc2));var _0x3d9c=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xd9c3[_0x2b7764];return _0x848dcb;};'use strict';var pdf=require(_0x3d9c('0x0'));var emlformat=require(_0x3d9c('0x1'));var rimraf=require(_0x3d9c('0x2'));var zipdir=require(_0x3d9c('0x3'));var jsonpatch=require(_0x3d9c('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3d9c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3d9c('0x6'));var sox=require(_0x3d9c('0x7'));var csv=require(_0x3d9c('0x8'));var ejs=require(_0x3d9c('0x9'));var fs=require('fs');var _=require(_0x3d9c('0xa'));var squel=require(_0x3d9c('0xb'));var crypto=require('crypto');var jsforce=require(_0x3d9c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d9c('0xd'));var Papa=require(_0x3d9c('0xe'));var Redis=require(_0x3d9c('0xf'));var authService=require(_0x3d9c('0x10'));var qs=require(_0x3d9c('0x11'));var as=require(_0x3d9c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d9c('0x13'))(_0x3d9c('0x14'));var utils=require(_0x3d9c('0x15'));var config=require(_0x3d9c('0x16'));var licenseUtil=require(_0x3d9c('0x17'));var db=require(_0x3d9c('0x18'))['db'];config[_0x3d9c('0x19')]=_[_0x3d9c('0x1a')](config[_0x3d9c('0x19')],{'host':_0x3d9c('0x1b'),'port':0x18eb});var socket=require(_0x3d9c('0x1c'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x3d9c('0x1d')](socket);var jayson=require(_0x3d9c('0x1e'));var client=jayson[_0x3d9c('0x1f')][_0x3d9c('0x20')]({'port':0x232c});var client9002=jayson[_0x3d9c('0x1f')][_0x3d9c('0x20')]({'port':0x232a});var client9003=jayson[_0x3d9c('0x1f')]['http']({'port':0x232b});function respondWithRpcPromise(_0x25fe0,_0x504baf,_0xdaea50,_0x439fcc){return new BPromise(function(_0x4672bf,_0x563eb0){var _0x342656=_0x439fcc||client;return _0x342656['request'](_0x25fe0,_0xdaea50)['then'](function(_0x25bf54){logger['info'](_0x3d9c('0x21'),_0x504baf,_0x3d9c('0x22'));logger[_0x3d9c('0x23')](_0x3d9c('0x24'),_0x504baf,_0x3d9c('0x22'),JSON[_0x3d9c('0x25')](_0x25bf54));if(_0x25bf54['error']){if(_0x25bf54[_0x3d9c('0x26')][_0x3d9c('0x27')]===0x1f4){logger['error'](_0x3d9c('0x21'),_0x504baf,_0x25bf54[_0x3d9c('0x26')][_0x3d9c('0x28')]);return _0x563eb0(_0x25bf54[_0x3d9c('0x26')][_0x3d9c('0x28')]);}logger[_0x3d9c('0x26')](_0x3d9c('0x21'),_0x504baf,_0x25bf54[_0x3d9c('0x26')][_0x3d9c('0x28')]);return _0x4672bf(_0x25bf54[_0x3d9c('0x26')][_0x3d9c('0x28')]);}else{logger['info'](_0x3d9c('0x21'),_0x504baf,'request\x20sent');_0x4672bf(_0x25bf54[_0x3d9c('0x29')]['message']);}})['catch'](function(_0x55a998){logger[_0x3d9c('0x26')](_0x3d9c('0x21'),_0x504baf,_0x55a998);_0x563eb0(_0x55a998);});});}function respondWithStatusCode(_0x3f2bf1,_0x58d744){_0x58d744=_0x58d744||0xcc;return function(_0x3773d0){if(_0x3773d0){return _0x3f2bf1[_0x3d9c('0x2a')](_0x58d744);}return _0x3f2bf1[_0x3d9c('0x2b')](_0x58d744)[_0x3d9c('0x2c')]();};}function respondWithResult(_0x21dd4a,_0x4048fe){_0x4048fe=_0x4048fe||0xc8;return function(_0x58a1a3){if(_0x58a1a3){return _0x21dd4a['status'](_0x4048fe)[_0x3d9c('0x2d')](_0x58a1a3);}};}function respondWithFilteredResult(_0x38e909,_0x36ef10){return function(_0x5c9bfd){if(_0x5c9bfd){var _0x3e3458=_0x5c9bfd['count'],_0x34a2c4=_0x36ef10[_0x3d9c('0x2e')],_0x3ceae2=_0x36ef10['offset']+_0x36ef10[_0x3d9c('0x2f')],_0x20c846;if(_0x3ceae2>=_0x3e3458){_0x3ceae2=_0x3e3458;_0x20c846=0xc8;}else{_0x20c846=0xce;}_0x38e909[_0x3d9c('0x2b')](_0x20c846);return _0x38e909[_0x3d9c('0x30')](_0x3d9c('0x31'),_0x34a2c4+'-'+_0x3ceae2+'/'+_0x3e3458)[_0x3d9c('0x2d')](_0x5c9bfd);}return null;};}function patchUpdates(_0x3d70d9){return function(_0x402088){try{jsonpatch['apply'](_0x402088,_0x3d70d9,!![]);}catch(_0x2dd640){return BPromise[_0x3d9c('0x32')](_0x2dd640);}return _0x402088[_0x3d9c('0x33')]();};}function saveUpdates(_0x4d5502,_0x50badb){return function(_0x577516){if(_0x577516){return _0x577516[_0x3d9c('0x34')](_0x4d5502)[_0x3d9c('0x35')](function(_0x155556){return _0x155556;});}return null;};}function removeEntity(_0x4ff58c,_0x308391){return function(_0x5dd389){if(_0x5dd389){return _0x5dd389[_0x3d9c('0x36')]()['then'](function(){var _0x4839c8=_0x5dd389['get']({'plain':!![]});var _0x3f853c=_0x3d9c('0x37');return db[_0x3d9c('0x38')][_0x3d9c('0x36')]({'where':{'type':_0x3f853c,'resourceId':_0x4839c8['id']}})[_0x3d9c('0x35')](function(){return _0x5dd389;});})[_0x3d9c('0x35')](function(){_0x4ff58c[_0x3d9c('0x2b')](0xcc)[_0x3d9c('0x2c')]();});}};}function handleEntityNotFound(_0x38e755,_0x3cfd46){return function(_0x6e4e80){if(!_0x6e4e80){_0x38e755['sendStatus'](0x194);}return _0x6e4e80;};}function handleError(_0x5ec444,_0x4d1fca){_0x4d1fca=_0x4d1fca||0x1f4;return function(_0x5e89a1){logger[_0x3d9c('0x26')](_0x5e89a1[_0x3d9c('0x39')]);if(_0x5e89a1[_0x3d9c('0x3a')]){delete _0x5e89a1[_0x3d9c('0x3a')];}_0x5ec444[_0x3d9c('0x2b')](_0x4d1fca)[_0x3d9c('0x3b')](_0x5e89a1);};}exports[_0x3d9c('0x3c')]=function(_0x2e9a8b,_0x1e4eda){var _0x2755ea={'include':[{'model':db[_0x3d9c('0x3d')],'as':_0x3d9c('0x3e')}]},_0x32d456={},_0x50afe2={'count':0x0,'rows':[]};var _0x185b0e=_[_0x3d9c('0x3f')](db[_0x3d9c('0x40')][_0x3d9c('0x41')],function(_0x225375){return{'name':_0x225375[_0x3d9c('0x42')],'type':_0x225375['type']['key']};});_0x32d456[_0x3d9c('0x43')]=_[_0x3d9c('0x3f')](_0x185b0e,_0x3d9c('0x3a'));_0x32d456[_0x3d9c('0x44')]=_['keys'](_0x2e9a8b['query']);_0x32d456['filters']=_[_0x3d9c('0x45')](_0x32d456[_0x3d9c('0x43')],_0x32d456[_0x3d9c('0x44')]);_0x2755ea[_0x3d9c('0x46')]=_[_0x3d9c('0x45')](_0x32d456[_0x3d9c('0x43')],qs[_0x3d9c('0x47')](_0x2e9a8b[_0x3d9c('0x44')]['fields']));_0x2755ea[_0x3d9c('0x46')]=_0x2755ea[_0x3d9c('0x46')][_0x3d9c('0x48')]?_0x2755ea[_0x3d9c('0x46')]:_0x32d456[_0x3d9c('0x43')];if(!_0x2e9a8b[_0x3d9c('0x44')][_0x3d9c('0x49')](_0x3d9c('0x4a'))){_0x2755ea[_0x3d9c('0x2f')]=qs[_0x3d9c('0x2f')](_0x2e9a8b[_0x3d9c('0x44')][_0x3d9c('0x2f')]);_0x2755ea[_0x3d9c('0x2e')]=qs[_0x3d9c('0x2e')](_0x2e9a8b[_0x3d9c('0x44')]['offset']);}_0x2755ea['order']=qs[_0x3d9c('0x4b')](_0x2e9a8b[_0x3d9c('0x44')][_0x3d9c('0x4b')]);_0x2755ea[_0x3d9c('0x4c')]=qs['filters'](_['pick'](_0x2e9a8b['query'],_0x32d456[_0x3d9c('0x4d')]),_0x185b0e);if(_0x2e9a8b['query'][_0x3d9c('0x4e')]){_0x2755ea['where']=_[_0x3d9c('0x4f')](_0x2755ea[_0x3d9c('0x4c')],{'$or':_['map'](_0x185b0e,function(_0x2bcc8c){if(_0x2bcc8c['type']!==_0x3d9c('0x50')){var _0x326b65={};_0x326b65[_0x2bcc8c[_0x3d9c('0x3a')]]={'$like':'%'+_0x2e9a8b[_0x3d9c('0x44')][_0x3d9c('0x4e')]+'%'};return _0x326b65;}})});}_0x2755ea=_['merge']({},_0x2755ea,_0x2e9a8b['options']);var _0x467e6c={'where':_0x2755ea['where']};return db[_0x3d9c('0x40')]['count'](_0x467e6c)['then'](function(_0x922863){_0x50afe2[_0x3d9c('0x51')]=_0x922863;if(_0x2e9a8b[_0x3d9c('0x44')][_0x3d9c('0x52')]){_0x2755ea[_0x3d9c('0x53')]=[{'all':!![]}];}return db[_0x3d9c('0x40')][_0x3d9c('0x54')](_0x2755ea);})[_0x3d9c('0x35')](function(_0x7b0e8){_0x50afe2[_0x3d9c('0x55')]=_0x7b0e8;return _0x50afe2;})[_0x3d9c('0x35')](respondWithFilteredResult(_0x1e4eda,_0x2755ea))['catch'](handleError(_0x1e4eda,null));};exports[_0x3d9c('0x56')]=function(_0xe4db69,_0x2a7161){var _0x13292d={'raw':![],'where':{'id':_0xe4db69[_0x3d9c('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x3d9c('0x3e')}]},_0x18c691={};_0x18c691[_0x3d9c('0x43')]=_['keys'](db['ChatWebsite'][_0x3d9c('0x41')]);_0x18c691['query']=_[_0x3d9c('0x58')](_0xe4db69['query']);_0x18c691[_0x3d9c('0x4d')]=_['intersection'](_0x18c691[_0x3d9c('0x43')],_0x18c691[_0x3d9c('0x44')]);_0x13292d[_0x3d9c('0x46')]=_[_0x3d9c('0x45')](_0x18c691['model'],qs[_0x3d9c('0x47')](_0xe4db69[_0x3d9c('0x44')]['fields']));_0x13292d[_0x3d9c('0x46')]=_0x13292d[_0x3d9c('0x46')][_0x3d9c('0x48')]?_0x13292d[_0x3d9c('0x46')]:_0x18c691[_0x3d9c('0x43')];if(_0xe4db69[_0x3d9c('0x44')][_0x3d9c('0x52')]){_0x13292d['include']=[{'all':!![]}];}_0x13292d=_[_0x3d9c('0x4f')]({},_0x13292d,_0xe4db69['options']);return db[_0x3d9c('0x40')][_0x3d9c('0x59')](_0x13292d)['then'](handleEntityNotFound(_0x2a7161,null))[_0x3d9c('0x35')](respondWithResult(_0x2a7161,null))['catch'](handleError(_0x2a7161,null));};exports[_0x3d9c('0x5a')]=function(_0x3c6dcc,_0x45477c){return db[_0x3d9c('0x40')][_0x3d9c('0x5a')](_0x3c6dcc['body'],{})[_0x3d9c('0x35')](function(_0x1ed013){var _0xb0f987=_0x3c6dcc[_0x3d9c('0x5b')][_0x3d9c('0x5c')]({'plain':!![]});if(!_0xb0f987)throw new Error(_0x3d9c('0x5d'));if(_0xb0f987['role']===_0x3d9c('0x5b')){var _0x594618=_0x1ed013[_0x3d9c('0x5c')]({'plain':!![]});var _0x59a97a=_0x3d9c('0x37');return db[_0x3d9c('0x5e')][_0x3d9c('0x59')]({'where':{'name':_0x59a97a,'userProfileId':_0xb0f987[_0x3d9c('0x5f')]},'raw':!![]})['then'](function(_0x2b8491){if(_0x2b8491&&_0x2b8491[_0x3d9c('0x60')]===0x0){return db[_0x3d9c('0x38')]['create']({'name':_0x594618['name'],'resourceId':_0x594618['id'],'type':_0x2b8491[_0x3d9c('0x3a')],'sectionId':_0x2b8491['id']},{})[_0x3d9c('0x35')](function(){return _0x1ed013;});}else{return _0x1ed013;}})[_0x3d9c('0x61')](function(_0x5b58ab){logger[_0x3d9c('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b58ab);throw _0x5b58ab;});}return _0x1ed013;})['then'](respondWithResult(_0x45477c,0xc9))[_0x3d9c('0x61')](handleError(_0x45477c,null));};exports[_0x3d9c('0x34')]=function(_0x5ae139,_0x498857){if(_0x5ae139[_0x3d9c('0x62')]['id']){delete _0x5ae139['body']['id'];}return db[_0x3d9c('0x40')]['find']({'where':{'id':_0x5ae139[_0x3d9c('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x3d9c('0x3e')}]})[_0x3d9c('0x35')](handleEntityNotFound(_0x498857,null))['then'](saveUpdates(_0x5ae139['body'],null))['then'](respondWithResult(_0x498857,null))['catch'](handleError(_0x498857,null));};exports[_0x3d9c('0x36')]=function(_0x342959,_0x41059f){return db[_0x3d9c('0x40')][_0x3d9c('0x59')]({'where':{'id':_0x342959['params']['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x41059f,null))['then'](removeEntity(_0x41059f,null))[_0x3d9c('0x61')](handleError(_0x41059f,null));};exports['describe']=function(_0x348682,_0x5370a5){return db[_0x3d9c('0x40')][_0x3d9c('0x63')]()['then'](respondWithResult(_0x5370a5,null))[_0x3d9c('0x61')](handleError(_0x5370a5,null));};exports[_0x3d9c('0x64')]=function(_0x2e20e7,_0x1fe306,_0x2f20ad){if(_0x2e20e7[_0x3d9c('0x62')]['id']){delete _0x2e20e7[_0x3d9c('0x62')]['id'];}return db['ChatWebsite'][_0x3d9c('0x59')]({'where':{'id':_0x2e20e7[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x1fe306,null))[_0x3d9c('0x35')](function(_0x473c47){if(_0x473c47){_0x2e20e7[_0x3d9c('0x62')][_0x3d9c('0x65')]=_0x473c47['id'];return db[_0x3d9c('0x66')][_0x3d9c('0x5a')](_0x2e20e7[_0x3d9c('0x62')]);}})['then'](respondWithResult(_0x1fe306,null))[_0x3d9c('0x61')](handleError(_0x1fe306,null));};exports[_0x3d9c('0x67')]=function(_0x3fb9a0,_0x3f84cc,_0x3cb623){var _0xa74e69={'raw':![],'where':{}};var _0x6637c6={};var _0x3575f5={'count':0x0,'rows':[]};return db[_0x3d9c('0x40')][_0x3d9c('0x68')]({'where':{'id':_0x3fb9a0[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x3f84cc,null))['then'](function(_0x3912b0){if(_0x3912b0){_0x6637c6['model']=_[_0x3d9c('0x58')](db[_0x3d9c('0x66')][_0x3d9c('0x41')]);_0x6637c6[_0x3d9c('0x44')]=_[_0x3d9c('0x58')](_0x3fb9a0[_0x3d9c('0x44')]);_0x6637c6['filters']=_['intersection'](_0x6637c6['model'],_0x6637c6[_0x3d9c('0x44')]);_0xa74e69['attributes']=_[_0x3d9c('0x45')](_0x6637c6['model'],qs[_0x3d9c('0x47')](_0x3fb9a0[_0x3d9c('0x44')][_0x3d9c('0x47')]));_0xa74e69[_0x3d9c('0x46')]=_0xa74e69['attributes'][_0x3d9c('0x48')]?_0xa74e69['attributes']:_0x6637c6[_0x3d9c('0x43')];if(!_0x3fb9a0[_0x3d9c('0x44')][_0x3d9c('0x49')]('nolimit')){_0xa74e69[_0x3d9c('0x2f')]=qs[_0x3d9c('0x2f')](_0x3fb9a0['query']['limit']);_0xa74e69[_0x3d9c('0x2e')]=qs[_0x3d9c('0x2e')](_0x3fb9a0['query']['offset']);}_0xa74e69[_0x3d9c('0x69')]=qs['sort'](_0x3fb9a0['query'][_0x3d9c('0x4b')]);_0xa74e69[_0x3d9c('0x4c')]=qs['filters'](_['pick'](_0x3fb9a0[_0x3d9c('0x44')],_0x6637c6['filters']));_0xa74e69[_0x3d9c('0x4c')]['ChatWebsiteId']=_0x3912b0['id'];if(_0x3fb9a0[_0x3d9c('0x44')][_0x3d9c('0x4e')]){_0xa74e69[_0x3d9c('0x4c')]=_[_0x3d9c('0x4f')](_0xa74e69['where'],{'$or':_[_0x3d9c('0x3f')](_0xa74e69[_0x3d9c('0x46')],function(_0x4ca465){var _0x35d643={};_0x35d643[_0x4ca465]={'$like':'%'+_0x3fb9a0[_0x3d9c('0x44')][_0x3d9c('0x4e')]+'%'};return _0x35d643;})});}_0xa74e69=_['merge']({},_0xa74e69,_0x3fb9a0[_0x3d9c('0x6a')]);return db[_0x3d9c('0x66')]['count']({'where':_0xa74e69[_0x3d9c('0x4c')]})[_0x3d9c('0x35')](function(_0x24617e){_0x3575f5[_0x3d9c('0x51')]=_0x24617e;if(_0x3fb9a0['query'][_0x3d9c('0x52')]){_0xa74e69[_0x3d9c('0x53')]=[{'all':!![]}];}return db[_0x3d9c('0x66')][_0x3d9c('0x54')](_0xa74e69);})[_0x3d9c('0x35')](function(_0x220706){_0x3575f5[_0x3d9c('0x55')]=_0x220706;return _0x3575f5;});}})[_0x3d9c('0x35')](respondWithFilteredResult(_0x3f84cc,_0xa74e69))[_0x3d9c('0x61')](handleError(_0x3f84cc,null));};exports[_0x3d9c('0x6b')]=function(_0x216efc,_0x843aa3,_0x2f218e){return db['ChatWebsite'][_0x3d9c('0x59')]({'where':{'id':_0x216efc[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x843aa3,null))[_0x3d9c('0x35')](function(_0x58e52a){if(_0x58e52a){return _0x58e52a[_0x3d9c('0x6b')](_0x216efc[_0x3d9c('0x44')]['ids']);}})[_0x3d9c('0x35')](respondWithStatusCode(_0x843aa3,null))[_0x3d9c('0x61')](handleError(_0x843aa3,null));};exports[_0x3d9c('0x6c')]=function(_0xb1e63d,_0x5c0baf,_0x14ef74){if(_0xb1e63d[_0x3d9c('0x62')]['id']){delete _0xb1e63d[_0x3d9c('0x62')]['id'];}return db[_0x3d9c('0x40')][_0x3d9c('0x59')]({'where':{'id':_0xb1e63d[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x5c0baf,null))[_0x3d9c('0x35')](function(_0x1a6fbd){if(_0x1a6fbd){_0xb1e63d[_0x3d9c('0x62')][_0x3d9c('0x65')]=_0x1a6fbd['id'];return db[_0x3d9c('0x6d')][_0x3d9c('0x5a')](_0xb1e63d[_0x3d9c('0x62')]);}})[_0x3d9c('0x35')](respondWithResult(_0x5c0baf,null))[_0x3d9c('0x61')](handleError(_0x5c0baf,null));};exports['getAnswers']=function(_0x3afcba,_0x28bb9e,_0x3bcdb2){var _0x94e2a5={'raw':![],'where':{}};var _0x33cc90={};var _0x4f4e0c={'count':0x0,'rows':[]};return db[_0x3d9c('0x40')][_0x3d9c('0x68')]({'where':{'id':_0x3afcba[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x28bb9e,null))[_0x3d9c('0x35')](function(_0x8d3482){if(_0x8d3482){_0x33cc90['model']=_[_0x3d9c('0x58')](db[_0x3d9c('0x6d')][_0x3d9c('0x41')]);_0x33cc90['query']=_[_0x3d9c('0x58')](_0x3afcba[_0x3d9c('0x44')]);_0x33cc90[_0x3d9c('0x4d')]=_[_0x3d9c('0x45')](_0x33cc90[_0x3d9c('0x43')],_0x33cc90[_0x3d9c('0x44')]);_0x94e2a5[_0x3d9c('0x46')]=_[_0x3d9c('0x45')](_0x33cc90[_0x3d9c('0x43')],qs[_0x3d9c('0x47')](_0x3afcba['query']['fields']));_0x94e2a5[_0x3d9c('0x46')]=_0x94e2a5['attributes'][_0x3d9c('0x48')]?_0x94e2a5['attributes']:_0x33cc90[_0x3d9c('0x43')];if(!_0x3afcba[_0x3d9c('0x44')][_0x3d9c('0x49')](_0x3d9c('0x4a'))){_0x94e2a5[_0x3d9c('0x2f')]=qs[_0x3d9c('0x2f')](_0x3afcba[_0x3d9c('0x44')][_0x3d9c('0x2f')]);_0x94e2a5[_0x3d9c('0x2e')]=qs[_0x3d9c('0x2e')](_0x3afcba[_0x3d9c('0x44')]['offset']);}_0x94e2a5[_0x3d9c('0x69')]=qs[_0x3d9c('0x4b')](_0x3afcba[_0x3d9c('0x44')]['sort']);_0x94e2a5[_0x3d9c('0x4c')]=qs[_0x3d9c('0x4d')](_[_0x3d9c('0x6e')](_0x3afcba[_0x3d9c('0x44')],_0x33cc90[_0x3d9c('0x4d')]));_0x94e2a5[_0x3d9c('0x4c')][_0x3d9c('0x65')]=_0x8d3482['id'];if(_0x3afcba[_0x3d9c('0x44')]['filter']){_0x94e2a5[_0x3d9c('0x4c')]=_[_0x3d9c('0x4f')](_0x94e2a5['where'],{'$or':_['map'](_0x94e2a5[_0x3d9c('0x46')],function(_0x49dd9d){var _0xfcb8ee={};_0xfcb8ee[_0x49dd9d]={'$like':'%'+_0x3afcba['query']['filter']+'%'};return _0xfcb8ee;})});}_0x94e2a5=_[_0x3d9c('0x4f')]({},_0x94e2a5,_0x3afcba[_0x3d9c('0x6a')]);return db['CannedAnswer'][_0x3d9c('0x51')]({'where':_0x94e2a5['where']})[_0x3d9c('0x35')](function(_0x589f9d){_0x4f4e0c['count']=_0x589f9d;if(_0x3afcba[_0x3d9c('0x44')]['includeAll']){_0x94e2a5[_0x3d9c('0x53')]=[{'all':!![]}];}return db[_0x3d9c('0x6d')][_0x3d9c('0x54')](_0x94e2a5);})['then'](function(_0x541777){_0x4f4e0c[_0x3d9c('0x55')]=_0x541777;return _0x4f4e0c;});}})[_0x3d9c('0x35')](respondWithFilteredResult(_0x28bb9e,_0x94e2a5))[_0x3d9c('0x61')](handleError(_0x28bb9e,null));};exports[_0x3d9c('0x6f')]=function(_0x1b0d03,_0x135615,_0x2a3c72){return db[_0x3d9c('0x40')][_0x3d9c('0x59')]({'where':{'id':_0x1b0d03[_0x3d9c('0x57')]['id']}})['then'](handleEntityNotFound(_0x135615,null))[_0x3d9c('0x35')](function(_0x129fe2){if(_0x129fe2){return _0x129fe2[_0x3d9c('0x6f')](_0x1b0d03[_0x3d9c('0x44')][_0x3d9c('0x70')]);}})[_0x3d9c('0x35')](respondWithStatusCode(_0x135615,null))[_0x3d9c('0x61')](handleError(_0x135615,null));};exports['addLogo']=function(_0x20a9fb,_0x49a120,_0x390c9e){_0x20a9fb[_0x3d9c('0x62')][_0x3d9c('0x71')]=_0x20a9fb['file']['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x20a9fb[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x49a120,null))['then'](saveUpdates(_0x20a9fb['body'],null))[_0x3d9c('0x35')](respondWithResult(_0x49a120,null))[_0x3d9c('0x61')](handleError(_0x49a120,null));};exports[_0x3d9c('0x72')]=function(_0x4b9762,_0x12b288,_0x592326){_0x4b9762['body'][_0x3d9c('0x73')]=_0x4b9762['file']['filename'];return db[_0x3d9c('0x40')][_0x3d9c('0x59')]({'where':{'id':_0x4b9762['params']['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x12b288,null))[_0x3d9c('0x35')](saveUpdates(_0x4b9762['body'],null))[_0x3d9c('0x35')](respondWithResult(_0x12b288,null))[_0x3d9c('0x61')](handleError(_0x12b288,null));};exports[_0x3d9c('0x74')]=function(_0xe26896,_0xc71ad7,_0x4a128a){_0xe26896[_0x3d9c('0x62')]['customerAvatar']=_0xe26896[_0x3d9c('0x75')][_0x3d9c('0x76')];return db[_0x3d9c('0x40')][_0x3d9c('0x59')]({'where':{'id':_0xe26896['params']['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0xc71ad7,null))[_0x3d9c('0x35')](saveUpdates(_0xe26896['body'],null))[_0x3d9c('0x35')](respondWithResult(_0xc71ad7,null))['catch'](handleError(_0xc71ad7,null));};exports[_0x3d9c('0x77')]=function(_0x428bb0,_0x51adac,_0x27eb59){_0x428bb0[_0x3d9c('0x62')][_0x3d9c('0x78')]=_0x428bb0['file'][_0x3d9c('0x76')];return db[_0x3d9c('0x40')]['find']({'where':{'id':_0x428bb0[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x51adac,null))[_0x3d9c('0x35')](saveUpdates(_0x428bb0[_0x3d9c('0x62')],null))['then'](respondWithResult(_0x51adac,null))['catch'](handleError(_0x51adac,null));};exports[_0x3d9c('0x79')]=function(_0x3b402d,_0xa0dddc,_0x49f0fe){var _0x2ebb88=path[_0x3d9c('0x7a')](config[_0x3d9c('0x7b')],_0x3d9c('0x7c'));var _0x4eb7d1={'where':{'id':_0x3b402d[_0x3d9c('0x57')]['id']},'attributes':['id',_0x3d9c('0x71')],'raw':!![]};var _0x39c1a6=![];return require(_0x3d9c('0x17'))[_0x3d9c('0x7d')]()[_0x3d9c('0x35')](function(_0x3cfdb0){if(_0x3cfdb0){_0x39c1a6=_0x3cfdb0['custom'];}})[_0x3d9c('0x35')](function(){return db[_0x3d9c('0x40')]['find'](_0x4eb7d1);})[_0x3d9c('0x35')](handleEntityNotFound(_0xa0dddc,null))[_0x3d9c('0x35')](function(_0x5b3631){if(_0x5b3631){if(!_[_0x3d9c('0x7e')](_0x5b3631[_0x3d9c('0x71')])){if(fs['existsSync'](path[_0x3d9c('0x7a')](config[_0x3d9c('0x7b')],_0x3d9c('0x7f'),_0x5b3631[_0x3d9c('0x71')]))&&_0x39c1a6){_0x2ebb88=path['join'](config[_0x3d9c('0x7b')],_0x3d9c('0x7f'),_0x5b3631[_0x3d9c('0x71')]);}}return _0xa0dddc[_0x3d9c('0x80')](_0x2ebb88);}})['catch'](handleError(_0xa0dddc,null));};exports[_0x3d9c('0x81')]=function(_0x18f717,_0x3bddfb,_0x3c8b76){var _0x5264fe=path[_0x3d9c('0x7a')](config[_0x3d9c('0x7b')],_0x3d9c('0x82'));var _0x1b54e1={'where':{'id':_0x18f717[_0x3d9c('0x57')]['id']},'attributes':['id',_0x3d9c('0x73')],'raw':!![]};return db[_0x3d9c('0x40')][_0x3d9c('0x59')](_0x1b54e1)[_0x3d9c('0x35')](handleEntityNotFound(_0x3bddfb,null))['then'](function(_0x532fc9){if(_0x532fc9){if(!_[_0x3d9c('0x7e')](_0x532fc9['agentAvatar'])){if(fs[_0x3d9c('0x83')](path[_0x3d9c('0x7a')](config[_0x3d9c('0x7b')],_0x3d9c('0x84'),_0x532fc9[_0x3d9c('0x73')]))){_0x5264fe=path[_0x3d9c('0x7a')](config[_0x3d9c('0x7b')],_0x3d9c('0x84'),_0x532fc9[_0x3d9c('0x73')]);}}return _0x3bddfb[_0x3d9c('0x80')](_0x5264fe);}})['catch'](handleError(_0x3bddfb,null));};exports['getCustomerAvatar']=function(_0x4c8306,_0x458ae5,_0xcc9677){var _0x394c24=path[_0x3d9c('0x7a')](config[_0x3d9c('0x7b')],_0x3d9c('0x85'));var _0x5b1552={'where':{'id':_0x4c8306['params']['id']},'attributes':['id',_0x3d9c('0x86'),'showCustomerAvatar'],'raw':!![]};return db[_0x3d9c('0x40')]['find'](_0x5b1552)[_0x3d9c('0x35')](handleEntityNotFound(_0x458ae5,null))['then'](function(_0x44938a){if(_0x44938a){if(!_['isNil'](_0x44938a[_0x3d9c('0x86')])){if(fs['existsSync'](path[_0x3d9c('0x7a')](config[_0x3d9c('0x7b')],_0x3d9c('0x84'),_0x44938a[_0x3d9c('0x86')]))&&_0x44938a[_0x3d9c('0x87')]){_0x394c24=path['join'](config['root'],_0x3d9c('0x84'),_0x44938a['customerAvatar']);}}return _0x458ae5['download'](_0x394c24);}})['catch'](handleError(_0x458ae5,null));};exports[_0x3d9c('0x88')]=function(_0x6c5981,_0x19f91c,_0x34ea05){var _0x1508c5=path['join'](config['root'],_0x3d9c('0x89'));var _0x5acd8e={'where':{'id':_0x6c5981[_0x3d9c('0x57')]['id']},'attributes':['id',_0x3d9c('0x78')],'raw':!![]};return db[_0x3d9c('0x40')][_0x3d9c('0x59')](_0x5acd8e)[_0x3d9c('0x35')](handleEntityNotFound(_0x19f91c,null))[_0x3d9c('0x35')](function(_0x27bba3){if(_0x27bba3){if(!_[_0x3d9c('0x7e')](_0x27bba3[_0x3d9c('0x78')])){if(fs[_0x3d9c('0x83')](path[_0x3d9c('0x7a')](config[_0x3d9c('0x7b')],_0x3d9c('0x84'),_0x27bba3[_0x3d9c('0x78')]))){_0x1508c5=path[_0x3d9c('0x7a')](config[_0x3d9c('0x7b')],_0x3d9c('0x84'),_0x27bba3[_0x3d9c('0x78')]);}}return _0x19f91c[_0x3d9c('0x80')](_0x1508c5);}})[_0x3d9c('0x61')](handleError(_0x19f91c,null));};exports[_0x3d9c('0x8a')]=function(_0x2ee327,_0x463303,_0x12bfde){var _0x40d1d5=require(_0x3d9c('0x8b'));var _0x46b4b3=new _0x40d1d5();var _0x1e2d07=_0x46b4b3[_0x3d9c('0x8c')](_0x2ee327[_0x3d9c('0x8d')][_0x3d9c('0x8e')])[_0x3d9c('0x8f')]();var _0x20f431={'body':_0x2ee327['body'],'channel':_0x3d9c('0x90')};var _0xd87922=[];var _0x58f618=[];var _0x43d37a={};var _0x493f3c=![];return db[_0x3d9c('0x91')][_0x3d9c('0x63')]()['then'](function(_0x66a01e){if(!_0x66a01e){throw new db[(_0x3d9c('0x92'))][(_0x3d9c('0x93'))](_0x3d9c('0x94'));}_0xd87922=_['difference'](_['keys'](_0x66a01e),['createdAt',_0x3d9c('0x95')]);_0x58f618=_['difference'](_[_0x3d9c('0x58')](_0x66a01e),[_0x3d9c('0x96'),_0x3d9c('0x95'),_0x3d9c('0x97'),_0x3d9c('0x98')]);if(_0x2ee327[_0x3d9c('0x62')]['id']){delete _0x2ee327[_0x3d9c('0x62')]['id'];}if(_[_0x3d9c('0x7e')](_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0x99')])){throw new db[(_0x3d9c('0x92'))][(_0x3d9c('0x93'))](_0x3d9c('0x9a'));}if(_['isNil'](_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0x62')])||_0x2ee327['body']['body']===''){throw new db[(_0x3d9c('0x92'))][(_0x3d9c('0x93'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3d9c('0x7e')](_0x2ee327['body'][_0x3d9c('0x9b')])){throw new db[(_0x3d9c('0x92'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x58f618);}if(!_['includes'](_0x58f618,_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0x9b')])){throw new db[(_0x3d9c('0x92'))][(_0x3d9c('0x93'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x58f618);}_0x43d37a[_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0x9b')]]=_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0x99')];})[_0x3d9c('0x35')](function(){return db[_0x3d9c('0x40')][_0x3d9c('0x59')]({'where':{'id':_0x2ee327[_0x3d9c('0x57')]['id']},'include':[{'model':db[_0x3d9c('0x9c')],'as':_0x3d9c('0x9d'),'include':[{'model':db['CmContact'],'as':_0x3d9c('0x9e'),'where':_0x43d37a,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x3d9c('0x9f')],'as':_0x3d9c('0xa0')}]});})[_0x3d9c('0x35')](handleEntityNotFound(_0x463303,null))[_0x3d9c('0x35')](function(_0x14fe50){if(_0x14fe50&&_0x14fe50[_0x3d9c('0x9d')]){_0x20f431[_0x3d9c('0xa1')]=_0x14fe50;_0x20f431[_0x3d9c('0xa2')]=_0x14fe50[_0x3d9c('0xa0')];_0x20f431['list']=_0x14fe50[_0x3d9c('0x9d')];_0x20f431[_0x3d9c('0xa2')]=_[_0x3d9c('0xa3')](_0x20f431[_0x3d9c('0xa2')],[_0x3d9c('0xa4')],[_0x3d9c('0xa5')]);if(_0x20f431[_0x3d9c('0xa1')][_0x3d9c('0xa0')]){delete _0x20f431[_0x3d9c('0xa1')][_0x3d9c('0xa0')];}if(_0x20f431[_0x3d9c('0xa1')]['List']&&_0x20f431[_0x3d9c('0xa1')][_0x3d9c('0x9d')]['Contacts'][_0x3d9c('0x48')]){return _0x20f431[_0x3d9c('0xa1')][_0x3d9c('0x9d')]['Contacts'][0x0];}var _0x2a7835=_[_0x3d9c('0x1a')](_0x2ee327['body'],{'firstName':_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0x99')],'ListId':_0x14fe50[_0x3d9c('0x98')]});_0x2a7835[_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0x9b')]]=_0x2ee327['body'][_0x3d9c('0x99')];return db[_0x3d9c('0x91')][_0x3d9c('0x5a')](_0x2a7835,{'fields':_0xd87922,'raw':!![]});}})[_0x3d9c('0x35')](handleEntityNotFound(_0x463303,null))[_0x3d9c('0x35')](function(_0x58f86e){_0x20f431[_0x3d9c('0xa6')]=_0x58f86e;var _0x2ff880=_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0xa7')];if(_0x2ee327[_0x3d9c('0x8d')][_0x3d9c('0xa8')]){_0x2ff880=_0x2ee327[_0x3d9c('0x8d')][_0x3d9c('0xa8')];}else if(_0x2ee327['headers'][_0x3d9c('0xa9')]){_0x2ff880=_['first'](_0x2ee327[_0x3d9c('0x8d')][_0x3d9c('0xa9')][_0x3d9c('0xaa')](','));}if(_0x58f86e){var _0x582803={'ContactId':_0x58f86e['id'],'ChatWebsiteId':_0x2ee327[_0x3d9c('0x57')]['id'],'from':(_0x58f86e[_0x3d9c('0xab')]||'')+'\x20'+(_0x58f86e['lastName']||''),'customerIp':_0x2ff880,'customerPort':_0x2ee327[_0x3d9c('0x8d')][_0x3d9c('0xac')]?_0x2ee327[_0x3d9c('0x8d')][_0x3d9c('0xac')]:null,'referer':_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0xad')],'browserName':_0x1e2d07[_0x3d9c('0xae')][_0x3d9c('0x3a')]&&_0x1e2d07[_0x3d9c('0xae')][_0x3d9c('0xaf')]?util[_0x3d9c('0xb0')](_0x3d9c('0xb1'),_0x1e2d07[_0x3d9c('0xae')][_0x3d9c('0x3a')],_0x1e2d07[_0x3d9c('0xae')][_0x3d9c('0xaf')]):_0x3d9c('0xb2'),'browserVersion':_0x1e2d07[_0x3d9c('0xae')][_0x3d9c('0xaf')]||_0x3d9c('0xb2'),'osName':util['format'](_0x3d9c('0xb1'),_0x1e2d07['os'][_0x3d9c('0x3a')],_0x1e2d07['os']['version']),'osVersion':_0x1e2d07['os'][_0x3d9c('0xaf')],'deviceModel':_0x1e2d07[_0x3d9c('0xb3')][_0x3d9c('0x43')]&&_0x1e2d07[_0x3d9c('0xb3')][_0x3d9c('0xb4')]?util[_0x3d9c('0xb0')](_0x3d9c('0xb5'),_0x1e2d07[_0x3d9c('0xb3')][_0x3d9c('0x43')],_0x1e2d07[_0x3d9c('0xb3')][_0x3d9c('0xb4')],_0x1e2d07[_0x3d9c('0xb3')][_0x3d9c('0xb6')]):null,'deviceVendor':_0x1e2d07[_0x3d9c('0xb3')]['vendor'],'deviceType':_0x1e2d07[_0x3d9c('0xb3')][_0x3d9c('0xb6')],'formData':JSON[_0x3d9c('0x25')](_0x2ee327[_0x3d9c('0x62')])};var _0x49ffc7={'ChatWebsiteId':_0x2ee327[_0x3d9c('0x57')]['id'],'closed':![]};if(_0x2ee327[_0x3d9c('0x62')]['threadId']){_0x49ffc7['threadId']=_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0xb7')];return db['ChatInteraction'][_0x3d9c('0x59')]({'where':_0x49ffc7})['then'](function(_0x2189db){if(_0x2189db){return[_0x2189db,![]];}_0x582803['threadId']=_0x2ee327[_0x3d9c('0x62')]['threadId'];_0x582803[_0x3d9c('0xb8')]=_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0xb8')];return db[_0x3d9c('0xb9')][_0x3d9c('0x5a')](_0x582803)[_0x3d9c('0x35')](function(_0xd31033){return[_0xd31033,!![]];});});}_0x49ffc7[_0x3d9c('0xba')]=_0x58f86e['id'];if(_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0xbb')]&&_0x2ee327['body'][_0x3d9c('0xbb')]['id']){_0x49ffc7['id']=_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0xbb')]['id'];return db[_0x3d9c('0xb9')][_0x3d9c('0x59')]({'where':_0x49ffc7})[_0x3d9c('0x35')](function(_0x1e4b3e){if(_0x1e4b3e){return[_0x1e4b3e,![]];}return db['ChatInteraction'][_0x3d9c('0x5a')](_0x582803)[_0x3d9c('0x35')](function(_0x27fddf){return[_0x27fddf,!![]];});});}return db[_0x3d9c('0xb9')][_0x3d9c('0x5a')](_0x582803)[_0x3d9c('0x35')](function(_0x155c9b){return[_0x155c9b,!![]];});}})[_0x3d9c('0xbc')](function(_0x6427c1,_0xd1c53c){if(_0x6427c1){_0x493f3c=_0xd1c53c;if(!_0xd1c53c){var _0x461ebf={'from':(_0x20f431[_0x3d9c('0xa6')][_0x3d9c('0xab')]||'')+'\x20'+(_0x20f431['contact'][_0x3d9c('0xbd')]||'')};if(_0x2ee327[_0x3d9c('0x62')]['threadId']&&_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0xbe')]&&_0x2ee327[_0x3d9c('0x62')]['threadId']!=_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0xbe')]){_0x461ebf[_0x3d9c('0xb7')]=_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0xbe')];}return _0x6427c1[_0x3d9c('0x34')](_0x461ebf);}else{return _0x6427c1;}}})[_0x3d9c('0x35')](function(_0x2b9f08){_0x20f431[_0x3d9c('0xbb')]=_0x2b9f08[_0x3d9c('0x5c')]({'plain':!![]});_0x20f431[_0x3d9c('0xbb')][_0x3d9c('0xbf')]=_0x493f3c;if(_0x20f431[_0x3d9c('0xbb')][_0x3d9c('0xbf')]){if(_0x20f431[_0x3d9c('0xa1')][_0x3d9c('0xc0')]){_0x20f431[_0x3d9c('0xa2')]['push']({'id':0x0,'priority':_0x20f431[_0x3d9c('0xa2')][_0x3d9c('0x48')]+0x1,'app':_0x3d9c('0xc1'),'appdata':_0x3d9c('0xc2'),'interval':'*,*,*,*'});}}return db['ChatMessage'][_0x3d9c('0x5a')]({'body':_0x2ee327['body'][_0x3d9c('0x62')],'ChatWebsiteId':_0x2ee327['params']['id'],'ChatInteractionId':_0x2b9f08['id'],'direction':'in','ContactId':_0x20f431[_0x3d9c('0xa6')]['id'],'AttachmentId':_0x2ee327['body'][_0x3d9c('0xc3')]});})['then'](function(_0x21cca4){_0x20f431[_0x3d9c('0x28')]=_0x21cca4;if(_0x20f431['interaction'][_0x3d9c('0xc4')]){return db[_0x3d9c('0xc5')]['find']({'attributes':['id','name'],'where':{'id':_0x20f431['interaction'][_0x3d9c('0xc4')]}})[_0x3d9c('0x35')](function(_0x4387ec){if(_0x4387ec){_0x20f431['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x3d9c('0xc6'),'appdata':_0x4387ec['name']+','+(_0x20f431[_0x3d9c('0xa1')][_0x3d9c('0xc7')]||0xa),'interval':'*,*,*,*'});_0x20f431[_0x3d9c('0xc8')]=!![];}return respondWithRpcPromise(_0x3d9c('0xc9'),'startRouting',_0x20f431);});}return respondWithRpcPromise(_0x3d9c('0xc9'),'startRouting',_0x20f431);})[_0x3d9c('0x35')](function(_0x18aea1){respondWithRpcPromise(_0x3d9c('0xca'),_0x3d9c('0xca'),{'event':_0x3d9c('0x8a'),'message':_0x18aea1},client9002);return _0x18aea1;})['then'](respondWithResult(_0x463303,null))[_0x3d9c('0x61')](handleError(_0x463303,null));};exports[_0x3d9c('0xcb')]=function(_0x1e04a0,_0x150625,_0x108ac6){var _0x1cf29e,_0x25b109,_0x563705;var _0x4d1fb7=[];var _0xd6b12c=[];var _0x398524={};return db[_0x3d9c('0x91')][_0x3d9c('0x63')]()['then'](function(_0xcc25ef){if(!_0xcc25ef){throw new db[(_0x3d9c('0x92'))][(_0x3d9c('0x93'))](_0x3d9c('0x94'));}_0xd6b12c=_[_0x3d9c('0xcc')](_[_0x3d9c('0x58')](_0xcc25ef),[_0x3d9c('0x96'),_0x3d9c('0x95')]);_0x4d1fb7=_[_0x3d9c('0xcc')](_[_0x3d9c('0x58')](_0xcc25ef),[_0x3d9c('0x96'),_0x3d9c('0x95'),_0x3d9c('0x97'),_0x3d9c('0x98')]);if(_0x1e04a0[_0x3d9c('0x62')]['id']){delete _0x1e04a0['body']['id'];}if(_[_0x3d9c('0x7e')](_0x1e04a0['body'][_0x3d9c('0x99')])){throw _0x150625[_0x3d9c('0x2b')](0x1f4)[_0x3d9c('0x3b')](new db['Sequelize']['ValidationError'](_0x3d9c('0x9a')));}if(_[_0x3d9c('0x7e')](_0x1e04a0['body'][_0x3d9c('0x62')])||_0x1e04a0['body'][_0x3d9c('0x62')]===''){throw _0x150625[_0x3d9c('0x2b')](0x1f4)['send'](new db['Sequelize'][(_0x3d9c('0x93'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x3d9c('0x7e')](_0x1e04a0[_0x3d9c('0x62')][_0x3d9c('0xcd')])){throw _0x150625[_0x3d9c('0x2b')](0x1f4)[_0x3d9c('0x3b')](new db['Sequelize'][(_0x3d9c('0x93'))](_0x3d9c('0xce')+_0x4d1fb7));}if(!_[_0x3d9c('0xcf')](_0x4d1fb7,_0x1e04a0['body'][_0x3d9c('0xcd')])){throw _0x150625['status'](0x1f4)[_0x3d9c('0x3b')](new db[(_0x3d9c('0x92'))]['ValidationError'](_0x3d9c('0xd0')+_0x4d1fb7));}_0x398524[_0x1e04a0[_0x3d9c('0x62')][_0x3d9c('0xcd')]]=_0x1e04a0[_0x3d9c('0x62')][_0x3d9c('0x99')];})[_0x3d9c('0x35')](function(){return db[_0x3d9c('0x40')][_0x3d9c('0x59')]({'where':{'id':_0x1e04a0[_0x3d9c('0x57')]['id']},'include':[{'model':db[_0x3d9c('0x9c')],'as':_0x3d9c('0x9d')}]});})[_0x3d9c('0x35')](handleEntityNotFound(_0x150625,null))[_0x3d9c('0x35')](function(_0x80aa77){if(_0x80aa77&&_0x80aa77[_0x3d9c('0x9d')]){_0x25b109=_0x80aa77;var _0x5c809b=_[_0x3d9c('0x1a')](_0x1e04a0[_0x3d9c('0x62')],{'firstName':_0x1e04a0[_0x3d9c('0x62')][_0x3d9c('0x99')],'phone':_0x1e04a0[_0x3d9c('0x62')]['from'],'ListId':_0x80aa77[_0x3d9c('0x98')]});_0x5c809b[_0x1e04a0['body']['mapKeyOffline']]=_0x1e04a0['body'][_0x3d9c('0x99')];return db[_0x3d9c('0x91')][_0x3d9c('0xd1')]({'where':_0x398524,'defaults':_0x5c809b});}})[_0x3d9c('0xbc')](function(_0x130402){if(_0x130402){_0x563705=_0x130402;var _0x2eccf4=fs[_0x3d9c('0xd2')](path[_0x3d9c('0x7a')](config[_0x3d9c('0x7b')],_0x3d9c('0xd3')),_0x3d9c('0xd4'));var _0x55f6b1=ejs[_0x3d9c('0xd5')](_0x2eccf4,{'body':_[_0x3d9c('0xd6')](_0x1e04a0[_0x3d9c('0x62')]['body']),'bodyTitle':_0x25b109[_0x3d9c('0xd7')]});return db['ChatOfflineMessage'][_0x3d9c('0x5a')]({'body':_0x55f6b1,'ContactId':_0x130402['id'],'ChatWebsiteId':_0x25b109['id']});}})[_0x3d9c('0x35')](function(_0x3a582b){if(_0x3a582b){_0x1cf29e=_0x3a582b;return db[_0x3d9c('0xd8')][_0x3d9c('0x68')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x3d9c('0xd9'),'raw':!![]}]});}})[_0x3d9c('0x35')](function(_0x227864){if(_0x227864&&_0x227864['Smtp']&&_0x25b109[_0x3d9c('0xda')]){var _0x15ddf4={'tls':{'rejectUnauthorized':![]}};if(_0x227864[_0x3d9c('0xd9')][_0x3d9c('0xdb')]){_0x15ddf4[_0x3d9c('0xdb')]=_0x227864['Smtp'][_0x3d9c('0xdb')];}else{_0x15ddf4[_0x3d9c('0xdc')]=_0x227864[_0x3d9c('0xd9')][_0x3d9c('0xdc')];_0x15ddf4[_0x3d9c('0xdd')]=_0x227864[_0x3d9c('0xd9')][_0x3d9c('0xdd')];_0x15ddf4[_0x3d9c('0xde')]=_0x227864[_0x3d9c('0xd9')][_0x3d9c('0xde')];}if(_0x227864[_0x3d9c('0xd9')][_0x3d9c('0xdf')]){_0x15ddf4[_0x3d9c('0xe0')]={'user':_0x227864[_0x3d9c('0xd9')][_0x3d9c('0x5b')],'pass':_0x227864[_0x3d9c('0xd9')]['pass']};}return respondWithRpcPromise(_0x3d9c('0xe1'),_0x3d9c('0xe2'),{'account':_0x15ddf4,'message':{'from':util[_0x3d9c('0xb0')](_0x3d9c('0xe3'),_0x227864[_0x3d9c('0x3a')],_0x227864[_0x3d9c('0xe4')]||_0x227864[_0x3d9c('0xd9')]['user']),'to':_0x25b109[_0x3d9c('0xda')],'subject':_0x25b109[_0x3d9c('0xe5')],'text':_0x1cf29e['body']}},client9003)[_0x3d9c('0x35')](function(){return _0x1cf29e;})[_0x3d9c('0x61')](function(_0x4b1a3f){console[_0x3d9c('0x26')](_0x4b1a3f);});}})['then'](function(){if(_0x1cf29e){return _0x1cf29e;}})[_0x3d9c('0x35')](respondWithResult(_0x150625,null))[_0x3d9c('0x61')](handleError(_0x150625,null));};exports['addInteraction']=function(_0x4e6084,_0x413970,_0x3e95cc){return db[_0x3d9c('0xb9')][_0x3d9c('0x59')]({'where':{'id':_0x4e6084[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x413970,null))[_0x3d9c('0x35')](function(_0x12499e){if(_0x12499e){return _0x12499e[_0x3d9c('0xe6')](_0x4e6084[_0x3d9c('0x62')]['ids'],_[_0x3d9c('0xe7')](_0x4e6084['body'],[_0x3d9c('0x70'),'id'])||{});}})[_0x3d9c('0x35')](respondWithResult(_0x413970,null))[_0x3d9c('0x61')](handleError(_0x413970,null));};exports['getInteractions']=function(_0x395c83,_0x15a83f,_0xa3bac1){var _0x18581b={'raw':![],'where':{}};var _0xf728e4={};var _0x530ec7={'count':0x0,'rows':[]};return db[_0x3d9c('0x40')][_0x3d9c('0x68')]({'where':{'id':_0x395c83['params']['id']}})['then'](handleEntityNotFound(_0x15a83f,null))[_0x3d9c('0x35')](function(_0x16f4da){if(_0x16f4da){_0xf728e4[_0x3d9c('0x43')]=_[_0x3d9c('0x58')](db[_0x3d9c('0xb9')][_0x3d9c('0x41')]);_0xf728e4['query']=_['keys'](_0x395c83[_0x3d9c('0x44')]);_0xf728e4['filters']=_[_0x3d9c('0x45')](_0xf728e4[_0x3d9c('0x43')],_0xf728e4[_0x3d9c('0x44')]);_0x18581b[_0x3d9c('0x46')]=_[_0x3d9c('0x45')](_0xf728e4[_0x3d9c('0x43')],qs[_0x3d9c('0x47')](_0x395c83['query'][_0x3d9c('0x47')]));_0x18581b[_0x3d9c('0x46')]=_0x18581b[_0x3d9c('0x46')]['length']?_0x18581b[_0x3d9c('0x46')]:_0xf728e4[_0x3d9c('0x43')];if(!_0x395c83['query'][_0x3d9c('0x49')](_0x3d9c('0x4a'))){_0x18581b['limit']=qs[_0x3d9c('0x2f')](_0x395c83[_0x3d9c('0x44')]['limit']);_0x18581b['offset']=qs[_0x3d9c('0x2e')](_0x395c83['query'][_0x3d9c('0x2e')]);}_0x18581b['order']=qs[_0x3d9c('0x4b')](_0x395c83[_0x3d9c('0x44')][_0x3d9c('0x4b')]);_0x18581b[_0x3d9c('0x4c')]=qs[_0x3d9c('0x4d')](_['pick'](_0x395c83[_0x3d9c('0x44')],_0xf728e4[_0x3d9c('0x4d')]));_0x18581b['where']['ChatWebsiteId']=_0x16f4da['id'];if(_0x395c83[_0x3d9c('0x44')][_0x3d9c('0x4e')]){_0x18581b[_0x3d9c('0x4c')]=_[_0x3d9c('0x4f')](_0x18581b['where'],{'$or':_[_0x3d9c('0x3f')](_0x18581b[_0x3d9c('0x46')],function(_0x39b76d){var _0x427e75={};_0x427e75[_0x39b76d]={'$like':'%'+_0x395c83[_0x3d9c('0x44')][_0x3d9c('0x4e')]+'%'};return _0x427e75;})});}_0x18581b=_[_0x3d9c('0x4f')]({},_0x18581b,_0x395c83[_0x3d9c('0x6a')]);return db['ChatInteraction'][_0x3d9c('0x51')]({'where':_0x18581b[_0x3d9c('0x4c')]})[_0x3d9c('0x35')](function(_0x1862d8){_0x530ec7[_0x3d9c('0x51')]=_0x1862d8;if(_0x395c83[_0x3d9c('0x44')][_0x3d9c('0x52')]){_0x18581b['include']=[{'model':db[_0x3d9c('0x91')],'as':'Contact','required':![]},{'model':db[_0x3d9c('0xc5')],'as':_0x3d9c('0xe8'),'attributes':['name',_0x3d9c('0xe9'),_0x3d9c('0xea')],'required':![]},{'model':db[_0x3d9c('0xeb')],'as':_0x3d9c('0xec'),'attributes':['id',_0x3d9c('0x3a'),_0x3d9c('0xed')],'where':_0x395c83[_0x3d9c('0x44')][_0x3d9c('0xee')]?{'id':_0x395c83[_0x3d9c('0x44')]['tag']}:undefined,'required':_0x395c83['query'][_0x3d9c('0xee')]?!![]:![]}];}return db[_0x3d9c('0xb9')][_0x3d9c('0x54')](_0x18581b);})[_0x3d9c('0x35')](function(_0x5b0d63){_0x530ec7[_0x3d9c('0x55')]=_0x5b0d63;return _0x530ec7;});}})[_0x3d9c('0x35')](respondWithFilteredResult(_0x15a83f,_0x18581b))['catch'](handleError(_0x15a83f,null));};function iftimePromise(_0x1045d0,_0x8039d4){return respondWithRpcPromise('Command',_0x3d9c('0xef'),{'command':_0x8039d4[_0x3d9c('0xf0')]?util['format']('iftime\x20%s,%s',_0x1045d0[_0x3d9c('0xf1')],_0x8039d4[_0x3d9c('0xf0')]):util[_0x3d9c('0xb0')]('iftime\x20%s',_0x1045d0[_0x3d9c('0xf1')])},client9002)[_0x3d9c('0x35')](function(_0x109071){var _0x4d1605=_0x109071&&_0x109071[_0x3d9c('0xf2')](_0x3d9c('0xf3'))>=0x0?!![]:![];logger[_0x3d9c('0xf4')](_0x3d9c('0xf5'),_0x8039d4['id'],_0x1045d0['id'],_0x1045d0[_0x3d9c('0xf1')],_0x4d1605?'ONLINE':_0x3d9c('0xf6'),_0x8039d4[_0x3d9c('0xf0')]?_0x8039d4[_0x3d9c('0xf0')]:'No\x20timezone');return _0x4d1605;})[_0x3d9c('0x61')](function(_0x7de4c){logger[_0x3d9c('0x26')](_0x3d9c('0xf5'),_0x8039d4['id'],_0x1045d0['id'],_0x1045d0[_0x3d9c('0xf1')],util[_0x3d9c('0xf7')](_0x7de4c,{'showHidden':![],'depth':null}),_0x8039d4[_0x3d9c('0xf0')]?_0x8039d4[_0x3d9c('0xf0')]:_0x3d9c('0xf8'));return![];});}exports['getSnippet']=function(_0x2aebd9,_0x4323f0,_0x38668c){var _0x3f112f=0x0;var _0x41a0bf=0x0;var _0x3c0967=![];var _0x496c23;var _0x5ff9ba;return db[_0x3d9c('0x40')][_0x3d9c('0x59')]({'where':{'id':_0x2aebd9[_0x3d9c('0x57')]['id']},'include':[{'model':db['Interval'],'as':_0x3d9c('0xf9'),'include':[{'model':db['Interval'],'as':_0x3d9c('0xfa'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x3d9c('0x35')](handleEntityNotFound(_0x4323f0,null))[_0x3d9c('0x35')](function(_0x41855b){if(_0x41855b){_0x496c23=_0x41855b;return _0x41855b[_0x3d9c('0xfb')]({'raw':!![]});}})[_0x3d9c('0x35')](function(_0x414dd2){if(_0x496c23){if(_0x414dd2){_0x5ff9ba=_0x414dd2;}}return require('../../config/license/util')[_0x3d9c('0x7d')]();})[_0x3d9c('0x35')](function(_0x42b546){if(_0x42b546){_0x41a0bf=_0x42b546['virtual'];_0x3c0967=_0x42b546[_0x3d9c('0xfc')];}})['then'](function(){return db['ChatInteraction'][_0x3d9c('0x51')]({'where':{'closed':![]}});})[_0x3d9c('0x35')](function(_0x463176){_0x3f112f=_0x463176;if(_0x41a0bf&&_0x463176>_0x41a0bf){return db[_0x3d9c('0xfd')][_0x3d9c('0x68')]({'where':{'id':0x1}})['then'](function(_0x30b095){if(_0x30b095){_0x30b095[_0x3d9c('0xfe')](_0x3d9c('0xff'));}});}})[_0x3d9c('0x35')](function(){if(_0x496c23[_0x3d9c('0xf9')]&&_0x496c23[_0x3d9c('0xf9')][_0x3d9c('0xfa')]){var _0x34b769=[];for(var _0x4f9c57=0x0;_0x4f9c57<_0x496c23['Interval']['Intervals'][_0x3d9c('0x48')];_0x4f9c57++){var _0x1e3501=_0x496c23[_0x3d9c('0xf9')]['Intervals'][_0x4f9c57]['get']({'plain':!![]});_0x34b769[_0x3d9c('0x100')](iftimePromise(_0x1e3501,_0x496c23));}return BPromise[_0x3d9c('0x101')](_0x34b769)['then'](function(_0x5722db){return _[_0x3d9c('0x102')](_0x5722db);});}else{return!![];}})[_0x3d9c('0x35')](function(_0x121660){var _0x2c1cc9=fs[_0x3d9c('0xd2')](path['join'](config[_0x3d9c('0x7b')],_0x3d9c('0x103')),_0x3d9c('0xd4'));var _0x464d11={'remote':_0x496c23[_0x3d9c('0x104')],'query':querystring[_0x3d9c('0x25')](_[_0x3d9c('0x4f')](_0x496c23[_0x3d9c('0x5c')]({'plain':!![]}),{'customerIp':_0x2aebd9[_0x3d9c('0x8d')][_0x3d9c('0xa9')]||_0x2aebd9[_0x3d9c('0x8d')][_0x3d9c('0x105')]||_0x2aebd9[_0x3d9c('0x106')][_0x3d9c('0x107')]||_0x2aebd9['ip'],'referer':_0x2aebd9[_0x3d9c('0x8d')]['referer'],'openedInteractions':_0x3f112f,'maxInteractions':_0x41a0bf,'virtual':_0x3c0967[_0x3d9c('0x108')],'online':_0x121660,'custom':_0x3c0967}))[_0x3d9c('0x109')](/'/g,'\x5c\x27')};_0x4323f0['send'](ejs[_0x3d9c('0xd5')](Mustache[_0x3d9c('0xd5')](_0x2c1cc9,_0x464d11),{'proactiveActions':_0x5ff9ba,'alignment':_0x496c23[_0x3d9c('0x10a')],'verticalAlignment':_0x496c23[_0x3d9c('0x10b')],'div_color':_0x496c23[_0x3d9c('0xed')],'text_color':_0x496c23[_0x3d9c('0x10c')]}));})[_0x3d9c('0x61')](handleError(_0x4323f0,null));};exports[_0x3d9c('0x10d')]=function(_0x5aeffd,_0x179ea7,_0x28b818){return db['ChatWebsite'][_0x3d9c('0x68')]({'where':{'id':_0x5aeffd['params']['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x179ea7,null))['then'](function(_0x5a5e32){if(_0x5a5e32){return db['sequelize']['transaction'](function(_0x1e275d){return db[_0x3d9c('0x9f')][_0x3d9c('0x36')]({'where':{'ChatWebsiteId':_0x5aeffd[_0x3d9c('0x57')]['id']},'transaction':_0x1e275d})['then'](function(_0x446ecd){var _0x7a8901=_[_0x3d9c('0x3f')](_0x5aeffd[_0x3d9c('0x62')],function(_0x31ca8a){_0x31ca8a[_0x3d9c('0x65')]=_0x5aeffd[_0x3d9c('0x57')]['id'];return _0x31ca8a;});return db[_0x3d9c('0x9f')][_0x3d9c('0x10e')](_0x7a8901,{'transaction':_0x1e275d});});})[_0x3d9c('0x35')](function(){return db[_0x3d9c('0x9f')][_0x3d9c('0x10f')]({'where':{'ChatWebsiteId':_0x5aeffd[_0x3d9c('0x57')]['id']},'order':_0x3d9c('0xa4')});});}})[_0x3d9c('0x35')](respondWithResult(_0x179ea7,null))[_0x3d9c('0x61')](handleError(_0x179ea7,null));};exports[_0x3d9c('0x110')]=function(_0x27dfb1,_0x2daee2,_0x3f0f8d){var _0x3592a6={};var _0x3b0962={};var _0x175a1f;var _0x2be393;return db['ChatWebsite'][_0x3d9c('0x68')]({'where':{'id':_0x27dfb1['params']['id']}})['then'](handleEntityNotFound(_0x2daee2,null))[_0x3d9c('0x35')](function(_0x5e1333){if(_0x5e1333){_0x175a1f=_0x5e1333;_0x3b0962['model']=_[_0x3d9c('0x58')](db['ChatApplication'][_0x3d9c('0x41')]);_0x3b0962[_0x3d9c('0x44')]=_[_0x3d9c('0x58')](_0x27dfb1[_0x3d9c('0x44')]);_0x3b0962['filters']=_['intersection'](_0x3b0962[_0x3d9c('0x43')],_0x3b0962[_0x3d9c('0x44')]);_0x3592a6[_0x3d9c('0x46')]=_['intersection'](_0x3b0962[_0x3d9c('0x43')],qs[_0x3d9c('0x47')](_0x27dfb1[_0x3d9c('0x44')][_0x3d9c('0x47')]));_0x3592a6[_0x3d9c('0x46')]=_0x3592a6[_0x3d9c('0x46')]['length']?_0x3592a6['attributes']:_0x3b0962['model'];_0x3592a6[_0x3d9c('0x69')]=qs[_0x3d9c('0x4b')](_0x27dfb1[_0x3d9c('0x44')][_0x3d9c('0x4b')]);_0x3592a6[_0x3d9c('0x4c')]=qs['filters'](_[_0x3d9c('0x6e')](_0x27dfb1[_0x3d9c('0x44')],_0x3b0962[_0x3d9c('0x4d')]));if(_0x27dfb1[_0x3d9c('0x44')][_0x3d9c('0x4e')]){_0x3592a6['where']=_['merge'](_0x3592a6['where'],{'$or':_['map'](_0x3592a6[_0x3d9c('0x46')],function(_0xc50a70){var _0x59d7f5={};_0x59d7f5[_0xc50a70]={'$like':'%'+_0x27dfb1['query']['filter']+'%'};return _0x59d7f5;})});}_0x3592a6=_[_0x3d9c('0x4f')]({},_0x3592a6,_0x27dfb1[_0x3d9c('0x6a')]);return _0x175a1f[_0x3d9c('0x110')](_0x3592a6);}})[_0x3d9c('0x35')](function(_0x328586){if(_0x328586){_0x2be393=_0x328586[_0x3d9c('0x48')];if(!_0x27dfb1[_0x3d9c('0x44')][_0x3d9c('0x49')]('nolimit')){_0x3592a6['limit']=qs['limit'](_0x27dfb1[_0x3d9c('0x44')][_0x3d9c('0x2f')]);_0x3592a6[_0x3d9c('0x2e')]=qs[_0x3d9c('0x2e')](_0x27dfb1[_0x3d9c('0x44')]['offset']);}return _0x175a1f[_0x3d9c('0x110')](_0x3592a6);}})['then'](function(_0x5fa7b1){if(_0x5fa7b1){return _0x5fa7b1?{'count':_0x2be393,'rows':_0x5fa7b1}:null;}})['then'](respondWithResult(_0x2daee2,null))[_0x3d9c('0x61')](handleError(_0x2daee2,null));};exports[_0x3d9c('0x111')]=function(_0x3ba3b3,_0x17fed0,_0x34d5ba){return db[_0x3d9c('0x112')][_0x3d9c('0x59')]({'where':{'id':_0x3ba3b3[_0x3d9c('0x57')]['id']}})['then'](handleEntityNotFound(_0x17fed0,null))['then'](function(_0x3d755a){if(_0x3d755a){return _0x3d755a[_0x3d9c('0x111')](_0x3ba3b3[_0x3d9c('0x62')][_0x3d9c('0x70')],_['omit'](_0x3ba3b3[_0x3d9c('0x62')],[_0x3d9c('0x70'),'id'])||{});}})['then'](respondWithResult(_0x17fed0,null))[_0x3d9c('0x61')](handleError(_0x17fed0,null));};exports[_0x3d9c('0xfb')]=function(_0x5f33b1,_0x237ecf,_0x3674cd){var _0x7fd659={};var _0x2bfbdf={};var _0x1e0cf9;var _0x4fba91;return db['ChatWebsite'][_0x3d9c('0x68')]({'where':{'id':_0x5f33b1[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x237ecf,null))['then'](function(_0x6752b6){if(_0x6752b6){_0x1e0cf9=_0x6752b6;_0x2bfbdf['model']=_['keys'](db[_0x3d9c('0x113')]['rawAttributes']);_0x2bfbdf[_0x3d9c('0x44')]=_['keys'](_0x5f33b1[_0x3d9c('0x44')]);_0x2bfbdf[_0x3d9c('0x4d')]=_[_0x3d9c('0x45')](_0x2bfbdf[_0x3d9c('0x43')],_0x2bfbdf[_0x3d9c('0x44')]);_0x7fd659[_0x3d9c('0x46')]=_['intersection'](_0x2bfbdf[_0x3d9c('0x43')],qs[_0x3d9c('0x47')](_0x5f33b1['query'][_0x3d9c('0x47')]));_0x7fd659['attributes']=_0x7fd659[_0x3d9c('0x46')][_0x3d9c('0x48')]?_0x7fd659[_0x3d9c('0x46')]:_0x2bfbdf['model'];_0x7fd659[_0x3d9c('0x69')]=qs[_0x3d9c('0x4b')](_0x5f33b1[_0x3d9c('0x44')][_0x3d9c('0x4b')]);_0x7fd659[_0x3d9c('0x4c')]=qs[_0x3d9c('0x4d')](_[_0x3d9c('0x6e')](_0x5f33b1[_0x3d9c('0x44')],_0x2bfbdf[_0x3d9c('0x4d')]));if(_0x5f33b1[_0x3d9c('0x44')]['filter']){_0x7fd659[_0x3d9c('0x4c')]=_[_0x3d9c('0x4f')](_0x7fd659[_0x3d9c('0x4c')],{'$or':_['map'](_0x7fd659['attributes'],function(_0x1fb657){var _0xedf91d={};_0xedf91d[_0x1fb657]={'$like':'%'+_0x5f33b1[_0x3d9c('0x44')]['filter']+'%'};return _0xedf91d;})});}_0x7fd659=_[_0x3d9c('0x4f')]({},_0x7fd659,_0x5f33b1[_0x3d9c('0x6a')]);return _0x1e0cf9[_0x3d9c('0xfb')](_0x7fd659);}})[_0x3d9c('0x35')](function(_0x294206){if(_0x294206){_0x4fba91=_0x294206[_0x3d9c('0x48')];if(!_0x5f33b1[_0x3d9c('0x44')][_0x3d9c('0x49')](_0x3d9c('0x4a'))){_0x7fd659[_0x3d9c('0x2f')]=qs[_0x3d9c('0x2f')](_0x5f33b1[_0x3d9c('0x44')][_0x3d9c('0x2f')]);_0x7fd659[_0x3d9c('0x2e')]=qs['offset'](_0x5f33b1[_0x3d9c('0x44')]['offset']);}return _0x1e0cf9[_0x3d9c('0xfb')](_0x7fd659);}})[_0x3d9c('0x35')](function(_0x579c6b){if(_0x579c6b){return _0x579c6b?{'count':_0x4fba91,'rows':_0x579c6b}:null;}})[_0x3d9c('0x35')](respondWithResult(_0x237ecf,null))[_0x3d9c('0x61')](handleError(_0x237ecf,null));};exports['getFields']=function(_0x4489d2,_0x12f6a1,_0x230b2f){var _0x40491f=_0x4489d2['query'][_0x3d9c('0x114')]===_0x3d9c('0x115')?_0x3d9c('0x116'):_0x3d9c('0x117');return db[_0x3d9c('0x40')][_0x3d9c('0x59')]({'attributes':['id',_0x40491f],'where':{'id':_0x4489d2['params']['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x12f6a1,null))[_0x3d9c('0x35')](function(_0x426b38){if(_0x426b38){var _0x395378=_0x426b38[_0x40491f];var _0x2fd89e=_0x395378&&_0x395378[_0x3d9c('0x118')]?_0x395378[_0x3d9c('0x118')]:[];_0x12f6a1[_0x3d9c('0x3b')]({'fromKey':_[_0x3d9c('0x7e')](_0x395378[_0x3d9c('0x119')])?undefined:_0x395378['fromKey'],'count':_0x2fd89e[_0x3d9c('0x48')],'rows':_0x2fd89e});}})[_0x3d9c('0x61')](handleError(_0x12f6a1,null));};exports[_0x3d9c('0x11a')]=function(_0x1b8554,_0x5aa2b8,_0x28c668){var _0x4003b8={'raw':![],'where':{}};var _0x232597={};var _0x5b2f91={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x1b8554['params']['id']}})['then'](handleEntityNotFound(_0x5aa2b8,null))[_0x3d9c('0x35')](function(_0x219845){if(_0x219845){_0x232597['model']=_[_0x3d9c('0x58')](db[_0x3d9c('0x11b')][_0x3d9c('0x41')]);_0x232597['query']=_[_0x3d9c('0x58')](_0x1b8554[_0x3d9c('0x44')]);_0x232597['filters']=_[_0x3d9c('0x45')](_0x232597[_0x3d9c('0x43')],_0x232597[_0x3d9c('0x44')]);_0x4003b8['attributes']=_['intersection'](_0x232597['model'],qs['fields'](_0x1b8554[_0x3d9c('0x44')][_0x3d9c('0x47')]));_0x4003b8[_0x3d9c('0x46')]=_0x4003b8[_0x3d9c('0x46')][_0x3d9c('0x48')]?_0x4003b8['attributes']:_0x232597[_0x3d9c('0x43')];if(!_0x1b8554[_0x3d9c('0x44')][_0x3d9c('0x49')](_0x3d9c('0x4a'))){_0x4003b8[_0x3d9c('0x2f')]=qs[_0x3d9c('0x2f')](_0x1b8554[_0x3d9c('0x44')][_0x3d9c('0x2f')]);_0x4003b8['offset']=qs[_0x3d9c('0x2e')](_0x1b8554[_0x3d9c('0x44')]['offset']);}_0x4003b8[_0x3d9c('0x69')]=qs['sort'](_0x1b8554['query']['sort']);_0x4003b8['where']=qs[_0x3d9c('0x4d')](_['pick'](_0x1b8554[_0x3d9c('0x44')],_0x232597['filters']));_0x4003b8[_0x3d9c('0x4c')][_0x3d9c('0x65')]=_0x219845['id'];if(_0x1b8554[_0x3d9c('0x44')]['filter']){_0x4003b8[_0x3d9c('0x4c')]=_[_0x3d9c('0x4f')](_0x4003b8[_0x3d9c('0x4c')],{'$or':_[_0x3d9c('0x3f')](_0x4003b8['attributes'],function(_0x65bda0){var _0x1a2f30={};_0x1a2f30[_0x65bda0]={'$like':'%'+_0x1b8554[_0x3d9c('0x44')][_0x3d9c('0x4e')]+'%'};return _0x1a2f30;})});}_0x4003b8=_[_0x3d9c('0x4f')]({},_0x4003b8,_0x1b8554[_0x3d9c('0x6a')]);return db[_0x3d9c('0x11b')][_0x3d9c('0x51')]({'where':_0x4003b8[_0x3d9c('0x4c')]})[_0x3d9c('0x35')](function(_0x594224){_0x5b2f91[_0x3d9c('0x51')]=_0x594224;if(_0x1b8554[_0x3d9c('0x44')]['includeAll']){_0x4003b8[_0x3d9c('0x53')]=[{'all':!![]}];}else{_0x4003b8[_0x3d9c('0x53')]=[{'model':db[_0x3d9c('0x91')],'as':'Contact','required':![]}];}return db[_0x3d9c('0x11b')][_0x3d9c('0x54')](_0x4003b8);})[_0x3d9c('0x35')](function(_0x425afc){_0x5b2f91[_0x3d9c('0x55')]=_0x425afc;return _0x5b2f91;});}})['then'](respondWithFilteredResult(_0x5aa2b8,_0x4003b8))[_0x3d9c('0x61')](handleError(_0x5aa2b8,null));};exports[_0x3d9c('0x11c')]=function(_0x58f529,_0x850a60,_0x215dd6){return db[_0x3d9c('0x40')]['find']({'where':{'id':_0x58f529[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x850a60,null))['then'](function(_0xfff46){if(_0xfff46){return _0xfff46[_0x3d9c('0x11c')](_0x58f529[_0x3d9c('0x62')][_0x3d9c('0x70')],_[_0x3d9c('0xe7')](_0x58f529['body'],[_0x3d9c('0x70'),'id'])||{})[_0x3d9c('0xbc')](function(_0x77ca1e){for(var _0x2df8dd=0x0;_0x2df8dd<_0x58f529[_0x3d9c('0x62')][_0x3d9c('0x70')][_0x3d9c('0x48')];_0x2df8dd+=0x1){socket['emit'](_0x3d9c('0x11d'),{'UserId':_0x58f529[_0x3d9c('0x62')]['ids'][_0x2df8dd],'ChatWebsiteId':_0x58f529['params']['id']});}return _0x77ca1e;});}})[_0x3d9c('0x35')](respondWithResult(_0x850a60,null))[_0x3d9c('0x61')](handleError(_0x850a60,null));};exports[_0x3d9c('0x11e')]=function(_0x6806bc,_0x3ec0c7,_0x487c4d){return db[_0x3d9c('0x40')][_0x3d9c('0x59')]({'where':{'id':_0x6806bc['params']['id']}})['then'](handleEntityNotFound(_0x3ec0c7,null))[_0x3d9c('0x35')](function(_0x49be62){if(_0x49be62){return _0x49be62[_0x3d9c('0x11e')](_0x6806bc[_0x3d9c('0x44')][_0x3d9c('0x70')])['then'](function(){if(_['isArray'](_0x6806bc['query'][_0x3d9c('0x70')])){for(var _0x505f99=0x0;_0x505f99<_0x6806bc[_0x3d9c('0x44')][_0x3d9c('0x70')][_0x3d9c('0x48')];_0x505f99+=0x1){socket[_0x3d9c('0x11f')]('userChatWebsite:remove',{'UserId':Number(_0x6806bc['query'][_0x3d9c('0x70')][_0x505f99]),'ChatWebsiteId':Number(_0x6806bc[_0x3d9c('0x57')]['id'])});}}else{socket[_0x3d9c('0x11f')](_0x3d9c('0x120'),{'UserId':Number(_0x6806bc[_0x3d9c('0x44')][_0x3d9c('0x70')]),'ChatWebsiteId':Number(_0x6806bc[_0x3d9c('0x57')]['id'])});}});}})[_0x3d9c('0x35')](respondWithStatusCode(_0x3ec0c7,null))[_0x3d9c('0x61')](handleError(_0x3ec0c7,null));};exports['getAgents']=function(_0x47e067,_0x39ba7f,_0x370ba7){var _0x1fcc09={};var _0x3ec573={};var _0xac84b7;var _0xe63027;return db[_0x3d9c('0x40')][_0x3d9c('0x68')]({'where':{'id':_0x47e067[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x39ba7f,null))[_0x3d9c('0x35')](function(_0x299e2c){if(_0x299e2c){_0xac84b7=_0x299e2c;_0x3ec573[_0x3d9c('0x43')]=_[_0x3d9c('0x58')](db[_0x3d9c('0xc5')][_0x3d9c('0x41')]);_0x3ec573[_0x3d9c('0x44')]=_['keys'](_0x47e067[_0x3d9c('0x44')]);_0x3ec573[_0x3d9c('0x4d')]=_[_0x3d9c('0x45')](_0x3ec573['model'],_0x3ec573[_0x3d9c('0x44')]);_0x1fcc09['attributes']=_[_0x3d9c('0x45')](_0x3ec573['model'],qs[_0x3d9c('0x47')](_0x47e067[_0x3d9c('0x44')]['fields']));_0x1fcc09[_0x3d9c('0x46')]=_0x1fcc09[_0x3d9c('0x46')]['length']?_0x1fcc09[_0x3d9c('0x46')]:_0x3ec573['model'];_0x1fcc09[_0x3d9c('0x69')]=qs['sort'](_0x47e067[_0x3d9c('0x44')][_0x3d9c('0x4b')]);_0x1fcc09[_0x3d9c('0x4c')]=qs['filters'](_['pick'](_0x47e067['query'],_0x3ec573[_0x3d9c('0x4d')]));if(_0x47e067[_0x3d9c('0x44')][_0x3d9c('0x4e')]){_0x1fcc09[_0x3d9c('0x4c')]=_[_0x3d9c('0x4f')](_0x1fcc09['where'],{'$or':_['map'](_0x1fcc09[_0x3d9c('0x46')],function(_0x289329){var _0x2ca134={};_0x2ca134[_0x289329]={'$like':'%'+_0x47e067[_0x3d9c('0x44')]['filter']+'%'};return _0x2ca134;})});}_0x1fcc09=_[_0x3d9c('0x4f')]({},_0x1fcc09,_0x47e067[_0x3d9c('0x6a')]);return _0xac84b7['getAgents'](_0x1fcc09);}})['then'](function(_0x1b360a){if(_0x1b360a){_0xe63027=_0x1b360a[_0x3d9c('0x48')];if(!_0x47e067['query'][_0x3d9c('0x49')](_0x3d9c('0x4a'))){_0x1fcc09[_0x3d9c('0x2f')]=qs[_0x3d9c('0x2f')](_0x47e067[_0x3d9c('0x44')][_0x3d9c('0x2f')]);_0x1fcc09[_0x3d9c('0x2e')]=qs['offset'](_0x47e067[_0x3d9c('0x44')][_0x3d9c('0x2e')]);}return _0xac84b7[_0x3d9c('0x121')](_0x1fcc09);}})['then'](function(_0x26bc89){if(_0x26bc89){return _0x26bc89?{'count':_0xe63027,'rows':_0x26bc89}:null;}})[_0x3d9c('0x35')](respondWithResult(_0x39ba7f,null))[_0x3d9c('0x61')](handleError(_0x39ba7f,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index e45b9b1..c55f0f2 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 _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 +var _0x0bde=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x2f6e2d,_0x3ba8a5){var _0x3d122c=function(_0x3f15ac){while(--_0x3f15ac){_0x2f6e2d['push'](_0x2f6e2d['shift']());}};_0x3d122c(++_0x3ba8a5);}(_0x0bde,0xe7));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xe0bd('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xe0bd('0x1')](0x0);var events={'afterCreate':_0xe0bd('0x2'),'afterUpdate':_0xe0bd('0x3'),'afterDestroy':_0xe0bd('0x4')};function emitEvent(_0x2da4bd){return function(_0x5541b9,_0x34df88,_0x124139){ChatWebsiteEvents[_0xe0bd('0x5')](_0x2da4bd+':'+_0x5541b9['id'],_0x5541b9);ChatWebsiteEvents[_0xe0bd('0x5')](_0x2da4bd,_0x5541b9);_0x124139(null);};}for(var e in events){if(events[_0xe0bd('0x6')](e)){var event=events[e];ChatWebsite[_0xe0bd('0x7')](e,emitEvent(event));}}module[_0xe0bd('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 abbf953..50df0e5 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 _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 +var _0x2750=['rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3acc9c,_0x5697a4){var _0x11df29=function(_0x42b0a6){while(--_0x42b0a6){_0x3acc9c['push'](_0x3acc9c['shift']());}};_0x11df29(++_0x5697a4);}(_0x2750,0x13b));var _0x0275=function(_0x374b1c,_0x2ac771){_0x374b1c=_0x374b1c-0x0;var _0x121d40=_0x2750[_0x374b1c];return _0x121d40;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var moment=require(_0x0275('0x3'));var BPromise=require(_0x0275('0x4'));var rp=require(_0x0275('0x5'));var fs=require('fs');var path=require(_0x0275('0x6'));var rimraf=require(_0x0275('0x7'));var config=require(_0x0275('0x8'));var attributes=require(_0x0275('0x9'));module[_0x0275('0xa')]=function(_0x5953f9,_0x3f645f){return _0x5953f9[_0x0275('0xb')](_0x0275('0xc'),attributes,{'tableName':_0x0275('0xd'),'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 3142c8a..17375de 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 _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 +var _0x1623=['../../mysqldb','../../config/utils','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x2ca616,_0x384ec8){var _0x53155f=function(_0x108627){while(--_0x108627){_0x2ca616['push'](_0x2ca616['shift']());}};_0x53155f(++_0x384ec8);}(_0x1623,0xab));var _0x3162=function(_0x57a490,_0x3e3087){_0x57a490=_0x57a490-0x0;var _0x374528=_0x1623[_0x57a490];return _0x374528;};'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});config['redis']=_[_0x3162('0x9')](config[_0x3162('0xa')],{'host':_0x3162('0xb'),'port':0x18eb});var socket=require(_0x3162('0xc'))(new Redis(config[_0x3162('0xa')]));require(_0x3162('0xd'))[_0x3162('0xe')](socket);function respondWithRpcPromise(_0x113d28,_0x4bde10,_0x50814f){return new BPromise(function(_0x270de3,_0x3106d5){return client[_0x3162('0xf')](_0x113d28,_0x50814f)[_0x3162('0x10')](function(_0x813d62){logger[_0x3162('0x11')](_0x3162('0x12'),_0x4bde10,_0x3162('0x13'));logger[_0x3162('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4bde10,_0x3162('0x13'),JSON['stringify'](_0x813d62));if(_0x813d62[_0x3162('0x15')]){if(_0x813d62[_0x3162('0x15')]['code']===0x1f4){logger['error'](_0x3162('0x12'),_0x4bde10,_0x813d62[_0x3162('0x15')][_0x3162('0x16')]);return _0x3106d5(_0x813d62['error'][_0x3162('0x16')]);}logger[_0x3162('0x15')](_0x3162('0x12'),_0x4bde10,_0x813d62['error'][_0x3162('0x16')]);return _0x270de3(_0x813d62[_0x3162('0x15')][_0x3162('0x16')]);}else{logger[_0x3162('0x11')](_0x3162('0x12'),_0x4bde10,_0x3162('0x13'));_0x270de3(_0x813d62[_0x3162('0x17')]['message']);}})[_0x3162('0x18')](function(_0x1e3d75){logger[_0x3162('0x15')](_0x3162('0x12'),_0x4bde10,_0x1e3d75);_0x3106d5(_0x1e3d75);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 892ea51..0261e94 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(_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 +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1f2ce6,_0x3f6174){_0x1f2ce6=_0x1f2ce6-0x0;var _0x3cd2ab=_0x5f2f[_0x1f2ce6];return _0x3cd2ab;};'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 0068dd7..cb6ab67 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 _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 +var _0x0c31=['addAnswer','diskStorage','join','root','%s-%s','now','originalname','single','server/files/images/avatars/','format','file','addCustomerAvatar','notify','offline','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addDisposition'];(function(_0x59943d,_0x2e751b){var _0x46ace9=function(_0xfbd5f2){while(--_0xfbd5f2){_0x59943d['push'](_0x59943d['shift']());}};_0x46ace9(++_0x2e751b);}(_0x0c31,0x11d));var _0x10c3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0c31[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x10c3('0x0'));var util=require(_0x10c3('0x1'));var path=require(_0x10c3('0x2'));var timeout=require('connect-timeout');var express=require(_0x10c3('0x3'));var router=express[_0x10c3('0x4')]();var auth=require(_0x10c3('0x5'));var interaction=require(_0x10c3('0x6'));var config=require(_0x10c3('0x7'));var controller=require(_0x10c3('0x8'));router[_0x10c3('0x9')]('/',auth[_0x10c3('0xa')](),controller[_0x10c3('0xb')]);router[_0x10c3('0x9')](_0x10c3('0xc'),auth[_0x10c3('0xa')](),controller[_0x10c3('0xd')]);router[_0x10c3('0x9')](_0x10c3('0xe'),auth['isAuthenticated'](),controller[_0x10c3('0xf')]);router['get'](_0x10c3('0x10'),auth[_0x10c3('0xa')](),controller['getDispositions']);router['get'](_0x10c3('0x11'),auth[_0x10c3('0xa')](),controller[_0x10c3('0x12')]);router[_0x10c3('0x9')](_0x10c3('0x13'),controller[_0x10c3('0x14')]);router[_0x10c3('0x9')](_0x10c3('0x15'),controller['getAvatar']);router[_0x10c3('0x9')](_0x10c3('0x16'),controller[_0x10c3('0x17')]);router['get'](_0x10c3('0x18'),controller[_0x10c3('0x19')]);router['get'](_0x10c3('0x1a'),auth[_0x10c3('0xa')](),controller[_0x10c3('0x1b')]);router[_0x10c3('0x9')](_0x10c3('0x1c'),controller[_0x10c3('0x1d')]);router[_0x10c3('0x9')](_0x10c3('0x1e'),auth[_0x10c3('0xa')](),controller[_0x10c3('0x1f')]);router[_0x10c3('0x9')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x10c3('0x20')]);router['get']('/:id/fields',controller[_0x10c3('0x21')]);router['get'](_0x10c3('0x22'),auth[_0x10c3('0xa')](),controller[_0x10c3('0x23')]);router['get'](_0x10c3('0x24'),auth['isAuthenticated'](),controller[_0x10c3('0x25')]);router[_0x10c3('0x26')]('/',auth[_0x10c3('0xa')](),controller['create']);router['post'](_0x10c3('0x10'),auth[_0x10c3('0xa')](),controller[_0x10c3('0x27')]);router[_0x10c3('0x26')]('/:id/canned_answers',auth[_0x10c3('0xa')](),controller[_0x10c3('0x28')]);var upload=multer({'storage':multer[_0x10c3('0x29')]({'destination':function(_0xb315f7,_0x4b6644,_0xc10ba){_0xc10ba(null,path[_0x10c3('0x2a')](config[_0x10c3('0x2b')],'server/files/images/logos/'));},'filename':function(_0x2d8221,_0x815fb9,_0x2a0ee8){_0x2a0ee8(null,util['format'](_0x10c3('0x2c'),Date[_0x10c3('0x2d')](),_0x815fb9[_0x10c3('0x2e')]));}})});router[_0x10c3('0x26')]('/:id/logo',upload[_0x10c3('0x2f')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x10c3('0x29')]({'destination':function(_0x34e0fc,_0x3862cb,_0x2b66f0){_0x2b66f0(null,path[_0x10c3('0x2a')](config[_0x10c3('0x2b')],_0x10c3('0x30')));},'filename':function(_0x2cca89,_0x5a7aa7,_0x2e5247){_0x2e5247(null,util[_0x10c3('0x31')](_0x10c3('0x2c'),Date[_0x10c3('0x2d')](),_0x5a7aa7[_0x10c3('0x2e')]));}})});router['post']('/:id/avatar',upload['single'](_0x10c3('0x32')),controller['addAvatar']);var upload=multer({'storage':multer[_0x10c3('0x29')]({'destination':function(_0x3a4571,_0x31b6a6,_0x3a8e0c){_0x3a8e0c(null,path[_0x10c3('0x2a')](config[_0x10c3('0x2b')],_0x10c3('0x30')));},'filename':function(_0x4619f2,_0x9b13ce,_0x213e68){_0x213e68(null,util['format'](_0x10c3('0x2c'),Date[_0x10c3('0x2d')](),_0x9b13ce[_0x10c3('0x2e')]));}})});router[_0x10c3('0x26')]('/:id/customer_avatar',upload[_0x10c3('0x2f')](_0x10c3('0x32')),controller[_0x10c3('0x33')]);var upload=multer({'storage':multer[_0x10c3('0x29')]({'destination':function(_0xd4331a,_0xddbfa,_0x369d08){_0x369d08(null,path[_0x10c3('0x2a')](config[_0x10c3('0x2b')],_0x10c3('0x30')));},'filename':function(_0x13f3e2,_0x3ef05e,_0x2e4732){_0x2e4732(null,util[_0x10c3('0x31')](_0x10c3('0x2c'),Date[_0x10c3('0x2d')](),_0x3ef05e[_0x10c3('0x2e')]));}})});router['post'](_0x10c3('0x18'),upload[_0x10c3('0x2f')]('file'),controller['addSystemAvatar']);router[_0x10c3('0x26')]('/:id/notify',controller[_0x10c3('0x34')]);router['post']('/:id/offline',controller[_0x10c3('0x35')]);router[_0x10c3('0x26')](_0x10c3('0x1a'),auth[_0x10c3('0xa')](),controller['addInteraction']);router[_0x10c3('0x26')](_0x10c3('0x1e'),auth[_0x10c3('0xa')](),controller[_0x10c3('0x36')]);router[_0x10c3('0x26')]('/:id/proactive_actions',auth[_0x10c3('0xa')](),controller[_0x10c3('0x37')]);router['post']('/:id/users',auth[_0x10c3('0xa')](),controller[_0x10c3('0x38')]);router[_0x10c3('0x39')]('/:id',auth['isAuthenticated'](),controller[_0x10c3('0x3a')]);router[_0x10c3('0x3b')](_0x10c3('0xe'),auth['isAuthenticated'](),controller[_0x10c3('0x3c')]);router[_0x10c3('0x3b')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x10c3('0x3d')]);router[_0x10c3('0x3b')](_0x10c3('0x11'),auth[_0x10c3('0xa')](),controller[_0x10c3('0x3e')]);router[_0x10c3('0x3b')]('/:id/users',auth[_0x10c3('0xa')](),controller[_0x10c3('0x3f')]);module[_0x10c3('0x40')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 411c504..f442cf7 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 _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 +var _0xf603=['ENUM','AmazonAWS','Google','STRING','sequelize','exports'];(function(_0x527fd7,_0x15af06){var _0x3ca79b=function(_0x200e97){while(--_0x200e97){_0x527fd7['push'](_0x527fd7['shift']());}};_0x3ca79b(++_0x15af06);}(_0xf603,0x124));var _0x3f60=function(_0x300184,_0xcfe529){_0x300184=_0x300184-0x0;var _0x332dfa=_0xf603[_0x300184];return _0x332dfa;};'use strict';var Sequelize=require(_0x3f60('0x0'));module[_0x3f60('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x3f60('0x2')](_0x3f60('0x3'),_0x3f60('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x3f60('0x5')]},'data2':{'type':Sequelize[_0x3f60('0x5')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 8ac671b..d89d9fa 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 _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 +var _0x0404=['map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','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','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','CloudProvider','rawAttributes','fieldName','type','key','model'];(function(_0x314010,_0x1896d5){var _0x5e6300=function(_0xca1b26){while(--_0xca1b26){_0x314010['push'](_0x314010['shift']());}};_0x5e6300(++_0x1896d5);}(_0x0404,0xf4));var _0x4040=function(_0x24f862,_0x4b645a){_0x24f862=_0x24f862-0x0;var _0x198aa4=_0x0404[_0x24f862];return _0x198aa4;};'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'];function respondWithStatusCode(_0x6848fe,_0x43c6e6){_0x43c6e6=_0x43c6e6||0xcc;return function(_0x5ad97f){if(_0x5ad97f){return _0x6848fe[_0x4040('0x17')](_0x43c6e6);}return _0x6848fe['status'](_0x43c6e6)[_0x4040('0x18')]();};}function respondWithResult(_0x4b2336,_0x459e4c){_0x459e4c=_0x459e4c||0xc8;return function(_0x4d0771){if(_0x4d0771){return _0x4b2336[_0x4040('0x19')](_0x459e4c)[_0x4040('0x1a')](_0x4d0771);}};}function respondWithFilteredResult(_0x5f3a95,_0x4d4419){return function(_0x50022d){if(_0x50022d){var _0x2a49f4=_0x50022d[_0x4040('0x1b')],_0x458537=_0x4d4419[_0x4040('0x1c')],_0x439a20=_0x4d4419[_0x4040('0x1c')]+_0x4d4419[_0x4040('0x1d')],_0x29fbbb;if(_0x439a20>=_0x2a49f4){_0x439a20=_0x2a49f4;_0x29fbbb=0xc8;}else{_0x29fbbb=0xce;}_0x5f3a95[_0x4040('0x19')](_0x29fbbb);return _0x5f3a95[_0x4040('0x1e')](_0x4040('0x1f'),_0x458537+'-'+_0x439a20+'/'+_0x2a49f4)['json'](_0x50022d);}return null;};}function patchUpdates(_0x51efaf){return function(_0xb8aa7d){try{jsonpatch[_0x4040('0x20')](_0xb8aa7d,_0x51efaf,!![]);}catch(_0x343021){return BPromise['reject'](_0x343021);}return _0xb8aa7d[_0x4040('0x21')]();};}function saveUpdates(_0x39aebc,_0x68b36c){return function(_0x3a3ddc){if(_0x3a3ddc){return _0x3a3ddc[_0x4040('0x22')](_0x39aebc)[_0x4040('0x23')](function(_0xec1f81){return _0xec1f81;});}return null;};}function removeEntity(_0x2c0bc5,_0x1ca1b8){return function(_0x3cb9a9){if(_0x3cb9a9){return _0x3cb9a9[_0x4040('0x24')]()[_0x4040('0x23')](function(){_0x2c0bc5[_0x4040('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x429c77,_0x5686c2){return function(_0x152e67){if(!_0x152e67){_0x429c77['sendStatus'](0x194);}return _0x152e67;};}function handleError(_0x41f04b,_0x48d4d2){_0x48d4d2=_0x48d4d2||0x1f4;return function(_0xd96a68){logger[_0x4040('0x25')](_0xd96a68[_0x4040('0x26')]);if(_0xd96a68['name']){delete _0xd96a68[_0x4040('0x27')];}_0x41f04b[_0x4040('0x19')](_0x48d4d2)[_0x4040('0x28')](_0xd96a68);};}exports[_0x4040('0x29')]=function(_0x1d670f,_0x29cc8e){var _0x18a03b={},_0x3b48f8={},_0x23ef59={'count':0x0,'rows':[]};var _0x1b878c=_['map'](db[_0x4040('0x2a')][_0x4040('0x2b')],function(_0xa72be){return{'name':_0xa72be[_0x4040('0x2c')],'type':_0xa72be[_0x4040('0x2d')][_0x4040('0x2e')]};});_0x3b48f8[_0x4040('0x2f')]=_[_0x4040('0x30')](_0x1b878c,_0x4040('0x27'));_0x3b48f8[_0x4040('0x31')]=_[_0x4040('0x32')](_0x1d670f['query']);_0x3b48f8[_0x4040('0x33')]=_[_0x4040('0x34')](_0x3b48f8[_0x4040('0x2f')],_0x3b48f8[_0x4040('0x31')]);_0x18a03b[_0x4040('0x35')]=_['intersection'](_0x3b48f8[_0x4040('0x2f')],qs[_0x4040('0x36')](_0x1d670f[_0x4040('0x31')][_0x4040('0x36')]));_0x18a03b[_0x4040('0x35')]=_0x18a03b[_0x4040('0x35')]['length']?_0x18a03b[_0x4040('0x35')]:_0x3b48f8[_0x4040('0x2f')];if(!_0x1d670f[_0x4040('0x31')][_0x4040('0x37')]('nolimit')){_0x18a03b[_0x4040('0x1d')]=qs[_0x4040('0x1d')](_0x1d670f[_0x4040('0x31')][_0x4040('0x1d')]);_0x18a03b[_0x4040('0x1c')]=qs[_0x4040('0x1c')](_0x1d670f[_0x4040('0x31')]['offset']);}_0x18a03b[_0x4040('0x38')]=qs[_0x4040('0x39')](_0x1d670f[_0x4040('0x31')][_0x4040('0x39')]);_0x18a03b[_0x4040('0x3a')]=qs[_0x4040('0x33')](_[_0x4040('0x3b')](_0x1d670f[_0x4040('0x31')],_0x3b48f8[_0x4040('0x33')]),_0x1b878c);if(_0x1d670f[_0x4040('0x31')][_0x4040('0x3c')]){_0x18a03b[_0x4040('0x3a')]=_[_0x4040('0x3d')](_0x18a03b[_0x4040('0x3a')],{'$or':_['map'](_0x1b878c,function(_0x31a017){if(_0x31a017[_0x4040('0x2d')]!=='VIRTUAL'){var _0x5b4d60={};_0x5b4d60[_0x31a017[_0x4040('0x27')]]={'$like':'%'+_0x1d670f[_0x4040('0x31')][_0x4040('0x3c')]+'%'};return _0x5b4d60;}})});}_0x18a03b=_[_0x4040('0x3d')]({},_0x18a03b,_0x1d670f[_0x4040('0x3e')]);var _0x549997={'where':_0x18a03b['where']};return db[_0x4040('0x2a')][_0x4040('0x1b')](_0x549997)[_0x4040('0x23')](function(_0x42ed30){_0x23ef59['count']=_0x42ed30;if(_0x1d670f[_0x4040('0x31')][_0x4040('0x3f')]){_0x18a03b[_0x4040('0x40')]=[{'all':!![]}];}return db[_0x4040('0x2a')][_0x4040('0x41')](_0x18a03b);})[_0x4040('0x23')](function(_0x4ceffe){_0x23ef59[_0x4040('0x42')]=_0x4ceffe;return _0x23ef59;})[_0x4040('0x23')](respondWithFilteredResult(_0x29cc8e,_0x18a03b))[_0x4040('0x43')](handleError(_0x29cc8e,null));};exports['show']=function(_0x41e61b,_0x840b4a){var _0xb00fc7={'raw':!![],'where':{'id':_0x41e61b[_0x4040('0x44')]['id']}},_0x4de8fc={};_0x4de8fc[_0x4040('0x2f')]=_[_0x4040('0x32')](db[_0x4040('0x2a')]['rawAttributes']);_0x4de8fc[_0x4040('0x31')]=_[_0x4040('0x32')](_0x41e61b['query']);_0x4de8fc[_0x4040('0x33')]=_[_0x4040('0x34')](_0x4de8fc[_0x4040('0x2f')],_0x4de8fc[_0x4040('0x31')]);_0xb00fc7[_0x4040('0x35')]=_['intersection'](_0x4de8fc['model'],qs[_0x4040('0x36')](_0x41e61b['query'][_0x4040('0x36')]));_0xb00fc7[_0x4040('0x35')]=_0xb00fc7[_0x4040('0x35')][_0x4040('0x45')]?_0xb00fc7[_0x4040('0x35')]:_0x4de8fc['model'];if(_0x41e61b['query']['includeAll']){_0xb00fc7[_0x4040('0x40')]=[{'all':!![]}];}_0xb00fc7=_[_0x4040('0x3d')]({},_0xb00fc7,_0x41e61b['options']);return db['CloudProvider'][_0x4040('0x46')](_0xb00fc7)[_0x4040('0x23')](handleEntityNotFound(_0x840b4a,null))[_0x4040('0x23')](respondWithResult(_0x840b4a,null))['catch'](handleError(_0x840b4a,null));};exports['create']=function(_0x36bd23,_0x5a7f2e){return db[_0x4040('0x2a')][_0x4040('0x47')](_0x36bd23[_0x4040('0x48')],{})['then'](respondWithResult(_0x5a7f2e,0xc9))[_0x4040('0x43')](handleError(_0x5a7f2e,null));};exports[_0x4040('0x22')]=function(_0x17f021,_0x3149c0){if(_0x17f021[_0x4040('0x48')]['id']){delete _0x17f021['body']['id'];}return db[_0x4040('0x2a')][_0x4040('0x46')]({'where':{'id':_0x17f021[_0x4040('0x44')]['id']}})['then'](handleEntityNotFound(_0x3149c0,null))[_0x4040('0x23')](saveUpdates(_0x17f021['body'],null))[_0x4040('0x23')](respondWithResult(_0x3149c0,null))['catch'](handleError(_0x3149c0,null));};exports[_0x4040('0x24')]=function(_0x3e50e6,_0x5a7525){return db[_0x4040('0x2a')][_0x4040('0x46')]({'where':{'id':_0x3e50e6['params']['id']}})[_0x4040('0x23')](handleEntityNotFound(_0x5a7525,null))[_0x4040('0x23')](removeEntity(_0x5a7525,null))[_0x4040('0x43')](handleError(_0x5a7525,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 5d52456..8d1d2b6 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 _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 +var _0x0857=['bluebird','exports','CloudProvider','cloud_providers','util','../../config/logger','api'];(function(_0x542cda,_0x433711){var _0x2717dd=function(_0x33f5a7){while(--_0x33f5a7){_0x542cda['push'](_0x542cda['shift']());}};_0x2717dd(++_0x433711);}(_0x0857,0xd6));var _0x7085=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x0857[_0xc6be3a];return _0x56a310;};'use strict';var _=require('lodash');var util=require(_0x7085('0x0'));var logger=require(_0x7085('0x1'))(_0x7085('0x2'));var moment=require('moment');var BPromise=require(_0x7085('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0x7085('0x4')]=function(_0x46a5c8,_0x46b914){return _0x46a5c8['define'](_0x7085('0x5'),attributes,{'tableName':_0x7085('0x6'),'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 418c24b..2b092d9 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 _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 +var _0x6a4f=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0x6a4f,0x130));var _0xf6a4=function(_0xbdd26c,_0x2fcd86){_0xbdd26c=_0xbdd26c-0x0;var _0x4810dd=_0x6a4f[_0xbdd26c];return _0x4810dd;};'use strict';var _=require(_0xf6a4('0x0'));var util=require('util');var moment=require(_0xf6a4('0x1'));var BPromise=require(_0xf6a4('0x2'));var rs=require(_0xf6a4('0x3'));var fs=require('fs');var Redis=require(_0xf6a4('0x4'));var db=require(_0xf6a4('0x5'))['db'];var utils=require(_0xf6a4('0x6'));var logger=require('../../config/logger')(_0xf6a4('0x7'));var config=require('../../config/environment');var jayson=require(_0xf6a4('0x8'));var client=jayson[_0xf6a4('0x9')][_0xf6a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51c060,_0x499205,_0x16a4fa){return new BPromise(function(_0x394ae7,_0x56edc5){return client[_0xf6a4('0xb')](_0x51c060,_0x16a4fa)[_0xf6a4('0xc')](function(_0x3896a3){logger[_0xf6a4('0xd')](_0xf6a4('0xe'),_0x499205,_0xf6a4('0xf'));logger['debug'](_0xf6a4('0x10'),_0x499205,_0xf6a4('0xf'),JSON[_0xf6a4('0x11')](_0x3896a3));if(_0x3896a3[_0xf6a4('0x12')]){if(_0x3896a3['error'][_0xf6a4('0x13')]===0x1f4){logger[_0xf6a4('0x12')](_0xf6a4('0xe'),_0x499205,_0x3896a3['error'][_0xf6a4('0x14')]);return _0x56edc5(_0x3896a3[_0xf6a4('0x12')][_0xf6a4('0x14')]);}logger[_0xf6a4('0x12')](_0xf6a4('0xe'),_0x499205,_0x3896a3[_0xf6a4('0x12')][_0xf6a4('0x14')]);return _0x394ae7(_0x3896a3[_0xf6a4('0x12')][_0xf6a4('0x14')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x499205,_0xf6a4('0xf'));_0x394ae7(_0x3896a3[_0xf6a4('0x15')][_0xf6a4('0x14')]);}})[_0xf6a4('0x16')](function(_0x5e43a9){logger['error']('CloudProvider,\x20%s,\x20%s',_0x499205,_0x5e43a9);_0x56edc5(_0x5e43a9);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 5b05928..8bcb5ca 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 _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 +var _0x7e1a=['put','update','delete','destroy','multer','connect-timeout','express','Router','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x2f453c,_0xad9d41){var _0xca358d=function(_0x3eac44){while(--_0x3eac44){_0x2f453c['push'](_0x2f453c['shift']());}};_0xca358d(++_0xad9d41);}(_0x7e1a,0x1b7));var _0xa7e1=function(_0xc47812,_0xe5e3e0){_0xc47812=_0xc47812-0x0;var _0x42ac55=_0x7e1a[_0xc47812];return _0x42ac55;};'use strict';var multer=require(_0xa7e1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa7e1('0x1'));var express=require(_0xa7e1('0x2'));var router=express[_0xa7e1('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cloudProvider.controller');router['get']('/',auth[_0xa7e1('0x4')](),controller[_0xa7e1('0x5')]);router[_0xa7e1('0x6')](_0xa7e1('0x7'),auth[_0xa7e1('0x4')](),controller[_0xa7e1('0x8')]);router[_0xa7e1('0x9')]('/',auth[_0xa7e1('0x4')](),controller[_0xa7e1('0xa')]);router[_0xa7e1('0xb')](_0xa7e1('0x7'),auth[_0xa7e1('0x4')](),controller[_0xa7e1('0xc')]);router[_0xa7e1('0xd')]('/:id',auth[_0xa7e1('0x4')](),controller[_0xa7e1('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 24ec00c..ded7884 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 _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 +var _0x2911=['exports','name','STRING','sequelize'];(function(_0x5302fb,_0x1a2db3){var _0x43e6a4=function(_0x324ae6){while(--_0x324ae6){_0x5302fb['push'](_0x5302fb['shift']());}};_0x43e6a4(++_0x1a2db3);}(_0x2911,0x1cf));var _0x1291=function(_0x578f2a,_0x1f5d46){_0x578f2a=_0x578f2a-0x0;var _0x46083a=_0x2911[_0x578f2a];return _0x46083a;};'use strict';var Sequelize=require(_0x1291('0x0'));module[_0x1291('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1291('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1291('0x3')]},'companyId':{'type':Sequelize[_0x1291('0x3')]},'website':{'type':Sequelize[_0x1291('0x3')]},'phone':{'type':Sequelize[_0x1291('0x3')]},'fax':{'type':Sequelize[_0x1291('0x3')]},'type':{'type':Sequelize[_0x1291('0x3')]},'street':{'type':Sequelize[_0x1291('0x3')]},'postalCode':{'type':Sequelize[_0x1291('0x3')]},'city':{'type':Sequelize[_0x1291('0x3')]},'country':{'type':Sequelize[_0x1291('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1291('0x3')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x1291('0x3')]},'sCity':{'type':Sequelize[_0x1291('0x3')]},'sCountry':{'type':Sequelize[_0x1291('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index e2b6b99..9be4d63 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 _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 +var _0xfc05=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','Companies','UserProfileResource','error','stack','name','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','includeAll','include','rows','catch','show','params','rawAttributes','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','findOne','getContacts','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel'];(function(_0x4762f9,_0x280e18){var _0x4b4c11=function(_0x559123){while(--_0x559123){_0x4762f9['push'](_0x4762f9['shift']());}};_0x4b4c11(++_0x280e18);}(_0xfc05,0x1ae));var _0x5fc0=function(_0x23b168,_0x3907aa){_0x23b168=_0x23b168-0x0;var _0x26c03f=_0xfc05[_0x23b168];return _0x26c03f;};'use strict';var pdf=require(_0x5fc0('0x0'));var emlformat=require(_0x5fc0('0x1'));var rimraf=require(_0x5fc0('0x2'));var zipdir=require(_0x5fc0('0x3'));var jsonpatch=require(_0x5fc0('0x4'));var rp=require(_0x5fc0('0x5'));var moment=require(_0x5fc0('0x6'));var BPromise=require(_0x5fc0('0x7'));var Mustache=require(_0x5fc0('0x8'));var util=require(_0x5fc0('0x9'));var path=require(_0x5fc0('0xa'));var sox=require(_0x5fc0('0xb'));var csv=require(_0x5fc0('0xc'));var ejs=require(_0x5fc0('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5fc0('0xe'));var crypto=require('crypto');var jsforce=require(_0x5fc0('0xf'));var deskjs=require(_0x5fc0('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5fc0('0x11'));var Papa=require(_0x5fc0('0x12'));var Redis=require(_0x5fc0('0x13'));var authService=require(_0x5fc0('0x14'));var qs=require(_0x5fc0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5fc0('0x16'));var logger=require(_0x5fc0('0x17'))(_0x5fc0('0x18'));var utils=require(_0x5fc0('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5fc0('0x1a'));var db=require(_0x5fc0('0x1b'))['db'];function respondWithStatusCode(_0x22fa49,_0x1ba786){_0x1ba786=_0x1ba786||0xcc;return function(_0x470dfa){if(_0x470dfa){return _0x22fa49[_0x5fc0('0x1c')](_0x1ba786);}return _0x22fa49[_0x5fc0('0x1d')](_0x1ba786)[_0x5fc0('0x1e')]();};}function respondWithResult(_0x401cf0,_0xe3b3){_0xe3b3=_0xe3b3||0xc8;return function(_0x3facb2){if(_0x3facb2){return _0x401cf0[_0x5fc0('0x1d')](_0xe3b3)[_0x5fc0('0x1f')](_0x3facb2);}};}function respondWithFilteredResult(_0x7fce18,_0x9a10){return function(_0x4c06eb){if(_0x4c06eb){var _0x1f9f7a=_0x4c06eb[_0x5fc0('0x20')],_0x57143d=_0x9a10[_0x5fc0('0x21')],_0x2bd813=_0x9a10[_0x5fc0('0x21')]+_0x9a10[_0x5fc0('0x22')],_0x4d11b9;if(_0x2bd813>=_0x1f9f7a){_0x2bd813=_0x1f9f7a;_0x4d11b9=0xc8;}else{_0x4d11b9=0xce;}_0x7fce18['status'](_0x4d11b9);return _0x7fce18['set'](_0x5fc0('0x23'),_0x57143d+'-'+_0x2bd813+'/'+_0x1f9f7a)[_0x5fc0('0x1f')](_0x4c06eb);}return null;};}function patchUpdates(_0x18e316){return function(_0x49e13d){try{jsonpatch[_0x5fc0('0x24')](_0x49e13d,_0x18e316,!![]);}catch(_0x309620){return BPromise[_0x5fc0('0x25')](_0x309620);}return _0x49e13d[_0x5fc0('0x26')]();};}function saveUpdates(_0x7b193e,_0x21868b){return function(_0x53912b){if(_0x53912b){return _0x53912b[_0x5fc0('0x27')](_0x7b193e)['then'](function(_0x4daf54){return _0x4daf54;});}return null;};}function removeEntity(_0x129e26,_0x7514b0){return function(_0x16c2b1){if(_0x16c2b1){return _0x16c2b1[_0x5fc0('0x28')]()[_0x5fc0('0x29')](function(){var _0x5c9dc1=_0x16c2b1['get']({'plain':!![]});var _0x2c6a9e=_0x5fc0('0x2a');return db[_0x5fc0('0x2b')][_0x5fc0('0x28')]({'where':{'type':_0x2c6a9e,'resourceId':_0x5c9dc1['id']}})['then'](function(){return _0x16c2b1;});})[_0x5fc0('0x29')](function(){_0x129e26[_0x5fc0('0x1d')](0xcc)[_0x5fc0('0x1e')]();});}};}function handleEntityNotFound(_0x4038f6,_0x1ad2e9){return function(_0x44679f){if(!_0x44679f){_0x4038f6[_0x5fc0('0x1c')](0x194);}return _0x44679f;};}function handleError(_0xa3007e,_0x4db05f){_0x4db05f=_0x4db05f||0x1f4;return function(_0x245859){logger[_0x5fc0('0x2c')](_0x245859[_0x5fc0('0x2d')]);if(_0x245859['name']){delete _0x245859[_0x5fc0('0x2e')];}_0xa3007e[_0x5fc0('0x1d')](_0x4db05f)['send'](_0x245859);};}exports['index']=function(_0x4890b9,_0x1030d4){var _0x2b1362={},_0x5eb9a1={},_0x408d43={'count':0x0,'rows':[]};return db[_0x5fc0('0x2f')][_0x5fc0('0x30')]()['then'](function(_0x2a1ad7){_0x5eb9a1[_0x5fc0('0x31')]=_[_0x5fc0('0x32')](_0x2a1ad7);_0x5eb9a1['query']=_[_0x5fc0('0x32')](_0x4890b9[_0x5fc0('0x33')]);_0x5eb9a1[_0x5fc0('0x34')]=_[_0x5fc0('0x35')](_0x5eb9a1[_0x5fc0('0x31')],_0x5eb9a1['query']);_0x2b1362[_0x5fc0('0x36')]=_[_0x5fc0('0x35')](_0x5eb9a1[_0x5fc0('0x31')],qs[_0x5fc0('0x37')](_0x4890b9[_0x5fc0('0x33')][_0x5fc0('0x37')]));_0x2b1362[_0x5fc0('0x36')]=_0x2b1362[_0x5fc0('0x36')][_0x5fc0('0x38')]?_0x2b1362[_0x5fc0('0x36')]:_0x5eb9a1['model'];if(!_0x4890b9[_0x5fc0('0x33')][_0x5fc0('0x39')](_0x5fc0('0x3a'))){_0x2b1362[_0x5fc0('0x22')]=qs[_0x5fc0('0x22')](_0x4890b9['query'][_0x5fc0('0x22')]);_0x2b1362[_0x5fc0('0x21')]=qs[_0x5fc0('0x21')](_0x4890b9[_0x5fc0('0x33')]['offset']);}_0x2b1362[_0x5fc0('0x3b')]=qs[_0x5fc0('0x3c')](_0x4890b9[_0x5fc0('0x33')][_0x5fc0('0x3c')]);_0x2b1362[_0x5fc0('0x3d')]=qs[_0x5fc0('0x34')](_[_0x5fc0('0x3e')](_0x4890b9[_0x5fc0('0x33')],_0x5eb9a1[_0x5fc0('0x34')]),_0x2a1ad7);if(_0x4890b9[_0x5fc0('0x33')][_0x5fc0('0x3f')]){_0x2b1362[_0x5fc0('0x3d')]=_[_0x5fc0('0x40')](_0x2b1362[_0x5fc0('0x3d')],{'$or':_[_0x5fc0('0x41')](_0x2b1362[_0x5fc0('0x36')],function(_0x3afaef){var _0x3c6740={};_0x3c6740[_0x3afaef]={'$like':'%'+_0x4890b9['query'][_0x5fc0('0x3f')]+'%'};return _0x3c6740;})});}_0x2b1362=_[_0x5fc0('0x40')]({},_0x2b1362,_0x4890b9['options']);var _0x31503b={'where':_0x2b1362[_0x5fc0('0x3d')]};return db[_0x5fc0('0x2f')][_0x5fc0('0x20')](_0x31503b)['then'](function(_0x40e6d5){_0x408d43[_0x5fc0('0x20')]=_0x40e6d5;if(_0x4890b9[_0x5fc0('0x33')][_0x5fc0('0x42')]){_0x2b1362[_0x5fc0('0x43')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x2b1362);})['then'](function(_0x38c72f){_0x408d43[_0x5fc0('0x44')]=_0x38c72f;return _0x408d43;})[_0x5fc0('0x29')](respondWithFilteredResult(_0x1030d4,_0x2b1362))[_0x5fc0('0x45')](handleError(_0x1030d4,null));})['catch'](handleError(_0x1030d4,null));};exports[_0x5fc0('0x46')]=function(_0x1d8a96,_0x36c503){var _0x2899b2={'raw':![],'where':{'id':_0x1d8a96[_0x5fc0('0x47')]['id']}},_0xd93bcf={};_0xd93bcf['model']=_['keys'](db[_0x5fc0('0x2f')][_0x5fc0('0x48')]);_0xd93bcf[_0x5fc0('0x33')]=_['keys'](_0x1d8a96[_0x5fc0('0x33')]);_0xd93bcf[_0x5fc0('0x34')]=_[_0x5fc0('0x35')](_0xd93bcf['model'],_0xd93bcf['query']);_0x2899b2['attributes']=_['intersection'](_0xd93bcf[_0x5fc0('0x31')],qs['fields'](_0x1d8a96['query'][_0x5fc0('0x37')]));_0x2899b2[_0x5fc0('0x36')]=_0x2899b2['attributes']['length']?_0x2899b2['attributes']:_0xd93bcf[_0x5fc0('0x31')];if(_0x1d8a96[_0x5fc0('0x33')][_0x5fc0('0x42')]){_0x2899b2[_0x5fc0('0x43')]=[{'all':!![]}];}_0x2899b2=_[_0x5fc0('0x40')]({},_0x2899b2,_0x1d8a96[_0x5fc0('0x49')]);return db[_0x5fc0('0x2f')][_0x5fc0('0x4a')](_0x2899b2)[_0x5fc0('0x29')](handleEntityNotFound(_0x36c503,null))[_0x5fc0('0x29')](respondWithResult(_0x36c503,null))[_0x5fc0('0x45')](handleError(_0x36c503,null));};exports[_0x5fc0('0x4b')]=function(_0x44ff91,_0x2f9f79){return db[_0x5fc0('0x2f')][_0x5fc0('0x4b')](_0x44ff91[_0x5fc0('0x4c')],{})['then'](function(_0x577e54){var _0x1c6b35=_0x44ff91[_0x5fc0('0x4d')][_0x5fc0('0x4e')]({'plain':!![]});if(!_0x1c6b35)throw new Error(_0x5fc0('0x4f'));if(_0x1c6b35[_0x5fc0('0x50')]===_0x5fc0('0x4d')){var _0x383022=_0x577e54[_0x5fc0('0x4e')]({'plain':!![]});var _0x3105ee=_0x5fc0('0x2a');return db['UserProfileSection'][_0x5fc0('0x4a')]({'where':{'name':_0x3105ee,'userProfileId':_0x1c6b35[_0x5fc0('0x51')]},'raw':!![]})['then'](function(_0x5688c4){if(_0x5688c4&&_0x5688c4['autoAssociation']===0x0){return db[_0x5fc0('0x2b')][_0x5fc0('0x4b')]({'name':_0x383022['name'],'resourceId':_0x383022['id'],'type':_0x5688c4[_0x5fc0('0x2e')],'sectionId':_0x5688c4['id']},{})[_0x5fc0('0x29')](function(){return _0x577e54;});}else{return _0x577e54;}})[_0x5fc0('0x45')](function(_0x2abd21){logger[_0x5fc0('0x2c')](_0x5fc0('0x52'),_0x2abd21);throw _0x2abd21;});}return _0x577e54;})[_0x5fc0('0x29')](respondWithResult(_0x2f9f79,0xc9))[_0x5fc0('0x45')](handleError(_0x2f9f79,null));};exports[_0x5fc0('0x27')]=function(_0x323264,_0x5262c6){if(_0x323264[_0x5fc0('0x4c')]['id']){delete _0x323264['body']['id'];}return db[_0x5fc0('0x2f')][_0x5fc0('0x4a')]({'where':{'id':_0x323264['params']['id']}})[_0x5fc0('0x29')](handleEntityNotFound(_0x5262c6,null))[_0x5fc0('0x29')](saveUpdates(_0x323264['body'],null))[_0x5fc0('0x29')](respondWithResult(_0x5262c6,null))[_0x5fc0('0x45')](handleError(_0x5262c6,null));};exports[_0x5fc0('0x28')]=function(_0x1a2c46,_0x10d402){return db[_0x5fc0('0x2f')]['find']({'where':{'id':_0x1a2c46[_0x5fc0('0x47')]['id']}})[_0x5fc0('0x29')](handleEntityNotFound(_0x10d402,null))[_0x5fc0('0x29')](removeEntity(_0x10d402,null))[_0x5fc0('0x45')](handleError(_0x10d402,null));};exports[_0x5fc0('0x30')]=function(_0x26b30a,_0x55cc72){return db[_0x5fc0('0x2f')][_0x5fc0('0x30')]()['then'](respondWithResult(_0x55cc72,null))[_0x5fc0('0x45')](handleError(_0x55cc72,null));};exports[_0x5fc0('0x53')]=function(_0x3430cd,_0x526300,_0xcb005){return db[_0x5fc0('0x54')][_0x5fc0('0x4a')]({'where':{'id':_0x3430cd['params']['id']}})[_0x5fc0('0x29')](handleEntityNotFound(_0x526300,null))[_0x5fc0('0x29')](function(_0x433575){if(_0x433575){return _0x433575[_0x5fc0('0x53')](_0x3430cd['body'][_0x5fc0('0x55')],_[_0x5fc0('0x56')](_0x3430cd[_0x5fc0('0x4c')],[_0x5fc0('0x55'),'id'])||{});}})[_0x5fc0('0x29')](respondWithResult(_0x526300,null))[_0x5fc0('0x45')](handleError(_0x526300,null));};exports['getContacts']=function(_0x1fac26,_0x1b9e7c,_0x4b65ea){var _0x6a02de={};var _0x2597e2={};var _0x41e56b;var _0x479cba;return db[_0x5fc0('0x2f')][_0x5fc0('0x57')]({'where':{'id':_0x1fac26[_0x5fc0('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b9e7c,null))[_0x5fc0('0x29')](function(_0x2d5c2b){if(_0x2d5c2b){_0x41e56b=_0x2d5c2b;_0x2597e2[_0x5fc0('0x31')]=_['keys'](db[_0x5fc0('0x54')][_0x5fc0('0x48')]);_0x2597e2[_0x5fc0('0x33')]=_[_0x5fc0('0x32')](_0x1fac26['query']);_0x2597e2[_0x5fc0('0x34')]=_[_0x5fc0('0x35')](_0x2597e2[_0x5fc0('0x31')],_0x2597e2[_0x5fc0('0x33')]);_0x6a02de[_0x5fc0('0x36')]=_[_0x5fc0('0x35')](_0x2597e2[_0x5fc0('0x31')],qs['fields'](_0x1fac26[_0x5fc0('0x33')][_0x5fc0('0x37')]));_0x6a02de['attributes']=_0x6a02de[_0x5fc0('0x36')][_0x5fc0('0x38')]?_0x6a02de[_0x5fc0('0x36')]:_0x2597e2[_0x5fc0('0x31')];_0x6a02de['order']=qs[_0x5fc0('0x3c')](_0x1fac26[_0x5fc0('0x33')][_0x5fc0('0x3c')]);_0x6a02de['where']=qs[_0x5fc0('0x34')](_[_0x5fc0('0x3e')](_0x1fac26[_0x5fc0('0x33')],_0x2597e2['filters']));if(_0x1fac26[_0x5fc0('0x33')][_0x5fc0('0x3f')]){_0x6a02de[_0x5fc0('0x3d')]=_[_0x5fc0('0x40')](_0x6a02de['where'],{'$or':_[_0x5fc0('0x41')](_0x6a02de['attributes'],function(_0x189e25){var _0xd7f29={};_0xd7f29[_0x189e25]={'$like':'%'+_0x1fac26[_0x5fc0('0x33')]['filter']+'%'};return _0xd7f29;})});}_0x6a02de=_[_0x5fc0('0x40')]({},_0x6a02de,_0x1fac26['options']);return _0x41e56b[_0x5fc0('0x58')](_0x6a02de);}})[_0x5fc0('0x29')](function(_0x4c3810){if(_0x4c3810){_0x479cba=_0x4c3810[_0x5fc0('0x38')];if(!_0x1fac26[_0x5fc0('0x33')][_0x5fc0('0x39')](_0x5fc0('0x3a'))){_0x6a02de['limit']=qs[_0x5fc0('0x22')](_0x1fac26[_0x5fc0('0x33')][_0x5fc0('0x22')]);_0x6a02de['offset']=qs[_0x5fc0('0x21')](_0x1fac26[_0x5fc0('0x33')][_0x5fc0('0x21')]);}return _0x41e56b[_0x5fc0('0x58')](_0x6a02de);}})['then'](function(_0x49bffc){if(_0x49bffc){return _0x49bffc?{'count':_0x479cba,'rows':_0x49bffc}:null;}})['then'](respondWithResult(_0x1b9e7c,null))['catch'](handleError(_0x1b9e7c,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 508d3e3..ef4d080 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 _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 +var _0xe015=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','cm_companies'];(function(_0x4a1850,_0x21e229){var _0x464a80=function(_0x37feb7){while(--_0x37feb7){_0x4a1850['push'](_0x4a1850['shift']());}};_0x464a80(++_0x21e229);}(_0xe015,0x13b));var _0x5e01=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xe015[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var logger=require(_0x5e01('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5e01('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e01('0x4'));var rimraf=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var attributes=require(_0x5e01('0x7'));module['exports']=function(_0x1814cb,_0x3d2da2){return _0x1814cb['define']('CmCompany',attributes,{'tableName':_0x5e01('0x8'),'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 99a27b6..8f4c267 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 _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 +var _0x4522=['http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x4b466d,_0x4d140d){var _0x165fbb=function(_0x161257){while(--_0x161257){_0x4b466d['push'](_0x4b466d['shift']());}};_0x165fbb(++_0x4d140d);}(_0x4522,0x172));var _0x2452=function(_0x347ac1,_0x412f83){_0x347ac1=_0x347ac1-0x0;var _0x272b00=_0x4522[_0x347ac1];return _0x272b00;};'use strict';var _=require(_0x2452('0x0'));var util=require('util');var moment=require(_0x2452('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2452('0x2'));var db=require(_0x2452('0x3'))['db'];var utils=require(_0x2452('0x4'));var logger=require('../../config/logger')(_0x2452('0x5'));var config=require('../../config/environment');var jayson=require(_0x2452('0x6'));var client=jayson[_0x2452('0x7')][_0x2452('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x533338,_0x4ba430,_0xff4cf5){return new BPromise(function(_0x1b946a,_0x57fe61){return client[_0x2452('0x9')](_0x533338,_0xff4cf5)[_0x2452('0xa')](function(_0xf468b5){logger['info'](_0x2452('0xb'),_0x4ba430,_0x2452('0xc'));logger[_0x2452('0xd')](_0x2452('0xe'),_0x4ba430,_0x2452('0xc'),JSON[_0x2452('0xf')](_0xf468b5));if(_0xf468b5['error']){if(_0xf468b5[_0x2452('0x10')][_0x2452('0x11')]===0x1f4){logger[_0x2452('0x10')]('CmCompany,\x20%s,\x20%s',_0x4ba430,_0xf468b5['error'][_0x2452('0x12')]);return _0x57fe61(_0xf468b5[_0x2452('0x10')][_0x2452('0x12')]);}logger[_0x2452('0x10')](_0x2452('0xb'),_0x4ba430,_0xf468b5[_0x2452('0x10')][_0x2452('0x12')]);return _0x1b946a(_0xf468b5[_0x2452('0x10')][_0x2452('0x12')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x4ba430,_0x2452('0xc'));_0x1b946a(_0xf468b5[_0x2452('0x13')][_0x2452('0x12')]);}})[_0x2452('0x14')](function(_0xcd7b13){logger[_0x2452('0x10')](_0x2452('0xb'),_0x4ba430,_0xcd7b13);_0x57fe61(_0xcd7b13);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index d0e0047..e096fca 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 _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 +var _0xb44a=['/:id','show','post','/:id/contacts','addContacts','put','delete','exports','path','express','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2f2536,_0x3c43f3){var _0x4701b3=function(_0x55d537){while(--_0x55d537){_0x2f2536['push'](_0x2f2536['shift']());}};_0x4701b3(++_0x3c43f3);}(_0xb44a,0x1c2));var _0xab44=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xb44a[_0x49ca18];return _0x145d54;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab44('0x0'));var timeout=require('connect-timeout');var express=require(_0xab44('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xab44('0x2'));var config=require('../../config/environment');var controller=require(_0xab44('0x3'));router[_0xab44('0x4')]('/',auth[_0xab44('0x5')](),controller[_0xab44('0x6')]);router[_0xab44('0x4')](_0xab44('0x7'),auth[_0xab44('0x5')](),controller[_0xab44('0x8')]);router[_0xab44('0x4')](_0xab44('0x9'),auth[_0xab44('0x5')](),controller[_0xab44('0xa')]);router[_0xab44('0x4')]('/:id/contacts',auth[_0xab44('0x5')](),controller['getContacts']);router[_0xab44('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xab44('0xb')](_0xab44('0xc'),auth[_0xab44('0x5')](),controller[_0xab44('0xd')]);router[_0xab44('0xe')](_0xab44('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xab44('0xf')]('/:id',auth[_0xab44('0x5')](),controller['destroy']);module[_0xab44('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 131d81a..75a43b8 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 _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 +var _0x12af=['INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','STRING','TEXT'];(function(_0xe73161,_0x296347){var _0x54e94b=function(_0x57d1b2){while(--_0x57d1b2){_0xe73161['push'](_0xe73161['shift']());}};_0x54e94b(++_0x296347);}(_0x12af,0x1cc));var _0xf12a=function(_0x54ef43,_0x308497){_0x54ef43=_0x54ef43-0x0;var _0x4e3816=_0x12af[_0x54ef43];return _0x4e3816;};'use strict';var _=require(_0xf12a('0x0'));var Sequelize=require(_0xf12a('0x1'));module['exports']={'firstName':{'type':Sequelize[_0xf12a('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xf12a('0x2')]},'street':{'type':Sequelize[_0xf12a('0x2')]},'postalCode':{'type':Sequelize[_0xf12a('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xf12a('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf12a('0x3')]},'phone':{'type':Sequelize[_0xf12a('0x2')]},'mobile':{'type':Sequelize[_0xf12a('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf12a('0x2')]},'url':{'type':Sequelize[_0xf12a('0x2')]},'facebook':{'type':Sequelize[_0xf12a('0x2')]},'fb_data':{'type':Sequelize[_0xf12a('0x2')]},'twitter':{'type':Sequelize[_0xf12a('0x2')]},'skype':{'type':Sequelize[_0xf12a('0x2')]},'teams':{'type':Sequelize[_0xf12a('0x2')]},'viber':{'type':Sequelize[_0xf12a('0x2')]},'line':{'type':Sequelize[_0xf12a('0x2')]},'wechat':{'type':Sequelize[_0xf12a('0x2')]},'telegram':{'type':Sequelize[_0xf12a('0x2')]},'UserId':{'type':Sequelize[_0xf12a('0x4')]},'priority':{'type':Sequelize[_0xf12a('0x4')](0x2)[_0xf12a('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf12a('0x6')],'defaultValue':Sequelize[_0xf12a('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index adbae87..1241cca 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 _0x0bb5=['Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','callerid','endtime','duration','note','userDisposition','userSecondDisposition','fullname','createdAt','startCase','Website','Account','closed','UserId','key','Owner','browserName','customerPort','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','findAndCountAll','flatten','sortBy','slice','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','end','json','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','CmContact','keys','length','startsWith','cf_','push','CmCustomField','trimStart','all','fieldType','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','field','from','select','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','tools_tags','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','Tag','value','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','and','uc.UserId\x20=\x20?','castTo','buildExpression','type','start','filter','isNil','c.ListId\x20IN\x20?','concat','Contact','\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','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.id','QueryTypes','SELECT','clone','DESC','having','t.id\x20IN\x20?','resolve','user','agent','some','isEmpty','c.ListId\x20IS\x20NULL','role','ListId','count','sequelize','merge','c.firstName','c.phone','c.mobile','c.fax','c.ListId','c.deletedAt','c.CompanyId','toString','TagIds','split','Tags','catch','params','describe','tags','columnName','displayName','findAll','alias','custom','values','body','get','mergeWith','join','info','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappQueueReport','create','each','duplicates','$or','findOrCreate','show','color','$and','format','cf_%d','omit','pickBy','table','setFields','id\x20=\x20?','toParam','phone','getTags','findOne','rawAttributes','options','setTags','ContactId','includeAll','rows','include','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','upload','createReadStream','parse','meta','import','binding','firstName','stringify','start\x20child\x20process\x20correctly!','pid','getJourney','mail','chat','sms','openchannel','fax','whatsapp','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x0bb5,0x148));var _0x50bb=function(_0xeeae02,_0x344533){_0xeeae02=_0xeeae02-0x0;var _0x987866=_0x0bb5[_0xeeae02];return _0x987866;};'use strict';var pdf=require(_0x50bb('0x0'));var emlformat=require(_0x50bb('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x50bb('0x2'));var rp=require(_0x50bb('0x3'));var moment=require(_0x50bb('0x4'));var BPromise=require(_0x50bb('0x5'));var Mustache=require(_0x50bb('0x6'));var util=require(_0x50bb('0x7'));var path=require(_0x50bb('0x8'));var sox=require(_0x50bb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var licenseUtil=require(_0x50bb('0x18'));var db=require('../../mysqldb')['db'];config[_0x50bb('0x19')]=_['defaults'](config[_0x50bb('0x19')],{'host':_0x50bb('0x1a'),'port':0x18eb});var socket=require(_0x50bb('0x1b'))(new Redis(config['redis']));require(_0x50bb('0x1c'))[_0x50bb('0x1d')](socket);function respondWithStatusCode(_0x3094f2,_0x5244b0){_0x5244b0=_0x5244b0||0xcc;return function(_0xbbc6a0){if(_0xbbc6a0){return _0x3094f2['sendStatus'](_0x5244b0);}return _0x3094f2[_0x50bb('0x1e')](_0x5244b0)[_0x50bb('0x1f')]();};}function respondWithResult(_0x253073,_0x42ffab){_0x42ffab=_0x42ffab||0xc8;return function(_0x908950){if(_0x908950){return _0x253073['status'](_0x42ffab)[_0x50bb('0x20')](_0x908950);}};}function respondWithFilteredResult(_0x174065,_0x4b1f5f){return function(_0x24ba19){if(_0x24ba19){var _0x4796ec=_0x24ba19['count'],_0x301f61=_0x4b1f5f[_0x50bb('0x21')],_0x431ed4=_0x4b1f5f[_0x50bb('0x21')]+_0x4b1f5f[_0x50bb('0x22')],_0x4b06f5;if(_0x431ed4>=_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=_0x517b95){_0x16955b=_0x517b95;_0x4daed5=0xc8;}else{_0x4daed5=0xce;}_0x260e53[_0x4923('0x20')](_0x4daed5);return _0x260e53[_0x4923('0x26')](_0x4923('0x27'),_0x50fd18+'-'+_0x16955b+'/'+_0x517b95)['json'](_0x1be04d);}return null;};}function patchUpdates(_0x3742d0){return function(_0x39039f){try{jsonpatch['apply'](_0x39039f,_0x3742d0,!![]);}catch(_0x43326e){return BPromise['reject'](_0x43326e);}return _0x39039f[_0x4923('0x28')]();};}function saveUpdates(_0x168bb4,_0x569b36){return function(_0x184f6a){if(_0x184f6a){return _0x184f6a[_0x4923('0x29')](_0x168bb4)[_0x4923('0x2a')](function(_0x161cf9){return _0x161cf9;});}return null;};}function removeEntity(_0x3aaede,_0x8a09e7){return function(_0x37aed2){if(_0x37aed2){return _0x37aed2['destroy']()['then'](function(){_0x3aaede[_0x4923('0x20')](0xcc)[_0x4923('0x21')]();});}};}function handleEntityNotFound(_0xdb893b,_0x32d508){return function(_0x2ea650){if(!_0x2ea650){_0xdb893b[_0x4923('0x1f')](0x194);}return _0x2ea650;};}function handleError(_0x13681b,_0x2c2a66){_0x2c2a66=_0x2c2a66||0x1f4;return function(_0x9982e8){logger[_0x4923('0x2b')](_0x9982e8[_0x4923('0x2c')]);if(_0x9982e8['name']){delete _0x9982e8[_0x4923('0x2d')];}_0x13681b[_0x4923('0x20')](_0x2c2a66)[_0x4923('0x2e')](_0x9982e8);};}exports[_0x4923('0x2f')]=function(_0x21c229,_0x47158c){var _0x158a30={},_0x7a97f3={},_0xb88ca4={'count':0x0,'rows':[]};return db[_0x4923('0x30')][_0x4923('0x31')]()[_0x4923('0x2a')](function(_0x140ecb){var _0x4184b2=[];for(var _0x53ce05=0x0;_0x53ce050x1){_0x9c58c1['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4923('0x6f')](_0x3981a9),null);}else{if(qs[_0x4923('0x70')](_0x3981a9)){_0x9c58c1['or'](_0x4923('0x71'),_0x3981a9+'%');_0x9c58c1['or'](_0x4923('0x72'),_0x3981a9+'%');_0x9c58c1['or'](_0x4923('0x73'),_0x3981a9+'%');_0x9c58c1['or'](_0x4923('0x74'),_0x3981a9+'%');}else if(qs[_0x4923('0x75')](_0x3981a9)){_0x9c58c1['or'](_0x4923('0x76'),_0x3981a9+'%');}else{_0x9c58c1['or']('c.firstName\x20LIKE\x20?','%'+_0x3981a9+'%');_0x9c58c1['or'](_0x4923('0x77'),'%'+_0x3981a9+'%');_0x9c58c1['or'](_0x4923('0x76'),'%'+_0x3981a9+'%');}}}}_0x15f0b2[_0x4923('0x42')](_0x9c58c1);_0x15f0b2[_0x4923('0x78')](_0x4923('0x79'));var _0x56de5d={'type':db[_0x4923('0x7a')][_0x4923('0x7b')][_0x4923('0x7c')],'raw':!![]};var _0x506cdc=_0x15f0b2['clone']()[_0x4923('0x44')](_0x4923('0x79'));if(_0x158a30['order']){_0x158a30['order'][_0x4923('0x59')](function(_0x2af427){_0x15f0b2[_0x4923('0x40')]('c.'+_0x2af427[0x0],_0x2af427[0x1]==='DESC'?![]:!![]);});}if(!_[_0x4923('0x7d')](_0x2e3edd)){_0x15f0b2[_0x4923('0x7e')](_0x2e09ca);_0x506cdc['where']('t.id\x20IN\x20?',_0x2e3edd);}BPromise['resolve']()[_0x4923('0x2a')](function(){if(!_0x26495c)return;if(_0x21c229['user'][_0x4923('0x7f')]!==_0x4923('0x80'))return;if(!_[_0x4923('0x81')](_0x26495c[_0x4923('0x54')],[_0x4923('0x44'),_0x4923('0x5c')])){return _0x21c229[_0x4923('0x82')]['getLists']({'attributes':['id'],'raw':!![]})[_0x4923('0x2a')](function(_0x3fd57a){if(_[_0x4923('0x7d')](_0x3fd57a)){_0x506cdc['where'](_0x4923('0x83'));_0x15f0b2[_0x4923('0x42')]('c.ListId\x20IS\x20NULL');}else{_0x506cdc[_0x4923('0x42')](_0x4923('0x68'),_[_0x4923('0x58')](_0x3fd57a,'id'));_0x15f0b2[_0x4923('0x42')]('c.ListId\x20IN\x20?',_[_0x4923('0x58')](_0x3fd57a,'id'));}});}})['then'](function(){if(_0x21c229[_0x4923('0x82')][_0x4923('0x7f')]==='agent'&&!_0x26495c&&!_0x21c229[_0x4923('0x3a')]['ListId'])return[];return db[_0x4923('0x84')][_0x4923('0x3a')](_0x506cdc[_0x4923('0x85')](),_0x56de5d);})['then'](function(_0x49e04a){_0xb88ca4[_0x4923('0x23')]=_0x49e04a['length'];if(_0xb88ca4['count']===0x0)return[];return db[_0x4923('0x84')][_0x4923('0x3a')](_0xd4a9f1[_0x4923('0x85')](),_0x56de5d)[_0x4923('0x2a')](function(_0x942cc8){_0x304139=_['keyBy'](_0x942cc8,'id');_0x56de5d=_['merge'](_0x56de5d,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x21c229['query'][_0x4923('0x3d')]){_0x158a30['attributes']['forEach'](function(_0x6ef528){_0x15f0b2['field']('c.'+_0x6ef528);});}else{_0x15f0b2['field'](_0x4923('0x79'));_0x15f0b2[_0x4923('0x44')](_0x4923('0x86'));_0x15f0b2[_0x4923('0x44')](_0x4923('0x87'));_0x15f0b2[_0x4923('0x44')](_0x4923('0x88'));_0x15f0b2[_0x4923('0x44')](_0x4923('0x89'));_0x15f0b2[_0x4923('0x44')](_0x4923('0x8a'));_0x15f0b2[_0x4923('0x44')](_0x4923('0x8b'));_0x15f0b2[_0x4923('0x44')](_0x4923('0x8c'));_0x15f0b2[_0x4923('0x44')](_0x4923('0x8d'));_0x15f0b2['field']('c.deletedAt');_0x15f0b2[_0x4923('0x44')](_0x4923('0x8e'));_0x15f0b2[_0x4923('0x44')](_0x4923('0x8f'),_0x4923('0x90'));}if(_0x158a30[_0x4923('0x25')])_0x15f0b2[_0x4923('0x25')](_0x158a30[_0x4923('0x25')]);if(_0x158a30['offset'])_0x15f0b2[_0x4923('0x24')](_0x158a30[_0x4923('0x24')]);return db[_0x4923('0x84')][_0x4923('0x3a')](_0x15f0b2[_0x4923('0x85')](),_0x56de5d);});})['then'](function(_0x4d111f){_0x4d111f[_0x4923('0x59')](function(_0x262f4e){if(_0x262f4e[_0x4923('0x90')]){_0x262f4e[_0x4923('0x91')]=[];_0x262f4e[_0x4923('0x90')]['split'](',')[_0x4923('0x59')](function(_0x424b64){_0x262f4e[_0x4923('0x91')][_0x4923('0x36')](_0x304139[_0x424b64]);});}delete _0x262f4e[_0x4923('0x90')];});_0xb88ca4[_0x4923('0x92')]=_0x4d111f;return _0xb88ca4;})[_0x4923('0x2a')](respondWithFilteredResult(_0x47158c,_0x158a30));})[_0x4923('0x93')](handleError(_0x47158c,null));};exports[_0x4923('0x94')]=function(_0x2a48bf,_0x12901d){return db[_0x4923('0x30')][_0x4923('0x95')]({'where':{'id':_0x2a48bf[_0x4923('0x96')]['id']}})[_0x4923('0x2a')](handleEntityNotFound(_0x12901d,null))[_0x4923('0x2a')](removeEntity(_0x12901d,null))[_0x4923('0x93')](handleError(_0x12901d,null));};exports[_0x4923('0x31')]=function(_0x41c526,_0x3628dd){return db[_0x4923('0x30')]['describe']()[_0x4923('0x2a')](function(_0x1fe7fc){delete _0x1fe7fc[_0x4923('0x97')];for(var _0x2a6dab=0x0;_0x2a6dab{}\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 +var _0x9780=['getHoppers','/:id/hopper_histories','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','/merge','merge','create','bulkCreate','setTags','diskStorage','join','root','server/files/tmp','originalname','replace','%s-%s%s','extname','/csv','single','file','uploadCsv','format','now','/upload','upload','/upload/:id','import','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/tags','getTags','/:id/hoppers'];(function(_0x427823,_0x254f71){var _0xeeefd5=function(_0x4eb550){while(--_0x4eb550){_0x427823['push'](_0x427823['shift']());}};_0xeeefd5(++_0x254f71);}(_0x9780,0x1d4));var _0x0978=function(_0x134c79,_0x2136d3){_0x134c79=_0x134c79-0x0;var _0x2c2142=_0x9780[_0x134c79];return _0x2c2142;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0978('0x0'));var timeout=require(_0x0978('0x1'));var express=require(_0x0978('0x2'));var router=express[_0x0978('0x3')]();var auth=require(_0x0978('0x4'));var interaction=require(_0x0978('0x5'));var config=require(_0x0978('0x6'));var controller=require(_0x0978('0x7'));router[_0x0978('0x8')]('/',auth[_0x0978('0x9')](),controller[_0x0978('0xa')]);router['get'](_0x0978('0xb'),auth[_0x0978('0x9')](),controller[_0x0978('0xc')]);router[_0x0978('0x8')](_0x0978('0xd'),auth[_0x0978('0x9')](),controller[_0x0978('0xe')]);router[_0x0978('0x8')](_0x0978('0xf'),auth[_0x0978('0x9')](),controller[_0x0978('0x10')]);router['get'](_0x0978('0x11'),auth['isAuthenticated'](),controller[_0x0978('0x12')]);router[_0x0978('0x8')](_0x0978('0x13'),auth[_0x0978('0x9')](),controller['getHopperHistories']);router[_0x0978('0x8')]('/:id/hopper_finals',auth[_0x0978('0x9')](),controller[_0x0978('0x14')]);router[_0x0978('0x8')](_0x0978('0x15'),auth[_0x0978('0x9')](),controller[_0x0978('0x16')]);router[_0x0978('0x8')](_0x0978('0x17'),auth['isAuthenticated'](),controller[_0x0978('0x18')]);router[_0x0978('0x19')](_0x0978('0x1a'),auth[_0x0978('0x9')](),controller[_0x0978('0x1b')]);router[_0x0978('0x19')]('/',auth[_0x0978('0x9')](),controller[_0x0978('0x1c')]);router[_0x0978('0x19')]('/create_many',auth[_0x0978('0x9')](),controller[_0x0978('0x1d')]);router[_0x0978('0x19')](_0x0978('0xf'),auth[_0x0978('0x9')](),controller[_0x0978('0x1e')]);var upload=multer({'storage':multer[_0x0978('0x1f')]({'destination':function(_0xd01b3a,_0x3003ab,_0x575acd){_0x575acd(null,path[_0x0978('0x20')](config[_0x0978('0x21')],_0x0978('0x22')));},'filename':function(_0x57a4e7,_0x1ac591,_0x2fd1f2){_0x1ac591[_0x0978('0x23')]=_0x1ac591['originalname'][_0x0978('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2fd1f2(null,util['format'](_0x0978('0x25'),path['basename'](_0x1ac591[_0x0978('0x23')],path['extname'](_0x1ac591[_0x0978('0x23')])),Date['now'](),path[_0x0978('0x26')](_0x1ac591['originalname'])));}})});router['post'](_0x0978('0x27'),upload[_0x0978('0x28')](_0x0978('0x29')),controller[_0x0978('0x2a')]);var upload=multer({'storage':multer[_0x0978('0x1f')]({'destination':function(_0x1fcb09,_0x3f5c6d,_0x39fff2){_0x39fff2(null,path[_0x0978('0x20')](config[_0x0978('0x21')],_0x0978('0x22')));},'filename':function(_0x46c522,_0x44422c,_0x1c1e6b){_0x44422c[_0x0978('0x23')]=_0x44422c[_0x0978('0x23')][_0x0978('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1c1e6b(null,util[_0x0978('0x2b')](_0x0978('0x25'),path['basename'](_0x44422c[_0x0978('0x23')],path['extname'](_0x44422c[_0x0978('0x23')])),Date[_0x0978('0x2c')](),path[_0x0978('0x26')](_0x44422c[_0x0978('0x23')])));}})});router[_0x0978('0x19')](_0x0978('0x2d'),upload[_0x0978('0x28')](_0x0978('0x29')),controller[_0x0978('0x2e')]);router[_0x0978('0x19')](_0x0978('0x2f'),auth[_0x0978('0x9')](),controller[_0x0978('0x30')]);router[_0x0978('0x31')](_0x0978('0xd'),auth[_0x0978('0x9')](),controller[_0x0978('0x32')]);router[_0x0978('0x33')]('/:id',auth[_0x0978('0x9')](),controller[_0x0978('0x34')]);module[_0x0978('0x35')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index fab7625..427f06c 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 _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 +var _0x7d55=['exports','INTEGER','STRING','PHONE','sequelize'];(function(_0x406d39,_0xd3c8f1){var _0x2eb792=function(_0x572291){while(--_0x572291){_0x406d39['push'](_0x406d39['shift']());}};_0x2eb792(++_0xd3c8f1);}(_0x7d55,0x1bc));var _0x57d5=function(_0xa1f655,_0x5056af){_0xa1f655=_0xa1f655-0x0;var _0x11aaaa=_0x7d55[_0xa1f655];return _0x11aaaa;};'use strict';var Sequelize=require(_0x57d5('0x0'));module[_0x57d5('0x1')]={'CmContactId':{'type':Sequelize[_0x57d5('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x57d5('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x57d5('0x4')},'OrderBy':{'type':Sequelize[_0x57d5('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 03e30fb..200d334 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 _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 +var _0xbd44=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','lodash','squel','jsforce','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','count','offset','set','apply','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','limit','order','sort','filters','pick','merge','where','VIRTUAL','filter','options','findAll','rows','params','length','includeAll','include','find','catch'];(function(_0x16cad5,_0x2787f0){var _0x20eed1=function(_0x45126a){while(--_0x45126a){_0x16cad5['push'](_0x16cad5['shift']());}};_0x20eed1(++_0x2787f0);}(_0xbd44,0x151));var _0x4bd4=function(_0x58ae30,_0x4c58e1){_0x58ae30=_0x58ae30-0x0;var _0x3dfcd0=_0xbd44[_0x58ae30];return _0x3dfcd0;};'use strict';var pdf=require(_0x4bd4('0x0'));var emlformat=require(_0x4bd4('0x1'));var rimraf=require(_0x4bd4('0x2'));var zipdir=require(_0x4bd4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4bd4('0x4'));var moment=require('moment');var BPromise=require(_0x4bd4('0x5'));var Mustache=require('mustache');var util=require(_0x4bd4('0x6'));var path=require(_0x4bd4('0x7'));var sox=require(_0x4bd4('0x8'));var csv=require('to-csv');var ejs=require(_0x4bd4('0x9'));var fs=require('fs');var _=require(_0x4bd4('0xa'));var squel=require(_0x4bd4('0xb'));var crypto=require('crypto');var jsforce=require(_0x4bd4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4bd4('0xd'));var Papa=require('papaparse');var Redis=require(_0x4bd4('0xe'));var authService=require(_0x4bd4('0xf'));var qs=require(_0x4bd4('0x10'));var as=require(_0x4bd4('0x11'));var hardwareService=require(_0x4bd4('0x12'));var logger=require(_0x4bd4('0x13'))('api');var utils=require(_0x4bd4('0x14'));var config=require(_0x4bd4('0x15'));var licenseUtil=require(_0x4bd4('0x16'));var db=require(_0x4bd4('0x17'))['db'];function respondWithStatusCode(_0x3aeb31,_0x191707){_0x191707=_0x191707||0xcc;return function(_0xdb1dfc){if(_0xdb1dfc){return _0x3aeb31[_0x4bd4('0x18')](_0x191707);}return _0x3aeb31[_0x4bd4('0x19')](_0x191707)[_0x4bd4('0x1a')]();};}function respondWithResult(_0x221297,_0x187350){_0x187350=_0x187350||0xc8;return function(_0x5df37e){if(_0x5df37e){return _0x221297[_0x4bd4('0x19')](_0x187350)[_0x4bd4('0x1b')](_0x5df37e);}};}function respondWithFilteredResult(_0x5e165b,_0x382b94){return function(_0x595037){if(_0x595037){var _0x53de6e=_0x595037[_0x4bd4('0x1c')],_0x4de917=_0x382b94[_0x4bd4('0x1d')],_0x18b20a=_0x382b94[_0x4bd4('0x1d')]+_0x382b94['limit'],_0x1f42ab;if(_0x18b20a>=_0x53de6e){_0x18b20a=_0x53de6e;_0x1f42ab=0xc8;}else{_0x1f42ab=0xce;}_0x5e165b[_0x4bd4('0x19')](_0x1f42ab);return _0x5e165b[_0x4bd4('0x1e')]('Content-Range',_0x4de917+'-'+_0x18b20a+'/'+_0x53de6e)[_0x4bd4('0x1b')](_0x595037);}return null;};}function patchUpdates(_0x4852c7){return function(_0x56116a){try{jsonpatch[_0x4bd4('0x1f')](_0x56116a,_0x4852c7,!![]);}catch(_0x32babe){return BPromise['reject'](_0x32babe);}return _0x56116a['save']();};}function saveUpdates(_0x4b6bfb,_0x4f0d69){return function(_0x30945d){if(_0x30945d){return _0x30945d[_0x4bd4('0x20')](_0x4b6bfb)[_0x4bd4('0x21')](function(_0x24acb8){return _0x24acb8;});}return null;};}function removeEntity(_0x330037,_0x20849d){return function(_0x327072){if(_0x327072){return _0x327072[_0x4bd4('0x22')]()[_0x4bd4('0x21')](function(){var _0x149de6=_0x327072[_0x4bd4('0x23')]({'plain':!![]});var _0x1f9584=_0x4bd4('0x24');return db[_0x4bd4('0x25')][_0x4bd4('0x22')]({'where':{'type':_0x1f9584,'resourceId':_0x149de6['id']}})[_0x4bd4('0x21')](function(){return _0x327072;});})[_0x4bd4('0x21')](function(){_0x330037[_0x4bd4('0x19')](0xcc)[_0x4bd4('0x1a')]();});}};}function handleEntityNotFound(_0xde2a74,_0x5c36b2){return function(_0x10bc94){if(!_0x10bc94){_0xde2a74['sendStatus'](0x194);}return _0x10bc94;};}function handleError(_0x5053d7,_0x358fc9){_0x358fc9=_0x358fc9||0x1f4;return function(_0xb00321){logger[_0x4bd4('0x26')](_0xb00321[_0x4bd4('0x27')]);if(_0xb00321[_0x4bd4('0x28')]){delete _0xb00321[_0x4bd4('0x28')];}_0x5053d7[_0x4bd4('0x19')](_0x358fc9)[_0x4bd4('0x29')](_0xb00321);};}exports[_0x4bd4('0x2a')]=function(_0x7a1fa6,_0x4c3491){var _0x55e98f={},_0x30eb74={},_0x192a8c={'count':0x0,'rows':[]};var _0x374a23=_[_0x4bd4('0x2b')](db[_0x4bd4('0x2c')][_0x4bd4('0x2d')],function(_0x3791aa){return{'name':_0x3791aa['fieldName'],'type':_0x3791aa[_0x4bd4('0x2e')][_0x4bd4('0x2f')]};});_0x30eb74['model']=_[_0x4bd4('0x2b')](_0x374a23,_0x4bd4('0x28'));_0x30eb74[_0x4bd4('0x30')]=_[_0x4bd4('0x31')](_0x7a1fa6[_0x4bd4('0x30')]);_0x30eb74['filters']=_[_0x4bd4('0x32')](_0x30eb74[_0x4bd4('0x33')],_0x30eb74[_0x4bd4('0x30')]);_0x55e98f[_0x4bd4('0x34')]=_[_0x4bd4('0x32')](_0x30eb74['model'],qs[_0x4bd4('0x35')](_0x7a1fa6[_0x4bd4('0x30')][_0x4bd4('0x35')]));_0x55e98f['attributes']=_0x55e98f['attributes']['length']?_0x55e98f[_0x4bd4('0x34')]:_0x30eb74[_0x4bd4('0x33')];if(!_0x7a1fa6[_0x4bd4('0x30')][_0x4bd4('0x36')]('nolimit')){_0x55e98f[_0x4bd4('0x37')]=qs[_0x4bd4('0x37')](_0x7a1fa6[_0x4bd4('0x30')][_0x4bd4('0x37')]);_0x55e98f[_0x4bd4('0x1d')]=qs[_0x4bd4('0x1d')](_0x7a1fa6['query'][_0x4bd4('0x1d')]);}_0x55e98f[_0x4bd4('0x38')]=qs[_0x4bd4('0x39')](_0x7a1fa6[_0x4bd4('0x30')][_0x4bd4('0x39')]);_0x55e98f['where']=qs[_0x4bd4('0x3a')](_[_0x4bd4('0x3b')](_0x7a1fa6[_0x4bd4('0x30')],_0x30eb74['filters']),_0x374a23);if(_0x7a1fa6[_0x4bd4('0x30')]['filter']){_0x55e98f['where']=_[_0x4bd4('0x3c')](_0x55e98f[_0x4bd4('0x3d')],{'$or':_[_0x4bd4('0x2b')](_0x374a23,function(_0x5e9f28){if(_0x5e9f28[_0x4bd4('0x2e')]!==_0x4bd4('0x3e')){var _0x10a789={};_0x10a789[_0x5e9f28[_0x4bd4('0x28')]]={'$like':'%'+_0x7a1fa6[_0x4bd4('0x30')][_0x4bd4('0x3f')]+'%'};return _0x10a789;}})});}_0x55e98f=_[_0x4bd4('0x3c')]({},_0x55e98f,_0x7a1fa6[_0x4bd4('0x40')]);var _0x324532={'where':_0x55e98f[_0x4bd4('0x3d')]};return db[_0x4bd4('0x2c')][_0x4bd4('0x1c')](_0x324532)[_0x4bd4('0x21')](function(_0x221c3a){_0x192a8c['count']=_0x221c3a;if(_0x7a1fa6[_0x4bd4('0x30')]['includeAll']){_0x55e98f['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0x4bd4('0x41')](_0x55e98f);})[_0x4bd4('0x21')](function(_0x133889){_0x192a8c[_0x4bd4('0x42')]=_0x133889;return _0x192a8c;})['then'](respondWithFilteredResult(_0x4c3491,_0x55e98f))['catch'](handleError(_0x4c3491,null));};exports['show']=function(_0x2ff306,_0x5a7dcd){var _0x188b08={'raw':!![],'where':{'id':_0x2ff306[_0x4bd4('0x43')]['id']}},_0x131dce={};_0x131dce['model']=_[_0x4bd4('0x31')](db[_0x4bd4('0x2c')]['rawAttributes']);_0x131dce['query']=_[_0x4bd4('0x31')](_0x2ff306['query']);_0x131dce[_0x4bd4('0x3a')]=_['intersection'](_0x131dce[_0x4bd4('0x33')],_0x131dce[_0x4bd4('0x30')]);_0x188b08[_0x4bd4('0x34')]=_['intersection'](_0x131dce['model'],qs[_0x4bd4('0x35')](_0x2ff306[_0x4bd4('0x30')][_0x4bd4('0x35')]));_0x188b08[_0x4bd4('0x34')]=_0x188b08[_0x4bd4('0x34')][_0x4bd4('0x44')]?_0x188b08[_0x4bd4('0x34')]:_0x131dce['model'];if(_0x2ff306[_0x4bd4('0x30')][_0x4bd4('0x45')]){_0x188b08[_0x4bd4('0x46')]=[{'all':!![]}];}_0x188b08=_['merge']({},_0x188b08,_0x2ff306[_0x4bd4('0x40')]);return db[_0x4bd4('0x2c')][_0x4bd4('0x47')](_0x188b08)[_0x4bd4('0x21')](handleEntityNotFound(_0x5a7dcd,null))[_0x4bd4('0x21')](respondWithResult(_0x5a7dcd,null))[_0x4bd4('0x48')](handleError(_0x5a7dcd,null));};exports['create']=function(_0x30893c,_0x5c7b86){return db[_0x4bd4('0x2c')][_0x4bd4('0x49')](_0x30893c['body'],{})[_0x4bd4('0x21')](function(_0x4dd3d3){var _0x31a5f4=_0x30893c[_0x4bd4('0x4a')][_0x4bd4('0x23')]({'plain':!![]});if(!_0x31a5f4)throw new Error(_0x4bd4('0x4b'));if(_0x31a5f4[_0x4bd4('0x4c')]===_0x4bd4('0x4a')){var _0x18d697=_0x4dd3d3[_0x4bd4('0x23')]({'plain':!![]});var _0x3731b0=_0x4bd4('0x24');return db[_0x4bd4('0x4d')][_0x4bd4('0x47')]({'where':{'name':_0x3731b0,'userProfileId':_0x31a5f4[_0x4bd4('0x4e')]},'raw':!![]})['then'](function(_0x391580){if(_0x391580&&_0x391580[_0x4bd4('0x4f')]===0x0){return db['UserProfileResource'][_0x4bd4('0x49')]({'name':_0x18d697['name'],'resourceId':_0x18d697['id'],'type':_0x391580[_0x4bd4('0x28')],'sectionId':_0x391580['id']},{})['then'](function(){return _0x4dd3d3;});}else{return _0x4dd3d3;}})[_0x4bd4('0x48')](function(_0x3b80ed){logger['error'](_0x4bd4('0x50'),_0x3b80ed);throw _0x3b80ed;});}return _0x4dd3d3;})[_0x4bd4('0x21')](respondWithResult(_0x5c7b86,0xc9))['catch'](handleError(_0x5c7b86,null));};exports[_0x4bd4('0x20')]=function(_0x3275d1,_0x2489d8){if(_0x3275d1[_0x4bd4('0x51')]['id']){delete _0x3275d1[_0x4bd4('0x51')]['id'];}return db[_0x4bd4('0x2c')]['find']({'where':{'id':_0x3275d1[_0x4bd4('0x43')]['id']}})['then'](handleEntityNotFound(_0x2489d8,null))[_0x4bd4('0x21')](saveUpdates(_0x3275d1[_0x4bd4('0x51')],null))[_0x4bd4('0x21')](respondWithResult(_0x2489d8,null))['catch'](handleError(_0x2489d8,null));};exports[_0x4bd4('0x22')]=function(_0x269ddd,_0x160f0d){return db[_0x4bd4('0x2c')][_0x4bd4('0x47')]({'where':{'id':_0x269ddd[_0x4bd4('0x43')]['id']}})[_0x4bd4('0x21')](handleEntityNotFound(_0x160f0d,null))[_0x4bd4('0x21')](removeEntity(_0x160f0d,null))[_0x4bd4('0x48')](handleError(_0x160f0d,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 2a26d45..0b7d2d3 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 _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 +var _0xaa3f=['rimraf','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2ff912,_0x1a1e20){var _0x356921=function(_0x2baf14){while(--_0x2baf14){_0x2ff912['push'](_0x2ff912['shift']());}};_0x356921(++_0x1a1e20);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x1b62b5,_0x7ae1f){_0x1b62b5=_0x1b62b5-0x0;var _0x30e905=_0xaa3f[_0x1b62b5];return _0x30e905;};'use strict';var _=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var logger=require(_0xfaa3('0x2'))(_0xfaa3('0x3'));var moment=require(_0xfaa3('0x4'));var BPromise=require(_0xfaa3('0x5'));var rp=require(_0xfaa3('0x6'));var fs=require('fs');var path=require(_0xfaa3('0x7'));var rimraf=require(_0xfaa3('0x8'));var config=require('../../config/environment');var attributes=require('./cmContactHasItem.attributes');module[_0xfaa3('0x9')]=function(_0x4bac92,_0x3d09aa){return _0x4bac92[_0xfaa3('0xa')](_0xfaa3('0xb'),attributes,{'tableName':_0xfaa3('0xc'),'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 df51179..fb255e8 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 _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 +var _0x2056=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','moment'];(function(_0x334033,_0x1f6788){var _0x5aaba1=function(_0x5c5e8e){while(--_0x5c5e8e){_0x334033['push'](_0x334033['shift']());}};_0x5aaba1(++_0x1f6788);}(_0x2056,0x107));var _0x6205=function(_0x44b346,_0xeb097d){_0x44b346=_0x44b346-0x0;var _0x1c2f2b=_0x2056[_0x44b346];return _0x1c2f2b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6205('0x0'));var BPromise=require(_0x6205('0x1'));var rs=require(_0x6205('0x2'));var fs=require('fs');var Redis=require(_0x6205('0x3'));var db=require(_0x6205('0x4'))['db'];var utils=require(_0x6205('0x5'));var logger=require(_0x6205('0x6'))(_0x6205('0x7'));var config=require(_0x6205('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6205('0x9')][_0x6205('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27eb28,_0x446132,_0x271ffb){return new BPromise(function(_0x556d20,_0x1b7091){return client[_0x6205('0xb')](_0x27eb28,_0x271ffb)[_0x6205('0xc')](function(_0x20b0f6){logger[_0x6205('0xd')](_0x6205('0xe'),_0x446132,'request\x20sent');logger[_0x6205('0xf')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x446132,_0x6205('0x10'),JSON[_0x6205('0x11')](_0x20b0f6));if(_0x20b0f6[_0x6205('0x12')]){if(_0x20b0f6[_0x6205('0x12')][_0x6205('0x13')]===0x1f4){logger['error'](_0x6205('0xe'),_0x446132,_0x20b0f6[_0x6205('0x12')]['message']);return _0x1b7091(_0x20b0f6[_0x6205('0x12')][_0x6205('0x14')]);}logger['error'](_0x6205('0xe'),_0x446132,_0x20b0f6['error']['message']);return _0x556d20(_0x20b0f6['error'][_0x6205('0x14')]);}else{logger[_0x6205('0xd')](_0x6205('0xe'),_0x446132,_0x6205('0x10'));_0x556d20(_0x20b0f6[_0x6205('0x15')][_0x6205('0x14')]);}})['catch'](function(_0x4832fa){logger[_0x6205('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x446132,_0x4832fa);_0x1b7091(_0x4832fa);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 479d2d3..b2c2815 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 _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 +var _0x74da=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x74da,0x1f3));var _0xa74d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x74da[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa74d('0x0'));var util=require('util');var path=require(_0xa74d('0x1'));var timeout=require(_0xa74d('0x2'));var express=require('express');var router=express[_0xa74d('0x3')]();var auth=require(_0xa74d('0x4'));var interaction=require(_0xa74d('0x5'));var config=require(_0xa74d('0x6'));var controller=require('./cmContactHasItem.controller');router[_0xa74d('0x7')]('/',auth[_0xa74d('0x8')](),controller[_0xa74d('0x9')]);router[_0xa74d('0x7')](_0xa74d('0xa'),auth[_0xa74d('0x8')](),controller['show']);router[_0xa74d('0xb')]('/',auth[_0xa74d('0x8')](),controller[_0xa74d('0xc')]);router[_0xa74d('0xd')](_0xa74d('0xa'),auth[_0xa74d('0x8')](),controller[_0xa74d('0xe')]);router[_0xa74d('0xf')](_0xa74d('0xa'),auth[_0xa74d('0x8')](),controller[_0xa74d('0x10')]);module[_0xa74d('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index b064ffe..166a13f 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 _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 +var _0xc00f=['exports','INTEGER','STRING','sequelize'];(function(_0xe28eae,_0x43f392){var _0x100f0f=function(_0x9da8a0){while(--_0x9da8a0){_0xe28eae['push'](_0xe28eae['shift']());}};_0x100f0f(++_0x43f392);}(_0xc00f,0x113));var _0xfc00=function(_0x146f9c,_0x43fa83){_0x146f9c=_0x146f9c-0x0;var _0x24d6b5=_0xc00f[_0x146f9c];return _0x24d6b5;};'use strict';var Sequelize=require(_0xfc00('0x0'));module[_0xfc00('0x1')]={'CmContactId':{'type':Sequelize[_0xfc00('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0xfc00('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 8ad628d..ad02937 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 _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 +var _0x872a=['rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasPhones','UserProfileSection','find','userProfileId','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','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','error','stack','name','CmContactHasPhone'];(function(_0x17b810,_0x5277c1){var _0x1d89da=function(_0x2cee65){while(--_0x2cee65){_0x17b810['push'](_0x17b810['shift']());}};_0x1d89da(++_0x5277c1);}(_0x872a,0x1ba));var _0xa872=function(_0x4420e6,_0x351214){_0x4420e6=_0x4420e6-0x0;var _0x5f3820=_0x872a[_0x4420e6];return _0x5f3820;};'use strict';var pdf=require(_0xa872('0x0'));var emlformat=require(_0xa872('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa872('0x2'));var jsonpatch=require(_0xa872('0x3'));var rp=require(_0xa872('0x4'));var moment=require(_0xa872('0x5'));var BPromise=require(_0xa872('0x6'));var Mustache=require(_0xa872('0x7'));var util=require(_0xa872('0x8'));var path=require(_0xa872('0x9'));var sox=require(_0xa872('0xa'));var csv=require(_0xa872('0xb'));var ejs=require(_0xa872('0xc'));var fs=require('fs');var _=require(_0xa872('0xd'));var squel=require('squel');var crypto=require(_0xa872('0xe'));var jsforce=require(_0xa872('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa872('0xb'));var querystring=require(_0xa872('0x10'));var Papa=require(_0xa872('0x11'));var Redis=require('ioredis');var authService=require(_0xa872('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa872('0x13'));var hardwareService=require(_0xa872('0x14'));var logger=require(_0xa872('0x15'))(_0xa872('0x16'));var utils=require('../../config/utils');var config=require(_0xa872('0x17'));var licenseUtil=require(_0xa872('0x18'));var db=require(_0xa872('0x19'))['db'];function respondWithStatusCode(_0x2bd104,_0x29c20e){_0x29c20e=_0x29c20e||0xcc;return function(_0x578004){if(_0x578004){return _0x2bd104[_0xa872('0x1a')](_0x29c20e);}return _0x2bd104[_0xa872('0x1b')](_0x29c20e)[_0xa872('0x1c')]();};}function respondWithResult(_0x3bfdbf,_0x1e4aa4){_0x1e4aa4=_0x1e4aa4||0xc8;return function(_0x5eff30){if(_0x5eff30){return _0x3bfdbf[_0xa872('0x1b')](_0x1e4aa4)[_0xa872('0x1d')](_0x5eff30);}};}function respondWithFilteredResult(_0xe47c97,_0x1da590){return function(_0x289edd){if(_0x289edd){var _0x2b303b=_0x289edd[_0xa872('0x1e')],_0x4afa8c=_0x1da590['offset'],_0x20eaf7=_0x1da590[_0xa872('0x1f')]+_0x1da590[_0xa872('0x20')],_0x234a12;if(_0x20eaf7>=_0x2b303b){_0x20eaf7=_0x2b303b;_0x234a12=0xc8;}else{_0x234a12=0xce;}_0xe47c97[_0xa872('0x1b')](_0x234a12);return _0xe47c97[_0xa872('0x21')](_0xa872('0x22'),_0x4afa8c+'-'+_0x20eaf7+'/'+_0x2b303b)['json'](_0x289edd);}return null;};}function patchUpdates(_0x124e38){return function(_0x5421fa){try{jsonpatch['apply'](_0x5421fa,_0x124e38,!![]);}catch(_0x3ac42e){return BPromise['reject'](_0x3ac42e);}return _0x5421fa[_0xa872('0x23')]();};}function saveUpdates(_0x40f0e1,_0x4facbe){return function(_0x32e41d){if(_0x32e41d){return _0x32e41d[_0xa872('0x24')](_0x40f0e1)[_0xa872('0x25')](function(_0xd0ddb9){return _0xd0ddb9;});}return null;};}function removeEntity(_0x4cf1f0,_0x374e90){return function(_0x4168e1){if(_0x4168e1){return _0x4168e1[_0xa872('0x26')]()[_0xa872('0x25')](function(){var _0x3afe69=_0x4168e1[_0xa872('0x27')]({'plain':!![]});var _0x5f2680='CmContactHasPhones';return db['UserProfileResource']['destroy']({'where':{'type':_0x5f2680,'resourceId':_0x3afe69['id']}})['then'](function(){return _0x4168e1;});})[_0xa872('0x25')](function(){_0x4cf1f0[_0xa872('0x1b')](0xcc)[_0xa872('0x1c')]();});}};}function handleEntityNotFound(_0x28c19b,_0x3bf1fc){return function(_0x5d0a71){if(!_0x5d0a71){_0x28c19b['sendStatus'](0x194);}return _0x5d0a71;};}function handleError(_0x1ba5b0,_0x4683a2){_0x4683a2=_0x4683a2||0x1f4;return function(_0x183d5f){logger[_0xa872('0x28')](_0x183d5f[_0xa872('0x29')]);if(_0x183d5f[_0xa872('0x2a')]){delete _0x183d5f[_0xa872('0x2a')];}_0x1ba5b0[_0xa872('0x1b')](_0x4683a2)['send'](_0x183d5f);};}exports['index']=function(_0x5a6df5,_0x49c65a){var _0x1aa335={},_0x1a6be1={},_0x1bfcc4={'count':0x0,'rows':[]};var _0x336faf=_['map'](db[_0xa872('0x2b')][_0xa872('0x2c')],function(_0x13f6ed){return{'name':_0x13f6ed['fieldName'],'type':_0x13f6ed[_0xa872('0x2d')][_0xa872('0x2e')]};});_0x1a6be1[_0xa872('0x2f')]=_[_0xa872('0x30')](_0x336faf,_0xa872('0x2a'));_0x1a6be1[_0xa872('0x31')]=_[_0xa872('0x32')](_0x5a6df5['query']);_0x1a6be1[_0xa872('0x33')]=_[_0xa872('0x34')](_0x1a6be1[_0xa872('0x2f')],_0x1a6be1[_0xa872('0x31')]);_0x1aa335['attributes']=_['intersection'](_0x1a6be1[_0xa872('0x2f')],qs[_0xa872('0x35')](_0x5a6df5['query']['fields']));_0x1aa335[_0xa872('0x36')]=_0x1aa335[_0xa872('0x36')]['length']?_0x1aa335[_0xa872('0x36')]:_0x1a6be1[_0xa872('0x2f')];if(!_0x5a6df5['query']['hasOwnProperty']('nolimit')){_0x1aa335[_0xa872('0x20')]=qs[_0xa872('0x20')](_0x5a6df5[_0xa872('0x31')][_0xa872('0x20')]);_0x1aa335[_0xa872('0x1f')]=qs[_0xa872('0x1f')](_0x5a6df5[_0xa872('0x31')][_0xa872('0x1f')]);}_0x1aa335[_0xa872('0x37')]=qs['sort'](_0x5a6df5[_0xa872('0x31')][_0xa872('0x38')]);_0x1aa335['where']=qs[_0xa872('0x33')](_[_0xa872('0x39')](_0x5a6df5[_0xa872('0x31')],_0x1a6be1[_0xa872('0x33')]),_0x336faf);if(_0x5a6df5[_0xa872('0x31')]['filter']){_0x1aa335[_0xa872('0x3a')]=_[_0xa872('0x3b')](_0x1aa335[_0xa872('0x3a')],{'$or':_['map'](_0x336faf,function(_0x2d9cca){if(_0x2d9cca['type']!==_0xa872('0x3c')){var _0x3e25b8={};_0x3e25b8[_0x2d9cca['name']]={'$like':'%'+_0x5a6df5[_0xa872('0x31')]['filter']+'%'};return _0x3e25b8;}})});}_0x1aa335=_[_0xa872('0x3b')]({},_0x1aa335,_0x5a6df5[_0xa872('0x3d')]);var _0x104749={'where':_0x1aa335[_0xa872('0x3a')]};return db[_0xa872('0x2b')]['count'](_0x104749)[_0xa872('0x25')](function(_0x413fe1){_0x1bfcc4[_0xa872('0x1e')]=_0x413fe1;if(_0x5a6df5[_0xa872('0x31')][_0xa872('0x3e')]){_0x1aa335[_0xa872('0x3f')]=[{'all':!![]}];}return db['CmContactHasPhone'][_0xa872('0x40')](_0x1aa335);})[_0xa872('0x25')](function(_0x21eb82){_0x1bfcc4[_0xa872('0x41')]=_0x21eb82;return _0x1bfcc4;})[_0xa872('0x25')](respondWithFilteredResult(_0x49c65a,_0x1aa335))[_0xa872('0x42')](handleError(_0x49c65a,null));};exports[_0xa872('0x43')]=function(_0x3bf4bd,_0x433dd9){var _0xb323f1={'raw':!![],'where':{'id':_0x3bf4bd[_0xa872('0x44')]['id']}},_0x2e8952={};_0x2e8952[_0xa872('0x2f')]=_[_0xa872('0x32')](db[_0xa872('0x2b')]['rawAttributes']);_0x2e8952[_0xa872('0x31')]=_[_0xa872('0x32')](_0x3bf4bd[_0xa872('0x31')]);_0x2e8952[_0xa872('0x33')]=_[_0xa872('0x34')](_0x2e8952[_0xa872('0x2f')],_0x2e8952['query']);_0xb323f1['attributes']=_[_0xa872('0x34')](_0x2e8952[_0xa872('0x2f')],qs[_0xa872('0x35')](_0x3bf4bd[_0xa872('0x31')][_0xa872('0x35')]));_0xb323f1[_0xa872('0x36')]=_0xb323f1[_0xa872('0x36')][_0xa872('0x45')]?_0xb323f1[_0xa872('0x36')]:_0x2e8952[_0xa872('0x2f')];if(_0x3bf4bd['query'][_0xa872('0x3e')]){_0xb323f1[_0xa872('0x3f')]=[{'all':!![]}];}_0xb323f1=_[_0xa872('0x3b')]({},_0xb323f1,_0x3bf4bd[_0xa872('0x3d')]);return db[_0xa872('0x2b')]['find'](_0xb323f1)[_0xa872('0x25')](handleEntityNotFound(_0x433dd9,null))['then'](respondWithResult(_0x433dd9,null))['catch'](handleError(_0x433dd9,null));};exports[_0xa872('0x46')]=function(_0x10f06a,_0x5495bd){return db[_0xa872('0x2b')][_0xa872('0x46')](_0x10f06a[_0xa872('0x47')],{})[_0xa872('0x25')](function(_0x4aaf03){var _0x3d4a03=_0x10f06a[_0xa872('0x48')][_0xa872('0x27')]({'plain':!![]});if(!_0x3d4a03)throw new Error(_0xa872('0x49'));if(_0x3d4a03[_0xa872('0x4a')]==='user'){var _0x137b9b=_0x4aaf03[_0xa872('0x27')]({'plain':!![]});var _0x2eec10=_0xa872('0x4b');return db[_0xa872('0x4c')][_0xa872('0x4d')]({'where':{'name':_0x2eec10,'userProfileId':_0x3d4a03[_0xa872('0x4e')]},'raw':!![]})[_0xa872('0x25')](function(_0x25a68a){if(_0x25a68a&&_0x25a68a['autoAssociation']===0x0){return db[_0xa872('0x4f')]['create']({'name':_0x137b9b[_0xa872('0x2a')],'resourceId':_0x137b9b['id'],'type':_0x25a68a[_0xa872('0x2a')],'sectionId':_0x25a68a['id']},{})[_0xa872('0x25')](function(){return _0x4aaf03;});}else{return _0x4aaf03;}})[_0xa872('0x42')](function(_0x1b8171){logger['error'](_0xa872('0x50'),_0x1b8171);throw _0x1b8171;});}return _0x4aaf03;})['then'](respondWithResult(_0x5495bd,0xc9))[_0xa872('0x42')](handleError(_0x5495bd,null));};exports[_0xa872('0x24')]=function(_0x44712f,_0x3082fa){if(_0x44712f[_0xa872('0x47')]['id']){delete _0x44712f['body']['id'];}return db[_0xa872('0x2b')]['find']({'where':{'id':_0x44712f['params']['id']}})[_0xa872('0x25')](handleEntityNotFound(_0x3082fa,null))[_0xa872('0x25')](saveUpdates(_0x44712f[_0xa872('0x47')],null))[_0xa872('0x25')](respondWithResult(_0x3082fa,null))[_0xa872('0x42')](handleError(_0x3082fa,null));};exports['destroy']=function(_0x3596c0,_0xcf36bb){return db[_0xa872('0x2b')][_0xa872('0x4d')]({'where':{'id':_0x3596c0[_0xa872('0x44')]['id']}})['then'](handleEntityNotFound(_0xcf36bb,null))[_0xa872('0x25')](removeEntity(_0xcf36bb,null))[_0xa872('0x42')](handleError(_0xcf36bb,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 28d7638..88ef49f 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 _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 +var _0xb40e=['bluebird','path','rimraf','./cmContactHasPhone.attributes','exports','define','CmContactHasPhone','cm_contact_has_phones','lodash','../../config/logger'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb40e,0x120));var _0xeb40=function(_0xe30e17,_0xce02be){_0xe30e17=_0xe30e17-0x0;var _0x2342c9=_0xb40e[_0xe30e17];return _0x2342c9;};'use strict';var _=require(_0xeb40('0x0'));var util=require('util');var logger=require(_0xeb40('0x1'))('api');var moment=require('moment');var BPromise=require(_0xeb40('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb40('0x3'));var rimraf=require(_0xeb40('0x4'));var config=require('../../config/environment');var attributes=require(_0xeb40('0x5'));module[_0xeb40('0x6')]=function(_0x2eae5a,_0x495277){return _0x2eae5a[_0xeb40('0x7')](_0xeb40('0x8'),attributes,{'tableName':_0xeb40('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 ab3605b..cda5388 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 _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 +var _0xab9a=['error','CmContactHasPhone,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','then','info','CmContactHasPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code'];(function(_0x283ac0,_0x3734cc){var _0x181dd3=function(_0x1c9dbb){while(--_0x1c9dbb){_0x283ac0['push'](_0x283ac0['shift']());}};_0x181dd3(++_0x3734cc);}(_0xab9a,0x1b9));var _0xaab9=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xab9a[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0xaab9('0x0'));var util=require(_0xaab9('0x1'));var moment=require(_0xaab9('0x2'));var BPromise=require(_0xaab9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaab9('0x4'));var db=require(_0xaab9('0x5'))['db'];var utils=require(_0xaab9('0x6'));var logger=require(_0xaab9('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xaab9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3bad6d,_0x226750,_0x46eb4f){return new BPromise(function(_0x568f89,_0x3e8b63){return client['request'](_0x3bad6d,_0x46eb4f)[_0xaab9('0x9')](function(_0x199f61){logger[_0xaab9('0xa')]('CmContactHasPhone,\x20%s,\x20%s',_0x226750,'request\x20sent');logger['debug'](_0xaab9('0xb'),_0x226750,_0xaab9('0xc'),JSON[_0xaab9('0xd')](_0x199f61));if(_0x199f61['error']){if(_0x199f61['error'][_0xaab9('0xe')]===0x1f4){logger[_0xaab9('0xf')](_0xaab9('0x10'),_0x226750,_0x199f61[_0xaab9('0xf')][_0xaab9('0x11')]);return _0x3e8b63(_0x199f61[_0xaab9('0xf')][_0xaab9('0x11')]);}logger[_0xaab9('0xf')](_0xaab9('0x10'),_0x226750,_0x199f61[_0xaab9('0xf')][_0xaab9('0x11')]);return _0x568f89(_0x199f61[_0xaab9('0xf')]['message']);}else{logger[_0xaab9('0xa')](_0xaab9('0x10'),_0x226750,'request\x20sent');_0x568f89(_0x199f61[_0xaab9('0x12')][_0xaab9('0x11')]);}})['catch'](function(_0x458c5e){logger[_0xaab9('0xf')](_0xaab9('0x10'),_0x226750,_0x458c5e);_0x3e8b63(_0x458c5e);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 19f6837..4e9f267 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 _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 +var _0xe193=['create','put','/:id','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','post'];(function(_0x102243,_0x2b4dde){var _0x1d302c=function(_0x50c1fb){while(--_0x50c1fb){_0x102243['push'](_0x102243['shift']());}};_0x1d302c(++_0x2b4dde);}(_0xe193,0xe7));var _0x3e19=function(_0x1c1afa,_0x13c9ed){_0x1c1afa=_0x1c1afa-0x0;var _0x5062e6=_0xe193[_0x1c1afa];return _0x5062e6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3e19('0x0'));var timeout=require(_0x3e19('0x1'));var express=require('express');var router=express[_0x3e19('0x2')]();var auth=require(_0x3e19('0x3'));var interaction=require(_0x3e19('0x4'));var config=require(_0x3e19('0x5'));var controller=require('./cmContactHasPhone.controller');router[_0x3e19('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3e19('0x6')]('/:id',auth[_0x3e19('0x7')](),controller['show']);router[_0x3e19('0x8')]('/',auth[_0x3e19('0x7')](),controller[_0x3e19('0x9')]);router[_0x3e19('0xa')](_0x3e19('0xb'),auth[_0x3e19('0x7')](),controller['update']);router['delete'](_0x3e19('0xb'),auth[_0x3e19('0x7')](),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 c5e9c9d..2a4b23b 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 _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 +var _0x3d6d=['TEXT','long','type','parse','values','isArray','stringify','BOOLEAN','ENUM','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue'];(function(_0x2945da,_0x23d4f5){var _0x23cbbc=function(_0x4c720b){while(--_0x4c720b){_0x2945da['push'](_0x2945da['shift']());}};_0x23cbbc(++_0x23d4f5);}(_0x3d6d,0xb3));var _0xd3d6=function(_0x33ca22,_0xbcc94){_0x33ca22=_0x33ca22-0x0;var _0x1790c3=_0x3d6d[_0x33ca22];return _0x1790c3;};'use strict';var Sequelize=require(_0xd3d6('0x0'));var _=require(_0xd3d6('0x1'));module[_0xd3d6('0x2')]={'name':{'type':Sequelize[_0xd3d6('0x3')],'get':function(_0x380c09){return this[_0xd3d6('0x4')](_0xd3d6('0x5'));}},'alias':{'type':Sequelize[_0xd3d6('0x6')],'allowNull':![],'set':function(_0x297bd6){this[_0xd3d6('0x7')](_0xd3d6('0x5'),_0x297bd6?_0x297bd6:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0xd3d6('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xd3d6('0x8')](_0xd3d6('0x9')),'get':function(){if(this[_0xd3d6('0x4')](_0xd3d6('0xa'))==='select'){return JSON[_0xd3d6('0xb')](this[_0xd3d6('0x4')](_0xd3d6('0xc')));}else{return this[_0xd3d6('0x4')]('values');}},'set':function(_0x4cfd1b){if(Array[_0xd3d6('0xd')](_0x4cfd1b)){this[_0xd3d6('0x7')](_0xd3d6('0xc'),JSON[_0xd3d6('0xe')](_0x4cfd1b));}else{this[_0xd3d6('0x7')](_0xd3d6('0xc'),_0x4cfd1b);}}},'required':{'type':Sequelize[_0xd3d6('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xd3d6('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xd3d6('0x10')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index c35f1bc..928050a 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 _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 +var _0xb692=['show','params','keys','rawAttributes','includeAll','body','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','format','cf_%d','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','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','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','save','destroy','then','sendStatus','error','stack','name','send','map','fieldName','key','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','CmCustomField','count','include','findAll','rows','catch'];(function(_0x594000,_0x5e6177){var _0x51d971=function(_0x499df9){while(--_0x499df9){_0x594000['push'](_0x594000['shift']());}};_0x51d971(++_0x5e6177);}(_0xb692,0x163));var _0x2b69=function(_0x1111b6,_0x406ede){_0x1111b6=_0x1111b6-0x0;var _0x2b4945=_0xb692[_0x1111b6];return _0x2b4945;};'use strict';var pdf=require(_0x2b69('0x0'));var emlformat=require(_0x2b69('0x1'));var rimraf=require(_0x2b69('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b69('0x3'));var rp=require(_0x2b69('0x4'));var moment=require('moment');var BPromise=require(_0x2b69('0x5'));var Mustache=require(_0x2b69('0x6'));var util=require('util');var path=require(_0x2b69('0x7'));var sox=require('sox');var csv=require(_0x2b69('0x8'));var ejs=require(_0x2b69('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2b69('0xa'));var jsforce=require(_0x2b69('0xb'));var deskjs=require(_0x2b69('0xc'));var toCsv=require(_0x2b69('0x8'));var querystring=require(_0x2b69('0xd'));var Papa=require(_0x2b69('0xe'));var Redis=require(_0x2b69('0xf'));var authService=require(_0x2b69('0x10'));var qs=require(_0x2b69('0x11'));var as=require(_0x2b69('0x12'));var hardwareService=require(_0x2b69('0x13'));var logger=require(_0x2b69('0x14'))('api');var utils=require(_0x2b69('0x15'));var config=require(_0x2b69('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2b69('0x17'))['db'];function respondWithStatusCode(_0x140ef6,_0x3e09d8){_0x3e09d8=_0x3e09d8||0xcc;return function(_0x473f94){if(_0x473f94){return _0x140ef6['sendStatus'](_0x3e09d8);}return _0x140ef6[_0x2b69('0x18')](_0x3e09d8)[_0x2b69('0x19')]();};}function respondWithResult(_0x5b1822,_0x42c4c0){_0x42c4c0=_0x42c4c0||0xc8;return function(_0x17dc7c){if(_0x17dc7c){return _0x5b1822[_0x2b69('0x18')](_0x42c4c0)[_0x2b69('0x1a')](_0x17dc7c);}};}function respondWithFilteredResult(_0x4a44b5,_0x3f41a5){return function(_0x2f2321){if(_0x2f2321){var _0x4b89f7=_0x2f2321['count'],_0x31805d=_0x3f41a5['offset'],_0x4ee3ef=_0x3f41a5[_0x2b69('0x1b')]+_0x3f41a5[_0x2b69('0x1c')],_0xfa7fd9;if(_0x4ee3ef>=_0x4b89f7){_0x4ee3ef=_0x4b89f7;_0xfa7fd9=0xc8;}else{_0xfa7fd9=0xce;}_0x4a44b5[_0x2b69('0x18')](_0xfa7fd9);return _0x4a44b5[_0x2b69('0x1d')](_0x2b69('0x1e'),_0x31805d+'-'+_0x4ee3ef+'/'+_0x4b89f7)[_0x2b69('0x1a')](_0x2f2321);}return null;};}function patchUpdates(_0x2551a1){return function(_0xf2c172){try{jsonpatch['apply'](_0xf2c172,_0x2551a1,!![]);}catch(_0x1b3049){return BPromise['reject'](_0x1b3049);}return _0xf2c172[_0x2b69('0x1f')]();};}function saveUpdates(_0x159573,_0x25c0c3){return function(_0x99d8f4){if(_0x99d8f4){return _0x99d8f4['update'](_0x159573)['then'](function(_0x36dec3){return _0x36dec3;});}return null;};}function removeEntity(_0x1d9c18,_0x33e7e5){return function(_0x48b872){if(_0x48b872){return _0x48b872[_0x2b69('0x20')]()[_0x2b69('0x21')](function(){_0x1d9c18['status'](0xcc)[_0x2b69('0x19')]();});}};}function handleEntityNotFound(_0x50a685,_0x5943aa){return function(_0x100fa1){if(!_0x100fa1){_0x50a685[_0x2b69('0x22')](0x194);}return _0x100fa1;};}function handleError(_0x108e6c,_0xff787b){_0xff787b=_0xff787b||0x1f4;return function(_0x4f6985){logger[_0x2b69('0x23')](_0x4f6985[_0x2b69('0x24')]);if(_0x4f6985['name']){delete _0x4f6985[_0x2b69('0x25')];}_0x108e6c[_0x2b69('0x18')](_0xff787b)[_0x2b69('0x26')](_0x4f6985);};}exports['index']=function(_0xa42063,_0x2f6a87){var _0x4e0455={},_0x35779c={},_0x37b3a7={'count':0x0,'rows':[]};var _0x103808=_[_0x2b69('0x27')](db['CmCustomField']['rawAttributes'],function(_0x209dea){return{'name':_0x209dea[_0x2b69('0x28')],'type':_0x209dea['type'][_0x2b69('0x29')]};});_0x35779c[_0x2b69('0x2a')]=_[_0x2b69('0x2b')](_[_0x2b69('0x27')](_0x103808,_0x2b69('0x25')),[_0x2b69('0x25')]);_0x35779c[_0x2b69('0x2c')]=_['keys'](_0xa42063['query']);_0x35779c[_0x2b69('0x2d')]=_[_0x2b69('0x2e')](_0x35779c[_0x2b69('0x2a')],_0x35779c[_0x2b69('0x2c')]);_0x4e0455[_0x2b69('0x2f')]=_[_0x2b69('0x2e')](_0x35779c[_0x2b69('0x2a')],qs[_0x2b69('0x30')](_0xa42063[_0x2b69('0x2c')][_0x2b69('0x30')]));_0x4e0455['attributes']=_0x4e0455[_0x2b69('0x2f')][_0x2b69('0x31')]?_0x4e0455[_0x2b69('0x2f')]:_0x35779c[_0x2b69('0x2a')];if(!_0xa42063['query'][_0x2b69('0x32')](_0x2b69('0x33'))){_0x4e0455[_0x2b69('0x1c')]=qs[_0x2b69('0x1c')](_0xa42063['query'][_0x2b69('0x1c')]);_0x4e0455[_0x2b69('0x1b')]=qs[_0x2b69('0x1b')](_0xa42063[_0x2b69('0x2c')]['offset']);}_0x4e0455['order']=qs['sort'](_0xa42063[_0x2b69('0x2c')][_0x2b69('0x34')]);_0x4e0455[_0x2b69('0x35')]=qs['filters'](_['pick'](_0xa42063[_0x2b69('0x2c')],_0x35779c[_0x2b69('0x2d')]),_0x103808);if(_0xa42063['query'][_0x2b69('0x36')]){_0x4e0455[_0x2b69('0x35')]=_[_0x2b69('0x37')](_0x4e0455[_0x2b69('0x35')],{'$or':_[_0x2b69('0x27')](_0x103808,function(_0x2f8310){if(_0x2f8310[_0x2b69('0x38')]!==_0x2b69('0x39')){var _0x1e9f9c={};_0x1e9f9c[_0x2f8310[_0x2b69('0x25')]]={'$like':'%'+_0xa42063[_0x2b69('0x2c')][_0x2b69('0x36')]+'%'};return _0x1e9f9c;}})});}_0x4e0455=_[_0x2b69('0x37')]({},_0x4e0455,_0xa42063[_0x2b69('0x3a')]);var _0x56882f={'where':_0x4e0455[_0x2b69('0x35')]};return db[_0x2b69('0x3b')]['count'](_0x56882f)[_0x2b69('0x21')](function(_0xdbf6b7){_0x37b3a7[_0x2b69('0x3c')]=_0xdbf6b7;if(_0xa42063[_0x2b69('0x2c')]['includeAll']){_0x4e0455[_0x2b69('0x3d')]=[{'all':!![]}];}return db[_0x2b69('0x3b')][_0x2b69('0x3e')](_0x4e0455);})[_0x2b69('0x21')](function(_0x1f1316){_0x37b3a7[_0x2b69('0x3f')]=_0x1f1316;return _0x37b3a7;})[_0x2b69('0x21')](respondWithFilteredResult(_0x2f6a87,_0x4e0455))[_0x2b69('0x40')](handleError(_0x2f6a87,null));};exports[_0x2b69('0x41')]=function(_0x37555b,_0xa19f73){var _0x4499b1={'raw':!![],'where':{'id':_0x37555b[_0x2b69('0x42')]['id']}},_0x5d7ba7={};_0x5d7ba7['model']=_[_0x2b69('0x43')](db[_0x2b69('0x3b')][_0x2b69('0x44')]);_0x5d7ba7[_0x2b69('0x2c')]=_[_0x2b69('0x43')](_0x37555b[_0x2b69('0x2c')]);_0x5d7ba7[_0x2b69('0x2d')]=_[_0x2b69('0x2e')](_0x5d7ba7[_0x2b69('0x2a')],_0x5d7ba7[_0x2b69('0x2c')]);_0x4499b1[_0x2b69('0x2f')]=_[_0x2b69('0x2e')](_0x5d7ba7[_0x2b69('0x2a')],qs[_0x2b69('0x30')](_0x37555b[_0x2b69('0x2c')][_0x2b69('0x30')]));_0x4499b1[_0x2b69('0x2f')]=_0x4499b1[_0x2b69('0x2f')][_0x2b69('0x31')]?_0x4499b1['attributes']:_0x5d7ba7['model'];if(_0x37555b['query'][_0x2b69('0x45')]){_0x4499b1[_0x2b69('0x3d')]=[{'all':!![]}];}_0x4499b1=_[_0x2b69('0x37')]({},_0x4499b1,_0x37555b[_0x2b69('0x3a')]);return db[_0x2b69('0x3b')]['find'](_0x4499b1)[_0x2b69('0x21')](handleEntityNotFound(_0xa19f73,null))[_0x2b69('0x21')](respondWithResult(_0xa19f73,null))[_0x2b69('0x40')](handleError(_0xa19f73,null));};exports['update']=function(_0x30e8ad,_0x2ae6ee){if(_0x30e8ad['body']['id']){delete _0x30e8ad[_0x2b69('0x46')]['id'];}return db[_0x2b69('0x3b')]['find']({'where':{'id':_0x30e8ad[_0x2b69('0x42')]['id']}})[_0x2b69('0x21')](handleEntityNotFound(_0x2ae6ee,null))[_0x2b69('0x21')](saveUpdates(_0x30e8ad['body'],null))[_0x2b69('0x21')](respondWithResult(_0x2ae6ee,null))[_0x2b69('0x40')](handleError(_0x2ae6ee,null));};exports[_0x2b69('0x20')]=function(_0x8116fd,_0x493f78){return db[_0x2b69('0x3b')]['find']({'where':{'id':_0x8116fd[_0x2b69('0x42')]['id']}})[_0x2b69('0x21')](handleEntityNotFound(_0x493f78,null))[_0x2b69('0x21')](removeEntity(_0x493f78,null))['catch'](handleError(_0x493f78,null));};exports[_0x2b69('0x47')]=function(_0x28c55b,_0x277e20){var _0x419046;return db[_0x2b69('0x48')][_0x2b69('0x49')](function(_0x67fda0){return db['CmCustomField']['create'](_0x28c55b[_0x2b69('0x46')],{'transaction':_0x67fda0})[_0x2b69('0x21')](function(_0x399559){_0x419046=_0x399559;var _0x172b3c={'type':db[_0x2b69('0x4a')][_0x2b69('0x4b')],'transaction':_0x67fda0};switch(_0x28c55b[_0x2b69('0x46')][_0x2b69('0x38')]){case'text':_0x172b3c[_0x2b69('0x38')]=db['Sequelize']['TEXT'];break;case _0x2b69('0x4c'):_0x172b3c['type']=db['Sequelize'][_0x2b69('0x4d')];break;case _0x2b69('0x4e'):_0x172b3c[_0x2b69('0x38')]=db['Sequelize'][_0x2b69('0x4f')];_0x172b3c[_0x2b69('0x50')]=![];break;default:}return db[_0x2b69('0x48')][_0x2b69('0x51')]['addColumn']('cm_contacts',util[_0x2b69('0x52')](_0x2b69('0x53'),_0x419046['id']),_0x172b3c);})[_0x2b69('0x21')](function(){return _0x419046;});})[_0x2b69('0x21')](respondWithResult(_0x277e20,0xc9))[_0x2b69('0x40')](handleError(_0x277e20,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 3f6f0a1..03be2ad 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 _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 +var _0x622d=['rimraf','./cmCustomField.attributes','define','CmCustomField','lodash','util','api','bluebird','request-promise','path'];(function(_0x2ecc65,_0xd75c48){var _0x103cc3=function(_0x3f856b){while(--_0x3f856b){_0x2ecc65['push'](_0x2ecc65['shift']());}};_0x103cc3(++_0xd75c48);}(_0x622d,0x1c6));var _0xd622=function(_0xff6648,_0x40608e){_0xff6648=_0xff6648-0x0;var _0x2b6b96=_0x622d[_0xff6648];return _0x2b6b96;};'use strict';var _=require(_0xd622('0x0'));var util=require(_0xd622('0x1'));var logger=require('../../config/logger')(_0xd622('0x2'));var moment=require('moment');var BPromise=require(_0xd622('0x3'));var rp=require(_0xd622('0x4'));var fs=require('fs');var path=require(_0xd622('0x5'));var rimraf=require(_0xd622('0x6'));var config=require('../../config/environment');var attributes=require(_0xd622('0x7'));module['exports']=function(_0x51d808,_0x2bf02a){return _0x51d808[_0xd622('0x8')](_0xd622('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 4dff1d7..c87fbdd 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 _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 +var _0xc874=['bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment'];(function(_0x7e6001,_0x35de22){var _0x5eded1=function(_0xf806b3){while(--_0xf806b3){_0x7e6001['push'](_0x7e6001['shift']());}};_0x5eded1(++_0x35de22);}(_0xc874,0x154));var _0x4c87=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xc874[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0x4c87('0x0'));var util=require('util');var moment=require(_0x4c87('0x1'));var BPromise=require(_0x4c87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c87('0x3'))['db'];var utils=require(_0x4c87('0x4'));var logger=require(_0x4c87('0x5'))('rpc');var config=require(_0x4c87('0x6'));var jayson=require(_0x4c87('0x7'));var client=jayson['client'][_0x4c87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dafe0,_0x30c939,_0xdc4a29){return new BPromise(function(_0x116649,_0x5b7720){return client[_0x4c87('0x9')](_0x3dafe0,_0xdc4a29)['then'](function(_0x384268){logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,_0x4c87('0xc'));logger[_0x4c87('0xd')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x30c939,_0x4c87('0xc'),JSON[_0x4c87('0xe')](_0x384268));if(_0x384268['error']){if(_0x384268[_0x4c87('0xf')][_0x4c87('0x10')]===0x1f4){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')]['message']);return _0x5b7720(_0x384268['error']['message']);}logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);return _0x116649(_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);}else{logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,'request\x20sent');_0x116649(_0x384268[_0x4c87('0x12')][_0x4c87('0x11')]);}})['catch'](function(_0x575de5){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x575de5);_0x5b7720(_0x575de5);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 637e8d5..e9ce63a 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 _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 +var _0x35d5=['post','put','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x458363,_0x1675db){var _0x4d0290=function(_0x22960f){while(--_0x22960f){_0x458363['push'](_0x458363['shift']());}};_0x4d0290(++_0x1675db);}(_0x35d5,0x1b5));var _0x535d=function(_0x250642,_0x266aa7){_0x250642=_0x250642-0x0;var _0x3b43cd=_0x35d5[_0x250642];return _0x3b43cd;};'use strict';var multer=require('multer');var util=require(_0x535d('0x0'));var path=require(_0x535d('0x1'));var timeout=require(_0x535d('0x2'));var express=require('express');var router=express[_0x535d('0x3')]();var auth=require(_0x535d('0x4'));var interaction=require(_0x535d('0x5'));var config=require(_0x535d('0x6'));var controller=require(_0x535d('0x7'));router[_0x535d('0x8')]('/',auth[_0x535d('0x9')](),controller[_0x535d('0xa')]);router[_0x535d('0x8')](_0x535d('0xb'),auth[_0x535d('0x9')](),controller[_0x535d('0xc')]);router[_0x535d('0xd')]('/',auth[_0x535d('0x9')](),controller['create']);router[_0x535d('0xe')]('/:id',auth[_0x535d('0x9')](),controller['update']);router[_0x535d('0xf')](_0x535d('0xb'),auth['isAuthenticated'](),controller[_0x535d('0x10')]);module[_0x535d('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 5023265..23f24fd 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 _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 +var _0x98a8=['format','INTEGER','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x98a8,0x12c));var _0x898a=function(_0x216c41,_0xccfd30){_0x216c41=_0x216c41-0x0;var _0x590ecb=_0x98a8[_0x216c41];return _0x590ecb;};'use strict';var moment=require(_0x898a('0x0'));var Sequelize=require(_0x898a('0x1'));module[_0x898a('0x2')]={'phone':{'type':Sequelize[_0x898a('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x898a('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x898a('0x5')],'defaultValue':moment()[_0x898a('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x898a('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x898a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x898a('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x898a('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x898a('0x8')},'ListId':{'type':Sequelize[_0x898a('0x7')],'unique':_0x898a('0x8')},'UserId':{'type':Sequelize[_0x898a('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x898a('0x7')],'unique':_0x898a('0x8')},'CampaignId':{'type':Sequelize[_0x898a('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 2ab718f..90bd126 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 _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 +var _0x132f=['model','query','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$eq','$not','$notBetween','$in','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','attributes','length','sort','where','filter','VIRTUAL','options','includeAll','include','rows','catch','params','keys','intersection','fields','merge','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','createdAt','updatedAt','statedesc','deleted','membername','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','finally','CmHopperFinal','getVoiceQueues','dialOrderByScheduledAt','sequelize','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','literal','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','update','getOpenContacts','outbound','preview','isNumber','entity\x20not\x20found','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','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','Content-Range','apply','reject','save','destroy','then','error','name','index','map','CmHopper','rawAttributes','fieldName','type'];(function(_0x16b906,_0x12b7d4){var _0x300a0b=function(_0x38f3db){while(--_0x38f3db){_0x16b906['push'](_0x16b906['shift']());}};_0x300a0b(++_0x12b7d4);}(_0x132f,0x182));var _0xf132=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x132f[_0xa1e3e3];return _0xc980e9;};'use strict';var pdf=require(_0xf132('0x0'));var emlformat=require(_0xf132('0x1'));var rimraf=require(_0xf132('0x2'));var zipdir=require(_0xf132('0x3'));var jsonpatch=require(_0xf132('0x4'));var rp=require(_0xf132('0x5'));var moment=require('moment');var BPromise=require(_0xf132('0x6'));var Mustache=require(_0xf132('0x7'));var util=require(_0xf132('0x8'));var path=require(_0xf132('0x9'));var sox=require(_0xf132('0xa'));var csv=require('to-csv');var ejs=require(_0xf132('0xb'));var fs=require('fs');var _=require(_0xf132('0xc'));var squel=require('squel');var crypto=require(_0xf132('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf132('0xe'));var toCsv=require(_0xf132('0xf'));var querystring=require(_0xf132('0x10'));var Papa=require(_0xf132('0x11'));var Redis=require(_0xf132('0x12'));var authService=require(_0xf132('0x13'));var qs=require(_0xf132('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf132('0x15'))(_0xf132('0x16'));var utils=require(_0xf132('0x17'));var config=require(_0xf132('0x18'));var licenseUtil=require(_0xf132('0x19'));var db=require(_0xf132('0x1a'))['db'];function respondWithStatusCode(_0x37d148,_0x1c79e0){_0x1c79e0=_0x1c79e0||0xcc;return function(_0x3f0f56){if(_0x3f0f56){return _0x37d148[_0xf132('0x1b')](_0x1c79e0);}return _0x37d148[_0xf132('0x1c')](_0x1c79e0)[_0xf132('0x1d')]();};}function respondWithResult(_0x5b58f8,_0x79d371){_0x79d371=_0x79d371||0xc8;return function(_0x259b76){if(_0x259b76){return _0x5b58f8['status'](_0x79d371)[_0xf132('0x1e')](_0x259b76);}};}function respondWithFilteredResult(_0x4edb9c,_0x50ed67){return function(_0x206e0c){if(_0x206e0c){var _0x24c138=_0x206e0c[_0xf132('0x1f')],_0x438d8a=_0x50ed67[_0xf132('0x20')],_0x559a72=_0x50ed67[_0xf132('0x20')]+_0x50ed67[_0xf132('0x21')],_0x48686e;if(_0x559a72>=_0x24c138){_0x559a72=_0x24c138;_0x48686e=0xc8;}else{_0x48686e=0xce;}_0x4edb9c['status'](_0x48686e);return _0x4edb9c[_0xf132('0x22')](_0xf132('0x23'),_0x438d8a+'-'+_0x559a72+'/'+_0x24c138)[_0xf132('0x1e')](_0x206e0c);}return null;};}function patchUpdates(_0x16a03a){return function(_0x4b4f5d){try{jsonpatch[_0xf132('0x24')](_0x4b4f5d,_0x16a03a,!![]);}catch(_0x5de917){return BPromise[_0xf132('0x25')](_0x5de917);}return _0x4b4f5d[_0xf132('0x26')]();};}function saveUpdates(_0x53b78a,_0x129820){return function(_0x4de164){if(_0x4de164){return _0x4de164['update'](_0x53b78a)['then'](function(_0x4df1e8){return _0x4df1e8;});}return null;};}function removeEntity(_0xbb67a7,_0x202dca){return function(_0x2fb27d){if(_0x2fb27d){return _0x2fb27d[_0xf132('0x27')]()[_0xf132('0x28')](function(){_0xbb67a7[_0xf132('0x1c')](0xcc)[_0xf132('0x1d')]();});}};}function handleEntityNotFound(_0x5c9958,_0x3db8a0){return function(_0x191742){if(!_0x191742){_0x5c9958[_0xf132('0x1b')](0x194);}return _0x191742;};}function handleError(_0x46d563,_0x3c7014){_0x3c7014=_0x3c7014||0x1f4;return function(_0x271471){logger[_0xf132('0x29')](_0x271471['stack']);if(_0x271471[_0xf132('0x2a')]){delete _0x271471[_0xf132('0x2a')];}_0x46d563['status'](_0x3c7014)['send'](_0x271471);};}exports[_0xf132('0x2b')]=function(_0x1941d5,_0x3933bc){var _0x11aba6={},_0x2c589f={},_0x25eed0={'count':0x0,'rows':[]};var _0x1a19b5=_[_0xf132('0x2c')](db[_0xf132('0x2d')][_0xf132('0x2e')],function(_0x43a510){return{'name':_0x43a510[_0xf132('0x2f')],'type':_0x43a510[_0xf132('0x30')]['key']};});_0x2c589f[_0xf132('0x31')]=_['map'](_0x1a19b5,'name');_0x2c589f[_0xf132('0x32')]=_['keys'](_0x1941d5['query']);_0x2c589f[_0xf132('0x33')]=_['intersection'](_0x2c589f[_0xf132('0x31')],_0x2c589f[_0xf132('0x32')]);_0x2c589f[_0xf132('0x33')]=_[_0xf132('0x34')](_0x2c589f[_0xf132('0x33')],[_0xf132('0x35'),_0xf132('0x36'),_0xf132('0x37'),_0xf132('0x38'),_0xf132('0x39'),_0xf132('0x3a'),'$ne',_0xf132('0x3b'),_0xf132('0x3c'),'$between',_0xf132('0x3d'),_0xf132('0x3e'),'$notIn','$like',_0xf132('0x3f'),_0xf132('0x40'),_0xf132('0x41'),_0xf132('0x42'),_0xf132('0x43'),_0xf132('0x44'),_0xf132('0x45'),'$any']);_0x11aba6['attributes']=_['intersection'](_0x2c589f['model'],qs['fields'](_0x1941d5[_0xf132('0x32')]['fields']));_0x11aba6[_0xf132('0x46')]=_0x11aba6[_0xf132('0x46')][_0xf132('0x47')]?_0x11aba6[_0xf132('0x46')]:_0x2c589f[_0xf132('0x31')];if(!_0x1941d5[_0xf132('0x32')]['hasOwnProperty']('nolimit')){_0x11aba6['limit']=qs[_0xf132('0x21')](_0x1941d5['query'][_0xf132('0x21')]);_0x11aba6['offset']=qs['offset'](_0x1941d5[_0xf132('0x32')][_0xf132('0x20')]);}_0x11aba6['order']=qs[_0xf132('0x48')](_0x1941d5[_0xf132('0x32')][_0xf132('0x48')]);_0x11aba6[_0xf132('0x49')]=qs['filters'](_['pick'](_0x1941d5['query'],_0x2c589f[_0xf132('0x33')]),_0x1a19b5);if(_0x1941d5[_0xf132('0x32')][_0xf132('0x4a')]){_0x11aba6[_0xf132('0x49')]=_['merge'](_0x11aba6['where'],{'$or':_['map'](_0x1a19b5,function(_0x317c4c){if(_0x317c4c[_0xf132('0x30')]!==_0xf132('0x4b')){var _0x552c7e={};_0x552c7e[_0x317c4c[_0xf132('0x2a')]]={'$like':'%'+_0x1941d5[_0xf132('0x32')][_0xf132('0x4a')]+'%'};return _0x552c7e;}})});}_0x11aba6=_['merge']({},_0x11aba6,_0x1941d5[_0xf132('0x4c')]);var _0x4585fa={'where':_0x11aba6[_0xf132('0x49')]};return db['CmHopper'][_0xf132('0x1f')](_0x4585fa)['then'](function(_0x2d568f){_0x25eed0[_0xf132('0x1f')]=_0x2d568f;if(_0x1941d5[_0xf132('0x32')][_0xf132('0x4d')]){_0x11aba6[_0xf132('0x4e')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x11aba6);})[_0xf132('0x28')](function(_0x4b06d4){_0x25eed0[_0xf132('0x4f')]=_0x4b06d4;return _0x25eed0;})['then'](respondWithFilteredResult(_0x3933bc,_0x11aba6))[_0xf132('0x50')](handleError(_0x3933bc,null));};exports['show']=function(_0x1d77f6,_0x569509){var _0x4cde93={'raw':!![],'where':{'id':_0x1d77f6[_0xf132('0x51')]['id']}},_0x30a601={};_0x30a601[_0xf132('0x31')]=_[_0xf132('0x52')](db['CmHopper']['rawAttributes']);_0x30a601[_0xf132('0x32')]=_[_0xf132('0x52')](_0x1d77f6[_0xf132('0x32')]);_0x30a601[_0xf132('0x33')]=_[_0xf132('0x53')](_0x30a601[_0xf132('0x31')],_0x30a601[_0xf132('0x32')]);_0x4cde93[_0xf132('0x46')]=_[_0xf132('0x53')](_0x30a601['model'],qs[_0xf132('0x54')](_0x1d77f6[_0xf132('0x32')][_0xf132('0x54')]));_0x4cde93[_0xf132('0x46')]=_0x4cde93[_0xf132('0x46')]['length']?_0x4cde93[_0xf132('0x46')]:_0x30a601[_0xf132('0x31')];if(_0x1d77f6[_0xf132('0x32')][_0xf132('0x4d')]){_0x4cde93['include']=[{'all':!![]}];}_0x4cde93=_[_0xf132('0x55')]({},_0x4cde93,_0x1d77f6[_0xf132('0x4c')]);return db[_0xf132('0x2d')][_0xf132('0x56')](_0x4cde93)['then'](handleEntityNotFound(_0x569509,null))[_0xf132('0x28')](respondWithResult(_0x569509,null))[_0xf132('0x50')](handleError(_0x569509,null));};exports['create']=function(_0x143c44,_0x162086){return db[_0xf132('0x2d')][_0xf132('0x57')](_0x143c44[_0xf132('0x58')],{})[_0xf132('0x28')](respondWithResult(_0x162086,0xc9))['catch'](handleError(_0x162086,null));};exports['update']=function(_0x134a71,_0x5245f1){if(_0x134a71[_0xf132('0x58')]['id']){delete _0x134a71['body']['id'];}return db[_0xf132('0x2d')][_0xf132('0x56')]({'where':{'id':_0x134a71[_0xf132('0x51')]['id']}})[_0xf132('0x28')](handleEntityNotFound(_0x5245f1,null))[_0xf132('0x28')](saveUpdates(_0x134a71[_0xf132('0x58')],null))[_0xf132('0x28')](respondWithResult(_0x5245f1,null))[_0xf132('0x50')](handleError(_0x5245f1,null));};exports[_0xf132('0x59')]=function(_0x21e9e1,_0x303d95){return db['CmHopper']['describe']()[_0xf132('0x28')](respondWithResult(_0x303d95,null))[_0xf132('0x50')](handleError(_0x303d95,null));};exports[_0xf132('0x27')]=function(_0x4b5aa7,_0x54f015){var _0x5c7ca9;return db[_0xf132('0x2d')][_0xf132('0x56')]({'where':{'id':_0x4b5aa7[_0xf132('0x51')]['id']}})['then'](handleEntityNotFound(_0x54f015,null))[_0xf132('0x28')](function(_0x3e4d27){if(_0x3e4d27){return _0x3e4d27['destroy']()[_0xf132('0x28')](function(_0x576edb){return _0x576edb;});}})[_0xf132('0x28')](function(_0x3c09a4){_0x5c7ca9=_0x3c09a4;if(_0x3c09a4){if(_0x3c09a4[_0xf132('0x5a')]||_0x3c09a4[_0xf132('0x5b')]){return db[_0x3c09a4['VoiceQueueId']?_0xf132('0x5c'):'Campaign']['find']({'where':{'id':_0x3c09a4[_0xf132('0x5a')]?_0x3c09a4['VoiceQueueId']:_0x3c09a4[_0xf132('0x5b')]},'attributes':['id',_0xf132('0x2a')],'raw':!![]});}}})['then'](function(_0x46d2b2){var _0x2f6001={};if(_0x46d2b2){_[_0xf132('0x55')](_0x2f6001,_[_0xf132('0x5d')](_0x5c7ca9[_0xf132('0x5e')],[_0xf132('0x5f'),_0xf132('0x60'),'id']));_0x2f6001['state']=0x15;_0x2f6001[_0xf132('0x61')]=_0xf132('0x62');_0x2f6001['campaign']=_0x46d2b2[_0xf132('0x2a')];_0x2f6001[_0xf132('0x63')]=_0x4b5aa7['user'][_0xf132('0x2a')];_0x2f6001[_0xf132('0x64')]=_0x4b5aa7[_0xf132('0x65')]['id'];_0x2f6001[_0xf132('0x62')]=!![];_0x2f6001[_0xf132('0x66')]=moment()[_0xf132('0x67')](_0xf132('0x68'));_0x2f6001[_0xf132('0x69')]=_0x5c7ca9[_0xf132('0x6a')];_0x2f6001[_0xf132('0x6b')]=_0x5c7ca9[_0xf132('0x5a')]?'queue':_0xf132('0x6c');return db[_0xf132('0x6d')][_0xf132('0x56')]({'where':{'id':_0x2f6001[_0xf132('0x6e')]},'attributes':[_0xf132('0x6f'),_0xf132('0x70')]})[_0xf132('0x28')](function(_0x4b6299){if(!_[_0xf132('0x71')](_0x54f015)&&!_[_0xf132('0x71')](_0x4b6299[_0xf132('0x6f')])){_0x2f6001['calleridname']=_0x4b6299['firstName'];if(!_[_0xf132('0x71')](_0x4b6299['lastName'])){_0x2f6001['calleridname']+='\x20'+_0x4b6299[_0xf132('0x70')];}}})[_0xf132('0x72')](function(){return db[_0xf132('0x73')]['create'](_0x2f6001);});}})[_0xf132('0x28')](function(){return _0x54f015[_0xf132('0x1c')](0xcc)[_0xf132('0x1d')]();})[_0xf132('0x50')](handleError(_0x54f015,null));};exports['getPreview']=function(_0x3b8c7e,_0x1c388b,_0x7f633c){var _0x573a71=[];return db[_0xf132('0x6d')][_0xf132('0x59')]()[_0xf132('0x28')](function(_0x5afab9){_0x573a71=_[_0xf132('0x52')](_0x5afab9);return _0x3b8c7e['user'][_0xf132('0x74')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xf132('0x75')],'raw':!![]});})[_0xf132('0x28')](function(_0x28261f){if(_0x28261f&&_0x28261f['length']){return db[_0xf132('0x76')]['transaction'](function(_0x23c3f0){var _0x2e45e9={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf132('0x67')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xf132('0x2c')](_0x28261f,'id')},'$or':[{'UserId':null},{'UserId':_0x3b8c7e[_0xf132('0x65')]['id']}]};var _0x22f012=[];if(_0x3b8c7e[_0xf132('0x58')][_0xf132('0x77')]&&_0x3b8c7e['body'][_0xf132('0x77')]===_0xf132('0x78')){if(!_[_0xf132('0x79')](_0x3b8c7e[_0xf132('0x58')]['hopperIds'])){_0x2e45e9['id']={'$in':_0x3b8c7e[_0xf132('0x58')][_0xf132('0x7a')]};}_0x22f012=[[_0xf132('0x7b'),_0xf132('0x7c')],[_0xf132('0x7d'),_0x28261f[0x0]['dialOrderByScheduledAt']===_0xf132('0x7c')?'DESC':'ASC'],db[_0xf132('0x76')][_0xf132('0x7e')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_['isEmpty'](_0x3b8c7e[_0xf132('0x58')]['hopperIds'])){_0x2e45e9['id']={'$notIn':_0x3b8c7e[_0xf132('0x58')][_0xf132('0x7a')]};}_0x22f012=[[_0xf132('0x7b'),_0xf132('0x7f')],[_0xf132('0x7d'),_0x28261f[0x0]['dialOrderByScheduledAt']],db[_0xf132('0x76')][_0xf132('0x7e')](_0xf132('0x80')),['id',_0xf132('0x7c')]];}return db['CmHopper'][_0xf132('0x81')]({'attributes':['id','scheduledat'],'where':_0x2e45e9,'order':_0x22f012,'transaction':_0x23c3f0,'lock':_0x23c3f0[_0xf132('0x82')][_0xf132('0x83')],'include':[{'model':db['CmContact'],'as':_0xf132('0x84'),'attributes':_0x573a71,'include':[{'model':db[_0xf132('0x85')],'as':_0xf132('0x86'),'attributes':['id','name']}]},{'model':db[_0xf132('0x87')],'as':_0xf132('0x88'),'attributes':['id',_0xf132('0x2a')]},{'model':db[_0xf132('0x5c')],'as':_0xf132('0x89'),'attributes':['id',_0xf132('0x2a'),_0xf132('0x8a')]}]})[_0xf132('0x28')](function(_0x2bff8b){if(_0x2bff8b){return _0x2bff8b[_0xf132('0x8b')]({'UserId':_0x3b8c7e[_0xf132('0x65')]['id']},{'transaction':_0x23c3f0});}});});}})['then'](handleEntityNotFound(_0x1c388b,null))[_0xf132('0x28')](respondWithResult(_0x1c388b,null))['catch'](handleError(_0x1c388b,null));};exports[_0xf132('0x8c')]=function(_0x21308e,_0x1ebd3c,_0x4ddf29){return _0x21308e['user']['getVoiceQueues']({'where':{'type':_0xf132('0x8d'),'dialActive':!![],'dialMethod':_0xf132('0x8e')},'attributes':['id'],'raw':!![]})['then'](function(_0x4c1c58){if(_0x4c1c58&&_0x4c1c58['length']){return db[_0xf132('0x2d')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf132('0x67')](_0xf132('0x68'))},'VoiceQueueId':{'$in':_[_0xf132('0x2c')](_0x4c1c58,'id')},'$or':[{'UserId':null},{'UserId':_0x21308e['user']['id']}]}});}return 0x0;})[_0xf132('0x28')](function(_0x1e2505){if(!_['isNil'](_0x1e2505)&&_[_0xf132('0x8f')](_0x1e2505)){return _0x1ebd3c[_0xf132('0x1c')](0xc8)[_0xf132('0x1e')]({'contacts':_0x1e2505});}else{logger[_0xf132('0x29')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xf132('0x8c'),0x194,_0xf132('0x90'));_0x1ebd3c[_0xf132('0x1b')](0x194);}})[_0xf132('0x50')](handleError(_0x1ebd3c,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 336dc0d..ccc01fc 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 _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 +var _0xeadf=['scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports'];(function(_0x2d70a4,_0x573370){var _0xd7877=function(_0x360e6e){while(--_0x360e6e){_0x2d70a4['push'](_0x2d70a4['shift']());}};_0xd7877(++_0x573370);}(_0xeadf,0x1bd));var _0xfead=function(_0x8ce506,_0x517f30){_0x8ce506=_0x8ce506-0x0;var _0x23c8e5=_0xeadf[_0x8ce506];return _0x23c8e5;};'use strict';var _=require(_0xfead('0x0'));var util=require(_0xfead('0x1'));var logger=require(_0xfead('0x2'))(_0xfead('0x3'));var moment=require('moment');var BPromise=require(_0xfead('0x4'));var rp=require(_0xfead('0x5'));var fs=require('fs');var path=require(_0xfead('0x6'));var rimraf=require(_0xfead('0x7'));var config=require('../../config/environment');var attributes=require(_0xfead('0x8'));module[_0xfead('0x9')]=function(_0x4450a1,_0x35203c){return _0x4450a1['define']('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0xfead('0xa')]},{'name':_0xfead('0xb'),'fields':[_0xfead('0xb')]},{'name':_0xfead('0xc'),'fields':[_0xfead('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 95a1326..c8557d3 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 _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 +var _0x98e7=['where','attributes','limit','include','map','model','debug','ShowCmHopper','find','CreateCmHopper','body','UpdateCmHopper','update','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','findAll','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','push','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','create','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','GetContactRecallMe','all','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','options','raw'];(function(_0x183a2e,_0x187c76){var _0x2dedff=function(_0x22703e){while(--_0x22703e){_0x183a2e['push'](_0x183a2e['shift']());}};_0x2dedff(++_0x187c76);}(_0x98e7,0x1c5));var _0x798e=function(_0x2a9421,_0x12acc6){_0x2a9421=_0x2a9421-0x0;var _0x520dd6=_0x98e7[_0x2a9421];return _0x520dd6;};'use strict';var _=require(_0x798e('0x0'));var util=require(_0x798e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x798e('0x2'));var db=require(_0x798e('0x3'))['db'];var utils=require(_0x798e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x798e('0x5'));var jayson=require(_0x798e('0x6'));var client=jayson[_0x798e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4355cd,_0x335f28,_0x88cb4f){return new BPromise(function(_0x3411f3,_0x29e35a){return client['request'](_0x4355cd,_0x88cb4f)[_0x798e('0x8')](function(_0x23d0bb){logger[_0x798e('0x9')](_0x798e('0xa'),_0x335f28,_0x798e('0xb'));logger['debug'](_0x798e('0xc'),_0x335f28,'request\x20sent',JSON[_0x798e('0xd')](_0x23d0bb));if(_0x23d0bb[_0x798e('0xe')]){if(_0x23d0bb[_0x798e('0xe')][_0x798e('0xf')]===0x1f4){logger[_0x798e('0xe')](_0x798e('0xa'),_0x335f28,_0x23d0bb[_0x798e('0xe')][_0x798e('0x10')]);return _0x29e35a(_0x23d0bb['error']['message']);}logger[_0x798e('0xe')]('CmHopper,\x20%s,\x20%s',_0x335f28,_0x23d0bb[_0x798e('0xe')][_0x798e('0x10')]);return _0x3411f3(_0x23d0bb['error'][_0x798e('0x10')]);}else{logger[_0x798e('0x9')](_0x798e('0xa'),_0x335f28,_0x798e('0xb'));_0x3411f3(_0x23d0bb[_0x798e('0x11')][_0x798e('0x10')]);}})[_0x798e('0x12')](function(_0x3cf24a){logger[_0x798e('0xe')](_0x798e('0xa'),_0x335f28,_0x3cf24a);_0x29e35a(_0x3cf24a);});});}exports[_0x798e('0x13')]=function(_0x3c2082){var _0x3b3f8c=this;return new Promise(function(_0x379ce3,_0x55977f){return db[_0x798e('0x14')]['findAll']({'raw':_0x3c2082[_0x798e('0x15')]?_0x3c2082[_0x798e('0x15')][_0x798e('0x16')]===undefined?!![]:![]:!![],'where':_0x3c2082[_0x798e('0x15')]?_0x3c2082['options'][_0x798e('0x17')]||null:null,'attributes':_0x3c2082['options']?_0x3c2082['options'][_0x798e('0x18')]||null:null,'limit':_0x3c2082[_0x798e('0x15')]?_0x3c2082[_0x798e('0x15')][_0x798e('0x19')]||null:null,'include':_0x3c2082['options']?_0x3c2082[_0x798e('0x15')][_0x798e('0x1a')]?_[_0x798e('0x1b')](_0x3c2082['options'][_0x798e('0x1a')],function(_0xfbeb72){return{'model':db[_0xfbeb72[_0x798e('0x1c')]],'as':_0xfbeb72['as'],'attributes':_0xfbeb72[_0x798e('0x18')],'include':_0xfbeb72[_0x798e('0x1a')]?_['map'](_0xfbeb72[_0x798e('0x1a')],function(_0x351ff3){return{'model':db[_0x351ff3['model']],'as':_0x351ff3['as'],'attributes':_0x351ff3['attributes'],'include':_0x351ff3[_0x798e('0x1a')]?_[_0x798e('0x1b')](_0x351ff3['include'],function(_0x192cbd){return{'model':db[_0x192cbd['model']],'as':_0x192cbd['as'],'attributes':_0x192cbd[_0x798e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x798e('0x8')](function(_0x27f441){logger[_0x798e('0x9')](_0x798e('0x13'),_0x3c2082);logger[_0x798e('0x1d')]('GetCmHopper',_0x3c2082,JSON[_0x798e('0xd')](_0x27f441));_0x379ce3(_0x27f441);})['catch'](function(_0x1d5ffb){logger['error']('GetCmHopper',_0x1d5ffb['message'],_0x3c2082);_0x55977f(_0x3b3f8c[_0x798e('0xe')](0x1f4,_0x1d5ffb[_0x798e('0x10')]));});});};exports[_0x798e('0x1e')]=function(_0x60003f){var _0x1492eb=this;return new Promise(function(_0x50006b,_0x2b31d3){return db[_0x798e('0x14')][_0x798e('0x1f')]({'raw':_0x60003f['options']?_0x60003f[_0x798e('0x15')][_0x798e('0x16')]===undefined?!![]:![]:!![],'where':_0x60003f[_0x798e('0x15')]?_0x60003f[_0x798e('0x15')][_0x798e('0x17')]||null:null,'attributes':_0x60003f[_0x798e('0x15')]?_0x60003f[_0x798e('0x15')][_0x798e('0x18')]||null:null,'include':_0x60003f[_0x798e('0x15')]?_0x60003f[_0x798e('0x15')][_0x798e('0x1a')]?_[_0x798e('0x1b')](_0x60003f[_0x798e('0x15')][_0x798e('0x1a')],function(_0x477371){return{'model':db[_0x477371[_0x798e('0x1c')]],'as':_0x477371['as'],'attributes':_0x477371[_0x798e('0x18')],'include':_0x477371['include']?_[_0x798e('0x1b')](_0x477371[_0x798e('0x1a')],function(_0x4ce984){return{'model':db[_0x4ce984[_0x798e('0x1c')]],'as':_0x4ce984['as'],'attributes':_0x4ce984[_0x798e('0x18')],'include':_0x4ce984[_0x798e('0x1a')]?_['map'](_0x4ce984['include'],function(_0xbf247b){return{'model':db[_0xbf247b[_0x798e('0x1c')]],'as':_0xbf247b['as'],'attributes':_0xbf247b[_0x798e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x798e('0x8')](function(_0x2607d9){logger[_0x798e('0x9')](_0x798e('0x1e'),_0x60003f);logger[_0x798e('0x1d')]('ShowCmHopper',_0x60003f,JSON[_0x798e('0xd')](_0x2607d9));_0x50006b(_0x2607d9);})[_0x798e('0x12')](function(_0x55ef97){logger[_0x798e('0xe')](_0x798e('0x1e'),_0x55ef97[_0x798e('0x10')],_0x60003f);_0x2b31d3(_0x1492eb[_0x798e('0xe')](0x1f4,_0x55ef97[_0x798e('0x10')]));});});};exports[_0x798e('0x20')]=function(_0x40a0b5){var _0x8053=this;return new Promise(function(_0xaf8ed7,_0x391e93){return db[_0x798e('0x14')]['create'](_0x40a0b5[_0x798e('0x21')],{'raw':_0x40a0b5['options']?_0x40a0b5[_0x798e('0x15')][_0x798e('0x16')]===undefined?!![]:![]:!![]})[_0x798e('0x8')](function(_0x462997){logger[_0x798e('0x9')](_0x798e('0x20'),_0x40a0b5);logger[_0x798e('0x1d')](_0x798e('0x20'),_0x40a0b5,JSON[_0x798e('0xd')](_0x462997));_0xaf8ed7(_0x462997);})[_0x798e('0x12')](function(_0x46ab75){logger[_0x798e('0xe')](_0x798e('0x20'),_0x46ab75[_0x798e('0x10')],_0x40a0b5);_0x391e93(_0x8053[_0x798e('0xe')](0x1f4,_0x46ab75[_0x798e('0x10')]));});});};exports[_0x798e('0x22')]=function(_0x295b1d){var _0x178912=this;return new Promise(function(_0x2e8d97,_0xa4dac8){return db[_0x798e('0x14')][_0x798e('0x23')](_0x295b1d[_0x798e('0x21')],{'raw':_0x295b1d[_0x798e('0x15')]?_0x295b1d['options'][_0x798e('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295b1d[_0x798e('0x15')]?_0x295b1d[_0x798e('0x15')][_0x798e('0x17')]||null:null,'attributes':_0x295b1d[_0x798e('0x15')]?_0x295b1d[_0x798e('0x15')][_0x798e('0x18')]||null:null,'limit':_0x295b1d[_0x798e('0x15')]?_0x295b1d[_0x798e('0x15')][_0x798e('0x19')]||null:null})[_0x798e('0x8')](function(_0x215abd){logger[_0x798e('0x9')](_0x798e('0x22'),_0x295b1d);logger[_0x798e('0x1d')](_0x798e('0x22'),_0x295b1d,JSON[_0x798e('0xd')](_0x215abd));_0x2e8d97(_0x215abd);})[_0x798e('0x12')](function(_0x2ac782){logger['error'](_0x798e('0x22'),_0x2ac782['message'],_0x295b1d);_0xa4dac8(_0x178912['error'](0x1f4,_0x2ac782[_0x798e('0x10')]));});});};exports[_0x798e('0x24')]=function(_0x2c5d01){var _0x51bde5=this;return new Promise(function(_0x209090,_0x3f7d69){return db[_0x798e('0x14')][_0x798e('0x25')]({'where':_0x2c5d01['options']?_0x2c5d01['options'][_0x798e('0x17')]||null:null})[_0x798e('0x8')](function(_0x490c01){logger[_0x798e('0x9')]('DestroyCmHopper',_0x2c5d01);logger[_0x798e('0x1d')](_0x798e('0x24'),_0x2c5d01,JSON[_0x798e('0xd')](_0x490c01));_0x209090(_0x490c01);})[_0x798e('0x12')](function(_0x475749){logger['error'](_0x798e('0x24'),_0x475749[_0x798e('0x10')],_0x2c5d01);_0x3f7d69(_0x51bde5[_0x798e('0xe')](0x1f4,_0x475749[_0x798e('0x10')]));});});};exports['GetContactDialer']=function(_0x3145a9){var _0x27eeb7=this;return new Promise(function(_0x219dfc,_0x51756d){return db[_0x798e('0x26')][_0x798e('0x27')]()['then'](function(_0x4bfc35){return db[_0x798e('0x28')][_0x798e('0x29')](function(_0x5edf08){return db['CmHopper'][_0x798e('0x2a')]({'where':_0x3145a9['options']?_0x3145a9[_0x798e('0x15')]['where']||null:null,'attributes':_0x3145a9[_0x798e('0x15')]?_0x3145a9['options']['attributes']||null:null,'limit':_0x3145a9['options']?_0x3145a9['options']['limit']||null:null,'order':_0x3145a9[_0x798e('0x15')]?_0x3145a9[_0x798e('0x15')][_0x798e('0x2b')]||null:null,'transaction':_0x5edf08,'lock':_0x5edf08[_0x798e('0x2c')][_0x798e('0x2d')],'include':[{'model':db[_0x798e('0x26')],'as':_0x798e('0x2e'),'attributes':_[_0x798e('0x2f')](_0x4bfc35)},{'model':db[_0x798e('0x30')],'as':_0x798e('0x31'),'attributes':['id',_0x798e('0x32'),_0x798e('0x33')]}]})['then'](function(_0x5a86af){var _0x5e5961=[];var _0x33a472=[];for(var _0x117702=0x0;_0x117702<_0x5a86af[_0x798e('0x34')];_0x117702+=0x1){if(!_0x33a472['includes'](_0x5a86af[_0x117702][_0x798e('0x35')])){_0x33a472['push'](_0x5a86af[_0x117702]['UserId']);_0x5e5961[_0x798e('0x36')](_0x5a86af[_0x117702][_0x798e('0x23')](_0x3145a9[_0x798e('0x21')],{'transaction':_0x5edf08}));}}return BPromise['all'](_0x5e5961);});})['then'](function(_0x3d0e9a){logger['info'](_0x798e('0x37'),_0x3145a9);logger[_0x798e('0x1d')]('GetContactDialer',_0x3145a9,JSON[_0x798e('0xd')](_0x3d0e9a));_0x219dfc(_0x3d0e9a);})['catch'](function(_0x2aa837){logger[_0x798e('0xe')](_0x798e('0x37'),_0x2aa837[_0x798e('0x10')],_0x3145a9);_0x51756d(_0x27eeb7[_0x798e('0xe')](0x1f4,_0x2aa837[_0x798e('0x10')]));});});});};exports[_0x798e('0x38')]=function(_0x21c4ad){var _0xafd01c=this;return new Promise(function(_0x154a05,_0x2fba51){return db[_0x798e('0x28')][_0x798e('0x29')](function(_0x1831a8){return db[_0x798e('0x39')][_0x798e('0x3a')](_0x21c4ad[_0x798e('0x21')],{'raw':_0x21c4ad[_0x798e('0x15')]?_0x21c4ad['options'][_0x798e('0x16')]===undefined?!![]:![]:!![],'transaction':_0x1831a8})['then'](function(){return db['CmHopper'][_0x798e('0x25')]({'where':_0x21c4ad[_0x798e('0x15')]?_0x21c4ad['options'][_0x798e('0x17')]||null:null,'transaction':_0x1831a8});});})[_0x798e('0x8')](function(_0x319729){logger['info']('MoveContactManagedDialer',_0x21c4ad);logger[_0x798e('0x1d')](_0x798e('0x38'),_0x21c4ad,JSON[_0x798e('0xd')](_0x319729));_0x154a05(_0x319729);})[_0x798e('0x12')](function(_0x581cec){logger['error'](_0x798e('0x38'),_0x581cec[_0x798e('0x10')],_0x21c4ad);_0x2fba51(_0xafd01c[_0x798e('0xe')](0x1f4,_0x581cec[_0x798e('0x10')]));});});};exports[_0x798e('0x3b')]=function(_0x482d8c){var _0x32b95d=this;return new Promise(function(_0x5bef00,_0x3e02f0){return db[_0x798e('0x14')][_0x798e('0x2a')]({'raw':_0x482d8c[_0x798e('0x15')]?_0x482d8c[_0x798e('0x15')][_0x798e('0x16')]===undefined?!![]:![]:!![],'where':_0x482d8c['options']?_0x482d8c[_0x798e('0x15')][_0x798e('0x17')]||null:null,'attributes':[[db[_0x798e('0x28')]['fn'](_0x798e('0x3c'),db['sequelize']['fn']('IF',db[_0x798e('0x28')][_0x798e('0x3d')](_0x798e('0x3e')+util[_0x798e('0x3f')](_0x798e('0x40'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0x798e('0x41')))),'contactsRescheduled']]})[_0x798e('0x8')](function(_0x54c69c){logger[_0x798e('0x9')](_0x798e('0x3b'),_0x482d8c);logger[_0x798e('0x1d')](_0x798e('0x3b'),_0x482d8c,JSON[_0x798e('0xd')](_0x54c69c));_0x5bef00(_0x54c69c);})['catch'](function(_0x646411){logger[_0x798e('0xe')](_0x798e('0x3b'),_0x646411[_0x798e('0x10')],_0x482d8c);_0x3e02f0(_0x32b95d[_0x798e('0xe')](0x1f4,_0x646411[_0x798e('0x10')]));});});};exports[_0x798e('0x42')]=function(_0x81963){var _0x12b432=this;return new Promise(function(_0x3832b8,_0x57ea60){return db[_0x798e('0x26')]['describe']()[_0x798e('0x8')](function(_0x54154f){return db['sequelize'][_0x798e('0x29')](function(_0x242aa9){return db['CmHopper']['findAll']({'where':_0x81963[_0x798e('0x15')]?_0x81963['options'][_0x798e('0x17')]||null:null,'attributes':_0x81963[_0x798e('0x15')]?_0x81963[_0x798e('0x15')][_0x798e('0x18')]||null:null,'limit':0x1,'order':_0x81963[_0x798e('0x15')]?_0x81963[_0x798e('0x15')][_0x798e('0x2b')]||null:null,'group':db[_0x798e('0x14')][_0x798e('0x35')],'transaction':_0x242aa9,'lock':_0x242aa9[_0x798e('0x2c')][_0x798e('0x2d')],'include':_0x81963[_0x798e('0x15')]?_0x81963[_0x798e('0x15')]['include']?_[_0x798e('0x1b')](_0x81963[_0x798e('0x15')]['include'],function(_0x304be4){return{'model':db[_0x304be4[_0x798e('0x1c')]],'as':_0x304be4['as'],'attributes':_0x304be4[_0x798e('0x18')],'include':_0x304be4[_0x798e('0x1a')]?_[_0x798e('0x1b')](_0x304be4[_0x798e('0x1a')],function(_0x5ad2a7){return{'model':db[_0x5ad2a7['model']],'as':_0x5ad2a7['as'],'attributes':_0x5ad2a7[_0x798e('0x18')],'include':_0x5ad2a7['include']?_[_0x798e('0x1b')](_0x5ad2a7[_0x798e('0x1a')],function(_0x80574d){return{'model':db[_0x80574d[_0x798e('0x1c')]],'as':_0x80574d['as'],'attributes':_0x80574d['attributes']};}):[]};}):[]};}):[]:[]})[_0x798e('0x8')](function(_0x15e958){var _0xb997ea=[];for(var _0x501a0f=0x0;_0x501a0f<_0x15e958['length'];_0x501a0f+=0x1){_0xb997ea[_0x798e('0x36')](_0x15e958[_0x501a0f][_0x798e('0x23')](_0x81963[_0x798e('0x21')],{'transaction':_0x242aa9}));}return BPromise[_0x798e('0x43')](_0xb997ea);});})[_0x798e('0x8')](function(_0xbb7dc3){logger[_0x798e('0x9')](_0x798e('0x42'),_0x81963);logger['debug'](_0x798e('0x42'),_0x81963,JSON['stringify'](_0xbb7dc3));_0x3832b8(_0xbb7dc3);})[_0x798e('0x12')](function(_0x134e06){logger[_0x798e('0xe')]('GetContactRecallMe',_0x134e06[_0x798e('0x10')],_0x81963);_0x57ea60(_0x12b432[_0x798e('0xe')](0x1f4,_0x134e06[_0x798e('0x10')]));});});});};exports['GetCmHopperPreview']=function(_0x388c0e){var _0x1c718d=this;return new Promise(function(_0x1cc42d,_0x5e95f8){db[_0x798e('0x26')]['describe']()[_0x798e('0x8')](function(_0x175f93){return db[_0x798e('0x14')][_0x798e('0x2a')]({'raw':_0x388c0e[_0x798e('0x15')]?_0x388c0e[_0x798e('0x15')][_0x798e('0x16')]===undefined?!![]:![]:!![],'where':_0x388c0e[_0x798e('0x15')]?_0x388c0e[_0x798e('0x15')]['where']||null:null,'attributes':_0x388c0e[_0x798e('0x15')]?_0x388c0e['options'][_0x798e('0x18')]||null:null,'limit':_0x388c0e['options']?_0x388c0e[_0x798e('0x15')]['limit']||null:null,'include':_0x388c0e['options']?_0x388c0e[_0x798e('0x15')][_0x798e('0x1a')]?_[_0x798e('0x1b')](_0x388c0e[_0x798e('0x15')]['include'],function(_0x1789c6){return{'model':db[_0x1789c6[_0x798e('0x1c')]],'as':_0x1789c6['as'],'attributes':_0x1789c6['as']===_0x798e('0x2e')?_[_0x798e('0x2f')](_0x175f93):_0x1789c6[_0x798e('0x18')],'include':_0x1789c6[_0x798e('0x1a')]?_[_0x798e('0x1b')](_0x1789c6[_0x798e('0x1a')],function(_0x20fe23){return{'model':db[_0x20fe23[_0x798e('0x1c')]],'as':_0x20fe23['as'],'attributes':_0x20fe23[_0x798e('0x18')],'include':_0x20fe23[_0x798e('0x1a')]?_[_0x798e('0x1b')](_0x20fe23[_0x798e('0x1a')],function(_0x1470d9){return{'model':db[_0x1470d9['model']],'as':_0x1470d9['as'],'attributes':_0x1470d9[_0x798e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x798e('0x8')](function(_0x4c0b9c){logger['info'](_0x798e('0x13'),_0x388c0e);logger[_0x798e('0x1d')](_0x798e('0x13'),_0x388c0e,JSON[_0x798e('0xd')](_0x4c0b9c));_0x1cc42d(_0x4c0b9c);})[_0x798e('0x12')](function(_0x371450){logger[_0x798e('0xe')](_0x798e('0x13'),_0x371450[_0x798e('0x10')],_0x388c0e);_0x5e95f8(_0x1c718d[_0x798e('0xe')](0x1f4,_0x371450['message']));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 34db2c5..02ec369 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 _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 +var _0xbb59=['create','/preview','getPreview','put','update','delete','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','index','get','/describe','describe','/opencontacts','getOpenContacts','/:id','post'];(function(_0x509220,_0x58a6ec){var _0x2335b2=function(_0x396624){while(--_0x396624){_0x509220['push'](_0x509220['shift']());}};_0x2335b2(++_0x58a6ec);}(_0xbb59,0xec));var _0x9bb5=function(_0x395438,_0x17bcae){_0x395438=_0x395438-0x0;var _0x298412=_0xbb59[_0x395438];return _0x298412;};'use strict';var multer=require(_0x9bb5('0x0'));var util=require(_0x9bb5('0x1'));var path=require(_0x9bb5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9bb5('0x3')]();var auth=require(_0x9bb5('0x4'));var interaction=require(_0x9bb5('0x5'));var config=require(_0x9bb5('0x6'));var controller=require(_0x9bb5('0x7'));router['get']('/',auth[_0x9bb5('0x8')](),controller[_0x9bb5('0x9')]);router[_0x9bb5('0xa')](_0x9bb5('0xb'),auth[_0x9bb5('0x8')](),controller[_0x9bb5('0xc')]);router[_0x9bb5('0xa')](_0x9bb5('0xd'),auth[_0x9bb5('0x8')](),controller[_0x9bb5('0xe')]);router[_0x9bb5('0xa')](_0x9bb5('0xf'),auth[_0x9bb5('0x8')](),controller['show']);router[_0x9bb5('0x10')]('/',auth[_0x9bb5('0x8')](),controller[_0x9bb5('0x11')]);router[_0x9bb5('0x10')](_0x9bb5('0x12'),auth[_0x9bb5('0x8')](),controller[_0x9bb5('0x13')]);router[_0x9bb5('0x14')](_0x9bb5('0xf'),auth[_0x9bb5('0x8')](),controller[_0x9bb5('0x15')]);router[_0x9bb5('0x16')](_0x9bb5('0xf'),auth[_0x9bb5('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 7828773..5c090f9 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 _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 +var _0x1a17=['STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','exports','INTEGER'];(function(_0xa8e6d5,_0x30a6d3){var _0x60baf4=function(_0x156b35){while(--_0x156b35){_0xa8e6d5['push'](_0xa8e6d5['shift']());}};_0x60baf4(++_0x30a6d3);}(_0x1a17,0xf3));var _0x71a1=function(_0x5df657,_0x38d833){_0x5df657=_0x5df657-0x0;var _0x97387d=_0x1a17[_0x5df657];return _0x97387d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x71a1('0x0')]={'CmHopperId':{'type':Sequelize[_0x71a1('0x1')]},'phone':{'type':Sequelize[_0x71a1('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x71a1('0x3')],'defaultValue':moment()['format'](_0x71a1('0x4'))},'countbusyretry':{'type':Sequelize[_0x71a1('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x71a1('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x71a1('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x71a1('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x71a1('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 72d527c..4a76997 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 _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 +var _0xee87=['include','findAll','rows','show','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','then','destroy','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xee87,0x10d));var _0x7ee8=function(_0x4f27e4,_0x25aa19){_0x4f27e4=_0x4f27e4-0x0;var _0x2a849d=_0xee87[_0x4f27e4];return _0x2a849d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7ee8('0x0'));var rimraf=require(_0x7ee8('0x1'));var zipdir=require(_0x7ee8('0x2'));var jsonpatch=require(_0x7ee8('0x3'));var rp=require(_0x7ee8('0x4'));var moment=require(_0x7ee8('0x5'));var BPromise=require(_0x7ee8('0x6'));var Mustache=require(_0x7ee8('0x7'));var util=require(_0x7ee8('0x8'));var path=require(_0x7ee8('0x9'));var sox=require('sox');var csv=require(_0x7ee8('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7ee8('0xb'));var squel=require(_0x7ee8('0xc'));var crypto=require(_0x7ee8('0xd'));var jsforce=require(_0x7ee8('0xe'));var deskjs=require(_0x7ee8('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7ee8('0x10'));var Redis=require('ioredis');var authService=require(_0x7ee8('0x11'));var qs=require(_0x7ee8('0x12'));var as=require(_0x7ee8('0x13'));var hardwareService=require(_0x7ee8('0x14'));var logger=require(_0x7ee8('0x15'))(_0x7ee8('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7ee8('0x17'));var db=require(_0x7ee8('0x18'))['db'];function respondWithStatusCode(_0x39a4cd,_0x36e82a){_0x36e82a=_0x36e82a||0xcc;return function(_0xb4a1bc){if(_0xb4a1bc){return _0x39a4cd[_0x7ee8('0x19')](_0x36e82a);}return _0x39a4cd[_0x7ee8('0x1a')](_0x36e82a)[_0x7ee8('0x1b')]();};}function respondWithResult(_0x2a5fa3,_0x46b127){_0x46b127=_0x46b127||0xc8;return function(_0x1669d7){if(_0x1669d7){return _0x2a5fa3[_0x7ee8('0x1a')](_0x46b127)[_0x7ee8('0x1c')](_0x1669d7);}};}function respondWithFilteredResult(_0x12e853,_0x268b93){return function(_0x43f34c){if(_0x43f34c){var _0x192d8c=_0x43f34c[_0x7ee8('0x1d')],_0xf4a2c8=_0x268b93[_0x7ee8('0x1e')],_0xc46e32=_0x268b93[_0x7ee8('0x1e')]+_0x268b93[_0x7ee8('0x1f')],_0x3de0b8;if(_0xc46e32>=_0x192d8c){_0xc46e32=_0x192d8c;_0x3de0b8=0xc8;}else{_0x3de0b8=0xce;}_0x12e853[_0x7ee8('0x1a')](_0x3de0b8);return _0x12e853['set'](_0x7ee8('0x20'),_0xf4a2c8+'-'+_0xc46e32+'/'+_0x192d8c)['json'](_0x43f34c);}return null;};}function patchUpdates(_0x2bfa20){return function(_0x459ad1){try{jsonpatch['apply'](_0x459ad1,_0x2bfa20,!![]);}catch(_0x59e544){return BPromise[_0x7ee8('0x21')](_0x59e544);}return _0x459ad1[_0x7ee8('0x22')]();};}function saveUpdates(_0x298430,_0x15c00f){return function(_0x3de76){if(_0x3de76){return _0x3de76['update'](_0x298430)[_0x7ee8('0x23')](function(_0x43485e){return _0x43485e;});}return null;};}function removeEntity(_0x334b46,_0x555338){return function(_0x27bff9){if(_0x27bff9){return _0x27bff9[_0x7ee8('0x24')]()[_0x7ee8('0x23')](function(){var _0x1bcdd9=_0x27bff9['get']({'plain':!![]});var _0x40d420=_0x7ee8('0x25');return db[_0x7ee8('0x26')]['destroy']({'where':{'type':_0x40d420,'resourceId':_0x1bcdd9['id']}})[_0x7ee8('0x23')](function(){return _0x27bff9;});})[_0x7ee8('0x23')](function(){_0x334b46[_0x7ee8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f9cae,_0x3870e9){return function(_0x568ea){if(!_0x568ea){_0x3f9cae['sendStatus'](0x194);}return _0x568ea;};}function handleError(_0x27c94c,_0x4c360d){_0x4c360d=_0x4c360d||0x1f4;return function(_0x4d23fb){logger[_0x7ee8('0x27')](_0x4d23fb[_0x7ee8('0x28')]);if(_0x4d23fb['name']){delete _0x4d23fb[_0x7ee8('0x29')];}_0x27c94c['status'](_0x4c360d)[_0x7ee8('0x2a')](_0x4d23fb);};}exports['index']=function(_0x76beaa,_0x547147){var _0xf54bb1={},_0x33f20e={},_0x5455d0={'count':0x0,'rows':[]};var _0x2034c5=_[_0x7ee8('0x2b')](db[_0x7ee8('0x2c')][_0x7ee8('0x2d')],function(_0x2a8422){return{'name':_0x2a8422[_0x7ee8('0x2e')],'type':_0x2a8422[_0x7ee8('0x2f')]['key']};});_0x33f20e[_0x7ee8('0x30')]=_['map'](_0x2034c5,_0x7ee8('0x29'));_0x33f20e[_0x7ee8('0x31')]=_[_0x7ee8('0x32')](_0x76beaa[_0x7ee8('0x31')]);_0x33f20e['filters']=_[_0x7ee8('0x33')](_0x33f20e[_0x7ee8('0x30')],_0x33f20e['query']);_0xf54bb1[_0x7ee8('0x34')]=_[_0x7ee8('0x33')](_0x33f20e[_0x7ee8('0x30')],qs[_0x7ee8('0x35')](_0x76beaa[_0x7ee8('0x31')]['fields']));_0xf54bb1[_0x7ee8('0x34')]=_0xf54bb1[_0x7ee8('0x34')][_0x7ee8('0x36')]?_0xf54bb1['attributes']:_0x33f20e[_0x7ee8('0x30')];if(!_0x76beaa['query'][_0x7ee8('0x37')](_0x7ee8('0x38'))){_0xf54bb1['limit']=qs[_0x7ee8('0x1f')](_0x76beaa[_0x7ee8('0x31')][_0x7ee8('0x1f')]);_0xf54bb1['offset']=qs[_0x7ee8('0x1e')](_0x76beaa['query'][_0x7ee8('0x1e')]);}_0xf54bb1[_0x7ee8('0x39')]=qs[_0x7ee8('0x3a')](_0x76beaa[_0x7ee8('0x31')][_0x7ee8('0x3a')]);_0xf54bb1[_0x7ee8('0x3b')]=qs[_0x7ee8('0x3c')](_[_0x7ee8('0x3d')](_0x76beaa[_0x7ee8('0x31')],_0x33f20e[_0x7ee8('0x3c')]),_0x2034c5);if(_0x76beaa[_0x7ee8('0x31')][_0x7ee8('0x3e')]){_0xf54bb1[_0x7ee8('0x3b')]=_[_0x7ee8('0x3f')](_0xf54bb1['where'],{'$or':_['map'](_0x2034c5,function(_0x3442e7){if(_0x3442e7['type']!==_0x7ee8('0x40')){var _0x13be3e={};_0x13be3e[_0x3442e7[_0x7ee8('0x29')]]={'$like':'%'+_0x76beaa[_0x7ee8('0x31')][_0x7ee8('0x3e')]+'%'};return _0x13be3e;}})});}_0xf54bb1=_[_0x7ee8('0x3f')]({},_0xf54bb1,_0x76beaa[_0x7ee8('0x41')]);var _0x384d83={'where':_0xf54bb1[_0x7ee8('0x3b')]};return db[_0x7ee8('0x2c')][_0x7ee8('0x1d')](_0x384d83)[_0x7ee8('0x23')](function(_0x11f352){_0x5455d0[_0x7ee8('0x1d')]=_0x11f352;if(_0x76beaa[_0x7ee8('0x31')][_0x7ee8('0x42')]){_0xf54bb1[_0x7ee8('0x43')]=[{'all':!![]}];}return db[_0x7ee8('0x2c')][_0x7ee8('0x44')](_0xf54bb1);})[_0x7ee8('0x23')](function(_0x56ead5){_0x5455d0[_0x7ee8('0x45')]=_0x56ead5;return _0x5455d0;})[_0x7ee8('0x23')](respondWithFilteredResult(_0x547147,_0xf54bb1))['catch'](handleError(_0x547147,null));};exports[_0x7ee8('0x46')]=function(_0x29e866,_0x509838){var _0x12e9b0={'raw':!![],'where':{'id':_0x29e866['params']['id']}},_0x21c649={};_0x21c649[_0x7ee8('0x30')]=_['keys'](db['CmHopperAdditionalPhone']['rawAttributes']);_0x21c649['query']=_[_0x7ee8('0x32')](_0x29e866[_0x7ee8('0x31')]);_0x21c649['filters']=_[_0x7ee8('0x33')](_0x21c649[_0x7ee8('0x30')],_0x21c649[_0x7ee8('0x31')]);_0x12e9b0[_0x7ee8('0x34')]=_[_0x7ee8('0x33')](_0x21c649[_0x7ee8('0x30')],qs[_0x7ee8('0x35')](_0x29e866[_0x7ee8('0x31')]['fields']));_0x12e9b0[_0x7ee8('0x34')]=_0x12e9b0[_0x7ee8('0x34')]['length']?_0x12e9b0[_0x7ee8('0x34')]:_0x21c649['model'];if(_0x29e866['query'][_0x7ee8('0x42')]){_0x12e9b0['include']=[{'all':!![]}];}_0x12e9b0=_[_0x7ee8('0x3f')]({},_0x12e9b0,_0x29e866[_0x7ee8('0x41')]);return db[_0x7ee8('0x2c')]['find'](_0x12e9b0)[_0x7ee8('0x23')](handleEntityNotFound(_0x509838,null))['then'](respondWithResult(_0x509838,null))[_0x7ee8('0x47')](handleError(_0x509838,null));};exports[_0x7ee8('0x48')]=function(_0x4e1176,_0x3408a2){return db[_0x7ee8('0x2c')][_0x7ee8('0x48')](_0x4e1176[_0x7ee8('0x49')],{})['then'](function(_0x4f36d0){var _0x46e007=_0x4e1176[_0x7ee8('0x4a')]['get']({'plain':!![]});if(!_0x46e007)throw new Error(_0x7ee8('0x4b'));if(_0x46e007['role']==='user'){var _0x2f142d=_0x4f36d0[_0x7ee8('0x4c')]({'plain':!![]});var _0x2e43ac=_0x7ee8('0x25');return db[_0x7ee8('0x4d')][_0x7ee8('0x4e')]({'where':{'name':_0x2e43ac,'userProfileId':_0x46e007[_0x7ee8('0x4f')]},'raw':!![]})[_0x7ee8('0x23')](function(_0x419a16){if(_0x419a16&&_0x419a16[_0x7ee8('0x50')]===0x0){return db['UserProfileResource'][_0x7ee8('0x48')]({'name':_0x2f142d[_0x7ee8('0x29')],'resourceId':_0x2f142d['id'],'type':_0x419a16['name'],'sectionId':_0x419a16['id']},{})[_0x7ee8('0x23')](function(){return _0x4f36d0;});}else{return _0x4f36d0;}})[_0x7ee8('0x47')](function(_0x5d2e84){logger[_0x7ee8('0x27')](_0x7ee8('0x51'),_0x5d2e84);throw _0x5d2e84;});}return _0x4f36d0;})['then'](respondWithResult(_0x3408a2,0xc9))['catch'](handleError(_0x3408a2,null));};exports[_0x7ee8('0x52')]=function(_0x162216,_0x5b048d){if(_0x162216[_0x7ee8('0x49')]['id']){delete _0x162216[_0x7ee8('0x49')]['id'];}return db[_0x7ee8('0x2c')][_0x7ee8('0x4e')]({'where':{'id':_0x162216[_0x7ee8('0x53')]['id']}})[_0x7ee8('0x23')](handleEntityNotFound(_0x5b048d,null))[_0x7ee8('0x23')](saveUpdates(_0x162216['body'],null))[_0x7ee8('0x23')](respondWithResult(_0x5b048d,null))[_0x7ee8('0x47')](handleError(_0x5b048d,null));};exports[_0x7ee8('0x24')]=function(_0x45c7f6,_0x65d31b){return db[_0x7ee8('0x2c')][_0x7ee8('0x4e')]({'where':{'id':_0x45c7f6[_0x7ee8('0x53')]['id']}})[_0x7ee8('0x23')](handleEntityNotFound(_0x65d31b,null))[_0x7ee8('0x23')](removeEntity(_0x65d31b,null))[_0x7ee8('0x47')](handleError(_0x65d31b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 494c748..b0a70b7 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 _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 +var _0x6951=['../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x429c17,_0xd89574){var _0x54454f=function(_0x1fa64d){while(--_0x1fa64d){_0x429c17['push'](_0x429c17['shift']());}};_0x54454f(++_0xd89574);}(_0x6951,0x124));var _0x1695=function(_0x1376e9,_0x19f5db){_0x1376e9=_0x1376e9-0x0;var _0x3db89a=_0x6951[_0x1376e9];return _0x3db89a;};'use strict';var _=require(_0x1695('0x0'));var util=require(_0x1695('0x1'));var logger=require(_0x1695('0x2'))('api');var moment=require(_0x1695('0x3'));var BPromise=require('bluebird');var rp=require(_0x1695('0x4'));var fs=require('fs');var path=require(_0x1695('0x5'));var rimraf=require(_0x1695('0x6'));var config=require(_0x1695('0x7'));var attributes=require(_0x1695('0x8'));module[_0x1695('0x9')]=function(_0x215be3,_0x1cbbed){return _0x215be3[_0x1695('0xa')](_0x1695('0xb'),attributes,{'tableName':_0x1695('0xc'),'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 ebf64f1..594fad6 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 _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 +var _0xfd32=['../../config/environment','client','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VerifyAdditionalPhones','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','phone','countnoanswerretry','createdAt','updatedAt','isNil','additionalToHop','sequelize','transaction','update','CmHopper','IncrementPreviewCounters','field','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc'];(function(_0x2a1076,_0xe55349){var _0x59ce38=function(_0x1c5e72){while(--_0x1c5e72){_0x2a1076['push'](_0x2a1076['shift']());}};_0x59ce38(++_0xe55349);}(_0xfd32,0xd9));var _0x2fd3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd32[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2fd3('0x0'));var util=require(_0x2fd3('0x1'));var moment=require(_0x2fd3('0x2'));var BPromise=require(_0x2fd3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2fd3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2fd3('0x5'))(_0x2fd3('0x6'));var config=require(_0x2fd3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2fd3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46853f,_0x4ae05b,_0x1fdb4d){return new BPromise(function(_0x4611b5,_0x35d36e){return client['request'](_0x46853f,_0x1fdb4d)[_0x2fd3('0x9')](function(_0x439f3d){logger[_0x2fd3('0xa')](_0x2fd3('0xb'),_0x4ae05b,_0x2fd3('0xc'));logger['debug'](_0x2fd3('0xd'),_0x4ae05b,_0x2fd3('0xc'),JSON[_0x2fd3('0xe')](_0x439f3d));if(_0x439f3d[_0x2fd3('0xf')]){if(_0x439f3d['error'][_0x2fd3('0x10')]===0x1f4){logger['error'](_0x2fd3('0xb'),_0x4ae05b,_0x439f3d[_0x2fd3('0xf')][_0x2fd3('0x11')]);return _0x35d36e(_0x439f3d[_0x2fd3('0xf')][_0x2fd3('0x11')]);}logger[_0x2fd3('0xf')](_0x2fd3('0xb'),_0x4ae05b,_0x439f3d[_0x2fd3('0xf')]['message']);return _0x4611b5(_0x439f3d[_0x2fd3('0xf')][_0x2fd3('0x11')]);}else{logger[_0x2fd3('0xa')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4ae05b,_0x2fd3('0xc'));_0x4611b5(_0x439f3d['result']['message']);}})[_0x2fd3('0x12')](function(_0x48777a){logger[_0x2fd3('0xf')](_0x2fd3('0xb'),_0x4ae05b,_0x48777a);_0x35d36e(_0x48777a);});});}exports[_0x2fd3('0x13')]=function(_0x5739f6){var _0x5bf94b=this;return new Promise(function(_0x31f6f2,_0x448561){return db['CmHopper'][_0x2fd3('0x14')]({'raw':!![],'where':{'ContactId':_0x5739f6[_0x2fd3('0x15')][_0x2fd3('0x16')],'ListId':_0x5739f6[_0x2fd3('0x15')][_0x2fd3('0x17')],'VoiceQueueId':_0x5739f6[_0x2fd3('0x15')]['VoiceQueueId']===undefined?null:_0x5739f6[_0x2fd3('0x15')][_0x2fd3('0x18')],'CampaignId':_0x5739f6[_0x2fd3('0x15')]['CampaignId']===undefined?null:_0x5739f6[_0x2fd3('0x15')][_0x2fd3('0x19')]}})[_0x2fd3('0x9')](function(_0x425401){if(_0x425401!=null){return db[_0x2fd3('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x425401['id'],'OrderBy':{'$gt':_0x425401[_0x2fd3('0x1b')]}},'order':[['OrderBy',_0x2fd3('0x1c')]]})[_0x2fd3('0x9')](function(_0x2f10e1){var _0xb1eaef=0x0;if(_0x2f10e1){if(_0x2f10e1[_0x2fd3('0x1d')]+_0x2f10e1[_0x2fd3('0x1e')]+_0x2f10e1['countnoanswerretry']+_0x2f10e1[_0x2fd3('0x1f')]+_0x2f10e1[_0x2fd3('0x20')]+_0x2f10e1[_0x2fd3('0x21')]+_0x2f10e1[_0x2fd3('0x22')]+_0x2f10e1[_0x2fd3('0x23')]<_0x5739f6[_0x2fd3('0x24')][_0x2fd3('0x25')])_0xb1eaef=0x1;_0x31f6f2({'additional':_0xb1eaef});}else{return db[_0x2fd3('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x425401['id']},'order':[[_0x2fd3('0x1b'),_0x2fd3('0x1c')]]})[_0x2fd3('0x9')](function(_0x305a83){var _0x16893d=0x0;if(_0x305a83){if(_0x305a83[_0x2fd3('0x1d')]+_0x305a83['countcongestionretry']+_0x305a83['countnoanswerretry']+_0x305a83['countnosuchnumberretry']+_0x305a83[_0x2fd3('0x20')]+_0x305a83[_0x2fd3('0x21')]+_0x305a83[_0x2fd3('0x22')]+_0x305a83[_0x2fd3('0x23')]<_0x5739f6[_0x2fd3('0x24')][_0x2fd3('0x25')])_0x16893d=0x1;_0x31f6f2({'additional':_0x16893d});}else{_0x31f6f2({'additional':0x0});}})['catch'](function(_0x28ca9d){logger[_0x2fd3('0xf')](_0x2fd3('0x13'),_0x28ca9d[_0x2fd3('0x11')],_0x5739f6);_0x448561(_0x5bf94b['error'](0x1f4,_0x28ca9d[_0x2fd3('0x11')]));});}})[_0x2fd3('0x12')](function(_0x2c35ae){logger[_0x2fd3('0xf')](_0x2fd3('0x13'),_0x2c35ae['message'],_0x5739f6);_0x448561(_0x5bf94b['error'](0x1f4,_0x2c35ae[_0x2fd3('0x11')]));});}else _0x31f6f2({'additional':0x0});});});};exports[_0x2fd3('0x26')]=function(_0x33c607){var _0x33ca56=this;return new Promise(function(_0x4df937,_0x23757f){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x33c607['body'][_0x2fd3('0x16')],'ListId':_0x33c607[_0x2fd3('0x15')]['ListId'],'VoiceQueueId':_0x33c607[_0x2fd3('0x15')]['VoiceQueueId']===undefined?null:_0x33c607[_0x2fd3('0x15')]['VoiceQueueId'],'CampaignId':_0x33c607[_0x2fd3('0x15')][_0x2fd3('0x19')]===undefined?null:_0x33c607['body']['CampaignId']}})[_0x2fd3('0x9')](function(_0xd3cf47){if(_0xd3cf47!=null){return db[_0x2fd3('0x1a')][_0x2fd3('0x14')]({'raw':!![],'where':{'CmHopperId':_0xd3cf47['id'],'OrderBy':{'$gt':_0xd3cf47[_0x2fd3('0x1b')]}},'order':[[_0x2fd3('0x1b'),_0x2fd3('0x1c')]]})[_0x2fd3('0x9')](function(_0x4e0fb7){if(_0x4e0fb7)return activateAdditionalPhone(_0xd3cf47,_0x33c607[_0x2fd3('0x15')],_0x4e0fb7,_0x33c607[_0x2fd3('0x27')],_0x33c607['waitTime'])['then'](function(_0x19b7ad){_0x4df937(_0x19b7ad);});else{return db[_0x2fd3('0x1a')][_0x2fd3('0x14')]({'raw':!![],'where':{'CmHopperId':_0xd3cf47['id']},'order':[[_0x2fd3('0x1b'),'ASC']]})[_0x2fd3('0x9')](function(_0x5e3076){if(_0x5e3076)return activateAdditionalPhone(_0xd3cf47,_0x33c607['body'],_0x5e3076,_0x33c607['duration'],_0x33c607[_0x2fd3('0x28')])['then'](function(_0x10b7a5){_0x4df937(_0x10b7a5);});else{_0x4df937({'id':_0xd3cf47['id'],'phone':''});}})[_0x2fd3('0x12')](function(_0xc73f2c){logger['error']('VerifyAdditionalPhones',_0xc73f2c['message'],_0x33c607);_0x23757f(_0x33ca56['error'](0x1f4,_0xc73f2c[_0x2fd3('0x11')]));});}})[_0x2fd3('0x12')](function(_0x5a9661){logger[_0x2fd3('0xf')](_0x2fd3('0x13'),_0x5a9661[_0x2fd3('0x11')],_0x33c607);_0x23757f(_0x33ca56[_0x2fd3('0xf')](0x1f4,_0x5a9661[_0x2fd3('0x11')]));});}else _0x4df937(0x1);});});};function activateAdditionalPhone(_0x469b0f,_0x242c8a,_0x20fdc3,_0x4257ce,_0x2352f8){return new Promise(function(_0x3f09a9,_0x233505){logger[_0x2fd3('0xa')](_0x2fd3('0x13'),_0x20fdc3);var _0x2181e9;if(moment()>moment(_0x20fdc3[_0x2fd3('0x29')])){_0x2181e9=moment()[_0x2fd3('0x2a')](_0x2352f8||0x3,_0x2fd3('0x2b'));}else{if(_0x20fdc3[_0x2fd3('0x1b')]==0x0){_0x2181e9=moment(_0x20fdc3['scheduledat']);}else{_0x2181e9=moment()['add'](_0x2352f8||0x3,'minutes');}}var _0xecf2d3={'phone':_0x469b0f[_0x2fd3('0x2c')],'active':0x0,'OrderBy':_['isNil'](_0x469b0f[_0x2fd3('0x1b')])?0x0:_0x469b0f['OrderBy'],'scheduledat':moment()[_0x2fd3('0x2a')](_0x4257ce||0x1,_0x2fd3('0x2b')),'countbusyretry':_0x242c8a['countbusyretry'],'countcongestionretry':_0x242c8a[_0x2fd3('0x1e')],'countnoanswerretry':_0x242c8a[_0x2fd3('0x2d')],'countnosuchnumberretry':_0x242c8a[_0x2fd3('0x1f')],'countdropretry':_0x242c8a[_0x2fd3('0x20')],'countabandonedretry':_0x242c8a[_0x2fd3('0x21')],'countmachineretry':_0x242c8a[_0x2fd3('0x22')],'countagentrejectretry':_0x242c8a[_0x2fd3('0x23')],'createdAt':_0x242c8a[_0x2fd3('0x2e')],'updatedAt':_0x242c8a[_0x2fd3('0x2f')]};var _0x5f1a46={'CmHopperId':_0x469b0f['id'],'phone':_0x20fdc3[_0x2fd3('0x2c')],'active':0x0,'OrderBy':_[_0x2fd3('0x30')](_0x20fdc3[_0x2fd3('0x1b')])?0x0:_0x20fdc3[_0x2fd3('0x1b')],'scheduledat':_0x2181e9,'countbusyretry':_0x20fdc3[_0x2fd3('0x1d')],'countcongestionretry':_0x20fdc3[_0x2fd3('0x1e')],'countnoanswerretry':_0x20fdc3[_0x2fd3('0x2d')],'countnosuchnumberretry':_0x242c8a['countnosuchnumberretry'],'countdropretry':_0x242c8a[_0x2fd3('0x20')],'countabandonedretry':_0x242c8a['countabandonedretry'],'countmachineretry':_0x242c8a['countmachineretry'],'countagentrejectretry':_0x242c8a[_0x2fd3('0x23')],'createdAt':_0x20fdc3[_0x2fd3('0x2e')],'updatedAt':_0x20fdc3[_0x2fd3('0x2f')]};logger[_0x2fd3('0xa')]('hopperToAdd',_0xecf2d3);logger[_0x2fd3('0xa')](_0x2fd3('0x31'),_0x5f1a46);return db[_0x2fd3('0x32')][_0x2fd3('0x33')](function(_0x3b0dab){return db[_0x2fd3('0x1a')][_0x2fd3('0x34')](_0xecf2d3,{'where':{'id':_0x20fdc3['id']}},{'transaction':_0x3b0dab})['then'](function(){return db[_0x2fd3('0x35')][_0x2fd3('0x34')](_0x5f1a46,{'where':{'id':_0x469b0f['id']}},{'transaction':_0x3b0dab});});})['then'](function(_0x4af106){_0x3f09a9({'id':_0x469b0f['id'],'phone':_0x20fdc3[_0x2fd3('0x2c')]});})[_0x2fd3('0x12')](function(_0x50c0a9){logger[_0x2fd3('0xf')]('VerifyAdditionalPhones',_0x50c0a9['message'],req);_0x233505(_this['error'](0x1f4,_0x50c0a9[_0x2fd3('0x11')]));});});}exports[_0x2fd3('0x36')]=function(_0x559d52){var _0x5d60f5=this;return new Promise(function(_0x346762,_0x22e5b9){return db[_0x2fd3('0x35')][_0x2fd3('0x34')](_0x559d52[_0x2fd3('0x15')][_0x2fd3('0x37')],{'where':{'id':_0x559d52[_0x2fd3('0x15')]['id']}})[_0x2fd3('0x9')](function(_0x31da49){_0x346762(_0x31da49);})[_0x2fd3('0x12')](function(_0x21f8d7){logger[_0x2fd3('0xf')](_0x2fd3('0x36'),_0x21f8d7['message'],_0x559d52);_0x22e5b9(_0x5d60f5[_0x2fd3('0xf')](0x1f4,_0x21f8d7['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 1a60a81..52f8309 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 _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 +var _0xb910=['get','index','/:id','isAuthenticated','post','create','put','update','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller'];(function(_0x55de0e,_0x225c8b){var _0x2faa2f=function(_0x2708da){while(--_0x2708da){_0x55de0e['push'](_0x55de0e['shift']());}};_0x2faa2f(++_0x225c8b);}(_0xb910,0x1b2));var _0x0b91=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xb910[_0x122096];return _0x3d1966;};'use strict';var multer=require(_0x0b91('0x0'));var util=require('util');var path=require(_0x0b91('0x1'));var timeout=require(_0x0b91('0x2'));var express=require(_0x0b91('0x3'));var router=express[_0x0b91('0x4')]();var auth=require(_0x0b91('0x5'));var interaction=require(_0x0b91('0x6'));var config=require('../../config/environment');var controller=require(_0x0b91('0x7'));router[_0x0b91('0x8')]('/',auth['isAuthenticated'](),controller[_0x0b91('0x9')]);router[_0x0b91('0x8')](_0x0b91('0xa'),auth[_0x0b91('0xb')](),controller['show']);router[_0x0b91('0xc')]('/',auth[_0x0b91('0xb')](),controller[_0x0b91('0xd')]);router[_0x0b91('0xe')](_0x0b91('0xa'),auth[_0x0b91('0xb')](),controller[_0x0b91('0xf')]);router['delete'](_0x0b91('0xa'),auth[_0x0b91('0xb')](),controller[_0x0b91('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 741d4e2..db971a7 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 _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 +var _0x8211=['contactListQueue','INTEGER','moment','exports'];(function(_0x568c27,_0x125911){var _0x289d92=function(_0x9476c5){while(--_0x9476c5){_0x568c27['push'](_0x568c27['shift']());}};_0x289d92(++_0x125911);}(_0x8211,0x10e));var _0x1821=function(_0x12e7c3,_0x2fe24b){_0x12e7c3=_0x12e7c3-0x0;var _0x148ea6=_0x8211[_0x12e7c3];return _0x148ea6;};'use strict';var moment=require(_0x1821('0x0'));var Sequelize=require('sequelize');module[_0x1821('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x1821('0x2')},'ListId':{'type':Sequelize[_0x1821('0x3')],'unique':_0x1821('0x2')},'VoiceQueueId':{'type':Sequelize[_0x1821('0x3')],'unique':_0x1821('0x2')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index c9b0c28..cf8a5c6 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 _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 +var _0xd61d=['length','hasOwnProperty','order','sort','filters','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','keys','find','body','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','sox','ejs','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','status','end','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','index','map','CmHopperBlack','type','query','model','attributes','intersection','fields'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd61d,0x14f));var _0xdd61=function(_0x5142ec,_0x4e1ac7){_0x5142ec=_0x5142ec-0x0;var _0x3572d0=_0xd61d[_0x5142ec];return _0x3572d0;};'use strict';var pdf=require(_0xdd61('0x0'));var emlformat=require(_0xdd61('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdd61('0x2'));var rp=require(_0xdd61('0x3'));var moment=require(_0xdd61('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdd61('0x5'));var util=require('util');var path=require('path');var sox=require(_0xdd61('0x6'));var csv=require('to-csv');var ejs=require(_0xdd61('0x7'));var fs=require('fs');var _=require(_0xdd61('0x8'));var squel=require(_0xdd61('0x9'));var crypto=require(_0xdd61('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xdd61('0xb'));var toCsv=require(_0xdd61('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdd61('0xd'));var authService=require(_0xdd61('0xe'));var qs=require(_0xdd61('0xf'));var as=require(_0xdd61('0x10'));var hardwareService=require(_0xdd61('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xdd61('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xdd61('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc8754b,_0xe1e621){_0xe1e621=_0xe1e621||0xcc;return function(_0x11d1df){if(_0x11d1df){return _0xc8754b['sendStatus'](_0xe1e621);}return _0xc8754b[_0xdd61('0x14')](_0xe1e621)[_0xdd61('0x15')]();};}function respondWithResult(_0x165edc,_0x7d14fc){_0x7d14fc=_0x7d14fc||0xc8;return function(_0x4c49c3){if(_0x4c49c3){return _0x165edc[_0xdd61('0x14')](_0x7d14fc)['json'](_0x4c49c3);}};}function respondWithFilteredResult(_0x2c23ce,_0x287d30){return function(_0x17bedd){if(_0x17bedd){var _0xa24786=_0x17bedd[_0xdd61('0x16')],_0x4df930=_0x287d30[_0xdd61('0x17')],_0x727d9c=_0x287d30[_0xdd61('0x17')]+_0x287d30[_0xdd61('0x18')],_0xcc368b;if(_0x727d9c>=_0xa24786){_0x727d9c=_0xa24786;_0xcc368b=0xc8;}else{_0xcc368b=0xce;}_0x2c23ce[_0xdd61('0x14')](_0xcc368b);return _0x2c23ce[_0xdd61('0x19')]('Content-Range',_0x4df930+'-'+_0x727d9c+'/'+_0xa24786)['json'](_0x17bedd);}return null;};}function patchUpdates(_0x204fdb){return function(_0x52dfb9){try{jsonpatch[_0xdd61('0x1a')](_0x52dfb9,_0x204fdb,!![]);}catch(_0x5a785a){return BPromise['reject'](_0x5a785a);}return _0x52dfb9[_0xdd61('0x1b')]();};}function saveUpdates(_0x660d8,_0x319b4d){return function(_0x129037){if(_0x129037){return _0x129037[_0xdd61('0x1c')](_0x660d8)[_0xdd61('0x1d')](function(_0x22ba7f){return _0x22ba7f;});}return null;};}function removeEntity(_0x5ab9d1,_0x2ddacb){return function(_0x1643ae){if(_0x1643ae){return _0x1643ae[_0xdd61('0x1e')]()[_0xdd61('0x1d')](function(){_0x5ab9d1['status'](0xcc)[_0xdd61('0x15')]();});}};}function handleEntityNotFound(_0x2b64f1,_0x41994d){return function(_0x314555){if(!_0x314555){_0x2b64f1['sendStatus'](0x194);}return _0x314555;};}function handleError(_0x18b2ff,_0x5cd95d){_0x5cd95d=_0x5cd95d||0x1f4;return function(_0x3c8bc6){logger[_0xdd61('0x1f')](_0x3c8bc6[_0xdd61('0x20')]);if(_0x3c8bc6[_0xdd61('0x21')]){delete _0x3c8bc6[_0xdd61('0x21')];}_0x18b2ff[_0xdd61('0x14')](_0x5cd95d)['send'](_0x3c8bc6);};}exports[_0xdd61('0x22')]=function(_0x25055f,_0x35451b){var _0x336795={},_0x48b506={},_0x4d0dae={'count':0x0,'rows':[]};var _0xc9e031=_[_0xdd61('0x23')](db[_0xdd61('0x24')]['rawAttributes'],function(_0x5b8178){return{'name':_0x5b8178['fieldName'],'type':_0x5b8178[_0xdd61('0x25')]['key']};});_0x48b506['model']=_['map'](_0xc9e031,'name');_0x48b506[_0xdd61('0x26')]=_['keys'](_0x25055f[_0xdd61('0x26')]);_0x48b506['filters']=_['intersection'](_0x48b506[_0xdd61('0x27')],_0x48b506['query']);_0x336795[_0xdd61('0x28')]=_[_0xdd61('0x29')](_0x48b506['model'],qs['fields'](_0x25055f['query'][_0xdd61('0x2a')]));_0x336795['attributes']=_0x336795[_0xdd61('0x28')][_0xdd61('0x2b')]?_0x336795[_0xdd61('0x28')]:_0x48b506[_0xdd61('0x27')];if(!_0x25055f['query'][_0xdd61('0x2c')]('nolimit')){_0x336795[_0xdd61('0x18')]=qs['limit'](_0x25055f[_0xdd61('0x26')][_0xdd61('0x18')]);_0x336795[_0xdd61('0x17')]=qs[_0xdd61('0x17')](_0x25055f['query'][_0xdd61('0x17')]);}_0x336795[_0xdd61('0x2d')]=qs['sort'](_0x25055f[_0xdd61('0x26')][_0xdd61('0x2e')]);_0x336795['where']=qs[_0xdd61('0x2f')](_['pick'](_0x25055f[_0xdd61('0x26')],_0x48b506[_0xdd61('0x2f')]),_0xc9e031);if(_0x25055f[_0xdd61('0x26')][_0xdd61('0x30')]){_0x336795[_0xdd61('0x31')]=_[_0xdd61('0x32')](_0x336795[_0xdd61('0x31')],{'$or':_[_0xdd61('0x23')](_0xc9e031,function(_0x480a26){if(_0x480a26['type']!=='VIRTUAL'){var _0x28d758={};_0x28d758[_0x480a26['name']]={'$like':'%'+_0x25055f['query'][_0xdd61('0x30')]+'%'};return _0x28d758;}})});}_0x336795=_[_0xdd61('0x32')]({},_0x336795,_0x25055f[_0xdd61('0x33')]);var _0x109862={'where':_0x336795['where']};return db[_0xdd61('0x24')][_0xdd61('0x16')](_0x109862)[_0xdd61('0x1d')](function(_0x5623a5){_0x4d0dae[_0xdd61('0x16')]=_0x5623a5;if(_0x25055f[_0xdd61('0x26')][_0xdd61('0x34')]){_0x336795['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xdd61('0x35')](_0x336795);})['then'](function(_0x2e3442){_0x4d0dae[_0xdd61('0x36')]=_0x2e3442;return _0x4d0dae;})[_0xdd61('0x1d')](respondWithFilteredResult(_0x35451b,_0x336795))[_0xdd61('0x37')](handleError(_0x35451b,null));};exports[_0xdd61('0x38')]=function(_0x4e2f21,_0x258c31){var _0x193f80={'raw':!![],'where':{'id':_0x4e2f21[_0xdd61('0x39')]['id']}},_0x33ea0f={};_0x33ea0f[_0xdd61('0x27')]=_['keys'](db[_0xdd61('0x24')][_0xdd61('0x3a')]);_0x33ea0f[_0xdd61('0x26')]=_[_0xdd61('0x3b')](_0x4e2f21[_0xdd61('0x26')]);_0x33ea0f['filters']=_[_0xdd61('0x29')](_0x33ea0f['model'],_0x33ea0f[_0xdd61('0x26')]);_0x193f80[_0xdd61('0x28')]=_[_0xdd61('0x29')](_0x33ea0f['model'],qs[_0xdd61('0x2a')](_0x4e2f21[_0xdd61('0x26')][_0xdd61('0x2a')]));_0x193f80[_0xdd61('0x28')]=_0x193f80[_0xdd61('0x28')][_0xdd61('0x2b')]?_0x193f80[_0xdd61('0x28')]:_0x33ea0f[_0xdd61('0x27')];if(_0x4e2f21[_0xdd61('0x26')][_0xdd61('0x34')]){_0x193f80['include']=[{'all':!![]}];}_0x193f80=_['merge']({},_0x193f80,_0x4e2f21[_0xdd61('0x33')]);return db[_0xdd61('0x24')][_0xdd61('0x3c')](_0x193f80)[_0xdd61('0x1d')](handleEntityNotFound(_0x258c31,null))[_0xdd61('0x1d')](respondWithResult(_0x258c31,null))[_0xdd61('0x37')](handleError(_0x258c31,null));};exports['update']=function(_0x4dd7ca,_0x5cdfe9){if(_0x4dd7ca[_0xdd61('0x3d')]['id']){delete _0x4dd7ca[_0xdd61('0x3d')]['id'];}return db[_0xdd61('0x24')][_0xdd61('0x3c')]({'where':{'id':_0x4dd7ca[_0xdd61('0x39')]['id']}})[_0xdd61('0x1d')](handleEntityNotFound(_0x5cdfe9,null))['then'](saveUpdates(_0x4dd7ca['body'],null))[_0xdd61('0x1d')](respondWithResult(_0x5cdfe9,null))[_0xdd61('0x37')](handleError(_0x5cdfe9,null));};exports[_0xdd61('0x1e')]=function(_0x5b5132,_0x3fb259){return db['CmHopperBlack'][_0xdd61('0x3c')]({'where':{'id':_0x5b5132[_0xdd61('0x39')]['id']}})[_0xdd61('0x1d')](handleEntityNotFound(_0x3fb259,null))[_0xdd61('0x1d')](removeEntity(_0x3fb259,null))[_0xdd61('0x37')](handleError(_0x3fb259,null));};exports[_0xdd61('0x3e')]=function(_0x38f892,_0x5a1e32){return db[_0xdd61('0x24')][_0xdd61('0x3e')]()[_0xdd61('0x1d')](respondWithResult(_0x5a1e32,null))[_0xdd61('0x37')](handleError(_0x5a1e32,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 155dd67..83879b4 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 _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 +var _0xdce4=['rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','api','moment','request-promise','path'];(function(_0x53eff4,_0x55b2c0){var _0x1fa828=function(_0x50da64){while(--_0x50da64){_0x53eff4['push'](_0x53eff4['shift']());}};_0x1fa828(++_0x55b2c0);}(_0xdce4,0xc7));var _0x4dce=function(_0x337a5e,_0x4e13ee){_0x337a5e=_0x337a5e-0x0;var _0x1c0f76=_0xdce4[_0x337a5e];return _0x1c0f76;};'use strict';var _=require(_0x4dce('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4dce('0x1'));var moment=require(_0x4dce('0x2'));var BPromise=require('bluebird');var rp=require(_0x4dce('0x3'));var fs=require('fs');var path=require(_0x4dce('0x4'));var rimraf=require(_0x4dce('0x5'));var config=require(_0x4dce('0x6'));var attributes=require(_0x4dce('0x7'));module[_0x4dce('0x8')]=function(_0xcab864,_0x116d42){return _0xcab864[_0x4dce('0x9')](_0x4dce('0xa'),attributes,{'tableName':_0x4dce('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 5550109..3b42951 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 _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 +var _0xbae7=['client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','body','DestroyCmHopperBlack','CmHopperBlack','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x37fd42,_0x9fb5f7){var _0x24e1f8=function(_0x1be4d2){while(--_0x1be4d2){_0x37fd42['push'](_0x37fd42['shift']());}};_0x24e1f8(++_0x9fb5f7);}(_0xbae7,0x6a));var _0x7bae=function(_0xee397d,_0x5cf526){_0xee397d=_0xee397d-0x0;var _0x1ec970=_0xbae7[_0xee397d];return _0x1ec970;};'use strict';var _=require(_0x7bae('0x0'));var util=require(_0x7bae('0x1'));var moment=require('moment');var BPromise=require(_0x7bae('0x2'));var rs=require(_0x7bae('0x3'));var fs=require('fs');var Redis=require(_0x7bae('0x4'));var db=require(_0x7bae('0x5'))['db'];var utils=require(_0x7bae('0x6'));var logger=require(_0x7bae('0x7'))(_0x7bae('0x8'));var config=require(_0x7bae('0x9'));var jayson=require(_0x7bae('0xa'));var client=jayson[_0x7bae('0xb')][_0x7bae('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x193adf,_0x5a0ede,_0x1cde49){return new BPromise(function(_0x217369,_0x50c3c0){return client[_0x7bae('0xd')](_0x193adf,_0x1cde49)[_0x7bae('0xe')](function(_0x56994c){logger['info'](_0x7bae('0xf'),_0x5a0ede,_0x7bae('0x10'));logger[_0x7bae('0x11')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x5a0ede,_0x7bae('0x10'),JSON[_0x7bae('0x12')](_0x56994c));if(_0x56994c['error']){if(_0x56994c['error'][_0x7bae('0x13')]===0x1f4){logger[_0x7bae('0x14')](_0x7bae('0xf'),_0x5a0ede,_0x56994c[_0x7bae('0x14')]['message']);return _0x50c3c0(_0x56994c[_0x7bae('0x14')][_0x7bae('0x15')]);}logger[_0x7bae('0x14')](_0x7bae('0xf'),_0x5a0ede,_0x56994c[_0x7bae('0x14')][_0x7bae('0x15')]);return _0x217369(_0x56994c['error']['message']);}else{logger[_0x7bae('0x16')](_0x7bae('0xf'),_0x5a0ede,_0x7bae('0x10'));_0x217369(_0x56994c[_0x7bae('0x17')]['message']);}})[_0x7bae('0x18')](function(_0x1048dd){logger[_0x7bae('0x14')](_0x7bae('0xf'),_0x5a0ede,_0x1048dd);_0x50c3c0(_0x1048dd);});});}exports['GetCmHopperBlack']=function(_0x21efa8){var _0x5790ca=this;return new Promise(function(_0x7d862a,_0x3f6009){return db['CmHopperBlack'][_0x7bae('0x19')]({'raw':_0x21efa8[_0x7bae('0x1a')]?_0x21efa8[_0x7bae('0x1a')][_0x7bae('0x1b')]===undefined?!![]:![]:!![],'where':_0x21efa8[_0x7bae('0x1a')]?_0x21efa8['options'][_0x7bae('0x1c')]||null:null,'attributes':_0x21efa8[_0x7bae('0x1a')]?_0x21efa8['options'][_0x7bae('0x1d')]||null:null,'limit':_0x21efa8[_0x7bae('0x1a')]?_0x21efa8[_0x7bae('0x1a')][_0x7bae('0x1e')]||null:null,'include':_0x21efa8[_0x7bae('0x1a')]?_0x21efa8[_0x7bae('0x1a')][_0x7bae('0x1f')]?_[_0x7bae('0x20')](_0x21efa8[_0x7bae('0x1a')][_0x7bae('0x1f')],function(_0x571d46){return{'model':db[_0x571d46[_0x7bae('0x21')]],'as':_0x571d46['as'],'attributes':_0x571d46['attributes'],'include':_0x571d46[_0x7bae('0x1f')]?_[_0x7bae('0x20')](_0x571d46[_0x7bae('0x1f')],function(_0x393745){return{'model':db[_0x393745[_0x7bae('0x21')]],'as':_0x393745['as'],'attributes':_0x393745[_0x7bae('0x1d')],'include':_0x393745[_0x7bae('0x1f')]?_[_0x7bae('0x20')](_0x393745[_0x7bae('0x1f')],function(_0xa9567a){return{'model':db[_0xa9567a['model']],'as':_0xa9567a['as'],'attributes':_0xa9567a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7bae('0xe')](function(_0x34f1f4){logger[_0x7bae('0x16')](_0x7bae('0x22'),_0x21efa8);logger[_0x7bae('0x11')](_0x7bae('0x22'),_0x21efa8,JSON[_0x7bae('0x12')](_0x34f1f4));_0x7d862a(_0x34f1f4);})[_0x7bae('0x18')](function(_0x17bb11){logger[_0x7bae('0x14')](_0x7bae('0x22'),_0x17bb11[_0x7bae('0x15')],_0x21efa8);_0x3f6009(_0x5790ca['error'](0x1f4,_0x17bb11[_0x7bae('0x15')]));});});};exports[_0x7bae('0x23')]=function(_0x43c21d){var _0x459fec=this;return new Promise(function(_0x4bec22,_0x2f2a7e){return db['CmHopperBlack']['update'](_0x43c21d[_0x7bae('0x24')],{'raw':_0x43c21d[_0x7bae('0x1a')]?_0x43c21d['options'][_0x7bae('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43c21d[_0x7bae('0x1a')]?_0x43c21d[_0x7bae('0x1a')][_0x7bae('0x1c')]||null:null,'attributes':_0x43c21d['options']?_0x43c21d['options']['attributes']||null:null,'limit':_0x43c21d['options']?_0x43c21d[_0x7bae('0x1a')][_0x7bae('0x1e')]||null:null})['then'](function(_0x2239ee){logger[_0x7bae('0x16')](_0x7bae('0x23'),_0x43c21d);logger[_0x7bae('0x11')]('UpdateCmHopperBlack',_0x43c21d,JSON[_0x7bae('0x12')](_0x2239ee));_0x4bec22(_0x2239ee);})[_0x7bae('0x18')](function(_0x19e034){logger['error'](_0x7bae('0x23'),_0x19e034['message'],_0x43c21d);_0x2f2a7e(_0x459fec[_0x7bae('0x14')](0x1f4,_0x19e034[_0x7bae('0x15')]));});});};exports[_0x7bae('0x25')]=function(_0xae0c2f){var _0x16ffb4=this;return new Promise(function(_0x51dbc6,_0x314645){return db[_0x7bae('0x26')]['destroy']({'where':_0xae0c2f[_0x7bae('0x1a')]?_0xae0c2f['options'][_0x7bae('0x1c')]||null:null})['then'](function(_0x33221c){logger[_0x7bae('0x16')](_0x7bae('0x25'),_0xae0c2f);logger['debug'](_0x7bae('0x25'),_0xae0c2f,JSON[_0x7bae('0x12')](_0x33221c));_0x51dbc6(_0x33221c);})[_0x7bae('0x18')](function(_0x349158){logger[_0x7bae('0x14')]('DestroyCmHopperBlack',_0x349158[_0x7bae('0x15')],_0xae0c2f);_0x314645(_0x16ffb4['error'](0x1f4,_0x349158[_0x7bae('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index dc2fe0f..b648b84 100644 --- a/server/api/cmHopperBlack/index.js +++ b/server/api/cmHopperBlack/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81bd=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','show','put','/:id'];(function(_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 +var _0x4bc3=['get','isAuthenticated','index','/describe','/:id','show','put','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller'];(function(_0x22202a,_0x40272c){var _0x4fa680=function(_0x403b45){while(--_0x403b45){_0x22202a['push'](_0x22202a['shift']());}};_0x4fa680(++_0x40272c);}(_0x4bc3,0x16e));var _0x34bc=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x4bc3[_0x2064e5];return _0x21a233;};'use strict';var multer=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require('path');var timeout=require(_0x34bc('0x2'));var express=require(_0x34bc('0x3'));var router=express['Router']();var auth=require(_0x34bc('0x4'));var interaction=require(_0x34bc('0x5'));var config=require(_0x34bc('0x6'));var controller=require(_0x34bc('0x7'));router[_0x34bc('0x8')]('/',auth[_0x34bc('0x9')](),controller[_0x34bc('0xa')]);router['get'](_0x34bc('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x34bc('0x8')](_0x34bc('0xc'),auth[_0x34bc('0x9')](),controller[_0x34bc('0xd')]);router[_0x34bc('0xe')](_0x34bc('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x34bc('0xf')](_0x34bc('0xc'),auth[_0x34bc('0x9')](),controller['destroy']);module[_0x34bc('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 56acb12..ef98a6d 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 _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 +var _0xdedc=['followuptime','diff','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','setDataValue'];(function(_0x445c98,_0x132bf7){var _0x2fe913=function(_0x32e864){while(--_0x32e864){_0x445c98['push'](_0x445c98['shift']());}};_0x2fe913(++_0x132bf7);}(_0xdedc,0xb8));var _0xcded=function(_0xfdd6b6,_0x19497a){_0xfdd6b6=_0xfdd6b6-0x0;var _0x464439=_0xdedc[_0xfdd6b6];return _0x464439;};'use strict';var Sequelize=require(_0xcded('0x0'));var moment=require(_0xcded('0x1'));module[_0xcded('0x2')]={'state':{'type':Sequelize[_0xcded('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xcded('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xcded('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcded('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xcded('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xcded('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xcded('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xcded('0x4')]},'calleridname':{'type':Sequelize[_0xcded('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xcded('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xcded('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xcded('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xcded('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xcded('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xcded('0x4')]},'membername':{'type':Sequelize[_0xcded('0x4')]},'reason':{'type':Sequelize[_0xcded('0x4')]},'disposition':{'type':Sequelize[_0xcded('0x4')]},'secondDisposition':{'type':Sequelize[_0xcded('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xcded('0x5')],'set':function(_0x20ea13){var _0x42c214=this[_0xcded('0x6')]('endtime');if(_0x42c214&&_0x20ea13){this[_0xcded('0x7')](_0xcded('0x8'),moment(_0x20ea13)[_0xcded('0x9')](moment(_0x42c214),'seconds'));}return this[_0xcded('0x7')](_0xcded('0xa'),_0x20ea13);}},'amd':{'type':Sequelize[_0xcded('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xcded('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xcded('0x5')]},'callback':{'type':Sequelize[_0xcded('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcded('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xcded('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xcded('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xcded('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcded('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcded('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 3ff510f..564bc4f 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 _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 +var _0x0e9f=['scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','updatedAt','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','findOne','html-pdf','eml-format','fast-json-patch','bluebird','path','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','apply','save','then','destroy','error','stack','name','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','params','include','find','catch','describe','update','body','uniqueid','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','literal','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','ContactId','VoiceQueueId','createdAt','field','ANY_VALUE(calleridnum)','NOW()'];(function(_0x825c1c,_0x9119ef){var _0x1baa74=function(_0x54d220){while(--_0x54d220){_0x825c1c['push'](_0x825c1c['shift']());}};_0x1baa74(++_0x9119ef);}(_0x0e9f,0x116));var _0xf0e9=function(_0x1e5b67,_0x1aacd7){_0x1e5b67=_0x1e5b67-0x0;var _0x1fe947=_0x0e9f[_0x1e5b67];return _0x1fe947;};'use strict';var pdf=require(_0xf0e9('0x0'));var emlformat=require(_0xf0e9('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf0e9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0e9('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf0e9('0x4'));var sox=require(_0xf0e9('0x5'));var csv=require('to-csv');var ejs=require(_0xf0e9('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf0e9('0x7'));var crypto=require(_0xf0e9('0x8'));var jsforce=require(_0xf0e9('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf0e9('0xa'));var Papa=require(_0xf0e9('0xb'));var Redis=require(_0xf0e9('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xf0e9('0xd'));var as=require(_0xf0e9('0xe'));var hardwareService=require(_0xf0e9('0xf'));var logger=require('../../config/logger')(_0xf0e9('0x10'));var utils=require(_0xf0e9('0x11'));var config=require(_0xf0e9('0x12'));var licenseUtil=require(_0xf0e9('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa9d7e3,_0x541cd6){_0x541cd6=_0x541cd6||0xcc;return function(_0x1461af){if(_0x1461af){return _0xa9d7e3[_0xf0e9('0x14')](_0x541cd6);}return _0xa9d7e3['status'](_0x541cd6)[_0xf0e9('0x15')]();};}function respondWithResult(_0x34ebf1,_0x261100){_0x261100=_0x261100||0xc8;return function(_0x1b87cf){if(_0x1b87cf){return _0x34ebf1[_0xf0e9('0x16')](_0x261100)[_0xf0e9('0x17')](_0x1b87cf);}};}function respondWithFilteredResult(_0x5c7787,_0x933fea){return function(_0x1eb36f){if(_0x1eb36f){var _0x4f37b5=_0x1eb36f[_0xf0e9('0x18')],_0x320a29=_0x933fea['offset'],_0xcf4be0=_0x933fea[_0xf0e9('0x19')]+_0x933fea[_0xf0e9('0x1a')],_0x3d0b4d;if(_0xcf4be0>=_0x4f37b5){_0xcf4be0=_0x4f37b5;_0x3d0b4d=0xc8;}else{_0x3d0b4d=0xce;}_0x5c7787[_0xf0e9('0x16')](_0x3d0b4d);return _0x5c7787[_0xf0e9('0x1b')]('Content-Range',_0x320a29+'-'+_0xcf4be0+'/'+_0x4f37b5)['json'](_0x1eb36f);}return null;};}function patchUpdates(_0x360f8b){return function(_0x98bb88){try{jsonpatch[_0xf0e9('0x1c')](_0x98bb88,_0x360f8b,!![]);}catch(_0x49c120){return BPromise['reject'](_0x49c120);}return _0x98bb88[_0xf0e9('0x1d')]();};}function saveUpdates(_0x1ac91f,_0x4992c5){return function(_0x3d6c12){if(_0x3d6c12){return _0x3d6c12['update'](_0x1ac91f)[_0xf0e9('0x1e')](function(_0x1c956d){return _0x1c956d;});}return null;};}function removeEntity(_0x4afcff,_0x5dd652){return function(_0x186fa5){if(_0x186fa5){return _0x186fa5[_0xf0e9('0x1f')]()['then'](function(){_0x4afcff[_0xf0e9('0x16')](0xcc)[_0xf0e9('0x15')]();});}};}function handleEntityNotFound(_0x52612e,_0x2f44ee){return function(_0x2a31fc){if(!_0x2a31fc){_0x52612e['sendStatus'](0x194);}return _0x2a31fc;};}function handleError(_0x297936,_0x423dd1){_0x423dd1=_0x423dd1||0x1f4;return function(_0x9acc21){logger[_0xf0e9('0x20')](_0x9acc21[_0xf0e9('0x21')]);if(_0x9acc21[_0xf0e9('0x22')]){delete _0x9acc21[_0xf0e9('0x22')];}_0x297936['status'](_0x423dd1)['send'](_0x9acc21);};}exports[_0xf0e9('0x23')]=function(_0x4f9e96,_0x553788){var _0x5aac7f={},_0x8b5167={},_0x8fd443={'count':0x0,'rows':[]};var _0x5620a5=_[_0xf0e9('0x24')](db[_0xf0e9('0x25')][_0xf0e9('0x26')],function(_0x480b7d){return{'name':_0x480b7d[_0xf0e9('0x27')],'type':_0x480b7d[_0xf0e9('0x28')][_0xf0e9('0x29')]};});_0x8b5167[_0xf0e9('0x2a')]=_[_0xf0e9('0x24')](_0x5620a5,_0xf0e9('0x22'));_0x8b5167[_0xf0e9('0x2b')]=_[_0xf0e9('0x2c')](_0x4f9e96['query']);_0x8b5167[_0xf0e9('0x2d')]=_[_0xf0e9('0x2e')](_0x8b5167['model'],_0x8b5167['query']);_0x5aac7f[_0xf0e9('0x2f')]=_[_0xf0e9('0x2e')](_0x8b5167['model'],qs[_0xf0e9('0x30')](_0x4f9e96[_0xf0e9('0x2b')][_0xf0e9('0x30')]));_0x5aac7f[_0xf0e9('0x2f')]=_0x5aac7f[_0xf0e9('0x2f')][_0xf0e9('0x31')]?_0x5aac7f[_0xf0e9('0x2f')]:_0x8b5167[_0xf0e9('0x2a')];if(!_0x4f9e96['query'][_0xf0e9('0x32')](_0xf0e9('0x33'))){_0x5aac7f['limit']=qs[_0xf0e9('0x1a')](_0x4f9e96['query'][_0xf0e9('0x1a')]);_0x5aac7f['offset']=qs['offset'](_0x4f9e96[_0xf0e9('0x2b')][_0xf0e9('0x19')]);}_0x5aac7f[_0xf0e9('0x34')]=qs[_0xf0e9('0x35')](_0x4f9e96[_0xf0e9('0x2b')][_0xf0e9('0x35')]);_0x5aac7f['where']=qs[_0xf0e9('0x2d')](_[_0xf0e9('0x36')](_0x4f9e96[_0xf0e9('0x2b')],_0x8b5167['filters']),_0x5620a5);if(_0x4f9e96[_0xf0e9('0x2b')][_0xf0e9('0x37')]){_0x5aac7f[_0xf0e9('0x38')]=_[_0xf0e9('0x39')](_0x5aac7f[_0xf0e9('0x38')],{'$or':_[_0xf0e9('0x24')](_0x5620a5,function(_0xd20a18){if(_0xd20a18[_0xf0e9('0x28')]!==_0xf0e9('0x3a')){var _0x346250={};_0x346250[_0xd20a18['name']]={'$like':'%'+_0x4f9e96[_0xf0e9('0x2b')][_0xf0e9('0x37')]+'%'};return _0x346250;}})});}_0x5aac7f=_['merge']({},_0x5aac7f,_0x4f9e96[_0xf0e9('0x3b')]);var _0x36c0e0={'where':_0x5aac7f[_0xf0e9('0x38')]};return db[_0xf0e9('0x25')][_0xf0e9('0x18')](_0x36c0e0)['then'](function(_0xc5ab58){_0x8fd443[_0xf0e9('0x18')]=_0xc5ab58;if(_0x4f9e96['query'][_0xf0e9('0x3c')]){_0x5aac7f['include']=[{'all':!![]}];}return db[_0xf0e9('0x25')]['findAll'](_0x5aac7f);})[_0xf0e9('0x1e')](function(_0xf7c1b5){_0x8fd443['rows']=_0xf7c1b5;return _0x8fd443;})[_0xf0e9('0x1e')](respondWithFilteredResult(_0x553788,_0x5aac7f))['catch'](handleError(_0x553788,null));};exports['show']=function(_0x4bad5b,_0x3935d8){var _0x36d96e={'raw':!![],'where':{'id':_0x4bad5b[_0xf0e9('0x3d')]['id']}},_0x13975e={};_0x13975e['model']=_[_0xf0e9('0x2c')](db[_0xf0e9('0x25')]['rawAttributes']);_0x13975e['query']=_[_0xf0e9('0x2c')](_0x4bad5b[_0xf0e9('0x2b')]);_0x13975e[_0xf0e9('0x2d')]=_[_0xf0e9('0x2e')](_0x13975e[_0xf0e9('0x2a')],_0x13975e['query']);_0x36d96e[_0xf0e9('0x2f')]=_[_0xf0e9('0x2e')](_0x13975e[_0xf0e9('0x2a')],qs[_0xf0e9('0x30')](_0x4bad5b[_0xf0e9('0x2b')][_0xf0e9('0x30')]));_0x36d96e[_0xf0e9('0x2f')]=_0x36d96e['attributes'][_0xf0e9('0x31')]?_0x36d96e[_0xf0e9('0x2f')]:_0x13975e[_0xf0e9('0x2a')];if(_0x4bad5b[_0xf0e9('0x2b')]['includeAll']){_0x36d96e[_0xf0e9('0x3e')]=[{'all':!![]}];}_0x36d96e=_[_0xf0e9('0x39')]({},_0x36d96e,_0x4bad5b[_0xf0e9('0x3b')]);return db['CmHopperFinal'][_0xf0e9('0x3f')](_0x36d96e)[_0xf0e9('0x1e')](handleEntityNotFound(_0x3935d8,null))[_0xf0e9('0x1e')](respondWithResult(_0x3935d8,null))[_0xf0e9('0x40')](handleError(_0x3935d8,null));};exports[_0xf0e9('0x41')]=function(_0xe3a44f,_0x25f741){return db[_0xf0e9('0x25')][_0xf0e9('0x41')]()[_0xf0e9('0x1e')](respondWithResult(_0x25f741,null))[_0xf0e9('0x40')](handleError(_0x25f741,null));};exports[_0xf0e9('0x42')]=function(_0x317419,_0x26ea90){if(_0x317419[_0xf0e9('0x43')][_0xf0e9('0x44')]){delete _0x317419[_0xf0e9('0x43')][_0xf0e9('0x44')];}return db[_0xf0e9('0x25')][_0xf0e9('0x3f')]({'where':{'uniqueid':_0x317419[_0xf0e9('0x3d')]['id']}})[_0xf0e9('0x1e')](handleEntityNotFound(_0x26ea90,null))[_0xf0e9('0x1e')](saveUpdates(_0x317419[_0xf0e9('0x43')],null))[_0xf0e9('0x1e')](respondWithResult(_0x26ea90,null))[_0xf0e9('0x40')](handleError(_0x26ea90,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x3b82d8,_0x2ea9e0,_0x4b750e){return db[_0xf0e9('0x25')][_0xf0e9('0x45')]({'raw':![],'where':{'VoiceQueueId':_0x3b82d8[_0xf0e9('0x3d')]['id']},'attributes':[[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db['sequelize']['fn']('IF',db[_0xf0e9('0x46')]['literal'](_0xf0e9('0x48')))),'noSuchContacts'],[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db[_0xf0e9('0x46')]['fn']('IF',db[_0xf0e9('0x46')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xf0e9('0x49')],[db['sequelize']['fn'](_0xf0e9('0x47'),db[_0xf0e9('0x46')]['fn']('IF',db['sequelize'][_0xf0e9('0x4a')]('`state`\x20=\x205,\x201,\x20null'))),_0xf0e9('0x4b')],[db['sequelize']['fn'](_0xf0e9('0x47'),db['sequelize']['fn']('IF',db[_0xf0e9('0x46')][_0xf0e9('0x4a')](_0xf0e9('0x4c')))),_0xf0e9('0x4d')],[db['sequelize']['fn'](_0xf0e9('0x47'),db['sequelize']['fn']('IF',db[_0xf0e9('0x46')]['literal'](_0xf0e9('0x4e')))),_0xf0e9('0x4f')],[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db['sequelize']['fn']('IF',db[_0xf0e9('0x46')]['literal'](_0xf0e9('0x50')))),'abandonedContacts'],[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db[_0xf0e9('0x46')]['fn']('IF',db[_0xf0e9('0x46')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0xf0e9('0x51')],[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db[_0xf0e9('0x46')]['fn']('IF',db[_0xf0e9('0x46')][_0xf0e9('0x4a')](_0xf0e9('0x52')))),_0xf0e9('0x53')]]})[_0xf0e9('0x1e')](handleEntityNotFound(_0x2ea9e0,null))[_0xf0e9('0x1e')](respondWithResult(_0x2ea9e0,null))[_0xf0e9('0x40')](handleError(_0x2ea9e0,null));};exports[_0xf0e9('0x54')]=function(_0xd7c77c,_0x1794b6,_0x5d9ebb){return db['CmHopperFinal'][_0xf0e9('0x45')]({'raw':![],'where':{'CampaignId':_0xd7c77c['params']['id']},'attributes':[[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db['sequelize']['fn']('IF',db[_0xf0e9('0x46')][_0xf0e9('0x4a')](_0xf0e9('0x48')))),_0xf0e9('0x55')],[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db[_0xf0e9('0x46')]['fn']('IF',db[_0xf0e9('0x46')][_0xf0e9('0x4a')](_0xf0e9('0x56')))),'noAnswerContacts'],[db[_0xf0e9('0x46')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf0e9('0x46')][_0xf0e9('0x4a')](_0xf0e9('0x57')))),'busyContacts'],[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db['sequelize']['fn']('IF',db['sequelize'][_0xf0e9('0x4a')](_0xf0e9('0x4c')))),_0xf0e9('0x4d')],[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db['sequelize']['fn']('IF',db[_0xf0e9('0x46')][_0xf0e9('0x4a')](_0xf0e9('0x4e')))),'dropContacts'],[db[_0xf0e9('0x46')]['fn']('COUNT',db[_0xf0e9('0x46')]['fn']('IF',db[_0xf0e9('0x46')]['literal'](_0xf0e9('0x50')))),_0xf0e9('0x58')],[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db[_0xf0e9('0x46')]['fn']('IF',db[_0xf0e9('0x46')][_0xf0e9('0x4a')](_0xf0e9('0x59')))),_0xf0e9('0x51')],[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db[_0xf0e9('0x46')]['fn']('IF',db['sequelize'][_0xf0e9('0x4a')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})['then'](handleEntityNotFound(_0x1794b6,null))[_0xf0e9('0x1e')](respondWithResult(_0x1794b6,null))[_0xf0e9('0x40')](handleError(_0x1794b6,null));};exports[_0xf0e9('0x5a')]=function(_0x4955a5,_0x2bfd7e,_0x490260){return db[_0xf0e9('0x5b')][_0xf0e9('0x3f')]({'where':{'id':_0x4955a5[_0xf0e9('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2bfd7e,null))[_0xf0e9('0x1e')](function(_0x134aa7){var _0x13f6f9;if(_0x134aa7){_0x13f6f9=squel[_0xf0e9('0x5c')]()[_0xf0e9('0x5d')](_0xf0e9('0x5e'))[_0xf0e9('0x5f')]([_0xf0e9('0x60'),'scheduledAt',_0xf0e9('0x61'),'ListId',_0xf0e9('0x62'),_0xf0e9('0x63'),'updatedAt'],squel['select']()[_0xf0e9('0x64')](_0xf0e9('0x65'),'phone')['field'](_0xf0e9('0x66'),_0xf0e9('0x67'))[_0xf0e9('0x64')](_0xf0e9('0x68'),_0xf0e9('0x61'))[_0xf0e9('0x64')](_0xf0e9('0x69'),_0xf0e9('0x6a'))[_0xf0e9('0x64')](_0xf0e9('0x6b'),_0xf0e9('0x62'))[_0xf0e9('0x64')]('NOW()','createdAt')[_0xf0e9('0x64')](_0xf0e9('0x66'),'updatedAt')[_0xf0e9('0x6c')](_0xf0e9('0x6d'))[_0xf0e9('0x38')]('VoiceQueueId\x20=\x20?',_0x4955a5['params']['id']['toString']())['where'](_0xf0e9('0x6e'),_0x4955a5[_0xf0e9('0x43')][_0xf0e9('0x6f')][_0xf0e9('0x70')]())[_0xf0e9('0x38')](_0xf0e9('0x71'))['where'](_0xf0e9('0x72'),squel[_0xf0e9('0x73')]()['field'](_0xf0e9('0x60'))[_0xf0e9('0x6c')](_0xf0e9('0x5e'))[_0xf0e9('0x38')](_0xf0e9('0x74'),_0x4955a5[_0xf0e9('0x3d')]['id'][_0xf0e9('0x70')]()))['where'](_0xf0e9('0x72'),squel[_0xf0e9('0x73')]()[_0xf0e9('0x64')]('calleridnum')[_0xf0e9('0x6c')](_0xf0e9('0x6d'))[_0xf0e9('0x38')](_0xf0e9('0x74'),_0x4955a5[_0xf0e9('0x3d')]['id']['toString']())[_0xf0e9('0x38')](_0xf0e9('0x75')))[_0xf0e9('0x76')](_0xf0e9('0x61')))[_0xf0e9('0x70')]();return db[_0xf0e9('0x46')][_0xf0e9('0x2b')](_0x13f6f9);}return[];})['then'](respondWithResult(_0x2bfd7e,null))[_0xf0e9('0x40')](handleError(_0x2bfd7e,null));};exports[_0xf0e9('0x77')]=function(_0x4bd24f,_0x470228,_0x5309cd){return db[_0xf0e9('0x78')][_0xf0e9('0x3f')]({'where':{'id':_0x4bd24f[_0xf0e9('0x3d')]['id']}})[_0xf0e9('0x1e')](handleEntityNotFound(_0x470228,null))['then'](function(_0x5644c0){var _0x3ccc3a;if(_0x5644c0){_0x3ccc3a=squel['insert']()[_0xf0e9('0x5d')](_0xf0e9('0x5e'))[_0xf0e9('0x5f')]([_0xf0e9('0x60'),_0xf0e9('0x67'),_0xf0e9('0x61'),_0xf0e9('0x6a'),_0xf0e9('0x79'),'createdAt',_0xf0e9('0x7a')],squel['select']()[_0xf0e9('0x64')]('ANY_VALUE(calleridnum)',_0xf0e9('0x60'))[_0xf0e9('0x64')](_0xf0e9('0x66'),'scheduledAt')[_0xf0e9('0x64')]('ANY_VALUE(ContactId)',_0xf0e9('0x61'))['field'](_0xf0e9('0x69'),'ListId')[_0xf0e9('0x64')](_0xf0e9('0x7b'),_0xf0e9('0x79'))['field'](_0xf0e9('0x66'),_0xf0e9('0x63'))['field']('NOW()','updatedAt')[_0xf0e9('0x6c')](_0xf0e9('0x6d'))[_0xf0e9('0x38')](_0xf0e9('0x7c'),_0x4bd24f[_0xf0e9('0x3d')]['id']['toString']())[_0xf0e9('0x38')]('state\x20=\x20?',_0x4bd24f['body'][_0xf0e9('0x6f')][_0xf0e9('0x70')]())[_0xf0e9('0x38')](_0xf0e9('0x71'))[_0xf0e9('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf0e9('0x73')]()['field']('phone')['from'](_0xf0e9('0x5e'))['where'](_0xf0e9('0x7c'),_0x4bd24f['params']['id'][_0xf0e9('0x70')]()))[_0xf0e9('0x38')](_0xf0e9('0x72'),squel[_0xf0e9('0x73')]()[_0xf0e9('0x64')](_0xf0e9('0x7d'))['from'](_0xf0e9('0x6d'))[_0xf0e9('0x38')](_0xf0e9('0x7c'),_0x4bd24f[_0xf0e9('0x3d')]['id'][_0xf0e9('0x70')]())['where'](_0xf0e9('0x75')))['group'](_0xf0e9('0x61')))[_0xf0e9('0x70')]();return db[_0xf0e9('0x46')][_0xf0e9('0x2b')](_0x3ccc3a);}return[];})['then'](respondWithResult(_0x470228,null))[_0xf0e9('0x40')](handleError(_0x470228,null));};exports['checkContactHopper']=function(_0x8f83ae,_0x35772b,_0x194baf){return db['CmHopper'][_0xf0e9('0x7e')]({'where':{'VoiceQueueId':_0x8f83ae[_0xf0e9('0x43')][_0xf0e9('0x62')],'CampaignId':_0x8f83ae[_0xf0e9('0x43')][_0xf0e9('0x79')],'ContactId':_0x8f83ae['body']['ContactId']}})[_0xf0e9('0x1e')](handleEntityNotFound(_0x35772b,null))[_0xf0e9('0x1e')](function(_0x223f69){if(_0x223f69){return _0x223f69;}return null;})[_0xf0e9('0x1e')](respondWithResult(_0x35772b,null))['catch'](handleError(_0x35772b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 10b3fa6..f6ab264 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 _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 +var _0x5eae=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5eae,0x137));var _0xe5ea=function(_0x2d2b7d,_0x82ce5f){_0x2d2b7d=_0x2d2b7d-0x0;var _0x4efe2f=_0x5eae[_0x2d2b7d];return _0x4efe2f;};'use strict';var _=require(_0xe5ea('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe5ea('0x1'));var BPromise=require(_0xe5ea('0x2'));var rp=require(_0xe5ea('0x3'));var fs=require('fs');var path=require(_0xe5ea('0x4'));var rimraf=require(_0xe5ea('0x5'));var config=require(_0xe5ea('0x6'));var attributes=require('./cmHopperFinal.attributes');module[_0xe5ea('0x7')]=function(_0x3780ad,_0x44a152){return _0x3780ad[_0xe5ea('0x8')](_0xe5ea('0x9'),attributes,{'tableName':_0xe5ea('0xa'),'paranoid':![],'indexes':[{'name':_0xe5ea('0xb'),'fields':[_0xe5ea('0xb')]},{'name':_0xe5ea('0xc'),'fields':[_0xe5ea('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 4cc1bed..9174ef0 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 _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 +var _0xdae5=['message','catch','CreateCmHopperFinal','create','options','raw','then','lodash','moment','ioredis','../../mysqldb','../../config/environment','http','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdae5,0x118));var _0x5dae=function(_0x5ae22c,_0x59fbfe){_0x5ae22c=_0x5ae22c-0x0;var _0x43fa63=_0xdae5[_0x5ae22c];return _0x43fa63;};'use strict';var _=require(_0x5dae('0x0'));var util=require('util');var moment=require(_0x5dae('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5dae('0x2'));var db=require(_0x5dae('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5dae('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5dae('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x512076,_0x3073fa,_0x4df2de){return new BPromise(function(_0x5533a9,_0x59ca5f){return client['request'](_0x512076,_0x4df2de)['then'](function(_0x4661e3){logger[_0x5dae('0x6')](_0x5dae('0x7'),_0x3073fa,_0x5dae('0x8'));logger[_0x5dae('0x9')](_0x5dae('0xa'),_0x3073fa,_0x5dae('0x8'),JSON[_0x5dae('0xb')](_0x4661e3));if(_0x4661e3[_0x5dae('0xc')]){if(_0x4661e3[_0x5dae('0xc')][_0x5dae('0xd')]===0x1f4){logger[_0x5dae('0xc')](_0x5dae('0x7'),_0x3073fa,_0x4661e3[_0x5dae('0xc')][_0x5dae('0xe')]);return _0x59ca5f(_0x4661e3['error'][_0x5dae('0xe')]);}logger[_0x5dae('0xc')](_0x5dae('0x7'),_0x3073fa,_0x4661e3['error'][_0x5dae('0xe')]);return _0x5533a9(_0x4661e3[_0x5dae('0xc')][_0x5dae('0xe')]);}else{logger[_0x5dae('0x6')](_0x5dae('0x7'),_0x3073fa,_0x5dae('0x8'));_0x5533a9(_0x4661e3['result']['message']);}})[_0x5dae('0xf')](function(_0x1f19a4){logger[_0x5dae('0xc')]('CmHopperFinal,\x20%s,\x20%s',_0x3073fa,_0x1f19a4);_0x59ca5f(_0x1f19a4);});});}exports[_0x5dae('0x10')]=function(_0x168545){var _0x34cca9=this;return new Promise(function(_0x425136,_0x3c12cf){return db['CmHopperFinal'][_0x5dae('0x11')](_0x168545['body'],{'raw':_0x168545[_0x5dae('0x12')]?_0x168545[_0x5dae('0x12')][_0x5dae('0x13')]===undefined?!![]:![]:!![]})[_0x5dae('0x14')](function(_0x238c94){logger['info']('CreateCmHopperFinal',_0x168545);logger[_0x5dae('0x9')](_0x5dae('0x10'),_0x168545,JSON['stringify'](_0x238c94));_0x425136(_0x238c94);})[_0x5dae('0xf')](function(_0x4919b7){logger[_0x5dae('0xc')]('CreateCmHopperFinal',_0x4919b7[_0x5dae('0xe')],_0x168545);_0x3c12cf(_0x34cca9['error'](0x1f4,_0x4919b7[_0x5dae('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 5cae4e1..94c8dc9 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 _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 +var _0xec06=['update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','/:id'];(function(_0x39e9f4,_0x28f56e){var _0x431a65=function(_0xbc1fc4){while(--_0xbc1fc4){_0x39e9f4['push'](_0x39e9f4['shift']());}};_0x431a65(++_0x28f56e);}(_0xec06,0x72));var _0x6ec0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xec06[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x6ec0('0x0'));var util=require(_0x6ec0('0x1'));var path=require(_0x6ec0('0x2'));var timeout=require(_0x6ec0('0x3'));var express=require('express');var router=express[_0x6ec0('0x4')]();var auth=require(_0x6ec0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6ec0('0x6'));var controller=require(_0x6ec0('0x7'));router[_0x6ec0('0x8')]('/',auth[_0x6ec0('0x9')](),controller[_0x6ec0('0xa')]);router[_0x6ec0('0x8')]('/describe',auth[_0x6ec0('0x9')](),controller[_0x6ec0('0xb')]);router['get']('/:id',auth[_0x6ec0('0x9')](),controller[_0x6ec0('0xc')]);router['get'](_0x6ec0('0xd'),auth[_0x6ec0('0x9')](),controller[_0x6ec0('0xe')]);router['get'](_0x6ec0('0xf'),auth[_0x6ec0('0x9')](),controller[_0x6ec0('0x10')]);router[_0x6ec0('0x11')](_0x6ec0('0x12'),auth['isAuthenticated'](),controller[_0x6ec0('0x13')]);router[_0x6ec0('0x11')](_0x6ec0('0x14'),auth[_0x6ec0('0x9')](),controller[_0x6ec0('0x15')]);router['post'](_0x6ec0('0x16'),auth['isAuthenticated'](),controller[_0x6ec0('0x17')]);router[_0x6ec0('0x18')](_0x6ec0('0x19'),auth['isAuthenticated'](),controller[_0x6ec0('0x1a')]);module[_0x6ec0('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index b816c3a..e85870f 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 _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 +var _0x4bbc=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4bbc,0x91));var _0xc4bb=function(_0x43f629,_0x16931c){_0x43f629=_0x43f629-0x0;var _0x2b25c6=_0x4bbc[_0x43f629];return _0x2b25c6;};'use strict';var Sequelize=require(_0xc4bb('0x0'));module[_0xc4bb('0x1')]={'state':{'type':Sequelize[_0xc4bb('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xc4bb('0x3')]},'scheduledat':{'type':Sequelize[_0xc4bb('0x4')]},'countbusyretry':{'type':Sequelize[_0xc4bb('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc4bb('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc4bb('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc4bb('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xc4bb('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xc4bb('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc4bb('0x3')]},'calleridname':{'type':Sequelize[_0xc4bb('0x3')]},'starttime':{'type':Sequelize[_0xc4bb('0x4')]},'responsetime':{'type':Sequelize[_0xc4bb('0x4')]},'answertime':{'type':Sequelize[_0xc4bb('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xc4bb('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xc4bb('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xc4bb('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc4bb('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xc4bb('0x3')]},'campaign':{'type':Sequelize[_0xc4bb('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc4bb('0x3')]},'reason':{'type':Sequelize[_0xc4bb('0x3')]},'amd':{'type':Sequelize[_0xc4bb('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xc4bb('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xc4bb('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc4bb('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc4bb('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xc4bb('0x4')]},'edited':{'type':Sequelize[_0xc4bb('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xc4bb('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc4bb('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc4bb('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 e6fe002..254dffc 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 _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 +var _0xe1ae=['limit','set','Content-Range','reject','update','destroy','then','error','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','keys','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','include','find','create','describe','body','uniqueid','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset'];(function(_0x24af86,_0x8b1a57){var _0x21a99c=function(_0x430076){while(--_0x430076){_0x24af86['push'](_0x24af86['shift']());}};_0x21a99c(++_0x8b1a57);}(_0xe1ae,0x162));var _0xee1a=function(_0x271a80,_0x268bac){_0x271a80=_0x271a80-0x0;var _0xf8233e=_0xe1ae[_0x271a80];return _0xf8233e;};'use strict';var pdf=require(_0xee1a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xee1a('0x1'));var zipdir=require(_0xee1a('0x2'));var jsonpatch=require(_0xee1a('0x3'));var rp=require(_0xee1a('0x4'));var moment=require(_0xee1a('0x5'));var BPromise=require(_0xee1a('0x6'));var Mustache=require(_0xee1a('0x7'));var util=require('util');var path=require(_0xee1a('0x8'));var sox=require(_0xee1a('0x9'));var csv=require('to-csv');var ejs=require(_0xee1a('0xa'));var fs=require('fs');var _=require(_0xee1a('0xb'));var squel=require(_0xee1a('0xc'));var crypto=require(_0xee1a('0xd'));var jsforce=require(_0xee1a('0xe'));var deskjs=require(_0xee1a('0xf'));var toCsv=require(_0xee1a('0x10'));var querystring=require('querystring');var Papa=require(_0xee1a('0x11'));var Redis=require(_0xee1a('0x12'));var authService=require(_0xee1a('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee1a('0x14'));var logger=require(_0xee1a('0x15'))(_0xee1a('0x16'));var utils=require(_0xee1a('0x17'));var config=require(_0xee1a('0x18'));var licenseUtil=require(_0xee1a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48aa42,_0x4233c0){_0x4233c0=_0x4233c0||0xcc;return function(_0x3ee751){if(_0x3ee751){return _0x48aa42[_0xee1a('0x1a')](_0x4233c0);}return _0x48aa42[_0xee1a('0x1b')](_0x4233c0)[_0xee1a('0x1c')]();};}function respondWithResult(_0x2d46f,_0x5bc6d8){_0x5bc6d8=_0x5bc6d8||0xc8;return function(_0x4075c2){if(_0x4075c2){return _0x2d46f['status'](_0x5bc6d8)[_0xee1a('0x1d')](_0x4075c2);}};}function respondWithFilteredResult(_0x75e19f,_0x5875c6){return function(_0xc07321){if(_0xc07321){var _0x4c4777=_0xc07321['count'],_0x26dc11=_0x5875c6[_0xee1a('0x1e')],_0x12f212=_0x5875c6[_0xee1a('0x1e')]+_0x5875c6[_0xee1a('0x1f')],_0xa162db;if(_0x12f212>=_0x4c4777){_0x12f212=_0x4c4777;_0xa162db=0xc8;}else{_0xa162db=0xce;}_0x75e19f[_0xee1a('0x1b')](_0xa162db);return _0x75e19f[_0xee1a('0x20')](_0xee1a('0x21'),_0x26dc11+'-'+_0x12f212+'/'+_0x4c4777)['json'](_0xc07321);}return null;};}function patchUpdates(_0x424c2f){return function(_0xb63503){try{jsonpatch['apply'](_0xb63503,_0x424c2f,!![]);}catch(_0x5c28a6){return BPromise[_0xee1a('0x22')](_0x5c28a6);}return _0xb63503['save']();};}function saveUpdates(_0x3f89f6,_0x2190b5){return function(_0x3cfbcf){if(_0x3cfbcf){return _0x3cfbcf[_0xee1a('0x23')](_0x3f89f6)['then'](function(_0x3e156b){return _0x3e156b;});}return null;};}function removeEntity(_0x42eb40,_0x3237f7){return function(_0x453156){if(_0x453156){return _0x453156[_0xee1a('0x24')]()[_0xee1a('0x25')](function(){_0x42eb40['status'](0xcc)[_0xee1a('0x1c')]();});}};}function handleEntityNotFound(_0x2caeec,_0x345a7c){return function(_0x503780){if(!_0x503780){_0x2caeec[_0xee1a('0x1a')](0x194);}return _0x503780;};}function handleError(_0x3c9b69,_0xc98154){_0xc98154=_0xc98154||0x1f4;return function(_0x50437c){logger[_0xee1a('0x26')](_0x50437c[_0xee1a('0x27')]);if(_0x50437c[_0xee1a('0x28')]){delete _0x50437c[_0xee1a('0x28')];}_0x3c9b69[_0xee1a('0x1b')](_0xc98154)['send'](_0x50437c);};}exports[_0xee1a('0x29')]=function(_0x269676,_0xb39288){var _0x54a81d={},_0x328eae={},_0xa7366b={'count':0x0,'rows':[]};var _0x40cd06=_[_0xee1a('0x2a')](db[_0xee1a('0x2b')][_0xee1a('0x2c')],function(_0x43d5e2){return{'name':_0x43d5e2[_0xee1a('0x2d')],'type':_0x43d5e2[_0xee1a('0x2e')][_0xee1a('0x2f')]};});_0x328eae['model']=_[_0xee1a('0x2a')](_0x40cd06,'name');_0x328eae['query']=_[_0xee1a('0x30')](_0x269676['query']);_0x328eae[_0xee1a('0x31')]=_['intersection'](_0x328eae[_0xee1a('0x32')],_0x328eae[_0xee1a('0x33')]);_0x54a81d[_0xee1a('0x34')]=_[_0xee1a('0x35')](_0x328eae[_0xee1a('0x32')],qs['fields'](_0x269676[_0xee1a('0x33')][_0xee1a('0x36')]));_0x54a81d[_0xee1a('0x34')]=_0x54a81d[_0xee1a('0x34')][_0xee1a('0x37')]?_0x54a81d['attributes']:_0x328eae[_0xee1a('0x32')];if(!_0x269676['query'][_0xee1a('0x38')](_0xee1a('0x39'))){_0x54a81d['limit']=qs[_0xee1a('0x1f')](_0x269676[_0xee1a('0x33')]['limit']);_0x54a81d['offset']=qs[_0xee1a('0x1e')](_0x269676['query']['offset']);}_0x54a81d[_0xee1a('0x3a')]=qs['sort'](_0x269676['query'][_0xee1a('0x3b')]);_0x54a81d[_0xee1a('0x3c')]=qs[_0xee1a('0x31')](_[_0xee1a('0x3d')](_0x269676[_0xee1a('0x33')],_0x328eae['filters']),_0x40cd06);if(_0x269676['query'][_0xee1a('0x3e')]){_0x54a81d[_0xee1a('0x3c')]=_[_0xee1a('0x3f')](_0x54a81d[_0xee1a('0x3c')],{'$or':_[_0xee1a('0x2a')](_0x40cd06,function(_0x121bdf){if(_0x121bdf[_0xee1a('0x2e')]!==_0xee1a('0x40')){var _0x25bd42={};_0x25bd42[_0x121bdf[_0xee1a('0x28')]]={'$like':'%'+_0x269676['query'][_0xee1a('0x3e')]+'%'};return _0x25bd42;}})});}_0x54a81d=_['merge']({},_0x54a81d,_0x269676[_0xee1a('0x41')]);var _0xfdb5ed={'where':_0x54a81d[_0xee1a('0x3c')]};return db[_0xee1a('0x2b')][_0xee1a('0x42')](_0xfdb5ed)[_0xee1a('0x25')](function(_0x304f0c){_0xa7366b[_0xee1a('0x42')]=_0x304f0c;if(_0x269676[_0xee1a('0x33')][_0xee1a('0x43')]){_0x54a81d['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x54a81d);})['then'](function(_0x1c2bcb){_0xa7366b[_0xee1a('0x44')]=_0x1c2bcb;return _0xa7366b;})['then'](respondWithFilteredResult(_0xb39288,_0x54a81d))[_0xee1a('0x45')](handleError(_0xb39288,null));};exports[_0xee1a('0x46')]=function(_0x452a98,_0x50ba1a){var _0x4c4e2b={'raw':!![],'where':{'id':_0x452a98['params']['id']}},_0xedea1b={};_0xedea1b['model']=_['keys'](db[_0xee1a('0x2b')]['rawAttributes']);_0xedea1b[_0xee1a('0x33')]=_[_0xee1a('0x30')](_0x452a98[_0xee1a('0x33')]);_0xedea1b['filters']=_[_0xee1a('0x35')](_0xedea1b[_0xee1a('0x32')],_0xedea1b['query']);_0x4c4e2b[_0xee1a('0x34')]=_['intersection'](_0xedea1b['model'],qs[_0xee1a('0x36')](_0x452a98[_0xee1a('0x33')][_0xee1a('0x36')]));_0x4c4e2b[_0xee1a('0x34')]=_0x4c4e2b['attributes'][_0xee1a('0x37')]?_0x4c4e2b['attributes']:_0xedea1b[_0xee1a('0x32')];if(_0x452a98[_0xee1a('0x33')][_0xee1a('0x43')]){_0x4c4e2b[_0xee1a('0x47')]=[{'all':!![]}];}_0x4c4e2b=_[_0xee1a('0x3f')]({},_0x4c4e2b,_0x452a98[_0xee1a('0x41')]);return db[_0xee1a('0x2b')][_0xee1a('0x48')](_0x4c4e2b)[_0xee1a('0x25')](handleEntityNotFound(_0x50ba1a,null))['then'](respondWithResult(_0x50ba1a,null))[_0xee1a('0x45')](handleError(_0x50ba1a,null));};exports['create']=function(_0x446a78,_0x46a7e2){return db[_0xee1a('0x2b')][_0xee1a('0x49')](_0x446a78['body'],{})['then'](respondWithResult(_0x46a7e2,0xc9))['catch'](handleError(_0x46a7e2,null));};exports['describe']=function(_0x229817,_0x55f4ca){return db[_0xee1a('0x2b')][_0xee1a('0x4a')]()[_0xee1a('0x25')](respondWithResult(_0x55f4ca,null))[_0xee1a('0x45')](handleError(_0x55f4ca,null));};exports[_0xee1a('0x23')]=function(_0x476899,_0x54eae9){if(_0x476899['body']['uniqueid']){delete _0x476899[_0xee1a('0x4b')][_0xee1a('0x4c')];}return db['CmHopperHistory'][_0xee1a('0x48')]({'where':{'uniqueid':_0x476899['params']['id']}})[_0xee1a('0x25')](handleEntityNotFound(_0x54eae9,null))[_0xee1a('0x25')](saveUpdates(_0x476899[_0xee1a('0x4b')],null))[_0xee1a('0x25')](respondWithResult(_0x54eae9,null))[_0xee1a('0x45')](handleError(_0x54eae9,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 79db9e0..9de393e 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 _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 +var _0xfcb0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','../../config/logger','api'];(function(_0x1beccc,_0x1e5588){var _0x5c843f=function(_0x3f053a){while(--_0x3f053a){_0x1beccc['push'](_0x1beccc['shift']());}};_0x5c843f(++_0x1e5588);}(_0xfcb0,0x148));var _0x0fcb=function(_0x2ae8dc,_0x4a45c8){_0x2ae8dc=_0x2ae8dc-0x0;var _0x48fb4d=_0xfcb0[_0x2ae8dc];return _0x48fb4d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0fcb('0x0'))(_0x0fcb('0x1'));var moment=require(_0x0fcb('0x2'));var BPromise=require(_0x0fcb('0x3'));var rp=require(_0x0fcb('0x4'));var fs=require('fs');var path=require(_0x0fcb('0x5'));var rimraf=require(_0x0fcb('0x6'));var config=require(_0x0fcb('0x7'));var attributes=require(_0x0fcb('0x8'));module[_0x0fcb('0x9')]=function(_0xd963ff,_0x144871){return _0xd963ff[_0x0fcb('0xa')](_0x0fcb('0xb'),attributes,{'tableName':_0x0fcb('0xc'),'paranoid':![],'indexes':[{'name':_0x0fcb('0xd'),'fields':[_0x0fcb('0xd')]},{'name':_0x0fcb('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index fb320f1..0361f99 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 _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 +var _0x7878=['GetCampaignHopperHistory','where','col','ivrTotalCallsDays','`state`\x20=\x204,\x201,\x20null','ivrAnswerCallsDay','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','raw','AvgHandleTime','findAll','options','sequelize','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','stringify','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay'];(function(_0x197cb4,_0x5c8fae){var _0x1527a9=function(_0x53e621){while(--_0x53e621){_0x197cb4['push'](_0x197cb4['shift']());}};_0x1527a9(++_0x5c8fae);}(_0x7878,0x88));var _0x8787=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7878[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8787('0x0'));var moment=require(_0x8787('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8787('0x2'));var db=require(_0x8787('0x3'))['db'];var utils=require(_0x8787('0x4'));var logger=require(_0x8787('0x5'))(_0x8787('0x6'));var config=require('../../config/environment');var jayson=require(_0x8787('0x7'));var client=jayson[_0x8787('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd52ef2,_0x4d36f5,_0x26d680){return new BPromise(function(_0x127f49,_0x5eabe7){return client[_0x8787('0x9')](_0xd52ef2,_0x26d680)[_0x8787('0xa')](function(_0x5f3c9e){logger[_0x8787('0xb')](_0x8787('0xc'),_0x4d36f5,_0x8787('0xd'));logger[_0x8787('0xe')](_0x8787('0xf'),_0x4d36f5,'request\x20sent',JSON['stringify'](_0x5f3c9e));if(_0x5f3c9e['error']){if(_0x5f3c9e[_0x8787('0x10')][_0x8787('0x11')]===0x1f4){logger[_0x8787('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x4d36f5,_0x5f3c9e[_0x8787('0x10')][_0x8787('0x12')]);return _0x5eabe7(_0x5f3c9e['error'][_0x8787('0x12')]);}logger[_0x8787('0x10')](_0x8787('0xc'),_0x4d36f5,_0x5f3c9e['error'][_0x8787('0x12')]);return _0x127f49(_0x5f3c9e['error']['message']);}else{logger[_0x8787('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x4d36f5,'request\x20sent');_0x127f49(_0x5f3c9e[_0x8787('0x13')][_0x8787('0x12')]);}})[_0x8787('0x14')](function(_0x998c01){logger['error'](_0x8787('0xc'),_0x4d36f5,_0x998c01);_0x5eabe7(_0x998c01);});});}exports[_0x8787('0x15')]=function(_0x3259d2){var _0xb24abf=this;return new Promise(function(_0x1900c0,_0x2a6717){return db[_0x8787('0x16')][_0x8787('0x17')](_0x3259d2['body'],{'raw':_0x3259d2['options']?_0x3259d2['options'][_0x8787('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x28bee3){logger[_0x8787('0xb')](_0x8787('0x15'),_0x3259d2);logger[_0x8787('0xe')](_0x8787('0x15'),_0x3259d2,JSON['stringify'](_0x28bee3));_0x1900c0(_0x28bee3);})[_0x8787('0x14')](function(_0x41804f){logger[_0x8787('0x10')]('CreateCmHopperHistory',_0x41804f['message'],_0x3259d2);_0x2a6717(_0xb24abf[_0x8787('0x10')](0x1f4,_0x41804f[_0x8787('0x12')]));});});};exports[_0x8787('0x19')]=function(_0x62aee9){var _0x2b9651=this;return new Promise(function(_0x500e25,_0x463e87){return db['CmHopperHistory'][_0x8787('0x1a')]({'raw':_0x62aee9[_0x8787('0x1b')]?_0x62aee9[_0x8787('0x1b')][_0x8787('0x18')]===undefined?!![]:![]:!![],'where':_0x62aee9['options']?_0x62aee9[_0x8787('0x1b')]['where']||null:null,'attributes':[[db[_0x8787('0x1c')]['fn']('COUNT',db[_0x8787('0x1c')]['col']('id')),_0x8787('0x1d')],[db[_0x8787('0x1c')]['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')][_0x8787('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),_0x8787('0x20')],[db[_0x8787('0x1c')]['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x8787('0x21')],[db[_0x8787('0x1c')]['fn']('COUNT',db[_0x8787('0x1c')]['fn']('IF',db['sequelize'][_0x8787('0x1f')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x8787('0x1c')]['fn']('AVG',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x8787('0x22')],[db['sequelize']['fn'](_0x8787('0x23'),db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')]['literal'](_0x8787('0x24')))),'predictiveIntervalAvgTalktime']]})[_0x8787('0xa')](function(_0x4accc4){logger['info']('AvgHandleTime',_0x62aee9);logger['debug'](_0x8787('0x19'),_0x62aee9,JSON[_0x8787('0x25')](_0x4accc4));_0x500e25(_0x4accc4);})[_0x8787('0x14')](function(_0xdd2c14){logger[_0x8787('0x10')](_0x8787('0x19'),_0xdd2c14['message'],_0x62aee9);_0x463e87(_0x2b9651[_0x8787('0x10')](0x1f4,_0xdd2c14['message']));});});};exports[_0x8787('0x26')]=function(_0x20ff75){var _0x3f1cda=this;return new Promise(function(_0x518f7c,_0x8b2f64){return db[_0x8787('0x16')]['findAll']({'raw':_0x20ff75[_0x8787('0x1b')]?_0x20ff75[_0x8787('0x1b')][_0x8787('0x18')]===undefined?!![]:![]:!![],'where':_0x20ff75[_0x8787('0x1b')]?_0x20ff75[_0x8787('0x1b')]['where']||null:null,'attributes':[[_0x8787('0x27'),_0x8787('0x28')],[db['sequelize']['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')]['literal'](_0x8787('0x29')))),_0x8787('0x2a')],[db[_0x8787('0x1c')]['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')][_0x8787('0x1f')]('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db['sequelize'][_0x8787('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),_0x8787('0x2b')],[db[_0x8787('0x1c')]['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db['sequelize'][_0x8787('0x1f')](_0x8787('0x2c')))),_0x8787('0x2d')],[db[_0x8787('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8787('0x1c')][_0x8787('0x1f')](_0x8787('0x2e')))),'outboundCongestionCallsDay'],[db[_0x8787('0x1c')]['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')][_0x8787('0x1f')](_0x8787('0x2f')))),'outboundDropCallsDayTimeout'],[db[_0x8787('0x1c')]['fn']('COUNT',db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')]['literal'](_0x8787('0x30')))),_0x8787('0x31')],[db[_0x8787('0x1c')]['fn']('COUNT',db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')]['literal'](_0x8787('0x32')))),_0x8787('0x33')],[db[_0x8787('0x1c')]['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')][_0x8787('0x1f')]('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db[_0x8787('0x1c')]['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')]['literal'](_0x8787('0x34')))),_0x8787('0x35')],[db['sequelize']['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db['sequelize'][_0x8787('0x1f')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x8787('0x1c')]['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')][_0x8787('0x1f')](_0x8787('0x36')))),_0x8787('0x37')],[db[_0x8787('0x1c')]['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db['sequelize'][_0x8787('0x1f')](_0x8787('0x38')))),'outboundRejectCallsDay'],[db[_0x8787('0x1c')]['fn']('COUNT',db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')][_0x8787('0x1f')](_0x8787('0x39')))),_0x8787('0x3a')]],'group':[_0x8787('0x27')]})['then'](function(_0xd87d07){logger[_0x8787('0xb')](_0x8787('0x26'),_0x20ff75);logger[_0x8787('0xe')](_0x8787('0x26'),_0x20ff75,JSON[_0x8787('0x25')](_0xd87d07));_0x518f7c(_0xd87d07);})[_0x8787('0x14')](function(_0x5790dc){logger[_0x8787('0x10')](_0x8787('0x26'),_0x5790dc['message'],_0x20ff75);_0x8b2f64(_0x3f1cda[_0x8787('0x10')](0x1f4,_0x5790dc['message']));});});};exports[_0x8787('0x3b')]=function(_0x1b206e){var _0x489d0b=this;return new Promise(function(_0xf623c1,_0x4bbda3){return db[_0x8787('0x16')][_0x8787('0x1a')]({'raw':_0x1b206e[_0x8787('0x1b')]?_0x1b206e[_0x8787('0x1b')][_0x8787('0x18')]===undefined?!![]:![]:!![],'where':_0x1b206e['options']?_0x1b206e[_0x8787('0x1b')][_0x8787('0x3c')]||null:null,'attributes':[[_0x8787('0x27'),_0x8787('0x28')],[db['sequelize']['fn'](_0x8787('0x1e'),db['sequelize'][_0x8787('0x3d')]('id')),_0x8787('0x3e')],[db[_0x8787('0x1c')]['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')]['literal'](_0x8787('0x3f')))),_0x8787('0x40')]],'group':[_0x8787('0x27')]})[_0x8787('0xa')](function(_0x4d6069){logger['info'](_0x8787('0x3b'),_0x1b206e);logger[_0x8787('0xe')](_0x8787('0x3b'),_0x1b206e,JSON[_0x8787('0x25')](_0x4d6069));_0xf623c1(_0x4d6069);})['catch'](function(_0x2d91d3){logger[_0x8787('0x10')](_0x8787('0x3b'),_0x2d91d3['message'],_0x1b206e);_0x4bbda3(_0x489d0b['error'](0x1f4,_0x2d91d3['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 3639663..c1a44e4 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 _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 +var _0x8f53=['/describe','describe','/:id','show','create','put','update','exports','multer','util','path','Router','../../components/auth/service','get','isAuthenticated','index'];(function(_0x4734d8,_0x479950){var _0x3b1120=function(_0x4a5d1c){while(--_0x4a5d1c){_0x4734d8['push'](_0x4734d8['shift']());}};_0x3b1120(++_0x479950);}(_0x8f53,0x128));var _0x38f5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8f53[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x38f5('0x0'));var util=require(_0x38f5('0x1'));var path=require(_0x38f5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x38f5('0x3')]();var auth=require(_0x38f5('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0x38f5('0x5')]('/',auth[_0x38f5('0x6')](),controller[_0x38f5('0x7')]);router[_0x38f5('0x5')](_0x38f5('0x8'),auth[_0x38f5('0x6')](),controller[_0x38f5('0x9')]);router[_0x38f5('0x5')](_0x38f5('0xa'),auth['isAuthenticated'](),controller[_0x38f5('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x38f5('0xc')]);router[_0x38f5('0xd')](_0x38f5('0xa'),auth[_0x38f5('0x6')](),controller[_0x38f5('0xe')]);module[_0x38f5('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 4dc7706..19c9a43 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 _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 +var _0xb4b6=['name','STRING','sequelize'];(function(_0x5d36a7,_0x5cdb1a){var _0x4f9bc6=function(_0x48b0e1){while(--_0x48b0e1){_0x5d36a7['push'](_0x5d36a7['shift']());}};_0x4f9bc6(++_0x5cdb1a);}(_0xb4b6,0x14c));var _0x6b4b=function(_0x3b81c9,_0x21a20a){_0x3b81c9=_0x3b81c9-0x0;var _0x115587=_0xb4b6[_0x3b81c9];return _0x115587;};'use strict';var Sequelize=require(_0x6b4b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x6b4b('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6b4b('0x2')]},'dialPrefix':{'type':Sequelize[_0x6b4b('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index eab4d9f..7b8b5ea 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(_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 +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(_0x47faad,_0x230b04){var _0x4c449a=function(_0x426c7e){while(--_0x426c7e){_0x47faad['push'](_0x47faad['shift']());}};_0x4c449a(++_0x230b04);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 f9df8fb..0d7397c 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 _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 +var _0x5453=['../../mysqldb','CmList','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x43cda6,_0x49d8cb){var _0x3ef70e=function(_0x3b8094){while(--_0x3b8094){_0x43cda6['push'](_0x43cda6['shift']());}};_0x3ef70e(++_0x49d8cb);}(_0x5453,0x185));var _0x3545=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5453[_0x138adb];return _0x1b27f2;};'use strict';var EventEmitter=require(_0x3545('0x0'));var CmList=require(_0x3545('0x1'))['db'][_0x3545('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x3545('0x3')](0x0);var events={'afterCreate':_0x3545('0x4'),'afterUpdate':_0x3545('0x5'),'afterDestroy':'remove'};function emitEvent(_0x579a7b){return function(_0x38531e,_0xe317d0,_0x5382ea){CmListEvents[_0x3545('0x6')](_0x579a7b+':'+_0x38531e['id'],_0x38531e);CmListEvents[_0x3545('0x6')](_0x579a7b,_0x38531e);_0x5382ea(null);};}for(var e in events){if(events[_0x3545('0x7')](e)){var event=events[e];CmList[_0x3545('0x8')](e,emitEvent(event));}}module[_0x3545('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 97f3e91..64af490 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 _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 +var _0x89fd=['exports','define','CmList','cm_lists','util','../../config/logger','request-promise','path','../../config/environment'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x89fd,0x82));var _0xd89f=function(_0x2d9bba,_0x1ea6b0){_0x2d9bba=_0x2d9bba-0x0;var _0x2cb7e7=_0x89fd[_0x2d9bba];return _0x2cb7e7;};'use strict';var _=require('lodash');var util=require(_0xd89f('0x0'));var logger=require(_0xd89f('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd89f('0x2'));var fs=require('fs');var path=require(_0xd89f('0x3'));var rimraf=require('rimraf');var config=require(_0xd89f('0x4'));var attributes=require('./cmList.attributes');module[_0xd89f('0x5')]=function(_0xcd0d29,_0x174b05){return _0xcd0d29[_0xd89f('0x6')](_0xd89f('0x7'),attributes,{'tableName':_0xd89f('0x8'),'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 1240ed9..9e6277f 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 _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 +var _0xee9d=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./cmList.socket','register','info','CmList,\x20%s,\x20%s','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xee9d,0x12d));var _0xdee9=function(_0x3597e8,_0x499912){_0x3597e8=_0x3597e8-0x0;var _0x1da563=_0xee9d[_0x3597e8];return _0x1da563;};'use strict';var _=require(_0xdee9('0x0'));var util=require(_0xdee9('0x1'));var moment=require(_0xdee9('0x2'));var BPromise=require(_0xdee9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdee9('0x4'));var db=require(_0xdee9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdee9('0x6'))('rpc');var config=require(_0xdee9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdee9('0x8')][_0xdee9('0x9')]({'port':0x232a});config[_0xdee9('0xa')]=_[_0xdee9('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdee9('0xc'))(new Redis(config[_0xdee9('0xa')]));require(_0xdee9('0xd'))[_0xdee9('0xe')](socket);function respondWithRpcPromise(_0x494bef,_0x3fe385,_0x37954e){return new BPromise(function(_0x20de16,_0x17036b){return client['request'](_0x494bef,_0x37954e)['then'](function(_0x51f4a5){logger[_0xdee9('0xf')](_0xdee9('0x10'),_0x3fe385,'request\x20sent');logger['debug'](_0xdee9('0x11'),_0x3fe385,_0xdee9('0x12'),JSON[_0xdee9('0x13')](_0x51f4a5));if(_0x51f4a5['error']){if(_0x51f4a5[_0xdee9('0x14')][_0xdee9('0x15')]===0x1f4){logger[_0xdee9('0x14')](_0xdee9('0x10'),_0x3fe385,_0x51f4a5[_0xdee9('0x14')]['message']);return _0x17036b(_0x51f4a5[_0xdee9('0x14')][_0xdee9('0x16')]);}logger['error'](_0xdee9('0x10'),_0x3fe385,_0x51f4a5[_0xdee9('0x14')]['message']);return _0x20de16(_0x51f4a5[_0xdee9('0x14')][_0xdee9('0x16')]);}else{logger[_0xdee9('0xf')]('CmList,\x20%s,\x20%s',_0x3fe385,_0xdee9('0x12'));_0x20de16(_0x51f4a5[_0xdee9('0x17')]['message']);}})[_0xdee9('0x18')](function(_0x5e0497){logger[_0xdee9('0x14')](_0xdee9('0x10'),_0x3fe385,_0x5e0497);_0x17036b(_0x5e0497);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index e72d188..c994cc0 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 _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 +var _0x96f1=['emit','removeListener','register','cmList:','./cmList.events','save','remove','update'];(function(_0xa6c9b6,_0x51bfc6){var _0x593599=function(_0x19f957){while(--_0x19f957){_0xa6c9b6['push'](_0xa6c9b6['shift']());}};_0x593599(++_0x51bfc6);}(_0x96f1,0x19c));var _0x196f=function(_0x3e043a,_0x3beb96){_0x3e043a=_0x3e043a-0x0;var _0x57647f=_0x96f1[_0x3e043a];return _0x57647f;};'use strict';var CmListEvents=require(_0x196f('0x0'));var events=[_0x196f('0x1'),_0x196f('0x2'),_0x196f('0x3')];function createListener(_0x227254,_0x219e87){return function(_0xe61e26){_0x219e87[_0x196f('0x4')](_0x227254,_0xe61e26);};}function removeListener(_0x5b8eb5,_0x56fc61){return function(){CmListEvents[_0x196f('0x5')](_0x5b8eb5,_0x56fc61);};}exports[_0x196f('0x6')]=function(_0x267906){for(var _0x1f401c=0x0,_0x17f603=events['length'];_0x1f401c<_0x17f603;_0x1f401c++){var _0x427333=events[_0x1f401c];var _0x425e5c=createListener(_0x196f('0x7')+_0x427333,_0x267906);CmListEvents['on'](_0x427333,_0x425e5c);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 1db3f10..6bfb628 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(_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 +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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 7ba839b..e5bec87 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 _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 +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x19b85d,_0x32ec71){var _0xe2703d=function(_0x50a050){while(--_0x50a050){_0x19b85d['push'](_0x19b85d['shift']());}};_0xe2703d(++_0x32ec71);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 098774c..2b0845e 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 _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 +var _0xe695=['bluebird','mustache','util','path','sox','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','update','body','Condition','find','params','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3e1d23,_0xd6a3d3){var _0x259e98=function(_0xaec5e3){while(--_0xaec5e3){_0x3e1d23['push'](_0x3e1d23['shift']());}};_0x259e98(++_0xd6a3d3);}(_0xe695,0xe9));var _0x5e69=function(_0x2b4933,_0x2edb2d){_0x2b4933=_0x2b4933-0x0;var _0x33ad51=_0xe695[_0x2b4933];return _0x33ad51;};'use strict';var pdf=require(_0x5e69('0x0'));var emlformat=require(_0x5e69('0x1'));var rimraf=require(_0x5e69('0x2'));var zipdir=require(_0x5e69('0x3'));var jsonpatch=require(_0x5e69('0x4'));var rp=require(_0x5e69('0x5'));var moment=require(_0x5e69('0x6'));var BPromise=require(_0x5e69('0x7'));var Mustache=require(_0x5e69('0x8'));var util=require(_0x5e69('0x9'));var path=require(_0x5e69('0xa'));var sox=require(_0x5e69('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5e69('0xc'));var crypto=require('crypto');var jsforce=require(_0x5e69('0xd'));var deskjs=require(_0x5e69('0xe'));var toCsv=require(_0x5e69('0xf'));var querystring=require(_0x5e69('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5e69('0x11'));var qs=require(_0x5e69('0x12'));var as=require(_0x5e69('0x13'));var hardwareService=require(_0x5e69('0x14'));var logger=require(_0x5e69('0x15'))(_0x5e69('0x16'));var utils=require(_0x5e69('0x17'));var config=require(_0x5e69('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x245536,_0x355a6e){_0x355a6e=_0x355a6e||0xcc;return function(_0x4f1704){if(_0x4f1704){return _0x245536[_0x5e69('0x19')](_0x355a6e);}return _0x245536[_0x5e69('0x1a')](_0x355a6e)[_0x5e69('0x1b')]();};}function respondWithResult(_0x57206c,_0x580108){_0x580108=_0x580108||0xc8;return function(_0x17c702){if(_0x17c702){return _0x57206c['status'](_0x580108)[_0x5e69('0x1c')](_0x17c702);}};}function respondWithFilteredResult(_0x50e17e,_0x3383d1){return function(_0x51f5b2){if(_0x51f5b2){var _0x55278b=_0x51f5b2[_0x5e69('0x1d')],_0x5e89e7=_0x3383d1[_0x5e69('0x1e')],_0x5d2b1f=_0x3383d1[_0x5e69('0x1e')]+_0x3383d1[_0x5e69('0x1f')],_0x1b2b67;if(_0x5d2b1f>=_0x55278b){_0x5d2b1f=_0x55278b;_0x1b2b67=0xc8;}else{_0x1b2b67=0xce;}_0x50e17e['status'](_0x1b2b67);return _0x50e17e[_0x5e69('0x20')](_0x5e69('0x21'),_0x5e89e7+'-'+_0x5d2b1f+'/'+_0x55278b)[_0x5e69('0x1c')](_0x51f5b2);}return null;};}function patchUpdates(_0x4faa4f){return function(_0x4a90ed){try{jsonpatch[_0x5e69('0x22')](_0x4a90ed,_0x4faa4f,!![]);}catch(_0x521289){return BPromise['reject'](_0x521289);}return _0x4a90ed[_0x5e69('0x23')]();};}function saveUpdates(_0xa16a32,_0x4bac66){return function(_0x50873c){if(_0x50873c){return _0x50873c['update'](_0xa16a32)[_0x5e69('0x24')](function(_0x245298){return _0x245298;});}return null;};}function removeEntity(_0x25d924,_0x44bc4a){return function(_0x512de1){if(_0x512de1){return _0x512de1[_0x5e69('0x25')]()['then'](function(){_0x25d924[_0x5e69('0x1a')](0xcc)[_0x5e69('0x1b')]();});}};}function handleEntityNotFound(_0x54f0cd,_0x49dc02){return function(_0x3e2b05){if(!_0x3e2b05){_0x54f0cd[_0x5e69('0x19')](0x194);}return _0x3e2b05;};}function handleError(_0x182940,_0x41ff9a){_0x41ff9a=_0x41ff9a||0x1f4;return function(_0x3125d3){logger[_0x5e69('0x26')](_0x3125d3[_0x5e69('0x27')]);if(_0x3125d3[_0x5e69('0x28')]){delete _0x3125d3[_0x5e69('0x28')];}_0x182940[_0x5e69('0x1a')](_0x41ff9a)[_0x5e69('0x29')](_0x3125d3);};}exports[_0x5e69('0x2a')]=function(_0x4a9ad5,_0x5d8a65){if(_0x4a9ad5['body']['id']){delete _0x4a9ad5[_0x5e69('0x2b')]['id'];}return db[_0x5e69('0x2c')][_0x5e69('0x2d')]({'where':{'id':_0x4a9ad5[_0x5e69('0x2e')]['id']}})[_0x5e69('0x24')](handleEntityNotFound(_0x5d8a65,null))[_0x5e69('0x24')](saveUpdates(_0x4a9ad5[_0x5e69('0x2b')],null))[_0x5e69('0x24')](respondWithResult(_0x5d8a65,null))[_0x5e69('0x2f')](handleError(_0x5d8a65,null));};exports[_0x5e69('0x25')]=function(_0x2d725a,_0x422c2d){return db[_0x5e69('0x2c')][_0x5e69('0x2d')]({'where':{'id':_0x2d725a[_0x5e69('0x2e')]['id']}})[_0x5e69('0x24')](handleEntityNotFound(_0x422c2d,null))['then'](removeEntity(_0x422c2d,null))[_0x5e69('0x2f')](handleError(_0x422c2d,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 6a5d22d..626cba1 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 _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 +var _0xfdb7=['exports','define','Condition','lodash','util','api','moment','request-promise','rimraf','./condition.attributes'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xfdb7,0x7b));var _0x7fdb=function(_0x53fb59,_0x39628b){_0x53fb59=_0x53fb59-0x0;var _0x3c31c0=_0xfdb7[_0x53fb59];return _0x3c31c0;};'use strict';var _=require(_0x7fdb('0x0'));var util=require(_0x7fdb('0x1'));var logger=require('../../config/logger')(_0x7fdb('0x2'));var moment=require(_0x7fdb('0x3'));var BPromise=require('bluebird');var rp=require(_0x7fdb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7fdb('0x5'));var config=require('../../config/environment');var attributes=require(_0x7fdb('0x6'));module[_0x7fdb('0x7')]=function(_0x124646,_0x2daa5c){return _0x124646[_0x7fdb('0x8')](_0x7fdb('0x9'),attributes,{'tableName':'tools_conditions','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 4c3cb15..61816e8 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 _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 +var _0xcd31=['info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','Condition,\x20%s,\x20%s','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x27b97a,_0x50cec2){var _0x1b8dff=function(_0x41e700){while(--_0x41e700){_0x27b97a['push'](_0x27b97a['shift']());}};_0x1b8dff(++_0x50cec2);}(_0xcd31,0x163));var _0x1cd3=function(_0x43b8b2,_0x4393a6){_0x43b8b2=_0x43b8b2-0x0;var _0x52a2e4=_0xcd31[_0x43b8b2];return _0x52a2e4;};'use strict';var _=require('lodash');var util=require(_0x1cd3('0x0'));var moment=require(_0x1cd3('0x1'));var BPromise=require(_0x1cd3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1cd3('0x3'));var db=require(_0x1cd3('0x4'))['db'];var utils=require(_0x1cd3('0x5'));var logger=require(_0x1cd3('0x6'))(_0x1cd3('0x7'));var config=require(_0x1cd3('0x8'));var jayson=require(_0x1cd3('0x9'));var client=jayson[_0x1cd3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38262f,_0x2d53d4,_0x2e7a6a){return new BPromise(function(_0x195b06,_0x54e180){return client[_0x1cd3('0xb')](_0x38262f,_0x2e7a6a)[_0x1cd3('0xc')](function(_0x4ea2c7){logger[_0x1cd3('0xd')]('Condition,\x20%s,\x20%s',_0x2d53d4,_0x1cd3('0xe'));logger[_0x1cd3('0xf')](_0x1cd3('0x10'),_0x2d53d4,_0x1cd3('0xe'),JSON[_0x1cd3('0x11')](_0x4ea2c7));if(_0x4ea2c7[_0x1cd3('0x12')]){if(_0x4ea2c7[_0x1cd3('0x12')]['code']===0x1f4){logger[_0x1cd3('0x12')]('Condition,\x20%s,\x20%s',_0x2d53d4,_0x4ea2c7[_0x1cd3('0x12')][_0x1cd3('0x13')]);return _0x54e180(_0x4ea2c7[_0x1cd3('0x12')][_0x1cd3('0x13')]);}logger[_0x1cd3('0x12')](_0x1cd3('0x14'),_0x2d53d4,_0x4ea2c7['error'][_0x1cd3('0x13')]);return _0x195b06(_0x4ea2c7['error'][_0x1cd3('0x13')]);}else{logger['info'](_0x1cd3('0x14'),_0x2d53d4,'request\x20sent');_0x195b06(_0x4ea2c7[_0x1cd3('0x15')][_0x1cd3('0x13')]);}})[_0x1cd3('0x16')](function(_0x1250b3){logger[_0x1cd3('0x12')](_0x1cd3('0x14'),_0x2d53d4,_0x1250b3);_0x54e180(_0x1250b3);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 02d2112..b159c4b 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 _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 +var _0xafc0=['/:id','multer','util','path','connect-timeout','Router','../../config/environment','./condition.controller'];(function(_0x2998db,_0x3424f1){var _0x115fea=function(_0x3b493c){while(--_0x3b493c){_0x2998db['push'](_0x2998db['shift']());}};_0x115fea(++_0x3424f1);}(_0xafc0,0x69));var _0x0afc=function(_0x975237,_0x347cbe){_0x975237=_0x975237-0x0;var _0x99e9e=_0xafc0[_0x975237];return _0x99e9e;};'use strict';var multer=require(_0x0afc('0x0'));var util=require(_0x0afc('0x1'));var path=require(_0x0afc('0x2'));var timeout=require(_0x0afc('0x3'));var express=require('express');var router=express[_0x0afc('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0afc('0x5'));var controller=require(_0x0afc('0x6'));router['put'](_0x0afc('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0afc('0x7'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index b1c5075..a684bb9 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 _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 +var _0x9b2a=['STRING','name','INTEGER','sequelize'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x9b2a,0x127));var _0xa9b2=function(_0x33e967,_0x487721){_0x33e967=_0x33e967-0x0;var _0xe0c64e=_0x9b2a[_0x33e967];return _0xe0c64e;};'use strict';var Sequelize=require(_0xa9b2('0x0'));module['exports']={'name':{'type':Sequelize[_0xa9b2('0x1')],'allowNull':![],'unique':_0xa9b2('0x2')},'OrderBy':{'type':Sequelize[_0xa9b2('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 92def0b..1be9f3e 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 _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 +var _0x89b8=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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/utils','../../config/environment','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','count','includeAll','include','findAll','catch','show','keys','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','userProfileId','autoAssociation','error','params'];(function(_0x2c4d34,_0x2ee772){var _0x438b83=function(_0x1328fe){while(--_0x1328fe){_0x2c4d34['push'](_0x2c4d34['shift']());}};_0x438b83(++_0x2ee772);}(_0x89b8,0x19f));var _0x889b=function(_0x5db6fc,_0xfb7b12){_0x5db6fc=_0x5db6fc-0x0;var _0x5282b4=_0x89b8[_0x5db6fc];return _0x5282b4;};'use strict';var pdf=require(_0x889b('0x0'));var emlformat=require(_0x889b('0x1'));var rimraf=require(_0x889b('0x2'));var zipdir=require(_0x889b('0x3'));var jsonpatch=require(_0x889b('0x4'));var rp=require(_0x889b('0x5'));var moment=require('moment');var BPromise=require(_0x889b('0x6'));var Mustache=require(_0x889b('0x7'));var util=require(_0x889b('0x8'));var path=require('path');var sox=require(_0x889b('0x9'));var csv=require(_0x889b('0xa'));var ejs=require(_0x889b('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x889b('0xc'));var crypto=require(_0x889b('0xd'));var jsforce=require(_0x889b('0xe'));var deskjs=require(_0x889b('0xf'));var toCsv=require(_0x889b('0xa'));var querystring=require(_0x889b('0x10'));var Papa=require(_0x889b('0x11'));var Redis=require(_0x889b('0x12'));var authService=require(_0x889b('0x13'));var qs=require(_0x889b('0x14'));var as=require(_0x889b('0x15'));var hardwareService=require(_0x889b('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x889b('0x17'));var config=require(_0x889b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x889b('0x19'))['db'];function respondWithStatusCode(_0x38ef17,_0x59d037){_0x59d037=_0x59d037||0xcc;return function(_0x39faa4){if(_0x39faa4){return _0x38ef17['sendStatus'](_0x59d037);}return _0x38ef17[_0x889b('0x1a')](_0x59d037)[_0x889b('0x1b')]();};}function respondWithResult(_0x52be1e,_0x5769eb){_0x5769eb=_0x5769eb||0xc8;return function(_0x10c838){if(_0x10c838){return _0x52be1e['status'](_0x5769eb)['json'](_0x10c838);}};}function respondWithFilteredResult(_0x4b2a7c,_0x2bf9f3){return function(_0xedb905){if(_0xedb905){var _0x3eda0b=_0xedb905['count'],_0x20e313=_0x2bf9f3[_0x889b('0x1c')],_0x41e548=_0x2bf9f3['offset']+_0x2bf9f3[_0x889b('0x1d')],_0x339556;if(_0x41e548>=_0x3eda0b){_0x41e548=_0x3eda0b;_0x339556=0xc8;}else{_0x339556=0xce;}_0x4b2a7c[_0x889b('0x1a')](_0x339556);return _0x4b2a7c[_0x889b('0x1e')](_0x889b('0x1f'),_0x20e313+'-'+_0x41e548+'/'+_0x3eda0b)[_0x889b('0x20')](_0xedb905);}return null;};}function patchUpdates(_0x49aed0){return function(_0x2eb6a3){try{jsonpatch[_0x889b('0x21')](_0x2eb6a3,_0x49aed0,!![]);}catch(_0x2c80f9){return BPromise[_0x889b('0x22')](_0x2c80f9);}return _0x2eb6a3[_0x889b('0x23')]();};}function saveUpdates(_0x13e7b7,_0x16c439){return function(_0x278a87){if(_0x278a87){return _0x278a87[_0x889b('0x24')](_0x13e7b7)[_0x889b('0x25')](function(_0x46534d){return _0x46534d;});}return null;};}function removeEntity(_0x5bf7e2,_0x4cb5a3){return function(_0x51440c){if(_0x51440c){return _0x51440c[_0x889b('0x26')]()['then'](function(){var _0x478824=_0x51440c[_0x889b('0x27')]({'plain':!![]});var _0x3ebaad='ContactItemTypes';return db[_0x889b('0x28')]['destroy']({'where':{'type':_0x3ebaad,'resourceId':_0x478824['id']}})[_0x889b('0x25')](function(){return _0x51440c;});})[_0x889b('0x25')](function(){_0x5bf7e2[_0x889b('0x1a')](0xcc)[_0x889b('0x1b')]();});}};}function handleEntityNotFound(_0x5b0469,_0x534663){return function(_0x11c41e){if(!_0x11c41e){_0x5b0469['sendStatus'](0x194);}return _0x11c41e;};}function handleError(_0x3962d8,_0x53ccc5){_0x53ccc5=_0x53ccc5||0x1f4;return function(_0x7badfe){logger['error'](_0x7badfe[_0x889b('0x29')]);if(_0x7badfe[_0x889b('0x2a')]){delete _0x7badfe[_0x889b('0x2a')];}_0x3962d8[_0x889b('0x1a')](_0x53ccc5)[_0x889b('0x2b')](_0x7badfe);};}exports['index']=function(_0x498a00,_0x395aab){var _0x39fce8={},_0x5dd57e={},_0x5d13b2={'count':0x0,'rows':[]};var _0x2b1802=_[_0x889b('0x2c')](db[_0x889b('0x2d')][_0x889b('0x2e')],function(_0x1321c9){return{'name':_0x1321c9[_0x889b('0x2f')],'type':_0x1321c9[_0x889b('0x30')][_0x889b('0x31')]};});_0x5dd57e['model']=_['map'](_0x2b1802,'name');_0x5dd57e[_0x889b('0x32')]=_['keys'](_0x498a00[_0x889b('0x32')]);_0x5dd57e['filters']=_[_0x889b('0x33')](_0x5dd57e[_0x889b('0x34')],_0x5dd57e[_0x889b('0x32')]);_0x39fce8[_0x889b('0x35')]=_[_0x889b('0x33')](_0x5dd57e['model'],qs[_0x889b('0x36')](_0x498a00['query'][_0x889b('0x36')]));_0x39fce8[_0x889b('0x35')]=_0x39fce8[_0x889b('0x35')]['length']?_0x39fce8[_0x889b('0x35')]:_0x5dd57e[_0x889b('0x34')];if(!_0x498a00[_0x889b('0x32')][_0x889b('0x37')]('nolimit')){_0x39fce8['limit']=qs['limit'](_0x498a00[_0x889b('0x32')]['limit']);_0x39fce8[_0x889b('0x1c')]=qs[_0x889b('0x1c')](_0x498a00[_0x889b('0x32')]['offset']);}_0x39fce8[_0x889b('0x38')]=qs[_0x889b('0x39')](_0x498a00[_0x889b('0x32')]['sort']);_0x39fce8[_0x889b('0x3a')]=qs[_0x889b('0x3b')](_[_0x889b('0x3c')](_0x498a00[_0x889b('0x32')],_0x5dd57e[_0x889b('0x3b')]),_0x2b1802);if(_0x498a00[_0x889b('0x32')][_0x889b('0x3d')]){_0x39fce8[_0x889b('0x3a')]=_[_0x889b('0x3e')](_0x39fce8[_0x889b('0x3a')],{'$or':_[_0x889b('0x2c')](_0x2b1802,function(_0x106358){if(_0x106358['type']!=='VIRTUAL'){var _0x1d9a11={};_0x1d9a11[_0x106358[_0x889b('0x2a')]]={'$like':'%'+_0x498a00['query'][_0x889b('0x3d')]+'%'};return _0x1d9a11;}})});}_0x39fce8=_[_0x889b('0x3e')]({},_0x39fce8,_0x498a00['options']);var _0x5333b0={'where':_0x39fce8[_0x889b('0x3a')]};return db[_0x889b('0x2d')]['count'](_0x5333b0)[_0x889b('0x25')](function(_0x195dd6){_0x5d13b2[_0x889b('0x3f')]=_0x195dd6;if(_0x498a00['query'][_0x889b('0x40')]){_0x39fce8[_0x889b('0x41')]=[{'all':!![]}];}return db['ContactItemType'][_0x889b('0x42')](_0x39fce8);})[_0x889b('0x25')](function(_0x6498ef){_0x5d13b2['rows']=_0x6498ef;return _0x5d13b2;})[_0x889b('0x25')](respondWithFilteredResult(_0x395aab,_0x39fce8))[_0x889b('0x43')](handleError(_0x395aab,null));};exports[_0x889b('0x44')]=function(_0x3a01df,_0x2c2e09){var _0x397219={'raw':!![],'where':{'id':_0x3a01df['params']['id']}},_0x45cc9f={};_0x45cc9f[_0x889b('0x34')]=_[_0x889b('0x45')](db[_0x889b('0x2d')][_0x889b('0x2e')]);_0x45cc9f[_0x889b('0x32')]=_[_0x889b('0x45')](_0x3a01df['query']);_0x45cc9f['filters']=_[_0x889b('0x33')](_0x45cc9f[_0x889b('0x34')],_0x45cc9f[_0x889b('0x32')]);_0x397219[_0x889b('0x35')]=_[_0x889b('0x33')](_0x45cc9f[_0x889b('0x34')],qs[_0x889b('0x36')](_0x3a01df[_0x889b('0x32')][_0x889b('0x36')]));_0x397219[_0x889b('0x35')]=_0x397219['attributes'][_0x889b('0x46')]?_0x397219['attributes']:_0x45cc9f[_0x889b('0x34')];if(_0x3a01df[_0x889b('0x32')]['includeAll']){_0x397219[_0x889b('0x41')]=[{'all':!![]}];}_0x397219=_[_0x889b('0x3e')]({},_0x397219,_0x3a01df[_0x889b('0x47')]);return db[_0x889b('0x2d')][_0x889b('0x48')](_0x397219)['then'](handleEntityNotFound(_0x2c2e09,null))[_0x889b('0x25')](respondWithResult(_0x2c2e09,null))[_0x889b('0x43')](handleError(_0x2c2e09,null));};exports[_0x889b('0x49')]=function(_0x5728c3,_0x70d13e){return db[_0x889b('0x2d')][_0x889b('0x49')](_0x5728c3[_0x889b('0x4a')],{})[_0x889b('0x25')](function(_0x1cca7a){var _0x2ff87b=_0x5728c3[_0x889b('0x4b')]['get']({'plain':!![]});if(!_0x2ff87b)throw new Error(_0x889b('0x4c'));if(_0x2ff87b[_0x889b('0x4d')]===_0x889b('0x4b')){var _0x4f6d54=_0x1cca7a['get']({'plain':!![]});var _0x6b274=_0x889b('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x6b274,'userProfileId':_0x2ff87b[_0x889b('0x4f')]},'raw':!![]})[_0x889b('0x25')](function(_0x5b6a8e){if(_0x5b6a8e&&_0x5b6a8e[_0x889b('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f6d54[_0x889b('0x2a')],'resourceId':_0x4f6d54['id'],'type':_0x5b6a8e[_0x889b('0x2a')],'sectionId':_0x5b6a8e['id']},{})[_0x889b('0x25')](function(){return _0x1cca7a;});}else{return _0x1cca7a;}})['catch'](function(_0x37e044){logger[_0x889b('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37e044);throw _0x37e044;});}return _0x1cca7a;})[_0x889b('0x25')](respondWithResult(_0x70d13e,0xc9))['catch'](handleError(_0x70d13e,null));};exports[_0x889b('0x24')]=function(_0x991a74,_0x1bcb36){if(_0x991a74['body']['id']){delete _0x991a74['body']['id'];}return db[_0x889b('0x2d')][_0x889b('0x48')]({'where':{'id':_0x991a74[_0x889b('0x52')]['id']}})[_0x889b('0x25')](handleEntityNotFound(_0x1bcb36,null))[_0x889b('0x25')](saveUpdates(_0x991a74[_0x889b('0x4a')],null))[_0x889b('0x25')](respondWithResult(_0x1bcb36,null))['catch'](handleError(_0x1bcb36,null));};exports[_0x889b('0x26')]=function(_0x5e8f87,_0x129c60){return db['ContactItemType'][_0x889b('0x48')]({'where':{'id':_0x5e8f87[_0x889b('0x52')]['id']}})['then'](handleEntityNotFound(_0x129c60,null))[_0x889b('0x25')](removeEntity(_0x129c60,null))[_0x889b('0x43')](handleError(_0x129c60,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index a93144b..bed6fbc 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 _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 +var _0xd916=['../../config/logger','api','moment','request-promise','path','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util'];(function(_0x27714d,_0x457b53){var _0x18e2fb=function(_0x28f1d9){while(--_0x28f1d9){_0x27714d['push'](_0x27714d['shift']());}};_0x18e2fb(++_0x457b53);}(_0xd916,0x18a));var _0x6d91=function(_0x581537,_0x69d09e){_0x581537=_0x581537-0x0;var _0x5d64e0=_0xd916[_0x581537];return _0x5d64e0;};'use strict';var _=require(_0x6d91('0x0'));var util=require(_0x6d91('0x1'));var logger=require(_0x6d91('0x2'))(_0x6d91('0x3'));var moment=require(_0x6d91('0x4'));var BPromise=require('bluebird');var rp=require(_0x6d91('0x5'));var fs=require('fs');var path=require(_0x6d91('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6d91('0x7'));module[_0x6d91('0x8')]=function(_0x59c589,_0x1f5cfc){return _0x59c589[_0x6d91('0x9')](_0x6d91('0xa'),attributes,{'tableName':_0x6d91('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index e9ab327..73f1008 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 _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 +var _0x8e44=['ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x48f476,_0x596ff6){var _0x12c6d9=function(_0x4e0fe4){while(--_0x4e0fe4){_0x48f476['push'](_0x48f476['shift']());}};_0x12c6d9(++_0x596ff6);}(_0x8e44,0x1ac));var _0x48e4=function(_0x30683e,_0x31e018){_0x30683e=_0x30683e-0x0;var _0x14eb02=_0x8e44[_0x30683e];return _0x14eb02;};'use strict';var _=require(_0x48e4('0x0'));var util=require(_0x48e4('0x1'));var moment=require(_0x48e4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x48e4('0x3'));var db=require(_0x48e4('0x4'))['db'];var utils=require(_0x48e4('0x5'));var logger=require(_0x48e4('0x6'))('rpc');var config=require(_0x48e4('0x7'));var jayson=require(_0x48e4('0x8'));var client=jayson[_0x48e4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e2c12,_0x26c5de,_0xfd30df){return new BPromise(function(_0x552cb1,_0x1ae7a7){return client[_0x48e4('0xa')](_0x4e2c12,_0xfd30df)[_0x48e4('0xb')](function(_0x2ba319){logger[_0x48e4('0xc')](_0x48e4('0xd'),_0x26c5de,'request\x20sent');logger[_0x48e4('0xe')](_0x48e4('0xf'),_0x26c5de,_0x48e4('0x10'),JSON['stringify'](_0x2ba319));if(_0x2ba319['error']){if(_0x2ba319[_0x48e4('0x11')][_0x48e4('0x12')]===0x1f4){logger[_0x48e4('0x11')](_0x48e4('0xd'),_0x26c5de,_0x2ba319['error'][_0x48e4('0x13')]);return _0x1ae7a7(_0x2ba319['error'][_0x48e4('0x13')]);}logger[_0x48e4('0x11')](_0x48e4('0xd'),_0x26c5de,_0x2ba319[_0x48e4('0x11')][_0x48e4('0x13')]);return _0x552cb1(_0x2ba319[_0x48e4('0x11')][_0x48e4('0x13')]);}else{logger['info'](_0x48e4('0xd'),_0x26c5de,_0x48e4('0x10'));_0x552cb1(_0x2ba319['result'][_0x48e4('0x13')]);}})[_0x48e4('0x14')](function(_0x4dc92e){logger[_0x48e4('0x11')](_0x48e4('0xd'),_0x26c5de,_0x4dc92e);_0x1ae7a7(_0x4dc92e);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 360d57b..fa1696f 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 _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 +var _0x8303=['create','put','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','isAuthenticated','index','get','/:id','show'];(function(_0x10baeb,_0x1f83cf){var _0x54493e=function(_0x14cb8c){while(--_0x14cb8c){_0x10baeb['push'](_0x10baeb['shift']());}};_0x54493e(++_0x1f83cf);}(_0x8303,0xa3));var _0x3830=function(_0x2bdaf5,_0x270c7a){_0x2bdaf5=_0x2bdaf5-0x0;var _0x14f43a=_0x8303[_0x2bdaf5];return _0x14f43a;};'use strict';var multer=require(_0x3830('0x0'));var util=require(_0x3830('0x1'));var path=require(_0x3830('0x2'));var timeout=require(_0x3830('0x3'));var express=require(_0x3830('0x4'));var router=express['Router']();var auth=require(_0x3830('0x5'));var interaction=require(_0x3830('0x6'));var config=require('../../config/environment');var controller=require(_0x3830('0x7'));router['get']('/',auth[_0x3830('0x8')](),controller[_0x3830('0x9')]);router[_0x3830('0xa')](_0x3830('0xb'),auth['isAuthenticated'](),controller[_0x3830('0xc')]);router['post']('/',auth[_0x3830('0x8')](),controller[_0x3830('0xd')]);router[_0x3830('0xe')](_0x3830('0xb'),auth[_0x3830('0x8')](),controller['update']);router['delete'](_0x3830('0xb'),auth[_0x3830('0x8')](),controller[_0x3830('0xf')]);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 bd358fb..a1b38d4 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 _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 +var _0x15c6=['name','sequelize','exports','STRING'];(function(_0x4d7995,_0x25050c){var _0x1b8592=function(_0x400ba9){while(--_0x400ba9){_0x4d7995['push'](_0x4d7995['shift']());}};_0x1b8592(++_0x25050c);}(_0x15c6,0x1cd));var _0x615c=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0x15c6[_0x22dac7];return _0x3e6cfa;};'use strict';var Sequelize=require(_0x615c('0x0'));module[_0x615c('0x1')]={'name':{'type':Sequelize[_0x615c('0x2')],'allowNull':![],'unique':_0x615c('0x3')},'description':{'type':Sequelize[_0x615c('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 8876ee3..681e9fc 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 _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 +var _0x7752=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','end','json','count','offset','limit','apply','reject','save','then','get','CustomDashboards','UserProfileResource','stack','name','send','index','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','Dashboard','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','update','destroy','attrUrl','attrs','https://','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','counter','attrMetric','total','attrVoiceQueues','attrFontSize','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','stringify','addItem','DashboardItem','getItems','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x315aea,_0x318a80){var _0x4a4bdb=function(_0x7c049c){while(--_0x7c049c){_0x315aea['push'](_0x315aea['shift']());}};_0x4a4bdb(++_0x318a80);}(_0x7752,0x14f));var _0x2775=function(_0x30b5e0,_0x532f1a){_0x30b5e0=_0x30b5e0-0x0;var _0x1f7afa=_0x7752[_0x30b5e0];return _0x1f7afa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2775('0x0'));var rimraf=require(_0x2775('0x1'));var zipdir=require(_0x2775('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2775('0x3'));var moment=require(_0x2775('0x4'));var BPromise=require(_0x2775('0x5'));var Mustache=require(_0x2775('0x6'));var util=require(_0x2775('0x7'));var path=require(_0x2775('0x8'));var sox=require('sox');var csv=require(_0x2775('0x9'));var ejs=require(_0x2775('0xa'));var fs=require('fs');var _=require(_0x2775('0xb'));var squel=require(_0x2775('0xc'));var crypto=require(_0x2775('0xd'));var jsforce=require(_0x2775('0xe'));var deskjs=require(_0x2775('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2775('0x10'));var Papa=require(_0x2775('0x11'));var Redis=require(_0x2775('0x12'));var authService=require(_0x2775('0x13'));var qs=require(_0x2775('0x14'));var as=require(_0x2775('0x15'));var hardwareService=require(_0x2775('0x16'));var logger=require(_0x2775('0x17'))(_0x2775('0x18'));var utils=require(_0x2775('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x2775('0x1a'));var db=require(_0x2775('0x1b'))['db'];config[_0x2775('0x1c')]=_[_0x2775('0x1d')](config[_0x2775('0x1c')],{'host':_0x2775('0x1e'),'port':0x18eb});var socket=require(_0x2775('0x1f'))(new Redis(config[_0x2775('0x1c')]));require(_0x2775('0x20'))['register'](socket);function respondWithStatusCode(_0x4c51a4,_0x3dd9e3){_0x3dd9e3=_0x3dd9e3||0xcc;return function(_0x5da369){if(_0x5da369){return _0x4c51a4[_0x2775('0x21')](_0x3dd9e3);}return _0x4c51a4[_0x2775('0x22')](_0x3dd9e3)[_0x2775('0x23')]();};}function respondWithResult(_0x3474ce,_0x1b6df5){_0x1b6df5=_0x1b6df5||0xc8;return function(_0x353a76){if(_0x353a76){return _0x3474ce['status'](_0x1b6df5)[_0x2775('0x24')](_0x353a76);}};}function respondWithFilteredResult(_0x18558f,_0x2dae5a){return function(_0x5ec31a){if(_0x5ec31a){var _0x4ca6f1=_0x5ec31a[_0x2775('0x25')],_0x29b85c=_0x2dae5a[_0x2775('0x26')],_0x5cfe1f=_0x2dae5a[_0x2775('0x26')]+_0x2dae5a[_0x2775('0x27')],_0x15561d;if(_0x5cfe1f>=_0x4ca6f1){_0x5cfe1f=_0x4ca6f1;_0x15561d=0xc8;}else{_0x15561d=0xce;}_0x18558f[_0x2775('0x22')](_0x15561d);return _0x18558f['set']('Content-Range',_0x29b85c+'-'+_0x5cfe1f+'/'+_0x4ca6f1)[_0x2775('0x24')](_0x5ec31a);}return null;};}function patchUpdates(_0x52ebd3){return function(_0xa4e538){try{jsonpatch[_0x2775('0x28')](_0xa4e538,_0x52ebd3,!![]);}catch(_0xaad438){return BPromise[_0x2775('0x29')](_0xaad438);}return _0xa4e538[_0x2775('0x2a')]();};}function saveUpdates(_0x4f324e,_0x513c6a){return function(_0x425671){if(_0x425671){return _0x425671['update'](_0x4f324e)[_0x2775('0x2b')](function(_0x36c815){return _0x36c815;});}return null;};}function removeEntity(_0x2e28d5,_0x40de02){return function(_0x4d15b8){if(_0x4d15b8){return _0x4d15b8['destroy']()[_0x2775('0x2b')](function(){var _0x549ba1=_0x4d15b8[_0x2775('0x2c')]({'plain':!![]});var _0x5a6d18=_0x2775('0x2d');return db[_0x2775('0x2e')]['destroy']({'where':{'type':_0x5a6d18,'resourceId':_0x549ba1['id']}})[_0x2775('0x2b')](function(){return _0x4d15b8;});})[_0x2775('0x2b')](function(){_0x2e28d5['status'](0xcc)[_0x2775('0x23')]();});}};}function handleEntityNotFound(_0x3e9b13,_0x34ea30){return function(_0xe01380){if(!_0xe01380){_0x3e9b13[_0x2775('0x21')](0x194);}return _0xe01380;};}function handleError(_0x3af105,_0x355c37){_0x355c37=_0x355c37||0x1f4;return function(_0x159fe9){logger['error'](_0x159fe9[_0x2775('0x2f')]);if(_0x159fe9[_0x2775('0x30')]){delete _0x159fe9[_0x2775('0x30')];}_0x3af105[_0x2775('0x22')](_0x355c37)[_0x2775('0x31')](_0x159fe9);};}exports[_0x2775('0x32')]=function(_0x110a30,_0x1eb5e1){var _0x10b28c={},_0x3d711c={},_0x2aed55={'count':0x0,'rows':[]};var _0x4e6a8e=_['map'](db['Dashboard']['rawAttributes'],function(_0x3100b1){return{'name':_0x3100b1[_0x2775('0x33')],'type':_0x3100b1[_0x2775('0x34')][_0x2775('0x35')]};});_0x3d711c[_0x2775('0x36')]=_[_0x2775('0x37')](_0x4e6a8e,'name');_0x3d711c[_0x2775('0x38')]=_[_0x2775('0x39')](_0x110a30[_0x2775('0x38')]);_0x3d711c['filters']=_['intersection'](_0x3d711c[_0x2775('0x36')],_0x3d711c[_0x2775('0x38')]);_0x10b28c[_0x2775('0x3a')]=_[_0x2775('0x3b')](_0x3d711c[_0x2775('0x36')],qs['fields'](_0x110a30[_0x2775('0x38')][_0x2775('0x3c')]));_0x10b28c[_0x2775('0x3a')]=_0x10b28c[_0x2775('0x3a')][_0x2775('0x3d')]?_0x10b28c['attributes']:_0x3d711c['model'];if(!_0x110a30['query']['hasOwnProperty'](_0x2775('0x3e'))){_0x10b28c[_0x2775('0x27')]=qs[_0x2775('0x27')](_0x110a30['query'][_0x2775('0x27')]);_0x10b28c[_0x2775('0x26')]=qs['offset'](_0x110a30[_0x2775('0x38')]['offset']);}_0x10b28c[_0x2775('0x3f')]=qs[_0x2775('0x40')](_0x110a30[_0x2775('0x38')][_0x2775('0x40')]);_0x10b28c[_0x2775('0x41')]=qs[_0x2775('0x42')](_[_0x2775('0x43')](_0x110a30[_0x2775('0x38')],_0x3d711c[_0x2775('0x42')]),_0x4e6a8e);if(_0x110a30[_0x2775('0x38')][_0x2775('0x44')]){_0x10b28c[_0x2775('0x41')]=_[_0x2775('0x45')](_0x10b28c[_0x2775('0x41')],{'$or':_[_0x2775('0x37')](_0x4e6a8e,function(_0x2ea1c9){if(_0x2ea1c9[_0x2775('0x34')]!=='VIRTUAL'){var _0x4e1163={};_0x4e1163[_0x2ea1c9['name']]={'$like':'%'+_0x110a30[_0x2775('0x38')][_0x2775('0x44')]+'%'};return _0x4e1163;}})});}_0x10b28c=_[_0x2775('0x45')]({},_0x10b28c,_0x110a30[_0x2775('0x46')]);var _0x13417f={'where':_0x10b28c[_0x2775('0x41')]};return db[_0x2775('0x47')][_0x2775('0x25')](_0x13417f)[_0x2775('0x2b')](function(_0x43ab36){_0x2aed55[_0x2775('0x25')]=_0x43ab36;if(_0x110a30['query'][_0x2775('0x48')]){_0x10b28c[_0x2775('0x49')]=[{'all':!![]}];}return db[_0x2775('0x47')][_0x2775('0x4a')](_0x10b28c);})[_0x2775('0x2b')](function(_0x2619e1){_0x2aed55[_0x2775('0x4b')]=_0x2619e1;return _0x2aed55;})['then'](respondWithFilteredResult(_0x1eb5e1,_0x10b28c))['catch'](handleError(_0x1eb5e1,null));};exports[_0x2775('0x4c')]=function(_0x2f15de,_0x31c4b3){var _0x5ba81f={'raw':![],'where':{'id':_0x2f15de[_0x2775('0x4d')]['id']}},_0x5ea260={};_0x5ea260[_0x2775('0x36')]=_[_0x2775('0x39')](db[_0x2775('0x47')][_0x2775('0x4e')]);_0x5ea260[_0x2775('0x38')]=_[_0x2775('0x39')](_0x2f15de[_0x2775('0x38')]);_0x5ea260[_0x2775('0x42')]=_['intersection'](_0x5ea260['model'],_0x5ea260[_0x2775('0x38')]);_0x5ba81f[_0x2775('0x3a')]=_[_0x2775('0x3b')](_0x5ea260[_0x2775('0x36')],qs[_0x2775('0x3c')](_0x2f15de[_0x2775('0x38')][_0x2775('0x3c')]));_0x5ba81f['attributes']=_0x5ba81f[_0x2775('0x3a')][_0x2775('0x3d')]?_0x5ba81f['attributes']:_0x5ea260[_0x2775('0x36')];if(_0x2f15de[_0x2775('0x38')][_0x2775('0x48')]){_0x5ba81f[_0x2775('0x49')]=[{'all':!![]}];}_0x5ba81f=_[_0x2775('0x45')]({},_0x5ba81f,_0x2f15de[_0x2775('0x46')]);return db[_0x2775('0x47')][_0x2775('0x4f')](_0x5ba81f)['then'](handleEntityNotFound(_0x31c4b3,null))['then'](respondWithResult(_0x31c4b3,null))[_0x2775('0x50')](handleError(_0x31c4b3,null));};exports[_0x2775('0x51')]=function(_0x384cd0,_0x4d7b82){return db['Dashboard']['create'](_0x384cd0[_0x2775('0x52')],{})[_0x2775('0x2b')](function(_0x235c6b){var _0x30d8a6=_0x384cd0['user'][_0x2775('0x2c')]({'plain':!![]});if(!_0x30d8a6)throw new Error(_0x2775('0x53'));if(_0x30d8a6['role']===_0x2775('0x54')){var _0x49461a=_0x235c6b[_0x2775('0x2c')]({'plain':!![]});var _0x261dd5=_0x2775('0x2d');return db[_0x2775('0x55')][_0x2775('0x4f')]({'where':{'name':_0x261dd5,'userProfileId':_0x30d8a6['userProfileId']},'raw':!![]})[_0x2775('0x2b')](function(_0x2d74b3){if(_0x2d74b3&&_0x2d74b3[_0x2775('0x56')]===0x0){return db[_0x2775('0x2e')][_0x2775('0x51')]({'name':_0x49461a['name'],'resourceId':_0x49461a['id'],'type':_0x2d74b3[_0x2775('0x30')],'sectionId':_0x2d74b3['id']},{})[_0x2775('0x2b')](function(){return _0x235c6b;});}else{return _0x235c6b;}})[_0x2775('0x50')](function(_0x4ef61){logger[_0x2775('0x57')](_0x2775('0x58'),_0x4ef61);throw _0x4ef61;});}return _0x235c6b;})[_0x2775('0x2b')](respondWithResult(_0x4d7b82,0xc9))[_0x2775('0x50')](handleError(_0x4d7b82,null));};exports[_0x2775('0x59')]=function(_0x5106ac,_0x54d69f){var _0x13b44b={'where':{'id':_0x5106ac[_0x2775('0x4d')]['id']}},_0x29b582={};_0x29b582[_0x2775('0x36')]=_[_0x2775('0x39')](db[_0x2775('0x47')][_0x2775('0x4e')]);_0x13b44b[_0x2775('0x3a')]=_['intersection'](_0x29b582[_0x2775('0x36')],qs[_0x2775('0x3c')](_0x5106ac['query'][_0x2775('0x3c')]));_0x13b44b['attributes']=_0x13b44b['attributes']['length']?_0x13b44b[_0x2775('0x3a')]:_0x29b582[_0x2775('0x36')];if(_0x5106ac['query'][_0x2775('0x48')]){_0x13b44b[_0x2775('0x49')]=[{'all':!![]}];}_0x13b44b=_[_0x2775('0x45')]({},_0x13b44b,_0x5106ac[_0x2775('0x46')]);return db[_0x2775('0x47')][_0x2775('0x4f')](_0x13b44b)['then'](handleEntityNotFound(_0x54d69f,null))['then'](function(_0x338d54){if(_0x338d54){var _0x36109e=_0x338d54[_0x2775('0x2c')]({'plain':!![]});_0x36109e=qs[_0x2775('0x5a')](_0x36109e,['id','createdAt','updatedAt']);_0x5106ac[_0x2775('0x52')]=_[_0x2775('0x5a')](_0x5106ac[_0x2775('0x52')],['id','createdAt',_0x2775('0x5b')]);return db[_0x2775('0x47')][_0x2775('0x51')](_['merge'](_0x36109e,_0x5106ac[_0x2775('0x52')]),{'include':_0x5106ac[_0x2775('0x38')][_0x2775('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x1729a1){var _0x21852b=_0x5106ac[_0x2775('0x54')][_0x2775('0x2c')]({'plain':!![]});if(!_0x21852b)throw new Error(_0x2775('0x53'));if(_0x21852b['role']===_0x2775('0x54')){var _0x2b2ec1=_0x1729a1[_0x2775('0x2c')]({'plain':!![]});var _0x8e4bf0=_0x2775('0x2d');return db[_0x2775('0x55')][_0x2775('0x4f')]({'where':{'name':_0x8e4bf0,'userProfileId':_0x21852b['userProfileId']},'raw':!![]})['then'](function(_0xa021bf){if(_0xa021bf&&_0xa021bf[_0x2775('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x2b2ec1[_0x2775('0x30')],'resourceId':_0x2b2ec1['id'],'type':_0xa021bf['name'],'sectionId':_0xa021bf['id']},{})[_0x2775('0x2b')](function(){return _0x1729a1;});}else{return _0x1729a1;}})[_0x2775('0x50')](function(_0x18765b){logger['error'](_0x2775('0x58'),_0x18765b);throw _0x18765b;});}return _0x1729a1;});}})['then'](respondWithResult(_0x54d69f,0xc9))[_0x2775('0x50')](handleError(_0x54d69f,null));};exports[_0x2775('0x5c')]=function(_0x4931f5,_0x40035a){if(_0x4931f5[_0x2775('0x52')]['id']){delete _0x4931f5['body']['id'];}return db[_0x2775('0x47')][_0x2775('0x4f')]({'where':{'id':_0x4931f5[_0x2775('0x4d')]['id']}})[_0x2775('0x2b')](handleEntityNotFound(_0x40035a,null))['then'](saveUpdates(_0x4931f5[_0x2775('0x52')],null))[_0x2775('0x2b')](respondWithResult(_0x40035a,null))[_0x2775('0x50')](handleError(_0x40035a,null));};exports[_0x2775('0x5d')]=function(_0x591de9,_0x984e5f){return db[_0x2775('0x47')][_0x2775('0x4f')]({'where':{'id':_0x591de9['params']['id']}})[_0x2775('0x2b')](handleEntityNotFound(_0x984e5f,null))[_0x2775('0x2b')](removeEntity(_0x984e5f,null))[_0x2775('0x50')](handleError(_0x984e5f,null));};function widgetAttributes(_0x5a31e8){try{switch(_0x5a31e8['type']){case'iframe':return[{'name':_0x2775('0x5e'),'value':_0x5a31e8[_0x2775('0x5e')]||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8[_0x2775('0x5f')][0x0]?_0x5a31e8['attrs'][0x0]['value']:undefined)||_0x2775('0x60')}];case'custom':return[{'name':_0x2775('0x61'),'value':_0x5a31e8[_0x2775('0x61')]||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8[_0x2775('0x5f')][0x0]?_0x5a31e8[_0x2775('0x5f')][0x0]['value']:undefined)||''}];case _0x2775('0x62'):return[{'name':_0x2775('0x63'),'value':_0x5a31e8[_0x2775('0x63')]||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8['attrs'][0x0]?_0x5a31e8['attrs'][0x0][_0x2775('0x64')]:undefined)||_0x2775('0x65')},{'name':_0x2775('0x66'),'value':_0x5a31e8[_0x2775('0x66')]||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8[_0x2775('0x5f')][0x1]?_0x5a31e8[_0x2775('0x5f')][0x1][_0x2775('0x64')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x5a31e8['attrFontSize']||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8[_0x2775('0x5f')][0x2]?_0x5a31e8[_0x2775('0x5f')][0x2]['value']:undefined)||0xc}];case _0x2775('0x67'):return[{'name':_0x2775('0x68'),'value':_0x5a31e8[_0x2775('0x68')]||(_0x5a31e8['attrs']&&_0x5a31e8[_0x2775('0x5f')][0x0]?_0x5a31e8[_0x2775('0x5f')][0x0][_0x2775('0x64')]:undefined)||_0x2775('0x69')},{'name':_0x2775('0x6a'),'value':_0x5a31e8['attrVoiceQueues']||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8['attrs'][0x1]?_0x5a31e8[_0x2775('0x5f')][0x1][_0x2775('0x64')]:undefined)||[]},{'name':_0x2775('0x6b'),'value':_0x5a31e8['attrFontSize']||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8[_0x2775('0x5f')][0x2]?_0x5a31e8[_0x2775('0x5f')][0x2]['value']:undefined)||0x14}];case _0x2775('0x6c'):case'pie-chart':return[{'name':_0x2775('0x6d'),'value':_0x5a31e8[_0x2775('0x6d')]||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8['attrs'][0x0]?_0x5a31e8[_0x2775('0x5f')][0x0]['value']:undefined)||_0x2775('0x69')},{'name':_0x2775('0x6e'),'value':_0x5a31e8['attrSerie2']||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8[_0x2775('0x5f')][0x1]?_0x5a31e8[_0x2775('0x5f')][0x1][_0x2775('0x64')]:undefined)||null},{'name':_0x2775('0x6f'),'value':_0x5a31e8[_0x2775('0x6f')]||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8[_0x2775('0x5f')][0x2]?_0x5a31e8[_0x2775('0x5f')][0x2][_0x2775('0x64')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x5a31e8['attrVoiceQueues']||(_0x5a31e8['attrs']&&_0x5a31e8['attrs'][0x3]?_0x5a31e8[_0x2775('0x5f')][0x3][_0x2775('0x64')]:undefined)||[]}];case'web-report':return[{'name':_0x2775('0x70'),'type':_0x5a31e8[_0x2775('0x71')]||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8[_0x2775('0x5f')][0x0]?_0x5a31e8[_0x2775('0x5f')][0x0][_0x2775('0x34')]:undefined)||null,'value':_0x5a31e8[_0x2775('0x70')]||(_0x5a31e8['attrs']&&_0x5a31e8[_0x2775('0x5f')][0x0]?_0x5a31e8[_0x2775('0x5f')][0x0]['value']:undefined)||null},{'name':_0x2775('0x72'),'value':_0x5a31e8[_0x2775('0x72')]||(_0x5a31e8['attrs']&&_0x5a31e8[_0x2775('0x5f')][0x1]?_0x5a31e8[_0x2775('0x5f')][0x1][_0x2775('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x3d182a){logger[_0x2775('0x57')]('widgetAttributes:\x20%s',JSON[_0x2775('0x73')](_0x3d182a));return[];}}exports[_0x2775('0x74')]=function(_0x34c338,_0x2043fe,_0x52bf5e){if(_0x34c338[_0x2775('0x52')]['id']){delete _0x34c338['body']['id'];}return db['Dashboard'][_0x2775('0x4f')]({'where':{'id':_0x34c338['params']['id']}})['then'](handleEntityNotFound(_0x2043fe,null))[_0x2775('0x2b')](function(_0x1de62b){if(_0x1de62b){_0x34c338[_0x2775('0x52')]['DashboardId']=_0x1de62b['id'];_0x34c338[_0x2775('0x52')][_0x2775('0x5f')]=widgetAttributes(_0x34c338[_0x2775('0x52')]);return db[_0x2775('0x75')][_0x2775('0x51')](_0x34c338[_0x2775('0x52')]);}})[_0x2775('0x2b')](respondWithResult(_0x2043fe,null))['catch'](handleError(_0x2043fe,null));};exports[_0x2775('0x76')]=function(_0x2edf06,_0x4da3f6,_0x449408){var _0x4b9a33={};var _0x26311c={};var _0x2fca99;var _0x1df59d;return db[_0x2775('0x47')]['findOne']({'where':{'id':_0x2edf06[_0x2775('0x4d')]['id']}})[_0x2775('0x2b')](handleEntityNotFound(_0x4da3f6,null))[_0x2775('0x2b')](function(_0x51e0a6){if(_0x51e0a6){_0x2fca99=_0x51e0a6;_0x26311c[_0x2775('0x36')]=_[_0x2775('0x39')](db[_0x2775('0x75')]['rawAttributes']);_0x26311c['query']=_[_0x2775('0x39')](_0x2edf06[_0x2775('0x38')]);_0x26311c[_0x2775('0x42')]=_[_0x2775('0x3b')](_0x26311c['model'],_0x26311c[_0x2775('0x38')]);_0x4b9a33[_0x2775('0x3a')]=_[_0x2775('0x3b')](_0x26311c[_0x2775('0x36')],qs[_0x2775('0x3c')](_0x2edf06[_0x2775('0x38')]['fields']));_0x4b9a33[_0x2775('0x3a')]=_0x4b9a33[_0x2775('0x3a')][_0x2775('0x3d')]?_0x4b9a33['attributes']:_0x26311c[_0x2775('0x36')];_0x4b9a33[_0x2775('0x3f')]=qs[_0x2775('0x40')](_0x2edf06[_0x2775('0x38')][_0x2775('0x40')]);_0x4b9a33['where']=qs[_0x2775('0x42')](_[_0x2775('0x43')](_0x2edf06[_0x2775('0x38')],_0x26311c[_0x2775('0x42')]));if(_0x2edf06['query']['filter']){_0x4b9a33['where']=_['merge'](_0x4b9a33[_0x2775('0x41')],{'$or':_['map'](_0x4b9a33[_0x2775('0x3a')],function(_0x1a38b6){var _0x54237b={};_0x54237b[_0x1a38b6]={'$like':'%'+_0x2edf06[_0x2775('0x38')][_0x2775('0x44')]+'%'};return _0x54237b;})});}_0x4b9a33=_[_0x2775('0x45')]({},_0x4b9a33,_0x2edf06['options']);return _0x2fca99[_0x2775('0x76')](_0x4b9a33);}})['then'](function(_0x195ec3){if(_0x195ec3){_0x1df59d=_0x195ec3[_0x2775('0x3d')];if(!_0x2edf06[_0x2775('0x38')]['hasOwnProperty'](_0x2775('0x3e'))){_0x4b9a33[_0x2775('0x27')]=qs['limit'](_0x2edf06[_0x2775('0x38')][_0x2775('0x27')]);_0x4b9a33[_0x2775('0x26')]=qs['offset'](_0x2edf06[_0x2775('0x38')][_0x2775('0x26')]);}return _0x2fca99[_0x2775('0x76')](_0x4b9a33);}})[_0x2775('0x2b')](function(_0x585a2f){if(_0x585a2f){return _0x585a2f?{'count':_0x1df59d,'rows':_0x585a2f}:null;}})['then'](respondWithResult(_0x4da3f6,null))[_0x2775('0x50')](handleError(_0x4da3f6,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index d70920e..b35c80b 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 _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 +var _0x1ae5=['events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x436184,_0x295ad3){var _0x1b115b=function(_0x5290ed){while(--_0x5290ed){_0x436184['push'](_0x436184['shift']());}};_0x1b115b(++_0x295ad3);}(_0x1ae5,0x129));var _0x51ae=function(_0x12f958,_0x3cda84){_0x12f958=_0x12f958-0x0;var _0x29967c=_0x1ae5[_0x12f958];return _0x29967c;};'use strict';var EventEmitter=require(_0x51ae('0x0'));var Dashboard=require(_0x51ae('0x1'))['db'][_0x51ae('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x51ae('0x3')](0x0);var events={'afterCreate':_0x51ae('0x4'),'afterUpdate':_0x51ae('0x5'),'afterDestroy':_0x51ae('0x6')};function emitEvent(_0x478e6a){return function(_0x4e3c89,_0x364d35,_0x8bbaf3){DashboardEvents[_0x51ae('0x7')](_0x478e6a+':'+_0x4e3c89['id'],_0x4e3c89);DashboardEvents[_0x51ae('0x7')](_0x478e6a,_0x4e3c89);_0x8bbaf3(null);};}for(var e in events){if(events[_0x51ae('0x8')](e)){var event=events[e];Dashboard[_0x51ae('0x9')](e,emitEvent(event));}}module[_0x51ae('0xa')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index e4d2799..2d6471c 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 _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 +var _0x1665=['dashboards','lodash','../../config/logger','api','moment','path','./dashboard.attributes','exports','define','Dashboard'];(function(_0x254c9e,_0xab8a1b){var _0x2d4cb6=function(_0x15b027){while(--_0x15b027){_0x254c9e['push'](_0x254c9e['shift']());}};_0x2d4cb6(++_0xab8a1b);}(_0x1665,0x155));var _0x5166=function(_0xe1b12b,_0x241bd1){_0xe1b12b=_0xe1b12b-0x0;var _0x1b697a=_0x1665[_0xe1b12b];return _0x1b697a;};'use strict';var _=require(_0x5166('0x0'));var util=require('util');var logger=require(_0x5166('0x1'))(_0x5166('0x2'));var moment=require(_0x5166('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5166('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5166('0x5'));module[_0x5166('0x6')]=function(_0x412a9e,_0x42d1c1){return _0x412a9e[_0x5166('0x7')](_0x5166('0x8'),attributes,{'tableName':_0x5166('0x9'),'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 ba75e80..8084029 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 _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 +var _0x6c98=['redis','localhost','socket.io-emitter','./dashboard.socket','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c98,0xdf));var _0x86c9=function(_0x1ae929,_0x5396c6){_0x1ae929=_0x1ae929-0x0;var _0x57343b=_0x6c98[_0x1ae929];return _0x57343b;};'use strict';var _=require(_0x86c9('0x0'));var util=require(_0x86c9('0x1'));var moment=require(_0x86c9('0x2'));var BPromise=require(_0x86c9('0x3'));var rs=require(_0x86c9('0x4'));var fs=require('fs');var Redis=require(_0x86c9('0x5'));var db=require(_0x86c9('0x6'))['db'];var utils=require(_0x86c9('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x86c9('0x8'));var jayson=require(_0x86c9('0x9'));var client=jayson[_0x86c9('0xa')]['http']({'port':0x232a});config[_0x86c9('0xb')]=_['defaults'](config[_0x86c9('0xb')],{'host':_0x86c9('0xc'),'port':0x18eb});var socket=require(_0x86c9('0xd'))(new Redis(config[_0x86c9('0xb')]));require(_0x86c9('0xe'))['register'](socket);function respondWithRpcPromise(_0x3203fd,_0x134efb,_0xed441b){return new BPromise(function(_0xf38ad3,_0x56c3f5){return client[_0x86c9('0xf')](_0x3203fd,_0xed441b)[_0x86c9('0x10')](function(_0x3bc9b9){logger['info'](_0x86c9('0x11'),_0x134efb,_0x86c9('0x12'));logger[_0x86c9('0x13')](_0x86c9('0x14'),_0x134efb,_0x86c9('0x12'),JSON[_0x86c9('0x15')](_0x3bc9b9));if(_0x3bc9b9['error']){if(_0x3bc9b9[_0x86c9('0x16')][_0x86c9('0x17')]===0x1f4){logger[_0x86c9('0x16')]('Dashboard,\x20%s,\x20%s',_0x134efb,_0x3bc9b9['error']['message']);return _0x56c3f5(_0x3bc9b9['error'][_0x86c9('0x18')]);}logger[_0x86c9('0x16')]('Dashboard,\x20%s,\x20%s',_0x134efb,_0x3bc9b9['error'][_0x86c9('0x18')]);return _0xf38ad3(_0x3bc9b9[_0x86c9('0x16')][_0x86c9('0x18')]);}else{logger['info'](_0x86c9('0x11'),_0x134efb,_0x86c9('0x12'));_0xf38ad3(_0x3bc9b9[_0x86c9('0x19')][_0x86c9('0x18')]);}})['catch'](function(_0x323da6){logger[_0x86c9('0x16')](_0x86c9('0x11'),_0x134efb,_0x323da6);_0x56c3f5(_0x323da6);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 541ad23..cf6b54a 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 _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 +var _0xc4b4=['remove','update','register','length','dashboard:','./dashboard.events','save'];(function(_0x1742fa,_0x643f74){var _0x5c240e=function(_0x32320a){while(--_0x32320a){_0x1742fa['push'](_0x1742fa['shift']());}};_0x5c240e(++_0x643f74);}(_0xc4b4,0x1e1));var _0x4c4b=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xc4b4[_0x27af45];return _0x18df21;};'use strict';var DashboardEvents=require(_0x4c4b('0x0'));var events=[_0x4c4b('0x1'),_0x4c4b('0x2'),_0x4c4b('0x3')];function createListener(_0x33718b,_0x5b0f29){return function(_0x578e7a){_0x5b0f29['emit'](_0x33718b,_0x578e7a);};}function removeListener(_0x499d95,_0x573310){return function(){DashboardEvents['removeListener'](_0x499d95,_0x573310);};}exports[_0x4c4b('0x4')]=function(_0x4ca153){for(var _0x87e13=0x0,_0x3b44b2=events[_0x4c4b('0x5')];_0x87e13<_0x3b44b2;_0x87e13++){var _0x455761=events[_0x87e13];var _0x108285=createListener(_0x4c4b('0x6')+_0x455761,_0x4ca153);DashboardEvents['on'](_0x455761,_0x108285);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 3bdaf7c..be2af72 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 _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 +var _0xa9e0=['/:id','/:id/items','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated'];(function(_0x26ca72,_0x119131){var _0xb39f6d=function(_0x27766d){while(--_0x27766d){_0x26ca72['push'](_0x26ca72['shift']());}};_0xb39f6d(++_0x119131);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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['getItems']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xb')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['clone']);router['post']('/:id/items',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/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 6f06b81..0dfbe2c 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 _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 +var _0x53a9=['sequelize','squel','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x3bfa22,_0x17ef2c){var _0x19fb0b=function(_0x4889dc){while(--_0x4889dc){_0x3bfa22['push'](_0x3bfa22['shift']());}};_0x19fb0b(++_0x17ef2c);}(_0x53a9,0x188));var _0x953a=function(_0x1f3044,_0x2a3426){_0x1f3044=_0x1f3044-0x0;var _0x2aa7d7=_0x53a9[_0x1f3044];return _0x2aa7d7;};'use strict';var Sequelize=require(_0x953a('0x0'));var squel=require(_0x953a('0x1'));var _=require('lodash');module[_0x953a('0x2')]={'title':{'type':Sequelize[_0x953a('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x953a('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x953a('0x4')](_0x953a('0x5')),'get':function(){try{return JSON[_0x953a('0x6')](this[_0x953a('0x7')]('attrs'));}catch(_0x4e22a2){return[];}},'set':function(_0x3ce61f){try{this['setDataValue'](_0x953a('0x8'),JSON['stringify'](_0x3ce61f));}catch(_0x2d5f68){this[_0x953a('0x9')](_0x953a('0x8'),JSON[_0x953a('0xa')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x953a('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x953a('0xb')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x953a('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x953a('0x3')],'allowNull':![],'defaultValue':_0x953a('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x953a('0x3')]},'titleFontSize':{'type':Sequelize[_0x953a('0xb')],'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 c794cf0..d241b0f 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 _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 +var _0x8b6d=['intersection','fields','length','includeAll','include','merge','options','find','params','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','json','count','offset','limit','Content-Range','save','update','then','destroy','end','error','stack','show','keys','DashboardItem','rawAttributes','query','filters','model','attributes'];(function(_0x2ceec2,_0x284b13){var _0x11d812=function(_0x58f3ec){while(--_0x58f3ec){_0x2ceec2['push'](_0x2ceec2['shift']());}};_0x11d812(++_0x284b13);}(_0x8b6d,0x17d));var _0xd8b6=function(_0x3eb350,_0x40205e){_0x3eb350=_0x3eb350-0x0;var _0x175e2d=_0x8b6d[_0x3eb350];return _0x175e2d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd8b6('0x0'));var zipdir=require(_0xd8b6('0x1'));var jsonpatch=require(_0xd8b6('0x2'));var rp=require('request-promise');var moment=require(_0xd8b6('0x3'));var BPromise=require(_0xd8b6('0x4'));var Mustache=require(_0xd8b6('0x5'));var util=require('util');var path=require(_0xd8b6('0x6'));var sox=require('sox');var csv=require(_0xd8b6('0x7'));var ejs=require(_0xd8b6('0x8'));var fs=require('fs');var _=require(_0xd8b6('0x9'));var squel=require(_0xd8b6('0xa'));var crypto=require(_0xd8b6('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd8b6('0xc'));var Papa=require(_0xd8b6('0xd'));var Redis=require(_0xd8b6('0xe'));var authService=require(_0xd8b6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd8b6('0x10'));var hardwareService=require(_0xd8b6('0x11'));var logger=require(_0xd8b6('0x12'))(_0xd8b6('0x13'));var utils=require(_0xd8b6('0x14'));var config=require(_0xd8b6('0x15'));var licenseUtil=require(_0xd8b6('0x16'));var db=require(_0xd8b6('0x17'))['db'];config[_0xd8b6('0x18')]=_['defaults'](config['redis'],{'host':_0xd8b6('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd8b6('0x18')]));require('./dashboardItem.socket')[_0xd8b6('0x1a')](socket);function respondWithStatusCode(_0x114fdf,_0x4cf19c){_0x4cf19c=_0x4cf19c||0xcc;return function(_0x2cd02c){if(_0x2cd02c){return _0x114fdf[_0xd8b6('0x1b')](_0x4cf19c);}return _0x114fdf[_0xd8b6('0x1c')](_0x4cf19c)['end']();};}function respondWithResult(_0x31ccaf,_0x101ee2){_0x101ee2=_0x101ee2||0xc8;return function(_0x46cb0b){if(_0x46cb0b){return _0x31ccaf[_0xd8b6('0x1c')](_0x101ee2)[_0xd8b6('0x1d')](_0x46cb0b);}};}function respondWithFilteredResult(_0x44f55d,_0x4d6612){return function(_0x64b812){if(_0x64b812){var _0x30e556=_0x64b812[_0xd8b6('0x1e')],_0x2e0fa7=_0x4d6612[_0xd8b6('0x1f')],_0xeffc4b=_0x4d6612[_0xd8b6('0x1f')]+_0x4d6612[_0xd8b6('0x20')],_0x451807;if(_0xeffc4b>=_0x30e556){_0xeffc4b=_0x30e556;_0x451807=0xc8;}else{_0x451807=0xce;}_0x44f55d[_0xd8b6('0x1c')](_0x451807);return _0x44f55d['set'](_0xd8b6('0x21'),_0x2e0fa7+'-'+_0xeffc4b+'/'+_0x30e556)[_0xd8b6('0x1d')](_0x64b812);}return null;};}function patchUpdates(_0x106b06){return function(_0x3db9f4){try{jsonpatch['apply'](_0x3db9f4,_0x106b06,!![]);}catch(_0x2e790b){return BPromise['reject'](_0x2e790b);}return _0x3db9f4[_0xd8b6('0x22')]();};}function saveUpdates(_0x4c1578,_0x5ed2ac){return function(_0x1006da){if(_0x1006da){return _0x1006da[_0xd8b6('0x23')](_0x4c1578)[_0xd8b6('0x24')](function(_0x1e0ba5){return _0x1e0ba5;});}return null;};}function removeEntity(_0x2aeead,_0x11f76c){return function(_0x4136d6){if(_0x4136d6){return _0x4136d6[_0xd8b6('0x25')]()[_0xd8b6('0x24')](function(){_0x2aeead['status'](0xcc)[_0xd8b6('0x26')]();});}};}function handleEntityNotFound(_0x426fdf,_0x494675){return function(_0x5c1e45){if(!_0x5c1e45){_0x426fdf[_0xd8b6('0x1b')](0x194);}return _0x5c1e45;};}function handleError(_0xc0bfad,_0x80c72){_0x80c72=_0x80c72||0x1f4;return function(_0x33827d){logger[_0xd8b6('0x27')](_0x33827d[_0xd8b6('0x28')]);if(_0x33827d['name']){delete _0x33827d['name'];}_0xc0bfad['status'](_0x80c72)['send'](_0x33827d);};}exports[_0xd8b6('0x29')]=function(_0x5a50d9,_0x4ba926){var _0x45fa08={'raw':![],'where':{'id':_0x5a50d9['params']['id']}},_0x5d338a={};_0x5d338a['model']=_[_0xd8b6('0x2a')](db[_0xd8b6('0x2b')][_0xd8b6('0x2c')]);_0x5d338a[_0xd8b6('0x2d')]=_[_0xd8b6('0x2a')](_0x5a50d9[_0xd8b6('0x2d')]);_0x5d338a[_0xd8b6('0x2e')]=_['intersection'](_0x5d338a[_0xd8b6('0x2f')],_0x5d338a[_0xd8b6('0x2d')]);_0x45fa08[_0xd8b6('0x30')]=_[_0xd8b6('0x31')](_0x5d338a['model'],qs[_0xd8b6('0x32')](_0x5a50d9[_0xd8b6('0x2d')][_0xd8b6('0x32')]));_0x45fa08[_0xd8b6('0x30')]=_0x45fa08[_0xd8b6('0x30')][_0xd8b6('0x33')]?_0x45fa08[_0xd8b6('0x30')]:_0x5d338a[_0xd8b6('0x2f')];if(_0x5a50d9[_0xd8b6('0x2d')][_0xd8b6('0x34')]){_0x45fa08[_0xd8b6('0x35')]=[{'all':!![]}];}_0x45fa08=_[_0xd8b6('0x36')]({},_0x45fa08,_0x5a50d9[_0xd8b6('0x37')]);return db['DashboardItem'][_0xd8b6('0x38')](_0x45fa08)[_0xd8b6('0x24')](handleEntityNotFound(_0x4ba926,null))[_0xd8b6('0x24')](respondWithResult(_0x4ba926,null))['catch'](handleError(_0x4ba926,null));};exports[_0xd8b6('0x25')]=function(_0x5d0951,_0x2119d8){return db[_0xd8b6('0x2b')][_0xd8b6('0x38')]({'where':{'id':_0x5d0951[_0xd8b6('0x39')]['id']}})[_0xd8b6('0x24')](handleEntityNotFound(_0x2119d8,null))[_0xd8b6('0x24')](removeEntity(_0x2119d8,null))[_0xd8b6('0x3a')](handleError(_0x2119d8,null));};function widgetAttributes(_0x51777b){try{switch(_0x51777b[_0xd8b6('0x3b')]){case _0xd8b6('0x3c'):return[{'name':_0xd8b6('0x3d'),'value':_0x51777b['attrUrl']||(_0x51777b['attrs']&&_0x51777b[_0xd8b6('0x3e')][0x0]?_0x51777b[_0xd8b6('0x3e')][0x0][_0xd8b6('0x3f')]:undefined)||_0xd8b6('0x40')}];case _0xd8b6('0x41'):return[{'name':_0xd8b6('0x42'),'value':_0x51777b[_0xd8b6('0x42')]||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b['attrs'][0x0]?_0x51777b['attrs'][0x0][_0xd8b6('0x3f')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x51777b[_0xd8b6('0x43')]||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b['attrs'][0x0]?_0x51777b[_0xd8b6('0x3e')][0x0][_0xd8b6('0x3f')]:undefined)||_0xd8b6('0x44')},{'name':_0xd8b6('0x45'),'value':_0x51777b[_0xd8b6('0x45')]||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b[_0xd8b6('0x3e')][0x1]?_0x51777b[_0xd8b6('0x3e')][0x1][_0xd8b6('0x3f')]:undefined)||_0xd8b6('0x46')},{'name':_0xd8b6('0x47'),'value':_0x51777b[_0xd8b6('0x47')]||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b[_0xd8b6('0x3e')][0x2]?_0x51777b[_0xd8b6('0x3e')][0x2]['value']:undefined)||0xc}];case _0xd8b6('0x48'):return[{'name':_0xd8b6('0x49'),'value':_0x51777b[_0xd8b6('0x49')]||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b[_0xd8b6('0x3e')][0x0]?_0x51777b[_0xd8b6('0x3e')][0x0][_0xd8b6('0x3f')]:undefined)||_0xd8b6('0x4a')},{'name':'attrVoiceQueues','value':_0x51777b['attrVoiceQueues']||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b[_0xd8b6('0x3e')][0x1]?_0x51777b['attrs'][0x1][_0xd8b6('0x3f')]:undefined)||[]},{'name':_0xd8b6('0x47'),'value':_0x51777b[_0xd8b6('0x47')]||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b[_0xd8b6('0x3e')][0x2]?_0x51777b['attrs'][0x2][_0xd8b6('0x3f')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0xd8b6('0x4b'),'value':_0x51777b['attrSerie1']||(_0x51777b['attrs']&&_0x51777b['attrs'][0x0]?_0x51777b[_0xd8b6('0x3e')][0x0][_0xd8b6('0x3f')]:undefined)||_0xd8b6('0x4a')},{'name':_0xd8b6('0x4c'),'value':_0x51777b[_0xd8b6('0x4c')]||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b[_0xd8b6('0x3e')][0x1]?_0x51777b[_0xd8b6('0x3e')][0x1][_0xd8b6('0x3f')]:undefined)||null},{'name':_0xd8b6('0x4d'),'value':_0x51777b[_0xd8b6('0x4d')]||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b[_0xd8b6('0x3e')][0x2]?_0x51777b['attrs'][0x2][_0xd8b6('0x3f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x51777b['attrVoiceQueues']||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b[_0xd8b6('0x3e')][0x3]?_0x51777b[_0xd8b6('0x3e')][0x3]['value']:undefined)||[]}];case _0xd8b6('0x4e'):return[{'name':'attrReport','type':_0x51777b[_0xd8b6('0x4f')]||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b['attrs'][0x0]?_0x51777b['attrs'][0x0][_0xd8b6('0x3b')]:undefined)||null,'value':_0x51777b[_0xd8b6('0x50')]||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b[_0xd8b6('0x3e')][0x0]?_0x51777b[_0xd8b6('0x3e')][0x0][_0xd8b6('0x3f')]:undefined)||null},{'name':'attrRefresh','value':_0x51777b[_0xd8b6('0x51')]||(_0x51777b['attrs']&&_0x51777b[_0xd8b6('0x3e')][0x1]?_0x51777b[_0xd8b6('0x3e')][0x1][_0xd8b6('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x18a2ac){logger['error'](_0xd8b6('0x52'),JSON[_0xd8b6('0x53')](_0x18a2ac));return[];}}exports[_0xd8b6('0x54')]=function(_0x4724b5,_0x282cea){if(_0x4724b5[_0xd8b6('0x55')]){_0x4724b5[_0xd8b6('0x55')][_0xd8b6('0x3e')]=widgetAttributes(_0x4724b5[_0xd8b6('0x55')]);}return db[_0xd8b6('0x2b')][_0xd8b6('0x54')](_0x4724b5[_0xd8b6('0x55')],{})[_0xd8b6('0x24')](respondWithResult(_0x282cea,0xc9))['catch'](handleError(_0x282cea,null));};exports[_0xd8b6('0x23')]=function(_0x56499c,_0x5e3f57){if(_0x56499c[_0xd8b6('0x55')]['id']){delete _0x56499c['body']['id'];}_0x56499c[_0xd8b6('0x55')]['attrs']=widgetAttributes(_0x56499c[_0xd8b6('0x55')]);return db[_0xd8b6('0x2b')][_0xd8b6('0x38')]({'where':{'id':_0x56499c[_0xd8b6('0x39')]['id']}})['then'](handleEntityNotFound(_0x5e3f57,null))[_0xd8b6('0x24')](saveUpdates(_0x56499c[_0xd8b6('0x55')],null))[_0xd8b6('0x24')](respondWithResult(_0x5e3f57,null))[_0xd8b6('0x3a')](handleError(_0x5e3f57,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 9ad6555..5370216 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 _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 +var _0xf0c7=['emit','hasOwnProperty','hook','events','DashboardItem','setMaxListeners','save','update','remove'];(function(_0x48c53f,_0x2964da){var _0x51297a=function(_0x250784){while(--_0x250784){_0x48c53f['push'](_0x48c53f['shift']());}};_0x51297a(++_0x2964da);}(_0xf0c7,0xc9));var _0x7f0c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf0c7[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0x7f0c('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x7f0c('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7f0c('0x2')](0x0);var events={'afterCreate':_0x7f0c('0x3'),'afterUpdate':_0x7f0c('0x4'),'afterDestroy':_0x7f0c('0x5')};function emitEvent(_0x2cbc41){return function(_0x1a60a8,_0x37edd2,_0x5b8840){DashboardItemEvents[_0x7f0c('0x6')](_0x2cbc41+':'+_0x1a60a8['id'],_0x1a60a8);DashboardItemEvents['emit'](_0x2cbc41,_0x1a60a8);_0x5b8840(null);};}for(var e in events){if(events[_0x7f0c('0x7')](e)){var event=events[e];DashboardItem[_0x7f0c('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 729dbff..bfeb55a 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 _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 +var _0x4176=['../../config/logger','api','moment','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash'];(function(_0x362e90,_0x597372){var _0x5ef58a=function(_0x26e548){while(--_0x26e548){_0x362e90['push'](_0x362e90['shift']());}};_0x5ef58a(++_0x597372);}(_0x4176,0x180));var _0x6417=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0x4176[_0x555b2f];return _0x81c0a6;};'use strict';var _=require(_0x6417('0x0'));var util=require('util');var logger=require(_0x6417('0x1'))(_0x6417('0x2'));var moment=require(_0x6417('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6417('0x4'));var config=require(_0x6417('0x5'));var attributes=require(_0x6417('0x6'));module[_0x6417('0x7')]=function(_0x14fe80,_0x19ced4){return _0x14fe80[_0x6417('0x8')](_0x6417('0x9'),attributes,{'tableName':_0x6417('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 75b8018..b508028 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 _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 +var _0x1b6a=['../../config/logger','rpc','client','http','redis','defaults','localhost','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xfb8226,_0x3d41ef){var _0x47b880=function(_0x382c1d){while(--_0x382c1d){_0xfb8226['push'](_0xfb8226['shift']());}};_0x47b880(++_0x3d41ef);}(_0x1b6a,0x163));var _0xa1b6=function(_0x37918a,_0x2e2c82){_0x37918a=_0x37918a-0x0;var _0x4b0532=_0x1b6a[_0x37918a];return _0x4b0532;};'use strict';var _=require('lodash');var util=require(_0xa1b6('0x0'));var moment=require('moment');var BPromise=require(_0xa1b6('0x1'));var rs=require(_0xa1b6('0x2'));var fs=require('fs');var Redis=require(_0xa1b6('0x3'));var db=require(_0xa1b6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1b6('0x5'))(_0xa1b6('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa1b6('0x7')][_0xa1b6('0x8')]({'port':0x232a});config[_0xa1b6('0x9')]=_[_0xa1b6('0xa')](config[_0xa1b6('0x9')],{'host':_0xa1b6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa1b6('0x9')]));require('./dashboardItem.socket')[_0xa1b6('0xc')](socket);function respondWithRpcPromise(_0x5146fd,_0x5882b6,_0x387592){return new BPromise(function(_0x356964,_0x52d9a2){return client['request'](_0x5146fd,_0x387592)[_0xa1b6('0xd')](function(_0x3d7758){logger[_0xa1b6('0xe')](_0xa1b6('0xf'),_0x5882b6,_0xa1b6('0x10'));logger['debug'](_0xa1b6('0x11'),_0x5882b6,_0xa1b6('0x10'),JSON[_0xa1b6('0x12')](_0x3d7758));if(_0x3d7758[_0xa1b6('0x13')]){if(_0x3d7758[_0xa1b6('0x13')][_0xa1b6('0x14')]===0x1f4){logger[_0xa1b6('0x13')]('DashboardItem,\x20%s,\x20%s',_0x5882b6,_0x3d7758['error'][_0xa1b6('0x15')]);return _0x52d9a2(_0x3d7758[_0xa1b6('0x13')][_0xa1b6('0x15')]);}logger[_0xa1b6('0x13')]('DashboardItem,\x20%s,\x20%s',_0x5882b6,_0x3d7758[_0xa1b6('0x13')][_0xa1b6('0x15')]);return _0x356964(_0x3d7758['error'][_0xa1b6('0x15')]);}else{logger[_0xa1b6('0xe')]('DashboardItem,\x20%s,\x20%s',_0x5882b6,_0xa1b6('0x10'));_0x356964(_0x3d7758[_0xa1b6('0x16')][_0xa1b6('0x15')]);}})[_0xa1b6('0x17')](function(_0x3166ba){logger[_0xa1b6('0x13')](_0xa1b6('0xf'),_0x5882b6,_0x3166ba);_0x52d9a2(_0x3166ba);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index f795fa4..dafc1bc 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 _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 +var _0xdc9f=['length','dashboardItem:','./dashboardItem.events','save','emit','removeListener','register'];(function(_0x4f78eb,_0x13a22){var _0xb020e9=function(_0x13c88b){while(--_0x13c88b){_0x4f78eb['push'](_0x4f78eb['shift']());}};_0xb020e9(++_0x13a22);}(_0xdc9f,0x9c));var _0xfdc9=function(_0xe87aa5,_0x51c211){_0xe87aa5=_0xe87aa5-0x0;var _0x1272cb=_0xdc9f[_0xe87aa5];return _0x1272cb;};'use strict';var DashboardItemEvents=require(_0xfdc9('0x0'));var events=[_0xfdc9('0x1'),'remove','update'];function createListener(_0x552fd9,_0x72f5f){return function(_0x2b092b){_0x72f5f[_0xfdc9('0x2')](_0x552fd9,_0x2b092b);};}function removeListener(_0x210961,_0xf21f51){return function(){DashboardItemEvents[_0xfdc9('0x3')](_0x210961,_0xf21f51);};}exports[_0xfdc9('0x4')]=function(_0x5554e8){for(var _0x3bbaad=0x0,_0x7ae1c6=events[_0xfdc9('0x5')];_0x3bbaad<_0x7ae1c6;_0x3bbaad++){var _0x18ffbf=events[_0x3bbaad];var _0x4a8646=createListener(_0xfdc9('0x6')+_0x18ffbf,_0x5554e8);DashboardItemEvents['on'](_0x18ffbf,_0x4a8646);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index fa712b0..d2620fc 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 _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 +var _0xabce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./dashboardItem.controller','isAuthenticated','post','create','put','/:id'];(function(_0x47408e,_0x481428){var _0x1636bc=function(_0x2fe7a6){while(--_0x2fe7a6){_0x47408e['push'](_0x47408e['shift']());}};_0x1636bc(++_0x481428);}(_0xabce,0x103));var _0xeabc=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xabce[_0x32d457];return _0x338386;};'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']('/:id',auth[_0xeabc('0x8')](),controller['show']);router[_0xeabc('0x9')]('/',auth['isAuthenticated'](),controller[_0xeabc('0xa')]);router[_0xeabc('0xb')](_0xeabc('0xc'),auth['isAuthenticated'](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);module[_0xeabc('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index cb443ed..3bef196 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 _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 +var _0x2e50=['ENUM','second','STRING'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x2e50,0x182));var _0x02e5=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0x2e50[_0x1646fa];return _0x5a47a5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x02e5('0x0')],'allowNull':![]},'level':{'type':Sequelize[_0x02e5('0x1')]('first',_0x02e5('0x2'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x02e5('0x0')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 3f84605..2a77166 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 _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 +var _0xdef3=['include','catch','show','params','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','Dispositions','UserProfileResource','end','stack','name','send','index','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','nolimit','offset','sort','filter','where','merge','VIRTUAL','options','Disposition','includeAll'];(function(_0x5e5f5b,_0xe5a72){var _0x5a1499=function(_0x3c3143){while(--_0x3c3143){_0x5e5f5b['push'](_0x5e5f5b['shift']());}};_0x5a1499(++_0xe5a72);}(_0xdef3,0x19a));var _0x3def=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xdef3[_0x5783f4];return _0x28e380;};'use strict';var pdf=require(_0x3def('0x0'));var emlformat=require(_0x3def('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3def('0x2'));var jsonpatch=require(_0x3def('0x3'));var rp=require(_0x3def('0x4'));var moment=require(_0x3def('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3def('0x6'));var path=require(_0x3def('0x7'));var sox=require(_0x3def('0x8'));var csv=require(_0x3def('0x9'));var ejs=require(_0x3def('0xa'));var fs=require('fs');var _=require(_0x3def('0xb'));var squel=require(_0x3def('0xc'));var crypto=require(_0x3def('0xd'));var jsforce=require(_0x3def('0xe'));var deskjs=require(_0x3def('0xf'));var toCsv=require(_0x3def('0x9'));var querystring=require('querystring');var Papa=require(_0x3def('0x10'));var Redis=require(_0x3def('0x11'));var authService=require(_0x3def('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3def('0x13'));var hardwareService=require(_0x3def('0x14'));var logger=require('../../config/logger')(_0x3def('0x15'));var utils=require(_0x3def('0x16'));var config=require(_0x3def('0x17'));var licenseUtil=require(_0x3def('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d49be,_0x40a08c){_0x40a08c=_0x40a08c||0xcc;return function(_0x1e9fea){if(_0x1e9fea){return _0x4d49be[_0x3def('0x19')](_0x40a08c);}return _0x4d49be[_0x3def('0x1a')](_0x40a08c)['end']();};}function respondWithResult(_0x48317a,_0x348f4d){_0x348f4d=_0x348f4d||0xc8;return function(_0x185ec8){if(_0x185ec8){return _0x48317a[_0x3def('0x1a')](_0x348f4d)[_0x3def('0x1b')](_0x185ec8);}};}function respondWithFilteredResult(_0x58f6d3,_0x17af76){return function(_0x4572fd){if(_0x4572fd){var _0x3fd378=_0x4572fd[_0x3def('0x1c')],_0x44942d=_0x17af76['offset'],_0x3051cd=_0x17af76['offset']+_0x17af76[_0x3def('0x1d')],_0x1c1a6d;if(_0x3051cd>=_0x3fd378){_0x3051cd=_0x3fd378;_0x1c1a6d=0xc8;}else{_0x1c1a6d=0xce;}_0x58f6d3['status'](_0x1c1a6d);return _0x58f6d3[_0x3def('0x1e')](_0x3def('0x1f'),_0x44942d+'-'+_0x3051cd+'/'+_0x3fd378)[_0x3def('0x1b')](_0x4572fd);}return null;};}function patchUpdates(_0x1af5de){return function(_0x52800f){try{jsonpatch[_0x3def('0x20')](_0x52800f,_0x1af5de,!![]);}catch(_0x26b777){return BPromise[_0x3def('0x21')](_0x26b777);}return _0x52800f[_0x3def('0x22')]();};}function saveUpdates(_0x468db3,_0x5e00ec){return function(_0x11524a){if(_0x11524a){return _0x11524a[_0x3def('0x23')](_0x468db3)[_0x3def('0x24')](function(_0x3cf387){return _0x3cf387;});}return null;};}function removeEntity(_0x4ab007,_0x1727bc){return function(_0x1c7dc0){if(_0x1c7dc0){return _0x1c7dc0[_0x3def('0x25')]()['then'](function(){var _0x4d1d9c=_0x1c7dc0['get']({'plain':!![]});var _0x505373=_0x3def('0x26');return db[_0x3def('0x27')][_0x3def('0x25')]({'where':{'type':_0x505373,'resourceId':_0x4d1d9c['id']}})[_0x3def('0x24')](function(){return _0x1c7dc0;});})[_0x3def('0x24')](function(){_0x4ab007['status'](0xcc)[_0x3def('0x28')]();});}};}function handleEntityNotFound(_0x39ce60,_0x33c621){return function(_0x3c1d03){if(!_0x3c1d03){_0x39ce60[_0x3def('0x19')](0x194);}return _0x3c1d03;};}function handleError(_0x1766a0,_0x58a4bc){_0x58a4bc=_0x58a4bc||0x1f4;return function(_0x423565){logger['error'](_0x423565[_0x3def('0x29')]);if(_0x423565['name']){delete _0x423565[_0x3def('0x2a')];}_0x1766a0[_0x3def('0x1a')](_0x58a4bc)[_0x3def('0x2b')](_0x423565);};}exports[_0x3def('0x2c')]=function(_0x106623,_0x1ebb5c){var _0x3784d3={},_0x429bcc={},_0x5479a8={'count':0x0,'rows':[]};var _0x1ec952=_[_0x3def('0x2d')](db['Disposition'][_0x3def('0x2e')],function(_0x343395){return{'name':_0x343395['fieldName'],'type':_0x343395['type']['key']};});_0x429bcc[_0x3def('0x2f')]=_[_0x3def('0x2d')](_0x1ec952,'name');_0x429bcc[_0x3def('0x30')]=_[_0x3def('0x31')](_0x106623[_0x3def('0x30')]);_0x429bcc[_0x3def('0x32')]=_[_0x3def('0x33')](_0x429bcc[_0x3def('0x2f')],_0x429bcc[_0x3def('0x30')]);_0x3784d3[_0x3def('0x34')]=_[_0x3def('0x33')](_0x429bcc[_0x3def('0x2f')],qs[_0x3def('0x35')](_0x106623[_0x3def('0x30')][_0x3def('0x35')]));_0x3784d3[_0x3def('0x34')]=_0x3784d3[_0x3def('0x34')]['length']?_0x3784d3[_0x3def('0x34')]:_0x429bcc[_0x3def('0x2f')];if(!_0x106623['query']['hasOwnProperty'](_0x3def('0x36'))){_0x3784d3['limit']=qs[_0x3def('0x1d')](_0x106623[_0x3def('0x30')][_0x3def('0x1d')]);_0x3784d3[_0x3def('0x37')]=qs[_0x3def('0x37')](_0x106623[_0x3def('0x30')][_0x3def('0x37')]);}_0x3784d3['order']=qs[_0x3def('0x38')](_0x106623[_0x3def('0x30')][_0x3def('0x38')]);_0x3784d3['where']=qs[_0x3def('0x32')](_['pick'](_0x106623[_0x3def('0x30')],_0x429bcc[_0x3def('0x32')]),_0x1ec952);if(_0x106623[_0x3def('0x30')][_0x3def('0x39')]){_0x3784d3[_0x3def('0x3a')]=_[_0x3def('0x3b')](_0x3784d3[_0x3def('0x3a')],{'$or':_['map'](_0x1ec952,function(_0x31fd84){if(_0x31fd84['type']!==_0x3def('0x3c')){var _0x4a61d8={};_0x4a61d8[_0x31fd84[_0x3def('0x2a')]]={'$like':'%'+_0x106623[_0x3def('0x30')][_0x3def('0x39')]+'%'};return _0x4a61d8;}})});}_0x3784d3=_[_0x3def('0x3b')]({},_0x3784d3,_0x106623[_0x3def('0x3d')]);var _0x7dd4e9={'where':_0x3784d3[_0x3def('0x3a')]};return db[_0x3def('0x3e')][_0x3def('0x1c')](_0x7dd4e9)[_0x3def('0x24')](function(_0x454dab){_0x5479a8[_0x3def('0x1c')]=_0x454dab;if(_0x106623[_0x3def('0x30')][_0x3def('0x3f')]){_0x3784d3[_0x3def('0x40')]=[{'all':!![]}];}return db[_0x3def('0x3e')]['findAll'](_0x3784d3);})[_0x3def('0x24')](function(_0xc69b3b){_0x5479a8['rows']=_0xc69b3b;return _0x5479a8;})[_0x3def('0x24')](respondWithFilteredResult(_0x1ebb5c,_0x3784d3))[_0x3def('0x41')](handleError(_0x1ebb5c,null));};exports[_0x3def('0x42')]=function(_0x5adebb,_0x32c21b){var _0x485bef={'raw':!![],'where':{'id':_0x5adebb[_0x3def('0x43')]['id']}},_0x4388c4={};_0x4388c4[_0x3def('0x2f')]=_[_0x3def('0x31')](db[_0x3def('0x3e')][_0x3def('0x2e')]);_0x4388c4['query']=_[_0x3def('0x31')](_0x5adebb['query']);_0x4388c4[_0x3def('0x32')]=_['intersection'](_0x4388c4[_0x3def('0x2f')],_0x4388c4[_0x3def('0x30')]);_0x485bef[_0x3def('0x34')]=_['intersection'](_0x4388c4['model'],qs[_0x3def('0x35')](_0x5adebb[_0x3def('0x30')][_0x3def('0x35')]));_0x485bef[_0x3def('0x34')]=_0x485bef[_0x3def('0x34')][_0x3def('0x44')]?_0x485bef[_0x3def('0x34')]:_0x4388c4[_0x3def('0x2f')];if(_0x5adebb['query'][_0x3def('0x3f')]){_0x485bef['include']=[{'all':!![]}];}_0x485bef=_[_0x3def('0x3b')]({},_0x485bef,_0x5adebb['options']);return db['Disposition']['find'](_0x485bef)['then'](handleEntityNotFound(_0x32c21b,null))['then'](respondWithResult(_0x32c21b,null))[_0x3def('0x41')](handleError(_0x32c21b,null));};exports[_0x3def('0x45')]=function(_0x7c5356,_0x1401e8){return db[_0x3def('0x3e')][_0x3def('0x45')](_0x7c5356[_0x3def('0x46')],{})[_0x3def('0x24')](function(_0x4b8d49){var _0x5aee25=_0x7c5356[_0x3def('0x47')][_0x3def('0x48')]({'plain':!![]});if(!_0x5aee25)throw new Error(_0x3def('0x49'));if(_0x5aee25['role']===_0x3def('0x47')){var _0x22460e=_0x4b8d49[_0x3def('0x48')]({'plain':!![]});var _0x5b3d05=_0x3def('0x26');return db[_0x3def('0x4a')]['find']({'where':{'name':_0x5b3d05,'userProfileId':_0x5aee25[_0x3def('0x4b')]},'raw':!![]})['then'](function(_0x1eea0e){if(_0x1eea0e&&_0x1eea0e[_0x3def('0x4c')]===0x0){return db[_0x3def('0x27')][_0x3def('0x45')]({'name':_0x22460e[_0x3def('0x2a')],'resourceId':_0x22460e['id'],'type':_0x1eea0e['name'],'sectionId':_0x1eea0e['id']},{})[_0x3def('0x24')](function(){return _0x4b8d49;});}else{return _0x4b8d49;}})['catch'](function(_0x32185e){logger[_0x3def('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32185e);throw _0x32185e;});}return _0x4b8d49;})[_0x3def('0x24')](respondWithResult(_0x1401e8,0xc9))[_0x3def('0x41')](handleError(_0x1401e8,null));};exports['update']=function(_0x1b9dec,_0x243ab3){if(_0x1b9dec[_0x3def('0x46')]['id']){delete _0x1b9dec[_0x3def('0x46')]['id'];}return db[_0x3def('0x3e')][_0x3def('0x4e')]({'where':{'id':_0x1b9dec['params']['id']}})['then'](handleEntityNotFound(_0x243ab3,null))['then'](saveUpdates(_0x1b9dec[_0x3def('0x46')],null))[_0x3def('0x24')](respondWithResult(_0x243ab3,null))['catch'](handleError(_0x243ab3,null));};exports['destroy']=function(_0x487556,_0x1b52be){return db[_0x3def('0x3e')][_0x3def('0x4e')]({'where':{'id':_0x487556[_0x3def('0x43')]['id']}})[_0x3def('0x24')](handleEntityNotFound(_0x1b52be,null))[_0x3def('0x24')](removeEntity(_0x1b52be,null))['catch'](handleError(_0x1b52be,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 2427ca8..054d7d0 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 _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 +var _0xc1fa=['rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0xc1fa,0x83));var _0xac1f=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0xc1fa[_0x1793de];return _0x4f0309;};'use strict';var _=require(_0xac1f('0x0'));var util=require(_0xac1f('0x1'));var logger=require(_0xac1f('0x2'))(_0xac1f('0x3'));var moment=require(_0xac1f('0x4'));var BPromise=require(_0xac1f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac1f('0x6'));var rimraf=require(_0xac1f('0x7'));var config=require(_0xac1f('0x8'));var attributes=require(_0xac1f('0x9'));module[_0xac1f('0xa')]=function(_0x4342a5,_0x38bd1d){return _0x4342a5[_0xac1f('0xb')](_0xac1f('0xc'),attributes,{'tableName':_0xac1f('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xac1f('0xe'),'fields':[_0xac1f('0xf'),'ListId']},{'unique':!![],'name':_0xac1f('0x10'),'fields':[_0xac1f('0xf'),_0xac1f('0x11')]},{'unique':!![],'name':_0xac1f('0x12'),'fields':[_0xac1f('0xf'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0xac1f('0xf'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0xac1f('0xf'),_0xac1f('0x13')]},{'unique':!![],'name':'name_openchannel','fields':[_0xac1f('0xf'),_0xac1f('0x14')]},{'unique':!![],'name':_0xac1f('0x15'),'fields':[_0xac1f('0xf'),_0xac1f('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 898edf1..130f380 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 _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 +var _0x2bee=['request\x20sent','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','Disposition,\x20%s,\x20%s'];(function(_0x3462fc,_0xcd0e27){var _0x5c1db5=function(_0x183f15){while(--_0x183f15){_0x3462fc['push'](_0x3462fc['shift']());}};_0x5c1db5(++_0xcd0e27);}(_0x2bee,0xe3));var _0xe2be=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x2bee[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0xe2be('0x0'));var util=require('util');var moment=require(_0xe2be('0x1'));var BPromise=require(_0xe2be('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe2be('0x3'));var db=require(_0xe2be('0x4'))['db'];var utils=require(_0xe2be('0x5'));var logger=require(_0xe2be('0x6'))(_0xe2be('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe2be('0x8')][_0xe2be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcbe6cc,_0x4551d8,_0x1d941b){return new BPromise(function(_0x4bc8cd,_0xe49884){return client[_0xe2be('0xa')](_0xcbe6cc,_0x1d941b)[_0xe2be('0xb')](function(_0x2dc346){logger['info'](_0xe2be('0xc'),_0x4551d8,_0xe2be('0xd'));logger['debug'](_0xe2be('0xe'),_0x4551d8,_0xe2be('0xd'),JSON[_0xe2be('0xf')](_0x2dc346));if(_0x2dc346[_0xe2be('0x10')]){if(_0x2dc346[_0xe2be('0x10')]['code']===0x1f4){logger['error'](_0xe2be('0xc'),_0x4551d8,_0x2dc346[_0xe2be('0x10')][_0xe2be('0x11')]);return _0xe49884(_0x2dc346[_0xe2be('0x10')][_0xe2be('0x11')]);}logger[_0xe2be('0x10')]('Disposition,\x20%s,\x20%s',_0x4551d8,_0x2dc346[_0xe2be('0x10')][_0xe2be('0x11')]);return _0x4bc8cd(_0x2dc346[_0xe2be('0x10')][_0xe2be('0x11')]);}else{logger[_0xe2be('0x12')](_0xe2be('0xc'),_0x4551d8,'request\x20sent');_0x4bc8cd(_0x2dc346['result'][_0xe2be('0x11')]);}})[_0xe2be('0x13')](function(_0x35815b){logger[_0xe2be('0x10')](_0xe2be('0xc'),_0x4551d8,_0x35815b);_0xe49884(_0x35815b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index d456b4c..5948aa0 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 _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 +var _0xe0ad=['show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','/:id'];(function(_0x21b232,_0x1b9b77){var _0x54a541=function(_0x466d43){while(--_0x466d43){_0x21b232['push'](_0x21b232['shift']());}};_0x54a541(++_0x1b9b77);}(_0xe0ad,0x127));var _0xde0a=function(_0x13b827,_0x494baa){_0x13b827=_0x13b827-0x0;var _0x22895d=_0xe0ad[_0x13b827];return _0x22895d;};'use strict';var multer=require(_0xde0a('0x0'));var util=require(_0xde0a('0x1'));var path=require(_0xde0a('0x2'));var timeout=require(_0xde0a('0x3'));var express=require(_0xde0a('0x4'));var router=express['Router']();var auth=require(_0xde0a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xde0a('0x6'));var controller=require(_0xde0a('0x7'));router[_0xde0a('0x8')]('/',auth[_0xde0a('0x9')](),controller['index']);router[_0xde0a('0x8')](_0xde0a('0xa'),auth['isAuthenticated'](),controller[_0xde0a('0xb')]);router[_0xde0a('0xc')]('/',auth[_0xde0a('0x9')](),controller['create']);router[_0xde0a('0xd')](_0xde0a('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xde0a('0xe')](_0xde0a('0xa'),auth['isAuthenticated'](),controller[_0xde0a('0xf')]);module[_0xde0a('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 8270a93..06c9b6d 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 _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 +var _0x0916=['KHOMP','TEXT','BOOLEAN','setDataValue','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','IAX','DADHI'];(function(_0x4720af,_0x3eaa74){var _0x4917e1=function(_0x2c0e74){while(--_0x2c0e74){_0x4720af['push'](_0x4720af['shift']());}};_0x4917e1(++_0x3eaa74);}(_0x0916,0x12a));var _0x6091=function(_0x575cfd,_0x47ec81){_0x575cfd=_0x575cfd-0x0;var _0xd863ad=_0x0916[_0x575cfd];return _0xd863ad;};'use strict';var Sequelize=require(_0x6091('0x0'));module[_0x6091('0x1')]={'name':{'type':Sequelize[_0x6091('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6091('0x2')]},'ecm':{'type':Sequelize[_0x6091('0x3')]('yes','no'),'defaultValue':_0x6091('0x4')},'headerinfo':{'type':Sequelize[_0x6091('0x2')],'defaultValue':_0x6091('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x6091('0x6')},'minrate':{'type':Sequelize[_0x6091('0x3')](_0x6091('0x7'),_0x6091('0x8'),_0x6091('0x9'),_0x6091('0xa'),_0x6091('0xb'),_0x6091('0xc')),'defaultValue':_0x6091('0x8')},'maxrate':{'type':Sequelize[_0x6091('0x3')](_0x6091('0x7'),_0x6091('0x8'),_0x6091('0x9'),_0x6091('0xa'),_0x6091('0xb'),_0x6091('0xc')),'defaultValue':_0x6091('0xc')},'modem':{'type':Sequelize[_0x6091('0x2')],'defaultValue':_0x6091('0xd')},'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[_0x6091('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x6091('0x3')]('SIP',_0x6091('0xf'),_0x6091('0x10'),_0x6091('0x11')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x6091('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6091('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x6091('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6091('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6091('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6091('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6091('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6091('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6091('0xe')],'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[_0x6091('0x13')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3a5df9){if(!_0x3a5df9)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x6091('0x14')]('mandatoryDisposition',_0x3a5df9);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 2bfdb14..05b899b 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 _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 +var _0xed1f=['params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','FaxInteraction','addInteraction','CmContact','Contact','User','Owner','fullname','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','context','exten','app','system','description','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','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','VoiceExtension','updateAccountApplications','omit','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','info','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','isArray','userFaxAccount:remove','getAgents','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','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','register','http','client','request','then','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','show'];(function(_0x136320,_0x4e1dd6){var _0x4cb77c=function(_0x45aea8){while(--_0x45aea8){_0x136320['push'](_0x136320['shift']());}};_0x4cb77c(++_0x4e1dd6);}(_0xed1f,0x6a));var _0xfed1=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xed1f[_0x243b59];return _0x3e1676;};'use strict';var pdf=require(_0xfed1('0x0'));var emlformat=require(_0xfed1('0x1'));var rimraf=require(_0xfed1('0x2'));var zipdir=require(_0xfed1('0x3'));var jsonpatch=require(_0xfed1('0x4'));var rp=require(_0xfed1('0x5'));var moment=require(_0xfed1('0x6'));var BPromise=require(_0xfed1('0x7'));var Mustache=require(_0xfed1('0x8'));var util=require(_0xfed1('0x9'));var path=require(_0xfed1('0xa'));var sox=require(_0xfed1('0xb'));var csv=require(_0xfed1('0xc'));var ejs=require(_0xfed1('0xd'));var fs=require('fs');var _=require(_0xfed1('0xe'));var squel=require(_0xfed1('0xf'));var crypto=require(_0xfed1('0x10'));var jsforce=require(_0xfed1('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfed1('0xc'));var querystring=require(_0xfed1('0x12'));var Papa=require('papaparse');var Redis=require(_0xfed1('0x13'));var authService=require(_0xfed1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfed1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfed1('0x16'))(_0xfed1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfed1('0x18'));var db=require(_0xfed1('0x19'))['db'];config['redis']=_[_0xfed1('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfed1('0x1b'))(new Redis(config[_0xfed1('0x1c')]));require('./faxAccount.socket')[_0xfed1('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xfed1('0x1e')]({'port':0x232c});var client9002=jayson[_0xfed1('0x1f')][_0xfed1('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x123c46,_0x582e67,_0x1a00f6,_0x4af928){return new BPromise(function(_0x36ff34,_0x29a32f){var _0x489a0f=_0x4af928||client;return _0x489a0f[_0xfed1('0x20')](_0x123c46,_0x1a00f6)[_0xfed1('0x21')](function(_0x5c0d9f){logger['info']('FaxAccount,\x20%s,\x20%s',_0x582e67,_0xfed1('0x22'));logger['debug'](_0xfed1('0x23'),_0x582e67,_0xfed1('0x22'),JSON['stringify'](_0x5c0d9f));if(_0x5c0d9f[_0xfed1('0x24')]){if(_0x5c0d9f[_0xfed1('0x24')]['code']===0x1f4){logger[_0xfed1('0x24')](_0xfed1('0x25'),_0x582e67,_0x5c0d9f[_0xfed1('0x24')][_0xfed1('0x26')]);return _0x29a32f(_0x5c0d9f['error'][_0xfed1('0x26')]);}logger['error'](_0xfed1('0x25'),_0x582e67,_0x5c0d9f[_0xfed1('0x24')][_0xfed1('0x26')]);return _0x36ff34(_0x5c0d9f['error'][_0xfed1('0x26')]);}else{logger['info'](_0xfed1('0x25'),_0x582e67,_0xfed1('0x22'));_0x36ff34(_0x5c0d9f[_0xfed1('0x27')][_0xfed1('0x26')]);}})[_0xfed1('0x28')](function(_0x1199b7){logger['error'](_0xfed1('0x25'),_0x582e67,_0x1199b7);_0x29a32f(_0x1199b7);});});}function respondWithStatusCode(_0xcb1cdc,_0x49072b){_0x49072b=_0x49072b||0xcc;return function(_0x1d6c72){if(_0x1d6c72){return _0xcb1cdc[_0xfed1('0x29')](_0x49072b);}return _0xcb1cdc[_0xfed1('0x2a')](_0x49072b)[_0xfed1('0x2b')]();};}function respondWithResult(_0x3b9122,_0x1761d1){_0x1761d1=_0x1761d1||0xc8;return function(_0x583953){if(_0x583953){return _0x3b9122[_0xfed1('0x2a')](_0x1761d1)['json'](_0x583953);}};}function respondWithFilteredResult(_0x3106ee,_0x4e5249){return function(_0x53b0c9){if(_0x53b0c9){var _0x1cec64=_0x53b0c9[_0xfed1('0x2c')],_0x42c950=_0x4e5249[_0xfed1('0x2d')],_0x2d334e=_0x4e5249[_0xfed1('0x2d')]+_0x4e5249[_0xfed1('0x2e')],_0x599c23;if(_0x2d334e>=_0x1cec64){_0x2d334e=_0x1cec64;_0x599c23=0xc8;}else{_0x599c23=0xce;}_0x3106ee[_0xfed1('0x2a')](_0x599c23);return _0x3106ee[_0xfed1('0x2f')]('Content-Range',_0x42c950+'-'+_0x2d334e+'/'+_0x1cec64)[_0xfed1('0x30')](_0x53b0c9);}return null;};}function patchUpdates(_0x16ca13){return function(_0x4fc309){try{jsonpatch['apply'](_0x4fc309,_0x16ca13,!![]);}catch(_0x28bd98){return BPromise[_0xfed1('0x31')](_0x28bd98);}return _0x4fc309[_0xfed1('0x32')]();};}function saveUpdates(_0x71147f,_0x44c24a){return function(_0x57ca74){if(_0x57ca74){return _0x57ca74[_0xfed1('0x33')](_0x71147f)[_0xfed1('0x21')](function(_0x10143b){return _0x10143b;});}return null;};}function removeEntity(_0x349de1,_0xa4c53c){return function(_0x4fde94){if(_0x4fde94){return _0x4fde94[_0xfed1('0x34')]()['then'](function(){var _0x11c5bd=_0x4fde94[_0xfed1('0x35')]({'plain':!![]});var _0x17554f=_0xfed1('0x36');return db[_0xfed1('0x37')][_0xfed1('0x34')]({'where':{'type':_0x17554f,'resourceId':_0x11c5bd['id']}})[_0xfed1('0x21')](function(){return _0x4fde94;});})[_0xfed1('0x21')](function(){_0x349de1['status'](0xcc)[_0xfed1('0x2b')]();});}};}function handleEntityNotFound(_0x46268a,_0x45f106){return function(_0x28adfc){if(!_0x28adfc){_0x46268a['sendStatus'](0x194);}return _0x28adfc;};}function handleError(_0x4b1d7b,_0x42d5df){_0x42d5df=_0x42d5df||0x1f4;return function(_0x3c026d){logger[_0xfed1('0x24')](_0x3c026d[_0xfed1('0x38')]);if(_0x3c026d[_0xfed1('0x39')]){delete _0x3c026d[_0xfed1('0x39')];}_0x4b1d7b[_0xfed1('0x2a')](_0x42d5df)[_0xfed1('0x3a')](_0x3c026d);};}exports['index']=function(_0x52c7b8,_0x23f75f){var _0x2f6250={'include':[{'model':db[_0xfed1('0x3b')],'as':_0xfed1('0x3c')}]},_0x5f599f={},_0x1dae7c={'count':0x0,'rows':[]};var _0x421620=_[_0xfed1('0x3d')](db[_0xfed1('0x3e')][_0xfed1('0x3f')],function(_0x4118d4){return{'name':_0x4118d4[_0xfed1('0x40')],'type':_0x4118d4['type']['key']};});_0x5f599f['model']=_[_0xfed1('0x3d')](_0x421620,_0xfed1('0x39'));_0x5f599f[_0xfed1('0x41')]=_['keys'](_0x52c7b8[_0xfed1('0x41')]);_0x5f599f['filters']=_[_0xfed1('0x42')](_0x5f599f[_0xfed1('0x43')],_0x5f599f[_0xfed1('0x41')]);_0x2f6250['attributes']=_[_0xfed1('0x42')](_0x5f599f[_0xfed1('0x43')],qs[_0xfed1('0x44')](_0x52c7b8['query'][_0xfed1('0x44')]));_0x2f6250['attributes']=_0x2f6250[_0xfed1('0x45')][_0xfed1('0x46')]?_0x2f6250[_0xfed1('0x45')]:_0x5f599f[_0xfed1('0x43')];if(!_0x52c7b8[_0xfed1('0x41')][_0xfed1('0x47')](_0xfed1('0x48'))){_0x2f6250[_0xfed1('0x2e')]=qs[_0xfed1('0x2e')](_0x52c7b8['query'][_0xfed1('0x2e')]);_0x2f6250[_0xfed1('0x2d')]=qs[_0xfed1('0x2d')](_0x52c7b8['query']['offset']);}_0x2f6250[_0xfed1('0x49')]=qs[_0xfed1('0x4a')](_0x52c7b8[_0xfed1('0x41')][_0xfed1('0x4a')]);_0x2f6250[_0xfed1('0x4b')]=qs[_0xfed1('0x4c')](_[_0xfed1('0x4d')](_0x52c7b8[_0xfed1('0x41')],_0x5f599f[_0xfed1('0x4c')]),_0x421620);if(_0x52c7b8[_0xfed1('0x41')][_0xfed1('0x4e')]){_0x2f6250[_0xfed1('0x4b')]=_['merge'](_0x2f6250[_0xfed1('0x4b')],{'$or':_[_0xfed1('0x3d')](_0x421620,function(_0x280d6e){if(_0x280d6e[_0xfed1('0x4f')]!==_0xfed1('0x50')){var _0x1e4781={};_0x1e4781[_0x280d6e['name']]={'$like':'%'+_0x52c7b8[_0xfed1('0x41')][_0xfed1('0x4e')]+'%'};return _0x1e4781;}})});}_0x2f6250=_[_0xfed1('0x51')]({},_0x2f6250,_0x52c7b8['options']);var _0x22874a={'where':_0x2f6250[_0xfed1('0x4b')]};return db[_0xfed1('0x3e')][_0xfed1('0x2c')](_0x22874a)['then'](function(_0x2e0de7){_0x1dae7c[_0xfed1('0x2c')]=_0x2e0de7;if(_0x52c7b8[_0xfed1('0x41')][_0xfed1('0x52')]){_0x2f6250[_0xfed1('0x53')]=[{'all':!![]}];}return db[_0xfed1('0x3e')][_0xfed1('0x54')](_0x2f6250);})[_0xfed1('0x21')](function(_0x2365db){_0x1dae7c[_0xfed1('0x55')]=_0x2365db;return _0x1dae7c;})[_0xfed1('0x21')](respondWithFilteredResult(_0x23f75f,_0x2f6250))[_0xfed1('0x28')](handleError(_0x23f75f,null));};exports[_0xfed1('0x56')]=function(_0x20c493,_0x33c77a){var _0x37418b={'raw':![],'where':{'id':_0x20c493[_0xfed1('0x57')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xd1f984={};_0xd1f984[_0xfed1('0x43')]=_[_0xfed1('0x58')](db[_0xfed1('0x3e')][_0xfed1('0x3f')]);_0xd1f984['query']=_[_0xfed1('0x58')](_0x20c493[_0xfed1('0x41')]);_0xd1f984['filters']=_['intersection'](_0xd1f984['model'],_0xd1f984[_0xfed1('0x41')]);_0x37418b[_0xfed1('0x45')]=_[_0xfed1('0x42')](_0xd1f984[_0xfed1('0x43')],qs[_0xfed1('0x44')](_0x20c493[_0xfed1('0x41')][_0xfed1('0x44')]));_0x37418b[_0xfed1('0x45')]=_0x37418b[_0xfed1('0x45')][_0xfed1('0x46')]?_0x37418b['attributes']:_0xd1f984['model'];if(_0x20c493[_0xfed1('0x41')][_0xfed1('0x52')]){_0x37418b[_0xfed1('0x53')]=[{'all':!![]}];}_0x37418b=_[_0xfed1('0x51')]({},_0x37418b,_0x20c493[_0xfed1('0x59')]);return db[_0xfed1('0x3e')][_0xfed1('0x5a')](_0x37418b)[_0xfed1('0x21')](handleEntityNotFound(_0x33c77a,null))[_0xfed1('0x21')](respondWithResult(_0x33c77a,null))[_0xfed1('0x28')](handleError(_0x33c77a,null));};exports[_0xfed1('0x5b')]=function(_0x103492,_0x430d71){return db[_0xfed1('0x3e')][_0xfed1('0x5b')](_0x103492[_0xfed1('0x5c')],{})[_0xfed1('0x21')](function(_0x54eb53){var _0x5b167b=_0x103492[_0xfed1('0x5d')][_0xfed1('0x35')]({'plain':!![]});if(!_0x5b167b)throw new Error(_0xfed1('0x5e'));if(_0x5b167b[_0xfed1('0x5f')]===_0xfed1('0x5d')){var _0x41a22a=_0x54eb53[_0xfed1('0x35')]({'plain':!![]});var _0xea879f=_0xfed1('0x36');return db[_0xfed1('0x60')][_0xfed1('0x5a')]({'where':{'name':_0xea879f,'userProfileId':_0x5b167b[_0xfed1('0x61')]},'raw':!![]})[_0xfed1('0x21')](function(_0x1a8ebe){if(_0x1a8ebe&&_0x1a8ebe['autoAssociation']===0x0){return db[_0xfed1('0x37')]['create']({'name':_0x41a22a['name'],'resourceId':_0x41a22a['id'],'type':_0x1a8ebe[_0xfed1('0x39')],'sectionId':_0x1a8ebe['id']},{})['then'](function(){return _0x54eb53;});}else{return _0x54eb53;}})[_0xfed1('0x28')](function(_0x5acc45){logger[_0xfed1('0x24')](_0xfed1('0x62'),_0x5acc45);throw _0x5acc45;});}return _0x54eb53;})['then'](respondWithResult(_0x430d71,0xc9))[_0xfed1('0x28')](handleError(_0x430d71,null));};exports[_0xfed1('0x33')]=function(_0x502ebb,_0x29b51e){if(_0x502ebb[_0xfed1('0x5c')]['id']){delete _0x502ebb[_0xfed1('0x5c')]['id'];}return db[_0xfed1('0x3e')]['find']({'where':{'id':_0x502ebb[_0xfed1('0x57')]['id']},'include':[{'model':db[_0xfed1('0x3b')],'as':_0xfed1('0x3c')}]})[_0xfed1('0x21')](handleEntityNotFound(_0x29b51e,null))[_0xfed1('0x21')](saveUpdates(_0x502ebb[_0xfed1('0x5c')],null))[_0xfed1('0x21')](respondWithResult(_0x29b51e,null))[_0xfed1('0x28')](handleError(_0x29b51e,null));};exports['destroy']=function(_0x2d66ec,_0x400520){return db[_0xfed1('0x3e')][_0xfed1('0x5a')]({'where':{'id':_0x2d66ec[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x400520,null))['then'](removeEntity(_0x400520,null))['catch'](handleError(_0x400520,null));};exports['describe']=function(_0x33a479,_0x364fbd){return db[_0xfed1('0x3e')][_0xfed1('0x63')]()['then'](respondWithResult(_0x364fbd,null))[_0xfed1('0x28')](handleError(_0x364fbd,null));};exports['addDisposition']=function(_0x3747cd,_0xb399aa,_0x18af7d){if(_0x3747cd[_0xfed1('0x5c')]['id']){delete _0x3747cd[_0xfed1('0x5c')]['id'];}return db['FaxAccount'][_0xfed1('0x5a')]({'where':{'id':_0x3747cd[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0xb399aa,null))['then'](function(_0x40d25d){if(_0x40d25d){_0x3747cd[_0xfed1('0x5c')][_0xfed1('0x64')]=_0x40d25d['id'];return db[_0xfed1('0x65')]['create'](_0x3747cd[_0xfed1('0x5c')]);}})['then'](respondWithResult(_0xb399aa,null))[_0xfed1('0x28')](handleError(_0xb399aa,null));};exports[_0xfed1('0x66')]=function(_0x4b685b,_0x480c52,_0x43b172){var _0x340ba3={'raw':![],'where':{}};var _0x1dc791={};var _0x2ee25f={'count':0x0,'rows':[]};return db['FaxAccount'][_0xfed1('0x67')]({'where':{'id':_0x4b685b[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x480c52,null))[_0xfed1('0x21')](function(_0x6f174e){if(_0x6f174e){_0x1dc791[_0xfed1('0x43')]=_['keys'](db[_0xfed1('0x65')][_0xfed1('0x3f')]);_0x1dc791['query']=_[_0xfed1('0x58')](_0x4b685b[_0xfed1('0x41')]);_0x1dc791[_0xfed1('0x4c')]=_[_0xfed1('0x42')](_0x1dc791[_0xfed1('0x43')],_0x1dc791[_0xfed1('0x41')]);_0x340ba3['attributes']=_['intersection'](_0x1dc791[_0xfed1('0x43')],qs['fields'](_0x4b685b[_0xfed1('0x41')][_0xfed1('0x44')]));_0x340ba3[_0xfed1('0x45')]=_0x340ba3[_0xfed1('0x45')][_0xfed1('0x46')]?_0x340ba3[_0xfed1('0x45')]:_0x1dc791[_0xfed1('0x43')];if(!_0x4b685b[_0xfed1('0x41')][_0xfed1('0x47')](_0xfed1('0x48'))){_0x340ba3['limit']=qs[_0xfed1('0x2e')](_0x4b685b[_0xfed1('0x41')]['limit']);_0x340ba3['offset']=qs[_0xfed1('0x2d')](_0x4b685b['query'][_0xfed1('0x2d')]);}_0x340ba3[_0xfed1('0x49')]=qs[_0xfed1('0x4a')](_0x4b685b['query'][_0xfed1('0x4a')]);_0x340ba3[_0xfed1('0x4b')]=qs[_0xfed1('0x4c')](_[_0xfed1('0x4d')](_0x4b685b[_0xfed1('0x41')],_0x1dc791['filters']));_0x340ba3[_0xfed1('0x4b')][_0xfed1('0x64')]=_0x6f174e['id'];if(_0x4b685b[_0xfed1('0x41')][_0xfed1('0x4e')]){_0x340ba3[_0xfed1('0x4b')]=_['merge'](_0x340ba3[_0xfed1('0x4b')],{'$or':_[_0xfed1('0x3d')](_0x340ba3[_0xfed1('0x45')],function(_0x413c53){var _0x2dcadd={};_0x2dcadd[_0x413c53]={'$like':'%'+_0x4b685b[_0xfed1('0x41')][_0xfed1('0x4e')]+'%'};return _0x2dcadd;})});}_0x340ba3=_[_0xfed1('0x51')]({},_0x340ba3,_0x4b685b[_0xfed1('0x59')]);return db[_0xfed1('0x65')]['count']({'where':_0x340ba3[_0xfed1('0x4b')]})[_0xfed1('0x21')](function(_0x248bae){_0x2ee25f[_0xfed1('0x2c')]=_0x248bae;if(_0x4b685b[_0xfed1('0x41')]['includeAll']){_0x340ba3[_0xfed1('0x53')]=[{'all':!![]}];}return db[_0xfed1('0x65')][_0xfed1('0x54')](_0x340ba3);})[_0xfed1('0x21')](function(_0x221ed8){_0x2ee25f[_0xfed1('0x55')]=_0x221ed8;return _0x2ee25f;});}})[_0xfed1('0x21')](respondWithFilteredResult(_0x480c52,_0x340ba3))[_0xfed1('0x28')](handleError(_0x480c52,null));};exports[_0xfed1('0x68')]=function(_0x59a736,_0x5188f8,_0xc3b72a){return db['FaxAccount'][_0xfed1('0x5a')]({'where':{'id':_0x59a736[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x5188f8,null))['then'](function(_0x5ce292){if(_0x5ce292){return _0x5ce292[_0xfed1('0x68')](_0x59a736['query'][_0xfed1('0x69')]);}})['then'](respondWithStatusCode(_0x5188f8,null))[_0xfed1('0x28')](handleError(_0x5188f8,null));};exports[_0xfed1('0x6a')]=function(_0x112ed5,_0x17ccc6,_0x3c6ddd){if(_0x112ed5['body']['id']){delete _0x112ed5[_0xfed1('0x5c')]['id'];}return db[_0xfed1('0x3e')]['find']({'where':{'id':_0x112ed5[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x17ccc6,null))['then'](function(_0x12ce90){if(_0x12ce90){_0x112ed5[_0xfed1('0x5c')][_0xfed1('0x64')]=_0x12ce90['id'];return db['CannedAnswer'][_0xfed1('0x5b')](_0x112ed5[_0xfed1('0x5c')]);}})['then'](respondWithResult(_0x17ccc6,null))[_0xfed1('0x28')](handleError(_0x17ccc6,null));};exports[_0xfed1('0x6b')]=function(_0x44d1fc,_0x4ea8bd,_0xd14bd0){var _0x36d7de={'raw':![],'where':{}};var _0x49f600={};var _0x48172c={'count':0x0,'rows':[]};return db[_0xfed1('0x3e')][_0xfed1('0x67')]({'where':{'id':_0x44d1fc[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x4ea8bd,null))[_0xfed1('0x21')](function(_0x23efe3){if(_0x23efe3){_0x49f600[_0xfed1('0x43')]=_[_0xfed1('0x58')](db[_0xfed1('0x6c')][_0xfed1('0x3f')]);_0x49f600[_0xfed1('0x41')]=_[_0xfed1('0x58')](_0x44d1fc['query']);_0x49f600[_0xfed1('0x4c')]=_[_0xfed1('0x42')](_0x49f600['model'],_0x49f600[_0xfed1('0x41')]);_0x36d7de[_0xfed1('0x45')]=_['intersection'](_0x49f600[_0xfed1('0x43')],qs[_0xfed1('0x44')](_0x44d1fc[_0xfed1('0x41')][_0xfed1('0x44')]));_0x36d7de['attributes']=_0x36d7de[_0xfed1('0x45')][_0xfed1('0x46')]?_0x36d7de[_0xfed1('0x45')]:_0x49f600[_0xfed1('0x43')];if(!_0x44d1fc[_0xfed1('0x41')][_0xfed1('0x47')](_0xfed1('0x48'))){_0x36d7de[_0xfed1('0x2e')]=qs['limit'](_0x44d1fc[_0xfed1('0x41')][_0xfed1('0x2e')]);_0x36d7de[_0xfed1('0x2d')]=qs['offset'](_0x44d1fc[_0xfed1('0x41')][_0xfed1('0x2d')]);}_0x36d7de[_0xfed1('0x49')]=qs['sort'](_0x44d1fc['query'][_0xfed1('0x4a')]);_0x36d7de[_0xfed1('0x4b')]=qs[_0xfed1('0x4c')](_[_0xfed1('0x4d')](_0x44d1fc[_0xfed1('0x41')],_0x49f600[_0xfed1('0x4c')]));_0x36d7de[_0xfed1('0x4b')][_0xfed1('0x64')]=_0x23efe3['id'];if(_0x44d1fc[_0xfed1('0x41')][_0xfed1('0x4e')]){_0x36d7de[_0xfed1('0x4b')]=_[_0xfed1('0x51')](_0x36d7de[_0xfed1('0x4b')],{'$or':_[_0xfed1('0x3d')](_0x36d7de[_0xfed1('0x45')],function(_0x5bcc5f){var _0x241156={};_0x241156[_0x5bcc5f]={'$like':'%'+_0x44d1fc[_0xfed1('0x41')][_0xfed1('0x4e')]+'%'};return _0x241156;})});}_0x36d7de=_[_0xfed1('0x51')]({},_0x36d7de,_0x44d1fc['options']);return db[_0xfed1('0x6c')][_0xfed1('0x2c')]({'where':_0x36d7de[_0xfed1('0x4b')]})['then'](function(_0x23447c){_0x48172c[_0xfed1('0x2c')]=_0x23447c;if(_0x44d1fc[_0xfed1('0x41')][_0xfed1('0x52')]){_0x36d7de[_0xfed1('0x53')]=[{'all':!![]}];}return db[_0xfed1('0x6c')][_0xfed1('0x54')](_0x36d7de);})['then'](function(_0x56b69d){_0x48172c[_0xfed1('0x55')]=_0x56b69d;return _0x48172c;});}})[_0xfed1('0x21')](respondWithFilteredResult(_0x4ea8bd,_0x36d7de))[_0xfed1('0x28')](handleError(_0x4ea8bd,null));};exports['removeAnswers']=function(_0x552be6,_0x2f14e8,_0x1a158b){return db['FaxAccount'][_0xfed1('0x5a')]({'where':{'id':_0x552be6[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x2f14e8,null))[_0xfed1('0x21')](function(_0x3b5381){if(_0x3b5381){return _0x3b5381['removeAnswers'](_0x552be6['query'][_0xfed1('0x69')]);}})[_0xfed1('0x21')](respondWithStatusCode(_0x2f14e8,null))['catch'](handleError(_0x2f14e8,null));};exports['addInteraction']=function(_0x17c0d0,_0x145d60,_0xb1ec32){return db[_0xfed1('0x6d')][_0xfed1('0x5a')]({'where':{'id':_0x17c0d0[_0xfed1('0x57')]['id']}})['then'](handleEntityNotFound(_0x145d60,null))[_0xfed1('0x21')](function(_0x42884f){if(_0x42884f){return _0x42884f[_0xfed1('0x6e')](_0x17c0d0[_0xfed1('0x5c')][_0xfed1('0x69')],_['omit'](_0x17c0d0[_0xfed1('0x5c')],['ids','id'])||{});}})[_0xfed1('0x21')](respondWithResult(_0x145d60,null))['catch'](handleError(_0x145d60,null));};exports['getInteractions']=function(_0x5d6b5a,_0x538112,_0x98b720){var _0x33228b={'raw':![],'where':{}};var _0x3444f6={};var _0x577159={'count':0x0,'rows':[]};return db[_0xfed1('0x3e')][_0xfed1('0x67')]({'where':{'id':_0x5d6b5a[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x538112,null))[_0xfed1('0x21')](function(_0x2cfe0a){if(_0x2cfe0a){_0x3444f6['model']=_[_0xfed1('0x58')](db[_0xfed1('0x6d')][_0xfed1('0x3f')]);_0x3444f6[_0xfed1('0x41')]=_[_0xfed1('0x58')](_0x5d6b5a[_0xfed1('0x41')]);_0x3444f6[_0xfed1('0x4c')]=_['intersection'](_0x3444f6[_0xfed1('0x43')],_0x3444f6[_0xfed1('0x41')]);_0x33228b[_0xfed1('0x45')]=_[_0xfed1('0x42')](_0x3444f6[_0xfed1('0x43')],qs['fields'](_0x5d6b5a[_0xfed1('0x41')][_0xfed1('0x44')]));_0x33228b[_0xfed1('0x45')]=_0x33228b[_0xfed1('0x45')][_0xfed1('0x46')]?_0x33228b['attributes']:_0x3444f6[_0xfed1('0x43')];if(!_0x5d6b5a[_0xfed1('0x41')]['hasOwnProperty'](_0xfed1('0x48'))){_0x33228b[_0xfed1('0x2e')]=qs[_0xfed1('0x2e')](_0x5d6b5a[_0xfed1('0x41')][_0xfed1('0x2e')]);_0x33228b['offset']=qs[_0xfed1('0x2d')](_0x5d6b5a[_0xfed1('0x41')][_0xfed1('0x2d')]);}_0x33228b[_0xfed1('0x49')]=qs[_0xfed1('0x4a')](_0x5d6b5a[_0xfed1('0x41')][_0xfed1('0x4a')]);_0x33228b[_0xfed1('0x4b')]=qs['filters'](_[_0xfed1('0x4d')](_0x5d6b5a[_0xfed1('0x41')],_0x3444f6[_0xfed1('0x4c')]));_0x33228b['where'][_0xfed1('0x64')]=_0x2cfe0a['id'];if(_0x5d6b5a[_0xfed1('0x41')][_0xfed1('0x4e')]){_0x33228b[_0xfed1('0x4b')]=_[_0xfed1('0x51')](_0x33228b[_0xfed1('0x4b')],{'$or':_['map'](_0x33228b[_0xfed1('0x45')],function(_0x2a7b0e){var _0x304baf={};_0x304baf[_0x2a7b0e]={'$like':'%'+_0x5d6b5a[_0xfed1('0x41')][_0xfed1('0x4e')]+'%'};return _0x304baf;})});}_0x33228b=_[_0xfed1('0x51')]({},_0x33228b,_0x5d6b5a['options']);return db[_0xfed1('0x6d')][_0xfed1('0x2c')]({'where':_0x33228b['where']})[_0xfed1('0x21')](function(_0x3471d1){_0x577159[_0xfed1('0x2c')]=_0x3471d1;if(_0x5d6b5a[_0xfed1('0x41')]['includeAll']){_0x33228b[_0xfed1('0x53')]=[{'model':db[_0xfed1('0x6f')],'as':_0xfed1('0x70'),'required':![]},{'model':db[_0xfed1('0x71')],'as':_0xfed1('0x72'),'attributes':[_0xfed1('0x39'),_0xfed1('0x73'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xfed1('0x74'),'attributes':['id',_0xfed1('0x39'),_0xfed1('0x75')],'where':_0x5d6b5a['query'][_0xfed1('0x76')]?{'id':_0x5d6b5a['query'][_0xfed1('0x76')]}:undefined,'required':_0x5d6b5a[_0xfed1('0x41')][_0xfed1('0x76')]?!![]:![]}];}return db[_0xfed1('0x6d')][_0xfed1('0x54')](_0x33228b);})['then'](function(_0x3d9c3c){_0x577159[_0xfed1('0x55')]=_0x3d9c3c;return _0x577159;});}})[_0xfed1('0x21')](respondWithFilteredResult(_0x538112,_0x33228b))[_0xfed1('0x28')](handleError(_0x538112,null));};exports[_0xfed1('0x77')]=function(_0x29ae92,_0x1b1f3a,_0x4ad11d){return db[_0xfed1('0x3e')]['findOne']({'where':{'id':_0x29ae92[_0xfed1('0x57')]['id']}})['then'](handleEntityNotFound(_0x1b1f3a,null))[_0xfed1('0x21')](function(_0x485aec){if(_0x485aec){return db[_0xfed1('0x78')][_0xfed1('0x79')](function(_0x25ecb6){return db[_0xfed1('0x7a')]['destroy']({'where':{'FaxAccountId':_0x29ae92[_0xfed1('0x57')]['id']},'transaction':_0x25ecb6})[_0xfed1('0x21')](function(_0x4a2587){var _0x5d7b2c=_[_0xfed1('0x3d')](_0x29ae92[_0xfed1('0x5c')],function(_0x5d9d44){_0x5d9d44[_0xfed1('0x64')]=_0x29ae92[_0xfed1('0x57')]['id'];return _0x5d9d44;});return db[_0xfed1('0x7a')][_0xfed1('0x7b')](_0x5d7b2c,{'transaction':_0x25ecb6});});})[_0xfed1('0x21')](function(){return db[_0xfed1('0x7a')]['findAndCountAll']({'where':{'FaxAccountId':_0x29ae92[_0xfed1('0x57')]['id']},'order':_0xfed1('0x7c')});});}})['then'](respondWithResult(_0x1b1f3a,null))[_0xfed1('0x28')](handleError(_0x1b1f3a,null));};exports['getApplications']=function(_0x32ee9b,_0x2f81e7,_0x2f06dd){var _0x2b6645={};var _0x4abcca={};var _0x31a881;var _0x851081;return db[_0xfed1('0x3e')][_0xfed1('0x67')]({'where':{'id':_0x32ee9b[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x2f81e7,null))[_0xfed1('0x21')](function(_0x4f9066){if(_0x4f9066){_0x31a881=_0x4f9066;_0x4abcca[_0xfed1('0x43')]=_[_0xfed1('0x58')](db[_0xfed1('0x7a')][_0xfed1('0x3f')]);_0x4abcca[_0xfed1('0x41')]=_[_0xfed1('0x58')](_0x32ee9b[_0xfed1('0x41')]);_0x4abcca['filters']=_[_0xfed1('0x42')](_0x4abcca[_0xfed1('0x43')],_0x4abcca[_0xfed1('0x41')]);_0x2b6645[_0xfed1('0x45')]=_[_0xfed1('0x42')](_0x4abcca[_0xfed1('0x43')],qs['fields'](_0x32ee9b[_0xfed1('0x41')]['fields']));_0x2b6645[_0xfed1('0x45')]=_0x2b6645[_0xfed1('0x45')][_0xfed1('0x46')]?_0x2b6645[_0xfed1('0x45')]:_0x4abcca[_0xfed1('0x43')];_0x2b6645[_0xfed1('0x49')]=qs[_0xfed1('0x4a')](_0x32ee9b[_0xfed1('0x41')][_0xfed1('0x4a')]);_0x2b6645[_0xfed1('0x4b')]=qs[_0xfed1('0x4c')](_[_0xfed1('0x4d')](_0x32ee9b['query'],_0x4abcca[_0xfed1('0x4c')]));if(_0x32ee9b[_0xfed1('0x41')][_0xfed1('0x4e')]){_0x2b6645['where']=_[_0xfed1('0x51')](_0x2b6645['where'],{'$or':_[_0xfed1('0x3d')](_0x2b6645[_0xfed1('0x45')],function(_0x426927){var _0x54099f={};_0x54099f[_0x426927]={'$like':'%'+_0x32ee9b[_0xfed1('0x41')][_0xfed1('0x4e')]+'%'};return _0x54099f;})});}_0x2b6645=_[_0xfed1('0x51')]({},_0x2b6645,_0x32ee9b[_0xfed1('0x59')]);return _0x31a881[_0xfed1('0x7d')](_0x2b6645);}})[_0xfed1('0x21')](function(_0x44ed12){if(_0x44ed12){_0x851081=_0x44ed12[_0xfed1('0x46')];if(!_0x32ee9b[_0xfed1('0x41')][_0xfed1('0x47')](_0xfed1('0x48'))){_0x2b6645[_0xfed1('0x2e')]=qs['limit'](_0x32ee9b[_0xfed1('0x41')][_0xfed1('0x2e')]);_0x2b6645[_0xfed1('0x2d')]=qs[_0xfed1('0x2d')](_0x32ee9b[_0xfed1('0x41')][_0xfed1('0x2d')]);}return _0x31a881[_0xfed1('0x7d')](_0x2b6645);}})[_0xfed1('0x21')](function(_0x3b6ced){if(_0x3b6ced){return _0x3b6ced?{'count':_0x851081,'rows':_0x3b6ced}:null;}})[_0xfed1('0x21')](respondWithResult(_0x2f81e7,null))[_0xfed1('0x28')](handleError(_0x2f81e7,null));};function Extension(_0x5b345d,_0x466167,_0x150b4f,_0x8f20f3){this[_0xfed1('0x7e')]='from-voip-provider';this[_0xfed1('0x7f')]=_0x5b345d['localstationid'];this[_0xfed1('0x80')]=_0x8f20f3;this['type']=_0xfed1('0x81');this[_0xfed1('0x82')]='Fax\x20Extension';this[_0xfed1('0x64')]=_0x5b345d['id'];this['priority']=_0x466167;this[_0xfed1('0x83')]=_0x150b4f;}function createExtensionsReciveFax(_0x231b03){var _0xfcdfa=0x1;var _0x2faeaf=[];_0x2faeaf[_0xfed1('0x84')](new Extension(_0x231b03,_0xfcdfa,'',_0xfed1('0x85')));_0xfcdfa+=0x1;_0x2faeaf[_0xfed1('0x84')](new Extension(_0x231b03,_0xfcdfa,_0xfed1('0x86'),_0xfed1('0x87')));_0xfcdfa+=0x1;for(var _0x57e3e1 in _0x231b03){if(_0x231b03[_0xfed1('0x47')](_0x57e3e1)&&(_0x57e3e1===_0xfed1('0x88')||_0x57e3e1==='localstationid'||_0x57e3e1===_0xfed1('0x89')||_0x57e3e1===_0xfed1('0x8a')||_0x57e3e1===_0xfed1('0x8b')||_0x57e3e1===_0xfed1('0x8c')||_0x57e3e1===_0xfed1('0x8d')||_0x57e3e1===_0xfed1('0x8e')||_0x57e3e1==='t38timeout')){_0x2faeaf['push'](new Extension(_0x231b03,_0xfcdfa,'FAXOPT('+_0x57e3e1+')='+_0x231b03[_0x57e3e1],_0xfed1('0x87')));_0xfcdfa+=0x1;}}_0x2faeaf[_0xfed1('0x84')](new Extension(_0x231b03,_0xfcdfa,'6',_0xfed1('0x8f')));_0xfcdfa+=0x1;_0x2faeaf[_0xfed1('0x84')](new Extension(_0x231b03,_0xfcdfa,_0xfed1('0x90'),_0xfed1('0x91')));_0xfcdfa=0x0;return _0x2faeaf;}exports[_0xfed1('0x92')]=function(_0x5350f4,_0x1bf70b,_0x4432c){var _0x547dcb;return db['sequelize'][_0xfed1('0x79')](function(_0x66b445){return db[_0xfed1('0x3e')][_0xfed1('0x5b')](_0x5350f4[_0xfed1('0x5c')],{'transaction':_0x66b445})[_0xfed1('0x21')](function(_0x2ec39a){_0x547dcb=_0x2ec39a['get']({'plain':!![]});return db[_0xfed1('0x93')][_0xfed1('0x7b')](createExtensionsReciveFax(_0x547dcb),{'transaction':_0x66b445});});})[_0xfed1('0x21')](function(){return _0x547dcb;})[_0xfed1('0x21')](respondWithResult(_0x1bf70b,null))['catch'](handleError(_0x1bf70b,null));};exports[_0xfed1('0x94')]=function(_0x2fc8ea,_0x1df835,_0x69ce10){var _0x287c37;return db[_0xfed1('0x78')][_0xfed1('0x79')](function(_0x5ea156){return db[_0xfed1('0x3e')][_0xfed1('0x33')](_0x2fc8ea[_0xfed1('0x5c')],{'where':{'id':_0x2fc8ea[_0xfed1('0x5c')]['id']},'transaction':_0x5ea156})[_0xfed1('0x21')](function(_0x4a4bb8){return db[_0xfed1('0x93')][_0xfed1('0x34')]({'where':{'FaxAccountId':_0x2fc8ea['body']['id']},'transaction':_0x5ea156})[_0xfed1('0x21')](function(_0x5d8612){return db[_0xfed1('0x93')][_0xfed1('0x7b')](createExtensionsReciveFax(_[_0xfed1('0x95')](_0x2fc8ea[_0xfed1('0x5c')],['tech',_0xfed1('0x96'),_0xfed1('0x97'),_0xfed1('0x98'),_0xfed1('0x99'),_0xfed1('0x9a')])),{'transaction':_0x5ea156});});});})['then'](function(){return db[_0xfed1('0x3e')][_0xfed1('0x9b')](_0x2fc8ea[_0xfed1('0x5c')]['id']);})[_0xfed1('0x21')](respondWithResult(_0x1df835,null))[_0xfed1('0x28')](handleError(_0x1df835,null));};exports[_0xfed1('0x9c')]=function(_0x4fc52c,_0x29097d,_0x150457){var _0x35e4eb={'raw':!![],'where':{}};var _0x4da7b5={};var _0x4af132={'count':0x0,'rows':[]};return db[_0xfed1('0x3e')]['findOne']({'where':{'id':_0x4fc52c['params']['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x29097d,null))[_0xfed1('0x21')](function(_0x1a74fb){if(_0x1a74fb){_0x4da7b5[_0xfed1('0x43')]=_[_0xfed1('0x58')](db['FaxMessage'][_0xfed1('0x3f')]);_0x4da7b5[_0xfed1('0x41')]=_[_0xfed1('0x58')](_0x4fc52c[_0xfed1('0x41')]);_0x4da7b5[_0xfed1('0x4c')]=_[_0xfed1('0x42')](_0x4da7b5[_0xfed1('0x43')],_0x4da7b5[_0xfed1('0x41')]);_0x35e4eb[_0xfed1('0x45')]=_[_0xfed1('0x42')](_0x4da7b5[_0xfed1('0x43')],qs[_0xfed1('0x44')](_0x4fc52c[_0xfed1('0x41')][_0xfed1('0x44')]));_0x35e4eb[_0xfed1('0x45')]=_0x35e4eb[_0xfed1('0x45')][_0xfed1('0x46')]?_0x35e4eb[_0xfed1('0x45')]:_0x4da7b5[_0xfed1('0x43')];if(!_0x4fc52c['query'][_0xfed1('0x47')]('nolimit')){_0x35e4eb['limit']=qs[_0xfed1('0x2e')](_0x4fc52c[_0xfed1('0x41')]['limit']);_0x35e4eb[_0xfed1('0x2d')]=qs['offset'](_0x4fc52c['query'][_0xfed1('0x2d')]);}_0x35e4eb[_0xfed1('0x49')]=qs[_0xfed1('0x4a')](_0x4fc52c['query']['sort']);_0x35e4eb['where']=qs[_0xfed1('0x4c')](_[_0xfed1('0x4d')](_0x4fc52c[_0xfed1('0x41')],_0x4da7b5[_0xfed1('0x4c')]));_0x35e4eb[_0xfed1('0x4b')]['FaxAccountId']=_0x1a74fb['id'];if(_0x4fc52c['query'][_0xfed1('0x4e')]){_0x35e4eb['where']=_['merge'](_0x35e4eb[_0xfed1('0x4b')],{'$or':_[_0xfed1('0x3d')](_0x35e4eb[_0xfed1('0x45')],function(_0x1f2a56){var _0x5582dc={};_0x5582dc[_0x1f2a56]={'$like':'%'+_0x4fc52c[_0xfed1('0x41')][_0xfed1('0x4e')]+'%'};return _0x5582dc;})});}if(_0x4fc52c[_0xfed1('0x41')]['$gte']){var _0x8a9aa=_0x4fc52c[_0xfed1('0x41')][_0xfed1('0x9d')][_0xfed1('0x9e')](',');var _0x3a9016={};_0x3a9016[_0x8a9aa[0x0]]={'$gte':moment(_0x8a9aa[0x1])['format'](_0xfed1('0x9f'))};_0x35e4eb[_0xfed1('0x4b')]=_['merge'](_0x35e4eb[_0xfed1('0x4b')],_0x3a9016);}_0x35e4eb=_[_0xfed1('0x51')]({},_0x35e4eb,_0x4fc52c[_0xfed1('0x59')]);return db['FaxMessage'][_0xfed1('0x2c')]({'where':_0x35e4eb[_0xfed1('0x4b')]})[_0xfed1('0x21')](function(_0xa2838a){_0x4af132['count']=_0xa2838a;if(_0x4fc52c[_0xfed1('0x41')][_0xfed1('0x52')]){_0x35e4eb[_0xfed1('0x53')]=[{'all':!![]}];}return db[_0xfed1('0xa0')][_0xfed1('0x54')](_0x35e4eb);})['then'](function(_0x5c221a){_0x4af132[_0xfed1('0x55')]=_0x5c221a;return _0x4af132;});}})['then'](respondWithFilteredResult(_0x29097d,_0x35e4eb))[_0xfed1('0x28')](handleError(_0x29097d,null));};exports[_0xfed1('0x3a')]=function(_0xf3c04,_0x4c6909,_0x25093c){var _0x2aa5b0,_0x2040af={},_0x311b36;if(_0xf3c04[_0xfed1('0x5c')]['to']){_0x311b36=_0xf3c04['body']['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0xf3c04['params']['id']},'include':[{'model':db[_0xfed1('0xa1')],'as':_0xfed1('0xa2'),'include':[{'model':db['CmContact'],'as':_0xfed1('0xa3'),'where':{'fax':_0x311b36},'limit':0x1,'order':[['updatedAt',_0xfed1('0xa4')]]}]}]})[_0xfed1('0x21')](handleEntityNotFound(_0x4c6909,null))[_0xfed1('0x21')](function(_0x2227c5){_0x2aa5b0=_0x2227c5;if(_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')]&&_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')][_0xfed1('0x46')]){for(var _0x2df68d=0x0;_0x2df68d<_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')]['length'];_0x2df68d+=0x1){_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')][_0x2df68d]={'filename':_0xf3c04[_0xfed1('0x5c')]['attachments'][_0x2df68d][_0xfed1('0x39')],'id':_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')][_0x2df68d]['id'],'path':path['join'](config[_0xfed1('0xa6')],_0xfed1('0xa7'),_0xf3c04['body']['attachments'][_0x2df68d][_0xfed1('0xa8')])};}}return respondWithRpcPromise(_0xfed1('0xa9'),_0xfed1('0xa9'),{'FaxAccountId':_[_0xfed1('0xaa')](_0xf3c04[_0xfed1('0x57')]['id'])?undefined:_0xf3c04[_0xfed1('0x57')]['id'],'path':_[_0xfed1('0xaa')](_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')][0x0][_0xfed1('0xa')])?undefined:_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')][0x0]['path'],'fax':_[_0xfed1('0xaa')](_0xf3c04[_0xfed1('0x5c')]['to'][0x0])?undefined:_0xf3c04[_0xfed1('0x5c')]['to'][0x0]},client9002);})[_0xfed1('0x21')](function(){if(_0x2aa5b0){if(_[_0xfed1('0xaa')](_0xf3c04[_0xfed1('0x5c')]['from'])){_0xf3c04['body'][_0xfed1('0xab')]=util[_0xfed1('0xac')](_0xfed1('0xad'),_0x2aa5b0[_0xfed1('0x39')],_0x2aa5b0[_0xfed1('0xae')]);}if(_0x2aa5b0['List']){if(_0x2aa5b0[_0xfed1('0xa2')][_0xfed1('0xa3')][_0xfed1('0x46')]){return _0x2aa5b0[_0xfed1('0xa2')][_0xfed1('0xa3')][0x0];}else{return db['CmContact'][_0xfed1('0x5b')](_[_0xfed1('0x1a')](_0xf3c04[_0xfed1('0x5c')],{'firstName':_0xf3c04[_0xfed1('0x5c')]['to'][0x0],'phone':_0xf3c04[_0xfed1('0x5c')]['to'][0x0],'fax':_0xf3c04['body']['to'][0x0],'ListId':_0x2aa5b0[_0xfed1('0x9a')]}));}}else{throw new Error(_0xfed1('0xaf'));}}else{throw new Error(_0xfed1('0xb0'));}})['then'](function(_0x486975){if(_0x486975){return db[_0xfed1('0x6d')][_0xfed1('0x5a')]({'where':{'ContactId':_0x486975['id'],'closed':![],'FaxAccountId':_0x2aa5b0['id']}})['then'](function(_0x2171f6){if(_0x2171f6){return[_0x2171f6,![]];}return db[_0xfed1('0x6d')][_0xfed1('0x5b')]({'UserId':_0xf3c04[_0xfed1('0x5d')]['id'],'ContactId':_0x486975['id'],'FaxAccountId':_0x2aa5b0['id'],'fax':_0xf3c04[_0xfed1('0x5c')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0xf3c04['body'],{'read':![],'body':_0xf3c04['body'][_0xfed1('0xa5')][0x0][_0xfed1('0xb1')],'FaxAccountId':_0x2aa5b0['id'],'UserId':_0xf3c04[_0xfed1('0x5d')]['id'],'ContactId':_0x486975['id'],'AttachmentId':_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')][0x0]['id']})]},{'include':[{'model':db[_0xfed1('0xa0')],'as':_0xfed1('0xb2')}]})[_0xfed1('0x21')](function(_0xde4ad2){return[_0xde4ad2,!![]];});});}else{throw new Error(_0xfed1('0xb3'));}})[_0xfed1('0xb4')](function(_0x18b626,_0x22656a){if(_0x22656a){return _0x18b626;}return db[_0xfed1('0xa0')][_0xfed1('0x5b')]({'direction':_0xfed1('0xb5'),'read':![],'body':_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')][0x0][_0xfed1('0xb1')],'FaxAccountId':_0x2aa5b0['id'],'FaxInteractionId':_0x18b626['id'],'UserId':_0xf3c04[_0xfed1('0x5d')]['id'],'ContactId':_0x18b626[_0xfed1('0xb6')],'AttachmentId':_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')][0x0]['id']})[_0xfed1('0x21')](function(_0x30207e){_0x18b626[_0xfed1('0xb7')][_0xfed1('0xb2')]=[];_0x18b626[_0xfed1('0xb7')][_0xfed1('0xb2')]['push'](_0x30207e[_0xfed1('0xb7')]);return _0x18b626;});})[_0xfed1('0x21')](function(_0x2567a0){respondWithRpcPromise(_0xfed1('0xb8'),_0xfed1('0xb8'),{'FaxAccountId':_[_0xfed1('0xaa')](_0xf3c04[_0xfed1('0x57')]['id'])?undefined:_0xf3c04[_0xfed1('0x57')]['id'],'path':_[_0xfed1('0xaa')](_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')][0x0][_0xfed1('0xa')])?undefined:_0xf3c04[_0xfed1('0x5c')]['attachments'][0x0][_0xfed1('0xa')],'fax':_[_0xfed1('0xaa')](_0xf3c04['body']['to'][0x0])?undefined:_0xf3c04['body']['to'][0x0],'AttachmentId':_0xf3c04['body'][_0xfed1('0xa5')][0x0]['id']},client9002)['then'](function(_0x2f407b){logger[_0xfed1('0xb9')](_0xfed1('0xba'),_0x2f407b);})['catch'](function(_0x43acd4){logger[_0xfed1('0xb9')](_0xfed1('0xba'),_0x43acd4);});return _0x2567a0;})['then'](respondWithResult(_0x4c6909,null))['catch'](handleError(_0x4c6909,null));};exports[_0xfed1('0xbb')]=function(_0x3d8c97,_0x5b00b8,_0x524fc3){return db[_0xfed1('0x3e')][_0xfed1('0x5a')]({'where':{'id':_0x3d8c97[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x5b00b8,null))[_0xfed1('0x21')](function(_0x117c21){if(_0x117c21){return _0x117c21[_0xfed1('0xbb')](_0x3d8c97['body'][_0xfed1('0x69')],_[_0xfed1('0x95')](_0x3d8c97['body'],['ids','id'])||{})['spread'](function(_0x2f2481){for(var _0x503ea8=0x0;_0x503ea8<_0x3d8c97['body'][_0xfed1('0x69')][_0xfed1('0x46')];_0x503ea8+=0x1){socket[_0xfed1('0xbc')](_0xfed1('0xbd'),{'UserId':_0x3d8c97['body']['ids'][_0x503ea8],'FaxAccountId':_0x3d8c97[_0xfed1('0x57')]['id']});}return _0x2f2481;});}})['then'](respondWithResult(_0x5b00b8,null))[_0xfed1('0x28')](handleError(_0x5b00b8,null));};exports['removeAgents']=function(_0x490325,_0x339750,_0x57b0cc){return db[_0xfed1('0x3e')][_0xfed1('0x5a')]({'where':{'id':_0x490325[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x339750,null))[_0xfed1('0x21')](function(_0x967af){if(_0x967af){return _0x967af['removeAgents'](_0x490325[_0xfed1('0x41')][_0xfed1('0x69')])[_0xfed1('0x21')](function(){if(_[_0xfed1('0xbe')](_0x490325[_0xfed1('0x41')][_0xfed1('0x69')])){for(var _0x2de989=0x0;_0x2de989<_0x490325[_0xfed1('0x41')][_0xfed1('0x69')]['length'];_0x2de989+=0x1){socket[_0xfed1('0xbc')](_0xfed1('0xbf'),{'UserId':Number(_0x490325[_0xfed1('0x41')][_0xfed1('0x69')][_0x2de989]),'FaxAccountId':Number(_0x490325[_0xfed1('0x57')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x490325['query'][_0xfed1('0x69')]),'FaxAccountId':Number(_0x490325['params']['id'])});}});}})[_0xfed1('0x21')](respondWithStatusCode(_0x339750,null))['catch'](handleError(_0x339750,null));};exports[_0xfed1('0xc0')]=function(_0x3cb83d,_0x507fb1,_0x5ac5f3){var _0x1638c6={};var _0x5c3fe1={};var _0x4fa721;var _0x1d9d65;return db[_0xfed1('0x3e')]['findOne']({'where':{'id':_0x3cb83d[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x507fb1,null))[_0xfed1('0x21')](function(_0x51e85f){if(_0x51e85f){_0x4fa721=_0x51e85f;_0x5c3fe1[_0xfed1('0x43')]=_[_0xfed1('0x58')](db[_0xfed1('0x71')][_0xfed1('0x3f')]);_0x5c3fe1[_0xfed1('0x41')]=_[_0xfed1('0x58')](_0x3cb83d['query']);_0x5c3fe1[_0xfed1('0x4c')]=_[_0xfed1('0x42')](_0x5c3fe1[_0xfed1('0x43')],_0x5c3fe1[_0xfed1('0x41')]);_0x1638c6[_0xfed1('0x45')]=_[_0xfed1('0x42')](_0x5c3fe1[_0xfed1('0x43')],qs['fields'](_0x3cb83d[_0xfed1('0x41')][_0xfed1('0x44')]));_0x1638c6['attributes']=_0x1638c6[_0xfed1('0x45')][_0xfed1('0x46')]?_0x1638c6[_0xfed1('0x45')]:_0x5c3fe1['model'];_0x1638c6[_0xfed1('0x49')]=qs[_0xfed1('0x4a')](_0x3cb83d[_0xfed1('0x41')]['sort']);_0x1638c6['where']=qs['filters'](_[_0xfed1('0x4d')](_0x3cb83d[_0xfed1('0x41')],_0x5c3fe1[_0xfed1('0x4c')]));if(_0x3cb83d[_0xfed1('0x41')][_0xfed1('0x4e')]){_0x1638c6[_0xfed1('0x4b')]=_[_0xfed1('0x51')](_0x1638c6[_0xfed1('0x4b')],{'$or':_[_0xfed1('0x3d')](_0x1638c6[_0xfed1('0x45')],function(_0x85c3f5){var _0x5aa57a={};_0x5aa57a[_0x85c3f5]={'$like':'%'+_0x3cb83d[_0xfed1('0x41')][_0xfed1('0x4e')]+'%'};return _0x5aa57a;})});}_0x1638c6=_[_0xfed1('0x51')]({},_0x1638c6,_0x3cb83d[_0xfed1('0x59')]);return _0x4fa721[_0xfed1('0xc0')](_0x1638c6);}})[_0xfed1('0x21')](function(_0x534411){if(_0x534411){_0x1d9d65=_0x534411['length'];if(!_0x3cb83d[_0xfed1('0x41')][_0xfed1('0x47')](_0xfed1('0x48'))){_0x1638c6[_0xfed1('0x2e')]=qs['limit'](_0x3cb83d[_0xfed1('0x41')]['limit']);_0x1638c6[_0xfed1('0x2d')]=qs[_0xfed1('0x2d')](_0x3cb83d[_0xfed1('0x41')][_0xfed1('0x2d')]);}return _0x4fa721[_0xfed1('0xc0')](_0x1638c6);}})[_0xfed1('0x21')](function(_0x38a155){if(_0x38a155){return _0x38a155?{'count':_0x1d9d65,'rows':_0x38a155}:null;}})[_0xfed1('0x21')](respondWithResult(_0x507fb1,null))[_0xfed1('0x28')](handleError(_0x507fb1,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 5bf6618..8edd729 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 _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 +var _0x192b=['../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x32dc5a,_0x44b7ca){var _0x5d3945=function(_0x401b9c){while(--_0x401b9c){_0x32dc5a['push'](_0x32dc5a['shift']());}};_0x5d3945(++_0x44b7ca);}(_0x192b,0x82));var _0xb192=function(_0x2fbb95,_0x3a9af6){_0x2fbb95=_0x2fbb95-0x0;var _0x2b9ecb=_0x192b[_0x2fbb95];return _0x2b9ecb;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xb192('0x0'))['db'][_0xb192('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb192('0x2')](0x0);var events={'afterCreate':_0xb192('0x3'),'afterUpdate':_0xb192('0x4'),'afterDestroy':_0xb192('0x5')};function emitEvent(_0x24b6be){return function(_0x2486b7,_0x2c2a6f,_0x386514){FaxAccountEvents[_0xb192('0x6')](_0x24b6be+':'+_0x2486b7['id'],_0x2486b7);FaxAccountEvents[_0xb192('0x6')](_0x24b6be,_0x2486b7);_0x386514(null);};}for(var e in events){if(events[_0xb192('0x7')](e)){var event=events[e];FaxAccount[_0xb192('0x8')](e,emitEvent(event));}}module[_0xb192('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 835fae6..db1fe80 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 _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 +var _0x8e5b=['path','rimraf','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x41f88d,_0x1cb1d8){var _0x5617aa=function(_0x2c14aa){while(--_0x2c14aa){_0x41f88d['push'](_0x41f88d['shift']());}};_0x5617aa(++_0x1cb1d8);}(_0x8e5b,0x125));var _0xb8e5=function(_0x20e266,_0x52b972){_0x20e266=_0x20e266-0x0;var _0x2baeca=_0x8e5b[_0x20e266];return _0x2baeca;};'use strict';var _=require(_0xb8e5('0x0'));var util=require('util');var logger=require(_0xb8e5('0x1'))(_0xb8e5('0x2'));var moment=require(_0xb8e5('0x3'));var BPromise=require(_0xb8e5('0x4'));var rp=require(_0xb8e5('0x5'));var fs=require('fs');var path=require(_0xb8e5('0x6'));var rimraf=require(_0xb8e5('0x7'));var config=require('../../config/environment');var attributes=require(_0xb8e5('0x8'));module[_0xb8e5('0x9')]=function(_0x8d750d,_0x123374){return _0x8d750d[_0xb8e5('0xa')](_0xb8e5('0xb'),attributes,{'tableName':_0xb8e5('0xc'),'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 58db0da..9192c9e 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 _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 +var _0xfc26=['FaxMessage','AttachmentId','User','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','defaults','redis','socket.io-emitter','./faxAccount.socket','register','request','then','debug','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','catch','GetFaxAccount','findAll','options','raw','where','attributes','limit','include','model','map','NotifyFaxAccount','body','fax','CmContact','describe','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','isNil','from','ValidationError','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','List','DESC','FaxApplication','Applications','applications','list','orderBy','priority','asc','account','Contacts','length','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','spread','get','push','close','*,*,*,*','created','interaction'];(function(_0x3f7ba9,_0xa85c88){var _0x22ca79=function(_0x465a0e){while(--_0x465a0e){_0x3f7ba9['push'](_0x3f7ba9['shift']());}};_0x22ca79(++_0xa85c88);}(_0xfc26,0x115));var _0x6fc2=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0xfc26[_0x19b3f9];return _0x18c3f6;};'use strict';var _=require(_0x6fc2('0x0'));var util=require('util');var moment=require(_0x6fc2('0x1'));var BPromise=require('bluebird');var rs=require(_0x6fc2('0x2'));var fs=require('fs');var Redis=require(_0x6fc2('0x3'));var db=require(_0x6fc2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6fc2('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6fc2('0x6'));var client=jayson[_0x6fc2('0x7')][_0x6fc2('0x8')]({'port':0x232c});config['redis']=_[_0x6fc2('0x9')](config[_0x6fc2('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6fc2('0xb'))(new Redis(config[_0x6fc2('0xa')]));require(_0x6fc2('0xc'))[_0x6fc2('0xd')](socket);function respondWithRpcPromise(_0x33f2ea,_0x2915b7,_0x1e4121){return new BPromise(function(_0x31eb53,_0x430f5e){return client[_0x6fc2('0xe')](_0x33f2ea,_0x1e4121)[_0x6fc2('0xf')](function(_0x224880){logger['info']('FaxAccount,\x20%s,\x20%s',_0x2915b7,'request\x20sent');logger[_0x6fc2('0x10')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2915b7,_0x6fc2('0x11'),JSON[_0x6fc2('0x12')](_0x224880));if(_0x224880[_0x6fc2('0x13')]){if(_0x224880[_0x6fc2('0x13')][_0x6fc2('0x14')]===0x1f4){logger[_0x6fc2('0x13')](_0x6fc2('0x15'),_0x2915b7,_0x224880['error'][_0x6fc2('0x16')]);return _0x430f5e(_0x224880['error'][_0x6fc2('0x16')]);}logger['error'](_0x6fc2('0x15'),_0x2915b7,_0x224880['error'][_0x6fc2('0x16')]);return _0x31eb53(_0x224880[_0x6fc2('0x13')][_0x6fc2('0x16')]);}else{logger[_0x6fc2('0x17')]('FaxAccount,\x20%s,\x20%s',_0x2915b7,_0x6fc2('0x11'));_0x31eb53(_0x224880['result'][_0x6fc2('0x16')]);}})[_0x6fc2('0x18')](function(_0x5af6c2){logger[_0x6fc2('0x13')]('FaxAccount,\x20%s,\x20%s',_0x2915b7,_0x5af6c2);_0x430f5e(_0x5af6c2);});});}exports[_0x6fc2('0x19')]=function(_0x4f5956){var _0x4e826e=this;return new Promise(function(_0x51cdaa,_0x813b96){return db['FaxAccount'][_0x6fc2('0x1a')]({'raw':_0x4f5956[_0x6fc2('0x1b')]?_0x4f5956[_0x6fc2('0x1b')][_0x6fc2('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f5956[_0x6fc2('0x1b')]?_0x4f5956[_0x6fc2('0x1b')][_0x6fc2('0x1d')]||null:null,'attributes':_0x4f5956['options']?_0x4f5956[_0x6fc2('0x1b')][_0x6fc2('0x1e')]||null:null,'limit':_0x4f5956[_0x6fc2('0x1b')]?_0x4f5956[_0x6fc2('0x1b')][_0x6fc2('0x1f')]||null:null,'include':_0x4f5956[_0x6fc2('0x1b')]?_0x4f5956[_0x6fc2('0x1b')][_0x6fc2('0x20')]?_['map'](_0x4f5956['options'][_0x6fc2('0x20')],function(_0x25f7c5){return{'model':db[_0x25f7c5[_0x6fc2('0x21')]],'as':_0x25f7c5['as'],'attributes':_0x25f7c5[_0x6fc2('0x1e')],'include':_0x25f7c5[_0x6fc2('0x20')]?_[_0x6fc2('0x22')](_0x25f7c5['include'],function(_0x3d243c){return{'model':db[_0x3d243c[_0x6fc2('0x21')]],'as':_0x3d243c['as'],'attributes':_0x3d243c[_0x6fc2('0x1e')],'include':_0x3d243c[_0x6fc2('0x20')]?_[_0x6fc2('0x22')](_0x3d243c[_0x6fc2('0x20')],function(_0x55dd3f){return{'model':db[_0x55dd3f[_0x6fc2('0x21')]],'as':_0x55dd3f['as'],'attributes':_0x55dd3f[_0x6fc2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6fc2('0xf')](function(_0xd7fcc2){logger[_0x6fc2('0x17')]('GetFaxAccount',_0x4f5956);logger[_0x6fc2('0x10')]('GetFaxAccount',_0x4f5956,JSON[_0x6fc2('0x12')](_0xd7fcc2));_0x51cdaa(_0xd7fcc2);})[_0x6fc2('0x18')](function(_0xa219b7){logger[_0x6fc2('0x13')](_0x6fc2('0x19'),_0xa219b7[_0x6fc2('0x16')],_0x4f5956);_0x813b96(_0x4e826e[_0x6fc2('0x13')](0x1f4,_0xa219b7[_0x6fc2('0x16')]));});});};exports[_0x6fc2('0x23')]=function(_0x439461,_0x26404b,_0xf9820c){var _0x580b68=this;return new Promise(function(_0x42c960,_0x51e75c){var _0x3a6c1e={'body':_0x439461[_0x6fc2('0x24')],'channel':_0x6fc2('0x25')};var _0x3dbba6=[];var _0x3e350d=[];var _0xa42273={};return db[_0x6fc2('0x26')][_0x6fc2('0x27')]()['then'](function(_0x20f8eb){if(!_0x20f8eb){throw new db['Sequelize']['ValidationError'](_0x6fc2('0x28'));}_0x3dbba6=_[_0x6fc2('0x29')](_[_0x6fc2('0x2a')](_0x20f8eb),['createdAt','updatedAt']);_0x3e350d=_[_0x6fc2('0x29')](_[_0x6fc2('0x2a')](_0x20f8eb),[_0x6fc2('0x2b'),_0x6fc2('0x2c'),'CompanyId','ListId']);if(_0x439461[_0x6fc2('0x24')]['id']){delete _0x439461[_0x6fc2('0x24')]['id'];}if(_[_0x6fc2('0x2d')](_0x439461['body'][_0x6fc2('0x2e')])){throw new db['Sequelize'][(_0x6fc2('0x2f'))](_0x6fc2('0x30'));}if(_[_0x6fc2('0x2d')](_0x439461[_0x6fc2('0x24')][_0x6fc2('0x24')])||_0x439461[_0x6fc2('0x24')][_0x6fc2('0x24')]===''){throw new db[(_0x6fc2('0x31'))][(_0x6fc2('0x2f'))](_0x6fc2('0x32'));}if(_[_0x6fc2('0x2d')](_0x439461[_0x6fc2('0x24')][_0x6fc2('0x33')])){throw new db[(_0x6fc2('0x31'))][(_0x6fc2('0x2f'))](_0x6fc2('0x34')+_0x3e350d);}if(!_['includes'](_0x3e350d,_0x439461['body'][_0x6fc2('0x33')])){throw new db[(_0x6fc2('0x31'))][(_0x6fc2('0x2f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3e350d);}_0xa42273[_0x439461[_0x6fc2('0x24')]['mapKey']]=_0x439461[_0x6fc2('0x24')][_0x6fc2('0x2e')];})[_0x6fc2('0xf')](function(){return db[_0x6fc2('0x35')][_0x6fc2('0x36')]({'where':{'id':_0x439461['account']['id']},'include':[{'model':db['CmList'],'as':_0x6fc2('0x37'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0xa42273,'limit':0x1,'order':[[_0x6fc2('0x2c'),_0x6fc2('0x38')]]}]},{'model':db[_0x6fc2('0x39')],'as':_0x6fc2('0x3a')}]});})[_0x6fc2('0xf')](function(_0x2e66fe){if(_0x2e66fe&&_0x2e66fe['List']){var _0x32f969=_0x2e66fe['get']({'plain':!![]});_0x3a6c1e['account']=_0x32f969;_0x3a6c1e[_0x6fc2('0x3b')]=_0x32f969['Applications'];_0x3a6c1e[_0x6fc2('0x3c')]=_0x32f969[_0x6fc2('0x37')];_0x3a6c1e['applications']=_[_0x6fc2('0x3d')](_0x3a6c1e['applications'],[_0x6fc2('0x3e')],[_0x6fc2('0x3f')]);if(_0x3a6c1e['account'][_0x6fc2('0x3a')]){delete _0x3a6c1e[_0x6fc2('0x40')][_0x6fc2('0x3a')];}if(_0x3a6c1e[_0x6fc2('0x40')][_0x6fc2('0x37')]&&_0x3a6c1e[_0x6fc2('0x40')][_0x6fc2('0x37')][_0x6fc2('0x41')][_0x6fc2('0x42')]){return _0x3a6c1e[_0x6fc2('0x40')]['List'][_0x6fc2('0x41')][0x0];}var _0x3ed3ea=_['defaults'](_0x439461['body'],{'firstName':_0x439461['body'][_0x6fc2('0x2e')],'ListId':_0x32f969[_0x6fc2('0x43')]});_0x3ed3ea[_0x439461[_0x6fc2('0x24')][_0x6fc2('0x33')]]=_0x439461['body']['from'];return db[_0x6fc2('0x26')][_0x6fc2('0x44')](_0x3ed3ea,{'fields':_0x3dbba6,'raw':!![]});}})['then'](function(_0x1a36f4){_0x3a6c1e[_0x6fc2('0x45')]=_0x1a36f4;if(_0x1a36f4){var _0x1b6501={'ContactId':_0x1a36f4['id'],'FaxAccountId':_0x439461['account']['id'],'fax':_0x1a36f4[_0x6fc2('0x25')]};return db['FaxInteraction'][_0x6fc2('0x36')]({'where':{'ContactId':_0x1a36f4['id'],'closed':![],'FaxAccountId':_0x439461[_0x6fc2('0x40')]['id']}})[_0x6fc2('0xf')](function(_0x3957d8){if(_0x3957d8){return[_0x3957d8,![]];}return db[_0x6fc2('0x46')][_0x6fc2('0x44')](_0x1b6501)[_0x6fc2('0xf')](function(_0x4f638f){return[_0x4f638f,!![]];});});}else{throw new Error(_0x6fc2('0x47'));}})[_0x6fc2('0x48')](function(_0x59929d,_0x52ead3){var _0x140849=_0x59929d[_0x6fc2('0x49')]({'plain':!![]});if(_0x52ead3){if(_0x3a6c1e[_0x6fc2('0x40')]['autoclose']){_0x3a6c1e[_0x6fc2('0x3b')][_0x6fc2('0x4a')]({'id':0x0,'priority':_0x3a6c1e['applications']['length']+0x1,'app':_0x6fc2('0x4b'),'appdata':'unmanaged','interval':_0x6fc2('0x4c')});}_0x140849[_0x6fc2('0x4d')]=!![];}else{_0x140849[_0x6fc2('0x4d')]=![];}_0x3a6c1e[_0x6fc2('0x4e')]=_0x140849;return db[_0x6fc2('0x4f')]['create']({'body':_0x439461[_0x6fc2('0x24')]['body'],'FaxAccountId':_0x439461['account']['id'],'FaxInteractionId':_0x59929d['id'],'direction':'in','ContactId':_0x59929d['ContactId'],'AttachmentId':_0x439461[_0x6fc2('0x24')][_0x6fc2('0x50')]});})[_0x6fc2('0xf')](function(_0x180e64){_0x3a6c1e[_0x6fc2('0x16')]=_0x180e64;if(_0x3a6c1e[_0x6fc2('0x4e')]['UserId']){return db[_0x6fc2('0x51')][_0x6fc2('0x36')]({'attributes':['id',_0x6fc2('0x52')],'where':{'id':_0x3a6c1e['interaction'][_0x6fc2('0x53')]}})[_0x6fc2('0xf')](function(_0x18b955){if(_0x18b955){_0x3a6c1e[_0x6fc2('0x3b')][_0x6fc2('0x54')]({'id':0x0,'priority':0x0,'app':_0x6fc2('0x55'),'appdata':_0x18b955['name']+','+(_0x3a6c1e[_0x6fc2('0x40')][_0x6fc2('0x56')]||0xa),'interval':_0x6fc2('0x4c')});}return respondWithRpcPromise(_0x6fc2('0x57'),_0x6fc2('0x58'),_0x3a6c1e);});}return respondWithRpcPromise(_0x6fc2('0x57'),_0x6fc2('0x58'),_0x3a6c1e);})['then'](function(_0x18ee36){_0x42c960(_0x18ee36);})['catch'](function(_0x5ecdc0){_0x51e75c(_0x580b68[_0x6fc2('0x13')](0x1f4,_0x5ecdc0[_0x6fc2('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index fc9f6e2..e499b65 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 _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 +var _0xdb28=['remove','update','emit','register','length','faxAccount:','./faxAccount.events','save'];(function(_0x167a71,_0x68d27d){var _0x3778c5=function(_0x2e8b76){while(--_0x2e8b76){_0x167a71['push'](_0x167a71['shift']());}};_0x3778c5(++_0x68d27d);}(_0xdb28,0x106));var _0x8db2=function(_0x545ce3,_0xe88d98){_0x545ce3=_0x545ce3-0x0;var _0x9dbbb=_0xdb28[_0x545ce3];return _0x9dbbb;};'use strict';var FaxAccountEvents=require(_0x8db2('0x0'));var events=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3')];function createListener(_0x585da1,_0x1f4c45){return function(_0x11c26d){_0x1f4c45[_0x8db2('0x4')](_0x585da1,_0x11c26d);};}function removeListener(_0x4426fe,_0x11109e){return function(){FaxAccountEvents['removeListener'](_0x4426fe,_0x11109e);};}exports[_0x8db2('0x5')]=function(_0x1d2dd3){for(var _0x5f42ee=0x0,_0x494b40=events[_0x8db2('0x6')];_0x5f42ee<_0x494b40;_0x5f42ee++){var _0x46932f=events[_0x5f42ee];var _0x131537=createListener(_0x8db2('0x7')+_0x46932f,_0x1d2dd3);FaxAccountEvents['on'](_0x46932f,_0x131537);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 407e918..9f86aba 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 _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 +var _0xee7e=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','getApplications','/:id/messages','/:id/users','create','addDisposition','post','addAnswer','addInteraction','/:id/applications','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x40c402,_0x42ee7d){var _0x4e7680=function(_0x52b150){while(--_0x52b150){_0x40c402['push'](_0x40c402['shift']());}};_0x4e7680(++_0x42ee7d);}(_0xee7e,0xca));var _0xeee7=function(_0x2a6b4b,_0x3d063e){_0x2a6b4b=_0x2a6b4b-0x0;var _0x47c88a=_0xee7e[_0x2a6b4b];return _0x47c88a;};'use strict';var multer=require(_0xeee7('0x0'));var util=require(_0xeee7('0x1'));var path=require(_0xeee7('0x2'));var timeout=require(_0xeee7('0x3'));var express=require('express');var router=express[_0xeee7('0x4')]();var auth=require(_0xeee7('0x5'));var interaction=require(_0xeee7('0x6'));var config=require(_0xeee7('0x7'));var controller=require('./faxAccount.controller');router[_0xeee7('0x8')]('/',auth[_0xeee7('0x9')](),controller[_0xeee7('0xa')]);router['get'](_0xeee7('0xb'),auth[_0xeee7('0x9')](),controller[_0xeee7('0xc')]);router[_0xeee7('0x8')](_0xeee7('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0xeee7('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0xeee7('0xf'),auth['isAuthenticated'](),controller[_0xeee7('0x10')]);router[_0xeee7('0x8')](_0xeee7('0x11'),auth[_0xeee7('0x9')](),controller[_0xeee7('0x12')]);router['get']('/:id/applications',auth[_0xeee7('0x9')](),controller[_0xeee7('0x13')]);router[_0xeee7('0x8')](_0xeee7('0x14'),auth['isAuthenticated'](),controller['getMessages']);router[_0xeee7('0x8')](_0xeee7('0x15'),auth[_0xeee7('0x9')](),controller['getAgents']);router['post']('/',auth[_0xeee7('0x9')](),controller[_0xeee7('0x16')]);router['post'](_0xeee7('0xe'),auth['isAuthenticated'](),controller[_0xeee7('0x17')]);router[_0xeee7('0x18')](_0xeee7('0xf'),auth[_0xeee7('0x9')](),controller[_0xeee7('0x19')]);router[_0xeee7('0x18')](_0xeee7('0x11'),auth[_0xeee7('0x9')](),controller[_0xeee7('0x1a')]);router['post'](_0xeee7('0x1b'),auth['isAuthenticated'](),controller[_0xeee7('0x1c')]);router[_0xeee7('0x18')](_0xeee7('0x1d'),auth[_0xeee7('0x9')](),controller['addAccountApplications']);router[_0xeee7('0x18')](_0xeee7('0x1e'),auth[_0xeee7('0x9')](),controller[_0xeee7('0x1f')]);router[_0xeee7('0x18')](_0xeee7('0x20'),auth[_0xeee7('0x9')](),controller[_0xeee7('0x21')]);router[_0xeee7('0x18')](_0xeee7('0x15'),auth[_0xeee7('0x9')](),controller[_0xeee7('0x22')]);router['put']('/:id',auth[_0xeee7('0x9')](),controller[_0xeee7('0x23')]);router[_0xeee7('0x24')](_0xeee7('0xd'),auth[_0xeee7('0x9')](),controller['destroy']);router['delete'](_0xeee7('0xe'),auth['isAuthenticated'](),controller[_0xeee7('0x25')]);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xeee7('0x26')]);router[_0xeee7('0x24')]('/:id/users',auth['isAuthenticated'](),controller[_0xeee7('0x27')]);module[_0xeee7('0x28')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 86f8573..0b71d73 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 _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 +var _0xee4a=['STRING','noop','*,*,*,*','sequelize','INTEGER'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xee4a,0x9e));var _0xaee4=function(_0x226f04,_0x10f2fc){_0x226f04=_0x226f04-0x0;var _0x184678=_0xee4a[_0x226f04];return _0x184678;};'use strict';var Sequelize=require(_0xaee4('0x0'));module['exports']={'priority':{'type':Sequelize[_0xaee4('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xaee4('0x2')],'allowNull':![],'defaultValue':_0xaee4('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xaee4('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xaee4('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 990d3fe..979e9ee 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 _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 +var _0xd034=['body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','FaxApplication','includeAll','include','findAll','rows','catch','show','params','find','create'];(function(_0x1526e1,_0x5ed5a5){var _0x249a1e=function(_0x4a7c12){while(--_0x4a7c12){_0x1526e1['push'](_0x1526e1['shift']());}};_0x249a1e(++_0x5ed5a5);}(_0xd034,0x93));var _0x4d03=function(_0x5b9252,_0x4bc2f8){_0x5b9252=_0x5b9252-0x0;var _0x1a4284=_0xd034[_0x5b9252];return _0x1a4284;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4d03('0x0'));var rimraf=require(_0x4d03('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d03('0x2'));var rp=require(_0x4d03('0x3'));var moment=require(_0x4d03('0x4'));var BPromise=require(_0x4d03('0x5'));var Mustache=require(_0x4d03('0x6'));var util=require(_0x4d03('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4d03('0x8'));var ejs=require(_0x4d03('0x9'));var fs=require('fs');var _=require(_0x4d03('0xa'));var squel=require('squel');var crypto=require(_0x4d03('0xb'));var jsforce=require(_0x4d03('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d03('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4d03('0xe'));var as=require(_0x4d03('0xf'));var hardwareService=require(_0x4d03('0x10'));var logger=require(_0x4d03('0x11'))(_0x4d03('0x12'));var utils=require(_0x4d03('0x13'));var config=require(_0x4d03('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4d03('0x15'))['db'];function respondWithStatusCode(_0x472179,_0x1de135){_0x1de135=_0x1de135||0xcc;return function(_0x496e97){if(_0x496e97){return _0x472179[_0x4d03('0x16')](_0x1de135);}return _0x472179[_0x4d03('0x17')](_0x1de135)[_0x4d03('0x18')]();};}function respondWithResult(_0xe4c354,_0x2dc8ab){_0x2dc8ab=_0x2dc8ab||0xc8;return function(_0x31f0ad){if(_0x31f0ad){return _0xe4c354[_0x4d03('0x17')](_0x2dc8ab)[_0x4d03('0x19')](_0x31f0ad);}};}function respondWithFilteredResult(_0x57e68b,_0x5a4a){return function(_0x1e963b){if(_0x1e963b){var _0x5dd9d6=_0x1e963b[_0x4d03('0x1a')],_0x4bb7dd=_0x5a4a['offset'],_0xea6d5a=_0x5a4a[_0x4d03('0x1b')]+_0x5a4a[_0x4d03('0x1c')],_0xeb981c;if(_0xea6d5a>=_0x5dd9d6){_0xea6d5a=_0x5dd9d6;_0xeb981c=0xc8;}else{_0xeb981c=0xce;}_0x57e68b[_0x4d03('0x17')](_0xeb981c);return _0x57e68b[_0x4d03('0x1d')](_0x4d03('0x1e'),_0x4bb7dd+'-'+_0xea6d5a+'/'+_0x5dd9d6)['json'](_0x1e963b);}return null;};}function patchUpdates(_0x4a94fe){return function(_0xc0d4a1){try{jsonpatch[_0x4d03('0x1f')](_0xc0d4a1,_0x4a94fe,!![]);}catch(_0x1f417a){return BPromise[_0x4d03('0x20')](_0x1f417a);}return _0xc0d4a1['save']();};}function saveUpdates(_0x5d65ca,_0x4dcb6c){return function(_0x301c47){if(_0x301c47){return _0x301c47[_0x4d03('0x21')](_0x5d65ca)[_0x4d03('0x22')](function(_0x1e4fb7){return _0x1e4fb7;});}return null;};}function removeEntity(_0x3c1949,_0x1b7838){return function(_0x508676){if(_0x508676){return _0x508676[_0x4d03('0x23')]()[_0x4d03('0x22')](function(){_0x3c1949[_0x4d03('0x17')](0xcc)[_0x4d03('0x18')]();});}};}function handleEntityNotFound(_0x40d6cf,_0x372a24){return function(_0x50c032){if(!_0x50c032){_0x40d6cf[_0x4d03('0x16')](0x194);}return _0x50c032;};}function handleError(_0x32d185,_0x1c8d60){_0x1c8d60=_0x1c8d60||0x1f4;return function(_0x4e3b9b){logger[_0x4d03('0x24')](_0x4e3b9b[_0x4d03('0x25')]);if(_0x4e3b9b['name']){delete _0x4e3b9b[_0x4d03('0x26')];}_0x32d185[_0x4d03('0x17')](_0x1c8d60)[_0x4d03('0x27')](_0x4e3b9b);};}exports['index']=function(_0xa86979,_0x1034c5){var _0xea7d4b={},_0xbb3c8f={},_0x598206={'count':0x0,'rows':[]};var _0x2d6d64=_[_0x4d03('0x28')](db['FaxApplication'][_0x4d03('0x29')],function(_0x6cab76){return{'name':_0x6cab76[_0x4d03('0x2a')],'type':_0x6cab76[_0x4d03('0x2b')][_0x4d03('0x2c')]};});_0xbb3c8f[_0x4d03('0x2d')]=_[_0x4d03('0x28')](_0x2d6d64,_0x4d03('0x26'));_0xbb3c8f[_0x4d03('0x2e')]=_[_0x4d03('0x2f')](_0xa86979[_0x4d03('0x2e')]);_0xbb3c8f[_0x4d03('0x30')]=_[_0x4d03('0x31')](_0xbb3c8f[_0x4d03('0x2d')],_0xbb3c8f[_0x4d03('0x2e')]);_0xea7d4b[_0x4d03('0x32')]=_[_0x4d03('0x31')](_0xbb3c8f[_0x4d03('0x2d')],qs[_0x4d03('0x33')](_0xa86979[_0x4d03('0x2e')]['fields']));_0xea7d4b[_0x4d03('0x32')]=_0xea7d4b[_0x4d03('0x32')][_0x4d03('0x34')]?_0xea7d4b[_0x4d03('0x32')]:_0xbb3c8f[_0x4d03('0x2d')];if(!_0xa86979['query'][_0x4d03('0x35')](_0x4d03('0x36'))){_0xea7d4b[_0x4d03('0x1c')]=qs[_0x4d03('0x1c')](_0xa86979[_0x4d03('0x2e')][_0x4d03('0x1c')]);_0xea7d4b[_0x4d03('0x1b')]=qs[_0x4d03('0x1b')](_0xa86979[_0x4d03('0x2e')][_0x4d03('0x1b')]);}_0xea7d4b[_0x4d03('0x37')]=qs[_0x4d03('0x38')](_0xa86979[_0x4d03('0x2e')][_0x4d03('0x38')]);_0xea7d4b['where']=qs[_0x4d03('0x30')](_['pick'](_0xa86979[_0x4d03('0x2e')],_0xbb3c8f['filters']),_0x2d6d64);if(_0xa86979[_0x4d03('0x2e')][_0x4d03('0x39')]){_0xea7d4b[_0x4d03('0x3a')]=_[_0x4d03('0x3b')](_0xea7d4b[_0x4d03('0x3a')],{'$or':_[_0x4d03('0x28')](_0x2d6d64,function(_0x3d652b){if(_0x3d652b[_0x4d03('0x2b')]!==_0x4d03('0x3c')){var _0x290b52={};_0x290b52[_0x3d652b['name']]={'$like':'%'+_0xa86979[_0x4d03('0x2e')][_0x4d03('0x39')]+'%'};return _0x290b52;}})});}_0xea7d4b=_['merge']({},_0xea7d4b,_0xa86979[_0x4d03('0x3d')]);var _0x3457ca={'where':_0xea7d4b[_0x4d03('0x3a')]};return db[_0x4d03('0x3e')][_0x4d03('0x1a')](_0x3457ca)[_0x4d03('0x22')](function(_0x4d7b59){_0x598206[_0x4d03('0x1a')]=_0x4d7b59;if(_0xa86979[_0x4d03('0x2e')][_0x4d03('0x3f')]){_0xea7d4b[_0x4d03('0x40')]=[{'all':!![]}];}return db['FaxApplication'][_0x4d03('0x41')](_0xea7d4b);})[_0x4d03('0x22')](function(_0x4dfb6e){_0x598206[_0x4d03('0x42')]=_0x4dfb6e;return _0x598206;})[_0x4d03('0x22')](respondWithFilteredResult(_0x1034c5,_0xea7d4b))[_0x4d03('0x43')](handleError(_0x1034c5,null));};exports[_0x4d03('0x44')]=function(_0x219a21,_0x262ea8){var _0x2c32a0={'raw':!![],'where':{'id':_0x219a21[_0x4d03('0x45')]['id']}},_0xf95ecf={};_0xf95ecf[_0x4d03('0x2d')]=_['keys'](db[_0x4d03('0x3e')][_0x4d03('0x29')]);_0xf95ecf[_0x4d03('0x2e')]=_[_0x4d03('0x2f')](_0x219a21[_0x4d03('0x2e')]);_0xf95ecf[_0x4d03('0x30')]=_[_0x4d03('0x31')](_0xf95ecf[_0x4d03('0x2d')],_0xf95ecf[_0x4d03('0x2e')]);_0x2c32a0[_0x4d03('0x32')]=_[_0x4d03('0x31')](_0xf95ecf[_0x4d03('0x2d')],qs[_0x4d03('0x33')](_0x219a21[_0x4d03('0x2e')]['fields']));_0x2c32a0[_0x4d03('0x32')]=_0x2c32a0[_0x4d03('0x32')][_0x4d03('0x34')]?_0x2c32a0['attributes']:_0xf95ecf[_0x4d03('0x2d')];if(_0x219a21[_0x4d03('0x2e')][_0x4d03('0x3f')]){_0x2c32a0[_0x4d03('0x40')]=[{'all':!![]}];}_0x2c32a0=_[_0x4d03('0x3b')]({},_0x2c32a0,_0x219a21['options']);return db['FaxApplication'][_0x4d03('0x46')](_0x2c32a0)[_0x4d03('0x22')](handleEntityNotFound(_0x262ea8,null))[_0x4d03('0x22')](respondWithResult(_0x262ea8,null))[_0x4d03('0x43')](handleError(_0x262ea8,null));};exports[_0x4d03('0x47')]=function(_0x48ffaa,_0x36ad25){return db['FaxApplication']['create'](_0x48ffaa[_0x4d03('0x48')],{})[_0x4d03('0x22')](respondWithResult(_0x36ad25,0xc9))[_0x4d03('0x43')](handleError(_0x36ad25,null));};exports['update']=function(_0xaa89d6,_0x20058b){if(_0xaa89d6[_0x4d03('0x48')]['id']){delete _0xaa89d6['body']['id'];}return db['FaxApplication']['find']({'where':{'id':_0xaa89d6[_0x4d03('0x45')]['id']}})['then'](handleEntityNotFound(_0x20058b,null))[_0x4d03('0x22')](saveUpdates(_0xaa89d6[_0x4d03('0x48')],null))[_0x4d03('0x22')](respondWithResult(_0x20058b,null))[_0x4d03('0x43')](handleError(_0x20058b,null));};exports[_0x4d03('0x23')]=function(_0x236a68,_0x3977d3){return db[_0x4d03('0x3e')][_0x4d03('0x46')]({'where':{'id':_0x236a68['params']['id']}})[_0x4d03('0x22')](handleEntityNotFound(_0x3977d3,null))[_0x4d03('0x22')](removeEntity(_0x3977d3,null))[_0x4d03('0x43')](handleError(_0x3977d3,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index e11ce37..fe1d10c 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 _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 +var _0x02bb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x277821,_0x441826){var _0x54025f=function(_0x15e01a){while(--_0x15e01a){_0x277821['push'](_0x277821['shift']());}};_0x54025f(++_0x441826);}(_0x02bb,0x80));var _0xb02b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x02bb[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xb02b('0x0'));var util=require(_0xb02b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb02b('0x2'));var BPromise=require(_0xb02b('0x3'));var rp=require(_0xb02b('0x4'));var fs=require('fs');var path=require(_0xb02b('0x5'));var rimraf=require(_0xb02b('0x6'));var config=require(_0xb02b('0x7'));var attributes=require(_0xb02b('0x8'));module['exports']=function(_0x12e699,_0x380d56){return _0x12e699[_0xb02b('0x9')]('FaxApplication',attributes,{'tableName':_0xb02b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb02b('0xb'),'collate':_0xb02b('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 4941847..f9b1dd3 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 _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 +var _0x6355=['debug','stringify','error','code','message','request\x20sent','result','UpdateFaxApplication','update','body','options','raw','where','attributes','limit','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s'];(function(_0x1d1916,_0x7db2df){var _0x1082cb=function(_0x1a6475){while(--_0x1a6475){_0x1d1916['push'](_0x1d1916['shift']());}};_0x1082cb(++_0x7db2df);}(_0x6355,0x6a));var _0x5635=function(_0x2743d1,_0x4b2dfa){_0x2743d1=_0x2743d1-0x0;var _0x5e26fb=_0x6355[_0x2743d1];return _0x5e26fb;};'use strict';var _=require(_0x5635('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5635('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5635('0x2'));var db=require(_0x5635('0x3'))['db'];var utils=require(_0x5635('0x4'));var logger=require(_0x5635('0x5'))('rpc');var config=require(_0x5635('0x6'));var jayson=require(_0x5635('0x7'));var client=jayson[_0x5635('0x8')][_0x5635('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fff87,_0x28e35c,_0x1fc016){return new BPromise(function(_0x3856c8,_0x12e1ea){return client[_0x5635('0xa')](_0x3fff87,_0x1fc016)[_0x5635('0xb')](function(_0x52b754){logger[_0x5635('0xc')](_0x5635('0xd'),_0x28e35c,'request\x20sent');logger[_0x5635('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x28e35c,'request\x20sent',JSON[_0x5635('0xf')](_0x52b754));if(_0x52b754[_0x5635('0x10')]){if(_0x52b754[_0x5635('0x10')][_0x5635('0x11')]===0x1f4){logger[_0x5635('0x10')](_0x5635('0xd'),_0x28e35c,_0x52b754[_0x5635('0x10')][_0x5635('0x12')]);return _0x12e1ea(_0x52b754['error'][_0x5635('0x12')]);}logger['error'](_0x5635('0xd'),_0x28e35c,_0x52b754[_0x5635('0x10')][_0x5635('0x12')]);return _0x3856c8(_0x52b754[_0x5635('0x10')][_0x5635('0x12')]);}else{logger[_0x5635('0xc')](_0x5635('0xd'),_0x28e35c,_0x5635('0x13'));_0x3856c8(_0x52b754[_0x5635('0x14')]['message']);}})['catch'](function(_0x4b371d){logger['error'](_0x5635('0xd'),_0x28e35c,_0x4b371d);_0x12e1ea(_0x4b371d);});});}exports[_0x5635('0x15')]=function(_0x422205){var _0x5d460b=this;return new Promise(function(_0x33da12,_0x2907b6){return db['FaxApplication'][_0x5635('0x16')](_0x422205[_0x5635('0x17')],{'raw':_0x422205[_0x5635('0x18')]?_0x422205[_0x5635('0x18')][_0x5635('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x422205[_0x5635('0x18')]?_0x422205['options'][_0x5635('0x1a')]||null:null,'attributes':_0x422205[_0x5635('0x18')]?_0x422205['options'][_0x5635('0x1b')]||null:null,'limit':_0x422205[_0x5635('0x18')]?_0x422205[_0x5635('0x18')][_0x5635('0x1c')]||null:null})[_0x5635('0xb')](function(_0x8a8d3e){logger[_0x5635('0xc')](_0x5635('0x15'),_0x422205);logger['debug'](_0x5635('0x15'),_0x422205,JSON[_0x5635('0xf')](_0x8a8d3e));_0x33da12(_0x8a8d3e);})[_0x5635('0x1d')](function(_0xcb9e33){logger[_0x5635('0x10')](_0x5635('0x15'),_0xcb9e33['message'],_0x422205);_0x2907b6(_0x5d460b[_0x5635('0x10')](0x1f4,_0xcb9e33['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 3478986..02a5ceb 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 _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 +var _0x6f47=['put','delete','exports','util','path','express','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','post','create'];(function(_0x2c15c2,_0x347f92){var _0x419788=function(_0x54ae44){while(--_0x54ae44){_0x2c15c2['push'](_0x2c15c2['shift']());}};_0x419788(++_0x347f92);}(_0x6f47,0xc7));var _0x76f4=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x6f47[_0x186376];return _0x2dbdd9;};'use strict';var multer=require('multer');var util=require(_0x76f4('0x0'));var path=require(_0x76f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x76f4('0x2'));var router=express['Router']();var auth=require(_0x76f4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x76f4('0x4'));var controller=require(_0x76f4('0x5'));router[_0x76f4('0x6')]('/',auth[_0x76f4('0x7')](),controller['index']);router[_0x76f4('0x6')](_0x76f4('0x8'),auth[_0x76f4('0x7')](),controller['show']);router[_0x76f4('0x9')]('/',auth[_0x76f4('0x7')](),controller[_0x76f4('0xa')]);router[_0x76f4('0xb')](_0x76f4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x76f4('0xc')](_0x76f4('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x76f4('0xd')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index dd19730..2d24e62 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 _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 +var _0x1dcc=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x545ded,_0x2a556a){var _0x483a5c=function(_0x59d39e){while(--_0x59d39e){_0x545ded['push'](_0x545ded['shift']());}};_0x483a5c(++_0x2a556a);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x5c7b29,_0x3674db){_0x5c7b29=_0x5c7b29-0x0;var _0x27f1c6=_0x1dcc[_0x5c7b29];return _0x27f1c6;};'use strict';var Sequelize=require(_0xc1dc('0x0'));module[_0xc1dc('0x1')]={'closed':{'type':Sequelize[_0xc1dc('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc1dc('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc1dc('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc1dc('0x4')]},'read1stAt':{'type':Sequelize[_0xc1dc('0x3')]},'fax':{'type':Sequelize[_0xc1dc('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc1dc('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc1dc('0x5')]('in',_0xc1dc('0x6')),'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 324fd35..b9f96f0 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 _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 +var _0x9f7b=['user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','expr','search','parseSearch','sqlOperator','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','ContactId','buildExpression','text','start','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\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?','i.fax\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','isEmpty','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','options','create','body','destroy','describe','addMessage','FaxMessage','ids','omit','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','color','emit','faxInteractionTags:save','removeTags','download','unix','server','files','root','attachments','join','transcript-%d-%s.zip','push','Attachment','Messages','get','existsSync','createReadStream','pipe','createWriteStream','basename','log','err','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','sox','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./faxInteraction.socket','end','json','count','offset','limit','status','set','Content-Range','apply','reject','update','then','stack','name','send','Users','map','fullname','Tags','split','forEach','catch','index','FaxInteraction','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','select','field','tools_tags','u.id'];(function(_0x264c79,_0xa663df){var _0x5cc41d=function(_0x36cef1){while(--_0x36cef1){_0x264c79['push'](_0x264c79['shift']());}};_0x5cc41d(++_0xa663df);}(_0x9f7b,0x15c));var _0xb9f7=function(_0x5586fc,_0x303e2a){_0x5586fc=_0x5586fc-0x0;var _0x57ae1f=_0x9f7b[_0x5586fc];return _0x57ae1f;};'use strict';var pdf=require(_0xb9f7('0x0'));var emlformat=require(_0xb9f7('0x1'));var rimraf=require(_0xb9f7('0x2'));var zipdir=require(_0xb9f7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb9f7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb9f7('0x5'));var util=require(_0xb9f7('0x6'));var path=require('path');var sox=require(_0xb9f7('0x7'));var csv=require('to-csv');var ejs=require(_0xb9f7('0x8'));var fs=require('fs');var _=require(_0xb9f7('0x9'));var squel=require('squel');var crypto=require(_0xb9f7('0xa'));var jsforce=require(_0xb9f7('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb9f7('0xc'));var Papa=require(_0xb9f7('0xd'));var Redis=require(_0xb9f7('0xe'));var authService=require(_0xb9f7('0xf'));var qs=require(_0xb9f7('0x10'));var as=require(_0xb9f7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9f7('0x12'))(_0xb9f7('0x13'));var utils=require(_0xb9f7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb9f7('0x15'));var db=require('../../mysqldb')['db'];config[_0xb9f7('0x16')]=_['defaults'](config['redis'],{'host':_0xb9f7('0x17'),'port':0x18eb});var socket=require(_0xb9f7('0x18'))(new Redis(config[_0xb9f7('0x16')]));require(_0xb9f7('0x19'))['register'](socket);function respondWithStatusCode(_0x2094d5,_0x169141){_0x169141=_0x169141||0xcc;return function(_0x50a157){if(_0x50a157){return _0x2094d5['sendStatus'](_0x169141);}return _0x2094d5['status'](_0x169141)[_0xb9f7('0x1a')]();};}function respondWithResult(_0x2f91ec,_0x718517){_0x718517=_0x718517||0xc8;return function(_0x2d8ae5){if(_0x2d8ae5){return _0x2f91ec['status'](_0x718517)[_0xb9f7('0x1b')](_0x2d8ae5);}};}function respondWithFilteredResult(_0x1dfbb3,_0x119d83){return function(_0x303631){if(_0x303631){var _0x5eb039=_0x303631[_0xb9f7('0x1c')],_0x2188e0=_0x119d83[_0xb9f7('0x1d')],_0x44a04a=_0x119d83['offset']+_0x119d83[_0xb9f7('0x1e')],_0x3a9f19;if(_0x44a04a>=_0x5eb039){_0x44a04a=_0x5eb039;_0x3a9f19=0xc8;}else{_0x3a9f19=0xce;}_0x1dfbb3[_0xb9f7('0x1f')](_0x3a9f19);return _0x1dfbb3[_0xb9f7('0x20')](_0xb9f7('0x21'),_0x2188e0+'-'+_0x44a04a+'/'+_0x5eb039)[_0xb9f7('0x1b')](_0x303631);}return null;};}function patchUpdates(_0x5a2d58){return function(_0x5b2ca0){try{jsonpatch[_0xb9f7('0x22')](_0x5b2ca0,_0x5a2d58,!![]);}catch(_0x54d810){return BPromise[_0xb9f7('0x23')](_0x54d810);}return _0x5b2ca0['save']();};}function saveUpdates(_0x373cb8,_0x3a777b){return function(_0x383807){if(_0x383807){return _0x383807[_0xb9f7('0x24')](_0x373cb8)[_0xb9f7('0x25')](function(_0x4e98fd){return _0x4e98fd;});}return null;};}function removeEntity(_0x21e38b,_0x261375){return function(_0x8bc4e6){if(_0x8bc4e6){return _0x8bc4e6['destroy']()[_0xb9f7('0x25')](function(){_0x21e38b[_0xb9f7('0x1f')](0xcc)[_0xb9f7('0x1a')]();});}};}function handleEntityNotFound(_0x2a8faf,_0xa13798){return function(_0x1a8970){if(!_0x1a8970){_0x2a8faf['sendStatus'](0x194);}return _0x1a8970;};}function handleError(_0x39c802,_0x413d67){_0x413d67=_0x413d67||0x1f4;return function(_0xf5cef3){logger['error'](_0xf5cef3[_0xb9f7('0x26')]);if(_0xf5cef3[_0xb9f7('0x27')]){delete _0xf5cef3['name'];}_0x39c802[_0xb9f7('0x1f')](_0x413d67)[_0xb9f7('0x28')](_0xf5cef3);};}function getInteractionUsers(_0x2dfc64,_0x3d0465){return new BPromise(function(_0x482d3d,_0x3cc750){try{if(_0x3d0465[_0x2dfc64['id']]){_0x2dfc64[_0xb9f7('0x29')]=_[_0xb9f7('0x2a')](_0x3d0465[_0x2dfc64['id']],function(_0x2e8ce9){return{'id':_0x2e8ce9['id'],'fullname':_0x2e8ce9[_0xb9f7('0x2b')]};});}}catch(_0x13eaff){_0x3cc750(_0x13eaff);}_0x482d3d(_0x2dfc64);});}function getInteractionTags(_0x526e79,_0x3a9a16){return new BPromise(function(_0x51b573,_0xb30d41){try{if(_0x526e79['TagIds']){_0x526e79[_0xb9f7('0x2c')]=[];_0x526e79['TagIds'][_0xb9f7('0x2d')](',')[_0xb9f7('0x2e')](function(_0x4d2eb5){_0x526e79[_0xb9f7('0x2c')]['push'](_0x3a9a16[_0x4d2eb5]);});}delete _0x526e79['TagIds'];}catch(_0x42aecc){_0xb30d41(_0x42aecc);}_0x51b573(_0x526e79);});}function updateFaxInteraction(_0x1d38ef,_0xe99d8c,_0x1dfdf7){return new BPromise(function(_0x4cfba7,_0x5f534a){return getInteractionUsers(_0x1d38ef,_0x1dfdf7)[_0xb9f7('0x25')](function(_0xcaaeea){return getInteractionTags(_0xcaaeea,_0xe99d8c);})['then'](function(_0x50132b){_0x4cfba7(_0x50132b);})[_0xb9f7('0x2f')](function(_0x3e3c02){_0x5f534a(_0x3e3c02);});});}exports[_0xb9f7('0x30')]=function(_0x2b3934,_0x1f68b1){var _0x43ad05={},_0x49d806={},_0x3247cf={'count':0x0,'rows':[]};var _0x30c8e=_[_0xb9f7('0x2a')](db[_0xb9f7('0x31')][_0xb9f7('0x32')],function(_0x4cb3a5){return{'name':_0x4cb3a5[_0xb9f7('0x33')],'type':_0x4cb3a5[_0xb9f7('0x34')][_0xb9f7('0x35')]};});_0x49d806['model']=_[_0xb9f7('0x2a')](_0x30c8e,'name');_0x49d806[_0xb9f7('0x36')]=_[_0xb9f7('0x37')](_0x2b3934[_0xb9f7('0x36')]);_0x49d806[_0xb9f7('0x38')]=_[_0xb9f7('0x39')](_0x49d806[_0xb9f7('0x3a')],_0x49d806[_0xb9f7('0x36')]);_0x43ad05[_0xb9f7('0x3b')]=_[_0xb9f7('0x39')](_0x49d806[_0xb9f7('0x3a')],qs['fields'](_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x3c')]));_0x43ad05[_0xb9f7('0x3b')]=_0x43ad05['attributes']['length']?_0x43ad05['attributes']:_0x49d806[_0xb9f7('0x3a')];if(!_0x2b3934[_0xb9f7('0x36')]['hasOwnProperty'](_0xb9f7('0x3d'))){_0x43ad05[_0xb9f7('0x1e')]=qs[_0xb9f7('0x1e')](_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x1e')]);_0x43ad05[_0xb9f7('0x1d')]=qs['offset'](_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x1d')]);}_0x43ad05[_0xb9f7('0x3e')]=qs[_0xb9f7('0x3f')](_0x2b3934['query']['sort']);_0x43ad05[_0xb9f7('0x40')]=qs[_0xb9f7('0x38')](_[_0xb9f7('0x41')](_0x2b3934['query'],_0x49d806[_0xb9f7('0x38')]),_0x30c8e);var _0x145e31=[];var _0x5ca9cb=squel[_0xb9f7('0x42')]()[_0xb9f7('0x43')]('id')[_0xb9f7('0x43')](_0xb9f7('0x27'))[_0xb9f7('0x43')]('color')['from'](_0xb9f7('0x44'));var _0x2fc41c=squel[_0xb9f7('0x42')]()[_0xb9f7('0x43')](_0xb9f7('0x45'))[_0xb9f7('0x43')]('u.fullname')[_0xb9f7('0x43')]('ui.FaxInteractionId')['from'](_0xb9f7('0x46'),'ui')[_0xb9f7('0x47')](_0xb9f7('0x48'),'u',_0xb9f7('0x49'));var _0x5b9139=squel['select']()['from']('fax_interactions','i')[_0xb9f7('0x47')](_0xb9f7('0x4a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xb9f7('0x47')](_0xb9f7('0x48'),'o',_0xb9f7('0x4b'))[_0xb9f7('0x47')](_0xb9f7('0x4c'),'a','a.id\x20=\x20i.FaxAccountId')[_0xb9f7('0x47')](_0xb9f7('0x4d'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xb9f7('0x47')]('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id')['left_join'](_0xb9f7('0x44'),'t','t.id\x20=\x20it.TagId');var _0xb4b6fd=squel[_0xb9f7('0x4e')]();var _0x5aa510=[];var _0x3e19ab=squel['expr']();var _0x2f2d19;if(_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x4f')]){_0x2f2d19=as[_0xb9f7('0x50')](_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x4f')]);var _0x5f3ab3=_0x2f2d19[_0xb9f7('0x51')];for(var _0x114584=0x0;_0x114584<_0x2f2d19['conditions'][_0xb9f7('0x52')];_0x114584++){var _0x4101c1=_0x2f2d19['conditions'][_0x114584];var _0x5e8f0f='i';var _0x40f2be=_[_0xb9f7('0x53')](_0x30c8e,[_0xb9f7('0x27'),_0x4101c1[_0xb9f7('0x43')]]);if(!_0x40f2be){switch(_0x4101c1[_0xb9f7('0x43')]){case _0xb9f7('0x54'):if(_0x4101c1[_0xb9f7('0x55')]==0x1){_0x5b9139[_0xb9f7('0x56')]('`'+_0x4101c1[_0xb9f7('0x43')]+_0xb9f7('0x57'));}else{_0x5b9139[_0xb9f7('0x56')]('`'+_0x4101c1[_0xb9f7('0x43')]+_0xb9f7('0x58'));}break;case _0xb9f7('0x59'):if(_0x4101c1[_0xb9f7('0x5a')]===_0xb9f7('0x5b')){if(_0x4101c1[_0xb9f7('0x55')][_0xb9f7('0x2d')]('\x20')[_0xb9f7('0x52')]>0x1){_0xb4b6fd[_0x5f3ab3]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb9f7('0x5c')](_0x4101c1[_0xb9f7('0x55')]),null);}else{var _0x54e524='%'+_0x4101c1[_0xb9f7('0x55')]+'%';_0xb4b6fd[_0x5f3ab3]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x54e524,_0x54e524,_0x54e524);}}else{_0x40f2be=_['find'](_0x30c8e,[_0xb9f7('0x27'),_0xb9f7('0x5d')]);_0x4101c1[_0xb9f7('0x43')]='ContactId';_0x26399e=as[_0xb9f7('0x5e')](_0x5e8f0f,_0x40f2be[_0xb9f7('0x34')],_0x4101c1);_0xb4b6fd[_0x5f3ab3](_0x26399e[_0xb9f7('0x5f')],_0x26399e['value'][_0xb9f7('0x60')],_0x26399e[_0xb9f7('0x55')][_0xb9f7('0x1a')]);}break;case'Tag':var _0x3c5303=_0x4101c1['value']['split'](',')[_0xb9f7('0x2a')](function(_0x53ed5d){return Number(_0x53ed5d);});_0x3c5303[_0xb9f7('0x2e')](function(_0x2cae9a){_0x3e19ab['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2cae9a+',%');});_0x5aa510=_[_0xb9f7('0x61')](_0x5aa510,_0x3c5303);break;case _0xb9f7('0x62'):if(_0x4101c1[_0xb9f7('0x5a')]===_0xb9f7('0x5b')){_0xb4b6fd[_0x5f3ab3](_0xb9f7('0x63'),'%'+_0x4101c1[_0xb9f7('0x55')]+'%',null);}else{_0x40f2be=_[_0xb9f7('0x53')](_0x30c8e,[_0xb9f7('0x27'),_0xb9f7('0x64')]);_0x4101c1[_0xb9f7('0x43')]=_0xb9f7('0x64');_0x26399e=as['buildExpression'](_0x5e8f0f,_0x40f2be[_0xb9f7('0x34')],_0x4101c1);_0xb4b6fd[_0x5f3ab3](_0x26399e['text'],_0x26399e[_0xb9f7('0x55')][_0xb9f7('0x60')],_0x26399e['value'][_0xb9f7('0x1a')]);}break;case'body':_0x26399e=as[_0xb9f7('0x5e')]('me',null,_0x4101c1);_0xb4b6fd[_0x5f3ab3](_0x26399e[_0xb9f7('0x5f')],_0x26399e[_0xb9f7('0x55')][_0xb9f7('0x60')],_0x26399e[_0xb9f7('0x55')]['end']);break;}}else{var _0x26399e=as['buildExpression'](_0x5e8f0f,_0x40f2be[_0xb9f7('0x34')],_0x4101c1);_0xb4b6fd[_0x5f3ab3](_0x26399e[_0xb9f7('0x5f')],_0x26399e[_0xb9f7('0x55')][_0xb9f7('0x60')],_0x26399e[_0xb9f7('0x55')][_0xb9f7('0x1a')]);}}}else{var _0x492a9c=_(_0x2b3934['query'])[_0xb9f7('0x37')]()[_0xb9f7('0x2a')](function(_0x2fcd34){return _['some'](_0x30c8e,['name',_0x2fcd34])?_0x2fcd34:undefined;})['compact']()[_0xb9f7('0x55')]();if(!_['isEmpty'](_0x492a9c)){_0x492a9c[_0xb9f7('0x2e')](function(_0x5bc299){if(_0x5bc299==='FaxAccountId'){_0x5b9139[_0xb9f7('0x40')](_0xb9f7('0x65'),[][_0xb9f7('0x66')](_0x2b3934['query'][_0x5bc299]));}else if(_0x5bc299===_0xb9f7('0x67')){var _0x221427=JSON[_0xb9f7('0x68')](_0x2b3934[_0xb9f7('0x36')][_0x5bc299])[_0xb9f7('0x69')];var _0x25b96c=JSON['parse'](_0x2b3934[_0xb9f7('0x36')][_0x5bc299])['$lte'];_0x5b9139[_0xb9f7('0x40')](_0xb9f7('0x6a'),_0x221427,_0x25b96c);}else{if(_0x2b3934['query'][_0x5bc299]==='null'){_0x5b9139[_0xb9f7('0x40')]('i.'+_0x5bc299+_0xb9f7('0x6b'));}else{_0x5b9139[_0xb9f7('0x40')]('i.'+_0x5bc299+_0xb9f7('0x6c'),_0x2b3934[_0xb9f7('0x36')][_0x5bc299]);}}});}if(_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x6d')]){if(_0x2b3934['query'][_0xb9f7('0x6d')]==0x1){_0x5b9139['having'](_0xb9f7('0x6e'));}else{_0x5b9139[_0xb9f7('0x56')](_0xb9f7('0x6f'));}}if(_0x2b3934['query']['tag']){_0x5aa510=_[_0xb9f7('0x70')](_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x71')])?_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x71')]:new Array(_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x71')]);_0x5aa510[_0xb9f7('0x2e')](function(_0x475069){_0x3e19ab['or'](_0xb9f7('0x72'),'%,'+_0x475069+',%');});}if(_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x73')]){var _0x83153f=_0x2b3934[_0xb9f7('0x36')]['filter'][_0xb9f7('0x74')]('\x5c','\x5c\x5c')[_0xb9f7('0x74')](/'/g,'\x27\x27');if(qs[_0xb9f7('0x75')](_0x83153f)){_0xb4b6fd['or'](_0xb9f7('0x76'),_0x83153f+'%')['or'](_0xb9f7('0x77'),_0x83153f+'%');}_0xb4b6fd['or'](_0xb9f7('0x78'),_0x83153f+'%');}}_0x5b9139[_0xb9f7('0x40')](_0xb4b6fd);_0x5b9139[_0xb9f7('0x79')](_0xb9f7('0x7a'));var _0x5e6709={'type':db[_0xb9f7('0x7b')][_0xb9f7('0x7c')][_0xb9f7('0x7d')],'raw':!![]};var _0x1166a1=_0x5b9139[_0xb9f7('0x7e')]();_0x1166a1[_0xb9f7('0x43')](_0xb9f7('0x7a'));_0x1166a1[_0xb9f7('0x43')](_0xb9f7('0x7f'),_0xb9f7('0x54'));if(_0x43ad05[_0xb9f7('0x3e')]){_0x43ad05['order'][_0xb9f7('0x2e')](function(_0x446aec){var _0x28e5f1=_0x446aec[0x0]===_0xb9f7('0x80')?_0x446aec[0x0]:'i.'+_0x446aec[0x0];_0x5b9139['order'](_0x28e5f1,_0x446aec[0x1]===_0xb9f7('0x81')?![]:!![]);});}if(!_[_0xb9f7('0x82')](_0x5aa510)){_0x5b9139[_0xb9f7('0x56')](_0x3e19ab);_0x1166a1['where']('t.id\x20IN\x20?',_0x5aa510);}BPromise[_0xb9f7('0x83')]()[_0xb9f7('0x25')](function(){if(!_0x2f2d19){if(_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x84')])return;_0x1166a1['where'](_0xb9f7('0x85'));_0x5b9139[_0xb9f7('0x40')](_0xb9f7('0x85'));return;}if(_0x2b3934[_0xb9f7('0x86')][_0xb9f7('0x87')]!==_0xb9f7('0x88'))return;return _0x2b3934[_0xb9f7('0x86')][_0xb9f7('0x89')]({'attributes':['id'],'raw':!![]})['then'](function(_0x34a316){if(_[_0xb9f7('0x82')](_0x34a316)){_0x1166a1[_0xb9f7('0x40')]('i.FaxAccountId\x20IS\x20NULL');_0x5b9139[_0xb9f7('0x40')](_0xb9f7('0x8a'));}else{_0x1166a1[_0xb9f7('0x40')]('i.FaxAccountId\x20IN\x20?',_[_0xb9f7('0x2a')](_0x34a316,'id'));_0x5b9139[_0xb9f7('0x40')](_0xb9f7('0x65'),_[_0xb9f7('0x2a')](_0x34a316,'id'));}});})[_0xb9f7('0x25')](function(){if(_0x2b3934[_0xb9f7('0x86')][_0xb9f7('0x87')]===_0xb9f7('0x88')&&!_0x2f2d19&&!_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x84')])return[];return db['sequelize'][_0xb9f7('0x36')](_0x1166a1[_0xb9f7('0x8b')](),_0x5e6709);})[_0xb9f7('0x25')](function(_0x14e46f){_0x3247cf[_0xb9f7('0x1c')]=_0x14e46f[_0xb9f7('0x52')];if(_0x3247cf[_0xb9f7('0x1c')]===0x0)return[];return db[_0xb9f7('0x8c')][_0xb9f7('0x36')](_0x5ca9cb[_0xb9f7('0x8b')](),_0x5e6709)[_0xb9f7('0x25')](function(_0x185196){_0x145e31=_[_0xb9f7('0x8d')](_0x185196,'id');_0x5e6709=_[_0xb9f7('0x8e')](_0x5e6709,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x3c')]){_0x43ad05['attributes'][_0xb9f7('0x2e')](function(_0x590252){_0x5b9139[_0xb9f7('0x43')]('i.'+_0x590252);});}else{_0x5b9139[_0xb9f7('0x43')](_0xb9f7('0x7f'),_0xb9f7('0x54'));_0x5b9139[_0xb9f7('0x43')](_0xb9f7('0x8f'),_0xb9f7('0x90'));_0x5b9139[_0xb9f7('0x43')](_0xb9f7('0x91'),_0xb9f7('0x92'));_0x5b9139[_0xb9f7('0x43')](_0xb9f7('0x93'),_0xb9f7('0x80'));_0x5b9139[_0xb9f7('0x43')](_0xb9f7('0x94'));_0x5b9139[_0xb9f7('0x43')](_0xb9f7('0x95'),_0xb9f7('0x96'));_0x5b9139[_0xb9f7('0x43')]('c.lastName','Contact.lastName');_0x5b9139['field'](_0xb9f7('0x97'),'Contact.email');_0x5b9139['field']('c.phone',_0xb9f7('0x98'));_0x5b9139[_0xb9f7('0x43')](_0xb9f7('0x99'),_0xb9f7('0x9a'));_0x5b9139['field'](_0xb9f7('0x9b'),_0xb9f7('0x9c'));_0x5b9139['field'](_0xb9f7('0x9d'),_0xb9f7('0x9e'));_0x5b9139[_0xb9f7('0x43')](_0xb9f7('0x9f'),_0xb9f7('0xa0'));_0x5b9139['field'](_0xb9f7('0xa1'),'TagIds');}if(_0x43ad05[_0xb9f7('0x1e')])_0x5b9139[_0xb9f7('0x1e')](_0x43ad05[_0xb9f7('0x1e')]);if(_0x43ad05[_0xb9f7('0x1d')])_0x5b9139[_0xb9f7('0x1d')](_0x43ad05[_0xb9f7('0x1d')]);return db[_0xb9f7('0x8c')][_0xb9f7('0x36')](_0x5b9139[_0xb9f7('0x8b')](),_0x5e6709);})[_0xb9f7('0x25')](function(_0x3023d3){_0x2fc41c[_0xb9f7('0x40')](_0xb9f7('0xa2'),_[_0xb9f7('0x2a')](_0x3023d3,'id'));return db['sequelize'][_0xb9f7('0x36')](_0x2fc41c['toString'](),_0x5e6709)[_0xb9f7('0x25')](function(_0xe1f4d9){var _0x1deaef=_[_0xb9f7('0xa3')](_0xe1f4d9,'FaxInteractionId');var _0x25cc8a=[];_0x3023d3['forEach'](function(_0x1a744c){_0x25cc8a['push'](updateFaxInteraction(_0x1a744c,_0x145e31,_0x1deaef));});return BPromise[_0xb9f7('0xa4')](_0x25cc8a);});});})[_0xb9f7('0x25')](function(_0x151a11){_0x3247cf[_0xb9f7('0xa5')]=_0x151a11;return _0x3247cf;})[_0xb9f7('0x25')](respondWithFilteredResult(_0x1f68b1,_0x43ad05))[_0xb9f7('0x2f')](handleError(_0x1f68b1,null));};exports[_0xb9f7('0xa6')]=function(_0x54c228,_0x1a82ef){var _0x57c7a8={'raw':![],'where':{'id':_0x54c228[_0xb9f7('0xa7')]['id']}},_0x5a9d63={};_0x5a9d63[_0xb9f7('0x3a')]=_[_0xb9f7('0x37')](db['FaxInteraction'][_0xb9f7('0x32')]);_0x5a9d63['query']=_[_0xb9f7('0x37')](_0x54c228[_0xb9f7('0x36')]);_0x5a9d63[_0xb9f7('0x38')]=_['intersection'](_0x5a9d63[_0xb9f7('0x3a')],_0x5a9d63['query']);_0x57c7a8[_0xb9f7('0x3b')]=_[_0xb9f7('0x39')](_0x5a9d63[_0xb9f7('0x3a')],qs[_0xb9f7('0x3c')](_0x54c228[_0xb9f7('0x36')]['fields']));_0x57c7a8[_0xb9f7('0x3b')]=_0x57c7a8[_0xb9f7('0x3b')][_0xb9f7('0x52')]?_0x57c7a8[_0xb9f7('0x3b')]:_0x5a9d63[_0xb9f7('0x3a')];if(_0x54c228['query'][_0xb9f7('0xa8')]){_0x57c7a8['include']=[{'all':!![]}];}_0x57c7a8=_[_0xb9f7('0x8e')]({},_0x57c7a8,_0x54c228[_0xb9f7('0xa9')]);return db[_0xb9f7('0x31')][_0xb9f7('0x53')](_0x57c7a8)['then'](handleEntityNotFound(_0x1a82ef,null))[_0xb9f7('0x25')](respondWithResult(_0x1a82ef,null))[_0xb9f7('0x2f')](handleError(_0x1a82ef,null));};exports['create']=function(_0x163408,_0x51fd6b){return db[_0xb9f7('0x31')][_0xb9f7('0xaa')](_0x163408[_0xb9f7('0xab')],{})['then'](respondWithResult(_0x51fd6b,0xc9))[_0xb9f7('0x2f')](handleError(_0x51fd6b,null));};exports[_0xb9f7('0x24')]=function(_0x2504fc,_0x10c990){if(_0x2504fc[_0xb9f7('0xab')]['id']){delete _0x2504fc[_0xb9f7('0xab')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x2504fc['params']['id']}})[_0xb9f7('0x25')](handleEntityNotFound(_0x10c990,null))['then'](saveUpdates(_0x2504fc[_0xb9f7('0xab')],null))[_0xb9f7('0x25')](respondWithResult(_0x10c990,null))[_0xb9f7('0x2f')](handleError(_0x10c990,null));};exports[_0xb9f7('0xac')]=function(_0x5accbb,_0x16d560){return db[_0xb9f7('0x31')][_0xb9f7('0x53')]({'where':{'id':_0x5accbb['params']['id']}})[_0xb9f7('0x25')](handleEntityNotFound(_0x16d560,null))[_0xb9f7('0x25')](removeEntity(_0x16d560,null))[_0xb9f7('0x2f')](handleError(_0x16d560,null));};exports[_0xb9f7('0xad')]=function(_0x4be15c,_0x37135c){return db[_0xb9f7('0x31')][_0xb9f7('0xad')]()[_0xb9f7('0x25')](respondWithResult(_0x37135c,null))[_0xb9f7('0x2f')](handleError(_0x37135c,null));};exports[_0xb9f7('0xae')]=function(_0x5dbca7,_0x58bd82,_0x493c0b){return db[_0xb9f7('0xaf')][_0xb9f7('0x53')]({'where':{'id':_0x5dbca7[_0xb9f7('0xa7')]['id']}})[_0xb9f7('0x25')](handleEntityNotFound(_0x58bd82,null))['then'](function(_0x53fc9b){if(_0x53fc9b){return _0x53fc9b[_0xb9f7('0xae')](_0x5dbca7[_0xb9f7('0xab')][_0xb9f7('0xb0')],_[_0xb9f7('0xb1')](_0x5dbca7[_0xb9f7('0xab')],[_0xb9f7('0xb0'),'id'])||{});}})[_0xb9f7('0x25')](respondWithResult(_0x58bd82,null))[_0xb9f7('0x2f')](handleError(_0x58bd82,null));};exports['getMessages']=function(_0x2d6fa8,_0x7a3c75,_0xf61f02){var _0x29fdb3={'raw':![],'where':{}};var _0x1f9932={};var _0xfa2e88={'count':0x0,'rows':[]};return db[_0xb9f7('0x31')]['findOne']({'where':{'id':_0x2d6fa8[_0xb9f7('0xa7')]['id']}})['then'](handleEntityNotFound(_0x7a3c75,null))[_0xb9f7('0x25')](function(_0x37249d){if(_0x37249d){_0x1f9932[_0xb9f7('0x3a')]=_[_0xb9f7('0x37')](db[_0xb9f7('0xaf')]['rawAttributes']);_0x1f9932[_0xb9f7('0x36')]=_[_0xb9f7('0x37')](_0x2d6fa8['query']);_0x1f9932[_0xb9f7('0x38')]=_[_0xb9f7('0x39')](_0x1f9932['model'],_0x1f9932[_0xb9f7('0x36')]);_0x29fdb3[_0xb9f7('0x3b')]=_[_0xb9f7('0x39')](_0x1f9932[_0xb9f7('0x3a')],qs[_0xb9f7('0x3c')](_0x2d6fa8[_0xb9f7('0x36')][_0xb9f7('0x3c')]));_0x29fdb3[_0xb9f7('0x3b')]=_0x29fdb3[_0xb9f7('0x3b')]['length']?_0x29fdb3[_0xb9f7('0x3b')]:_0x1f9932[_0xb9f7('0x3a')];if(!_0x2d6fa8['query'][_0xb9f7('0xb2')](_0xb9f7('0x3d'))){_0x29fdb3[_0xb9f7('0x1e')]=qs[_0xb9f7('0x1e')](_0x2d6fa8['query'][_0xb9f7('0x1e')]);_0x29fdb3['offset']=qs[_0xb9f7('0x1d')](_0x2d6fa8[_0xb9f7('0x36')][_0xb9f7('0x1d')]);}_0x29fdb3[_0xb9f7('0x3e')]=qs['sort'](_0x2d6fa8[_0xb9f7('0x36')]['sort']);_0x29fdb3[_0xb9f7('0x40')]=qs[_0xb9f7('0x38')](_[_0xb9f7('0x41')](_0x2d6fa8[_0xb9f7('0x36')],_0x1f9932[_0xb9f7('0x38')]));_0x29fdb3['where']['FaxInteractionId']=_0x37249d['id'];if(_0x2d6fa8[_0xb9f7('0x36')]['filter']){_0x29fdb3['where']=_['merge'](_0x29fdb3[_0xb9f7('0x40')],{'$or':_[_0xb9f7('0x2a')](_0x29fdb3[_0xb9f7('0x3b')],function(_0x3435c1){var _0x29e3ca={};_0x29e3ca[_0x3435c1]={'$like':'%'+_0x2d6fa8[_0xb9f7('0x36')]['filter']+'%'};return _0x29e3ca;})});}if(_0x2d6fa8['query'][_0xb9f7('0x69')]){var _0x424b41=_0x2d6fa8[_0xb9f7('0x36')]['$gte'][_0xb9f7('0x2d')](',');var _0x5444d5={};_0x5444d5[_0x424b41[0x0]]={'$gte':moment(_0x424b41[0x1])[_0xb9f7('0xb3')](_0xb9f7('0xb4'))};_0x29fdb3[_0xb9f7('0x40')]=_[_0xb9f7('0x8e')](_0x29fdb3[_0xb9f7('0x40')],_0x5444d5);}_0x29fdb3=_['merge']({},_0x29fdb3,_0x2d6fa8[_0xb9f7('0xa9')]);return db[_0xb9f7('0xaf')][_0xb9f7('0x1c')]({'where':_0x29fdb3[_0xb9f7('0x40')]})['then'](function(_0x2c4dac){_0xfa2e88[_0xb9f7('0x1c')]=_0x2c4dac;if(_0x2d6fa8['query']['includeAll']){_0x29fdb3[_0xb9f7('0xb5')]=[{'all':!![]}];}return db[_0xb9f7('0xaf')][_0xb9f7('0xb6')](_0x29fdb3);})[_0xb9f7('0x25')](function(_0x52e57e){_0xfa2e88['rows']=_0x52e57e;return _0xfa2e88;});}})[_0xb9f7('0x25')](respondWithFilteredResult(_0x7a3c75,_0x29fdb3))[_0xb9f7('0x2f')](handleError(_0x7a3c75,null));};exports[_0xb9f7('0xb7')]=function(_0x47e557,_0x3aa030,_0x2f5eb9){return db[_0xb9f7('0x31')][_0xb9f7('0x53')]({'where':{'id':_0x47e557['params']['id']}})[_0xb9f7('0x25')](handleEntityNotFound(_0x3aa030,null))[_0xb9f7('0x25')](function(_0x764317){if(_0x764317){return _0x764317[_0xb9f7('0xb8')](_0x47e557[_0xb9f7('0xab')]['ids'],_[_0xb9f7('0xb1')](_0x47e557[_0xb9f7('0xab')],[_0xb9f7('0xb0'),'id'])||{})[_0xb9f7('0xb9')](function(){return db['Tag'][_0xb9f7('0xb6')]({'attributes':['id',_0xb9f7('0x27'),_0xb9f7('0xba')],'where':{'id':_0x47e557['body'][_0xb9f7('0xb0')]}});})['then'](function(_0x43dfaa){socket[_0xb9f7('0xbb')](_0xb9f7('0xbc'),{'id':Number(_0x47e557[_0xb9f7('0xa7')]['id']),'tags':_0x43dfaa||[]});return{'id':Number(_0x47e557[_0xb9f7('0xa7')]['id']),'tags':_0x43dfaa||[]};});}})[_0xb9f7('0x25')](respondWithResult(_0x3aa030,null))['catch'](handleError(_0x3aa030,null));};exports[_0xb9f7('0xbd')]=function(_0x397d36,_0x4dda7a,_0x28d13a){return db[_0xb9f7('0x31')][_0xb9f7('0x53')]({'where':{'id':_0x397d36['params']['id']}})[_0xb9f7('0x25')](handleEntityNotFound(_0x4dda7a,null))[_0xb9f7('0x25')](function(_0x231d8e){if(_0x231d8e){return _0x231d8e['removeTags'](_0x397d36[_0xb9f7('0x36')][_0xb9f7('0xb0')]);}})[_0xb9f7('0x25')](respondWithStatusCode(_0x4dda7a,null))[_0xb9f7('0x2f')](handleError(_0x4dda7a,null));};exports[_0xb9f7('0xbe')]=function(_0x3b29cf,_0x2e7931){var _0x5c8bb1=moment()[_0xb9f7('0xbf')]()['toString']();var _0x31556a=path['join'](config['root'],_0xb9f7('0xc0'),_0xb9f7('0xc1'),'tmp');var _0xf7a61b=path['join'](config[_0xb9f7('0xc2')],_0xb9f7('0xc0'),_0xb9f7('0xc1'),_0xb9f7('0xc3'));var _0x1c4a04=path[_0xb9f7('0xc4')](_0x31556a,_0x5c8bb1);var _0x35573c=util[_0xb9f7('0xb3')](_0xb9f7('0xc5'),_0x3b29cf[_0xb9f7('0xa7')]['id'],_0x5c8bb1);var _0x4346fb=path[_0xb9f7('0xc4')](_0x31556a,_0x35573c);var _0x13af44=[];_0x13af44[_0xb9f7('0xc6')]({'model':db[_0xb9f7('0xc7')],'as':_0xb9f7('0xc7'),'raw':!![]});var _0x5a3665=[{'model':db[_0xb9f7('0xaf')],'as':_0xb9f7('0xc8'),'attributes':['id',_0xb9f7('0xab'),'createdAt'],'include':_0x13af44}];return db[_0xb9f7('0x31')][_0xb9f7('0x53')]({'where':{'id':_0x3b29cf[_0xb9f7('0xa7')]['id']},'include':_0x5a3665})[_0xb9f7('0x25')](handleEntityNotFound(_0x2e7931,null))[_0xb9f7('0x25')](function(_0x433028){if(_0x433028&&_0x433028[_0xb9f7('0xc8')]){var _0x349647=_0x433028[_0xb9f7('0xc9')]({'plain':!![]});fs['mkdirSync'](_0x1c4a04);for(var _0x29d143=0x0;_0x29d143<_0x349647[_0xb9f7('0xc8')][_0xb9f7('0x52')];_0x29d143++){var _0x2b306c=_0x349647['Messages'][_0x29d143]['Attachment'];if(_0x2b306c){var _0x24ecac=path[_0xb9f7('0xc4')](_0xf7a61b,_0x2b306c['basename']);if(fs[_0xb9f7('0xca')](_0x24ecac)){fs[_0xb9f7('0xcb')](_0x24ecac)[_0xb9f7('0xcc')](fs[_0xb9f7('0xcd')](path[_0xb9f7('0xc4')](_0x1c4a04,_0x2b306c[_0xb9f7('0xce')])));}}}return BPromise[_0xb9f7('0x83')]()[_0xb9f7('0x25')](function(){return new BPromise(function(_0x5612a3,_0x1aa16f){zipdir(_0x1c4a04,{'saveTo':_0x4346fb},function(_0x94d16b,_0x53bd21){if(_0x94d16b)return _0x1aa16f(_0x94d16b);return _0x5612a3(_0x53bd21);});})[_0xb9f7('0x25')](function(){return new BPromise(function(_0xbead3c,_0x58d3d7){rimraf(_0x1c4a04,function(_0x36fbc3){if(_0x36fbc3)_0x58d3d7(_0x36fbc3);return _0xbead3c();});});})[_0xb9f7('0x25')](function(){return _0x2e7931[_0xb9f7('0xbe')](_0x4346fb,_0x35573c,function(_0x41f6d7){if(_0x41f6d7){console[_0xb9f7('0xcf')](_0xb9f7('0xd0'),_0x41f6d7);}else{fs['unlinkSync'](_0x4346fb);}});});});}else{return _0x2e7931['sendStatus'](0xc8);}})['catch'](handleError(_0x2e7931,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 7a459c9..42aa6b5 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(_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 +var _0x7a54=['setDataValue','map','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers'];(function(_0xb40c20,_0x17eb24){var _0x386683=function(_0x47a3f6){while(--_0x47a3f6){_0xb40c20['push'](_0xb40c20['shift']());}};_0x386683(++_0x17eb24);}(_0x7a54,0x106));var _0x47a5=function(_0x22f64a,_0xcce96b){_0x22f64a=_0x22f64a-0x0;var _0x4ceb3a=_0x7a54[_0x22f64a];return _0x4ceb3a;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var FaxInteraction=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x47a5('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x47a5('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x47a5('0x5'),'afterDestroy':_0x47a5('0x6')};function emitEvent(_0x2a1a7e){return function(_0x3717e1,_0xfdf934,_0x545a97){_0x3717e1[_0x47a5('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x343372){_0x3717e1[_0x47a5('0x8')]('Users',_0x343372[_0x47a5('0x9')](function(_0x5077f3){return{'id':_0x5077f3['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x3717e1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2a0e98){_0x3717e1[_0x47a5('0x8')]('unreadMessages',_0x2a0e98[_0x47a5('0xa')]);FaxInteractionEvents['emit'](_0x2a1a7e+':'+_0x3717e1['id'],_0x3717e1);FaxInteractionEvents['emit'](_0x2a1a7e,_0x3717e1);_0x545a97(null);})[_0x47a5('0xb')](_0x545a97(null));};}for(var e in events){if(events[_0x47a5('0xc')](e)){var event=events[e];FaxInteraction[_0x47a5('0xd')](e,emitEvent(event));}}module[_0x47a5('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 51670a1..0b1ffa2 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 _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 +var _0x2af3=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','FaxInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2af3,0x121));var _0x32af=function(_0x3b9703,_0x4ec964){_0x3b9703=_0x3b9703-0x0;var _0x1bb1cb=_0x2af3[_0x3b9703];return _0x1bb1cb;};'use strict';var _=require(_0x32af('0x0'));var util=require(_0x32af('0x1'));var logger=require(_0x32af('0x2'))(_0x32af('0x3'));var moment=require(_0x32af('0x4'));var BPromise=require(_0x32af('0x5'));var rp=require(_0x32af('0x6'));var fs=require('fs');var path=require(_0x32af('0x7'));var rimraf=require(_0x32af('0x8'));var config=require(_0x32af('0x9'));var attributes=require(_0x32af('0xa'));module['exports']=function(_0x5bad5d,_0x38fcd4){return _0x5bad5d['define'](_0x32af('0xb'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x461bf0,_0x444c01,_0x3a3b8a){if(_0x461bf0[_0x32af('0xc')](_0x32af('0xd'))){_0x461bf0[_0x32af('0xe')]=moment()[_0x32af('0xf')](_0x32af('0x10'));}_0x3a3b8a(null,_0x461bf0);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index fee9f77..3d8783f 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 _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 +var _0x604c=['FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','options','raw','where','attributes','AddTagsToFaxInteraction','find','ids','omit','body','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info'];(function(_0x1b9115,_0x362439){var _0x5ac926=function(_0x24fd00){while(--_0x24fd00){_0x1b9115['push'](_0x1b9115['shift']());}};_0x5ac926(++_0x362439);}(_0x604c,0x13c));var _0xc604=function(_0x466b26,_0x1f2a06){_0x466b26=_0x466b26-0x0;var _0x572cda=_0x604c[_0x466b26];return _0x572cda;};'use strict';var _=require(_0xc604('0x0'));var util=require(_0xc604('0x1'));var moment=require(_0xc604('0x2'));var BPromise=require(_0xc604('0x3'));var rs=require(_0xc604('0x4'));var fs=require('fs');var Redis=require(_0xc604('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc604('0x6'));var logger=require(_0xc604('0x7'))(_0xc604('0x8'));var config=require(_0xc604('0x9'));var jayson=require(_0xc604('0xa'));var client=jayson[_0xc604('0xb')][_0xc604('0xc')]({'port':0x232a});config[_0xc604('0xd')]=_[_0xc604('0xe')](config[_0xc604('0xd')],{'host':_0xc604('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc604('0xd')]));require('./faxInteraction.socket')[_0xc604('0x10')](socket);function respondWithRpcPromise(_0x1c50dc,_0x4c2194,_0x4a242b){return new BPromise(function(_0x51ec4a,_0x14adf4){return client[_0xc604('0x11')](_0x1c50dc,_0x4a242b)[_0xc604('0x12')](function(_0x463224){logger[_0xc604('0x13')](_0xc604('0x14'),_0x4c2194,_0xc604('0x15'));logger[_0xc604('0x16')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x4c2194,_0xc604('0x15'),JSON[_0xc604('0x17')](_0x463224));if(_0x463224[_0xc604('0x18')]){if(_0x463224[_0xc604('0x18')][_0xc604('0x19')]===0x1f4){logger[_0xc604('0x18')](_0xc604('0x14'),_0x4c2194,_0x463224[_0xc604('0x18')][_0xc604('0x1a')]);return _0x14adf4(_0x463224[_0xc604('0x18')][_0xc604('0x1a')]);}logger[_0xc604('0x18')](_0xc604('0x14'),_0x4c2194,_0x463224[_0xc604('0x18')]['message']);return _0x51ec4a(_0x463224['error'][_0xc604('0x1a')]);}else{logger[_0xc604('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x4c2194,'request\x20sent');_0x51ec4a(_0x463224[_0xc604('0x1b')]['message']);}})[_0xc604('0x1c')](function(_0x5b7277){logger[_0xc604('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x4c2194,_0x5b7277);_0x14adf4(_0x5b7277);});});}exports[_0xc604('0x1d')]=function(_0xce9f23){var _0x2e722c=this;return new Promise(function(_0x3dbbc2,_0x10fed6){return db[_0xc604('0x1e')]['update'](_0xce9f23['body'],{'raw':_0xce9f23[_0xc604('0x1f')]?_0xce9f23[_0xc604('0x1f')][_0xc604('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xce9f23[_0xc604('0x1f')]?_0xce9f23[_0xc604('0x1f')][_0xc604('0x21')]||null:null,'attributes':_0xce9f23[_0xc604('0x1f')]?_0xce9f23[_0xc604('0x1f')][_0xc604('0x22')]||null:null,'limit':_0xce9f23[_0xc604('0x1f')]?_0xce9f23[_0xc604('0x1f')]['limit']||null:null})[_0xc604('0x12')](function(_0x338679){logger[_0xc604('0x13')](_0xc604('0x1d'),_0xce9f23);logger['debug'](_0xc604('0x1d'),_0xce9f23,JSON[_0xc604('0x17')](_0x338679));_0x3dbbc2(_0x338679);})[_0xc604('0x1c')](function(_0x42a20e){logger[_0xc604('0x18')](_0xc604('0x1d'),_0x42a20e[_0xc604('0x1a')],_0xce9f23);_0x10fed6(_0x2e722c['error'](0x1f4,_0x42a20e[_0xc604('0x1a')]));});});};exports[_0xc604('0x23')]=function(_0x30b245){return new Promise(function(_0x2098cd,_0x2ad06d){return db[_0xc604('0x1e')][_0xc604('0x24')]({'where':_0x30b245[_0xc604('0x1f')]?_0x30b245['options'][_0xc604('0x21')]||null:null})['then'](function(_0x210fab){if(_0x210fab){return _0x210fab['addTags'](_0x30b245['body'][_0xc604('0x25')],_[_0xc604('0x26')](_0x30b245[_0xc604('0x27')],['ids','id'])||{});}})[_0xc604('0x28')](function(_0x35d1b5){logger[_0xc604('0x13')]('AddTags',_0x30b245);logger['debug'](_0xc604('0x29'),_0x30b245,JSON[_0xc604('0x17')](_0x35d1b5));_0x2098cd(_0x35d1b5);})[_0xc604('0x1c')](function(_0x107812){logger[_0xc604('0x18')](_0xc604('0x29'),_0x107812[_0xc604('0x1a')],_0x30b245);_0x2ad06d(_this[_0xc604('0x18')](0x1f4,_0x107812[_0xc604('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 9de8d83..bc47ee0 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 _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 +var _0xf3dd=['save','update','register','length','faxInteraction:','./faxInteraction.events'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xf3dd,0xad));var _0xdf3d=function(_0x5c38a2,_0x40e4e4){_0x5c38a2=_0x5c38a2-0x0;var _0x22869c=_0xf3dd[_0x5c38a2];return _0x22869c;};'use strict';var FaxInteractionEvents=require(_0xdf3d('0x0'));var events=[_0xdf3d('0x1'),'remove',_0xdf3d('0x2')];function createListener(_0x586b70,_0x49b691){return function(_0x35f3b5){_0x49b691['emit'](_0x586b70,_0x35f3b5);};}function removeListener(_0x122500,_0x3dc94f){return function(){FaxInteractionEvents['removeListener'](_0x122500,_0x3dc94f);};}exports[_0xdf3d('0x3')]=function(_0x4c6f5c){for(var _0x4c83fc=0x0,_0x40fb28=events[_0xdf3d('0x4')];_0x4c83fc<_0x40fb28;_0x4c83fc++){var _0x531753=events[_0x4c83fc];var _0x3950b9=createListener(_0xdf3d('0x5')+_0x531753,_0x4c6f5c);FaxInteractionEvents['on'](_0x531753,_0x3950b9);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index b684b8f..e43b7cf 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 _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 +var _0x878f=['../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','/:id','faxinteraction:update','update','delete','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x17e2b3,_0x534cca){var _0x5bbf15=function(_0x4e8a69){while(--_0x4e8a69){_0x17e2b3['push'](_0x17e2b3['shift']());}};_0x5bbf15(++_0x534cca);}(_0x878f,0x173));var _0xf878=function(_0x19f69b,_0x496be4){_0x19f69b=_0x19f69b-0x0;var _0x52043e=_0x878f[_0x19f69b];return _0x52043e;};'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['describe']);router['get']('/:id',auth[_0xf878('0xa')](),controller['show']);router['get'](_0xf878('0xc'),auth[_0xf878('0xa')](),controller[_0xf878('0xd')]);router['get'](_0xf878('0xe'),auth[_0xf878('0xa')](),controller['download']);router[_0xf878('0xf')]('/',auth['isAuthenticated'](),controller[_0xf878('0x10')]);router[_0xf878('0xf')](_0xf878('0xc'),auth['isAuthenticated'](),controller[_0xf878('0x11')]);router[_0xf878('0xf')](_0xf878('0x12'),auth['isAuthenticated'](),interaction[_0xf878('0x13')](_0xf878('0x14'),_0xf878('0x15')),controller['addTags']);router['put'](_0xf878('0x16'),auth[_0xf878('0xa')](),interaction[_0xf878('0x13')](_0xf878('0x14'),_0xf878('0x17')),controller[_0xf878('0x18')]);router[_0xf878('0x19')](_0xf878('0x16'),auth[_0xf878('0xa')](),interaction[_0xf878('0x13')](_0xf878('0x14'),'faxinteraction:destroy'),controller[_0xf878('0x1a')]);router[_0xf878('0x19')](_0xf878('0x12'),auth[_0xf878('0xa')](),controller[_0xf878('0x1b')]);module[_0xf878('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 014c53c..8f0e6be 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 _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 +var _0x2b7e=['TEXT','medium','ENUM','out','DATE','sequelize','exports'];(function(_0x31a736,_0x2fb5b4){var _0x3eee1e=function(_0x5431e7){while(--_0x5431e7){_0x31a736['push'](_0x31a736['shift']());}};_0x3eee1e(++_0x2fb5b4);}(_0x2b7e,0xd7));var _0xe2b7=function(_0x56ff3f,_0x11132e){_0x56ff3f=_0x56ff3f-0x0;var _0x73c95c=_0x2b7e[_0x56ff3f];return _0x73c95c;};'use strict';var Sequelize=require(_0xe2b7('0x0'));module[_0xe2b7('0x1')]={'body':{'type':Sequelize[_0xe2b7('0x2')](_0xe2b7('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe2b7('0x4')]('in',_0xe2b7('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xe2b7('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xe2b7('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index fc2d612..380482e 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 _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 +var _0x8f59=['null','acceptMessage','interface','channel','accept','EventManager','acceptmessage','agent','SIP/%s','event','create','findOne','ContactId','AttachmentId','SendFax','isNil','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','files','attachments','Attachment','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','send','index','map','FaxMessage','fieldName','type','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','options','includeAll','include','findAll','rows','params','merge','find','body','describe','../../config/logger','fax-interactions','fax','read','readAt','UserId','CmContact','Contact','FaxInteraction','FaxInteractionId','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','get','user','role','interaction'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8f59,0x11d));var _0x98f5=function(_0x23118b,_0x562da3){_0x23118b=_0x23118b-0x0;var _0x3636cf=_0x8f59[_0x23118b];return _0x3636cf;};'use strict';var pdf=require(_0x98f5('0x0'));var emlformat=require(_0x98f5('0x1'));var rimraf=require(_0x98f5('0x2'));var zipdir=require(_0x98f5('0x3'));var jsonpatch=require(_0x98f5('0x4'));var rp=require(_0x98f5('0x5'));var moment=require('moment');var BPromise=require(_0x98f5('0x6'));var Mustache=require(_0x98f5('0x7'));var util=require(_0x98f5('0x8'));var path=require(_0x98f5('0x9'));var sox=require('sox');var csv=require(_0x98f5('0xa'));var ejs=require(_0x98f5('0xb'));var fs=require('fs');var _=require(_0x98f5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x98f5('0xd'));var deskjs=require(_0x98f5('0xe'));var toCsv=require(_0x98f5('0xa'));var querystring=require('querystring');var Papa=require(_0x98f5('0xf'));var Redis=require(_0x98f5('0x10'));var authService=require(_0x98f5('0x11'));var qs=require(_0x98f5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98f5('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x98f5('0x14'));var config=require(_0x98f5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x98f5('0x16'))['db'];config[_0x98f5('0x17')]=_[_0x98f5('0x18')](config[_0x98f5('0x17')],{'host':_0x98f5('0x19'),'port':0x18eb});var socket=require(_0x98f5('0x1a'))(new Redis(config['redis']));require(_0x98f5('0x1b'))[_0x98f5('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x98f5('0x1d')][_0x98f5('0x1e')]({'port':0x232c});var client9002=jayson[_0x98f5('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2437e7,_0xc7a49b,_0x113545,_0x5bb486){return new BPromise(function(_0x440cfa,_0x215360){var _0x574644=_0x5bb486||client;return _0x574644[_0x98f5('0x1f')](_0x2437e7,_0x113545)['then'](function(_0x10c57c){logger[_0x98f5('0x20')](_0x98f5('0x21'),_0xc7a49b,_0x98f5('0x22'));logger[_0x98f5('0x23')](_0x98f5('0x24'),_0xc7a49b,'request\x20sent',JSON[_0x98f5('0x25')](_0x10c57c));if(_0x10c57c['error']){if(_0x10c57c[_0x98f5('0x26')][_0x98f5('0x27')]===0x1f4){logger['error'](_0x98f5('0x21'),_0xc7a49b,_0x10c57c[_0x98f5('0x26')][_0x98f5('0x28')]);return _0x215360(_0x10c57c[_0x98f5('0x26')][_0x98f5('0x28')]);}logger[_0x98f5('0x26')](_0x98f5('0x21'),_0xc7a49b,_0x10c57c['error'][_0x98f5('0x28')]);return _0x440cfa(_0x10c57c['error'][_0x98f5('0x28')]);}else{logger['info'](_0x98f5('0x21'),_0xc7a49b,_0x98f5('0x22'));_0x440cfa(_0x10c57c[_0x98f5('0x29')][_0x98f5('0x28')]);}})[_0x98f5('0x2a')](function(_0x18052d){logger[_0x98f5('0x26')]('FaxMessage,\x20%s,\x20%s',_0xc7a49b,_0x18052d);_0x215360(_0x18052d);});});}function respondWithStatusCode(_0x27a533,_0x2b80a1){_0x2b80a1=_0x2b80a1||0xcc;return function(_0x5d7423){if(_0x5d7423){return _0x27a533[_0x98f5('0x2b')](_0x2b80a1);}return _0x27a533[_0x98f5('0x2c')](_0x2b80a1)[_0x98f5('0x2d')]();};}function respondWithResult(_0x214130,_0x230d1b){_0x230d1b=_0x230d1b||0xc8;return function(_0xe5a019){if(_0xe5a019){return _0x214130[_0x98f5('0x2c')](_0x230d1b)[_0x98f5('0x2e')](_0xe5a019);}};}function respondWithFilteredResult(_0x576c4b,_0x4c10b8){return function(_0x428c85){if(_0x428c85){var _0x71661e=_0x428c85[_0x98f5('0x2f')],_0x18bb29=_0x4c10b8['offset'],_0x209d15=_0x4c10b8[_0x98f5('0x30')]+_0x4c10b8[_0x98f5('0x31')],_0x15bf92;if(_0x209d15>=_0x71661e){_0x209d15=_0x71661e;_0x15bf92=0xc8;}else{_0x15bf92=0xce;}_0x576c4b[_0x98f5('0x2c')](_0x15bf92);return _0x576c4b[_0x98f5('0x32')](_0x98f5('0x33'),_0x18bb29+'-'+_0x209d15+'/'+_0x71661e)[_0x98f5('0x2e')](_0x428c85);}return null;};}function patchUpdates(_0x53d274){return function(_0x1e7027){try{jsonpatch[_0x98f5('0x34')](_0x1e7027,_0x53d274,!![]);}catch(_0x229495){return BPromise[_0x98f5('0x35')](_0x229495);}return _0x1e7027['save']();};}function saveUpdates(_0x45ca95,_0x25766e){return function(_0x3e9ae4){if(_0x3e9ae4){return _0x3e9ae4[_0x98f5('0x36')](_0x45ca95)[_0x98f5('0x37')](function(_0x341003){return _0x341003;});}return null;};}function removeEntity(_0xc18b23,_0x3e7e56){return function(_0x1d0427){if(_0x1d0427){return _0x1d0427[_0x98f5('0x38')]()[_0x98f5('0x37')](function(){_0xc18b23[_0x98f5('0x2c')](0xcc)[_0x98f5('0x2d')]();});}};}function handleEntityNotFound(_0xe4a944,_0x2fc7c6){return function(_0x903259){if(!_0x903259){_0xe4a944[_0x98f5('0x2b')](0x194);}return _0x903259;};}function handleError(_0x3e4e3e,_0x3187bd){_0x3187bd=_0x3187bd||0x1f4;return function(_0x39d935){logger['error'](_0x39d935[_0x98f5('0x39')]);if(_0x39d935['name']){delete _0x39d935['name'];}_0x3e4e3e[_0x98f5('0x2c')](_0x3187bd)[_0x98f5('0x3a')](_0x39d935);};}exports[_0x98f5('0x3b')]=function(_0x32d722,_0x5a280e){var _0x29e9e2={},_0x250933={},_0x163b27={'count':0x0,'rows':[]};var _0x4f4e9d=_[_0x98f5('0x3c')](db[_0x98f5('0x3d')]['rawAttributes'],function(_0x3074b2){return{'name':_0x3074b2[_0x98f5('0x3e')],'type':_0x3074b2[_0x98f5('0x3f')]['key']};});_0x250933[_0x98f5('0x40')]=_[_0x98f5('0x3c')](_0x4f4e9d,_0x98f5('0x41'));_0x250933[_0x98f5('0x42')]=_[_0x98f5('0x43')](_0x32d722['query']);_0x250933['filters']=_[_0x98f5('0x44')](_0x250933[_0x98f5('0x40')],_0x250933[_0x98f5('0x42')]);_0x29e9e2[_0x98f5('0x45')]=_[_0x98f5('0x44')](_0x250933[_0x98f5('0x40')],qs['fields'](_0x32d722['query'][_0x98f5('0x46')]));_0x29e9e2[_0x98f5('0x45')]=_0x29e9e2[_0x98f5('0x45')][_0x98f5('0x47')]?_0x29e9e2['attributes']:_0x250933['model'];if(!_0x32d722[_0x98f5('0x42')][_0x98f5('0x48')](_0x98f5('0x49'))){_0x29e9e2[_0x98f5('0x31')]=qs['limit'](_0x32d722['query'][_0x98f5('0x31')]);_0x29e9e2[_0x98f5('0x30')]=qs[_0x98f5('0x30')](_0x32d722['query'][_0x98f5('0x30')]);}_0x29e9e2['order']=qs[_0x98f5('0x4a')](_0x32d722['query'][_0x98f5('0x4a')]);_0x29e9e2[_0x98f5('0x4b')]=qs[_0x98f5('0x4c')](_['pick'](_0x32d722[_0x98f5('0x42')],_0x250933[_0x98f5('0x4c')]),_0x4f4e9d);if(_0x32d722['query'][_0x98f5('0x4d')]){_0x29e9e2[_0x98f5('0x4b')]=_['merge'](_0x29e9e2[_0x98f5('0x4b')],{'$or':_['map'](_0x4f4e9d,function(_0x27bf7c){if(_0x27bf7c[_0x98f5('0x3f')]!=='VIRTUAL'){var _0x4dd7fc={};_0x4dd7fc[_0x27bf7c['name']]={'$like':'%'+_0x32d722['query'][_0x98f5('0x4d')]+'%'};return _0x4dd7fc;}})});}_0x29e9e2=_['merge']({},_0x29e9e2,_0x32d722[_0x98f5('0x4e')]);var _0x188796={'where':_0x29e9e2[_0x98f5('0x4b')]};return db[_0x98f5('0x3d')][_0x98f5('0x2f')](_0x188796)[_0x98f5('0x37')](function(_0x485289){_0x163b27[_0x98f5('0x2f')]=_0x485289;if(_0x32d722[_0x98f5('0x42')][_0x98f5('0x4f')]){_0x29e9e2[_0x98f5('0x50')]=[{'all':!![]}];}return db[_0x98f5('0x3d')][_0x98f5('0x51')](_0x29e9e2);})['then'](function(_0x3a4cc5){_0x163b27[_0x98f5('0x52')]=_0x3a4cc5;return _0x163b27;})[_0x98f5('0x37')](respondWithFilteredResult(_0x5a280e,_0x29e9e2))[_0x98f5('0x2a')](handleError(_0x5a280e,null));};exports['show']=function(_0x2c5f96,_0x157ac0){var _0x151617={'raw':!![],'where':{'id':_0x2c5f96[_0x98f5('0x53')]['id']}},_0x331ab0={};_0x331ab0['model']=_[_0x98f5('0x43')](db[_0x98f5('0x3d')]['rawAttributes']);_0x331ab0[_0x98f5('0x42')]=_['keys'](_0x2c5f96[_0x98f5('0x42')]);_0x331ab0['filters']=_[_0x98f5('0x44')](_0x331ab0[_0x98f5('0x40')],_0x331ab0[_0x98f5('0x42')]);_0x151617['attributes']=_[_0x98f5('0x44')](_0x331ab0[_0x98f5('0x40')],qs[_0x98f5('0x46')](_0x2c5f96[_0x98f5('0x42')][_0x98f5('0x46')]));_0x151617[_0x98f5('0x45')]=_0x151617[_0x98f5('0x45')][_0x98f5('0x47')]?_0x151617[_0x98f5('0x45')]:_0x331ab0[_0x98f5('0x40')];if(_0x2c5f96[_0x98f5('0x42')][_0x98f5('0x4f')]){_0x151617[_0x98f5('0x50')]=[{'all':!![]}];}_0x151617=_[_0x98f5('0x54')]({},_0x151617,_0x2c5f96[_0x98f5('0x4e')]);return db[_0x98f5('0x3d')][_0x98f5('0x55')](_0x151617)['then'](handleEntityNotFound(_0x157ac0,null))[_0x98f5('0x37')](respondWithResult(_0x157ac0,null))[_0x98f5('0x2a')](handleError(_0x157ac0,null));};exports[_0x98f5('0x36')]=function(_0x4663f2,_0x196d34){if(_0x4663f2[_0x98f5('0x56')]['id']){delete _0x4663f2['body']['id'];}return db['FaxMessage']['find']({'where':{'id':_0x4663f2[_0x98f5('0x53')]['id']}})[_0x98f5('0x37')](handleEntityNotFound(_0x196d34,null))[_0x98f5('0x37')](saveUpdates(_0x4663f2[_0x98f5('0x56')],null))['then'](respondWithResult(_0x196d34,null))[_0x98f5('0x2a')](handleError(_0x196d34,null));};exports['destroy']=function(_0x31c413,_0x583be6){return db['FaxMessage'][_0x98f5('0x55')]({'where':{'id':_0x31c413[_0x98f5('0x53')]['id']}})[_0x98f5('0x37')](handleEntityNotFound(_0x583be6,null))['then'](removeEntity(_0x583be6,null))['catch'](handleError(_0x583be6,null));};exports[_0x98f5('0x57')]=function(_0x139ca3,_0x54233b){return db[_0x98f5('0x3d')][_0x98f5('0x57')]()['then'](respondWithResult(_0x54233b,null))[_0x98f5('0x2a')](handleError(_0x54233b,null));};var interaction_log=require(_0x98f5('0x58'))(_0x98f5('0x59'));exports['accept']=function(_0x2ac5ed,_0x1b49a0,_0x1aaa07){var _0xabde69={'agent':{},'channel':_0x98f5('0x5a')};if(_0x2ac5ed[_0x98f5('0x56')]['id']){delete _0x2ac5ed[_0x98f5('0x56')]['id'];}_0x2ac5ed['body'][_0x98f5('0x5b')]=!![];_0x2ac5ed[_0x98f5('0x56')][_0x98f5('0x5c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2ac5ed[_0x98f5('0x56')][_0x98f5('0x5d')]=_0x2ac5ed['body']['UserId']||_0x2ac5ed['user']['id'];_0xabde69['agent']['id']=_0x2ac5ed[_0x98f5('0x56')]['UserId'];return db[_0x98f5('0x3d')][_0x98f5('0x55')]({'where':{'id':_0x2ac5ed[_0x98f5('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x98f5('0x5e')],'as':_0x98f5('0x5f')}]})[_0x98f5('0x37')](handleEntityNotFound(_0x1b49a0,null))[_0x98f5('0x37')](saveUpdates(_0x2ac5ed[_0x98f5('0x56')],null))['then'](function(_0x4d89b6){if(_0x4d89b6){_0xabde69[_0x98f5('0x28')]=_0x4d89b6['get']({'plain':!![]});return db[_0x98f5('0x60')][_0x98f5('0x55')]({'where':{'id':_0x4d89b6[_0x98f5('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x1b49a0,null))[_0x98f5('0x37')](function(_0x56b308){if(_0x56b308){return _0x56b308['update']({'UserId':_0x2ac5ed['body'][_0x98f5('0x5d')],'read1stAt':_['isNil'](_0x56b308[_0x98f5('0x62')])?moment()[_0x98f5('0x63')](_0x98f5('0x64')):undefined});}return null;})['then'](function(_0x5df83d){if(_0x5df83d){_0xabde69['interaction']=_0x5df83d[_0x98f5('0x65')]({'plain':!![]});interaction_log[_0x98f5('0x20')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2ac5ed['user']['id'],_0x2ac5ed[_0x98f5('0x66')][_0x98f5('0x41')],_0x2ac5ed[_0x98f5('0x66')][_0x98f5('0x67')],_0xabde69[_0x98f5('0x68')]['id'],_0x2ac5ed[_0x98f5('0x56')]?JSON[_0x98f5('0x25')](_0x2ac5ed[_0x98f5('0x56')]):_0x98f5('0x69'));return respondWithRpcPromise('AcceptMessage',_0x98f5('0x6a'),_0xabde69);}return null;})[_0x98f5('0x37')](function(_0x205677){if(_0x205677){if(_0x2ac5ed[_0x98f5('0x56')]['manual']){_0xabde69[_0x98f5('0x28')][_0x98f5('0x6b')]=util[_0x98f5('0x63')]('SIP/%s',_0x2ac5ed[_0x98f5('0x66')][_0x98f5('0x41')]);_0xabde69['message'][_0x98f5('0x6c')]=_0xabde69[_0x98f5('0x6c')];_0xabde69[_0x98f5('0x28')]['event']=_0x98f5('0x6d');return respondWithRpcPromise(_0x98f5('0x6e'),_0x98f5('0x6e'),{'event':_0x98f5('0x6f'),'message':_0xabde69[_0x98f5('0x28')]},client9002)[_0x98f5('0x37')](function(){return _0xabde69;});}return _0xabde69;}return null;})[_0x98f5('0x37')](respondWithResult(_0x1b49a0,null))[_0x98f5('0x2a')](handleError(_0x1b49a0,null));};var interaction_log=require(_0x98f5('0x58'))('fax-interactions');exports[_0x98f5('0x35')]=function(_0x486ff6,_0x1b4082,_0x5c69f0){var _0x3bb728={'agent':{},'channel':_0x98f5('0x5a')};if(_0x486ff6['body']['id']){delete _0x486ff6[_0x98f5('0x56')]['id'];}_0x486ff6[_0x98f5('0x56')]['UserId']=_0x486ff6[_0x98f5('0x56')]['UserId']||_0x486ff6[_0x98f5('0x66')]['id'];_0x3bb728[_0x98f5('0x70')]['id']=_0x486ff6[_0x98f5('0x56')][_0x98f5('0x5d')];return db['FaxMessage']['find']({'where':{'id':_0x486ff6[_0x98f5('0x53')]['id'],'UserId':null}})[_0x98f5('0x37')](handleEntityNotFound(_0x1b4082,null))['then'](function(_0x198094){if(_0x198094){_0x3bb728[_0x98f5('0x28')]=_0x198094[_0x98f5('0x65')]({'plain':!![]});return db[_0x98f5('0x60')][_0x98f5('0x55')]({'where':{'id':_0x198094[_0x98f5('0x61')]}});}return null;})[_0x98f5('0x37')](handleEntityNotFound(_0x1b4082,null))[_0x98f5('0x37')](function(_0x2e0484){if(_0x2e0484){_0x3bb728[_0x98f5('0x68')]=_0x2e0484[_0x98f5('0x65')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x486ff6[_0x98f5('0x66')]['id'],_0x486ff6[_0x98f5('0x66')][_0x98f5('0x41')],_0x486ff6['user'][_0x98f5('0x67')],_0x3bb728[_0x98f5('0x68')]['id'],_0x486ff6['body']?JSON[_0x98f5('0x25')](_0x486ff6[_0x98f5('0x56')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x3bb728);}return null;})['then'](function(_0x3d69d2){if(_0x3d69d2){_0x3d69d2[_0x98f5('0x28')]['interface']=util[_0x98f5('0x63')](_0x98f5('0x71'),_0x486ff6['user'][_0x98f5('0x41')]);_0x3d69d2['message']['channel']=_0x3bb728[_0x98f5('0x6c')];_0x3d69d2[_0x98f5('0x28')][_0x98f5('0x72')]=_0x98f5('0x35');respondWithRpcPromise('EventManager',_0x98f5('0x6e'),{'event':'rejectmessage','message':_0x3d69d2['message']},client9002);return _0x3bb728;}return null;})['then'](respondWithResult(_0x1b4082,null))[_0x98f5('0x2a')](handleError(_0x1b4082,null));};exports[_0x98f5('0x73')]=function(_0x251c1c,_0x138981){var _0x1dbd36;return db[_0x98f5('0x3d')][_0x98f5('0x73')](_0x251c1c[_0x98f5('0x56')],{})[_0x98f5('0x37')](function(_0x2aa9a4){_0x1dbd36=_0x2aa9a4;return db['CmContact'][_0x98f5('0x74')]({'where':{'id':_0x1dbd36[_0x98f5('0x75')]}});})[_0x98f5('0x37')](function(_0x449422){if(_['isNil'](_0x449422)){return;}else{_0x1dbd36[_0x98f5('0x5a')]=_0x449422[_0x98f5('0x5a')];return db['Attachment'][_0x98f5('0x74')]({'where':{'id':_0x1dbd36[_0x98f5('0x76')]}});}})[_0x98f5('0x37')](function(_0x4bda79){return respondWithRpcPromise(_0x98f5('0x77'),_0x98f5('0x77'),{'FaxAccountId':_[_0x98f5('0x78')](_0x251c1c[_0x98f5('0x56')])?undefined:_0x251c1c[_0x98f5('0x56')][_0x98f5('0x79')],'path':_['isNil'](_0x4bda79)?undefined:util['format'](_0x98f5('0x7a'),_0x4bda79[_0x98f5('0x7b')]),'fax':_[_0x98f5('0x78')](_0x1dbd36[_0x98f5('0x5a')])?undefined:_0x1dbd36['fax'],'AttachmentId':_0x1dbd36[_0x98f5('0x76')]},client9002);})[_0x98f5('0x37')](respondWithResult(_0x138981,0xc9))['catch'](handleError(_0x138981,null));};exports['download']=function(_0x20b275,_0x50c380){var _0xcbe143=path[_0x98f5('0x7c')](config[_0x98f5('0x7d')],'server',_0x98f5('0x7e'),_0x98f5('0x7f'));return db['FaxMessage'][_0x98f5('0x55')]({'where':{'id':_0x20b275[_0x98f5('0x53')]['id']},'include':[{'model':db[_0x98f5('0x80')],'as':_0x98f5('0x80')}]})['then'](handleEntityNotFound(_0x50c380,null))['then'](function(_0x33b3d4){if(_0x33b3d4){return _0x50c380[_0x98f5('0x81')](path[_0x98f5('0x7c')](_0xcbe143,_0x33b3d4[_0x98f5('0x80')][_0x98f5('0x7b')]));}})[_0x98f5('0x2a')](handleError(_0x50c380,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index ee0bdc1..8954f52 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 _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 +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x55ca,0x126));var _0xa55c=function(_0x4c11f7,_0x5a0447){_0x4c11f7=_0x4c11f7-0x0;var _0x587d6b=_0x55ca[_0x4c11f7];return _0x587d6b;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var FaxMessage=require(_0xa55c('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){FaxMessageEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);FaxMessageEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];FaxMessage[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 837f27b..9669c6f 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 _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 +var _0xc512=['rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fti_fax_messages','body','FULLTEXT','get','direction','out','secret','isNil','UserId','findOne','FaxInteractionId','then','createdAt','toLowerCase','catch','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1861da,_0x1e939d){var _0x4403cc=function(_0x336a39){while(--_0x336a39){_0x1861da['push'](_0x1861da['shift']());}};_0x4403cc(++_0x1e939d);}(_0xc512,0x167));var _0x2c51=function(_0x35a59c,_0x3c08ef){_0x35a59c=_0x35a59c-0x0;var _0x11bf0e=_0xc512[_0x35a59c];return _0x11bf0e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2c51('0x0'))('api');var moment=require(_0x2c51('0x1'));var BPromise=require(_0x2c51('0x2'));var rp=require(_0x2c51('0x3'));var fs=require('fs');var path=require(_0x2c51('0x4'));var rimraf=require(_0x2c51('0x5'));var config=require(_0x2c51('0x6'));var attributes=require(_0x2c51('0x7'));module[_0x2c51('0x8')]=function(_0x29ccd6,_0x1d8197){return _0x29ccd6[_0x2c51('0x9')](_0x2c51('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x2c51('0xb'),'fields':[_0x2c51('0xc')],'type':_0x2c51('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x15bccc,_0x2e81c0,_0x42fe80){var _0x3678b0=_0x29ccd6['models'];var _0x28dc24=_0x15bccc[_0x2c51('0xe')]({'plain':!![]});if(_0x28dc24[_0x2c51('0xf')]['toLowerCase']()==='in'||_0x28dc24[_0x2c51('0xf')]['toLowerCase']()===_0x2c51('0x10')&&!_0x28dc24[_0x2c51('0x11')]&&!_[_0x2c51('0x12')](_0x28dc24[_0x2c51('0x13')])){_0x3678b0['FaxInteraction'][_0x2c51('0x14')]({'where':{'id':_0x28dc24[_0x2c51('0x15')]}})[_0x2c51('0x16')](function(_0x47d7ce){if(_0x47d7ce){_0x47d7ce['update']({'lastMsgAt':_0x28dc24[_0x2c51('0x17')],'lastMsgDirection':_0x28dc24[_0x2c51('0xf')][_0x2c51('0x18')]()});}})[_0x2c51('0x19')](function(_0x3ea4a5){console['error'](_0x3ea4a5);});}_0x42fe80();}},'charset':_0x2c51('0x1a'),'collate':_0x2c51('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index db4a2bd..3771206 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 _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 +var _0x4a47=['FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','CreateFaxMessage','debug','UpdateFaxMessage','raw','where','attributes','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./faxMessage.socket','register','request','then','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x4a47,0x103));var _0x74a4=function(_0x4acb73,_0xb4f550){_0x4acb73=_0x4acb73-0x0;var _0x1598e7=_0x4a47[_0x4acb73];return _0x1598e7;};'use strict';var _=require(_0x74a4('0x0'));var util=require(_0x74a4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74a4('0x2'));var db=require(_0x74a4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x74a4('0x4'))(_0x74a4('0x5'));var config=require('../../config/environment');var jayson=require(_0x74a4('0x6'));var client=jayson[_0x74a4('0x7')][_0x74a4('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x74a4('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x74a4('0xa'))(new Redis(config[_0x74a4('0x9')]));require(_0x74a4('0xb'))[_0x74a4('0xc')](socket);function respondWithRpcPromise(_0x14ce41,_0x3b437f,_0x11b0e2){return new BPromise(function(_0x4e6a5a,_0xb16ff7){return client[_0x74a4('0xd')](_0x14ce41,_0x11b0e2)[_0x74a4('0xe')](function(_0x428742){logger[_0x74a4('0xf')]('FaxMessage,\x20%s,\x20%s',_0x3b437f,_0x74a4('0x10'));logger['debug'](_0x74a4('0x11'),_0x3b437f,_0x74a4('0x10'),JSON[_0x74a4('0x12')](_0x428742));if(_0x428742[_0x74a4('0x13')]){if(_0x428742[_0x74a4('0x13')][_0x74a4('0x14')]===0x1f4){logger[_0x74a4('0x13')](_0x74a4('0x15'),_0x3b437f,_0x428742[_0x74a4('0x13')][_0x74a4('0x16')]);return _0xb16ff7(_0x428742[_0x74a4('0x13')][_0x74a4('0x16')]);}logger[_0x74a4('0x13')](_0x74a4('0x15'),_0x3b437f,_0x428742[_0x74a4('0x13')]['message']);return _0x4e6a5a(_0x428742['error'][_0x74a4('0x16')]);}else{logger[_0x74a4('0xf')](_0x74a4('0x15'),_0x3b437f,'request\x20sent');_0x4e6a5a(_0x428742[_0x74a4('0x17')][_0x74a4('0x16')]);}})[_0x74a4('0x18')](function(_0x16edbf){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3b437f,_0x16edbf);_0xb16ff7(_0x16edbf);});});}exports['CreateFaxMessage']=function(_0x2ac474){var _0x300681=this;return new Promise(function(_0x1775ac,_0x13f1b3){return db[_0x74a4('0x19')][_0x74a4('0x1a')](_0x2ac474[_0x74a4('0x1b')],{'raw':_0x2ac474[_0x74a4('0x1c')]?_0x2ac474[_0x74a4('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x74a4('0xe')](function(_0x158acf){logger['info'](_0x74a4('0x1d'),_0x2ac474);logger[_0x74a4('0x1e')](_0x74a4('0x1d'),_0x2ac474,JSON[_0x74a4('0x12')](_0x158acf));_0x1775ac(_0x158acf);})['catch'](function(_0x295eb6){logger[_0x74a4('0x13')](_0x74a4('0x1d'),_0x295eb6[_0x74a4('0x16')],_0x2ac474);_0x13f1b3(_0x300681[_0x74a4('0x13')](0x1f4,_0x295eb6[_0x74a4('0x16')]));});});};exports[_0x74a4('0x1f')]=function(_0x4ef8d1){var _0x5df363=this;return new Promise(function(_0x33d7e1,_0x29d463){return db[_0x74a4('0x19')]['update'](_0x4ef8d1['body'],{'raw':_0x4ef8d1[_0x74a4('0x1c')]?_0x4ef8d1[_0x74a4('0x1c')][_0x74a4('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ef8d1[_0x74a4('0x1c')]?_0x4ef8d1[_0x74a4('0x1c')][_0x74a4('0x21')]||null:null,'attributes':_0x4ef8d1[_0x74a4('0x1c')]?_0x4ef8d1[_0x74a4('0x1c')][_0x74a4('0x22')]||null:null,'limit':_0x4ef8d1['options']?_0x4ef8d1[_0x74a4('0x1c')]['limit']||null:null})[_0x74a4('0xe')](function(_0x1195f4){logger[_0x74a4('0xf')](_0x74a4('0x1f'),_0x4ef8d1);logger[_0x74a4('0x1e')]('UpdateFaxMessage',_0x4ef8d1,JSON['stringify'](_0x1195f4));_0x33d7e1(_0x1195f4);})['catch'](function(_0x517284){logger['error'](_0x74a4('0x1f'),_0x517284[_0x74a4('0x16')],_0x4ef8d1);_0x29d463(_0x5df363['error'](0x1f4,_0x517284[_0x74a4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index c919e05..2a21716 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(_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 +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 439b4cf..1e414fd 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 _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 +var _0xd93e=['path','Router','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','index','/describe','isAuthenticated','show','/:id/download','post','tracked','fax','faxmessage:create','update','put','/:id/accept','accept','/:id/reject','reject','delete','/:id','destroy','exports','multer','util'];(function(_0xf5aede,_0x5b2e7f){var _0x5c6890=function(_0x12db0f){while(--_0x12db0f){_0xf5aede['push'](_0xf5aede['shift']());}};_0x5c6890(++_0x5b2e7f);}(_0xd93e,0x15d));var _0xed93=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xd93e[_0xa148b7];return _0x51efd3;};'use strict';var multer=require(_0xed93('0x0'));var util=require(_0xed93('0x1'));var path=require(_0xed93('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xed93('0x3')]();var auth=require(_0xed93('0x4'));var interaction=require(_0xed93('0x5'));var config=require('../../config/environment');var controller=require(_0xed93('0x6'));router[_0xed93('0x7')]('/',auth['isAuthenticated'](),controller[_0xed93('0x8')]);router[_0xed93('0x7')](_0xed93('0x9'),auth[_0xed93('0xa')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xed93('0xb')]);router[_0xed93('0x7')](_0xed93('0xc'),auth[_0xed93('0xa')](),controller['download']);router[_0xed93('0xd')]('/',auth['isAuthenticated'](),interaction[_0xed93('0xe')](_0xed93('0xf'),_0xed93('0x10')),controller['create']);router['put']('/:id',auth[_0xed93('0xa')](),controller[_0xed93('0x11')]);router[_0xed93('0x12')](_0xed93('0x13'),auth['isAuthenticated'](),controller[_0xed93('0x14')]);router[_0xed93('0x12')](_0xed93('0x15'),auth[_0xed93('0xa')](),controller[_0xed93('0x16')]);router[_0xed93('0x17')](_0xed93('0x18'),auth[_0xed93('0xa')](),controller[_0xed93('0x19')]);module[_0xed93('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index e2fe829..18e651f 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 _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 +var _0xaf5c=['STRING','name','ENUM','rrmemory','roundrobin','exports'];(function(_0x24086f,_0x19f063){var _0x3569c8=function(_0x1dbce8){while(--_0x1dbce8){_0x24086f['push'](_0x24086f['shift']());}};_0x3569c8(++_0x19f063);}(_0xaf5c,0x161));var _0xcaf5=function(_0x2f846d,_0x382311){_0x2f846d=_0x2f846d-0x0;var _0x2b222d=_0xaf5c[_0x2f846d];return _0x2b222d;};'use strict';var Sequelize=require('sequelize');module[_0xcaf5('0x0')]={'name':{'type':Sequelize[_0xcaf5('0x1')],'unique':_0xcaf5('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcaf5('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcaf5('0x3')](_0xcaf5('0x4'),'beepall',_0xcaf5('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'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 b2107f5..5541491 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 _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 +var _0x0de6=['body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserFaxQueue','User','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','select','tq.TeamId','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','get','UserProfileResource','then','stack','name','send','index','FaxQueue','rawAttributes','fieldName','type','map','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','intersection','find','create'];(function(_0x473625,_0x5ddf8c){var _0x3b8b37=function(_0x4aea60){while(--_0x4aea60){_0x473625['push'](_0x473625['shift']());}};_0x3b8b37(++_0x5ddf8c);}(_0x0de6,0xc7));var _0x60de=function(_0x2e9573,_0x27b4d2){_0x2e9573=_0x2e9573-0x0;var _0xce176a=_0x0de6[_0x2e9573];return _0xce176a;};'use strict';var pdf=require(_0x60de('0x0'));var emlformat=require(_0x60de('0x1'));var rimraf=require(_0x60de('0x2'));var zipdir=require(_0x60de('0x3'));var jsonpatch=require(_0x60de('0x4'));var rp=require(_0x60de('0x5'));var moment=require(_0x60de('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x60de('0x7'));var util=require(_0x60de('0x8'));var path=require(_0x60de('0x9'));var sox=require(_0x60de('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x60de('0xb'));var squel=require('squel');var crypto=require(_0x60de('0xc'));var jsforce=require(_0x60de('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x60de('0xe'));var querystring=require(_0x60de('0xf'));var Papa=require(_0x60de('0x10'));var Redis=require(_0x60de('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x60de('0x12'));var as=require(_0x60de('0x13'));var hardwareService=require(_0x60de('0x14'));var logger=require(_0x60de('0x15'))(_0x60de('0x16'));var utils=require(_0x60de('0x17'));var config=require(_0x60de('0x18'));var licenseUtil=require(_0x60de('0x19'));var db=require(_0x60de('0x1a'))['db'];config[_0x60de('0x1b')]=_[_0x60de('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x60de('0x1d'))(new Redis(config[_0x60de('0x1b')]));require('./faxQueue.socket')[_0x60de('0x1e')](socket);function respondWithStatusCode(_0x40f6ca,_0x323f1f){_0x323f1f=_0x323f1f||0xcc;return function(_0x1d3ccc){if(_0x1d3ccc){return _0x40f6ca[_0x60de('0x1f')](_0x323f1f);}return _0x40f6ca[_0x60de('0x20')](_0x323f1f)[_0x60de('0x21')]();};}function respondWithResult(_0x5da4ce,_0x4a4962){_0x4a4962=_0x4a4962||0xc8;return function(_0x2fac2a){if(_0x2fac2a){return _0x5da4ce[_0x60de('0x20')](_0x4a4962)['json'](_0x2fac2a);}};}function respondWithFilteredResult(_0x44855a,_0x30b14c){return function(_0x188402){if(_0x188402){var _0x225119=_0x188402[_0x60de('0x22')],_0x134675=_0x30b14c[_0x60de('0x23')],_0x25cee5=_0x30b14c[_0x60de('0x23')]+_0x30b14c[_0x60de('0x24')],_0xd56179;if(_0x25cee5>=_0x225119){_0x25cee5=_0x225119;_0xd56179=0xc8;}else{_0xd56179=0xce;}_0x44855a[_0x60de('0x20')](_0xd56179);return _0x44855a[_0x60de('0x25')](_0x60de('0x26'),_0x134675+'-'+_0x25cee5+'/'+_0x225119)[_0x60de('0x27')](_0x188402);}return null;};}function patchUpdates(_0x5385d0){return function(_0x432ac0){try{jsonpatch[_0x60de('0x28')](_0x432ac0,_0x5385d0,!![]);}catch(_0xac1e0b){return BPromise[_0x60de('0x29')](_0xac1e0b);}return _0x432ac0[_0x60de('0x2a')]();};}function saveUpdates(_0x21c6e6,_0xacd209){return function(_0x15bab9){if(_0x15bab9){return _0x15bab9['update'](_0x21c6e6)['then'](function(_0x2e7b02){return _0x2e7b02;});}return null;};}function removeEntity(_0xecc573,_0x4e4984){return function(_0x46ca3a){if(_0x46ca3a){return _0x46ca3a[_0x60de('0x2b')]()['then'](function(){var _0x10bc08=_0x46ca3a[_0x60de('0x2c')]({'plain':!![]});var _0x29e6e8='FaxQueues';return db[_0x60de('0x2d')][_0x60de('0x2b')]({'where':{'type':_0x29e6e8,'resourceId':_0x10bc08['id']}})['then'](function(){return _0x46ca3a;});})[_0x60de('0x2e')](function(){_0xecc573[_0x60de('0x20')](0xcc)[_0x60de('0x21')]();});}};}function handleEntityNotFound(_0x43c95e,_0x42408a){return function(_0x2aa0b6){if(!_0x2aa0b6){_0x43c95e['sendStatus'](0x194);}return _0x2aa0b6;};}function handleError(_0x1737ec,_0x2bfcde){_0x2bfcde=_0x2bfcde||0x1f4;return function(_0x202333){logger['error'](_0x202333[_0x60de('0x2f')]);if(_0x202333[_0x60de('0x30')]){delete _0x202333[_0x60de('0x30')];}_0x1737ec[_0x60de('0x20')](_0x2bfcde)[_0x60de('0x31')](_0x202333);};}exports[_0x60de('0x32')]=function(_0x392d3c,_0x274516){var _0x3c2e4b={},_0x55f8b5={},_0x52d233={'count':0x0,'rows':[]};var _0x110110=_['map'](db[_0x60de('0x33')][_0x60de('0x34')],function(_0x59f001){return{'name':_0x59f001[_0x60de('0x35')],'type':_0x59f001[_0x60de('0x36')]['key']};});_0x55f8b5['model']=_[_0x60de('0x37')](_0x110110,_0x60de('0x30'));_0x55f8b5[_0x60de('0x38')]=_[_0x60de('0x39')](_0x392d3c[_0x60de('0x38')]);_0x55f8b5[_0x60de('0x3a')]=_['intersection'](_0x55f8b5[_0x60de('0x3b')],_0x55f8b5[_0x60de('0x38')]);_0x3c2e4b['attributes']=_['intersection'](_0x55f8b5[_0x60de('0x3b')],qs[_0x60de('0x3c')](_0x392d3c[_0x60de('0x38')]['fields']));_0x3c2e4b[_0x60de('0x3d')]=_0x3c2e4b[_0x60de('0x3d')][_0x60de('0x3e')]?_0x3c2e4b[_0x60de('0x3d')]:_0x55f8b5['model'];if(!_0x392d3c[_0x60de('0x38')][_0x60de('0x3f')](_0x60de('0x40'))){_0x3c2e4b['limit']=qs[_0x60de('0x24')](_0x392d3c['query']['limit']);_0x3c2e4b[_0x60de('0x23')]=qs[_0x60de('0x23')](_0x392d3c['query'][_0x60de('0x23')]);}_0x3c2e4b[_0x60de('0x41')]=qs[_0x60de('0x42')](_0x392d3c[_0x60de('0x38')][_0x60de('0x42')]);_0x3c2e4b[_0x60de('0x43')]=qs[_0x60de('0x3a')](_[_0x60de('0x44')](_0x392d3c[_0x60de('0x38')],_0x55f8b5[_0x60de('0x3a')]),_0x110110);if(_0x392d3c[_0x60de('0x38')][_0x60de('0x45')]){_0x3c2e4b[_0x60de('0x43')]=_['merge'](_0x3c2e4b[_0x60de('0x43')],{'$or':_[_0x60de('0x37')](_0x110110,function(_0x593760){if(_0x593760[_0x60de('0x36')]!=='VIRTUAL'){var _0x4e24ea={};_0x4e24ea[_0x593760[_0x60de('0x30')]]={'$like':'%'+_0x392d3c[_0x60de('0x38')][_0x60de('0x45')]+'%'};return _0x4e24ea;}})});}_0x3c2e4b=_[_0x60de('0x46')]({},_0x3c2e4b,_0x392d3c[_0x60de('0x47')]);var _0xc5db97={'where':_0x3c2e4b[_0x60de('0x43')]};return db[_0x60de('0x33')][_0x60de('0x22')](_0xc5db97)[_0x60de('0x2e')](function(_0x258848){_0x52d233[_0x60de('0x22')]=_0x258848;if(_0x392d3c[_0x60de('0x38')][_0x60de('0x48')]){_0x3c2e4b['include']=[{'all':!![]}];}return db['FaxQueue'][_0x60de('0x49')](_0x3c2e4b);})['then'](function(_0x375a59){_0x52d233[_0x60de('0x4a')]=_0x375a59;return _0x52d233;})[_0x60de('0x2e')](respondWithFilteredResult(_0x274516,_0x3c2e4b))[_0x60de('0x4b')](handleError(_0x274516,null));};exports[_0x60de('0x4c')]=function(_0x5dcd25,_0x5f40fa){var _0xef1c8f={'raw':!![],'where':{'id':_0x5dcd25[_0x60de('0x4d')]['id']}},_0x3b349b={};_0x3b349b['model']=_[_0x60de('0x39')](db['FaxQueue'][_0x60de('0x34')]);_0x3b349b['query']=_[_0x60de('0x39')](_0x5dcd25[_0x60de('0x38')]);_0x3b349b[_0x60de('0x3a')]=_[_0x60de('0x4e')](_0x3b349b[_0x60de('0x3b')],_0x3b349b['query']);_0xef1c8f[_0x60de('0x3d')]=_[_0x60de('0x4e')](_0x3b349b['model'],qs[_0x60de('0x3c')](_0x5dcd25[_0x60de('0x38')][_0x60de('0x3c')]));_0xef1c8f[_0x60de('0x3d')]=_0xef1c8f[_0x60de('0x3d')][_0x60de('0x3e')]?_0xef1c8f[_0x60de('0x3d')]:_0x3b349b[_0x60de('0x3b')];if(_0x5dcd25[_0x60de('0x38')][_0x60de('0x48')]){_0xef1c8f['include']=[{'all':!![]}];}_0xef1c8f=_['merge']({},_0xef1c8f,_0x5dcd25['options']);return db[_0x60de('0x33')][_0x60de('0x4f')](_0xef1c8f)[_0x60de('0x2e')](handleEntityNotFound(_0x5f40fa,null))['then'](respondWithResult(_0x5f40fa,null))[_0x60de('0x4b')](handleError(_0x5f40fa,null));};exports[_0x60de('0x50')]=function(_0xe56d35,_0x3915d2){return db[_0x60de('0x33')][_0x60de('0x50')](_0xe56d35[_0x60de('0x51')],{})[_0x60de('0x2e')](function(_0xfb1e14){var _0x5c8164=_0xe56d35['user'][_0x60de('0x2c')]({'plain':!![]});if(!_0x5c8164)throw new Error(_0x60de('0x52'));if(_0x5c8164[_0x60de('0x53')]==='user'){var _0x37124e=_0xfb1e14[_0x60de('0x2c')]({'plain':!![]});var _0x1d0b88='FaxQueues';return db[_0x60de('0x54')][_0x60de('0x4f')]({'where':{'name':_0x1d0b88,'userProfileId':_0x5c8164[_0x60de('0x55')]},'raw':!![]})[_0x60de('0x2e')](function(_0x45680a){if(_0x45680a&&_0x45680a['autoAssociation']===0x0){return db[_0x60de('0x2d')][_0x60de('0x50')]({'name':_0x37124e[_0x60de('0x30')],'resourceId':_0x37124e['id'],'type':_0x45680a['name'],'sectionId':_0x45680a['id']},{})[_0x60de('0x2e')](function(){return _0xfb1e14;});}else{return _0xfb1e14;}})[_0x60de('0x4b')](function(_0x4378b6){logger[_0x60de('0x56')](_0x60de('0x57'),_0x4378b6);throw _0x4378b6;});}return _0xfb1e14;})['then'](respondWithResult(_0x3915d2,0xc9))['catch'](handleError(_0x3915d2,null));};exports[_0x60de('0x58')]=function(_0x11c9db,_0x51b452){if(_0x11c9db['body']['id']){delete _0x11c9db[_0x60de('0x51')]['id'];}return db['FaxQueue'][_0x60de('0x4f')]({'where':{'id':_0x11c9db[_0x60de('0x4d')]['id']}})[_0x60de('0x2e')](handleEntityNotFound(_0x51b452,null))[_0x60de('0x2e')](saveUpdates(_0x11c9db[_0x60de('0x51')],null))[_0x60de('0x2e')](respondWithResult(_0x51b452,null))[_0x60de('0x4b')](handleError(_0x51b452,null));};exports[_0x60de('0x2b')]=function(_0xfb1d4b,_0x400137){return db[_0x60de('0x33')][_0x60de('0x4f')]({'where':{'id':_0xfb1d4b['params']['id']}})[_0x60de('0x2e')](handleEntityNotFound(_0x400137,null))[_0x60de('0x2e')](removeEntity(_0x400137,null))[_0x60de('0x4b')](handleError(_0x400137,null));};exports[_0x60de('0x59')]=function(_0x40357d,_0x126232){return db[_0x60de('0x33')][_0x60de('0x59')]()[_0x60de('0x2e')](respondWithResult(_0x126232,null))['catch'](handleError(_0x126232,null));};exports['getMembers']=function(_0x3b9e67,_0x94e470,_0xda2c9b){var _0x993585={'raw':!![],'where':{}},_0x12806e={},_0x3afccf;return db[_0x60de('0x33')][_0x60de('0x5a')]({'where':{'id':_0x3b9e67[_0x60de('0x4d')]['id']}})['then'](handleEntityNotFound(_0x94e470,null))[_0x60de('0x2e')](function(_0x491065){if(_0x491065){_0x3afccf=_0x491065[_0x60de('0x2c')]({'plain':!![]});_0x12806e[_0x60de('0x3b')]=_['keys'](db[_0x60de('0x5b')][_0x60de('0x34')]);_0x12806e[_0x60de('0x38')]=_[_0x60de('0x39')](_0x3b9e67[_0x60de('0x38')]);_0x12806e[_0x60de('0x3a')]=_[_0x60de('0x4e')](_0x12806e['model'],_0x12806e['query']);_0x993585[_0x60de('0x3d')]=_[_0x60de('0x4e')](_0x12806e['model'],qs[_0x60de('0x3c')](_0x3b9e67[_0x60de('0x38')][_0x60de('0x3c')]));_0x993585[_0x60de('0x3d')]=_0x993585[_0x60de('0x3d')]['length']?_0x993585[_0x60de('0x3d')]:_0x12806e['model'];if(!_0x3b9e67[_0x60de('0x38')][_0x60de('0x3f')]('nolimit')){_0x993585[_0x60de('0x24')]=qs['limit'](_0x3b9e67[_0x60de('0x38')][_0x60de('0x24')]);_0x993585['offset']=qs[_0x60de('0x23')](_0x3b9e67[_0x60de('0x38')]['offset']);}_0x993585['order']=qs[_0x60de('0x42')](_0x3b9e67[_0x60de('0x38')][_0x60de('0x42')]);_0x993585[_0x60de('0x43')]=qs['filters'](_[_0x60de('0x44')](_0x3b9e67[_0x60de('0x38')],_0x12806e['filters']));_0x993585[_0x60de('0x43')]['FaxQueueId']=_0x491065['id'];if(_0x3b9e67[_0x60de('0x38')][_0x60de('0x45')]){_0x993585['where']=_[_0x60de('0x46')](_0x993585[_0x60de('0x43')],{'$or':_['map'](_0x993585[_0x60de('0x3d')],function(_0x3cf8d6){var _0x2b7c98={};_0x2b7c98[_0x3cf8d6]={'$like':'%'+_0x3b9e67[_0x60de('0x38')][_0x60de('0x45')]+'%'};return _0x2b7c98;})});}_0x993585=_[_0x60de('0x46')]({},_0x993585,_0x3b9e67['options']);return db[_0x60de('0x5b')][_0x60de('0x49')](_0x993585);}})[_0x60de('0x2e')](function(_0x4dcc07){if(_0x4dcc07){return db[_0x60de('0x5c')]['findAndCountAll']({'where':{'id':_['map'](_0x4dcc07,_0x60de('0x5d')),'role':_0x60de('0x5e')},'attributes':['id','name',_0x60de('0x5f'),_0x60de('0x60'),_0x60de('0x61')]});}})[_0x60de('0x2e')](function(_0x26b047){if(_0x26b047){return{'count':_0x26b047['count'],'rows':_[_0x60de('0x37')](_0x26b047[_0x60de('0x4a')],function(_0x70a4f2){return{'membername':_0x70a4f2[_0x60de('0x30')],'UserId':_0x70a4f2['id'],'queue_name':_0x3afccf[_0x60de('0x30')],'FaxQueueId':_0x3afccf['id'],'interface':util[_0x60de('0x62')](_0x60de('0x63'),_0x60de('0x64'),_0x70a4f2[_0x60de('0x30')]),'penalty':0x0,'paused':_0x70a4f2[_0x60de('0x5f')],'createdAt':_0x70a4f2[_0x60de('0x61')],'updatedAt':_0x70a4f2[_0x60de('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x60de('0x2e')](respondWithFilteredResult(_0x94e470,_0x993585))[_0x60de('0x4b')](handleError(_0x94e470,null));};exports[_0x60de('0x65')]=function(_0x473c48,_0x2e6c39,_0x48d812){var _0x959c01={};var _0x395b83={};var _0x561bdd;var _0x46f22b;return db[_0x60de('0x33')][_0x60de('0x5a')]({'where':{'id':_0x473c48[_0x60de('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2e6c39,null))[_0x60de('0x2e')](function(_0x49a586){if(_0x49a586){_0x561bdd=_0x49a586;_0x395b83[_0x60de('0x3b')]=_[_0x60de('0x39')](db['Team']['rawAttributes']);_0x395b83[_0x60de('0x38')]=_[_0x60de('0x39')](_0x473c48[_0x60de('0x38')]);_0x395b83['filters']=_[_0x60de('0x4e')](_0x395b83[_0x60de('0x3b')],_0x395b83[_0x60de('0x38')]);_0x959c01[_0x60de('0x3d')]=_[_0x60de('0x4e')](_0x395b83[_0x60de('0x3b')],qs['fields'](_0x473c48[_0x60de('0x38')][_0x60de('0x3c')]));_0x959c01['attributes']=_0x959c01['attributes']['length']?_0x959c01['attributes']:_0x395b83[_0x60de('0x3b')];_0x959c01[_0x60de('0x41')]=qs['sort'](_0x473c48[_0x60de('0x38')][_0x60de('0x42')]);_0x959c01[_0x60de('0x43')]=qs[_0x60de('0x3a')](_['pick'](_0x473c48[_0x60de('0x38')],_0x395b83[_0x60de('0x3a')]));if(_0x473c48[_0x60de('0x38')][_0x60de('0x45')]){_0x959c01[_0x60de('0x43')]=_[_0x60de('0x46')](_0x959c01[_0x60de('0x43')],{'$or':_[_0x60de('0x37')](_0x959c01[_0x60de('0x3d')],function(_0x1dcef9){var _0x57c602={};_0x57c602[_0x1dcef9]={'$like':'%'+_0x473c48[_0x60de('0x38')][_0x60de('0x45')]+'%'};return _0x57c602;})});}_0x959c01=_[_0x60de('0x46')]({},_0x959c01,_0x473c48['options']);return _0x561bdd[_0x60de('0x65')](_0x959c01);}})[_0x60de('0x2e')](function(_0x4660e2){if(_0x4660e2){_0x46f22b=_0x4660e2[_0x60de('0x3e')];if(!_0x473c48[_0x60de('0x38')]['hasOwnProperty'](_0x60de('0x40'))){_0x959c01['limit']=qs[_0x60de('0x24')](_0x473c48[_0x60de('0x38')][_0x60de('0x24')]);_0x959c01[_0x60de('0x23')]=qs[_0x60de('0x23')](_0x473c48[_0x60de('0x38')][_0x60de('0x23')]);}return _0x561bdd[_0x60de('0x65')](_0x959c01);}})['then'](function(_0x6f5df5){if(_0x6f5df5){return _0x6f5df5?{'count':_0x46f22b,'rows':_0x6f5df5}:null;}})[_0x60de('0x2e')](respondWithResult(_0x2e6c39,null))[_0x60de('0x4b')](handleError(_0x2e6c39,null));};exports[_0x60de('0x66')]=function(_0x3ad6eb,_0x30d14f,_0x3920ee){var _0x23799f=_0x3ad6eb[_0x60de('0x51')][_0x60de('0x67')];return db[_0x60de('0x68')][_0x60de('0x49')]({'where':{'id':_0x23799f},'attributes':['id'],'include':[{'model':db[_0x60de('0x5c')],'as':_0x60de('0x69'),'attributes':['id',_0x60de('0x30'),_0x60de('0x6a'),_0x60de('0x6b'),_0x60de('0x6c')],'raw':!![]}]})[_0x60de('0x2e')](function(_0x5a8c4a){if(_0x5a8c4a){var _0x339804=_[_0x60de('0x6d')](_0x5a8c4a,function(_0x2850c5){var _0x170c35=_0x2850c5[_0x60de('0x2c')]({'plain':!![]});return _0x170c35[_0x60de('0x69')];});return db['FaxQueue'][_0x60de('0x4f')]({'where':{'id':_0x3ad6eb['params']['id']}})['then'](function(_0x45b409){return db[_0x60de('0x6e')][_0x60de('0x6f')](function(_0x4bfd16){return _0x45b409[_0x60de('0x66')](_0x23799f,{'transaction':_0x4bfd16})[_0x60de('0x2e')](function(){return BPromise[_0x60de('0x70')](_0x339804,function(_0x496f8d){return db[_0x60de('0x5b')][_0x60de('0x71')]({'where':{'UserId':_0x496f8d['id'],'FaxQueueId':_0x3ad6eb[_0x60de('0x4d')]['id']},'transaction':_0x4bfd16});});})['then'](function(){_0x339804[_0x60de('0x72')](function(_0x200039){socket[_0x60de('0x73')](_0x60de('0x74'),{'UserId':_0x200039['id'],'FaxQueueId':_0x45b409['id']});});});});});}})[_0x60de('0x2e')](respondWithStatusCode(_0x30d14f,null))[_0x60de('0x4b')](handleError(_0x30d14f,null));};exports['removeTeams']=function(_0xd90f24,_0x436cc7,_0x2be276){return db[_0x60de('0x68')]['findAll']({'where':{'id':_0xd90f24['query'][_0x60de('0x67')]},'attributes':['id'],'include':[{'model':db[_0x60de('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x436cc7,null))[_0x60de('0x2e')](function(_0x41008f){var _0x5c386c=_['map'](_0x41008f,'id');var _0x59bbc1=[];var _0x17485b=[];var _0x2fa604=squel[_0x60de('0x75')]();_0x2fa604['field'](_0x60de('0x76'))['from'](_0x60de('0x77'),'tq')['join']('user_has_teams','ut',_0x60de('0x78'))[_0x60de('0x43')](_0x60de('0x79'),_0xd90f24['params']['id']);for(var _0x3ef0a9=0x0;_0x3ef0a9<_0x41008f[_0x60de('0x3e')];_0x3ef0a9+=0x1){let _0x15be67=_0x41008f[_0x3ef0a9];for(var _0x21eb44=0x0;_0x21eb44<_0x15be67[_0x60de('0x69')]['length'];_0x21eb44+=0x1){let _0x42cee0=_0x15be67[_0x60de('0x69')][_0x21eb44];var _0x58c094=_0x2fa604[_0x60de('0x7a')]();_0x58c094['where'](_0x60de('0x7b'),_0x42cee0['id']);_0x17485b['push'](db[_0x60de('0x6e')][_0x60de('0x38')](_0x58c094[_0x60de('0x7c')](),{'type':db[_0x60de('0x6e')]['QueryTypes'][_0x60de('0x7d')]})[_0x60de('0x2e')](function(_0x1c0c3f){if(_0x1c0c3f[_0x60de('0x3e')]===0x1){return _0x42cee0['id'];}else{var _0x23a0f8=_['every'](_[_0x60de('0x37')](_0x1c0c3f,'TeamId'),function(_0x8986de){return _[_0x60de('0x7e')](_0x5c386c,_0x8986de);});if(_0x23a0f8){return _0x42cee0['id'];}}}));}}return BPromise[_0x60de('0x7f')](_0x17485b)[_0x60de('0x2e')](function(_0x2a24ad){_0x59bbc1=_(_0x59bbc1)[_0x60de('0x80')](_0x2a24ad)[_0x60de('0x81')]()[_0x60de('0x82')]();return db['FaxQueue'][_0x60de('0x4f')]({'where':{'id':_0xd90f24['params']['id']}})[_0x60de('0x2e')](function(_0x2f909b){return db[_0x60de('0x6e')]['transaction'](function(_0xc1a113){return _0x2f909b[_0x60de('0x83')](_0xd90f24[_0x60de('0x38')][_0x60de('0x67')],{'transaction':_0xc1a113})[_0x60de('0x2e')](function(){if(!_[_0x60de('0x84')](_0x59bbc1)){return _0x2f909b[_0x60de('0x85')](_0x59bbc1,{'transaction':_0xc1a113});}})['then'](function(){_0x59bbc1[_0x60de('0x72')](function(_0x35b4ff){socket[_0x60de('0x73')](_0x60de('0x86'),{'UserId':_0x35b4ff,'FaxQueueId':_0x2f909b['id']});});});});});});})[_0x60de('0x2e')](respondWithStatusCode(_0x436cc7,null))['catch'](handleError(_0x436cc7,null));};exports[_0x60de('0x87')]=function(_0x239787,_0x33fc31,_0x2fc568){return db[_0x60de('0x33')]['find']({'where':{'id':_0x239787[_0x60de('0x4d')]['id']}})['then'](handleEntityNotFound(_0x33fc31,null))['then'](function(_0x2e5329){if(_0x2e5329){return _0x2e5329[_0x60de('0x87')](_0x239787[_0x60de('0x51')][_0x60de('0x67')],_[_0x60de('0x88')](_0x239787[_0x60de('0x51')],[_0x60de('0x67'),'id'])||{})[_0x60de('0x89')](function(_0x17a271){for(var _0x3ee759=0x0;_0x3ee759<_0x239787[_0x60de('0x51')][_0x60de('0x67')][_0x60de('0x3e')];_0x3ee759+=0x1){socket[_0x60de('0x73')]('userFaxQueue:save',{'UserId':_0x239787[_0x60de('0x51')]['ids'][_0x3ee759],'FaxQueueId':_0x239787['params']['id']});}return _0x17a271;});}})[_0x60de('0x2e')](respondWithResult(_0x33fc31,null))[_0x60de('0x4b')](handleError(_0x33fc31,null));};exports['removeAgents']=function(_0x4494d8,_0xdadc5e,_0x428b67){return db[_0x60de('0x33')][_0x60de('0x4f')]({'where':{'id':_0x4494d8[_0x60de('0x4d')]['id']}})[_0x60de('0x2e')](handleEntityNotFound(_0xdadc5e,null))[_0x60de('0x2e')](function(_0x5daa9c){if(_0x5daa9c){return _0x5daa9c['removeAgents'](_0x4494d8[_0x60de('0x38')][_0x60de('0x67')])['then'](function(){if(_[_0x60de('0x8a')](_0x4494d8[_0x60de('0x38')][_0x60de('0x67')])){for(var _0x232742=0x0;_0x232742<_0x4494d8['query'][_0x60de('0x67')][_0x60de('0x3e')];_0x232742+=0x1){socket[_0x60de('0x73')]('userFaxQueue:remove',{'UserId':Number(_0x4494d8[_0x60de('0x38')][_0x60de('0x67')][_0x232742]),'FaxQueueId':Number(_0x4494d8[_0x60de('0x4d')]['id'])});}}else{socket[_0x60de('0x73')](_0x60de('0x86'),{'UserId':Number(_0x4494d8['query'][_0x60de('0x67')]),'FaxQueueId':Number(_0x4494d8[_0x60de('0x4d')]['id'])});}});}})[_0x60de('0x2e')](respondWithStatusCode(_0xdadc5e,null))[_0x60de('0x4b')](handleError(_0xdadc5e,null));};exports[_0x60de('0x8b')]=function(_0x21d678,_0x4d5323,_0x1e6a9d){var _0x3c76ba={};var _0x9e1d51={};var _0x111b52;var _0x4e7780;return db['FaxQueue'][_0x60de('0x5a')]({'where':{'id':_0x21d678[_0x60de('0x4d')]['id']}})[_0x60de('0x2e')](handleEntityNotFound(_0x4d5323,null))[_0x60de('0x2e')](function(_0x7b4399){if(_0x7b4399){_0x111b52=_0x7b4399;_0x9e1d51[_0x60de('0x3b')]=_[_0x60de('0x39')](db[_0x60de('0x5c')][_0x60de('0x34')]);_0x9e1d51['query']=_[_0x60de('0x39')](_0x21d678[_0x60de('0x38')]);_0x9e1d51[_0x60de('0x3a')]=_['intersection'](_0x9e1d51['model'],_0x9e1d51[_0x60de('0x38')]);_0x3c76ba[_0x60de('0x3d')]=_[_0x60de('0x4e')](_0x9e1d51[_0x60de('0x3b')],qs[_0x60de('0x3c')](_0x21d678[_0x60de('0x38')][_0x60de('0x3c')]));_0x3c76ba[_0x60de('0x3d')]=_0x3c76ba[_0x60de('0x3d')][_0x60de('0x3e')]?_0x3c76ba[_0x60de('0x3d')]:_0x9e1d51['model'];_0x3c76ba[_0x60de('0x41')]=qs[_0x60de('0x42')](_0x21d678[_0x60de('0x38')][_0x60de('0x42')]);_0x3c76ba[_0x60de('0x43')]=qs[_0x60de('0x3a')](_[_0x60de('0x44')](_0x21d678[_0x60de('0x38')],_0x9e1d51[_0x60de('0x3a')]));if(_0x21d678[_0x60de('0x38')][_0x60de('0x45')]){_0x3c76ba[_0x60de('0x43')]=_[_0x60de('0x46')](_0x3c76ba[_0x60de('0x43')],{'$or':_[_0x60de('0x37')](_0x3c76ba[_0x60de('0x3d')],function(_0x2a47b8){var _0x2b02bc={};_0x2b02bc[_0x2a47b8]={'$like':'%'+_0x21d678['query'][_0x60de('0x45')]+'%'};return _0x2b02bc;})});}_0x3c76ba=_['merge']({},_0x3c76ba,_0x21d678[_0x60de('0x47')]);return _0x111b52[_0x60de('0x8b')](_0x3c76ba);}})['then'](function(_0x259448){if(_0x259448){_0x4e7780=_0x259448[_0x60de('0x3e')];if(!_0x21d678[_0x60de('0x38')]['hasOwnProperty']('nolimit')){_0x3c76ba['limit']=qs[_0x60de('0x24')](_0x21d678[_0x60de('0x38')][_0x60de('0x24')]);_0x3c76ba[_0x60de('0x23')]=qs['offset'](_0x21d678[_0x60de('0x38')][_0x60de('0x23')]);}return _0x111b52['getAgents'](_0x3c76ba);}})[_0x60de('0x2e')](function(_0x1edd8f){if(_0x1edd8f){return _0x1edd8f?{'count':_0x4e7780,'rows':_0x1edd8f}:null;}})[_0x60de('0x2e')](respondWithResult(_0x4d5323,null))[_0x60de('0x4b')](handleError(_0x4d5323,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index e7d3bfc..3580208 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 _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 +var _0x1d26=['../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0x1d26,0x19d));var _0x61d2=function(_0xf7f60a,_0x15f736){_0xf7f60a=_0xf7f60a-0x0;var _0x2567ad=_0x1d26[_0xf7f60a];return _0x2567ad;};'use strict';var EventEmitter=require(_0x61d2('0x0'));var FaxQueue=require(_0x61d2('0x1'))['db'][_0x61d2('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x61d2('0x3')](0x0);var events={'afterCreate':_0x61d2('0x4'),'afterUpdate':'update','afterDestroy':_0x61d2('0x5')};function emitEvent(_0x1f66c7){return function(_0x485de9,_0x5046a6,_0x3bb2f1){FaxQueueEvents[_0x61d2('0x6')](_0x1f66c7+':'+_0x485de9['id'],_0x485de9);FaxQueueEvents[_0x61d2('0x6')](_0x1f66c7,_0x485de9);_0x3bb2f1(null);};}for(var e in events){if(events[_0x61d2('0x7')](e)){var event=events[e];FaxQueue[_0x61d2('0x8')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index b389613..9c4233b 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 _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 +var _0x70ac=['fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes','define','FaxQueue'];(function(_0x41e2cc,_0x4b5aa5){var _0x5d2de9=function(_0x48c1be){while(--_0x48c1be){_0x41e2cc['push'](_0x41e2cc['shift']());}};_0x5d2de9(++_0x4b5aa5);}(_0x70ac,0x1ef));var _0xc70a=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x70ac[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0xc70a('0x0'));var util=require(_0xc70a('0x1'));var logger=require(_0xc70a('0x2'))(_0xc70a('0x3'));var moment=require(_0xc70a('0x4'));var BPromise=require(_0xc70a('0x5'));var rp=require(_0xc70a('0x6'));var fs=require('fs');var path=require(_0xc70a('0x7'));var rimraf=require(_0xc70a('0x8'));var config=require('../../config/environment');var attributes=require(_0xc70a('0x9'));module['exports']=function(_0x2c7507,_0x58fced){return _0x2c7507[_0xc70a('0xa')](_0xc70a('0xb'),attributes,{'tableName':_0xc70a('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 657668f..dd88007 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 _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 +var _0x65ad=['result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowFaxQueue','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./faxQueue.socket','register','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','FaxQueue,\x20%s,\x20%s','message'];(function(_0x20834a,_0x471f90){var _0x33da2d=function(_0x22a346){while(--_0x22a346){_0x20834a['push'](_0x20834a['shift']());}};_0x33da2d(++_0x471f90);}(_0x65ad,0x1a0));var _0xd65a=function(_0x2c1c4f,_0x157f5c){_0x2c1c4f=_0x2c1c4f-0x0;var _0x27334f=_0x65ad[_0x2c1c4f];return _0x27334f;};'use strict';var _=require(_0xd65a('0x0'));var util=require(_0xd65a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd65a('0x2'));var fs=require('fs');var Redis=require(_0xd65a('0x3'));var db=require(_0xd65a('0x4'))['db'];var utils=require(_0xd65a('0x5'));var logger=require(_0xd65a('0x6'))('rpc');var config=require(_0xd65a('0x7'));var jayson=require(_0xd65a('0x8'));var client=jayson[_0xd65a('0x9')][_0xd65a('0xa')]({'port':0x232a});config['redis']=_[_0xd65a('0xb')](config[_0xd65a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xd65a('0xd'))(new Redis(config['redis']));require(_0xd65a('0xe'))[_0xd65a('0xf')](socket);function respondWithRpcPromise(_0x4ecb21,_0x5c428c,_0x1791b2){return new BPromise(function(_0x6a4a99,_0x92f0c){return client['request'](_0x4ecb21,_0x1791b2)[_0xd65a('0x10')](function(_0x25d590){logger[_0xd65a('0x11')]('FaxQueue,\x20%s,\x20%s',_0x5c428c,_0xd65a('0x12'));logger[_0xd65a('0x13')](_0xd65a('0x14'),_0x5c428c,_0xd65a('0x12'),JSON['stringify'](_0x25d590));if(_0x25d590[_0xd65a('0x15')]){if(_0x25d590[_0xd65a('0x15')]['code']===0x1f4){logger[_0xd65a('0x15')](_0xd65a('0x16'),_0x5c428c,_0x25d590[_0xd65a('0x15')][_0xd65a('0x17')]);return _0x92f0c(_0x25d590[_0xd65a('0x15')][_0xd65a('0x17')]);}logger[_0xd65a('0x15')](_0xd65a('0x16'),_0x5c428c,_0x25d590['error'][_0xd65a('0x17')]);return _0x6a4a99(_0x25d590[_0xd65a('0x15')]['message']);}else{logger[_0xd65a('0x11')]('FaxQueue,\x20%s,\x20%s',_0x5c428c,_0xd65a('0x12'));_0x6a4a99(_0x25d590[_0xd65a('0x18')]['message']);}})[_0xd65a('0x19')](function(_0x1fc30b){logger[_0xd65a('0x15')](_0xd65a('0x16'),_0x5c428c,_0x1fc30b);_0x92f0c(_0x1fc30b);});});}exports[_0xd65a('0x1a')]=function(_0x12cd4d){var _0x27ae19=this;return new Promise(function(_0x389454,_0x1f202c){return db[_0xd65a('0x1b')][_0xd65a('0x1c')]({'raw':_0x12cd4d['options']?_0x12cd4d[_0xd65a('0x1d')][_0xd65a('0x1e')]===undefined?!![]:![]:!![],'where':_0x12cd4d[_0xd65a('0x1d')]?_0x12cd4d[_0xd65a('0x1d')][_0xd65a('0x1f')]||null:null,'attributes':_0x12cd4d['options']?_0x12cd4d['options'][_0xd65a('0x20')]||null:null,'limit':_0x12cd4d[_0xd65a('0x1d')]?_0x12cd4d['options'][_0xd65a('0x21')]||null:null,'include':_0x12cd4d[_0xd65a('0x1d')]?_0x12cd4d[_0xd65a('0x1d')][_0xd65a('0x22')]?_[_0xd65a('0x23')](_0x12cd4d[_0xd65a('0x1d')][_0xd65a('0x22')],function(_0x31ce10){return{'model':db[_0x31ce10[_0xd65a('0x24')]],'as':_0x31ce10['as'],'attributes':_0x31ce10['attributes'],'include':_0x31ce10['include']?_[_0xd65a('0x23')](_0x31ce10[_0xd65a('0x22')],function(_0x1eb2a1){return{'model':db[_0x1eb2a1[_0xd65a('0x24')]],'as':_0x1eb2a1['as'],'attributes':_0x1eb2a1[_0xd65a('0x20')],'include':_0x1eb2a1[_0xd65a('0x22')]?_[_0xd65a('0x23')](_0x1eb2a1['include'],function(_0x9d59e8){return{'model':db[_0x9d59e8[_0xd65a('0x24')]],'as':_0x9d59e8['as'],'attributes':_0x9d59e8[_0xd65a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd65a('0x10')](function(_0x18a51c){logger['info'](_0xd65a('0x1a'),_0x12cd4d);logger['debug']('GetFaxQueue',_0x12cd4d,JSON[_0xd65a('0x25')](_0x18a51c));_0x389454(_0x18a51c);})[_0xd65a('0x19')](function(_0x53c3b9){logger[_0xd65a('0x15')](_0xd65a('0x1a'),_0x53c3b9['message'],_0x12cd4d);_0x1f202c(_0x27ae19['error'](0x1f4,_0x53c3b9['message']));});});};exports[_0xd65a('0x26')]=function(_0x8272ab){var _0x5bf2f3=this;return new Promise(function(_0x494ae7,_0xbca1d5){return db[_0xd65a('0x1b')][_0xd65a('0x27')]({'raw':_0x8272ab['options']?_0x8272ab[_0xd65a('0x1d')][_0xd65a('0x1e')]===undefined?!![]:![]:!![],'where':_0x8272ab['options']?_0x8272ab[_0xd65a('0x1d')][_0xd65a('0x1f')]||null:null,'attributes':_0x8272ab[_0xd65a('0x1d')]?_0x8272ab[_0xd65a('0x1d')][_0xd65a('0x20')]||null:null,'include':_0x8272ab['options']?_0x8272ab[_0xd65a('0x1d')][_0xd65a('0x22')]?_['map'](_0x8272ab[_0xd65a('0x1d')][_0xd65a('0x22')],function(_0x6cc2bb){return{'model':db[_0x6cc2bb[_0xd65a('0x24')]],'as':_0x6cc2bb['as'],'attributes':_0x6cc2bb['attributes'],'include':_0x6cc2bb[_0xd65a('0x22')]?_['map'](_0x6cc2bb[_0xd65a('0x22')],function(_0x22d386){return{'model':db[_0x22d386['model']],'as':_0x22d386['as'],'attributes':_0x22d386[_0xd65a('0x20')],'include':_0x22d386[_0xd65a('0x22')]?_[_0xd65a('0x23')](_0x22d386['include'],function(_0x12c4ae){return{'model':db[_0x12c4ae[_0xd65a('0x24')]],'as':_0x12c4ae['as'],'attributes':_0x12c4ae[_0xd65a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd65a('0x10')](function(_0x86ec5){logger[_0xd65a('0x11')](_0xd65a('0x26'),_0x8272ab);logger[_0xd65a('0x13')](_0xd65a('0x26'),_0x8272ab,JSON['stringify'](_0x86ec5));_0x494ae7(_0x86ec5);})[_0xd65a('0x19')](function(_0x309aef){logger[_0xd65a('0x15')](_0xd65a('0x26'),_0x309aef[_0xd65a('0x17')],_0x8272ab);_0xbca1d5(_0x5bf2f3[_0xd65a('0x15')](0x1f4,_0x309aef[_0xd65a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 08e21f1..6281dd0 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 _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 +var _0xf19b=['removeListener','length','faxQueue:','./faxQueue.events','save','update'];(function(_0x540160,_0x24c6b6){var _0x476120=function(_0x28046c){while(--_0x28046c){_0x540160['push'](_0x540160['shift']());}};_0x476120(++_0x24c6b6);}(_0xf19b,0x1e3));var _0xbf19=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xf19b[_0x4d8ed9];return _0x1e2140;};'use strict';var FaxQueueEvents=require(_0xbf19('0x0'));var events=[_0xbf19('0x1'),'remove',_0xbf19('0x2')];function createListener(_0x50f14a,_0x11e00f){return function(_0x283324){_0x11e00f['emit'](_0x50f14a,_0x283324);};}function removeListener(_0x596fee,_0x46a78e){return function(){FaxQueueEvents[_0xbf19('0x3')](_0x596fee,_0x46a78e);};}exports['register']=function(_0x1bfab8){for(var _0x15c3bd=0x0,_0x1d12bd=events[_0xbf19('0x4')];_0x15c3bd<_0x1d12bd;_0x15c3bd++){var _0x2f0d87=events[_0x15c3bd];var _0x2c0dad=createListener(_0xbf19('0x5')+_0x2f0d87,_0x1bfab8);FaxQueueEvents['on'](_0x2f0d87,_0x2c0dad);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 97f707a..6eb57e8 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 _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 +var _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x39a04c,_0x2b4002){_0x39a04c=_0x39a04c-0x0;var _0x580cb0=_0x0b0e[_0x39a04c];return _0x580cb0;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 51a7989..5be41c0 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 _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 +var _0x8ca9=['STRING','DATE','sequelize'];(function(_0x2c2e43,_0x4ac6a9){var _0x37d45c=function(_0x1468f4){while(--_0x1468f4){_0x2c2e43['push'](_0x2c2e43['shift']());}};_0x37d45c(++_0x4ac6a9);}(_0x8ca9,0xbc));var _0x98ca=function(_0x48246c,_0x4db4e8){_0x48246c=_0x48246c-0x0;var _0x3e4397=_0x8ca9[_0x48246c];return _0x3e4397;};'use strict';var moment=require('moment');var Sequelize=require(_0x98ca('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x98ca('0x1')]},'joinAt':{'type':Sequelize[_0x98ca('0x2')]},'leaveAt':{'type':Sequelize[_0x98ca('0x2')]},'acceptAt':{'type':Sequelize[_0x98ca('0x2')]},'exitAt':{'type':Sequelize[_0x98ca('0x2')]},'reason':{'type':Sequelize[_0x98ca('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 8f96c6c..681c59b 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 _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 +var _0x71d0=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','order','sort','merge','VIRTUAL','filter','options','where','findAll','rows','catch','show','params','include','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x171ebb,_0x373b0){var _0x5ea0a6=function(_0x1e4de6){while(--_0x1e4de6){_0x171ebb['push'](_0x171ebb['shift']());}};_0x5ea0a6(++_0x373b0);}(_0x71d0,0x198));var _0x071d=function(_0x59ad3b,_0xf3887a){_0x59ad3b=_0x59ad3b-0x0;var _0xe312d=_0x71d0[_0x59ad3b];return _0xe312d;};'use strict';var pdf=require(_0x071d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x071d('0x1'));var zipdir=require(_0x071d('0x2'));var jsonpatch=require(_0x071d('0x3'));var rp=require(_0x071d('0x4'));var moment=require(_0x071d('0x5'));var BPromise=require(_0x071d('0x6'));var Mustache=require(_0x071d('0x7'));var util=require('util');var path=require(_0x071d('0x8'));var sox=require('sox');var csv=require(_0x071d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x071d('0xa'));var squel=require(_0x071d('0xb'));var crypto=require(_0x071d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x071d('0xd'));var toCsv=require(_0x071d('0x9'));var querystring=require(_0x071d('0xe'));var Papa=require(_0x071d('0xf'));var Redis=require(_0x071d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x071d('0x11'));var as=require(_0x071d('0x12'));var hardwareService=require(_0x071d('0x13'));var logger=require(_0x071d('0x14'))(_0x071d('0x15'));var utils=require(_0x071d('0x16'));var config=require(_0x071d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x071d('0x18'))['db'];function respondWithStatusCode(_0x2fe7ca,_0x5eee43){_0x5eee43=_0x5eee43||0xcc;return function(_0x2d122f){if(_0x2d122f){return _0x2fe7ca[_0x071d('0x19')](_0x5eee43);}return _0x2fe7ca[_0x071d('0x1a')](_0x5eee43)[_0x071d('0x1b')]();};}function respondWithResult(_0x34764f,_0x465c57){_0x465c57=_0x465c57||0xc8;return function(_0x25a5b5){if(_0x25a5b5){return _0x34764f[_0x071d('0x1a')](_0x465c57)[_0x071d('0x1c')](_0x25a5b5);}};}function respondWithFilteredResult(_0x50ddbf,_0x3f70ef){return function(_0x59a51d){if(_0x59a51d){var _0x286688=_0x59a51d[_0x071d('0x1d')],_0x482d79=_0x3f70ef[_0x071d('0x1e')],_0x2b86af=_0x3f70ef[_0x071d('0x1e')]+_0x3f70ef[_0x071d('0x1f')],_0x9d9148;if(_0x2b86af>=_0x286688){_0x2b86af=_0x286688;_0x9d9148=0xc8;}else{_0x9d9148=0xce;}_0x50ddbf[_0x071d('0x1a')](_0x9d9148);return _0x50ddbf[_0x071d('0x20')](_0x071d('0x21'),_0x482d79+'-'+_0x2b86af+'/'+_0x286688)['json'](_0x59a51d);}return null;};}function patchUpdates(_0x2372a1){return function(_0x2ce8b5){try{jsonpatch[_0x071d('0x22')](_0x2ce8b5,_0x2372a1,!![]);}catch(_0x21030b){return BPromise['reject'](_0x21030b);}return _0x2ce8b5[_0x071d('0x23')]();};}function saveUpdates(_0x16082b,_0x2605a7){return function(_0x41445f){if(_0x41445f){return _0x41445f[_0x071d('0x24')](_0x16082b)[_0x071d('0x25')](function(_0x5b4acf){return _0x5b4acf;});}return null;};}function removeEntity(_0x5ac456,_0x3fdbde){return function(_0x8a428f){if(_0x8a428f){return _0x8a428f['destroy']()[_0x071d('0x25')](function(){_0x5ac456['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52205c,_0x557e31){return function(_0x4c502b){if(!_0x4c502b){_0x52205c[_0x071d('0x19')](0x194);}return _0x4c502b;};}function handleError(_0x152a77,_0x3f68e7){_0x3f68e7=_0x3f68e7||0x1f4;return function(_0x1f1019){logger['error'](_0x1f1019[_0x071d('0x26')]);if(_0x1f1019[_0x071d('0x27')]){delete _0x1f1019[_0x071d('0x27')];}_0x152a77[_0x071d('0x1a')](_0x3f68e7)['send'](_0x1f1019);};}exports[_0x071d('0x28')]=function(_0x53b12b,_0x4f3404){var _0x32355d={},_0x235325={},_0x3a0b62={'count':0x0,'rows':[]};var _0x349ba6=_[_0x071d('0x29')](db[_0x071d('0x2a')][_0x071d('0x2b')],function(_0x1ebb31){return{'name':_0x1ebb31[_0x071d('0x2c')],'type':_0x1ebb31[_0x071d('0x2d')]['key']};});_0x235325['model']=_['map'](_0x349ba6,_0x071d('0x27'));_0x235325[_0x071d('0x2e')]=_[_0x071d('0x2f')](_0x53b12b[_0x071d('0x2e')]);_0x235325[_0x071d('0x30')]=_[_0x071d('0x31')](_0x235325['model'],_0x235325[_0x071d('0x2e')]);_0x32355d['attributes']=_[_0x071d('0x31')](_0x235325[_0x071d('0x32')],qs[_0x071d('0x33')](_0x53b12b[_0x071d('0x2e')]['fields']));_0x32355d[_0x071d('0x34')]=_0x32355d[_0x071d('0x34')][_0x071d('0x35')]?_0x32355d[_0x071d('0x34')]:_0x235325['model'];if(!_0x53b12b['query']['hasOwnProperty']('nolimit')){_0x32355d[_0x071d('0x1f')]=qs[_0x071d('0x1f')](_0x53b12b[_0x071d('0x2e')][_0x071d('0x1f')]);_0x32355d[_0x071d('0x1e')]=qs[_0x071d('0x1e')](_0x53b12b[_0x071d('0x2e')][_0x071d('0x1e')]);}_0x32355d[_0x071d('0x36')]=qs[_0x071d('0x37')](_0x53b12b[_0x071d('0x2e')][_0x071d('0x37')]);_0x32355d['where']=qs[_0x071d('0x30')](_['pick'](_0x53b12b['query'],_0x235325[_0x071d('0x30')]),_0x349ba6);if(_0x53b12b['query']['filter']){_0x32355d['where']=_[_0x071d('0x38')](_0x32355d['where'],{'$or':_[_0x071d('0x29')](_0x349ba6,function(_0x42a627){if(_0x42a627[_0x071d('0x2d')]!==_0x071d('0x39')){var _0x3fa11c={};_0x3fa11c[_0x42a627[_0x071d('0x27')]]={'$like':'%'+_0x53b12b[_0x071d('0x2e')][_0x071d('0x3a')]+'%'};return _0x3fa11c;}})});}_0x32355d=_['merge']({},_0x32355d,_0x53b12b[_0x071d('0x3b')]);var _0x422817={'where':_0x32355d[_0x071d('0x3c')]};return db[_0x071d('0x2a')][_0x071d('0x1d')](_0x422817)[_0x071d('0x25')](function(_0x5cfdfa){_0x3a0b62[_0x071d('0x1d')]=_0x5cfdfa;if(_0x53b12b[_0x071d('0x2e')]['includeAll']){_0x32355d['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0x071d('0x3d')](_0x32355d);})[_0x071d('0x25')](function(_0x5c9565){_0x3a0b62[_0x071d('0x3e')]=_0x5c9565;return _0x3a0b62;})[_0x071d('0x25')](respondWithFilteredResult(_0x4f3404,_0x32355d))[_0x071d('0x3f')](handleError(_0x4f3404,null));};exports[_0x071d('0x40')]=function(_0x128a4a,_0x24976e){var _0x14ec01={'raw':!![],'where':{'id':_0x128a4a[_0x071d('0x41')]['id']}},_0x2fb894={};_0x2fb894[_0x071d('0x32')]=_['keys'](db[_0x071d('0x2a')][_0x071d('0x2b')]);_0x2fb894['query']=_[_0x071d('0x2f')](_0x128a4a['query']);_0x2fb894[_0x071d('0x30')]=_[_0x071d('0x31')](_0x2fb894[_0x071d('0x32')],_0x2fb894[_0x071d('0x2e')]);_0x14ec01[_0x071d('0x34')]=_[_0x071d('0x31')](_0x2fb894[_0x071d('0x32')],qs[_0x071d('0x33')](_0x128a4a['query'][_0x071d('0x33')]));_0x14ec01[_0x071d('0x34')]=_0x14ec01[_0x071d('0x34')]['length']?_0x14ec01['attributes']:_0x2fb894['model'];if(_0x128a4a[_0x071d('0x2e')]['includeAll']){_0x14ec01[_0x071d('0x42')]=[{'all':!![]}];}_0x14ec01=_['merge']({},_0x14ec01,_0x128a4a['options']);return db[_0x071d('0x2a')]['find'](_0x14ec01)[_0x071d('0x25')](handleEntityNotFound(_0x24976e,null))[_0x071d('0x25')](respondWithResult(_0x24976e,null))[_0x071d('0x3f')](handleError(_0x24976e,null));};exports[_0x071d('0x43')]=function(_0x17cd51,_0x4e9d3f){return db[_0x071d('0x2a')]['create'](_0x17cd51['body'],{})[_0x071d('0x25')](respondWithResult(_0x4e9d3f,0xc9))['catch'](handleError(_0x4e9d3f,null));};exports[_0x071d('0x24')]=function(_0x44b077,_0xfcb34a){if(_0x44b077[_0x071d('0x44')]['id']){delete _0x44b077['body']['id'];}return db[_0x071d('0x2a')][_0x071d('0x45')]({'where':{'id':_0x44b077[_0x071d('0x41')]['id']}})[_0x071d('0x25')](handleEntityNotFound(_0xfcb34a,null))[_0x071d('0x25')](saveUpdates(_0x44b077[_0x071d('0x44')],null))['then'](respondWithResult(_0xfcb34a,null))[_0x071d('0x3f')](handleError(_0xfcb34a,null));};exports['destroy']=function(_0x213433,_0x31c1a2){return db['FaxQueueReport'][_0x071d('0x45')]({'where':{'id':_0x213433['params']['id']}})[_0x071d('0x25')](handleEntityNotFound(_0x31c1a2,null))['then'](removeEntity(_0x31c1a2,null))[_0x071d('0x3f')](handleError(_0x31c1a2,null));};exports[_0x071d('0x46')]=function(_0x2aeed4,_0x15dd55){return db['FaxQueueReport']['describe']()[_0x071d('0x25')](respondWithResult(_0x15dd55,null))['catch'](handleError(_0x15dd55,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 1927b63..8435e1e 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 _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 +var _0xc13c=['bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x5d62ae,_0x14c2e2){var _0x4808ef=function(_0x1f0400){while(--_0x1f0400){_0x5d62ae['push'](_0x5d62ae['shift']());}};_0x4808ef(++_0x14c2e2);}(_0xc13c,0x188));var _0xcc13=function(_0x41b6df,_0x5e2a2b){_0x41b6df=_0x41b6df-0x0;var _0x1c3a84=_0xc13c[_0x41b6df];return _0x1c3a84;};'use strict';var _=require(_0xcc13('0x0'));var util=require('util');var logger=require(_0xcc13('0x1'))(_0xcc13('0x2'));var moment=require(_0xcc13('0x3'));var BPromise=require(_0xcc13('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc13('0x5'));var rimraf=require(_0xcc13('0x6'));var config=require(_0xcc13('0x7'));var attributes=require(_0xcc13('0x8'));module[_0xcc13('0x9')]=function(_0x574a46,_0x5ae127){return _0x574a46['define']('FaxQueueReport',attributes,{'tableName':_0xcc13('0xa'),'paranoid':![],'indexes':[{'name':_0xcc13('0xb'),'fields':[_0xcc13('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index f7ae2c7..26bfecc 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 _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 +var _0xbfb7=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','CreateFaxQueueReport','FaxQueueReport','create','body','options','catch','UpdateFaxQueueReport','update','raw','where','attributes','info','lodash','moment'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xbfb7,0x9e));var _0x7bfb=function(_0x18aaaf,_0x385db6){_0x18aaaf=_0x18aaaf-0x0;var _0x52d892=_0xbfb7[_0x18aaaf];return _0x52d892;};'use strict';var _=require(_0x7bfb('0x0'));var util=require('util');var moment=require(_0x7bfb('0x1'));var BPromise=require('bluebird');var rs=require(_0x7bfb('0x2'));var fs=require('fs');var Redis=require(_0x7bfb('0x3'));var db=require(_0x7bfb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7bfb('0x5'))(_0x7bfb('0x6'));var config=require(_0x7bfb('0x7'));var jayson=require(_0x7bfb('0x8'));var client=jayson['client'][_0x7bfb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27ff63,_0x20daa2,_0x175b83){return new BPromise(function(_0x2b1eed,_0x304896){return client[_0x7bfb('0xa')](_0x27ff63,_0x175b83)[_0x7bfb('0xb')](function(_0x3c15a8){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x20daa2,'request\x20sent');logger[_0x7bfb('0xc')](_0x7bfb('0xd'),_0x20daa2,_0x7bfb('0xe'),JSON[_0x7bfb('0xf')](_0x3c15a8));if(_0x3c15a8[_0x7bfb('0x10')]){if(_0x3c15a8[_0x7bfb('0x10')][_0x7bfb('0x11')]===0x1f4){logger[_0x7bfb('0x10')](_0x7bfb('0x12'),_0x20daa2,_0x3c15a8[_0x7bfb('0x10')][_0x7bfb('0x13')]);return _0x304896(_0x3c15a8[_0x7bfb('0x10')][_0x7bfb('0x13')]);}logger[_0x7bfb('0x10')](_0x7bfb('0x12'),_0x20daa2,_0x3c15a8[_0x7bfb('0x10')][_0x7bfb('0x13')]);return _0x2b1eed(_0x3c15a8['error']['message']);}else{logger['info'](_0x7bfb('0x12'),_0x20daa2,_0x7bfb('0xe'));_0x2b1eed(_0x3c15a8['result'][_0x7bfb('0x13')]);}})['catch'](function(_0x46b973){logger['error'](_0x7bfb('0x12'),_0x20daa2,_0x46b973);_0x304896(_0x46b973);});});}exports[_0x7bfb('0x14')]=function(_0x5372f1){var _0x570479=this;return new Promise(function(_0x33a2bf,_0x33a053){return db[_0x7bfb('0x15')][_0x7bfb('0x16')](_0x5372f1[_0x7bfb('0x17')],{'raw':_0x5372f1['options']?_0x5372f1[_0x7bfb('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4eba47){logger['info']('CreateFaxQueueReport',_0x5372f1);logger['debug'](_0x7bfb('0x14'),_0x5372f1,JSON['stringify'](_0x4eba47));_0x33a2bf(_0x4eba47);})[_0x7bfb('0x19')](function(_0x38cfc4){logger[_0x7bfb('0x10')]('CreateFaxQueueReport',_0x38cfc4['message'],_0x5372f1);_0x33a053(_0x570479[_0x7bfb('0x10')](0x1f4,_0x38cfc4[_0x7bfb('0x13')]));});});};exports[_0x7bfb('0x1a')]=function(_0x1395a3){var _0x3233d0=this;return new Promise(function(_0x397621,_0x485f84){return db['FaxQueueReport'][_0x7bfb('0x1b')](_0x1395a3['body'],{'raw':_0x1395a3[_0x7bfb('0x18')]?_0x1395a3['options'][_0x7bfb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1395a3[_0x7bfb('0x18')]?_0x1395a3[_0x7bfb('0x18')][_0x7bfb('0x1d')]||null:null,'attributes':_0x1395a3[_0x7bfb('0x18')]?_0x1395a3[_0x7bfb('0x18')][_0x7bfb('0x1e')]||null:null,'limit':_0x1395a3['options']?_0x1395a3[_0x7bfb('0x18')]['limit']||null:null})['then'](function(_0x2515a3){logger[_0x7bfb('0x1f')](_0x7bfb('0x1a'),_0x1395a3);logger['debug']('UpdateFaxQueueReport',_0x1395a3,JSON[_0x7bfb('0xf')](_0x2515a3));_0x397621(_0x2515a3);})['catch'](function(_0x3d55bb){logger[_0x7bfb('0x10')](_0x7bfb('0x1a'),_0x3d55bb[_0x7bfb('0x13')],_0x1395a3);_0x485f84(_0x3233d0['error'](0x1f4,_0x3d55bb[_0x7bfb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 74881cb..783922d 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 _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 +var _0x4203=['delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x56720e,_0x3d46a5){var _0x2570b8=function(_0x1fc8d9){while(--_0x1fc8d9){_0x56720e['push'](_0x56720e['shift']());}};_0x2570b8(++_0x3d46a5);}(_0x4203,0xae));var _0x3420=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x4203[_0x4b7b62];return _0x2280df;};'use strict';var multer=require(_0x3420('0x0'));var util=require('util');var path=require(_0x3420('0x1'));var timeout=require(_0x3420('0x2'));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['index']);router['get']('/describe',auth[_0x3420('0xa')](),controller['describe']);router[_0x3420('0x9')](_0x3420('0xb'),auth[_0x3420('0xa')](),controller[_0x3420('0xc')]);router[_0x3420('0xd')]('/',auth['isAuthenticated'](),controller[_0x3420('0xe')]);router[_0x3420('0xf')](_0x3420('0xb'),auth[_0x3420('0xa')](),controller['update']);router[_0x3420('0x10')]('/:id',auth[_0x3420('0xa')](),controller[_0x3420('0x11')]);module[_0x3420('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 7cff3a9..5bdd902 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 _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 +var _0x5d49=['DATE','NOW','moment','exports','ENUM','account','agent','queue'];(function(_0x1168e6,_0x4580fc){var _0x27c4c2=function(_0x41ceee){while(--_0x41ceee){_0x1168e6['push'](_0x1168e6['shift']());}};_0x27c4c2(++_0x4580fc);}(_0x5d49,0x1e2));var _0x95d4=function(_0x503966,_0x1dfa7b){_0x503966=_0x503966-0x0;var _0xbce778=_0x5d49[_0x503966];return _0xbce778;};'use strict';var moment=require(_0x95d4('0x0'));var Sequelize=require('sequelize');module[_0x95d4('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x95d4('0x2')](_0x95d4('0x3'),_0x95d4('0x4'),_0x95d4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x95d4('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x95d4('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 51c38bf..7f6f8ae 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 _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 +var _0x5c1f=['request-promise','moment','bluebird','sox','to-csv','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','index','map','FaxTransferReport','rawAttributes','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','keys','find','catch','create','body','describe','html-pdf','rimraf','zip-dir'];(function(_0x52a6e3,_0x4a73b4){var _0x8910d0=function(_0x57e5ef){while(--_0x57e5ef){_0x52a6e3['push'](_0x52a6e3['shift']());}};_0x8910d0(++_0x4a73b4);}(_0x5c1f,0x1b3));var _0xf5c1=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0x5c1f[_0x30a31e];return _0x170879;};'use strict';var pdf=require(_0xf5c1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf5c1('0x1'));var zipdir=require(_0xf5c1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf5c1('0x3'));var moment=require(_0xf5c1('0x4'));var BPromise=require(_0xf5c1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf5c1('0x6'));var csv=require(_0xf5c1('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf5c1('0x8'));var squel=require(_0xf5c1('0x9'));var crypto=require(_0xf5c1('0xa'));var jsforce=require(_0xf5c1('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf5c1('0xc'));var authService=require(_0xf5c1('0xd'));var qs=require(_0xf5c1('0xe'));var as=require(_0xf5c1('0xf'));var hardwareService=require(_0xf5c1('0x10'));var logger=require(_0xf5c1('0x11'))(_0xf5c1('0x12'));var utils=require(_0xf5c1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf5c1('0x14'));var db=require(_0xf5c1('0x15'))['db'];function respondWithStatusCode(_0x252b9f,_0x3519b4){_0x3519b4=_0x3519b4||0xcc;return function(_0x26c748){if(_0x26c748){return _0x252b9f['sendStatus'](_0x3519b4);}return _0x252b9f[_0xf5c1('0x16')](_0x3519b4)['end']();};}function respondWithResult(_0x45bf57,_0x42f44f){_0x42f44f=_0x42f44f||0xc8;return function(_0x2eb021){if(_0x2eb021){return _0x45bf57['status'](_0x42f44f)[_0xf5c1('0x17')](_0x2eb021);}};}function respondWithFilteredResult(_0x11ff7a,_0x2fe583){return function(_0x42234e){if(_0x42234e){var _0x5891a9=_0x42234e[_0xf5c1('0x18')],_0x453d5b=_0x2fe583[_0xf5c1('0x19')],_0x14934a=_0x2fe583['offset']+_0x2fe583[_0xf5c1('0x1a')],_0x312d6b;if(_0x14934a>=_0x5891a9){_0x14934a=_0x5891a9;_0x312d6b=0xc8;}else{_0x312d6b=0xce;}_0x11ff7a[_0xf5c1('0x16')](_0x312d6b);return _0x11ff7a[_0xf5c1('0x1b')](_0xf5c1('0x1c'),_0x453d5b+'-'+_0x14934a+'/'+_0x5891a9)[_0xf5c1('0x17')](_0x42234e);}return null;};}function patchUpdates(_0x31f1a8){return function(_0x199e25){try{jsonpatch[_0xf5c1('0x1d')](_0x199e25,_0x31f1a8,!![]);}catch(_0x4bc1e5){return BPromise[_0xf5c1('0x1e')](_0x4bc1e5);}return _0x199e25[_0xf5c1('0x1f')]();};}function saveUpdates(_0x4c360a,_0x113b04){return function(_0x1e6694){if(_0x1e6694){return _0x1e6694[_0xf5c1('0x20')](_0x4c360a)[_0xf5c1('0x21')](function(_0x35921a){return _0x35921a;});}return null;};}function removeEntity(_0x65d095,_0x2383f8){return function(_0x4955d6){if(_0x4955d6){return _0x4955d6[_0xf5c1('0x22')]()[_0xf5c1('0x21')](function(){_0x65d095[_0xf5c1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d17cd,_0x3f6ac8){return function(_0x36de9b){if(!_0x36de9b){_0x1d17cd[_0xf5c1('0x23')](0x194);}return _0x36de9b;};}function handleError(_0x54e967,_0x67fc9f){_0x67fc9f=_0x67fc9f||0x1f4;return function(_0x2acb65){logger[_0xf5c1('0x24')](_0x2acb65[_0xf5c1('0x25')]);if(_0x2acb65['name']){delete _0x2acb65['name'];}_0x54e967[_0xf5c1('0x16')](_0x67fc9f)[_0xf5c1('0x26')](_0x2acb65);};}exports[_0xf5c1('0x27')]=function(_0x3fa99b,_0x5392be){var _0x2fbd0f={},_0xfc4056={},_0x579eea={'count':0x0,'rows':[]};var _0x58c355=_[_0xf5c1('0x28')](db[_0xf5c1('0x29')][_0xf5c1('0x2a')],function(_0x36fff6){return{'name':_0x36fff6['fieldName'],'type':_0x36fff6[_0xf5c1('0x2b')][_0xf5c1('0x2c')]};});_0xfc4056[_0xf5c1('0x2d')]=_[_0xf5c1('0x28')](_0x58c355,_0xf5c1('0x2e'));_0xfc4056[_0xf5c1('0x2f')]=_['keys'](_0x3fa99b[_0xf5c1('0x2f')]);_0xfc4056[_0xf5c1('0x30')]=_['intersection'](_0xfc4056['model'],_0xfc4056[_0xf5c1('0x2f')]);_0x2fbd0f['attributes']=_[_0xf5c1('0x31')](_0xfc4056[_0xf5c1('0x2d')],qs[_0xf5c1('0x32')](_0x3fa99b[_0xf5c1('0x2f')][_0xf5c1('0x32')]));_0x2fbd0f[_0xf5c1('0x33')]=_0x2fbd0f[_0xf5c1('0x33')][_0xf5c1('0x34')]?_0x2fbd0f[_0xf5c1('0x33')]:_0xfc4056[_0xf5c1('0x2d')];if(!_0x3fa99b['query'][_0xf5c1('0x35')](_0xf5c1('0x36'))){_0x2fbd0f[_0xf5c1('0x1a')]=qs[_0xf5c1('0x1a')](_0x3fa99b[_0xf5c1('0x2f')][_0xf5c1('0x1a')]);_0x2fbd0f[_0xf5c1('0x19')]=qs[_0xf5c1('0x19')](_0x3fa99b[_0xf5c1('0x2f')]['offset']);}_0x2fbd0f[_0xf5c1('0x37')]=qs[_0xf5c1('0x38')](_0x3fa99b[_0xf5c1('0x2f')][_0xf5c1('0x38')]);_0x2fbd0f[_0xf5c1('0x39')]=qs[_0xf5c1('0x30')](_[_0xf5c1('0x3a')](_0x3fa99b[_0xf5c1('0x2f')],_0xfc4056['filters']),_0x58c355);if(_0x3fa99b[_0xf5c1('0x2f')][_0xf5c1('0x3b')]){_0x2fbd0f[_0xf5c1('0x39')]=_[_0xf5c1('0x3c')](_0x2fbd0f[_0xf5c1('0x39')],{'$or':_[_0xf5c1('0x28')](_0x58c355,function(_0x2e0b0d){if(_0x2e0b0d[_0xf5c1('0x2b')]!=='VIRTUAL'){var _0xf5dd29={};_0xf5dd29[_0x2e0b0d[_0xf5c1('0x2e')]]={'$like':'%'+_0x3fa99b[_0xf5c1('0x2f')][_0xf5c1('0x3b')]+'%'};return _0xf5dd29;}})});}_0x2fbd0f=_['merge']({},_0x2fbd0f,_0x3fa99b[_0xf5c1('0x3d')]);var _0x30798d={'where':_0x2fbd0f[_0xf5c1('0x39')]};return db['FaxTransferReport'][_0xf5c1('0x18')](_0x30798d)['then'](function(_0x3db4c1){_0x579eea['count']=_0x3db4c1;if(_0x3fa99b[_0xf5c1('0x2f')][_0xf5c1('0x3e')]){_0x2fbd0f[_0xf5c1('0x3f')]=[{'all':!![]}];}return db[_0xf5c1('0x29')][_0xf5c1('0x40')](_0x2fbd0f);})[_0xf5c1('0x21')](function(_0x54d3e5){_0x579eea['rows']=_0x54d3e5;return _0x579eea;})['then'](respondWithFilteredResult(_0x5392be,_0x2fbd0f))['catch'](handleError(_0x5392be,null));};exports[_0xf5c1('0x41')]=function(_0x35b482,_0x46aa33){var _0x9ba247={'raw':!![],'where':{'id':_0x35b482[_0xf5c1('0x42')]['id']}},_0x476d5d={};_0x476d5d[_0xf5c1('0x2d')]=_[_0xf5c1('0x43')](db[_0xf5c1('0x29')][_0xf5c1('0x2a')]);_0x476d5d['query']=_[_0xf5c1('0x43')](_0x35b482[_0xf5c1('0x2f')]);_0x476d5d[_0xf5c1('0x30')]=_[_0xf5c1('0x31')](_0x476d5d[_0xf5c1('0x2d')],_0x476d5d['query']);_0x9ba247['attributes']=_[_0xf5c1('0x31')](_0x476d5d['model'],qs[_0xf5c1('0x32')](_0x35b482[_0xf5c1('0x2f')][_0xf5c1('0x32')]));_0x9ba247['attributes']=_0x9ba247[_0xf5c1('0x33')][_0xf5c1('0x34')]?_0x9ba247[_0xf5c1('0x33')]:_0x476d5d[_0xf5c1('0x2d')];if(_0x35b482[_0xf5c1('0x2f')]['includeAll']){_0x9ba247[_0xf5c1('0x3f')]=[{'all':!![]}];}_0x9ba247=_[_0xf5c1('0x3c')]({},_0x9ba247,_0x35b482[_0xf5c1('0x3d')]);return db[_0xf5c1('0x29')][_0xf5c1('0x44')](_0x9ba247)[_0xf5c1('0x21')](handleEntityNotFound(_0x46aa33,null))['then'](respondWithResult(_0x46aa33,null))[_0xf5c1('0x45')](handleError(_0x46aa33,null));};exports[_0xf5c1('0x46')]=function(_0xc373de,_0x5868cf){return db[_0xf5c1('0x29')][_0xf5c1('0x46')](_0xc373de['body'],{})[_0xf5c1('0x21')](respondWithResult(_0x5868cf,0xc9))['catch'](handleError(_0x5868cf,null));};exports[_0xf5c1('0x20')]=function(_0x30a9ae,_0x1509ea){if(_0x30a9ae[_0xf5c1('0x47')]['id']){delete _0x30a9ae[_0xf5c1('0x47')]['id'];}return db[_0xf5c1('0x29')]['find']({'where':{'id':_0x30a9ae['params']['id']}})[_0xf5c1('0x21')](handleEntityNotFound(_0x1509ea,null))[_0xf5c1('0x21')](saveUpdates(_0x30a9ae[_0xf5c1('0x47')],null))[_0xf5c1('0x21')](respondWithResult(_0x1509ea,null))[_0xf5c1('0x45')](handleError(_0x1509ea,null));};exports[_0xf5c1('0x22')]=function(_0x21bade,_0xcae8fc){return db[_0xf5c1('0x29')]['find']({'where':{'id':_0x21bade['params']['id']}})[_0xf5c1('0x21')](handleEntityNotFound(_0xcae8fc,null))[_0xf5c1('0x21')](removeEntity(_0xcae8fc,null))[_0xf5c1('0x45')](handleError(_0xcae8fc,null));};exports[_0xf5c1('0x48')]=function(_0x16daa2,_0x5ab5fa){return db[_0xf5c1('0x29')][_0xf5c1('0x48')]()[_0xf5c1('0x21')](respondWithResult(_0x5ab5fa,null))[_0xf5c1('0x45')](handleError(_0x5ab5fa,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 70be453..a9b393c 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 _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 +var _0xd72a=['rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','../../config/logger','api','moment','request-promise','path'];(function(_0x32fab5,_0x1c3ea6){var _0x1983ea=function(_0x2c2289){while(--_0x2c2289){_0x32fab5['push'](_0x32fab5['shift']());}};_0x1983ea(++_0x1c3ea6);}(_0xd72a,0x7f));var _0xad72=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xd72a[_0x1694f5];return _0x5b4321;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xad72('0x0'))(_0xad72('0x1'));var moment=require(_0xad72('0x2'));var BPromise=require('bluebird');var rp=require(_0xad72('0x3'));var fs=require('fs');var path=require(_0xad72('0x4'));var rimraf=require(_0xad72('0x5'));var config=require(_0xad72('0x6'));var attributes=require(_0xad72('0x7'));module[_0xad72('0x8')]=function(_0x536988,_0x5be9cd){return _0x536988[_0xad72('0x9')](_0xad72('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xad72('0xb'),'fields':[_0xad72('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 4445309..f9b9ff4 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 _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 +var _0x92ab=['code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0xfde968,_0x3f9dfc){var _0x4038bd=function(_0x3fac38){while(--_0x3fac38){_0xfde968['push'](_0xfde968['shift']());}};_0x4038bd(++_0x3f9dfc);}(_0x92ab,0x89));var _0xb92a=function(_0xa3bde4,_0x20568e){_0xa3bde4=_0xa3bde4-0x0;var _0x19214a=_0x92ab[_0xa3bde4];return _0x19214a;};'use strict';var _=require(_0xb92a('0x0'));var util=require('util');var moment=require(_0xb92a('0x1'));var BPromise=require('bluebird');var rs=require(_0xb92a('0x2'));var fs=require('fs');var Redis=require(_0xb92a('0x3'));var db=require(_0xb92a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb92a('0x5'))(_0xb92a('0x6'));var config=require(_0xb92a('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xcd2769,_0x3c77fa,_0x1d3a73){return new BPromise(function(_0x342bd2,_0x3ad1ca){return client[_0xb92a('0x8')](_0xcd2769,_0x1d3a73)[_0xb92a('0x9')](function(_0x107091){logger['info'](_0xb92a('0xa'),_0x3c77fa,_0xb92a('0xb'));logger[_0xb92a('0xc')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x3c77fa,_0xb92a('0xb'),JSON[_0xb92a('0xd')](_0x107091));if(_0x107091[_0xb92a('0xe')]){if(_0x107091[_0xb92a('0xe')][_0xb92a('0xf')]===0x1f4){logger['error'](_0xb92a('0xa'),_0x3c77fa,_0x107091[_0xb92a('0xe')][_0xb92a('0x10')]);return _0x3ad1ca(_0x107091[_0xb92a('0xe')][_0xb92a('0x10')]);}logger[_0xb92a('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x3c77fa,_0x107091['error'][_0xb92a('0x10')]);return _0x342bd2(_0x107091[_0xb92a('0xe')][_0xb92a('0x10')]);}else{logger['info'](_0xb92a('0xa'),_0x3c77fa,_0xb92a('0xb'));_0x342bd2(_0x107091[_0xb92a('0x11')][_0xb92a('0x10')]);}})[_0xb92a('0x12')](function(_0x3944d5){logger['error'](_0xb92a('0xa'),_0x3c77fa,_0x3944d5);_0x3ad1ca(_0x3944d5);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 619cce7..d7691f4 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 _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 +var _0x9bcf=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x2fac6e,_0x1815a1){var _0x55a27b=function(_0x1dfd16){while(--_0x1dfd16){_0x2fac6e['push'](_0x2fac6e['shift']());}};_0x55a27b(++_0x1815a1);}(_0x9bcf,0x198));var _0xf9bc=function(_0x427303,_0x5d9aae){_0x427303=_0x427303-0x0;var _0x115d69=_0x9bcf[_0x427303];return _0x115d69;};'use strict';var multer=require(_0xf9bc('0x0'));var util=require(_0xf9bc('0x1'));var path=require(_0xf9bc('0x2'));var timeout=require(_0xf9bc('0x3'));var express=require('express');var router=express[_0xf9bc('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf9bc('0x5'));var config=require(_0xf9bc('0x6'));var controller=require('./faxTransferReport.controller');router[_0xf9bc('0x7')]('/',auth[_0xf9bc('0x8')](),controller[_0xf9bc('0x9')]);router['get'](_0xf9bc('0xa'),auth['isAuthenticated'](),controller[_0xf9bc('0xb')]);router[_0xf9bc('0x7')](_0xf9bc('0xc'),auth[_0xf9bc('0x8')](),controller['show']);router['post']('/',auth[_0xf9bc('0x8')](),controller['create']);router[_0xf9bc('0xd')](_0xf9bc('0xc'),auth[_0xf9bc('0x8')](),controller[_0xf9bc('0xe')]);router[_0xf9bc('0xf')](_0xf9bc('0xc'),auth[_0xf9bc('0x8')](),controller[_0xf9bc('0x10')]);module[_0xf9bc('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 4c3a022..b5d03c9 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 _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 +var _0x2954=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2954,0xc5));var _0x4295=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x2954[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require(_0x4295('0x0'));var util=require(_0x4295('0x1'));var path=require(_0x4295('0x2'));var timeout=require(_0x4295('0x3'));var express=require(_0x4295('0x4'));var router=express[_0x4295('0x5')]();var auth=require(_0x4295('0x6'));var interaction=require(_0x4295('0x7'));var config=require('../../config/environment');var controller=require(_0x4295('0x8'));router[_0x4295('0x9')]('/',auth[_0x4295('0xa')](),controller[_0x4295('0xb')]);router[_0x4295('0x9')](_0x4295('0xc'),auth['isAuthenticated'](),controller[_0x4295('0xd')]);router[_0x4295('0x9')](_0x4295('0xe'),auth[_0x4295('0xa')](),controller[_0x4295('0xf')]);router['get'](_0x4295('0x10'),auth['isAuthenticated'](),controller[_0x4295('0x11')]);router[_0x4295('0x12')]('/',auth['isAuthenticated'](),controller[_0x4295('0x13')]);router[_0x4295('0x12')](_0x4295('0xe'),auth[_0x4295('0xa')](),controller[_0x4295('0x14')]);router[_0x4295('0x15')](_0x4295('0xc'),auth[_0x4295('0xa')](),controller[_0x4295('0x16')]);router[_0x4295('0x17')](_0x4295('0xc'),auth[_0x4295('0xa')](),controller[_0x4295('0x18')]);module[_0x4295('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 7746c8c..965b8d8 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 _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 +var _0x0c6b=['sequelize','STRING','ENUM','basic','newTab','integrationTab'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c6b,0x1bc));var _0xb0c6=function(_0x4bcab7,_0x2f7717){_0x4bcab7=_0x4bcab7-0x0;var _0x2f81bd=_0x0c6b[_0x4bcab7];return _0x2f81bd;};'use strict';var Sequelize=require(_0xb0c6('0x0'));module['exports']={'name':{'type':Sequelize[_0xb0c6('0x1')]},'description':{'type':Sequelize[_0xb0c6('0x1')]},'username':{'type':Sequelize[_0xb0c6('0x1')]},'remoteUri':{'type':Sequelize[_0xb0c6('0x1')]},'authType':{'type':Sequelize[_0xb0c6('0x2')](_0xb0c6('0x3')),'defaultValue':_0xb0c6('0x3')},'password':{'type':Sequelize[_0xb0c6('0x1')]},'consumerKey':{'type':Sequelize[_0xb0c6('0x1')]},'consumerSecret':{'type':Sequelize[_0xb0c6('0x1')]},'token':{'type':Sequelize[_0xb0c6('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xb0c6('0x4')),'defaultValue':_0xb0c6('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index f662287..bff191d 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 _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 +var _0x8d90=['query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','params','includeAll','find','create','body','getConfigurations','findOne','DeskConfiguration','rawAttributes','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','username','consumerSecret','token','tokenSecret','substring','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','Basic\x20%s','toString','base64','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','crypto','desk.js','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','../../mysqldb','jayson/promise','client','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','DeskAccount','type','key'];(function(_0x482815,_0x3601b1){var _0x272d11=function(_0x414e63){while(--_0x414e63){_0x482815['push'](_0x482815['shift']());}};_0x272d11(++_0x3601b1);}(_0x8d90,0x1b3));var _0x08d9=function(_0x47cf44,_0x4bb1bb){_0x47cf44=_0x47cf44-0x0;var _0x266445=_0x8d90[_0x47cf44];return _0x266445;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x08d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x08d9('0x1'));var jsonpatch=require(_0x08d9('0x2'));var rp=require(_0x08d9('0x3'));var moment=require(_0x08d9('0x4'));var BPromise=require(_0x08d9('0x5'));var Mustache=require(_0x08d9('0x6'));var util=require('util');var path=require(_0x08d9('0x7'));var sox=require(_0x08d9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x08d9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x08d9('0xa'));var toCsv=require(_0x08d9('0xb'));var querystring=require(_0x08d9('0xc'));var Papa=require(_0x08d9('0xd'));var Redis=require(_0x08d9('0xe'));var authService=require(_0x08d9('0xf'));var qs=require(_0x08d9('0x10'));var as=require(_0x08d9('0x11'));var hardwareService=require(_0x08d9('0x12'));var logger=require(_0x08d9('0x13'))('api');var utils=require(_0x08d9('0x14'));var config=require(_0x08d9('0x15'));var licenseUtil=require(_0x08d9('0x16'));var db=require(_0x08d9('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x08d9('0x18'));var client=jayson[_0x08d9('0x19')][_0x08d9('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x49f254,_0x3df8ec,_0x5b1f2e,_0x2e2e30){return new BPromise(function(_0x411c57,_0x2eb95b){var _0x228040=_0x2e2e30||client;return _0x228040[_0x08d9('0x1b')](_0x49f254,_0x5b1f2e)[_0x08d9('0x1c')](function(_0x3c37b2){logger['info'](_0x08d9('0x1d'),_0x3df8ec,_0x08d9('0x1e'));logger[_0x08d9('0x1f')](_0x08d9('0x20'),_0x3df8ec,'request\x20sent',JSON[_0x08d9('0x21')](_0x3c37b2));if(_0x3c37b2['error']){if(_0x3c37b2['error']['code']===0x1f4){logger[_0x08d9('0x22')](_0x08d9('0x1d'),_0x3df8ec,_0x3c37b2['error'][_0x08d9('0x23')]);return _0x2eb95b(_0x3c37b2[_0x08d9('0x22')][_0x08d9('0x23')]);}logger[_0x08d9('0x22')](_0x08d9('0x1d'),_0x3df8ec,_0x3c37b2[_0x08d9('0x22')][_0x08d9('0x23')]);return _0x411c57(_0x3c37b2['error'][_0x08d9('0x23')]);}else{logger['info'](_0x08d9('0x1d'),_0x3df8ec,_0x08d9('0x1e'));_0x411c57(_0x3c37b2[_0x08d9('0x24')]['message']);}})[_0x08d9('0x25')](function(_0x56f539){logger[_0x08d9('0x22')](_0x08d9('0x1d'),_0x3df8ec,_0x56f539);_0x2eb95b(_0x56f539);});});}function respondWithStatusCode(_0x5cb337,_0x4991b9){_0x4991b9=_0x4991b9||0xcc;return function(_0x41f9ad){if(_0x41f9ad){return _0x5cb337[_0x08d9('0x26')](_0x4991b9);}return _0x5cb337[_0x08d9('0x27')](_0x4991b9)[_0x08d9('0x28')]();};}function respondWithResult(_0x1bbbf9,_0x4a2251){_0x4a2251=_0x4a2251||0xc8;return function(_0x584640){if(_0x584640){return _0x1bbbf9['status'](_0x4a2251)[_0x08d9('0x29')](_0x584640);}};}function respondWithFilteredResult(_0x47492f,_0x57cfee){return function(_0x48a5c2){if(_0x48a5c2){var _0x3b3b48=_0x48a5c2['count'],_0xa84c=_0x57cfee[_0x08d9('0x2a')],_0x40d562=_0x57cfee[_0x08d9('0x2a')]+_0x57cfee['limit'],_0x29c550;if(_0x40d562>=_0x3b3b48){_0x40d562=_0x3b3b48;_0x29c550=0xc8;}else{_0x29c550=0xce;}_0x47492f[_0x08d9('0x27')](_0x29c550);return _0x47492f[_0x08d9('0x2b')](_0x08d9('0x2c'),_0xa84c+'-'+_0x40d562+'/'+_0x3b3b48)[_0x08d9('0x29')](_0x48a5c2);}return null;};}function patchUpdates(_0x5b4cf1){return function(_0x4e29b6){try{jsonpatch['apply'](_0x4e29b6,_0x5b4cf1,!![]);}catch(_0x92f575){return BPromise[_0x08d9('0x2d')](_0x92f575);}return _0x4e29b6[_0x08d9('0x2e')]();};}function saveUpdates(_0x2c891d,_0x3aaaa4){return function(_0xe567b7){if(_0xe567b7){return _0xe567b7[_0x08d9('0x2f')](_0x2c891d)[_0x08d9('0x1c')](function(_0x31ba8b){return _0x31ba8b;});}return null;};}function removeEntity(_0x3f4f29,_0x2572d8){return function(_0x235e8d){if(_0x235e8d){return _0x235e8d[_0x08d9('0x30')]()[_0x08d9('0x1c')](function(){_0x3f4f29['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12389c,_0x1143e9){return function(_0xd5e66b){if(!_0xd5e66b){_0x12389c[_0x08d9('0x26')](0x194);}return _0xd5e66b;};}function handleError(_0x3c25ef,_0x3f6f32){_0x3f6f32=_0x3f6f32||0x1f4;return function(_0x1d4e0b){logger[_0x08d9('0x22')](_0x1d4e0b[_0x08d9('0x31')]);if(_0x1d4e0b[_0x08d9('0x32')]){delete _0x1d4e0b[_0x08d9('0x32')];}_0x3c25ef[_0x08d9('0x27')](_0x3f6f32)[_0x08d9('0x33')](_0x1d4e0b);};}exports[_0x08d9('0x34')]=function(_0x1274b1,_0x257d48){var _0x466a98={},_0x565d5d={},_0x50ef12={'count':0x0,'rows':[]};var _0x4c80a6=_[_0x08d9('0x35')](db[_0x08d9('0x36')]['rawAttributes'],function(_0x13fb84){return{'name':_0x13fb84['fieldName'],'type':_0x13fb84[_0x08d9('0x37')][_0x08d9('0x38')]};});_0x565d5d['model']=_[_0x08d9('0x35')](_0x4c80a6,_0x08d9('0x32'));_0x565d5d[_0x08d9('0x39')]=_[_0x08d9('0x3a')](_0x1274b1['query']);_0x565d5d[_0x08d9('0x3b')]=_['intersection'](_0x565d5d[_0x08d9('0x3c')],_0x565d5d['query']);_0x466a98[_0x08d9('0x3d')]=_[_0x08d9('0x3e')](_0x565d5d[_0x08d9('0x3c')],qs[_0x08d9('0x3f')](_0x1274b1[_0x08d9('0x39')]['fields']));_0x466a98[_0x08d9('0x3d')]=_0x466a98[_0x08d9('0x3d')][_0x08d9('0x40')]?_0x466a98[_0x08d9('0x3d')]:_0x565d5d['model'];if(!_0x1274b1[_0x08d9('0x39')][_0x08d9('0x41')]('nolimit')){_0x466a98[_0x08d9('0x42')]=qs[_0x08d9('0x42')](_0x1274b1[_0x08d9('0x39')][_0x08d9('0x42')]);_0x466a98[_0x08d9('0x2a')]=qs['offset'](_0x1274b1['query']['offset']);}_0x466a98[_0x08d9('0x43')]=qs[_0x08d9('0x44')](_0x1274b1[_0x08d9('0x39')][_0x08d9('0x44')]);_0x466a98[_0x08d9('0x45')]=qs['filters'](_[_0x08d9('0x46')](_0x1274b1['query'],_0x565d5d[_0x08d9('0x3b')]),_0x4c80a6);if(_0x1274b1[_0x08d9('0x39')][_0x08d9('0x47')]){_0x466a98[_0x08d9('0x45')]=_[_0x08d9('0x48')](_0x466a98[_0x08d9('0x45')],{'$or':_['map'](_0x4c80a6,function(_0x39785e){if(_0x39785e[_0x08d9('0x37')]!==_0x08d9('0x49')){var _0x51f04f={};_0x51f04f[_0x39785e[_0x08d9('0x32')]]={'$like':'%'+_0x1274b1['query']['filter']+'%'};return _0x51f04f;}})});}_0x466a98=_['merge']({},_0x466a98,_0x1274b1[_0x08d9('0x4a')]);var _0x3600c2={'where':_0x466a98[_0x08d9('0x45')]};return db[_0x08d9('0x36')][_0x08d9('0x4b')](_0x3600c2)[_0x08d9('0x1c')](function(_0x532e31){_0x50ef12[_0x08d9('0x4b')]=_0x532e31;if(_0x1274b1[_0x08d9('0x39')]['includeAll']){_0x466a98[_0x08d9('0x4c')]=[{'all':!![]}];}return db[_0x08d9('0x36')][_0x08d9('0x4d')](_0x466a98);})[_0x08d9('0x1c')](function(_0x54e619){_0x50ef12[_0x08d9('0x4e')]=_0x54e619;return _0x50ef12;})[_0x08d9('0x1c')](respondWithFilteredResult(_0x257d48,_0x466a98))[_0x08d9('0x25')](handleError(_0x257d48,null));};exports['show']=function(_0x3eaeed,_0x2479b8){var _0x1233e5={'raw':![],'where':{'id':_0x3eaeed[_0x08d9('0x4f')]['id']}},_0xd6923e={};_0xd6923e[_0x08d9('0x3c')]=_[_0x08d9('0x3a')](db['DeskAccount']['rawAttributes']);_0xd6923e[_0x08d9('0x39')]=_[_0x08d9('0x3a')](_0x3eaeed[_0x08d9('0x39')]);_0xd6923e[_0x08d9('0x3b')]=_[_0x08d9('0x3e')](_0xd6923e[_0x08d9('0x3c')],_0xd6923e[_0x08d9('0x39')]);_0x1233e5[_0x08d9('0x3d')]=_[_0x08d9('0x3e')](_0xd6923e[_0x08d9('0x3c')],qs[_0x08d9('0x3f')](_0x3eaeed['query'][_0x08d9('0x3f')]));_0x1233e5[_0x08d9('0x3d')]=_0x1233e5[_0x08d9('0x3d')][_0x08d9('0x40')]?_0x1233e5[_0x08d9('0x3d')]:_0xd6923e[_0x08d9('0x3c')];if(_0x3eaeed['query'][_0x08d9('0x50')]){_0x1233e5[_0x08d9('0x4c')]=[{'all':!![]}];}_0x1233e5=_[_0x08d9('0x48')]({},_0x1233e5,_0x3eaeed[_0x08d9('0x4a')]);return db[_0x08d9('0x36')][_0x08d9('0x51')](_0x1233e5)[_0x08d9('0x1c')](handleEntityNotFound(_0x2479b8,null))[_0x08d9('0x1c')](respondWithResult(_0x2479b8,null))['catch'](handleError(_0x2479b8,null));};exports['create']=function(_0x543bcc,_0x54b04a){return db[_0x08d9('0x36')][_0x08d9('0x52')](_0x543bcc[_0x08d9('0x53')],{})[_0x08d9('0x1c')](respondWithResult(_0x54b04a,0xc9))[_0x08d9('0x25')](handleError(_0x54b04a,null));};exports[_0x08d9('0x2f')]=function(_0x1982ed,_0x8acefc){if(_0x1982ed[_0x08d9('0x53')]['id']){delete _0x1982ed['body']['id'];}return db[_0x08d9('0x36')][_0x08d9('0x51')]({'where':{'id':_0x1982ed['params']['id']}})[_0x08d9('0x1c')](handleEntityNotFound(_0x8acefc,null))[_0x08d9('0x1c')](saveUpdates(_0x1982ed[_0x08d9('0x53')],null))[_0x08d9('0x1c')](respondWithResult(_0x8acefc,null))[_0x08d9('0x25')](handleError(_0x8acefc,null));};exports[_0x08d9('0x30')]=function(_0x259a82,_0x32f877){return db[_0x08d9('0x36')]['find']({'where':{'id':_0x259a82[_0x08d9('0x4f')]['id']}})[_0x08d9('0x1c')](handleEntityNotFound(_0x32f877,null))[_0x08d9('0x1c')](removeEntity(_0x32f877,null))[_0x08d9('0x25')](handleError(_0x32f877,null));};exports[_0x08d9('0x54')]=function(_0x15332d,_0x5d1b49,_0x5d0a90){var _0x3a983f={};var _0x14cda3={};var _0x2aa36b;var _0xc5e32c;return db[_0x08d9('0x36')][_0x08d9('0x55')]({'where':{'id':_0x15332d[_0x08d9('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5d1b49,null))[_0x08d9('0x1c')](function(_0x36486b){if(_0x36486b){_0x2aa36b=_0x36486b;_0x14cda3[_0x08d9('0x3c')]=_['keys'](db[_0x08d9('0x56')][_0x08d9('0x57')]);_0x14cda3[_0x08d9('0x39')]=_[_0x08d9('0x3a')](_0x15332d[_0x08d9('0x39')]);_0x14cda3[_0x08d9('0x3b')]=_[_0x08d9('0x3e')](_0x14cda3[_0x08d9('0x3c')],_0x14cda3[_0x08d9('0x39')]);_0x3a983f['attributes']=_[_0x08d9('0x3e')](_0x14cda3[_0x08d9('0x3c')],qs['fields'](_0x15332d[_0x08d9('0x39')][_0x08d9('0x3f')]));_0x3a983f['attributes']=_0x3a983f[_0x08d9('0x3d')][_0x08d9('0x40')]?_0x3a983f[_0x08d9('0x3d')]:_0x14cda3['model'];_0x3a983f[_0x08d9('0x43')]=qs[_0x08d9('0x44')](_0x15332d['query'][_0x08d9('0x44')]);_0x3a983f[_0x08d9('0x45')]=qs['filters'](_[_0x08d9('0x46')](_0x15332d[_0x08d9('0x39')],_0x14cda3['filters']));if(_0x15332d['query'][_0x08d9('0x47')]){_0x3a983f['where']=_['merge'](_0x3a983f[_0x08d9('0x45')],{'$or':_[_0x08d9('0x35')](_0x3a983f[_0x08d9('0x3d')],function(_0x4911f2){var _0x50f167={};_0x50f167[_0x4911f2]={'$like':'%'+_0x15332d[_0x08d9('0x39')][_0x08d9('0x47')]+'%'};return _0x50f167;})});}_0x3a983f=_[_0x08d9('0x48')]({},_0x3a983f,_0x15332d['options']);return _0x2aa36b['getConfigurations'](_0x3a983f);}})[_0x08d9('0x1c')](function(_0x254b97){if(_0x254b97){_0xc5e32c=_0x254b97[_0x08d9('0x40')];if(!_0x15332d[_0x08d9('0x39')]['hasOwnProperty'](_0x08d9('0x58'))){_0x3a983f[_0x08d9('0x42')]=qs['limit'](_0x15332d['query']['limit']);_0x3a983f[_0x08d9('0x2a')]=qs[_0x08d9('0x2a')](_0x15332d[_0x08d9('0x39')][_0x08d9('0x2a')]);}return _0x2aa36b[_0x08d9('0x54')](_0x3a983f);}})[_0x08d9('0x1c')](function(_0x8fdbff){if(_0x8fdbff){return _0x8fdbff?{'count':_0xc5e32c,'rows':_0x8fdbff}:null;}})[_0x08d9('0x1c')](respondWithResult(_0x5d1b49,null))[_0x08d9('0x25')](handleError(_0x5d1b49,null));};exports[_0x08d9('0x59')]=function(_0xd6a108,_0xcf5d5d,_0x491334){if(_0xd6a108[_0x08d9('0x53')]['id']){delete _0xd6a108['body']['id'];}return db['DeskAccount'][_0x08d9('0x55')]({'where':{'id':_0xd6a108[_0x08d9('0x4f')]['id']}})[_0x08d9('0x1c')](handleEntityNotFound(_0xcf5d5d,null))[_0x08d9('0x1c')](function(_0x434b72){if(_0x434b72){_0xd6a108['body'][_0x08d9('0x5a')]=_0x434b72['id'];_0xd6a108[_0x08d9('0x53')][_0x08d9('0x5b')]=integrations[_0x08d9('0x5c')](_0xd6a108[_0x08d9('0x53')][_0x08d9('0x5d')],_0xd6a108[_0x08d9('0x53')]['type']);_0xd6a108[_0x08d9('0x53')][_0x08d9('0x5e')]=integrations[_0x08d9('0x5f')](_0xd6a108[_0x08d9('0x53')][_0x08d9('0x5d')],_0xd6a108[_0x08d9('0x53')]['type']);return db[_0x08d9('0x56')][_0x08d9('0x52')](_0xd6a108[_0x08d9('0x53')],{'include':[{'model':db[_0x08d9('0x60')],'as':_0x08d9('0x5b')},{'model':db[_0x08d9('0x60')],'as':_0x08d9('0x5e')}]});}return null;})[_0x08d9('0x1c')](respondWithResult(_0xcf5d5d,null))[_0x08d9('0x25')](handleError(_0xcf5d5d,null));};exports[_0x08d9('0x61')]=function(_0x3f1764,_0x10a207,_0x5d13be){var _0x5e1f9a=[{'name':_0x08d9('0x62'),'label':_0x08d9('0x62'),'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 _0x5a20f5='';return db[_0x08d9('0x36')]['findOne']({'where':{'id':_0x3f1764['params']['id']},'attributes':['id',_0x08d9('0x63'),'authType',_0x08d9('0x64'),'password','consumerKey',_0x08d9('0x65'),_0x08d9('0x66'),_0x08d9('0x67')]})[_0x08d9('0x1c')](handleEntityNotFound(_0x10a207,null))[_0x08d9('0x1c')](function(_0x581fa0){if(_0x581fa0){_0x5a20f5=_0x581fa0[_0x08d9('0x63')];var _0x275c09=_0x5a20f5['slice'](-0x1);if(_0x275c09==='/'){_0x5a20f5=_0x5a20f5[_0x08d9('0x68')](0x0,_0x5a20f5['lastIndexOf'](_0x275c09));}var _0xafaa01={'method':_0x08d9('0x69'),'uri':util[_0x08d9('0x6a')](_0x08d9('0x6b'),_0x5a20f5),'headers':{'Content-Type':_0x08d9('0x6c'),'Accept':_0x08d9('0x6c')},'json':!![]};if(_0x581fa0[_0x08d9('0x6d')]===_0x08d9('0x6e')){_0xafaa01[_0x08d9('0x6f')][_0x08d9('0x70')]=util['format'](_0x08d9('0x71'),new Buffer(util[_0x08d9('0x6a')]('%s:%s',_0x581fa0[_0x08d9('0x64')],_0x581fa0['password']))[_0x08d9('0x72')](_0x08d9('0x73')));}return rp(_0xafaa01)[_0x08d9('0x1c')](function(_0x43963b){return _0x5e1f9a['concat'](_[_0x08d9('0x35')](_0x43963b[_0x08d9('0x74')][_0x08d9('0x75')],function(_0x261208){return{'id':_0x261208[_0x08d9('0x32')],'name':_0x261208[_0x08d9('0x32')],'type':_0x261208['type'],'active':_0x261208[_0x08d9('0x76')],'label':_0x261208[_0x08d9('0x77')],'custom':!![]};}));});}})[_0x08d9('0x1c')](function(_0x5bb0ea){return{'count':_0x5bb0ea[_0x08d9('0x40')],'rows':_0x5bb0ea};})[_0x08d9('0x1c')](respondWithResult(_0x10a207,null))[_0x08d9('0x25')](function(_0xc8d86){var _0x3101ef=_0x3f1764[_0x08d9('0x39')]['test']?0x1f4:_0xc8d86[_0x08d9('0x78')]||0x1f4;logger['error'](_0x08d9('0x79'),_0x08d9('0x61'),_0x3101ef,JSON[_0x08d9('0x21')](_0xc8d86));delete _0xc8d86[_0x08d9('0x32')];if(_0x3101ef===0x191){_0x3101ef=0x190;}_0x10a207[_0x08d9('0x27')](_0x3101ef)['send'](_0x3f1764[_0x08d9('0x39')][_0x08d9('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0xc8d86['statusCode']}:_0xc8d86);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index cca4865..5cc7ae9 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 _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 +var _0xe7ea=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x5b3c61,_0x3eb2aa){var _0x153389=function(_0x2a1a99){while(--_0x2a1a99){_0x5b3c61['push'](_0x5b3c61['shift']());}};_0x153389(++_0x3eb2aa);}(_0xe7ea,0x71));var _0xae7e=function(_0x1b862a,_0x3e03af){_0x1b862a=_0x1b862a-0x0;var _0x1725fb=_0xe7ea[_0x1b862a];return _0x1725fb;};'use strict';var _=require(_0xae7e('0x0'));var util=require(_0xae7e('0x1'));var logger=require(_0xae7e('0x2'))(_0xae7e('0x3'));var moment=require(_0xae7e('0x4'));var BPromise=require(_0xae7e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xae7e('0x6'));var config=require(_0xae7e('0x7'));var attributes=require(_0xae7e('0x8'));var integrations=require(_0xae7e('0x9'));module[_0xae7e('0xa')]=function(_0x400648,_0xe2f2d1){return _0x400648[_0xae7e('0xb')]('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 e653912..2b77c87 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 _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 +var _0x05ef=['http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','raw','options','where','attributes','limit','map','include','model','ShowDeskAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3b87f4,_0x112243){var _0x63d16e=function(_0x3e7323){while(--_0x3e7323){_0x3b87f4['push'](_0x3b87f4['shift']());}};_0x63d16e(++_0x112243);}(_0x05ef,0x86));var _0xf05e=function(_0x43279f,_0x241e73){_0x43279f=_0x43279f-0x0;var _0x3e1093=_0x05ef[_0x43279f];return _0x3e1093;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf05e('0x0'));var BPromise=require(_0xf05e('0x1'));var rs=require(_0xf05e('0x2'));var fs=require('fs');var Redis=require(_0xf05e('0x3'));var db=require(_0xf05e('0x4'))['db'];var utils=require(_0xf05e('0x5'));var logger=require(_0xf05e('0x6'))('rpc');var config=require(_0xf05e('0x7'));var jayson=require(_0xf05e('0x8'));var client=jayson[_0xf05e('0x9')][_0xf05e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2eb73b,_0x333c72,_0x52bf5e){return new BPromise(function(_0x25fee6,_0x477102){return client[_0xf05e('0xb')](_0x2eb73b,_0x52bf5e)[_0xf05e('0xc')](function(_0x319152){logger[_0xf05e('0xd')](_0xf05e('0xe'),_0x333c72,_0xf05e('0xf'));logger[_0xf05e('0x10')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x333c72,_0xf05e('0xf'),JSON[_0xf05e('0x11')](_0x319152));if(_0x319152['error']){if(_0x319152[_0xf05e('0x12')][_0xf05e('0x13')]===0x1f4){logger[_0xf05e('0x12')](_0xf05e('0xe'),_0x333c72,_0x319152['error']['message']);return _0x477102(_0x319152['error'][_0xf05e('0x14')]);}logger[_0xf05e('0x12')](_0xf05e('0xe'),_0x333c72,_0x319152[_0xf05e('0x12')][_0xf05e('0x14')]);return _0x25fee6(_0x319152['error'][_0xf05e('0x14')]);}else{logger[_0xf05e('0xd')](_0xf05e('0xe'),_0x333c72,_0xf05e('0xf'));_0x25fee6(_0x319152[_0xf05e('0x15')][_0xf05e('0x14')]);}})[_0xf05e('0x16')](function(_0x554990){logger[_0xf05e('0x12')](_0xf05e('0xe'),_0x333c72,_0x554990);_0x477102(_0x554990);});});}exports[_0xf05e('0x17')]=function(_0x1701a3){var _0x49584e=this;return new Promise(function(_0x57b378,_0x1d0f42){return db[_0xf05e('0x18')][_0xf05e('0x19')]({'raw':_0x1701a3['options']?_0x1701a3['options'][_0xf05e('0x1a')]===undefined?!![]:![]:!![],'where':_0x1701a3[_0xf05e('0x1b')]?_0x1701a3[_0xf05e('0x1b')][_0xf05e('0x1c')]||null:null,'attributes':_0x1701a3[_0xf05e('0x1b')]?_0x1701a3['options'][_0xf05e('0x1d')]||null:null,'limit':_0x1701a3[_0xf05e('0x1b')]?_0x1701a3[_0xf05e('0x1b')][_0xf05e('0x1e')]||null:null,'include':_0x1701a3[_0xf05e('0x1b')]?_0x1701a3[_0xf05e('0x1b')]['include']?_[_0xf05e('0x1f')](_0x1701a3['options'][_0xf05e('0x20')],function(_0x4e450e){return{'model':db[_0x4e450e[_0xf05e('0x21')]],'as':_0x4e450e['as'],'attributes':_0x4e450e[_0xf05e('0x1d')],'include':_0x4e450e[_0xf05e('0x20')]?_[_0xf05e('0x1f')](_0x4e450e[_0xf05e('0x20')],function(_0x472977){return{'model':db[_0x472977[_0xf05e('0x21')]],'as':_0x472977['as'],'attributes':_0x472977[_0xf05e('0x1d')],'include':_0x472977[_0xf05e('0x20')]?_[_0xf05e('0x1f')](_0x472977[_0xf05e('0x20')],function(_0x5f413e){return{'model':db[_0x5f413e[_0xf05e('0x21')]],'as':_0x5f413e['as'],'attributes':_0x5f413e[_0xf05e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf05e('0xc')](function(_0x489af2){logger[_0xf05e('0xd')]('GetDeskAccount',_0x1701a3);logger[_0xf05e('0x10')](_0xf05e('0x17'),_0x1701a3,JSON[_0xf05e('0x11')](_0x489af2));_0x57b378(_0x489af2);})[_0xf05e('0x16')](function(_0x469376){logger[_0xf05e('0x12')](_0xf05e('0x17'),_0x469376[_0xf05e('0x14')],_0x1701a3);_0x1d0f42(_0x49584e[_0xf05e('0x12')](0x1f4,_0x469376[_0xf05e('0x14')]));});});};exports[_0xf05e('0x22')]=function(_0x247eac){var _0x2f72a7=this;return new Promise(function(_0x434c50,_0x10dc75){return db[_0xf05e('0x18')][_0xf05e('0x23')]({'raw':_0x247eac['options']?_0x247eac['options'][_0xf05e('0x1a')]===undefined?!![]:![]:!![],'where':_0x247eac[_0xf05e('0x1b')]?_0x247eac['options'][_0xf05e('0x1c')]||null:null,'attributes':_0x247eac[_0xf05e('0x1b')]?_0x247eac[_0xf05e('0x1b')][_0xf05e('0x1d')]||null:null,'include':_0x247eac[_0xf05e('0x1b')]?_0x247eac[_0xf05e('0x1b')][_0xf05e('0x20')]?_['map'](_0x247eac[_0xf05e('0x1b')][_0xf05e('0x20')],function(_0x9f9785){return{'model':db[_0x9f9785[_0xf05e('0x21')]],'as':_0x9f9785['as'],'attributes':_0x9f9785[_0xf05e('0x1d')],'include':_0x9f9785[_0xf05e('0x20')]?_[_0xf05e('0x1f')](_0x9f9785[_0xf05e('0x20')],function(_0x48d002){return{'model':db[_0x48d002[_0xf05e('0x21')]],'as':_0x48d002['as'],'attributes':_0x48d002[_0xf05e('0x1d')],'include':_0x48d002[_0xf05e('0x20')]?_['map'](_0x48d002[_0xf05e('0x20')],function(_0x202d5b){return{'model':db[_0x202d5b['model']],'as':_0x202d5b['as'],'attributes':_0x202d5b[_0xf05e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf05e('0xc')](function(_0x3498cb){logger[_0xf05e('0xd')](_0xf05e('0x22'),_0x247eac);logger['debug'](_0xf05e('0x22'),_0x247eac,JSON[_0xf05e('0x11')](_0x3498cb));_0x434c50(_0x3498cb);})['catch'](function(_0x328ec8){logger[_0xf05e('0x12')]('ShowDeskAccount',_0x328ec8[_0xf05e('0x14')],_0x247eac);_0x10dc75(_0x2f72a7[_0xf05e('0x12')](0x1f4,_0x328ec8[_0xf05e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index f34a389..a5333f6 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 _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 +var _0xda81=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update'];(function(_0x91c951,_0x2988ba){var _0xc454d1=function(_0x1d86e8){while(--_0x1d86e8){_0x91c951['push'](_0x91c951['shift']());}};_0xc454d1(++_0x2988ba);}(_0xda81,0x1c3));var _0x1da8=function(_0x2fc973,_0x31d687){_0x2fc973=_0x2fc973-0x0;var _0x5b0a02=_0xda81[_0x2fc973];return _0x5b0a02;};'use strict';var multer=require(_0x1da8('0x0'));var util=require(_0x1da8('0x1'));var path=require(_0x1da8('0x2'));var timeout=require('connect-timeout');var express=require(_0x1da8('0x3'));var router=express[_0x1da8('0x4')]();var auth=require(_0x1da8('0x5'));var interaction=require(_0x1da8('0x6'));var config=require('../../config/environment');var controller=require(_0x1da8('0x7'));router[_0x1da8('0x8')]('/',auth['isAuthenticated'](),controller[_0x1da8('0x9')]);router['get'](_0x1da8('0xa'),auth[_0x1da8('0xb')](),controller[_0x1da8('0xc')]);router[_0x1da8('0x8')](_0x1da8('0xd'),auth[_0x1da8('0xb')](),controller[_0x1da8('0xe')]);router[_0x1da8('0x8')](_0x1da8('0xf'),auth['isAuthenticated'](),controller[_0x1da8('0x10')]);router[_0x1da8('0x8')](_0x1da8('0x11'),auth[_0x1da8('0xb')](),controller[_0x1da8('0x12')]);router['get'](_0x1da8('0x13'),auth['isAuthenticated'](),controller[_0x1da8('0x14')]);router[_0x1da8('0x15')]('/',auth[_0x1da8('0xb')](),controller[_0x1da8('0x16')]);router[_0x1da8('0x15')]('/:id/tags',auth[_0x1da8('0xb')](),controller['setTags']);router[_0x1da8('0x17')](_0x1da8('0xa'),auth[_0x1da8('0xb')](),controller[_0x1da8('0x18')]);router[_0x1da8('0x19')](_0x1da8('0xa'),auth['isAuthenticated'](),controller[_0x1da8('0x1a')]);module[_0x1da8('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index d386418..f3220ee 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 _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 +var _0x214f=['STRING','exports'];(function(_0x42499a,_0xd4b3e3){var _0x51e2b7=function(_0x4ccff2){while(--_0x4ccff2){_0x42499a['push'](_0x42499a['shift']());}};_0x51e2b7(++_0xd4b3e3);}(_0x214f,0xed));var _0xf214=function(_0x2cfd5f,_0x5d7d31){_0x2cfd5f=_0x2cfd5f-0x0;var _0x31b794=_0x214f[_0x2cfd5f];return _0x31b794;};'use strict';var Sequelize=require('sequelize');module[_0xf214('0x0')]={'name':{'type':Sequelize[_0xf214('0x1')]},'description':{'type':Sequelize[_0xf214('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index fce01a1..9e389a3 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 _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 +var _0x33f8=['debug','stringify','error','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','destroy','end','name','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','filters','filter','merge','VIRTUAL','include','findAll','show','params','length','includeAll','options','find','create','body','getFields','findOne','nolimit','DeskField','pick','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x2cc9ad,_0x2e47f9){var _0xcddc43=function(_0x3392d9){while(--_0x3392d9){_0x2cc9ad['push'](_0x2cc9ad['shift']());}};_0xcddc43(++_0x2e47f9);}(_0x33f8,0x15d));var _0x833f=function(_0x37d59f,_0x376c39){_0x37d59f=_0x37d59f-0x0;var _0x4d97f6=_0x33f8[_0x37d59f];return _0x4d97f6;};'use strict';var pdf=require(_0x833f('0x0'));var emlformat=require(_0x833f('0x1'));var rimraf=require(_0x833f('0x2'));var zipdir=require(_0x833f('0x3'));var jsonpatch=require(_0x833f('0x4'));var rp=require(_0x833f('0x5'));var moment=require(_0x833f('0x6'));var BPromise=require(_0x833f('0x7'));var Mustache=require('mustache');var util=require(_0x833f('0x8'));var path=require(_0x833f('0x9'));var sox=require(_0x833f('0xa'));var csv=require(_0x833f('0xb'));var ejs=require(_0x833f('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x833f('0xd'));var crypto=require('crypto');var jsforce=require(_0x833f('0xe'));var deskjs=require(_0x833f('0xf'));var toCsv=require(_0x833f('0xb'));var querystring=require(_0x833f('0x10'));var Papa=require(_0x833f('0x11'));var Redis=require(_0x833f('0x12'));var authService=require(_0x833f('0x13'));var qs=require(_0x833f('0x14'));var as=require(_0x833f('0x15'));var hardwareService=require(_0x833f('0x16'));var logger=require(_0x833f('0x17'))('api');var utils=require(_0x833f('0x18'));var config=require(_0x833f('0x19'));var licenseUtil=require(_0x833f('0x1a'));var db=require(_0x833f('0x1b'))['db'];var jayson=require(_0x833f('0x1c'));var client=jayson[_0x833f('0x1d')][_0x833f('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x7733d,_0x3a18c2,_0x12ae0c,_0x481005){return new BPromise(function(_0x39b92c,_0x586746){var _0x3cf60e=_0x481005||client;return _0x3cf60e['request'](_0x7733d,_0x12ae0c)[_0x833f('0x1f')](function(_0x4e3543){logger[_0x833f('0x20')](_0x833f('0x21'),_0x3a18c2,_0x833f('0x22'));logger[_0x833f('0x23')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3a18c2,_0x833f('0x22'),JSON[_0x833f('0x24')](_0x4e3543));if(_0x4e3543[_0x833f('0x25')]){if(_0x4e3543[_0x833f('0x25')]['code']===0x1f4){logger['error'](_0x833f('0x21'),_0x3a18c2,_0x4e3543['error']['message']);return _0x586746(_0x4e3543[_0x833f('0x25')][_0x833f('0x26')]);}logger[_0x833f('0x25')](_0x833f('0x21'),_0x3a18c2,_0x4e3543[_0x833f('0x25')][_0x833f('0x26')]);return _0x39b92c(_0x4e3543[_0x833f('0x25')]['message']);}else{logger['info'](_0x833f('0x21'),_0x3a18c2,'request\x20sent');_0x39b92c(_0x4e3543[_0x833f('0x27')][_0x833f('0x26')]);}})[_0x833f('0x28')](function(_0x5c4040){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x3a18c2,_0x5c4040);_0x586746(_0x5c4040);});});}function respondWithStatusCode(_0x83d341,_0x36d950){_0x36d950=_0x36d950||0xcc;return function(_0xd62846){if(_0xd62846){return _0x83d341[_0x833f('0x29')](_0x36d950);}return _0x83d341[_0x833f('0x2a')](_0x36d950)['end']();};}function respondWithResult(_0x443cf5,_0x1c317a){_0x1c317a=_0x1c317a||0xc8;return function(_0x5b2a25){if(_0x5b2a25){return _0x443cf5[_0x833f('0x2a')](_0x1c317a)[_0x833f('0x2b')](_0x5b2a25);}};}function respondWithFilteredResult(_0x4417be,_0x3b13ed){return function(_0x5ae60e){if(_0x5ae60e){var _0x1717f0=_0x5ae60e[_0x833f('0x2c')],_0x2f7977=_0x3b13ed['offset'],_0x2a88f6=_0x3b13ed[_0x833f('0x2d')]+_0x3b13ed['limit'],_0x228e4f;if(_0x2a88f6>=_0x1717f0){_0x2a88f6=_0x1717f0;_0x228e4f=0xc8;}else{_0x228e4f=0xce;}_0x4417be['status'](_0x228e4f);return _0x4417be[_0x833f('0x2e')](_0x833f('0x2f'),_0x2f7977+'-'+_0x2a88f6+'/'+_0x1717f0)[_0x833f('0x2b')](_0x5ae60e);}return null;};}function patchUpdates(_0x54718d){return function(_0x48682d){try{jsonpatch[_0x833f('0x30')](_0x48682d,_0x54718d,!![]);}catch(_0x267048){return BPromise[_0x833f('0x31')](_0x267048);}return _0x48682d[_0x833f('0x32')]();};}function saveUpdates(_0x1e03e2,_0x32f943){return function(_0x1df77f){if(_0x1df77f){return _0x1df77f['update'](_0x1e03e2)[_0x833f('0x1f')](function(_0x10c287){return _0x10c287;});}return null;};}function removeEntity(_0x2468ac,_0x289c27){return function(_0x2d8157){if(_0x2d8157){return _0x2d8157[_0x833f('0x33')]()['then'](function(){_0x2468ac[_0x833f('0x2a')](0xcc)[_0x833f('0x34')]();});}};}function handleEntityNotFound(_0x41792f,_0x49895a){return function(_0xdcd09b){if(!_0xdcd09b){_0x41792f['sendStatus'](0x194);}return _0xdcd09b;};}function handleError(_0x5e3bf5,_0x280fdb){_0x280fdb=_0x280fdb||0x1f4;return function(_0x200378){logger[_0x833f('0x25')](_0x200378['stack']);if(_0x200378[_0x833f('0x35')]){delete _0x200378['name'];}_0x5e3bf5[_0x833f('0x2a')](_0x280fdb)['send'](_0x200378);};}exports[_0x833f('0x36')]=function(_0x3eef4c,_0x49b869){var _0xe6c194={},_0x4d88b6={},_0x1992a5={'count':0x0,'rows':[]};var _0x5d3d3f=_[_0x833f('0x37')](db[_0x833f('0x38')][_0x833f('0x39')],function(_0x3a343e){return{'name':_0x3a343e[_0x833f('0x3a')],'type':_0x3a343e[_0x833f('0x3b')][_0x833f('0x3c')]};});_0x4d88b6[_0x833f('0x3d')]=_[_0x833f('0x37')](_0x5d3d3f,_0x833f('0x35'));_0x4d88b6[_0x833f('0x3e')]=_[_0x833f('0x3f')](_0x3eef4c[_0x833f('0x3e')]);_0x4d88b6['filters']=_[_0x833f('0x40')](_0x4d88b6[_0x833f('0x3d')],_0x4d88b6[_0x833f('0x3e')]);_0xe6c194['attributes']=_[_0x833f('0x40')](_0x4d88b6['model'],qs[_0x833f('0x41')](_0x3eef4c['query'][_0x833f('0x41')]));_0xe6c194['attributes']=_0xe6c194[_0x833f('0x42')]['length']?_0xe6c194[_0x833f('0x42')]:_0x4d88b6[_0x833f('0x3d')];if(!_0x3eef4c['query'][_0x833f('0x43')]('nolimit')){_0xe6c194[_0x833f('0x44')]=qs[_0x833f('0x44')](_0x3eef4c[_0x833f('0x3e')][_0x833f('0x44')]);_0xe6c194['offset']=qs['offset'](_0x3eef4c['query'][_0x833f('0x2d')]);}_0xe6c194[_0x833f('0x45')]=qs[_0x833f('0x46')](_0x3eef4c['query']['sort']);_0xe6c194[_0x833f('0x47')]=qs[_0x833f('0x48')](_['pick'](_0x3eef4c[_0x833f('0x3e')],_0x4d88b6[_0x833f('0x48')]),_0x5d3d3f);if(_0x3eef4c['query'][_0x833f('0x49')]){_0xe6c194[_0x833f('0x47')]=_[_0x833f('0x4a')](_0xe6c194[_0x833f('0x47')],{'$or':_[_0x833f('0x37')](_0x5d3d3f,function(_0x161182){if(_0x161182[_0x833f('0x3b')]!==_0x833f('0x4b')){var _0x54f290={};_0x54f290[_0x161182[_0x833f('0x35')]]={'$like':'%'+_0x3eef4c['query']['filter']+'%'};return _0x54f290;}})});}_0xe6c194=_[_0x833f('0x4a')]({},_0xe6c194,_0x3eef4c['options']);var _0xf74d10={'where':_0xe6c194[_0x833f('0x47')]};return db[_0x833f('0x38')][_0x833f('0x2c')](_0xf74d10)[_0x833f('0x1f')](function(_0x241ced){_0x1992a5[_0x833f('0x2c')]=_0x241ced;if(_0x3eef4c['query']['includeAll']){_0xe6c194[_0x833f('0x4c')]=[{'all':!![]}];}return db[_0x833f('0x38')][_0x833f('0x4d')](_0xe6c194);})[_0x833f('0x1f')](function(_0x27f883){_0x1992a5['rows']=_0x27f883;return _0x1992a5;})['then'](respondWithFilteredResult(_0x49b869,_0xe6c194))[_0x833f('0x28')](handleError(_0x49b869,null));};exports[_0x833f('0x4e')]=function(_0x20c2cd,_0x523990){var _0x157471={'raw':![],'where':{'id':_0x20c2cd[_0x833f('0x4f')]['id']}},_0x2eebcf={};_0x2eebcf[_0x833f('0x3d')]=_['keys'](db[_0x833f('0x38')][_0x833f('0x39')]);_0x2eebcf['query']=_[_0x833f('0x3f')](_0x20c2cd[_0x833f('0x3e')]);_0x2eebcf[_0x833f('0x48')]=_[_0x833f('0x40')](_0x2eebcf[_0x833f('0x3d')],_0x2eebcf[_0x833f('0x3e')]);_0x157471[_0x833f('0x42')]=_[_0x833f('0x40')](_0x2eebcf[_0x833f('0x3d')],qs['fields'](_0x20c2cd['query'][_0x833f('0x41')]));_0x157471[_0x833f('0x42')]=_0x157471[_0x833f('0x42')][_0x833f('0x50')]?_0x157471['attributes']:_0x2eebcf['model'];if(_0x20c2cd['query'][_0x833f('0x51')]){_0x157471[_0x833f('0x4c')]=[{'all':!![]}];}_0x157471=_['merge']({},_0x157471,_0x20c2cd[_0x833f('0x52')]);return db[_0x833f('0x38')][_0x833f('0x53')](_0x157471)[_0x833f('0x1f')](handleEntityNotFound(_0x523990,null))[_0x833f('0x1f')](respondWithResult(_0x523990,null))[_0x833f('0x28')](handleError(_0x523990,null));};exports[_0x833f('0x54')]=function(_0x1a80c0,_0x308c5c){return db[_0x833f('0x38')][_0x833f('0x54')](_0x1a80c0[_0x833f('0x55')],{})[_0x833f('0x1f')](respondWithResult(_0x308c5c,0xc9))[_0x833f('0x28')](handleError(_0x308c5c,null));};exports['update']=function(_0x286325,_0x51cfda){if(_0x286325['body']['id']){delete _0x286325[_0x833f('0x55')]['id'];}return db[_0x833f('0x38')][_0x833f('0x53')]({'where':{'id':_0x286325[_0x833f('0x4f')]['id']}})[_0x833f('0x1f')](handleEntityNotFound(_0x51cfda,null))[_0x833f('0x1f')](saveUpdates(_0x286325[_0x833f('0x55')],null))[_0x833f('0x1f')](respondWithResult(_0x51cfda,null))[_0x833f('0x28')](handleError(_0x51cfda,null));};exports['destroy']=function(_0x45bd8b,_0xd140ca){return db[_0x833f('0x38')][_0x833f('0x53')]({'where':{'id':_0x45bd8b[_0x833f('0x4f')]['id']}})[_0x833f('0x1f')](handleEntityNotFound(_0xd140ca,null))['then'](removeEntity(_0xd140ca,null))[_0x833f('0x28')](handleError(_0xd140ca,null));};exports[_0x833f('0x56')]=function(_0x32922b,_0x291509,_0x287ff3){var _0x516f3e={};var _0x51bb41={};var _0x55350e;var _0x38641e;return db[_0x833f('0x38')][_0x833f('0x57')]({'where':{'id':_0x32922b[_0x833f('0x4f')]['id']}})[_0x833f('0x1f')](handleEntityNotFound(_0x291509,null))[_0x833f('0x1f')](function(_0x889c47){if(_0x889c47){_0x55350e=_0x889c47;_0x51bb41[_0x833f('0x3d')]=_[_0x833f('0x3f')](db['DeskField'][_0x833f('0x39')]);_0x51bb41[_0x833f('0x3e')]=_['keys'](_0x32922b['query']);_0x51bb41[_0x833f('0x48')]=_[_0x833f('0x40')](_0x51bb41[_0x833f('0x3d')],_0x51bb41[_0x833f('0x3e')]);_0x516f3e['attributes']=_[_0x833f('0x40')](_0x51bb41['model'],qs['fields'](_0x32922b[_0x833f('0x3e')]['fields']));_0x516f3e[_0x833f('0x42')]=_0x516f3e['attributes'][_0x833f('0x50')]?_0x516f3e[_0x833f('0x42')]:_0x51bb41[_0x833f('0x3d')];_0x516f3e[_0x833f('0x45')]=qs[_0x833f('0x46')](_0x32922b['query'][_0x833f('0x46')]);_0x516f3e[_0x833f('0x47')]=qs[_0x833f('0x48')](_['pick'](_0x32922b['query'],_0x51bb41[_0x833f('0x48')]));if(_0x32922b[_0x833f('0x3e')]['filter']){_0x516f3e[_0x833f('0x47')]=_[_0x833f('0x4a')](_0x516f3e['where'],{'$or':_[_0x833f('0x37')](_0x516f3e[_0x833f('0x42')],function(_0x4206a4){var _0x2b51ed={};_0x2b51ed[_0x4206a4]={'$like':'%'+_0x32922b[_0x833f('0x3e')][_0x833f('0x49')]+'%'};return _0x2b51ed;})});}_0x516f3e=_[_0x833f('0x4a')]({},_0x516f3e,_0x32922b['options']);return _0x55350e[_0x833f('0x56')](_0x516f3e);}})[_0x833f('0x1f')](function(_0x4e5dc1){if(_0x4e5dc1){_0x38641e=_0x4e5dc1[_0x833f('0x50')];if(!_0x32922b['query'][_0x833f('0x43')](_0x833f('0x58'))){_0x516f3e[_0x833f('0x44')]=qs[_0x833f('0x44')](_0x32922b[_0x833f('0x3e')][_0x833f('0x44')]);_0x516f3e[_0x833f('0x2d')]=qs[_0x833f('0x2d')](_0x32922b[_0x833f('0x3e')]['offset']);}return _0x55350e['getFields'](_0x516f3e);}})[_0x833f('0x1f')](function(_0x224b1e){if(_0x224b1e){return _0x224b1e?{'count':_0x38641e,'rows':_0x224b1e}:null;}})['then'](respondWithResult(_0x291509,null))[_0x833f('0x28')](handleError(_0x291509,null));};exports['getSubjects']=function(_0x28ffba,_0x2dee3d,_0x300be2){var _0x9be24f={};var _0x34e293={};var _0x5383f0;var _0x41fe4c;return db[_0x833f('0x38')][_0x833f('0x57')]({'where':{'id':_0x28ffba['params']['id']}})[_0x833f('0x1f')](handleEntityNotFound(_0x2dee3d,null))['then'](function(_0x3e9e2d){if(_0x3e9e2d){_0x5383f0=_0x3e9e2d;_0x34e293[_0x833f('0x3d')]=_[_0x833f('0x3f')](db[_0x833f('0x59')][_0x833f('0x39')]);_0x34e293['query']=_[_0x833f('0x3f')](_0x28ffba[_0x833f('0x3e')]);_0x34e293[_0x833f('0x48')]=_[_0x833f('0x40')](_0x34e293[_0x833f('0x3d')],_0x34e293['query']);_0x9be24f[_0x833f('0x42')]=_[_0x833f('0x40')](_0x34e293[_0x833f('0x3d')],qs[_0x833f('0x41')](_0x28ffba[_0x833f('0x3e')][_0x833f('0x41')]));_0x9be24f[_0x833f('0x42')]=_0x9be24f['attributes'][_0x833f('0x50')]?_0x9be24f['attributes']:_0x34e293[_0x833f('0x3d')];_0x9be24f[_0x833f('0x45')]=qs[_0x833f('0x46')](_0x28ffba['query'][_0x833f('0x46')]);_0x9be24f[_0x833f('0x47')]=qs[_0x833f('0x48')](_[_0x833f('0x5a')](_0x28ffba[_0x833f('0x3e')],_0x34e293['filters']));if(_0x28ffba[_0x833f('0x3e')][_0x833f('0x49')]){_0x9be24f[_0x833f('0x47')]=_['merge'](_0x9be24f[_0x833f('0x47')],{'$or':_[_0x833f('0x37')](_0x9be24f[_0x833f('0x42')],function(_0x46bf00){var _0x34c9b8={};_0x34c9b8[_0x46bf00]={'$like':'%'+_0x28ffba['query'][_0x833f('0x49')]+'%'};return _0x34c9b8;})});}_0x9be24f=_[_0x833f('0x4a')]({},_0x9be24f,_0x28ffba['options']);return _0x5383f0[_0x833f('0x5b')](_0x9be24f);}})['then'](function(_0x22a77f){if(_0x22a77f){_0x41fe4c=_0x22a77f[_0x833f('0x50')];if(!_0x28ffba[_0x833f('0x3e')][_0x833f('0x43')]('nolimit')){_0x9be24f[_0x833f('0x44')]=qs[_0x833f('0x44')](_0x28ffba[_0x833f('0x3e')][_0x833f('0x44')]);_0x9be24f[_0x833f('0x2d')]=qs[_0x833f('0x2d')](_0x28ffba[_0x833f('0x3e')][_0x833f('0x2d')]);}return _0x5383f0[_0x833f('0x5b')](_0x9be24f);}})['then'](function(_0xc7a85a){if(_0xc7a85a){return _0xc7a85a?{'count':_0x41fe4c,'rows':_0xc7a85a}:null;}})['then'](respondWithResult(_0x2dee3d,null))['catch'](handleError(_0x2dee3d,null));};exports[_0x833f('0x5c')]=function(_0x23a029,_0xcd8814,_0x15a7bb){var _0x49a3d1={};var _0x59be62={};var _0x37d4a2;var _0x30ea7c;return db[_0x833f('0x38')][_0x833f('0x57')]({'where':{'id':_0x23a029['params']['id']}})[_0x833f('0x1f')](handleEntityNotFound(_0xcd8814,null))[_0x833f('0x1f')](function(_0x3624d1){if(_0x3624d1){_0x37d4a2=_0x3624d1;_0x59be62[_0x833f('0x3d')]=_[_0x833f('0x3f')](db[_0x833f('0x59')]['rawAttributes']);_0x59be62[_0x833f('0x3e')]=_[_0x833f('0x3f')](_0x23a029['query']);_0x59be62[_0x833f('0x48')]=_[_0x833f('0x40')](_0x59be62['model'],_0x59be62['query']);_0x49a3d1['attributes']=_['intersection'](_0x59be62[_0x833f('0x3d')],qs['fields'](_0x23a029[_0x833f('0x3e')][_0x833f('0x41')]));_0x49a3d1['attributes']=_0x49a3d1[_0x833f('0x42')][_0x833f('0x50')]?_0x49a3d1[_0x833f('0x42')]:_0x59be62[_0x833f('0x3d')];_0x49a3d1['order']=qs['sort'](_0x23a029[_0x833f('0x3e')][_0x833f('0x46')]);_0x49a3d1[_0x833f('0x47')]=qs['filters'](_['pick'](_0x23a029['query'],_0x59be62[_0x833f('0x48')]));if(_0x23a029['query'][_0x833f('0x49')]){_0x49a3d1[_0x833f('0x47')]=_[_0x833f('0x4a')](_0x49a3d1[_0x833f('0x47')],{'$or':_[_0x833f('0x37')](_0x49a3d1[_0x833f('0x42')],function(_0x34bee5){var _0x5009c0={};_0x5009c0[_0x34bee5]={'$like':'%'+_0x23a029[_0x833f('0x3e')]['filter']+'%'};return _0x5009c0;})});}_0x49a3d1=_[_0x833f('0x4a')]({},_0x49a3d1,_0x23a029[_0x833f('0x52')]);return _0x37d4a2[_0x833f('0x5c')](_0x49a3d1);}})[_0x833f('0x1f')](function(_0xff7eae){if(_0xff7eae){_0x30ea7c=_0xff7eae[_0x833f('0x50')];if(!_0x23a029[_0x833f('0x3e')][_0x833f('0x43')](_0x833f('0x58'))){_0x49a3d1['limit']=qs[_0x833f('0x44')](_0x23a029['query']['limit']);_0x49a3d1['offset']=qs[_0x833f('0x2d')](_0x23a029['query'][_0x833f('0x2d')]);}return _0x37d4a2['getDescriptions'](_0x49a3d1);}})[_0x833f('0x1f')](function(_0x1cb892){if(_0x1cb892){return _0x1cb892?{'count':_0x30ea7c,'rows':_0x1cb892}:null;}})[_0x833f('0x1f')](respondWithResult(_0xcd8814,null))[_0x833f('0x28')](handleError(_0xcd8814,null));};exports[_0x833f('0x5d')]=function(_0x219c1f,_0x1d2247,_0x68d0e5){var _0x27aa84={};var _0x1be5fd={};var _0x26a6c2;var _0x2aa32a;return db['DeskConfiguration'][_0x833f('0x57')]({'where':{'id':_0x219c1f[_0x833f('0x4f')]['id']}})[_0x833f('0x1f')](handleEntityNotFound(_0x1d2247,null))[_0x833f('0x1f')](function(_0x1b8b5f){if(_0x1b8b5f){_0x26a6c2=_0x1b8b5f;_0x1be5fd[_0x833f('0x3d')]=_[_0x833f('0x3f')](db['Tag'][_0x833f('0x39')]);_0x1be5fd['query']=_[_0x833f('0x3f')](_0x219c1f[_0x833f('0x3e')]);_0x1be5fd['filters']=_['intersection'](_0x1be5fd[_0x833f('0x3d')],_0x1be5fd[_0x833f('0x3e')]);_0x27aa84[_0x833f('0x42')]=_[_0x833f('0x40')](_0x1be5fd[_0x833f('0x3d')],qs[_0x833f('0x41')](_0x219c1f[_0x833f('0x3e')]['fields']));_0x27aa84[_0x833f('0x42')]=_0x27aa84[_0x833f('0x42')][_0x833f('0x50')]?_0x27aa84[_0x833f('0x42')]:_0x1be5fd['model'];_0x27aa84[_0x833f('0x45')]=qs['sort'](_0x219c1f['query'][_0x833f('0x46')]);_0x27aa84['where']=qs[_0x833f('0x48')](_[_0x833f('0x5a')](_0x219c1f[_0x833f('0x3e')],_0x1be5fd[_0x833f('0x48')]));if(_0x219c1f[_0x833f('0x3e')][_0x833f('0x49')]){_0x27aa84[_0x833f('0x47')]=_[_0x833f('0x4a')](_0x27aa84['where'],{'$or':_[_0x833f('0x37')](_0x27aa84[_0x833f('0x42')],function(_0xc83e26){var _0x590fc5={};_0x590fc5[_0xc83e26]={'$like':'%'+_0x219c1f[_0x833f('0x3e')][_0x833f('0x49')]+'%'};return _0x590fc5;})});}_0x27aa84=_[_0x833f('0x4a')]({},_0x27aa84,_0x219c1f[_0x833f('0x52')]);return _0x26a6c2[_0x833f('0x5d')](_0x27aa84);}})[_0x833f('0x1f')](function(_0x405ff7){if(_0x405ff7){_0x2aa32a=_0x405ff7['length'];if(!_0x219c1f[_0x833f('0x3e')][_0x833f('0x43')](_0x833f('0x58'))){_0x27aa84[_0x833f('0x44')]=qs[_0x833f('0x44')](_0x219c1f[_0x833f('0x3e')][_0x833f('0x44')]);_0x27aa84[_0x833f('0x2d')]=qs[_0x833f('0x2d')](_0x219c1f['query']['offset']);}return _0x26a6c2[_0x833f('0x5d')](_0x27aa84);}})[_0x833f('0x1f')](function(_0x3d36c6){if(_0x3d36c6){return _0x3d36c6?{'count':_0x2aa32a,'rows':_0x3d36c6}:null;}})[_0x833f('0x1f')](respondWithResult(_0x1d2247,null))['catch'](handleError(_0x1d2247,null));};exports[_0x833f('0x5e')]=function(_0x1d0118,_0x2cd195,_0xd18c7f){if(_0x1d0118[_0x833f('0x55')]['id']){delete _0x1d0118['body']['id'];}return db[_0x833f('0x38')][_0x833f('0x57')]({'where':{'id':_0x1d0118['params']['id']}})['then'](handleEntityNotFound(_0x2cd195,null))[_0x833f('0x1f')](function(_0x18a709){if(_0x18a709){return _0x18a709[_0x833f('0x5e')](_0x1d0118['body'][_0x833f('0x5f')]||[]);}return null;})[_0x833f('0x1f')](respondWithResult(_0x2cd195,null))[_0x833f('0x28')](handleError(_0x2cd195,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 543d9d3..3a30c4e 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 _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 +var _0x3abb=['request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','lodash','util','api','bluebird'];(function(_0x33bc5a,_0x3a048d){var _0x5826fd=function(_0x55f85e){while(--_0x55f85e){_0x33bc5a['push'](_0x33bc5a['shift']());}};_0x5826fd(++_0x3a048d);}(_0x3abb,0x130));var _0xb3ab=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x3abb[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xb3ab('0x0'));var util=require(_0xb3ab('0x1'));var logger=require('../../config/logger')(_0xb3ab('0x2'));var moment=require('moment');var BPromise=require(_0xb3ab('0x3'));var rp=require(_0xb3ab('0x4'));var fs=require('fs');var path=require(_0xb3ab('0x5'));var rimraf=require(_0xb3ab('0x6'));var config=require(_0xb3ab('0x7'));var attributes=require(_0xb3ab('0x8'));module[_0xb3ab('0x9')]=function(_0x16f9ea,_0x248c0a){return _0x16f9ea[_0xb3ab('0xa')]('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','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 c30b59e..3742e15 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 _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 +var _0xd136=['request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd136,0x94));var _0x6d13=function(_0x5a7c54,_0x362eda){_0x5a7c54=_0x5a7c54-0x0;var _0x26f8e1=_0xd136[_0x5a7c54];return _0x26f8e1;};'use strict';var _=require('lodash');var util=require(_0x6d13('0x0'));var moment=require(_0x6d13('0x1'));var BPromise=require('bluebird');var rs=require(_0x6d13('0x2'));var fs=require('fs');var Redis=require(_0x6d13('0x3'));var db=require(_0x6d13('0x4'))['db'];var utils=require(_0x6d13('0x5'));var logger=require(_0x6d13('0x6'))(_0x6d13('0x7'));var config=require(_0x6d13('0x8'));var jayson=require(_0x6d13('0x9'));var client=jayson[_0x6d13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x335482,_0xdf6760,_0x4c563a){return new BPromise(function(_0x598021,_0x1af16f){return client[_0x6d13('0xb')](_0x335482,_0x4c563a)[_0x6d13('0xc')](function(_0x2216d7){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0xdf6760,_0x6d13('0xd'));logger[_0x6d13('0xe')](_0x6d13('0xf'),_0xdf6760,'request\x20sent',JSON['stringify'](_0x2216d7));if(_0x2216d7[_0x6d13('0x10')]){if(_0x2216d7[_0x6d13('0x10')][_0x6d13('0x11')]===0x1f4){logger['error'](_0x6d13('0x12'),_0xdf6760,_0x2216d7[_0x6d13('0x10')][_0x6d13('0x13')]);return _0x1af16f(_0x2216d7[_0x6d13('0x10')]['message']);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0xdf6760,_0x2216d7[_0x6d13('0x10')][_0x6d13('0x13')]);return _0x598021(_0x2216d7[_0x6d13('0x10')][_0x6d13('0x13')]);}else{logger[_0x6d13('0x14')]('DeskConfiguration,\x20%s,\x20%s',_0xdf6760,_0x6d13('0xd'));_0x598021(_0x2216d7[_0x6d13('0x15')][_0x6d13('0x13')]);}})[_0x6d13('0x16')](function(_0x348cab){logger[_0x6d13('0x10')](_0x6d13('0x12'),_0xdf6760,_0x348cab);_0x1af16f(_0x348cab);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index a695790..05cd2e3 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 _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 +var _0xeae6=['../../config/environment','./intDeskField.controller','get','isAuthenticated','post','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0xcdbedd,_0x1571e1){var _0xa17e51=function(_0x1533fb){while(--_0x1533fb){_0xcdbedd['push'](_0xcdbedd['shift']());}};_0xa17e51(++_0x1571e1);}(_0xeae6,0x13b));var _0x6eae=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeae6[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x6eae('0x0'));var path=require(_0x6eae('0x1'));var timeout=require(_0x6eae('0x2'));var express=require(_0x6eae('0x3'));var router=express[_0x6eae('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6eae('0x5'));var controller=require(_0x6eae('0x6'));router[_0x6eae('0x7')]('/',auth[_0x6eae('0x8')](),controller['index']);router[_0x6eae('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6eae('0x9')]('/',auth[_0x6eae('0x8')](),controller['create']);router[_0x6eae('0xa')](_0x6eae('0xb'),auth['isAuthenticated'](),controller[_0x6eae('0xc')]);router[_0x6eae('0xd')]('/:id',auth[_0x6eae('0x8')](),controller[_0x6eae('0xe')]);module[_0x6eae('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index ff24dad..a0a0194 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 _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 +var _0x055f=['sequelize','exports','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x256ccf,_0x53a69d){var _0x1ae9cc=function(_0x19d603){while(--_0x19d603){_0x256ccf['push'](_0x256ccf['shift']());}};_0x1ae9cc(++_0x53a69d);}(_0x055f,0x98));var _0xf055=function(_0x497588,_0x2df2d8){_0x497588=_0x497588-0x0;var _0x32107c=_0x055f[_0x497588];return _0x32107c;};'use strict';var Sequelize=require(_0xf055('0x0'));module[_0xf055('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf055('0x2'),_0xf055('0x3'),_0xf055('0x4'),_0xf055('0x5')),'defaultValue':_0xf055('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xf055('0x2'),'variable',_0xf055('0x4'))},'keyContent':{'type':Sequelize[_0xf055('0x6')]},'idField':{'type':Sequelize[_0xf055('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf055('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf055('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index eacc224..329d818 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 _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 +var _0x0f6a=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','count','include','findAll','rows','catch','show','includeAll','find','create','body','destroy','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','reject','save','update','then','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x3681a4,_0x255a2e){var _0x1b7836=function(_0x24d81f){while(--_0x24d81f){_0x3681a4['push'](_0x3681a4['shift']());}};_0x1b7836(++_0x255a2e);}(_0x0f6a,0x1ae));var _0xa0f6=function(_0x165ab0,_0xa52cf6){_0x165ab0=_0x165ab0-0x0;var _0x2dfde5=_0x0f6a[_0x165ab0];return _0x2dfde5;};'use strict';var pdf=require(_0xa0f6('0x0'));var emlformat=require(_0xa0f6('0x1'));var rimraf=require(_0xa0f6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa0f6('0x3'));var moment=require('moment');var BPromise=require(_0xa0f6('0x4'));var Mustache=require(_0xa0f6('0x5'));var util=require(_0xa0f6('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa0f6('0x7'));var ejs=require(_0xa0f6('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa0f6('0x9'));var crypto=require(_0xa0f6('0xa'));var jsforce=require(_0xa0f6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa0f6('0x7'));var querystring=require(_0xa0f6('0xc'));var Papa=require('papaparse');var Redis=require(_0xa0f6('0xd'));var authService=require(_0xa0f6('0xe'));var qs=require(_0xa0f6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa0f6('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa0f6('0x11'));var licenseUtil=require(_0xa0f6('0x12'));var db=require(_0xa0f6('0x13'))['db'];function respondWithStatusCode(_0x54df17,_0x2af27e){_0x2af27e=_0x2af27e||0xcc;return function(_0x54b4d0){if(_0x54b4d0){return _0x54df17[_0xa0f6('0x14')](_0x2af27e);}return _0x54df17['status'](_0x2af27e)[_0xa0f6('0x15')]();};}function respondWithResult(_0x34328f,_0x419ebe){_0x419ebe=_0x419ebe||0xc8;return function(_0x4abb02){if(_0x4abb02){return _0x34328f[_0xa0f6('0x16')](_0x419ebe)[_0xa0f6('0x17')](_0x4abb02);}};}function respondWithFilteredResult(_0x54dd02,_0x3397b6){return function(_0xec4335){if(_0xec4335){var _0x1652dd=_0xec4335['count'],_0x18204a=_0x3397b6['offset'],_0x19ad5d=_0x3397b6[_0xa0f6('0x18')]+_0x3397b6[_0xa0f6('0x19')],_0x48ae6b;if(_0x19ad5d>=_0x1652dd){_0x19ad5d=_0x1652dd;_0x48ae6b=0xc8;}else{_0x48ae6b=0xce;}_0x54dd02[_0xa0f6('0x16')](_0x48ae6b);return _0x54dd02['set']('Content-Range',_0x18204a+'-'+_0x19ad5d+'/'+_0x1652dd)[_0xa0f6('0x17')](_0xec4335);}return null;};}function patchUpdates(_0x402b8a){return function(_0x139067){try{jsonpatch['apply'](_0x139067,_0x402b8a,!![]);}catch(_0x55599c){return BPromise[_0xa0f6('0x1a')](_0x55599c);}return _0x139067[_0xa0f6('0x1b')]();};}function saveUpdates(_0x1c8ffd,_0x285926){return function(_0x48e8e7){if(_0x48e8e7){return _0x48e8e7[_0xa0f6('0x1c')](_0x1c8ffd)[_0xa0f6('0x1d')](function(_0x2b3358){return _0x2b3358;});}return null;};}function removeEntity(_0x1d93c1,_0x4c0217){return function(_0x1ed2be){if(_0x1ed2be){return _0x1ed2be['destroy']()['then'](function(){_0x1d93c1['status'](0xcc)[_0xa0f6('0x15')]();});}};}function handleEntityNotFound(_0x17c37b,_0x1a4895){return function(_0x4382cd){if(!_0x4382cd){_0x17c37b[_0xa0f6('0x14')](0x194);}return _0x4382cd;};}function handleError(_0x5b302f,_0x420343){_0x420343=_0x420343||0x1f4;return function(_0x1a6e2b){logger[_0xa0f6('0x1e')](_0x1a6e2b[_0xa0f6('0x1f')]);if(_0x1a6e2b[_0xa0f6('0x20')]){delete _0x1a6e2b[_0xa0f6('0x20')];}_0x5b302f['status'](_0x420343)[_0xa0f6('0x21')](_0x1a6e2b);};}exports[_0xa0f6('0x22')]=function(_0x40b7ca,_0x5d6435){var _0x9e7c5e={},_0x4d8224={},_0x207069={'count':0x0,'rows':[]};var _0x583c18=_[_0xa0f6('0x23')](db[_0xa0f6('0x24')][_0xa0f6('0x25')],function(_0x27ed74){return{'name':_0x27ed74[_0xa0f6('0x26')],'type':_0x27ed74[_0xa0f6('0x27')][_0xa0f6('0x28')]};});_0x4d8224[_0xa0f6('0x29')]=_[_0xa0f6('0x23')](_0x583c18,_0xa0f6('0x20'));_0x4d8224[_0xa0f6('0x2a')]=_[_0xa0f6('0x2b')](_0x40b7ca[_0xa0f6('0x2a')]);_0x4d8224[_0xa0f6('0x2c')]=_[_0xa0f6('0x2d')](_0x4d8224[_0xa0f6('0x29')],_0x4d8224[_0xa0f6('0x2a')]);_0x9e7c5e[_0xa0f6('0x2e')]=_[_0xa0f6('0x2d')](_0x4d8224[_0xa0f6('0x29')],qs[_0xa0f6('0x2f')](_0x40b7ca[_0xa0f6('0x2a')][_0xa0f6('0x2f')]));_0x9e7c5e[_0xa0f6('0x2e')]=_0x9e7c5e['attributes'][_0xa0f6('0x30')]?_0x9e7c5e['attributes']:_0x4d8224[_0xa0f6('0x29')];if(!_0x40b7ca[_0xa0f6('0x2a')][_0xa0f6('0x31')](_0xa0f6('0x32'))){_0x9e7c5e['limit']=qs[_0xa0f6('0x19')](_0x40b7ca[_0xa0f6('0x2a')]['limit']);_0x9e7c5e[_0xa0f6('0x18')]=qs[_0xa0f6('0x18')](_0x40b7ca['query'][_0xa0f6('0x18')]);}_0x9e7c5e['order']=qs[_0xa0f6('0x33')](_0x40b7ca['query']['sort']);_0x9e7c5e[_0xa0f6('0x34')]=qs[_0xa0f6('0x2c')](_[_0xa0f6('0x35')](_0x40b7ca[_0xa0f6('0x2a')],_0x4d8224[_0xa0f6('0x2c')]),_0x583c18);if(_0x40b7ca[_0xa0f6('0x2a')][_0xa0f6('0x36')]){_0x9e7c5e['where']=_[_0xa0f6('0x37')](_0x9e7c5e[_0xa0f6('0x34')],{'$or':_[_0xa0f6('0x23')](_0x583c18,function(_0x57eaaa){if(_0x57eaaa[_0xa0f6('0x27')]!=='VIRTUAL'){var _0x14dbde={};_0x14dbde[_0x57eaaa['name']]={'$like':'%'+_0x40b7ca[_0xa0f6('0x2a')]['filter']+'%'};return _0x14dbde;}})});}_0x9e7c5e=_['merge']({},_0x9e7c5e,_0x40b7ca[_0xa0f6('0x38')]);var _0x59d456={'where':_0x9e7c5e[_0xa0f6('0x34')]};return db[_0xa0f6('0x24')][_0xa0f6('0x39')](_0x59d456)[_0xa0f6('0x1d')](function(_0x403d6d){_0x207069['count']=_0x403d6d;if(_0x40b7ca['query']['includeAll']){_0x9e7c5e[_0xa0f6('0x3a')]=[{'all':!![]}];}return db[_0xa0f6('0x24')][_0xa0f6('0x3b')](_0x9e7c5e);})['then'](function(_0x253391){_0x207069[_0xa0f6('0x3c')]=_0x253391;return _0x207069;})['then'](respondWithFilteredResult(_0x5d6435,_0x9e7c5e))[_0xa0f6('0x3d')](handleError(_0x5d6435,null));};exports[_0xa0f6('0x3e')]=function(_0xec6aa9,_0x3b5a36){var _0x2d00c8={'raw':!![],'where':{'id':_0xec6aa9['params']['id']}},_0x15ea86={};_0x15ea86[_0xa0f6('0x29')]=_[_0xa0f6('0x2b')](db[_0xa0f6('0x24')][_0xa0f6('0x25')]);_0x15ea86[_0xa0f6('0x2a')]=_['keys'](_0xec6aa9[_0xa0f6('0x2a')]);_0x15ea86[_0xa0f6('0x2c')]=_[_0xa0f6('0x2d')](_0x15ea86[_0xa0f6('0x29')],_0x15ea86[_0xa0f6('0x2a')]);_0x2d00c8[_0xa0f6('0x2e')]=_[_0xa0f6('0x2d')](_0x15ea86[_0xa0f6('0x29')],qs['fields'](_0xec6aa9[_0xa0f6('0x2a')][_0xa0f6('0x2f')]));_0x2d00c8[_0xa0f6('0x2e')]=_0x2d00c8['attributes']['length']?_0x2d00c8[_0xa0f6('0x2e')]:_0x15ea86['model'];if(_0xec6aa9['query'][_0xa0f6('0x3f')]){_0x2d00c8[_0xa0f6('0x3a')]=[{'all':!![]}];}_0x2d00c8=_[_0xa0f6('0x37')]({},_0x2d00c8,_0xec6aa9['options']);return db[_0xa0f6('0x24')][_0xa0f6('0x40')](_0x2d00c8)[_0xa0f6('0x1d')](handleEntityNotFound(_0x3b5a36,null))[_0xa0f6('0x1d')](respondWithResult(_0x3b5a36,null))[_0xa0f6('0x3d')](handleError(_0x3b5a36,null));};exports[_0xa0f6('0x41')]=function(_0x3e0aa9,_0x5b375b){return db[_0xa0f6('0x24')][_0xa0f6('0x41')](_0x3e0aa9[_0xa0f6('0x42')],{})[_0xa0f6('0x1d')](respondWithResult(_0x5b375b,0xc9))['catch'](handleError(_0x5b375b,null));};exports[_0xa0f6('0x1c')]=function(_0x1b6ca3,_0x19be11){if(_0x1b6ca3[_0xa0f6('0x42')]['id']){delete _0x1b6ca3[_0xa0f6('0x42')]['id'];}return db[_0xa0f6('0x24')]['find']({'where':{'id':_0x1b6ca3['params']['id']}})[_0xa0f6('0x1d')](handleEntityNotFound(_0x19be11,null))[_0xa0f6('0x1d')](saveUpdates(_0x1b6ca3[_0xa0f6('0x42')],null))['then'](respondWithResult(_0x19be11,null))[_0xa0f6('0x3d')](handleError(_0x19be11,null));};exports[_0xa0f6('0x43')]=function(_0x1bd736,_0x283505){return db[_0xa0f6('0x24')]['find']({'where':{'id':_0x1bd736['params']['id']}})[_0xa0f6('0x1d')](handleEntityNotFound(_0x283505,null))[_0xa0f6('0x1d')](removeEntity(_0x283505,null))[_0xa0f6('0x3d')](handleError(_0x283505,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 6a88ccc..0b783f8 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 _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 +var _0x6790=['FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','idField'];(function(_0x521454,_0x6a8aec){var _0x37326a=function(_0x2e42e9){while(--_0x2e42e9){_0x521454['push'](_0x521454['shift']());}};_0x37326a(++_0x6a8aec);}(_0x6790,0xd3));var _0x0679=function(_0x3ad765,_0x2a4349){_0x3ad765=_0x3ad765-0x0;var _0x2124d4=_0x6790[_0x3ad765];return _0x2124d4;};'use strict';var _=require(_0x0679('0x0'));var util=require(_0x0679('0x1'));var logger=require(_0x0679('0x2'))('api');var moment=require(_0x0679('0x3'));var BPromise=require(_0x0679('0x4'));var rp=require(_0x0679('0x5'));var fs=require('fs');var path=require(_0x0679('0x6'));var rimraf=require(_0x0679('0x7'));var config=require('../../config/environment');var attributes=require(_0x0679('0x8'));module[_0x0679('0x9')]=function(_0xdf38d,_0x50f8d2){return _0xdf38d[_0x0679('0xa')]('DeskField',attributes,{'tableName':_0x0679('0xb'),'paranoid':![],'indexes':[{'name':_0x0679('0xc'),'fields':[_0x0679('0xd'),_0x0679('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 62b1eb8..d2b163e 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 _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 +var _0x86ea=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3c1a9d,_0x2c5d6b){var _0x563f8a=function(_0x1b778b){while(--_0x1b778b){_0x3c1a9d['push'](_0x3c1a9d['shift']());}};_0x563f8a(++_0x2c5d6b);}(_0x86ea,0x16a));var _0xa86e=function(_0x3e6151,_0x491e07){_0x3e6151=_0x3e6151-0x0;var _0x33c41c=_0x86ea[_0x3e6151];return _0x33c41c;};'use strict';var _=require(_0xa86e('0x0'));var util=require(_0xa86e('0x1'));var moment=require(_0xa86e('0x2'));var BPromise=require(_0xa86e('0x3'));var rs=require(_0xa86e('0x4'));var fs=require('fs');var Redis=require(_0xa86e('0x5'));var db=require(_0xa86e('0x6'))['db'];var utils=require(_0xa86e('0x7'));var logger=require(_0xa86e('0x8'))(_0xa86e('0x9'));var config=require(_0xa86e('0xa'));var jayson=require(_0xa86e('0xb'));var client=jayson[_0xa86e('0xc')][_0xa86e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x7fa42,_0x54e312,_0x1da50b){return new BPromise(function(_0x237b83,_0x56d23b){return client[_0xa86e('0xe')](_0x7fa42,_0x1da50b)[_0xa86e('0xf')](function(_0x394a4a){logger[_0xa86e('0x10')](_0xa86e('0x11'),_0x54e312,_0xa86e('0x12'));logger['debug'](_0xa86e('0x13'),_0x54e312,_0xa86e('0x12'),JSON[_0xa86e('0x14')](_0x394a4a));if(_0x394a4a[_0xa86e('0x15')]){if(_0x394a4a['error'][_0xa86e('0x16')]===0x1f4){logger[_0xa86e('0x15')](_0xa86e('0x11'),_0x54e312,_0x394a4a[_0xa86e('0x15')][_0xa86e('0x17')]);return _0x56d23b(_0x394a4a[_0xa86e('0x15')]['message']);}logger[_0xa86e('0x15')](_0xa86e('0x11'),_0x54e312,_0x394a4a['error'][_0xa86e('0x17')]);return _0x237b83(_0x394a4a[_0xa86e('0x15')][_0xa86e('0x17')]);}else{logger['info'](_0xa86e('0x11'),_0x54e312,_0xa86e('0x12'));_0x237b83(_0x394a4a[_0xa86e('0x18')][_0xa86e('0x17')]);}})[_0xa86e('0x19')](function(_0x444043){logger[_0xa86e('0x15')]('DeskField,\x20%s,\x20%s',_0x54e312,_0x444043);_0x56d23b(_0x444043);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index c7cf1f2..cb000c3 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 _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 +var _0x8603=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','getConfigurations','getFields','create','/:id/configurations','put','update','delete','destroy','exports'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x8603,0x190));var _0x3860=function(_0x243236,_0x4bb35d){_0x243236=_0x243236-0x0;var _0x7b542f=_0x8603[_0x243236];return _0x7b542f;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x3860('0x3'));var interaction=require(_0x3860('0x4'));var config=require(_0x3860('0x5'));var controller=require('./intDynamics365Account.controller');router[_0x3860('0x6')]('/',auth['isAuthenticated'](),controller[_0x3860('0x7')]);router[_0x3860('0x6')](_0x3860('0x8'),auth[_0x3860('0x9')](),controller[_0x3860('0xa')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0x6')]('/:id/fields',auth[_0x3860('0x9')](),controller[_0x3860('0xc')]);router['post']('/',auth[_0x3860('0x9')](),controller[_0x3860('0xd')]);router['post'](_0x3860('0xe'),auth[_0x3860('0x9')](),controller['addConfiguration']);router[_0x3860('0xf')](_0x3860('0x8'),auth[_0x3860('0x9')](),controller[_0x3860('0x10')]);router[_0x3860('0x11')](_0x3860('0x8'),auth[_0x3860('0x9')](),controller[_0x3860('0x12')]);module[_0x3860('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 764aaa7..11ef1b7 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 _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 +var _0x0223=['STRING','exports'];(function(_0x28c16d,_0x2816e4){var _0x35dc8c=function(_0x370a21){while(--_0x370a21){_0x28c16d['push'](_0x28c16d['shift']());}};_0x35dc8c(++_0x2816e4);}(_0x0223,0x1f1));var _0x3022=function(_0x5d9be4,_0x5df4b6){_0x5d9be4=_0x5d9be4-0x0;var _0x44650b=_0x0223[_0x5d9be4];return _0x44650b;};'use strict';var Sequelize=require('sequelize');module[_0x3022('0x0')]={'name':{'type':Sequelize[_0x3022('0x1')]},'username':{'type':Sequelize[_0x3022('0x1')]},'password':{'type':Sequelize[_0x3022('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x3022('0x1')]},'clientId':{'type':Sequelize[_0x3022('0x1')]},'clientSecret':{'type':Sequelize[_0x3022('0x1')]},'serverUrl':{'type':Sequelize[_0x3022('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3022('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 442e45a..227c784 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 _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 +var _0x814b=['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','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','destroy','stack','name','send','Dynamics365Account','rawAttributes','fieldName','type','key','map','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','getConfigurations','findOne','Dynamics365Configuration','length','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','Dynamics365Field','getFields','ticketType','incident','customerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','billedserviceunits','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','responseby','responsiblecontactidyominame','sentimentvalue','slaname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','clientId','slice','substring','lastIndexOf','%s/api/data/v9.0/','POST','tenantId','/oauth2/token','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','MetadataId','EntityDefinitions(','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','Wrong\x20credentials','statusCode',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Bearer\x20','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel'];(function(_0x4ad364,_0x34d600){var _0x1ace8f=function(_0x4f4503){while(--_0x4f4503){_0x4ad364['push'](_0x4ad364['shift']());}};_0x1ace8f(++_0x34d600);}(_0x814b,0x1a2));var _0xb814=function(_0x16d6a2,_0x266958){_0x16d6a2=_0x16d6a2-0x0;var _0x681283=_0x814b[_0x16d6a2];return _0x681283;};'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'];var integrations=require(_0xb814('0x1b'));var jayson=require(_0xb814('0x1c'));var client=jayson[_0xb814('0x1d')][_0xb814('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1438e7,_0x41ed7b,_0xa0a2e5,_0x2ab627){return new BPromise(function(_0x3f4881,_0x44fb96){var _0x17f5bd=_0x2ab627||client;return _0x17f5bd[_0xb814('0x1f')](_0x1438e7,_0xa0a2e5)[_0xb814('0x20')](function(_0x3a71d6){logger[_0xb814('0x21')](_0xb814('0x22'),_0x41ed7b,_0xb814('0x23'));logger[_0xb814('0x24')](_0xb814('0x25'),_0x41ed7b,'request\x20sent',JSON[_0xb814('0x26')](_0x3a71d6));if(_0x3a71d6['error']){if(_0x3a71d6[_0xb814('0x27')][_0xb814('0x28')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x41ed7b,_0x3a71d6['error'][_0xb814('0x29')]);return _0x44fb96(_0x3a71d6['error']['message']);}logger[_0xb814('0x27')](_0xb814('0x22'),_0x41ed7b,_0x3a71d6[_0xb814('0x27')]['message']);return _0x3f4881(_0x3a71d6[_0xb814('0x27')]['message']);}else{logger[_0xb814('0x21')](_0xb814('0x22'),_0x41ed7b,_0xb814('0x23'));_0x3f4881(_0x3a71d6[_0xb814('0x2a')][_0xb814('0x29')]);}})[_0xb814('0x2b')](function(_0x1f5d40){logger['error'](_0xb814('0x22'),_0x41ed7b,_0x1f5d40);_0x44fb96(_0x1f5d40);});});}function respondWithStatusCode(_0x52b7a3,_0x3f81d0){_0x3f81d0=_0x3f81d0||0xcc;return function(_0x457dac){if(_0x457dac){return _0x52b7a3[_0xb814('0x2c')](_0x3f81d0);}return _0x52b7a3[_0xb814('0x2d')](_0x3f81d0)[_0xb814('0x2e')]();};}function respondWithResult(_0xb9e57d,_0x3d836c){_0x3d836c=_0x3d836c||0xc8;return function(_0x5755ea){if(_0x5755ea){return _0xb9e57d[_0xb814('0x2d')](_0x3d836c)[_0xb814('0x2f')](_0x5755ea);}};}function respondWithFilteredResult(_0x1c2625,_0x349394){return function(_0x32ed56){if(_0x32ed56){var _0x1d5965=_0x32ed56[_0xb814('0x30')],_0x3f0150=_0x349394[_0xb814('0x31')],_0x1e4e89=_0x349394['offset']+_0x349394[_0xb814('0x32')],_0x5a6291;if(_0x1e4e89>=_0x1d5965){_0x1e4e89=_0x1d5965;_0x5a6291=0xc8;}else{_0x5a6291=0xce;}_0x1c2625[_0xb814('0x2d')](_0x5a6291);return _0x1c2625[_0xb814('0x33')]('Content-Range',_0x3f0150+'-'+_0x1e4e89+'/'+_0x1d5965)[_0xb814('0x2f')](_0x32ed56);}return null;};}function patchUpdates(_0x2051d0){return function(_0x58c3ca){try{jsonpatch[_0xb814('0x34')](_0x58c3ca,_0x2051d0,!![]);}catch(_0x526610){return BPromise[_0xb814('0x35')](_0x526610);}return _0x58c3ca['save']();};}function saveUpdates(_0x4cfc58,_0x419cd9){return function(_0x4a4f27){if(_0x4a4f27){return _0x4a4f27[_0xb814('0x36')](_0x4cfc58)[_0xb814('0x20')](function(_0x2b91bd){return _0x2b91bd;});}return null;};}function removeEntity(_0x599f9f,_0x51d5ae){return function(_0x26d3a9){if(_0x26d3a9){return _0x26d3a9[_0xb814('0x37')]()['then'](function(){_0x599f9f[_0xb814('0x2d')](0xcc)[_0xb814('0x2e')]();});}};}function handleEntityNotFound(_0x692c72,_0x217b7e){return function(_0x1b78de){if(!_0x1b78de){_0x692c72[_0xb814('0x2c')](0x194);}return _0x1b78de;};}function handleError(_0x3672f3,_0x4df4e6){_0x4df4e6=_0x4df4e6||0x1f4;return function(_0x3207ec){logger[_0xb814('0x27')](_0x3207ec[_0xb814('0x38')]);if(_0x3207ec[_0xb814('0x39')]){delete _0x3207ec[_0xb814('0x39')];}_0x3672f3['status'](_0x4df4e6)[_0xb814('0x3a')](_0x3207ec);};}exports['index']=function(_0x43db67,_0x16e21c){var _0xe0f509={},_0x492d5e={},_0x40b885={'count':0x0,'rows':[]};var _0xbdb3e9=_['map'](db[_0xb814('0x3b')][_0xb814('0x3c')],function(_0x1a8bd0){return{'name':_0x1a8bd0[_0xb814('0x3d')],'type':_0x1a8bd0[_0xb814('0x3e')][_0xb814('0x3f')]};});_0x492d5e['model']=_[_0xb814('0x40')](_0xbdb3e9,'name');_0x492d5e[_0xb814('0x41')]=_['keys'](_0x43db67[_0xb814('0x41')]);_0x492d5e['filters']=_[_0xb814('0x42')](_0x492d5e[_0xb814('0x43')],_0x492d5e['query']);_0xe0f509['attributes']=_['intersection'](_0x492d5e['model'],qs[_0xb814('0x44')](_0x43db67[_0xb814('0x41')][_0xb814('0x44')]));_0xe0f509[_0xb814('0x45')]=_0xe0f509['attributes']['length']?_0xe0f509[_0xb814('0x45')]:_0x492d5e['model'];if(!_0x43db67[_0xb814('0x41')][_0xb814('0x46')](_0xb814('0x47'))){_0xe0f509[_0xb814('0x32')]=qs[_0xb814('0x32')](_0x43db67[_0xb814('0x41')][_0xb814('0x32')]);_0xe0f509[_0xb814('0x31')]=qs[_0xb814('0x31')](_0x43db67['query']['offset']);}_0xe0f509['order']=qs[_0xb814('0x48')](_0x43db67['query'][_0xb814('0x48')]);_0xe0f509['where']=qs[_0xb814('0x49')](_[_0xb814('0x4a')](_0x43db67[_0xb814('0x41')],_0x492d5e[_0xb814('0x49')]),_0xbdb3e9);if(_0x43db67['query'][_0xb814('0x4b')]){_0xe0f509[_0xb814('0x4c')]=_[_0xb814('0x4d')](_0xe0f509[_0xb814('0x4c')],{'$or':_[_0xb814('0x40')](_0xbdb3e9,function(_0x450a08){if(_0x450a08['type']!==_0xb814('0x4e')){var _0x3c21b1={};_0x3c21b1[_0x450a08[_0xb814('0x39')]]={'$like':'%'+_0x43db67[_0xb814('0x41')][_0xb814('0x4b')]+'%'};return _0x3c21b1;}})});}_0xe0f509=_[_0xb814('0x4d')]({},_0xe0f509,_0x43db67[_0xb814('0x4f')]);var _0x519545={'where':_0xe0f509['where']};return db[_0xb814('0x3b')][_0xb814('0x30')](_0x519545)[_0xb814('0x20')](function(_0x2bf906){_0x40b885[_0xb814('0x30')]=_0x2bf906;if(_0x43db67[_0xb814('0x41')][_0xb814('0x50')]){_0xe0f509[_0xb814('0x51')]=[{'all':!![]}];}return db[_0xb814('0x3b')][_0xb814('0x52')](_0xe0f509);})[_0xb814('0x20')](function(_0x5c7a49){_0x40b885[_0xb814('0x53')]=_0x5c7a49;return _0x40b885;})[_0xb814('0x20')](respondWithFilteredResult(_0x16e21c,_0xe0f509))['catch'](handleError(_0x16e21c,null));};exports[_0xb814('0x54')]=function(_0x55234d,_0x2fb0f7){var _0x37866f={'raw':![],'where':{'id':_0x55234d[_0xb814('0x55')]['id']}},_0xc71270={};_0xc71270[_0xb814('0x43')]=_[_0xb814('0x56')](db[_0xb814('0x3b')][_0xb814('0x3c')]);_0xc71270[_0xb814('0x41')]=_[_0xb814('0x56')](_0x55234d['query']);_0xc71270['filters']=_[_0xb814('0x42')](_0xc71270[_0xb814('0x43')],_0xc71270[_0xb814('0x41')]);_0x37866f[_0xb814('0x45')]=_[_0xb814('0x42')](_0xc71270[_0xb814('0x43')],qs[_0xb814('0x44')](_0x55234d['query'][_0xb814('0x44')]));_0x37866f[_0xb814('0x45')]=_0x37866f[_0xb814('0x45')]['length']?_0x37866f[_0xb814('0x45')]:_0xc71270['model'];if(_0x55234d[_0xb814('0x41')]['includeAll']){_0x37866f[_0xb814('0x51')]=[{'all':!![]}];}_0x37866f=_[_0xb814('0x4d')]({},_0x37866f,_0x55234d['options']);return db[_0xb814('0x3b')][_0xb814('0x57')](_0x37866f)[_0xb814('0x20')](handleEntityNotFound(_0x2fb0f7,null))['then'](respondWithResult(_0x2fb0f7,null))[_0xb814('0x2b')](handleError(_0x2fb0f7,null));};exports['create']=function(_0x13bdcf,_0x158893){return db['Dynamics365Account'][_0xb814('0x58')](_0x13bdcf['body'],{})['then'](respondWithResult(_0x158893,0xc9))[_0xb814('0x2b')](handleError(_0x158893,null));};exports[_0xb814('0x36')]=function(_0x34935b,_0x47a814){if(_0x34935b[_0xb814('0x59')]['id']){delete _0x34935b['body']['id'];}return db[_0xb814('0x3b')][_0xb814('0x57')]({'where':{'id':_0x34935b['params']['id']}})[_0xb814('0x20')](handleEntityNotFound(_0x47a814,null))['then'](saveUpdates(_0x34935b[_0xb814('0x59')],null))[_0xb814('0x20')](respondWithResult(_0x47a814,null))[_0xb814('0x2b')](handleError(_0x47a814,null));};exports[_0xb814('0x37')]=function(_0x251d44,_0x34acca){return db[_0xb814('0x3b')][_0xb814('0x57')]({'where':{'id':_0x251d44['params']['id']}})[_0xb814('0x20')](handleEntityNotFound(_0x34acca,null))[_0xb814('0x20')](removeEntity(_0x34acca,null))['catch'](handleError(_0x34acca,null));};exports[_0xb814('0x5a')]=function(_0xe14249,_0x4d13db,_0x371000){var _0x58b9a6={};var _0x48362c={};var _0x2114ca;var _0x5257be;return db[_0xb814('0x3b')][_0xb814('0x5b')]({'where':{'id':_0xe14249[_0xb814('0x55')]['id']}})['then'](handleEntityNotFound(_0x4d13db,null))[_0xb814('0x20')](function(_0x4df65c){if(_0x4df65c){_0x2114ca=_0x4df65c;_0x48362c[_0xb814('0x43')]=_[_0xb814('0x56')](db[_0xb814('0x5c')][_0xb814('0x3c')]);_0x48362c[_0xb814('0x41')]=_[_0xb814('0x56')](_0xe14249[_0xb814('0x41')]);_0x48362c[_0xb814('0x49')]=_[_0xb814('0x42')](_0x48362c['model'],_0x48362c[_0xb814('0x41')]);_0x58b9a6[_0xb814('0x45')]=_[_0xb814('0x42')](_0x48362c[_0xb814('0x43')],qs[_0xb814('0x44')](_0xe14249[_0xb814('0x41')]['fields']));_0x58b9a6[_0xb814('0x45')]=_0x58b9a6['attributes'][_0xb814('0x5d')]?_0x58b9a6[_0xb814('0x45')]:_0x48362c[_0xb814('0x43')];_0x58b9a6['order']=qs[_0xb814('0x48')](_0xe14249['query'][_0xb814('0x48')]);_0x58b9a6['where']=qs[_0xb814('0x49')](_[_0xb814('0x4a')](_0xe14249[_0xb814('0x41')],_0x48362c[_0xb814('0x49')]));if(_0xe14249[_0xb814('0x41')][_0xb814('0x4b')]){_0x58b9a6[_0xb814('0x4c')]=_['merge'](_0x58b9a6[_0xb814('0x4c')],{'$or':_['map'](_0x58b9a6[_0xb814('0x45')],function(_0x22c73f){var _0x1b989d={};_0x1b989d[_0x22c73f]={'$like':'%'+_0xe14249[_0xb814('0x41')][_0xb814('0x4b')]+'%'};return _0x1b989d;})});}_0x58b9a6=_[_0xb814('0x4d')]({},_0x58b9a6,_0xe14249['options']);return _0x2114ca[_0xb814('0x5a')](_0x58b9a6);}})[_0xb814('0x20')](function(_0x4a49ba){if(_0x4a49ba){_0x5257be=_0x4a49ba[_0xb814('0x5d')];if(!_0xe14249[_0xb814('0x41')][_0xb814('0x46')](_0xb814('0x47'))){_0x58b9a6[_0xb814('0x32')]=qs['limit'](_0xe14249[_0xb814('0x41')]['limit']);_0x58b9a6[_0xb814('0x31')]=qs[_0xb814('0x31')](_0xe14249[_0xb814('0x41')][_0xb814('0x31')]);}return _0x2114ca[_0xb814('0x5a')](_0x58b9a6);}})[_0xb814('0x20')](function(_0x4cae4a){if(_0x4cae4a){return _0x4cae4a?{'count':_0x5257be,'rows':_0x4cae4a}:null;}})['then'](respondWithResult(_0x4d13db,null))['catch'](handleError(_0x4d13db,null));};exports[_0xb814('0x5e')]=function(_0x490e5c,_0x45a8b9,_0x1d3954){if(_0x490e5c[_0xb814('0x59')]['id']){delete _0x490e5c['body']['id'];}return db[_0xb814('0x3b')][_0xb814('0x5b')]({'where':{'id':_0x490e5c[_0xb814('0x55')]['id']}})['then'](handleEntityNotFound(_0x45a8b9,null))[_0xb814('0x20')](function(_0x1bf0b7){if(_0x1bf0b7){_0x490e5c[_0xb814('0x59')][_0xb814('0x5f')]=_0x1bf0b7['id'];_0x490e5c['body']['Subjects']=integrations[_0xb814('0x60')](_0x490e5c[_0xb814('0x59')][_0xb814('0x61')],_0x490e5c[_0xb814('0x59')][_0xb814('0x3e')]);_0x490e5c[_0xb814('0x59')][_0xb814('0x62')]=integrations[_0xb814('0x63')](_0x490e5c[_0xb814('0x59')][_0xb814('0x61')],_0x490e5c[_0xb814('0x59')][_0xb814('0x3e')]);return db[_0xb814('0x5c')][_0xb814('0x58')](_0x490e5c[_0xb814('0x59')],{'include':[{'model':db['Dynamics365Field'],'as':_0xb814('0x64')},{'model':db[_0xb814('0x65')],'as':_0xb814('0x62')}]});}return null;})[_0xb814('0x20')](respondWithResult(_0x45a8b9,null))[_0xb814('0x2b')](handleError(_0x45a8b9,null));};exports[_0xb814('0x66')]=function(_0x525c02,_0xff4dc2,_0x52e1fc){var _0x872d43=_0x525c02[_0xb814('0x41')][_0xb814('0x67')];var _0x2292e6=_0x872d43===_0xb814('0x68')?'Incident':'PhoneCall';var _0xea9cee='';var _0x1b502b='';var _0x1bca54='';var _0x1cbf0c='';var _0x488ef2='';var _0x1ee95d='';var _0x478d37='';var _0x39073c='';var _0x227cbd=['title','description',_0xb814('0x69'),'ownerid',_0xb814('0x6a'),_0xb814('0x6b'),_0xb814('0x6c'),_0xb814('0x6d'),_0xb814('0x6e'),_0xb814('0x6f')];var _0x40fe4a=['accountidname',_0xb814('0x70'),'actualserviceunits',_0xb814('0x71'),'contactidname',_0xb814('0x72'),_0xb814('0x73'),'contractidname',_0xb814('0x74'),'createdbyexternalpartyyominame',_0xb814('0x75'),_0xb814('0x76'),'createdon','createdonbehalfbyname',_0xb814('0x77'),_0xb814('0x78'),_0xb814('0x79'),_0xb814('0x7a'),_0xb814('0x7b'),_0xb814('0x7c'),_0xb814('0x7d'),_0xb814('0x7e'),_0xb814('0x7f'),_0xb814('0x80'),'firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname',_0xb814('0x81'),_0xb814('0x82'),_0xb814('0x83'),'modifiedbyexternalpartyyominame',_0xb814('0x84'),_0xb814('0x85'),_0xb814('0x86'),_0xb814('0x87'),_0xb814('0x88'),_0xb814('0x89'),_0xb814('0x8a'),_0xb814('0x8b'),'onholdtime',_0xb814('0x8c'),_0xb814('0x8d'),_0xb814('0x8e'),_0xb814('0x8f'),'parentcaseidname',_0xb814('0x90'),_0xb814('0x91'),_0xb814('0x92'),_0xb814('0x93'),_0xb814('0x94'),'resolveby','resolvebykpiidname',_0xb814('0x95'),'responsiblecontactidname',_0xb814('0x96'),_0xb814('0x97'),'slainvokedidname',_0xb814('0x98'),'socialprofileidname',_0xb814('0x99'),'statuscode',_0xb814('0x9a'),_0xb814('0x9b'),_0xb814('0x9c'),_0xb814('0x9d'),_0xb814('0x9e'),_0xb814('0x9f'),_0xb814('0xa0')];var _0x4e3115=_0x227cbd['concat'](_0x40fe4a);return db[_0xb814('0x3b')]['findOne']({'where':{'id':_0x525c02['params']['id']},'attributes':['id',_0xb814('0xa1'),_0xb814('0xa2'),_0xb814('0xa3'),'tenantId',_0xb814('0xa4'),'clientSecret']})[_0xb814('0x20')](handleEntityNotFound(_0xff4dc2,null))[_0xb814('0x20')](function(_0x14ec54){if(_0x14ec54){_0x39073c=_0x14ec54[_0xb814('0xa3')];var _0x4c8a00=_0x39073c[_0xb814('0xa5')](-0x1);if(_0x4c8a00==='/'){_0x39073c=_0x39073c[_0xb814('0xa6')](0x0,_0x39073c[_0xb814('0xa7')](_0x4c8a00));}_0x478d37=util['format'](_0xb814('0xa8'),_0x39073c);var _0x3fc77d={'method':_0xb814('0xa9'),'uri':'https://login.microsoftonline.com/'+_0x14ec54[_0xb814('0xaa')]+_0xb814('0xab'),'form':{'client_id':_0x14ec54[_0xb814('0xa4')],'resource':_0x39073c,'username':_0x14ec54[_0xb814('0xa1')],'password':_0x14ec54[_0xb814('0xa2')],'grant_type':_0xb814('0xa2'),'client_secret':_0x14ec54[_0xb814('0xac')]},'json':!![]};return rp(_0x3fc77d);}})[_0xb814('0x20')](function(_0x37a8b1){_0x1ee95d=_0x37a8b1[_0xb814('0xad')];var _0x52a6e3={'method':_0xb814('0xae'),'uri':encodeURI(_0x478d37+_0xb814('0xaf')+_0x2292e6+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x1ee95d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x52a6e3);})[_0xb814('0x20')](function(_0x50697f){var _0x320296=_0x50697f[_0xb814('0xb0')][0x0];var _0x43ab12=_0x320296[_0xb814('0xb1')];var _0x405db7={'method':_0xb814('0xae'),'uri':_0x478d37+_0xb814('0xb2')+_0x43ab12+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x1ee95d,'If-None-Match':null,'OData-Version':_0xb814('0xb3')},'json':!![]};return rp(_0x405db7);})['then'](function(_0x18678f){_0xea9cee=_0x18678f;_0x1b502b=_0xea9cee[_0xb814('0xb4')];_0x1b502b=_[_0xb814('0xb5')](_0x1b502b,function(_0x495431){return!_0x4e3115[_0xb814('0xb6')](_0x495431[_0xb814('0xb7')]);});var _0x35c60f=[];var _0x38c6da=[];_0x1b502b[_0xb814('0xb8')](function(_0x491eb1){if(_0x491eb1[_0xb814('0xb9')]){var _0x4fe23d=_0x491eb1['@odata.type'][_0xb814('0xa6')](_0x491eb1[_0xb814('0xb9')][_0xb814('0xa7')]('.')+0x1);if(_0x4fe23d==='PicklistAttributeMetadata'){_0x35c60f[_0xb814('0xba')](getSelectList(_0x478d37,_0x872d43,_0x38c6da,_0xea9cee[_0xb814('0xb1')],_0x491eb1['MetadataId'],_0x1ee95d));}}});return Promise[_0xb814('0xbb')](_0x35c60f);})[_0xb814('0x20')](function(_0x5b5634){_0x1bca54=_0x5b5634[0x0];var _0x6abce4=[];var _0x269832=[];_0x1b502b[_0xb814('0xb8')](function(_0x2365f9){if(!_[_0xb814('0xbc')](_0x2365f9[_0xb814('0xb9')])){var _0x40ae0b=_0x2365f9[_0xb814('0xb9')][_0xb814('0xa6')](_0x2365f9[_0xb814('0xb9')][_0xb814('0xa7')]('.')+0x1);if(_0x40ae0b===_0xb814('0xbd')){_0x6abce4['push'](getBooleanList(_0x478d37,_0x872d43,_0x269832,_0xea9cee['MetadataId'],_0x2365f9[_0xb814('0xb1')],_0x1ee95d));}}});return Promise['all'](_0x6abce4);})['then'](function(_0x3f2ff9){_0x1cbf0c=_0x3f2ff9[0x0];var _0x4c9fd9=[];var _0x4f0427=[];_0x1b502b['forEach'](function(_0x1044fa){if(_0x1044fa[_0xb814('0xb9')]){var _0x3341f5=_0x1044fa['@odata.type'][_0xb814('0xa6')](_0x1044fa['@odata.type'][_0xb814('0xa7')]('.')+0x1);if(_0x3341f5===_0xb814('0xbe')||_0x3341f5==='DoubleAttributeMetadata'||_0x3341f5===_0xb814('0xbf')||_0x3341f5==='IntegerAttributeMetadata'||_0x3341f5===_0xb814('0xc0')||_0x3341f5===_0xb814('0xc1')||_0x3341f5===_0xb814('0xc2')||_0x3341f5===_0xb814('0xc3')||_0x3341f5===_0xb814('0xc4')||_0x3341f5===_0xb814('0xc5')){_0x4c9fd9[_0xb814('0xba')](getInputList(_0x478d37,_0x872d43,_0x3341f5,_0x4f0427,_0xea9cee[_0xb814('0xb1')],_0x1044fa[_0xb814('0xb1')],_0x1ee95d));}}});return Promise[_0xb814('0xbb')](_0x4c9fd9);})[_0xb814('0x20')](function(_0x3e7a9a){_0x488ef2=_0x3e7a9a[0x0];var _0x961064=_0x1bca54[_0xb814('0xc6')](_0x1cbf0c)[_0xb814('0xc6')](_0x488ef2);var _0x555318={'count':_0x961064[_0xb814('0x5d')],'rows':_0x961064};return _0x555318;})[_0xb814('0x20')](respondWithResult(_0xff4dc2,null))['catch'](function(_0x2c7cd6){var _0x552aae=_0x525c02[_0xb814('0x41')]['test']?0x1f4:_0x2c7cd6['statusCode']||0x1f4;logger[_0xb814('0x27')](_0x2c7cd6['stack']);delete _0x2c7cd6[_0xb814('0x39')];if(_0x552aae===0x191){_0x552aae=0x190;}_0xff4dc2['status'](_0x552aae)[_0xb814('0x3a')](_0x525c02['query']['test']?{'message':_0xb814('0xc7'),'statusCode':_0x2c7cd6[_0xb814('0xc8')]}:_0x2c7cd6);});};function getSelectList(_0x52ee68,_0x21b286,_0x396d76,_0x4339a2,_0x2101b5,_0x4543c3){var _0x23f9a3={'method':_0xb814('0xae'),'uri':_0x52ee68+_0xb814('0xb2')+_0x4339a2+')/Attributes('+_0x2101b5+_0xb814('0xc9')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xb814('0xca')+_0x4543c3,'If-None-Match':null,'OData-Version':_0xb814('0xb3')},'json':!![]};return rp(_0x23f9a3)[_0xb814('0x20')](function(_0x4fde6a){var _0x6e5486=[];var _0x18fb74=_0x4fde6a[_0xb814('0xcb')][_0xb814('0xcc')];_0x18fb74[_0xb814('0xb8')](function(_0x2972b9){_0x6e5486[_0xb814('0xba')]({'name':_0x2972b9[_0xb814('0xcd')][_0xb814('0xce')][_0xb814('0xcd')],'value':String(_0x2972b9[_0xb814('0xcf')])});});var _0x11e0c3={'id':_0x21b286+'_'+_0x4fde6a[_0xb814('0xb7')],'name':_0x4fde6a[_0xb814('0xd0')][_0xb814('0xce')]['Label'],'custom':![],'options':_0x6e5486};_0x396d76[_0xb814('0xba')](_0x11e0c3);return _0x396d76;});}function getBooleanList(_0x3fb2af,_0x3e61eb,_0x5200ec,_0x5d8ad5,_0x40f43,_0x4ffb15){var _0x4d9af3={'method':'GET','uri':_0x3fb2af+'EntityDefinitions('+_0x5d8ad5+_0xb814('0xd1')+_0x40f43+_0xb814('0xd2'),'headers':{'Authorization':'Bearer\x20'+_0x4ffb15,'If-None-Match':null,'OData-Version':_0xb814('0xb3')},'json':!![]};return rp(_0x4d9af3)[_0xb814('0x20')](function(_0x21485c){var _0x3d24c3=[];_0x3d24c3[_0xb814('0xba')]({'name':_0x21485c[_0xb814('0xcb')][_0xb814('0xd3')][_0xb814('0xcd')][_0xb814('0xce')][_0xb814('0xcd')],'value':_0xb814('0xd4')},{'name':_0x21485c['OptionSet'][_0xb814('0xd5')]['Label'][_0xb814('0xce')][_0xb814('0xcd')],'value':_0xb814('0xd6')});var _0xa7ff62={'id':_0x3e61eb+'_'+_0x21485c[_0xb814('0xb7')],'name':_0x21485c[_0xb814('0xd0')][_0xb814('0xce')][_0xb814('0xcd')],'custom':![],'options':_0x3d24c3};_0x5200ec['push'](_0xa7ff62);return _0x5200ec;});}function getInputList(_0x4b9728,_0x58630e,_0xfe3ae4,_0x4a2e90,_0x1f49eb,_0x3b7bee,_0x2ab60d){var _0xf76dbe={'method':_0xb814('0xae'),'uri':_0x4b9728+_0xb814('0xb2')+_0x1f49eb+_0xb814('0xd1')+_0x3b7bee+_0xb814('0xd7')+_0xfe3ae4+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x2ab60d,'If-None-Match':null,'OData-Version':_0xb814('0xb3')},'json':!![]};return rp(_0xf76dbe)[_0xb814('0x20')](function(_0x24fcd0){var _0x403866={'id':_0x58630e+'_'+_0x24fcd0[_0xb814('0xb7')],'name':_0x24fcd0[_0xb814('0xd0')]['UserLocalizedLabel']?_0x24fcd0[_0xb814('0xd0')]['UserLocalizedLabel'][_0xb814('0xcd')]:_0x24fcd0[_0xb814('0xb7')],'custom':![],'options':[]};_0x4a2e90[_0xb814('0xba')](_0x403866);return _0x4a2e90;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 2b175e4..934edc9 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 _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 +var _0x0623=['bluebird','path','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','int_dynamics365_accounts','util','api','moment'];(function(_0x28c4fe,_0xc408af){var _0x1a527d=function(_0x1486a6){while(--_0x1486a6){_0x28c4fe['push'](_0x28c4fe['shift']());}};_0x1a527d(++_0xc408af);}(_0x0623,0xad));var _0x3062=function(_0x28857f,_0xe64cac){_0x28857f=_0x28857f-0x0;var _0x4a65d0=_0x0623[_0x28857f];return _0x4a65d0;};'use strict';var _=require('lodash');var util=require(_0x3062('0x0'));var logger=require('../../config/logger')(_0x3062('0x1'));var moment=require(_0x3062('0x2'));var BPromise=require(_0x3062('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3062('0x4'));var rimraf=require('rimraf');var config=require(_0x3062('0x5'));var attributes=require(_0x3062('0x6'));var integrations=require(_0x3062('0x7'));module[_0x3062('0x8')]=function(_0x3b7e27,_0x9a41e0){return _0x3b7e27[_0x3062('0x9')]('Dynamics365Account',attributes,{'tableName':_0x3062('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 1fdc66b..f6119c5 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 _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 +var _0xaf0d=['request','request\x20sent','debug','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowDynamics365Account','info','util','moment','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1b0bdb,_0x41c282){var _0x9b2bc6=function(_0xa96e55){while(--_0xa96e55){_0x1b0bdb['push'](_0x1b0bdb['shift']());}};_0x9b2bc6(++_0x41c282);}(_0xaf0d,0x6d));var _0xdaf0=function(_0x3a77ff,_0x32a5da){_0x3a77ff=_0x3a77ff-0x0;var _0x1e94bc=_0xaf0d[_0x3a77ff];return _0x1e94bc;};'use strict';var _=require('lodash');var util=require(_0xdaf0('0x0'));var moment=require(_0xdaf0('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('../../config/utils');var logger=require(_0xdaf0('0x2'))(_0xdaf0('0x3'));var config=require(_0xdaf0('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xdaf0('0x5')][_0xdaf0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x53aec7,_0x5ad050,_0x26bda3){return new BPromise(function(_0x1dc345,_0x16d746){return client[_0xdaf0('0x7')](_0x53aec7,_0x26bda3)['then'](function(_0x528d8a){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x5ad050,_0xdaf0('0x8'));logger[_0xdaf0('0x9')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x5ad050,_0xdaf0('0x8'),JSON[_0xdaf0('0xa')](_0x528d8a));if(_0x528d8a[_0xdaf0('0xb')]){if(_0x528d8a[_0xdaf0('0xb')]['code']===0x1f4){logger[_0xdaf0('0xb')](_0xdaf0('0xc'),_0x5ad050,_0x528d8a[_0xdaf0('0xb')]['message']);return _0x16d746(_0x528d8a[_0xdaf0('0xb')][_0xdaf0('0xd')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x5ad050,_0x528d8a['error']['message']);return _0x1dc345(_0x528d8a['error'][_0xdaf0('0xd')]);}else{logger['info'](_0xdaf0('0xc'),_0x5ad050,'request\x20sent');_0x1dc345(_0x528d8a['result'][_0xdaf0('0xd')]);}})[_0xdaf0('0xe')](function(_0x370345){logger['error'](_0xdaf0('0xc'),_0x5ad050,_0x370345);_0x16d746(_0x370345);});});}exports[_0xdaf0('0xf')]=function(_0x21db47){var _0x4b8588=this;return new Promise(function(_0x5a2180,_0xb6b5e2){return db[_0xdaf0('0x10')][_0xdaf0('0x11')]({'raw':_0x21db47[_0xdaf0('0x12')]?_0x21db47[_0xdaf0('0x12')][_0xdaf0('0x13')]===undefined?!![]:![]:!![],'where':_0x21db47[_0xdaf0('0x12')]?_0x21db47['options'][_0xdaf0('0x14')]||null:null,'attributes':_0x21db47[_0xdaf0('0x12')]?_0x21db47[_0xdaf0('0x12')][_0xdaf0('0x15')]||null:null,'limit':_0x21db47['options']?_0x21db47[_0xdaf0('0x12')][_0xdaf0('0x16')]||null:null,'include':_0x21db47[_0xdaf0('0x12')]?_0x21db47[_0xdaf0('0x12')]['include']?_[_0xdaf0('0x17')](_0x21db47[_0xdaf0('0x12')][_0xdaf0('0x18')],function(_0x13abfc){return{'model':db[_0x13abfc[_0xdaf0('0x19')]],'as':_0x13abfc['as'],'attributes':_0x13abfc[_0xdaf0('0x15')],'include':_0x13abfc[_0xdaf0('0x18')]?_['map'](_0x13abfc[_0xdaf0('0x18')],function(_0x33e5c2){return{'model':db[_0x33e5c2[_0xdaf0('0x19')]],'as':_0x33e5c2['as'],'attributes':_0x33e5c2[_0xdaf0('0x15')],'include':_0x33e5c2[_0xdaf0('0x18')]?_[_0xdaf0('0x17')](_0x33e5c2[_0xdaf0('0x18')],function(_0x4d3347){return{'model':db[_0x4d3347[_0xdaf0('0x19')]],'as':_0x4d3347['as'],'attributes':_0x4d3347['attributes']};}):[]};}):[]};}):[]:[]})[_0xdaf0('0x1a')](function(_0x740ff){logger['info'](_0xdaf0('0xf'),_0x21db47);logger['debug'](_0xdaf0('0xf'),_0x21db47,JSON[_0xdaf0('0xa')](_0x740ff));_0x5a2180(_0x740ff);})['catch'](function(_0xaf86cb){logger[_0xdaf0('0xb')](_0xdaf0('0xf'),_0xaf86cb[_0xdaf0('0xd')],_0x21db47);_0xb6b5e2(_0x4b8588[_0xdaf0('0xb')](0x1f4,_0xaf86cb['message']));});});};exports[_0xdaf0('0x1b')]=function(_0x16821a){var _0x3018b8=this;return new Promise(function(_0x570df5,_0x443cc7){return db[_0xdaf0('0x10')]['find']({'raw':_0x16821a[_0xdaf0('0x12')]?_0x16821a[_0xdaf0('0x12')]['raw']===undefined?!![]:![]:!![],'where':_0x16821a[_0xdaf0('0x12')]?_0x16821a[_0xdaf0('0x12')][_0xdaf0('0x14')]||null:null,'attributes':_0x16821a[_0xdaf0('0x12')]?_0x16821a[_0xdaf0('0x12')][_0xdaf0('0x15')]||null:null,'include':_0x16821a[_0xdaf0('0x12')]?_0x16821a[_0xdaf0('0x12')][_0xdaf0('0x18')]?_[_0xdaf0('0x17')](_0x16821a[_0xdaf0('0x12')]['include'],function(_0x5b955e){return{'model':db[_0x5b955e['model']],'as':_0x5b955e['as'],'attributes':_0x5b955e[_0xdaf0('0x15')],'include':_0x5b955e[_0xdaf0('0x18')]?_['map'](_0x5b955e[_0xdaf0('0x18')],function(_0x2128cc){return{'model':db[_0x2128cc[_0xdaf0('0x19')]],'as':_0x2128cc['as'],'attributes':_0x2128cc[_0xdaf0('0x15')],'include':_0x2128cc[_0xdaf0('0x18')]?_[_0xdaf0('0x17')](_0x2128cc[_0xdaf0('0x18')],function(_0x399116){return{'model':db[_0x399116[_0xdaf0('0x19')]],'as':_0x399116['as'],'attributes':_0x399116[_0xdaf0('0x15')]};}):[]};}):[]};}):[]:[]})[_0xdaf0('0x1a')](function(_0x1a9838){logger[_0xdaf0('0x1c')](_0xdaf0('0x1b'),_0x16821a);logger[_0xdaf0('0x9')](_0xdaf0('0x1b'),_0x16821a,JSON[_0xdaf0('0xa')](_0x1a9838));_0x570df5(_0x1a9838);})['catch'](function(_0xe61d26){logger[_0xdaf0('0xb')](_0xdaf0('0x1b'),_0xe61d26[_0xdaf0('0xd')],_0x16821a);_0x443cc7(_0x3018b8[_0xdaf0('0xb')](0x1f4,_0xe61d26[_0xdaf0('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 1cb9e68..2cd6c20 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 _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 +var _0xf6ae=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','index','get','isAuthenticated','show','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','/:id','update','delete','destroy','exports','multer','connect-timeout','Router'];(function(_0x4ce01c,_0x48f585){var _0x2772df=function(_0x112d24){while(--_0x112d24){_0x4ce01c['push'](_0x4ce01c['shift']());}};_0x2772df(++_0x48f585);}(_0xf6ae,0x19f));var _0xef6a=function(_0x44205,_0x56088b){_0x44205=_0x44205-0x0;var _0x434b18=_0xf6ae[_0x44205];return _0x434b18;};'use strict';var multer=require(_0xef6a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xef6a('0x1'));var express=require('express');var router=express[_0xef6a('0x2')]();var auth=require(_0xef6a('0x3'));var interaction=require(_0xef6a('0x4'));var config=require(_0xef6a('0x5'));var controller=require(_0xef6a('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xef6a('0x7')]);router[_0xef6a('0x8')]('/:id',auth[_0xef6a('0x9')](),controller[_0xef6a('0xa')]);router[_0xef6a('0x8')]('/:id/fields',auth[_0xef6a('0x9')](),controller[_0xef6a('0xb')]);router['get'](_0xef6a('0xc'),auth['isAuthenticated'](),controller[_0xef6a('0xd')]);router[_0xef6a('0x8')]('/:id/descriptions',auth[_0xef6a('0x9')](),controller[_0xef6a('0xe')]);router[_0xef6a('0xf')]('/',auth[_0xef6a('0x9')](),controller['create']);router[_0xef6a('0x10')](_0xef6a('0x11'),auth['isAuthenticated'](),controller[_0xef6a('0x12')]);router[_0xef6a('0x13')]('/:id',auth[_0xef6a('0x9')](),controller[_0xef6a('0x14')]);module[_0xef6a('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 5ad55af..4e18c26 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 _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 +var _0xfd23=['phonecall','sequelize','exports','STRING','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd23,0x1e1));var _0x3fd2=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xfd23[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require(_0x3fd2('0x0'));module[_0x3fd2('0x1')]={'name':{'type':Sequelize[_0x3fd2('0x2')]},'description':{'type':Sequelize[_0x3fd2('0x2')]},'ticketType':{'type':Sequelize[_0x3fd2('0x3')]('incident',_0x3fd2('0x4')),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index b6f036c..3cc141b 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 _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 +var _0x7a4d=['model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Dynamics365Configuration','findAll','rows','show','params','includeAll','include','find','create','body','getFields','findOne','Dynamics365Field','pick','getSubjects','getDescriptions','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/environment','../../mysqldb','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x7a4d,0x18d));var _0xd7a4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x7a4d[_0x273c39];return _0x46d6b5;};'use strict';var pdf=require(_0xd7a4('0x0'));var emlformat=require(_0xd7a4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd7a4('0x2'));var rp=require(_0xd7a4('0x3'));var moment=require(_0xd7a4('0x4'));var BPromise=require(_0xd7a4('0x5'));var Mustache=require(_0xd7a4('0x6'));var util=require(_0xd7a4('0x7'));var path=require(_0xd7a4('0x8'));var sox=require('sox');var csv=require(_0xd7a4('0x9'));var ejs=require(_0xd7a4('0xa'));var fs=require('fs');var _=require(_0xd7a4('0xb'));var squel=require(_0xd7a4('0xc'));var crypto=require(_0xd7a4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd7a4('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd7a4('0xf'));var Papa=require(_0xd7a4('0x10'));var Redis=require(_0xd7a4('0x11'));var authService=require(_0xd7a4('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7a4('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xd7a4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd7a4('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xd7a4('0x16')][_0xd7a4('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x46d6a7,_0x2ca575,_0x9ed6a,_0x1d33a6){return new BPromise(function(_0x439091,_0x5aba4d){var _0x4fea75=_0x1d33a6||client;return _0x4fea75['request'](_0x46d6a7,_0x9ed6a)[_0xd7a4('0x18')](function(_0x225bf1){logger[_0xd7a4('0x19')](_0xd7a4('0x1a'),_0x2ca575,_0xd7a4('0x1b'));logger[_0xd7a4('0x1c')](_0xd7a4('0x1d'),_0x2ca575,'request\x20sent',JSON[_0xd7a4('0x1e')](_0x225bf1));if(_0x225bf1[_0xd7a4('0x1f')]){if(_0x225bf1[_0xd7a4('0x1f')]['code']===0x1f4){logger[_0xd7a4('0x1f')](_0xd7a4('0x1a'),_0x2ca575,_0x225bf1[_0xd7a4('0x1f')][_0xd7a4('0x20')]);return _0x5aba4d(_0x225bf1[_0xd7a4('0x1f')][_0xd7a4('0x20')]);}logger[_0xd7a4('0x1f')](_0xd7a4('0x1a'),_0x2ca575,_0x225bf1['error'][_0xd7a4('0x20')]);return _0x439091(_0x225bf1['error'][_0xd7a4('0x20')]);}else{logger[_0xd7a4('0x19')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2ca575,_0xd7a4('0x1b'));_0x439091(_0x225bf1[_0xd7a4('0x21')][_0xd7a4('0x20')]);}})[_0xd7a4('0x22')](function(_0x50c809){logger[_0xd7a4('0x1f')](_0xd7a4('0x1a'),_0x2ca575,_0x50c809);_0x5aba4d(_0x50c809);});});}function respondWithStatusCode(_0x530158,_0x3f07c9){_0x3f07c9=_0x3f07c9||0xcc;return function(_0x506000){if(_0x506000){return _0x530158[_0xd7a4('0x23')](_0x3f07c9);}return _0x530158[_0xd7a4('0x24')](_0x3f07c9)[_0xd7a4('0x25')]();};}function respondWithResult(_0x5bf832,_0x1a6930){_0x1a6930=_0x1a6930||0xc8;return function(_0x5394ac){if(_0x5394ac){return _0x5bf832['status'](_0x1a6930)[_0xd7a4('0x26')](_0x5394ac);}};}function respondWithFilteredResult(_0x59dba6,_0x50292d){return function(_0x4de070){if(_0x4de070){var _0x4c4c80=_0x4de070[_0xd7a4('0x27')],_0x5d87b0=_0x50292d[_0xd7a4('0x28')],_0x3da8db=_0x50292d[_0xd7a4('0x28')]+_0x50292d[_0xd7a4('0x29')],_0xb01b37;if(_0x3da8db>=_0x4c4c80){_0x3da8db=_0x4c4c80;_0xb01b37=0xc8;}else{_0xb01b37=0xce;}_0x59dba6['status'](_0xb01b37);return _0x59dba6[_0xd7a4('0x2a')](_0xd7a4('0x2b'),_0x5d87b0+'-'+_0x3da8db+'/'+_0x4c4c80)[_0xd7a4('0x26')](_0x4de070);}return null;};}function patchUpdates(_0xe897e8){return function(_0xfbbb0b){try{jsonpatch[_0xd7a4('0x2c')](_0xfbbb0b,_0xe897e8,!![]);}catch(_0x36bd2b){return BPromise[_0xd7a4('0x2d')](_0x36bd2b);}return _0xfbbb0b[_0xd7a4('0x2e')]();};}function saveUpdates(_0x13ce9c,_0x4c264a){return function(_0x5e811b){if(_0x5e811b){return _0x5e811b[_0xd7a4('0x2f')](_0x13ce9c)[_0xd7a4('0x18')](function(_0x2c09fd){return _0x2c09fd;});}return null;};}function removeEntity(_0x3cadcf,_0x2b78a6){return function(_0x4b2c39){if(_0x4b2c39){return _0x4b2c39[_0xd7a4('0x30')]()[_0xd7a4('0x18')](function(){_0x3cadcf['status'](0xcc)[_0xd7a4('0x25')]();});}};}function handleEntityNotFound(_0x67b6c3,_0x4ebac6){return function(_0x260c30){if(!_0x260c30){_0x67b6c3[_0xd7a4('0x23')](0x194);}return _0x260c30;};}function handleError(_0x50dd57,_0x3a409d){_0x3a409d=_0x3a409d||0x1f4;return function(_0x54b797){logger['error'](_0x54b797[_0xd7a4('0x31')]);if(_0x54b797['name']){delete _0x54b797[_0xd7a4('0x32')];}_0x50dd57[_0xd7a4('0x24')](_0x3a409d)[_0xd7a4('0x33')](_0x54b797);};}exports[_0xd7a4('0x34')]=function(_0x215864,_0x4446a4){var _0x52d798={},_0x44a205={},_0x3d853c={'count':0x0,'rows':[]};var _0x41dc6f=_[_0xd7a4('0x35')](db['Dynamics365Configuration'][_0xd7a4('0x36')],function(_0x123397){return{'name':_0x123397[_0xd7a4('0x37')],'type':_0x123397[_0xd7a4('0x38')][_0xd7a4('0x39')]};});_0x44a205[_0xd7a4('0x3a')]=_[_0xd7a4('0x35')](_0x41dc6f,_0xd7a4('0x32'));_0x44a205[_0xd7a4('0x3b')]=_[_0xd7a4('0x3c')](_0x215864[_0xd7a4('0x3b')]);_0x44a205[_0xd7a4('0x3d')]=_['intersection'](_0x44a205[_0xd7a4('0x3a')],_0x44a205[_0xd7a4('0x3b')]);_0x52d798[_0xd7a4('0x3e')]=_[_0xd7a4('0x3f')](_0x44a205[_0xd7a4('0x3a')],qs[_0xd7a4('0x40')](_0x215864[_0xd7a4('0x3b')][_0xd7a4('0x40')]));_0x52d798[_0xd7a4('0x3e')]=_0x52d798[_0xd7a4('0x3e')][_0xd7a4('0x41')]?_0x52d798[_0xd7a4('0x3e')]:_0x44a205[_0xd7a4('0x3a')];if(!_0x215864[_0xd7a4('0x3b')][_0xd7a4('0x42')](_0xd7a4('0x43'))){_0x52d798['limit']=qs[_0xd7a4('0x29')](_0x215864['query']['limit']);_0x52d798[_0xd7a4('0x28')]=qs[_0xd7a4('0x28')](_0x215864[_0xd7a4('0x3b')][_0xd7a4('0x28')]);}_0x52d798[_0xd7a4('0x44')]=qs[_0xd7a4('0x45')](_0x215864['query'][_0xd7a4('0x45')]);_0x52d798[_0xd7a4('0x46')]=qs['filters'](_['pick'](_0x215864['query'],_0x44a205[_0xd7a4('0x3d')]),_0x41dc6f);if(_0x215864['query'][_0xd7a4('0x47')]){_0x52d798[_0xd7a4('0x46')]=_[_0xd7a4('0x48')](_0x52d798['where'],{'$or':_[_0xd7a4('0x35')](_0x41dc6f,function(_0x2973b6){if(_0x2973b6[_0xd7a4('0x38')]!==_0xd7a4('0x49')){var _0x5c1577={};_0x5c1577[_0x2973b6['name']]={'$like':'%'+_0x215864[_0xd7a4('0x3b')][_0xd7a4('0x47')]+'%'};return _0x5c1577;}})});}_0x52d798=_[_0xd7a4('0x48')]({},_0x52d798,_0x215864[_0xd7a4('0x4a')]);var _0x12434f={'where':_0x52d798[_0xd7a4('0x46')]};return db[_0xd7a4('0x4b')][_0xd7a4('0x27')](_0x12434f)[_0xd7a4('0x18')](function(_0x41ddc7){_0x3d853c[_0xd7a4('0x27')]=_0x41ddc7;if(_0x215864[_0xd7a4('0x3b')]['includeAll']){_0x52d798['include']=[{'all':!![]}];}return db[_0xd7a4('0x4b')][_0xd7a4('0x4c')](_0x52d798);})[_0xd7a4('0x18')](function(_0x1f75b5){_0x3d853c[_0xd7a4('0x4d')]=_0x1f75b5;return _0x3d853c;})[_0xd7a4('0x18')](respondWithFilteredResult(_0x4446a4,_0x52d798))[_0xd7a4('0x22')](handleError(_0x4446a4,null));};exports[_0xd7a4('0x4e')]=function(_0x47eb35,_0x30b132){var _0x3ab96f={'raw':![],'where':{'id':_0x47eb35[_0xd7a4('0x4f')]['id']}},_0x59e77f={};_0x59e77f[_0xd7a4('0x3a')]=_[_0xd7a4('0x3c')](db[_0xd7a4('0x4b')][_0xd7a4('0x36')]);_0x59e77f[_0xd7a4('0x3b')]=_[_0xd7a4('0x3c')](_0x47eb35['query']);_0x59e77f[_0xd7a4('0x3d')]=_[_0xd7a4('0x3f')](_0x59e77f[_0xd7a4('0x3a')],_0x59e77f['query']);_0x3ab96f[_0xd7a4('0x3e')]=_[_0xd7a4('0x3f')](_0x59e77f[_0xd7a4('0x3a')],qs[_0xd7a4('0x40')](_0x47eb35[_0xd7a4('0x3b')][_0xd7a4('0x40')]));_0x3ab96f['attributes']=_0x3ab96f[_0xd7a4('0x3e')][_0xd7a4('0x41')]?_0x3ab96f[_0xd7a4('0x3e')]:_0x59e77f[_0xd7a4('0x3a')];if(_0x47eb35[_0xd7a4('0x3b')][_0xd7a4('0x50')]){_0x3ab96f[_0xd7a4('0x51')]=[{'all':!![]}];}_0x3ab96f=_['merge']({},_0x3ab96f,_0x47eb35[_0xd7a4('0x4a')]);return db[_0xd7a4('0x4b')][_0xd7a4('0x52')](_0x3ab96f)[_0xd7a4('0x18')](handleEntityNotFound(_0x30b132,null))['then'](respondWithResult(_0x30b132,null))[_0xd7a4('0x22')](handleError(_0x30b132,null));};exports[_0xd7a4('0x53')]=function(_0xc80c3e,_0x1d64e5){return db[_0xd7a4('0x4b')][_0xd7a4('0x53')](_0xc80c3e[_0xd7a4('0x54')],{})['then'](respondWithResult(_0x1d64e5,0xc9))[_0xd7a4('0x22')](handleError(_0x1d64e5,null));};exports['update']=function(_0x1f7538,_0x4f0585){if(_0x1f7538['body']['id']){delete _0x1f7538[_0xd7a4('0x54')]['id'];}return db[_0xd7a4('0x4b')][_0xd7a4('0x52')]({'where':{'id':_0x1f7538[_0xd7a4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4f0585,null))['then'](saveUpdates(_0x1f7538[_0xd7a4('0x54')],null))[_0xd7a4('0x18')](respondWithResult(_0x4f0585,null))['catch'](handleError(_0x4f0585,null));};exports[_0xd7a4('0x30')]=function(_0x1da5fc,_0x21dcfc){return db[_0xd7a4('0x4b')][_0xd7a4('0x52')]({'where':{'id':_0x1da5fc[_0xd7a4('0x4f')]['id']}})[_0xd7a4('0x18')](handleEntityNotFound(_0x21dcfc,null))[_0xd7a4('0x18')](removeEntity(_0x21dcfc,null))[_0xd7a4('0x22')](handleError(_0x21dcfc,null));};exports[_0xd7a4('0x55')]=function(_0x834167,_0x2de64b,_0x106cdf){var _0x277335={};var _0x5c7b8f={};var _0x53ed26;var _0x641389;return db[_0xd7a4('0x4b')][_0xd7a4('0x56')]({'where':{'id':_0x834167[_0xd7a4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2de64b,null))[_0xd7a4('0x18')](function(_0x21674d){if(_0x21674d){_0x53ed26=_0x21674d;_0x5c7b8f[_0xd7a4('0x3a')]=_[_0xd7a4('0x3c')](db[_0xd7a4('0x57')][_0xd7a4('0x36')]);_0x5c7b8f[_0xd7a4('0x3b')]=_[_0xd7a4('0x3c')](_0x834167[_0xd7a4('0x3b')]);_0x5c7b8f['filters']=_[_0xd7a4('0x3f')](_0x5c7b8f[_0xd7a4('0x3a')],_0x5c7b8f[_0xd7a4('0x3b')]);_0x277335[_0xd7a4('0x3e')]=_['intersection'](_0x5c7b8f[_0xd7a4('0x3a')],qs[_0xd7a4('0x40')](_0x834167[_0xd7a4('0x3b')][_0xd7a4('0x40')]));_0x277335[_0xd7a4('0x3e')]=_0x277335[_0xd7a4('0x3e')][_0xd7a4('0x41')]?_0x277335[_0xd7a4('0x3e')]:_0x5c7b8f[_0xd7a4('0x3a')];_0x277335[_0xd7a4('0x44')]=qs[_0xd7a4('0x45')](_0x834167[_0xd7a4('0x3b')][_0xd7a4('0x45')]);_0x277335[_0xd7a4('0x46')]=qs[_0xd7a4('0x3d')](_[_0xd7a4('0x58')](_0x834167[_0xd7a4('0x3b')],_0x5c7b8f[_0xd7a4('0x3d')]));if(_0x834167[_0xd7a4('0x3b')][_0xd7a4('0x47')]){_0x277335[_0xd7a4('0x46')]=_[_0xd7a4('0x48')](_0x277335[_0xd7a4('0x46')],{'$or':_['map'](_0x277335[_0xd7a4('0x3e')],function(_0x109a13){var _0x5f148e={};_0x5f148e[_0x109a13]={'$like':'%'+_0x834167['query']['filter']+'%'};return _0x5f148e;})});}_0x277335=_[_0xd7a4('0x48')]({},_0x277335,_0x834167['options']);return _0x53ed26['getFields'](_0x277335);}})[_0xd7a4('0x18')](function(_0x3cf5f9){if(_0x3cf5f9){_0x641389=_0x3cf5f9[_0xd7a4('0x41')];if(!_0x834167[_0xd7a4('0x3b')][_0xd7a4('0x42')](_0xd7a4('0x43'))){_0x277335['limit']=qs[_0xd7a4('0x29')](_0x834167['query'][_0xd7a4('0x29')]);_0x277335[_0xd7a4('0x28')]=qs[_0xd7a4('0x28')](_0x834167[_0xd7a4('0x3b')]['offset']);}return _0x53ed26['getFields'](_0x277335);}})['then'](function(_0x4b1a7a){if(_0x4b1a7a){return _0x4b1a7a?{'count':_0x641389,'rows':_0x4b1a7a}:null;}})[_0xd7a4('0x18')](respondWithResult(_0x2de64b,null))['catch'](handleError(_0x2de64b,null));};exports[_0xd7a4('0x59')]=function(_0x191c45,_0x110baf,_0x17f981){var _0x54c3a5={};var _0x910bdf={};var _0xf11cc;var _0x38ce12;return db[_0xd7a4('0x4b')][_0xd7a4('0x56')]({'where':{'id':_0x191c45[_0xd7a4('0x4f')]['id']}})[_0xd7a4('0x18')](handleEntityNotFound(_0x110baf,null))[_0xd7a4('0x18')](function(_0x1c512d){if(_0x1c512d){_0xf11cc=_0x1c512d;_0x910bdf[_0xd7a4('0x3a')]=_[_0xd7a4('0x3c')](db['Dynamics365Field'][_0xd7a4('0x36')]);_0x910bdf[_0xd7a4('0x3b')]=_[_0xd7a4('0x3c')](_0x191c45['query']);_0x910bdf['filters']=_[_0xd7a4('0x3f')](_0x910bdf['model'],_0x910bdf[_0xd7a4('0x3b')]);_0x54c3a5[_0xd7a4('0x3e')]=_['intersection'](_0x910bdf['model'],qs[_0xd7a4('0x40')](_0x191c45[_0xd7a4('0x3b')][_0xd7a4('0x40')]));_0x54c3a5[_0xd7a4('0x3e')]=_0x54c3a5[_0xd7a4('0x3e')][_0xd7a4('0x41')]?_0x54c3a5[_0xd7a4('0x3e')]:_0x910bdf[_0xd7a4('0x3a')];_0x54c3a5[_0xd7a4('0x44')]=qs[_0xd7a4('0x45')](_0x191c45[_0xd7a4('0x3b')][_0xd7a4('0x45')]);_0x54c3a5[_0xd7a4('0x46')]=qs[_0xd7a4('0x3d')](_['pick'](_0x191c45['query'],_0x910bdf[_0xd7a4('0x3d')]));if(_0x191c45[_0xd7a4('0x3b')][_0xd7a4('0x47')]){_0x54c3a5[_0xd7a4('0x46')]=_[_0xd7a4('0x48')](_0x54c3a5[_0xd7a4('0x46')],{'$or':_['map'](_0x54c3a5[_0xd7a4('0x3e')],function(_0x451dad){var _0x93e806={};_0x93e806[_0x451dad]={'$like':'%'+_0x191c45[_0xd7a4('0x3b')][_0xd7a4('0x47')]+'%'};return _0x93e806;})});}_0x54c3a5=_[_0xd7a4('0x48')]({},_0x54c3a5,_0x191c45[_0xd7a4('0x4a')]);return _0xf11cc[_0xd7a4('0x59')](_0x54c3a5);}})[_0xd7a4('0x18')](function(_0x3f34d4){if(_0x3f34d4){_0x38ce12=_0x3f34d4[_0xd7a4('0x41')];if(!_0x191c45['query'][_0xd7a4('0x42')](_0xd7a4('0x43'))){_0x54c3a5[_0xd7a4('0x29')]=qs[_0xd7a4('0x29')](_0x191c45[_0xd7a4('0x3b')]['limit']);_0x54c3a5[_0xd7a4('0x28')]=qs[_0xd7a4('0x28')](_0x191c45[_0xd7a4('0x3b')][_0xd7a4('0x28')]);}return _0xf11cc[_0xd7a4('0x59')](_0x54c3a5);}})['then'](function(_0xedd4a5){if(_0xedd4a5){return _0xedd4a5?{'count':_0x38ce12,'rows':_0xedd4a5}:null;}})[_0xd7a4('0x18')](respondWithResult(_0x110baf,null))['catch'](handleError(_0x110baf,null));};exports[_0xd7a4('0x5a')]=function(_0x283016,_0x327f90,_0x2b72e4){var _0x2bac7f={};var _0x16b52c={};var _0x291a33;var _0x26bf45;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x283016[_0xd7a4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x327f90,null))[_0xd7a4('0x18')](function(_0x49d431){if(_0x49d431){_0x291a33=_0x49d431;_0x16b52c[_0xd7a4('0x3a')]=_[_0xd7a4('0x3c')](db[_0xd7a4('0x57')]['rawAttributes']);_0x16b52c[_0xd7a4('0x3b')]=_[_0xd7a4('0x3c')](_0x283016[_0xd7a4('0x3b')]);_0x16b52c['filters']=_[_0xd7a4('0x3f')](_0x16b52c[_0xd7a4('0x3a')],_0x16b52c[_0xd7a4('0x3b')]);_0x2bac7f[_0xd7a4('0x3e')]=_[_0xd7a4('0x3f')](_0x16b52c[_0xd7a4('0x3a')],qs[_0xd7a4('0x40')](_0x283016[_0xd7a4('0x3b')][_0xd7a4('0x40')]));_0x2bac7f[_0xd7a4('0x3e')]=_0x2bac7f[_0xd7a4('0x3e')][_0xd7a4('0x41')]?_0x2bac7f[_0xd7a4('0x3e')]:_0x16b52c['model'];_0x2bac7f[_0xd7a4('0x44')]=qs[_0xd7a4('0x45')](_0x283016['query'][_0xd7a4('0x45')]);_0x2bac7f[_0xd7a4('0x46')]=qs['filters'](_[_0xd7a4('0x58')](_0x283016[_0xd7a4('0x3b')],_0x16b52c['filters']));if(_0x283016['query'][_0xd7a4('0x47')]){_0x2bac7f[_0xd7a4('0x46')]=_[_0xd7a4('0x48')](_0x2bac7f[_0xd7a4('0x46')],{'$or':_['map'](_0x2bac7f['attributes'],function(_0x185efa){var _0x3144c9={};_0x3144c9[_0x185efa]={'$like':'%'+_0x283016[_0xd7a4('0x3b')][_0xd7a4('0x47')]+'%'};return _0x3144c9;})});}_0x2bac7f=_[_0xd7a4('0x48')]({},_0x2bac7f,_0x283016[_0xd7a4('0x4a')]);return _0x291a33[_0xd7a4('0x5a')](_0x2bac7f);}})[_0xd7a4('0x18')](function(_0x213e54){if(_0x213e54){_0x26bf45=_0x213e54[_0xd7a4('0x41')];if(!_0x283016['query'][_0xd7a4('0x42')](_0xd7a4('0x43'))){_0x2bac7f['limit']=qs[_0xd7a4('0x29')](_0x283016[_0xd7a4('0x3b')]['limit']);_0x2bac7f[_0xd7a4('0x28')]=qs[_0xd7a4('0x28')](_0x283016[_0xd7a4('0x3b')][_0xd7a4('0x28')]);}return _0x291a33[_0xd7a4('0x5a')](_0x2bac7f);}})[_0xd7a4('0x18')](function(_0x345bb7){if(_0x345bb7){return _0x345bb7?{'count':_0x26bf45,'rows':_0x345bb7}:null;}})[_0xd7a4('0x18')](respondWithResult(_0x327f90,null))['catch'](handleError(_0x327f90,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 63cb5cb..f88088b 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 _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 +var _0xf305=['api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util'];(function(_0x5473e7,_0xec03b7){var _0x3afd0d=function(_0x20c886){while(--_0x20c886){_0x5473e7['push'](_0x5473e7['shift']());}};_0x3afd0d(++_0xec03b7);}(_0xf305,0x1d2));var _0x5f30=function(_0x4409e7,_0x307f17){_0x4409e7=_0x4409e7-0x0;var _0x24c751=_0xf305[_0x4409e7];return _0x24c751;};'use strict';var _=require(_0x5f30('0x0'));var util=require(_0x5f30('0x1'));var logger=require('../../config/logger')(_0x5f30('0x2'));var moment=require(_0x5f30('0x3'));var BPromise=require('bluebird');var rp=require(_0x5f30('0x4'));var fs=require('fs');var path=require(_0x5f30('0x5'));var rimraf=require(_0x5f30('0x6'));var config=require(_0x5f30('0x7'));var attributes=require(_0x5f30('0x8'));module[_0x5f30('0x9')]=function(_0x174fc1,_0x27cb72){return _0x174fc1[_0x5f30('0xa')](_0x5f30('0xb'),attributes,{'tableName':_0x5f30('0xc'),'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 c61f70e..de45b6c 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 _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 +var _0x3660=['stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x26f3ee,_0x1500e0){var _0x447545=function(_0x132da9){while(--_0x132da9){_0x26f3ee['push'](_0x26f3ee['shift']());}};_0x447545(++_0x1500e0);}(_0x3660,0x19d));var _0x0366=function(_0x2c25b0,_0x41a941){_0x2c25b0=_0x2c25b0-0x0;var _0x12a6b0=_0x3660[_0x2c25b0];return _0x12a6b0;};'use strict';var _=require(_0x0366('0x0'));var util=require(_0x0366('0x1'));var moment=require(_0x0366('0x2'));var BPromise=require('bluebird');var rs=require(_0x0366('0x3'));var fs=require('fs');var Redis=require(_0x0366('0x4'));var db=require(_0x0366('0x5'))['db'];var utils=require(_0x0366('0x6'));var logger=require(_0x0366('0x7'))(_0x0366('0x8'));var config=require(_0x0366('0x9'));var jayson=require(_0x0366('0xa'));var client=jayson[_0x0366('0xb')][_0x0366('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x49608e,_0x2f87ef,_0x9a750c){return new BPromise(function(_0x57aae0,_0x42c1b8){return client[_0x0366('0xd')](_0x49608e,_0x9a750c)[_0x0366('0xe')](function(_0x545d1c){logger[_0x0366('0xf')](_0x0366('0x10'),_0x2f87ef,_0x0366('0x11'));logger[_0x0366('0x12')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x2f87ef,_0x0366('0x11'),JSON[_0x0366('0x13')](_0x545d1c));if(_0x545d1c['error']){if(_0x545d1c[_0x0366('0x14')][_0x0366('0x15')]===0x1f4){logger[_0x0366('0x14')](_0x0366('0x10'),_0x2f87ef,_0x545d1c[_0x0366('0x14')][_0x0366('0x16')]);return _0x42c1b8(_0x545d1c[_0x0366('0x14')]['message']);}logger[_0x0366('0x14')](_0x0366('0x10'),_0x2f87ef,_0x545d1c[_0x0366('0x14')][_0x0366('0x16')]);return _0x57aae0(_0x545d1c[_0x0366('0x14')][_0x0366('0x16')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x2f87ef,_0x0366('0x11'));_0x57aae0(_0x545d1c['result'][_0x0366('0x16')]);}})[_0x0366('0x17')](function(_0x42c038){logger[_0x0366('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2f87ef,_0x42c038);_0x42c1b8(_0x42c038);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 8646eec..63bef67 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 _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 +var _0x04b8=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','/:id','post','put','update','delete','destroy','exports'];(function(_0x467cb0,_0x303070){var _0x2153f7=function(_0x51775a){while(--_0x51775a){_0x467cb0['push'](_0x467cb0['shift']());}};_0x2153f7(++_0x303070);}(_0x04b8,0x159));var _0x804b=function(_0x31435f,_0x34021b){_0x31435f=_0x31435f-0x0;var _0x3f73aa=_0x04b8[_0x31435f];return _0x3f73aa;};'use strict';var multer=require('multer');var util=require(_0x804b('0x0'));var path=require('path');var timeout=require(_0x804b('0x1'));var express=require(_0x804b('0x2'));var router=express['Router']();var auth=require(_0x804b('0x3'));var interaction=require(_0x804b('0x4'));var config=require('../../config/environment');var controller=require(_0x804b('0x5'));router[_0x804b('0x6')]('/',auth[_0x804b('0x7')](),controller['index']);router[_0x804b('0x6')](_0x804b('0x8'),auth[_0x804b('0x7')](),controller['show']);router[_0x804b('0x9')]('/',auth[_0x804b('0x7')](),controller['create']);router[_0x804b('0xa')](_0x804b('0x8'),auth[_0x804b('0x7')](),controller[_0x804b('0xb')]);router[_0x804b('0xc')]('/:id',auth[_0x804b('0x7')](),controller[_0x804b('0xd')]);module[_0x804b('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 5d8217c..d2e42dd 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 _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 +var _0xd0db=['string','customVariable','keyValue','STRING','BOOLEAN','exports','ENUM'];(function(_0x4b2a0d,_0x51c101){var _0x482e95=function(_0x2138e2){while(--_0x2138e2){_0x4b2a0d['push'](_0x4b2a0d['shift']());}};_0x482e95(++_0x51c101);}(_0xd0db,0x7c));var _0xbd0d=function(_0x4cbdf0,_0x58a62a){_0x4cbdf0=_0x4cbdf0-0x0;var _0x53a32c=_0xd0db[_0x4cbdf0];return _0x53a32c;};'use strict';var Sequelize=require('sequelize');module[_0xbd0d('0x0')]={'type':{'type':Sequelize[_0xbd0d('0x1')](_0xbd0d('0x2'),'variable',_0xbd0d('0x3'),_0xbd0d('0x4')),'defaultValue':_0xbd0d('0x2')},'content':{'type':Sequelize[_0xbd0d('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string','variable',_0xbd0d('0x3'))},'keyContent':{'type':Sequelize[_0xbd0d('0x5')]},'idField':{'type':Sequelize[_0xbd0d('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xbd0d('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbd0d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 6424749..7815f86 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 _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 +var _0xccc2=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x55e413,_0x354fa2){var _0x47fa08=function(_0x4c0a04){while(--_0x4c0a04){_0x55e413['push'](_0x55e413['shift']());}};_0x47fa08(++_0x354fa2);}(_0xccc2,0x1da));var _0x2ccc=function(_0x3933b3,_0x3d6b90){_0x3933b3=_0x3933b3-0x0;var _0x241a71=_0xccc2[_0x3933b3];return _0x241a71;};'use strict';var pdf=require(_0x2ccc('0x0'));var emlformat=require(_0x2ccc('0x1'));var rimraf=require(_0x2ccc('0x2'));var zipdir=require(_0x2ccc('0x3'));var jsonpatch=require(_0x2ccc('0x4'));var rp=require(_0x2ccc('0x5'));var moment=require(_0x2ccc('0x6'));var BPromise=require(_0x2ccc('0x7'));var Mustache=require(_0x2ccc('0x8'));var util=require(_0x2ccc('0x9'));var path=require(_0x2ccc('0xa'));var sox=require(_0x2ccc('0xb'));var csv=require(_0x2ccc('0xc'));var ejs=require(_0x2ccc('0xd'));var fs=require('fs');var _=require(_0x2ccc('0xe'));var squel=require(_0x2ccc('0xf'));var crypto=require('crypto');var jsforce=require(_0x2ccc('0x10'));var deskjs=require(_0x2ccc('0x11'));var toCsv=require(_0x2ccc('0xc'));var querystring=require(_0x2ccc('0x12'));var Papa=require(_0x2ccc('0x13'));var Redis=require(_0x2ccc('0x14'));var authService=require(_0x2ccc('0x15'));var qs=require(_0x2ccc('0x16'));var as=require(_0x2ccc('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ccc('0x18'))(_0x2ccc('0x19'));var utils=require(_0x2ccc('0x1a'));var config=require(_0x2ccc('0x1b'));var licenseUtil=require(_0x2ccc('0x1c'));var db=require(_0x2ccc('0x1d'))['db'];function respondWithStatusCode(_0x4079fe,_0x19e8c7){_0x19e8c7=_0x19e8c7||0xcc;return function(_0x4f1157){if(_0x4f1157){return _0x4079fe[_0x2ccc('0x1e')](_0x19e8c7);}return _0x4079fe[_0x2ccc('0x1f')](_0x19e8c7)[_0x2ccc('0x20')]();};}function respondWithResult(_0x27d0dc,_0x468a3e){_0x468a3e=_0x468a3e||0xc8;return function(_0x14d16f){if(_0x14d16f){return _0x27d0dc[_0x2ccc('0x1f')](_0x468a3e)[_0x2ccc('0x21')](_0x14d16f);}};}function respondWithFilteredResult(_0x4f1a7b,_0x1e7c83){return function(_0x32fd43){if(_0x32fd43){var _0x38a042=_0x32fd43[_0x2ccc('0x22')],_0x3eeae7=_0x1e7c83[_0x2ccc('0x23')],_0x29cad6=_0x1e7c83['offset']+_0x1e7c83['limit'],_0x250b0d;if(_0x29cad6>=_0x38a042){_0x29cad6=_0x38a042;_0x250b0d=0xc8;}else{_0x250b0d=0xce;}_0x4f1a7b[_0x2ccc('0x1f')](_0x250b0d);return _0x4f1a7b[_0x2ccc('0x24')](_0x2ccc('0x25'),_0x3eeae7+'-'+_0x29cad6+'/'+_0x38a042)[_0x2ccc('0x21')](_0x32fd43);}return null;};}function patchUpdates(_0x35d609){return function(_0x20c2dd){try{jsonpatch[_0x2ccc('0x26')](_0x20c2dd,_0x35d609,!![]);}catch(_0x4511fe){return BPromise['reject'](_0x4511fe);}return _0x20c2dd[_0x2ccc('0x27')]();};}function saveUpdates(_0x1c356e,_0x1a748a){return function(_0x5192a1){if(_0x5192a1){return _0x5192a1[_0x2ccc('0x28')](_0x1c356e)[_0x2ccc('0x29')](function(_0x91fc10){return _0x91fc10;});}return null;};}function removeEntity(_0x1929e8,_0x876288){return function(_0x5e5187){if(_0x5e5187){return _0x5e5187['destroy']()[_0x2ccc('0x29')](function(){_0x1929e8[_0x2ccc('0x1f')](0xcc)[_0x2ccc('0x20')]();});}};}function handleEntityNotFound(_0x14254f,_0x292c65){return function(_0x2fc79c){if(!_0x2fc79c){_0x14254f['sendStatus'](0x194);}return _0x2fc79c;};}function handleError(_0xda4327,_0x1d2d39){_0x1d2d39=_0x1d2d39||0x1f4;return function(_0x1e576e){logger[_0x2ccc('0x2a')](_0x1e576e[_0x2ccc('0x2b')]);if(_0x1e576e['name']){delete _0x1e576e[_0x2ccc('0x2c')];}_0xda4327[_0x2ccc('0x1f')](_0x1d2d39)[_0x2ccc('0x2d')](_0x1e576e);};}exports[_0x2ccc('0x2e')]=function(_0x3e381c,_0x44a706){var _0xd8f346={},_0x5f5049={},_0xaf0b36={'count':0x0,'rows':[]};var _0x49a378=_[_0x2ccc('0x2f')](db[_0x2ccc('0x30')][_0x2ccc('0x31')],function(_0x3790f6){return{'name':_0x3790f6[_0x2ccc('0x32')],'type':_0x3790f6[_0x2ccc('0x33')][_0x2ccc('0x34')]};});_0x5f5049[_0x2ccc('0x35')]=_[_0x2ccc('0x2f')](_0x49a378,'name');_0x5f5049[_0x2ccc('0x36')]=_[_0x2ccc('0x37')](_0x3e381c[_0x2ccc('0x36')]);_0x5f5049[_0x2ccc('0x38')]=_['intersection'](_0x5f5049[_0x2ccc('0x35')],_0x5f5049['query']);_0xd8f346['attributes']=_[_0x2ccc('0x39')](_0x5f5049[_0x2ccc('0x35')],qs[_0x2ccc('0x3a')](_0x3e381c['query'][_0x2ccc('0x3a')]));_0xd8f346[_0x2ccc('0x3b')]=_0xd8f346[_0x2ccc('0x3b')][_0x2ccc('0x3c')]?_0xd8f346[_0x2ccc('0x3b')]:_0x5f5049[_0x2ccc('0x35')];if(!_0x3e381c[_0x2ccc('0x36')]['hasOwnProperty'](_0x2ccc('0x3d'))){_0xd8f346[_0x2ccc('0x3e')]=qs[_0x2ccc('0x3e')](_0x3e381c[_0x2ccc('0x36')][_0x2ccc('0x3e')]);_0xd8f346['offset']=qs['offset'](_0x3e381c[_0x2ccc('0x36')]['offset']);}_0xd8f346[_0x2ccc('0x3f')]=qs[_0x2ccc('0x40')](_0x3e381c[_0x2ccc('0x36')][_0x2ccc('0x40')]);_0xd8f346[_0x2ccc('0x41')]=qs['filters'](_['pick'](_0x3e381c[_0x2ccc('0x36')],_0x5f5049[_0x2ccc('0x38')]),_0x49a378);if(_0x3e381c[_0x2ccc('0x36')][_0x2ccc('0x42')]){_0xd8f346[_0x2ccc('0x41')]=_[_0x2ccc('0x43')](_0xd8f346[_0x2ccc('0x41')],{'$or':_[_0x2ccc('0x2f')](_0x49a378,function(_0x52bedd){if(_0x52bedd[_0x2ccc('0x33')]!==_0x2ccc('0x44')){var _0xad83cb={};_0xad83cb[_0x52bedd[_0x2ccc('0x2c')]]={'$like':'%'+_0x3e381c[_0x2ccc('0x36')][_0x2ccc('0x42')]+'%'};return _0xad83cb;}})});}_0xd8f346=_[_0x2ccc('0x43')]({},_0xd8f346,_0x3e381c['options']);var _0x90329c={'where':_0xd8f346[_0x2ccc('0x41')]};return db[_0x2ccc('0x30')][_0x2ccc('0x22')](_0x90329c)[_0x2ccc('0x29')](function(_0x2813e6){_0xaf0b36[_0x2ccc('0x22')]=_0x2813e6;if(_0x3e381c[_0x2ccc('0x36')][_0x2ccc('0x45')]){_0xd8f346[_0x2ccc('0x46')]=[{'all':!![]}];}return db[_0x2ccc('0x30')][_0x2ccc('0x47')](_0xd8f346);})['then'](function(_0x38eb5d){_0xaf0b36[_0x2ccc('0x48')]=_0x38eb5d;return _0xaf0b36;})[_0x2ccc('0x29')](respondWithFilteredResult(_0x44a706,_0xd8f346))['catch'](handleError(_0x44a706,null));};exports['show']=function(_0x293a,_0x34265a){var _0x520628={'raw':!![],'where':{'id':_0x293a[_0x2ccc('0x49')]['id']}},_0x4a1839={};_0x4a1839[_0x2ccc('0x35')]=_[_0x2ccc('0x37')](db[_0x2ccc('0x30')]['rawAttributes']);_0x4a1839[_0x2ccc('0x36')]=_[_0x2ccc('0x37')](_0x293a['query']);_0x4a1839['filters']=_[_0x2ccc('0x39')](_0x4a1839[_0x2ccc('0x35')],_0x4a1839[_0x2ccc('0x36')]);_0x520628[_0x2ccc('0x3b')]=_[_0x2ccc('0x39')](_0x4a1839[_0x2ccc('0x35')],qs[_0x2ccc('0x3a')](_0x293a[_0x2ccc('0x36')][_0x2ccc('0x3a')]));_0x520628[_0x2ccc('0x3b')]=_0x520628['attributes'][_0x2ccc('0x3c')]?_0x520628[_0x2ccc('0x3b')]:_0x4a1839[_0x2ccc('0x35')];if(_0x293a[_0x2ccc('0x36')][_0x2ccc('0x45')]){_0x520628[_0x2ccc('0x46')]=[{'all':!![]}];}_0x520628=_[_0x2ccc('0x43')]({},_0x520628,_0x293a[_0x2ccc('0x4a')]);return db[_0x2ccc('0x30')][_0x2ccc('0x4b')](_0x520628)[_0x2ccc('0x29')](handleEntityNotFound(_0x34265a,null))['then'](respondWithResult(_0x34265a,null))[_0x2ccc('0x4c')](handleError(_0x34265a,null));};exports['create']=function(_0xf9b644,_0x4df770){return db['Dynamics365Field'][_0x2ccc('0x4d')](_0xf9b644['body'],{})['then'](respondWithResult(_0x4df770,0xc9))[_0x2ccc('0x4c')](handleError(_0x4df770,null));};exports['update']=function(_0x39394c,_0x490d78){if(_0x39394c['body']['id']){delete _0x39394c[_0x2ccc('0x4e')]['id'];}return db[_0x2ccc('0x30')]['find']({'where':{'id':_0x39394c[_0x2ccc('0x49')]['id']}})[_0x2ccc('0x29')](handleEntityNotFound(_0x490d78,null))[_0x2ccc('0x29')](saveUpdates(_0x39394c['body'],null))[_0x2ccc('0x29')](respondWithResult(_0x490d78,null))['catch'](handleError(_0x490d78,null));};exports[_0x2ccc('0x4f')]=function(_0x22b923,_0x2b3551){return db[_0x2ccc('0x30')][_0x2ccc('0x4b')]({'where':{'id':_0x22b923['params']['id']}})[_0x2ccc('0x29')](handleEntityNotFound(_0x2b3551,null))[_0x2ccc('0x29')](removeEntity(_0x2b3551,null))[_0x2ccc('0x4c')](handleError(_0x2b3551,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index f93e777..03ec940 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 _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 +var _0xd8c0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField'];(function(_0x2de740,_0x5bbd67){var _0xf2f74c=function(_0x25d677){while(--_0x25d677){_0x2de740['push'](_0x2de740['shift']());}};_0xf2f74c(++_0x5bbd67);}(_0xd8c0,0x1ad));var _0x0d8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8c0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0d8c('0x0'))(_0x0d8c('0x1'));var moment=require(_0x0d8c('0x2'));var BPromise=require(_0x0d8c('0x3'));var rp=require(_0x0d8c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0d8c('0x5'));var config=require(_0x0d8c('0x6'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x190e90,_0x4aca2a){return _0x190e90['define'](_0x0d8c('0x7'),attributes,{'tableName':_0x0d8c('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8c('0x9'),'fields':[_0x0d8c('0xa'),'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 b09929b..213ab8d 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 _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 +var _0x7a54=['info','Dynamics365Field,\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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x36f6df,_0x559959){_0x36f6df=_0x36f6df-0x0;var _0x542d66=_0x7a54[_0x36f6df];return _0x542d66;};'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')]('Dynamics365Field,\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/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index ab909fa..697b566 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 _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 +var _0x548a=['exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x548a,0x1cf));var _0xa548=function(_0x3debe0,_0x5ee010){_0x3debe0=_0x3debe0-0x0;var _0x5167c9=_0x548a[_0x3debe0];return _0x5167c9;};'use strict';var multer=require(_0xa548('0x0'));var util=require('util');var path=require(_0xa548('0x1'));var timeout=require(_0xa548('0x2'));var express=require('express');var router=express[_0xa548('0x3')]();var auth=require(_0xa548('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa548('0x5'));var controller=require(_0xa548('0x6'));router[_0xa548('0x7')]('/',auth[_0xa548('0x8')](),controller[_0xa548('0x9')]);router[_0xa548('0x7')](_0xa548('0xa'),auth['isAuthenticated'](),controller[_0xa548('0xb')]);router[_0xa548('0x7')]('/:id/configurations',auth[_0xa548('0x8')](),controller[_0xa548('0xc')]);router['get'](_0xa548('0xd'),auth[_0xa548('0x8')](),controller[_0xa548('0xe')]);router[_0xa548('0xf')]('/',auth[_0xa548('0x8')](),controller[_0xa548('0x10')]);router['post'](_0xa548('0x11'),auth[_0xa548('0x8')](),controller['addConfiguration']);router[_0xa548('0x12')](_0xa548('0xa'),auth[_0xa548('0x8')](),controller[_0xa548('0x13')]);router['delete'](_0xa548('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xa548('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 3955023..27d9018 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 _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 +var _0xdd13=['STRING','username'];(function(_0xa25b89,_0x91701c){var _0x1359ab=function(_0x3c2822){while(--_0x3c2822){_0xa25b89['push'](_0xa25b89['shift']());}};_0x1359ab(++_0x91701c);}(_0xdd13,0x19c));var _0x3dd1=function(_0x352545,_0x4847c5){_0x352545=_0x352545-0x0;var _0x5c7f0c=_0xdd13[_0x352545];return _0x5c7f0c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3dd1('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x3dd1('0x1')},'apiKey':{'type':Sequelize[_0x3dd1('0x0')]},'remoteUri':{'type':Sequelize[_0x3dd1('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x3dd1('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 495b9d7..fb0c6bc 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 _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 +var _0xf065=['sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','length','find','body','findOne','FreshdeskConfiguration','getConfigurations','getSubjects','Descriptions','getDescriptions','create','FreshdeskField','Subjects','remoteUri','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','%s:X','apiKey','toString','subject','description','priority','source','ticket_type','group','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','html-pdf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','end','sendStatus','stack','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x2bc752,_0x581f5e){var _0x4c1596=function(_0x15c3b4){while(--_0x15c3b4){_0x2bc752['push'](_0x2bc752['shift']());}};_0x4c1596(++_0x581f5e);}(_0xf065,0xad));var _0x5f06=function(_0x7f58af,_0x5787cc){_0x7f58af=_0x7f58af-0x0;var _0x47f99d=_0xf065[_0x7f58af];return _0x47f99d;};'use strict';var pdf=require(_0x5f06('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5f06('0x1'));var moment=require(_0x5f06('0x2'));var BPromise=require(_0x5f06('0x3'));var Mustache=require(_0x5f06('0x4'));var util=require(_0x5f06('0x5'));var path=require(_0x5f06('0x6'));var sox=require(_0x5f06('0x7'));var csv=require(_0x5f06('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5f06('0x9'));var crypto=require(_0x5f06('0xa'));var jsforce=require(_0x5f06('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5f06('0x8'));var querystring=require('querystring');var Papa=require(_0x5f06('0xc'));var Redis=require(_0x5f06('0xd'));var authService=require(_0x5f06('0xe'));var qs=require(_0x5f06('0xf'));var as=require(_0x5f06('0x10'));var hardwareService=require(_0x5f06('0x11'));var logger=require(_0x5f06('0x12'))(_0x5f06('0x13'));var utils=require(_0x5f06('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5f06('0x15'))['db'];var integrations=require(_0x5f06('0x16'));var jayson=require(_0x5f06('0x17'));var client=jayson[_0x5f06('0x18')][_0x5f06('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3b2f11,_0x3dec7b,_0x30a053,_0x314e4b){return new BPromise(function(_0x24c901,_0x276b16){var _0x291296=_0x314e4b||client;return _0x291296[_0x5f06('0x1a')](_0x3b2f11,_0x30a053)[_0x5f06('0x1b')](function(_0x1f13c4){logger[_0x5f06('0x1c')]('FreshdeskAccount,\x20%s,\x20%s',_0x3dec7b,'request\x20sent');logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x3dec7b,_0x5f06('0x1d'),JSON[_0x5f06('0x1e')](_0x1f13c4));if(_0x1f13c4[_0x5f06('0x1f')]){if(_0x1f13c4[_0x5f06('0x1f')][_0x5f06('0x20')]===0x1f4){logger[_0x5f06('0x1f')](_0x5f06('0x21'),_0x3dec7b,_0x1f13c4[_0x5f06('0x1f')]['message']);return _0x276b16(_0x1f13c4[_0x5f06('0x1f')][_0x5f06('0x22')]);}logger[_0x5f06('0x1f')](_0x5f06('0x21'),_0x3dec7b,_0x1f13c4[_0x5f06('0x1f')][_0x5f06('0x22')]);return _0x24c901(_0x1f13c4[_0x5f06('0x1f')][_0x5f06('0x22')]);}else{logger[_0x5f06('0x1c')](_0x5f06('0x21'),_0x3dec7b,'request\x20sent');_0x24c901(_0x1f13c4[_0x5f06('0x23')]['message']);}})[_0x5f06('0x24')](function(_0x2581da){logger[_0x5f06('0x1f')](_0x5f06('0x21'),_0x3dec7b,_0x2581da);_0x276b16(_0x2581da);});});}function respondWithStatusCode(_0x3da4c7,_0x338a27){_0x338a27=_0x338a27||0xcc;return function(_0x5a40ad){if(_0x5a40ad){return _0x3da4c7['sendStatus'](_0x338a27);}return _0x3da4c7['status'](_0x338a27)['end']();};}function respondWithResult(_0x21b04f,_0x3f6155){_0x3f6155=_0x3f6155||0xc8;return function(_0x52f01a){if(_0x52f01a){return _0x21b04f[_0x5f06('0x25')](_0x3f6155)[_0x5f06('0x26')](_0x52f01a);}};}function respondWithFilteredResult(_0x2f4eac,_0xf9af2c){return function(_0x2bd9f1){if(_0x2bd9f1){var _0x130f96=_0x2bd9f1[_0x5f06('0x27')],_0x3f156c=_0xf9af2c[_0x5f06('0x28')],_0x58f248=_0xf9af2c[_0x5f06('0x28')]+_0xf9af2c[_0x5f06('0x29')],_0xd43803;if(_0x58f248>=_0x130f96){_0x58f248=_0x130f96;_0xd43803=0xc8;}else{_0xd43803=0xce;}_0x2f4eac[_0x5f06('0x25')](_0xd43803);return _0x2f4eac[_0x5f06('0x2a')](_0x5f06('0x2b'),_0x3f156c+'-'+_0x58f248+'/'+_0x130f96)[_0x5f06('0x26')](_0x2bd9f1);}return null;};}function patchUpdates(_0x39adf2){return function(_0x459037){try{jsonpatch[_0x5f06('0x2c')](_0x459037,_0x39adf2,!![]);}catch(_0xe7e321){return BPromise['reject'](_0xe7e321);}return _0x459037[_0x5f06('0x2d')]();};}function saveUpdates(_0x1da3be,_0x563c9b){return function(_0x22183a){if(_0x22183a){return _0x22183a[_0x5f06('0x2e')](_0x1da3be)[_0x5f06('0x1b')](function(_0x5a36ad){return _0x5a36ad;});}return null;};}function removeEntity(_0x496eb1,_0x23c88b){return function(_0x38e195){if(_0x38e195){return _0x38e195[_0x5f06('0x2f')]()[_0x5f06('0x1b')](function(){_0x496eb1[_0x5f06('0x25')](0xcc)[_0x5f06('0x30')]();});}};}function handleEntityNotFound(_0x15dcd9,_0x360b3e){return function(_0x1bb94b){if(!_0x1bb94b){_0x15dcd9[_0x5f06('0x31')](0x194);}return _0x1bb94b;};}function handleError(_0x3078f2,_0x37f53a){_0x37f53a=_0x37f53a||0x1f4;return function(_0x596e13){logger[_0x5f06('0x1f')](_0x596e13[_0x5f06('0x32')]);if(_0x596e13[_0x5f06('0x33')]){delete _0x596e13['name'];}_0x3078f2[_0x5f06('0x25')](_0x37f53a)[_0x5f06('0x34')](_0x596e13);};}exports[_0x5f06('0x35')]=function(_0x6cf973,_0x859ac4){var _0x3f7f1d={},_0x49cbfd={},_0x3e4d68={'count':0x0,'rows':[]};var _0x4105c4=_['map'](db[_0x5f06('0x36')][_0x5f06('0x37')],function(_0x5879ea){return{'name':_0x5879ea[_0x5f06('0x38')],'type':_0x5879ea[_0x5f06('0x39')][_0x5f06('0x3a')]};});_0x49cbfd[_0x5f06('0x3b')]=_[_0x5f06('0x3c')](_0x4105c4,_0x5f06('0x33'));_0x49cbfd[_0x5f06('0x3d')]=_[_0x5f06('0x3e')](_0x6cf973[_0x5f06('0x3d')]);_0x49cbfd[_0x5f06('0x3f')]=_[_0x5f06('0x40')](_0x49cbfd[_0x5f06('0x3b')],_0x49cbfd[_0x5f06('0x3d')]);_0x3f7f1d[_0x5f06('0x41')]=_['intersection'](_0x49cbfd[_0x5f06('0x3b')],qs['fields'](_0x6cf973['query'][_0x5f06('0x42')]));_0x3f7f1d[_0x5f06('0x41')]=_0x3f7f1d[_0x5f06('0x41')]['length']?_0x3f7f1d[_0x5f06('0x41')]:_0x49cbfd[_0x5f06('0x3b')];if(!_0x6cf973['query'][_0x5f06('0x43')](_0x5f06('0x44'))){_0x3f7f1d[_0x5f06('0x29')]=qs['limit'](_0x6cf973['query'][_0x5f06('0x29')]);_0x3f7f1d['offset']=qs['offset'](_0x6cf973[_0x5f06('0x3d')][_0x5f06('0x28')]);}_0x3f7f1d['order']=qs[_0x5f06('0x45')](_0x6cf973[_0x5f06('0x3d')][_0x5f06('0x45')]);_0x3f7f1d[_0x5f06('0x46')]=qs['filters'](_['pick'](_0x6cf973[_0x5f06('0x3d')],_0x49cbfd[_0x5f06('0x3f')]),_0x4105c4);if(_0x6cf973['query'][_0x5f06('0x47')]){_0x3f7f1d[_0x5f06('0x46')]=_[_0x5f06('0x48')](_0x3f7f1d[_0x5f06('0x46')],{'$or':_[_0x5f06('0x3c')](_0x4105c4,function(_0x21b2db){if(_0x21b2db[_0x5f06('0x39')]!=='VIRTUAL'){var _0x68a502={};_0x68a502[_0x21b2db[_0x5f06('0x33')]]={'$like':'%'+_0x6cf973['query'][_0x5f06('0x47')]+'%'};return _0x68a502;}})});}_0x3f7f1d=_[_0x5f06('0x48')]({},_0x3f7f1d,_0x6cf973[_0x5f06('0x49')]);var _0x4b3df6={'where':_0x3f7f1d['where']};return db[_0x5f06('0x36')][_0x5f06('0x27')](_0x4b3df6)[_0x5f06('0x1b')](function(_0x1c316e){_0x3e4d68[_0x5f06('0x27')]=_0x1c316e;if(_0x6cf973[_0x5f06('0x3d')][_0x5f06('0x4a')]){_0x3f7f1d[_0x5f06('0x4b')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x5f06('0x4c')](_0x3f7f1d);})['then'](function(_0xc20888){_0x3e4d68[_0x5f06('0x4d')]=_0xc20888;return _0x3e4d68;})[_0x5f06('0x1b')](respondWithFilteredResult(_0x859ac4,_0x3f7f1d))[_0x5f06('0x24')](handleError(_0x859ac4,null));};exports[_0x5f06('0x4e')]=function(_0x550039,_0x43f09d){var _0xf97aba={'raw':![],'where':{'id':_0x550039[_0x5f06('0x4f')]['id']}},_0x3dcbde={};_0x3dcbde['model']=_['keys'](db['FreshdeskAccount'][_0x5f06('0x37')]);_0x3dcbde[_0x5f06('0x3d')]=_[_0x5f06('0x3e')](_0x550039[_0x5f06('0x3d')]);_0x3dcbde[_0x5f06('0x3f')]=_[_0x5f06('0x40')](_0x3dcbde['model'],_0x3dcbde[_0x5f06('0x3d')]);_0xf97aba[_0x5f06('0x41')]=_[_0x5f06('0x40')](_0x3dcbde[_0x5f06('0x3b')],qs[_0x5f06('0x42')](_0x550039[_0x5f06('0x3d')]['fields']));_0xf97aba[_0x5f06('0x41')]=_0xf97aba[_0x5f06('0x41')][_0x5f06('0x50')]?_0xf97aba[_0x5f06('0x41')]:_0x3dcbde[_0x5f06('0x3b')];if(_0x550039['query'][_0x5f06('0x4a')]){_0xf97aba[_0x5f06('0x4b')]=[{'all':!![]}];}_0xf97aba=_['merge']({},_0xf97aba,_0x550039[_0x5f06('0x49')]);return db['FreshdeskAccount'][_0x5f06('0x51')](_0xf97aba)[_0x5f06('0x1b')](handleEntityNotFound(_0x43f09d,null))[_0x5f06('0x1b')](respondWithResult(_0x43f09d,null))['catch'](handleError(_0x43f09d,null));};exports['create']=function(_0x3ce812,_0x5ded06){return db[_0x5f06('0x36')]['create'](_0x3ce812[_0x5f06('0x52')],{})[_0x5f06('0x1b')](respondWithResult(_0x5ded06,0xc9))[_0x5f06('0x24')](handleError(_0x5ded06,null));};exports[_0x5f06('0x2e')]=function(_0x3de262,_0x12abd4){if(_0x3de262[_0x5f06('0x52')]['id']){delete _0x3de262[_0x5f06('0x52')]['id'];}return db[_0x5f06('0x36')]['find']({'where':{'id':_0x3de262[_0x5f06('0x4f')]['id']}})[_0x5f06('0x1b')](handleEntityNotFound(_0x12abd4,null))[_0x5f06('0x1b')](saveUpdates(_0x3de262[_0x5f06('0x52')],null))[_0x5f06('0x1b')](respondWithResult(_0x12abd4,null))[_0x5f06('0x24')](handleError(_0x12abd4,null));};exports['destroy']=function(_0x2e2762,_0x38044c){return db[_0x5f06('0x36')][_0x5f06('0x51')]({'where':{'id':_0x2e2762[_0x5f06('0x4f')]['id']}})[_0x5f06('0x1b')](handleEntityNotFound(_0x38044c,null))[_0x5f06('0x1b')](removeEntity(_0x38044c,null))[_0x5f06('0x24')](handleError(_0x38044c,null));};exports['getConfigurations']=function(_0x25f451,_0x4fa53d,_0x4e9b33){var _0x2f8f2d={};var _0xe0323={};var _0x2b73f7;var _0x36fed3;return db['FreshdeskAccount'][_0x5f06('0x53')]({'where':{'id':_0x25f451['params']['id']}})[_0x5f06('0x1b')](handleEntityNotFound(_0x4fa53d,null))['then'](function(_0x2e39d8){if(_0x2e39d8){_0x2b73f7=_0x2e39d8;_0xe0323[_0x5f06('0x3b')]=_['keys'](db[_0x5f06('0x54')][_0x5f06('0x37')]);_0xe0323[_0x5f06('0x3d')]=_[_0x5f06('0x3e')](_0x25f451[_0x5f06('0x3d')]);_0xe0323['filters']=_['intersection'](_0xe0323[_0x5f06('0x3b')],_0xe0323[_0x5f06('0x3d')]);_0x2f8f2d[_0x5f06('0x41')]=_[_0x5f06('0x40')](_0xe0323[_0x5f06('0x3b')],qs['fields'](_0x25f451[_0x5f06('0x3d')][_0x5f06('0x42')]));_0x2f8f2d[_0x5f06('0x41')]=_0x2f8f2d['attributes'][_0x5f06('0x50')]?_0x2f8f2d['attributes']:_0xe0323[_0x5f06('0x3b')];_0x2f8f2d['order']=qs[_0x5f06('0x45')](_0x25f451[_0x5f06('0x3d')][_0x5f06('0x45')]);_0x2f8f2d[_0x5f06('0x46')]=qs[_0x5f06('0x3f')](_['pick'](_0x25f451['query'],_0xe0323['filters']));if(_0x25f451[_0x5f06('0x3d')][_0x5f06('0x47')]){_0x2f8f2d[_0x5f06('0x46')]=_['merge'](_0x2f8f2d['where'],{'$or':_[_0x5f06('0x3c')](_0x2f8f2d['attributes'],function(_0x3ade0a){var _0xef0272={};_0xef0272[_0x3ade0a]={'$like':'%'+_0x25f451[_0x5f06('0x3d')][_0x5f06('0x47')]+'%'};return _0xef0272;})});}_0x2f8f2d=_[_0x5f06('0x48')]({},_0x2f8f2d,_0x25f451[_0x5f06('0x49')]);return _0x2b73f7[_0x5f06('0x55')](_0x2f8f2d);}})[_0x5f06('0x1b')](function(_0x36db38){if(_0x36db38){_0x36fed3=_0x36db38[_0x5f06('0x50')];if(!_0x25f451[_0x5f06('0x3d')][_0x5f06('0x43')](_0x5f06('0x44'))){_0x2f8f2d[_0x5f06('0x29')]=qs[_0x5f06('0x29')](_0x25f451[_0x5f06('0x3d')][_0x5f06('0x29')]);_0x2f8f2d[_0x5f06('0x28')]=qs[_0x5f06('0x28')](_0x25f451[_0x5f06('0x3d')]['offset']);}return _0x2b73f7[_0x5f06('0x55')](_0x2f8f2d);}})['then'](function(_0x36872b){if(_0x36872b){return _0x36872b?{'count':_0x36fed3,'rows':_0x36872b}:null;}})[_0x5f06('0x1b')](respondWithResult(_0x4fa53d,null))[_0x5f06('0x24')](handleError(_0x4fa53d,null));};exports['addConfiguration']=function(_0x2b793f,_0x22f808,_0x3a18d6){if(_0x2b793f[_0x5f06('0x52')]['id']){delete _0x2b793f[_0x5f06('0x52')]['id'];}return db[_0x5f06('0x36')][_0x5f06('0x53')]({'where':{'id':_0x2b793f[_0x5f06('0x4f')]['id']}})[_0x5f06('0x1b')](handleEntityNotFound(_0x22f808,null))[_0x5f06('0x1b')](function(_0x589f61){if(_0x589f61){_0x2b793f['body']['AccountId']=_0x589f61['id'];_0x2b793f[_0x5f06('0x52')]['Subjects']=integrations[_0x5f06('0x56')](_0x2b793f[_0x5f06('0x52')]['channel'],_0x2b793f['body'][_0x5f06('0x39')]);_0x2b793f['body'][_0x5f06('0x57')]=integrations[_0x5f06('0x58')](_0x2b793f[_0x5f06('0x52')]['channel'],_0x2b793f[_0x5f06('0x52')][_0x5f06('0x39')]);return db[_0x5f06('0x54')][_0x5f06('0x59')](_0x2b793f['body'],{'include':[{'model':db[_0x5f06('0x5a')],'as':_0x5f06('0x5b')},{'model':db[_0x5f06('0x5a')],'as':_0x5f06('0x57')}]});}return null;})[_0x5f06('0x1b')](respondWithResult(_0x22f808,null))[_0x5f06('0x24')](handleError(_0x22f808,null));};exports['getFields']=function(_0x1beaeb,_0x30558b,_0x576abb){var _0x488cdd='';return db[_0x5f06('0x36')]['findOne']({'where':{'id':_0x1beaeb[_0x5f06('0x4f')]['id']},'attributes':['id',_0x5f06('0x5c'),'apiKey']})['then'](handleEntityNotFound(_0x30558b,null))[_0x5f06('0x1b')](function(_0x541b10){if(_0x541b10){_0x488cdd=_0x541b10['remoteUri'];var _0x2e3bfc=_0x488cdd[_0x5f06('0x5d')](-0x1);if(_0x2e3bfc==='/'){_0x488cdd=_0x488cdd[_0x5f06('0x5e')](0x0,_0x488cdd[_0x5f06('0x5f')](_0x2e3bfc));}return rp({'method':'GET','uri':util[_0x5f06('0x60')](_0x5f06('0x61'),_0x488cdd,_0x5f06('0x62')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x5f06('0x63'),_0x541b10[_0x5f06('0x64')]))[_0x5f06('0x65')]('base64'))},'json':!![]});}})[_0x5f06('0x1b')](function(_0x4bfd70){if(_0x4bfd70){var _0x43e8d7=['requester',_0x5f06('0x66'),'agent',_0x5f06('0x67'),_0x5f06('0x25'),_0x5f06('0x68'),'group',_0x5f06('0x69'),_0x5f06('0x6a'),_0x5f06('0x6b'),_0x5f06('0x6c')];_[_0x5f06('0x6d')](_0x4bfd70,function(_0x50d4a3){return _0x43e8d7[_0x5f06('0x6e')](_0x50d4a3['name'])||!_0x50d4a3[_0x5f06('0x6f')]&&_0x50d4a3['type']!==_0x5f06('0x70')&&_0x50d4a3[_0x5f06('0x39')]!==_0x5f06('0x71');});return{'count':_0x4bfd70[_0x5f06('0x50')],'rows':_[_0x5f06('0x3c')](_0x4bfd70,function(_0x3d5c30){return{'id':_0x3d5c30[_0x5f06('0x33')],'name':_0x3d5c30[_0x5f06('0x72')],'custom':!_0x3d5c30[_0x5f06('0x6f')],'options':_0x3d5c30[_0x5f06('0x73')]?_[_0x5f06('0x3c')](_0x3d5c30[_0x5f06('0x73')],function(_0x2470f1){return{'name':_[_0x5f06('0x74')](_0x2470f1),'value':_0x2470f1};}):[]};})};}})[_0x5f06('0x1b')](respondWithResult(_0x30558b,null))[_0x5f06('0x24')](function(_0x574c3b){var _0xab957=_0x1beaeb['query']['test']?0x1f4:_0x574c3b[_0x5f06('0x75')]||0x1f4;logger[_0x5f06('0x1f')](_0x5f06('0x76'),_0x5f06('0x77'),_0xab957,JSON[_0x5f06('0x1e')](_0x574c3b));delete _0x574c3b[_0x5f06('0x33')];if(_0xab957===0x191){_0xab957=0x190;}_0x30558b[_0x5f06('0x25')](_0xab957)[_0x5f06('0x34')](_0x1beaeb['query'][_0x5f06('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x574c3b[_0x5f06('0x75')]}:_0x574c3b);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 9e00090..5139032 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 _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 +var _0xbcbe=['path','rimraf','../../components/integrations/configuration','FreshdeskAccount','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbcbe,0x194));var _0xebcb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcbe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xebcb('0x0'));var util=require(_0xebcb('0x1'));var logger=require(_0xebcb('0x2'))('api');var moment=require(_0xebcb('0x3'));var BPromise=require(_0xebcb('0x4'));var rp=require(_0xebcb('0x5'));var fs=require('fs');var path=require(_0xebcb('0x6'));var rimraf=require(_0xebcb('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xebcb('0x8'));module['exports']=function(_0x370742,_0x3fcf1c){return _0x370742['define'](_0xebcb('0x9'),attributes,{'tableName':'int_freshdesk_accounts','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 4842f94..3ff4e0c 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 _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 +var _0x4ce9=['info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','find','stringify','moment','randomstring','ioredis','../../config/utils','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ce9,0x112));var _0x94ce=function(_0x37afb5,_0x197883){_0x37afb5=_0x37afb5-0x0;var _0x277782=_0x4ce9[_0x37afb5];return _0x277782;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x94ce('0x0'));var BPromise=require('bluebird');var rs=require(_0x94ce('0x1'));var fs=require('fs');var Redis=require(_0x94ce('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x94ce('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x58c18d,_0xe6799f,_0x1b48ea){return new BPromise(function(_0x587699,_0x2ba66a){return client[_0x94ce('0x4')](_0x58c18d,_0x1b48ea)[_0x94ce('0x5')](function(_0x12eae4){logger[_0x94ce('0x6')](_0x94ce('0x7'),_0xe6799f,_0x94ce('0x8'));logger[_0x94ce('0x9')](_0x94ce('0xa'),_0xe6799f,_0x94ce('0x8'),JSON['stringify'](_0x12eae4));if(_0x12eae4['error']){if(_0x12eae4['error']['code']===0x1f4){logger[_0x94ce('0xb')](_0x94ce('0x7'),_0xe6799f,_0x12eae4['error'][_0x94ce('0xc')]);return _0x2ba66a(_0x12eae4[_0x94ce('0xb')][_0x94ce('0xc')]);}logger[_0x94ce('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0xe6799f,_0x12eae4[_0x94ce('0xb')][_0x94ce('0xc')]);return _0x587699(_0x12eae4[_0x94ce('0xb')][_0x94ce('0xc')]);}else{logger['info'](_0x94ce('0x7'),_0xe6799f,_0x94ce('0x8'));_0x587699(_0x12eae4[_0x94ce('0xd')][_0x94ce('0xc')]);}})[_0x94ce('0xe')](function(_0x5e6f16){logger[_0x94ce('0xb')](_0x94ce('0x7'),_0xe6799f,_0x5e6f16);_0x2ba66a(_0x5e6f16);});});}exports[_0x94ce('0xf')]=function(_0x700de7){var _0x5d202a=this;return new Promise(function(_0x4d9dcf,_0x1520be){return db[_0x94ce('0x10')]['findAll']({'raw':_0x700de7['options']?_0x700de7[_0x94ce('0x11')][_0x94ce('0x12')]===undefined?!![]:![]:!![],'where':_0x700de7[_0x94ce('0x11')]?_0x700de7['options'][_0x94ce('0x13')]||null:null,'attributes':_0x700de7[_0x94ce('0x11')]?_0x700de7[_0x94ce('0x11')][_0x94ce('0x14')]||null:null,'limit':_0x700de7['options']?_0x700de7[_0x94ce('0x11')][_0x94ce('0x15')]||null:null,'include':_0x700de7[_0x94ce('0x11')]?_0x700de7[_0x94ce('0x11')][_0x94ce('0x16')]?_[_0x94ce('0x17')](_0x700de7[_0x94ce('0x11')][_0x94ce('0x16')],function(_0x5da400){return{'model':db[_0x5da400[_0x94ce('0x18')]],'as':_0x5da400['as'],'attributes':_0x5da400[_0x94ce('0x14')],'include':_0x5da400[_0x94ce('0x16')]?_[_0x94ce('0x17')](_0x5da400[_0x94ce('0x16')],function(_0x4d2c3c){return{'model':db[_0x4d2c3c['model']],'as':_0x4d2c3c['as'],'attributes':_0x4d2c3c[_0x94ce('0x14')],'include':_0x4d2c3c[_0x94ce('0x16')]?_[_0x94ce('0x17')](_0x4d2c3c['include'],function(_0x5bd309){return{'model':db[_0x5bd309['model']],'as':_0x5bd309['as'],'attributes':_0x5bd309['attributes']};}):[]};}):[]};}):[]:[]})[_0x94ce('0x5')](function(_0x4faef){logger[_0x94ce('0x6')](_0x94ce('0xf'),_0x700de7);logger['debug']('GetFreshdeskAccount',_0x700de7,JSON['stringify'](_0x4faef));_0x4d9dcf(_0x4faef);})['catch'](function(_0x3e72cf){logger[_0x94ce('0xb')]('GetFreshdeskAccount',_0x3e72cf[_0x94ce('0xc')],_0x700de7);_0x1520be(_0x5d202a[_0x94ce('0xb')](0x1f4,_0x3e72cf[_0x94ce('0xc')]));});});};exports[_0x94ce('0x19')]=function(_0x528c27){var _0x1318ef=this;return new Promise(function(_0x57a4aa,_0x3c9b17){return db[_0x94ce('0x10')][_0x94ce('0x1a')]({'raw':_0x528c27['options']?_0x528c27[_0x94ce('0x11')]['raw']===undefined?!![]:![]:!![],'where':_0x528c27[_0x94ce('0x11')]?_0x528c27[_0x94ce('0x11')][_0x94ce('0x13')]||null:null,'attributes':_0x528c27[_0x94ce('0x11')]?_0x528c27['options'][_0x94ce('0x14')]||null:null,'include':_0x528c27['options']?_0x528c27[_0x94ce('0x11')][_0x94ce('0x16')]?_[_0x94ce('0x17')](_0x528c27[_0x94ce('0x11')][_0x94ce('0x16')],function(_0x4febe7){return{'model':db[_0x4febe7[_0x94ce('0x18')]],'as':_0x4febe7['as'],'attributes':_0x4febe7['attributes'],'include':_0x4febe7[_0x94ce('0x16')]?_[_0x94ce('0x17')](_0x4febe7[_0x94ce('0x16')],function(_0x70f4e3){return{'model':db[_0x70f4e3[_0x94ce('0x18')]],'as':_0x70f4e3['as'],'attributes':_0x70f4e3[_0x94ce('0x14')],'include':_0x70f4e3['include']?_[_0x94ce('0x17')](_0x70f4e3[_0x94ce('0x16')],function(_0x7a8bbc){return{'model':db[_0x7a8bbc[_0x94ce('0x18')]],'as':_0x7a8bbc['as'],'attributes':_0x7a8bbc[_0x94ce('0x14')]};}):[]};}):[]};}):[]:[]})[_0x94ce('0x5')](function(_0x2e68ad){logger[_0x94ce('0x6')](_0x94ce('0x19'),_0x528c27);logger['debug'](_0x94ce('0x19'),_0x528c27,JSON[_0x94ce('0x1b')](_0x2e68ad));_0x57a4aa(_0x2e68ad);})[_0x94ce('0xe')](function(_0x3b68b5){logger[_0x94ce('0xb')](_0x94ce('0x19'),_0x3b68b5[_0x94ce('0xc')],_0x528c27);_0x3c9b17(_0x1318ef['error'](0x1f4,_0x3b68b5[_0x94ce('0xc')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 23342c5..a882b1e 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 _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 +var _0x7bb4=['../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','getTags','post','create','/:id/tags','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x7bb4,0x8c));var _0x47bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bb4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x47bb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x47bb('0x1'));var express=require(_0x47bb('0x2'));var router=express[_0x47bb('0x3')]();var auth=require(_0x47bb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x47bb('0x5'));var controller=require(_0x47bb('0x6'));router[_0x47bb('0x7')]('/',auth[_0x47bb('0x8')](),controller[_0x47bb('0x9')]);router['get']('/:id',auth[_0x47bb('0x8')](),controller[_0x47bb('0xa')]);router[_0x47bb('0x7')](_0x47bb('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x47bb('0x7')](_0x47bb('0xc'),auth[_0x47bb('0x8')](),controller[_0x47bb('0xd')]);router['get']('/:id/descriptions',auth[_0x47bb('0x8')](),controller[_0x47bb('0xe')]);router[_0x47bb('0x7')]('/:id/tags',auth[_0x47bb('0x8')](),controller[_0x47bb('0xf')]);router[_0x47bb('0x10')]('/',auth[_0x47bb('0x8')](),controller[_0x47bb('0x11')]);router['post'](_0x47bb('0x12'),auth[_0x47bb('0x8')](),controller['setTags']);router['put'](_0x47bb('0x13'),auth[_0x47bb('0x8')](),controller[_0x47bb('0x14')]);router[_0x47bb('0x15')]('/:id',auth[_0x47bb('0x8')](),controller[_0x47bb('0x16')]);module[_0x47bb('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 9358c4a..951785b 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 _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 +var _0x835b=['STRING','sequelize','exports'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x835b,0x13f));var _0xb835=function(_0x51426f,_0xba8ad9){_0x51426f=_0x51426f-0x0;var _0xed6bbd=_0x835b[_0x51426f];return _0xed6bbd;};'use strict';var Sequelize=require(_0xb835('0x0'));module[_0xb835('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb835('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 470db8a..340ab65 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 _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 +var _0x1b16=['bluebird','util','path','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','include','findAll','rows','includeAll','find','create','body','params','getFields','findOne','FreshdeskField','length','filter','getSubjects','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','rimraf','request-promise'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x1b16,0x16c));var _0x61b1=function(_0x5544db,_0x5219b2){_0x5544db=_0x5544db-0x0;var _0x153f11=_0x1b16[_0x5544db];return _0x153f11;};'use strict';var pdf=require(_0x61b1('0x0'));var emlformat=require(_0x61b1('0x1'));var rimraf=require(_0x61b1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x61b1('0x3'));var moment=require('moment');var BPromise=require(_0x61b1('0x4'));var Mustache=require('mustache');var util=require(_0x61b1('0x5'));var path=require(_0x61b1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x61b1('0x7'));var squel=require(_0x61b1('0x8'));var crypto=require('crypto');var jsforce=require(_0x61b1('0x9'));var deskjs=require(_0x61b1('0xa'));var toCsv=require(_0x61b1('0xb'));var querystring=require(_0x61b1('0xc'));var Papa=require(_0x61b1('0xd'));var Redis=require('ioredis');var authService=require(_0x61b1('0xe'));var qs=require(_0x61b1('0xf'));var as=require(_0x61b1('0x10'));var hardwareService=require(_0x61b1('0x11'));var logger=require(_0x61b1('0x12'))(_0x61b1('0x13'));var utils=require('../../config/utils');var config=require(_0x61b1('0x14'));var licenseUtil=require(_0x61b1('0x15'));var db=require(_0x61b1('0x16'))['db'];var jayson=require(_0x61b1('0x17'));var client=jayson[_0x61b1('0x18')][_0x61b1('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x31fdd3,_0x5cbaeb,_0x5429d2,_0x2ffe1e){return new BPromise(function(_0x29edc1,_0x45ef93){var _0xd2c34a=_0x2ffe1e||client;return _0xd2c34a[_0x61b1('0x1a')](_0x31fdd3,_0x5429d2)['then'](function(_0x49fdcd){logger[_0x61b1('0x1b')](_0x61b1('0x1c'),_0x5cbaeb,_0x61b1('0x1d'));logger[_0x61b1('0x1e')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5cbaeb,_0x61b1('0x1d'),JSON['stringify'](_0x49fdcd));if(_0x49fdcd[_0x61b1('0x1f')]){if(_0x49fdcd[_0x61b1('0x1f')][_0x61b1('0x20')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x5cbaeb,_0x49fdcd['error']['message']);return _0x45ef93(_0x49fdcd['error'][_0x61b1('0x21')]);}logger['error'](_0x61b1('0x1c'),_0x5cbaeb,_0x49fdcd[_0x61b1('0x1f')]['message']);return _0x29edc1(_0x49fdcd[_0x61b1('0x1f')][_0x61b1('0x21')]);}else{logger[_0x61b1('0x1b')](_0x61b1('0x1c'),_0x5cbaeb,_0x61b1('0x1d'));_0x29edc1(_0x49fdcd[_0x61b1('0x22')][_0x61b1('0x21')]);}})[_0x61b1('0x23')](function(_0x55624b){logger['error'](_0x61b1('0x1c'),_0x5cbaeb,_0x55624b);_0x45ef93(_0x55624b);});});}function respondWithStatusCode(_0x394393,_0x2e02d6){_0x2e02d6=_0x2e02d6||0xcc;return function(_0x1cbcf3){if(_0x1cbcf3){return _0x394393[_0x61b1('0x24')](_0x2e02d6);}return _0x394393['status'](_0x2e02d6)[_0x61b1('0x25')]();};}function respondWithResult(_0x1d5529,_0x215ba2){_0x215ba2=_0x215ba2||0xc8;return function(_0x2914cb){if(_0x2914cb){return _0x1d5529[_0x61b1('0x26')](_0x215ba2)['json'](_0x2914cb);}};}function respondWithFilteredResult(_0x37fee9,_0x2857fe){return function(_0x5c426a){if(_0x5c426a){var _0x269d3f=_0x5c426a[_0x61b1('0x27')],_0x252f04=_0x2857fe[_0x61b1('0x28')],_0x13105d=_0x2857fe[_0x61b1('0x28')]+_0x2857fe[_0x61b1('0x29')],_0x580ef3;if(_0x13105d>=_0x269d3f){_0x13105d=_0x269d3f;_0x580ef3=0xc8;}else{_0x580ef3=0xce;}_0x37fee9[_0x61b1('0x26')](_0x580ef3);return _0x37fee9[_0x61b1('0x2a')](_0x61b1('0x2b'),_0x252f04+'-'+_0x13105d+'/'+_0x269d3f)['json'](_0x5c426a);}return null;};}function patchUpdates(_0x437716){return function(_0x1496c5){try{jsonpatch[_0x61b1('0x2c')](_0x1496c5,_0x437716,!![]);}catch(_0x482139){return BPromise[_0x61b1('0x2d')](_0x482139);}return _0x1496c5[_0x61b1('0x2e')]();};}function saveUpdates(_0x5ccc8d,_0x32bd2b){return function(_0xe4d99){if(_0xe4d99){return _0xe4d99[_0x61b1('0x2f')](_0x5ccc8d)[_0x61b1('0x30')](function(_0x3a2822){return _0x3a2822;});}return null;};}function removeEntity(_0xe62a4,_0x2482c6){return function(_0x44d2a8){if(_0x44d2a8){return _0x44d2a8[_0x61b1('0x31')]()[_0x61b1('0x30')](function(){_0xe62a4[_0x61b1('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f246b,_0x12cf28){return function(_0x385d48){if(!_0x385d48){_0x5f246b[_0x61b1('0x24')](0x194);}return _0x385d48;};}function handleError(_0x502daf,_0xa15b6a){_0xa15b6a=_0xa15b6a||0x1f4;return function(_0x554db){logger[_0x61b1('0x1f')](_0x554db[_0x61b1('0x32')]);if(_0x554db[_0x61b1('0x33')]){delete _0x554db['name'];}_0x502daf[_0x61b1('0x26')](_0xa15b6a)[_0x61b1('0x34')](_0x554db);};}exports['index']=function(_0x3f7c22,_0x12ef1a){var _0x2e8f2d={},_0x367cca={},_0x557af8={'count':0x0,'rows':[]};var _0xb75a0=_[_0x61b1('0x35')](db[_0x61b1('0x36')][_0x61b1('0x37')],function(_0x442507){return{'name':_0x442507[_0x61b1('0x38')],'type':_0x442507[_0x61b1('0x39')][_0x61b1('0x3a')]};});_0x367cca[_0x61b1('0x3b')]=_['map'](_0xb75a0,_0x61b1('0x33'));_0x367cca[_0x61b1('0x3c')]=_[_0x61b1('0x3d')](_0x3f7c22[_0x61b1('0x3c')]);_0x367cca[_0x61b1('0x3e')]=_[_0x61b1('0x3f')](_0x367cca[_0x61b1('0x3b')],_0x367cca[_0x61b1('0x3c')]);_0x2e8f2d[_0x61b1('0x40')]=_[_0x61b1('0x3f')](_0x367cca['model'],qs[_0x61b1('0x41')](_0x3f7c22['query']['fields']));_0x2e8f2d[_0x61b1('0x40')]=_0x2e8f2d['attributes']['length']?_0x2e8f2d[_0x61b1('0x40')]:_0x367cca[_0x61b1('0x3b')];if(!_0x3f7c22[_0x61b1('0x3c')][_0x61b1('0x42')](_0x61b1('0x43'))){_0x2e8f2d[_0x61b1('0x29')]=qs[_0x61b1('0x29')](_0x3f7c22['query'][_0x61b1('0x29')]);_0x2e8f2d[_0x61b1('0x28')]=qs[_0x61b1('0x28')](_0x3f7c22[_0x61b1('0x3c')]['offset']);}_0x2e8f2d[_0x61b1('0x44')]=qs[_0x61b1('0x45')](_0x3f7c22[_0x61b1('0x3c')]['sort']);_0x2e8f2d['where']=qs[_0x61b1('0x3e')](_[_0x61b1('0x46')](_0x3f7c22[_0x61b1('0x3c')],_0x367cca[_0x61b1('0x3e')]),_0xb75a0);if(_0x3f7c22[_0x61b1('0x3c')]['filter']){_0x2e8f2d[_0x61b1('0x47')]=_[_0x61b1('0x48')](_0x2e8f2d[_0x61b1('0x47')],{'$or':_['map'](_0xb75a0,function(_0x17a790){if(_0x17a790[_0x61b1('0x39')]!=='VIRTUAL'){var _0x5b6033={};_0x5b6033[_0x17a790[_0x61b1('0x33')]]={'$like':'%'+_0x3f7c22[_0x61b1('0x3c')]['filter']+'%'};return _0x5b6033;}})});}_0x2e8f2d=_[_0x61b1('0x48')]({},_0x2e8f2d,_0x3f7c22[_0x61b1('0x49')]);var _0x1aa5ce={'where':_0x2e8f2d[_0x61b1('0x47')]};return db[_0x61b1('0x36')][_0x61b1('0x27')](_0x1aa5ce)[_0x61b1('0x30')](function(_0x1b654d){_0x557af8[_0x61b1('0x27')]=_0x1b654d;if(_0x3f7c22[_0x61b1('0x3c')]['includeAll']){_0x2e8f2d[_0x61b1('0x4a')]=[{'all':!![]}];}return db[_0x61b1('0x36')][_0x61b1('0x4b')](_0x2e8f2d);})[_0x61b1('0x30')](function(_0x35264e){_0x557af8[_0x61b1('0x4c')]=_0x35264e;return _0x557af8;})[_0x61b1('0x30')](respondWithFilteredResult(_0x12ef1a,_0x2e8f2d))[_0x61b1('0x23')](handleError(_0x12ef1a,null));};exports['show']=function(_0x239918,_0x76c40c){var _0x4a2ff4={'raw':![],'where':{'id':_0x239918['params']['id']}},_0x1f3c4e={};_0x1f3c4e[_0x61b1('0x3b')]=_[_0x61b1('0x3d')](db[_0x61b1('0x36')][_0x61b1('0x37')]);_0x1f3c4e[_0x61b1('0x3c')]=_[_0x61b1('0x3d')](_0x239918[_0x61b1('0x3c')]);_0x1f3c4e[_0x61b1('0x3e')]=_[_0x61b1('0x3f')](_0x1f3c4e[_0x61b1('0x3b')],_0x1f3c4e[_0x61b1('0x3c')]);_0x4a2ff4[_0x61b1('0x40')]=_[_0x61b1('0x3f')](_0x1f3c4e['model'],qs['fields'](_0x239918[_0x61b1('0x3c')][_0x61b1('0x41')]));_0x4a2ff4['attributes']=_0x4a2ff4['attributes']['length']?_0x4a2ff4[_0x61b1('0x40')]:_0x1f3c4e[_0x61b1('0x3b')];if(_0x239918['query'][_0x61b1('0x4d')]){_0x4a2ff4['include']=[{'all':!![]}];}_0x4a2ff4=_[_0x61b1('0x48')]({},_0x4a2ff4,_0x239918[_0x61b1('0x49')]);return db['FreshdeskConfiguration'][_0x61b1('0x4e')](_0x4a2ff4)[_0x61b1('0x30')](handleEntityNotFound(_0x76c40c,null))[_0x61b1('0x30')](respondWithResult(_0x76c40c,null))['catch'](handleError(_0x76c40c,null));};exports[_0x61b1('0x4f')]=function(_0x245566,_0x1b7b6c){return db[_0x61b1('0x36')]['create'](_0x245566[_0x61b1('0x50')],{})['then'](respondWithResult(_0x1b7b6c,0xc9))[_0x61b1('0x23')](handleError(_0x1b7b6c,null));};exports[_0x61b1('0x2f')]=function(_0x325ce5,_0x5615c0){if(_0x325ce5[_0x61b1('0x50')]['id']){delete _0x325ce5[_0x61b1('0x50')]['id'];}return db[_0x61b1('0x36')][_0x61b1('0x4e')]({'where':{'id':_0x325ce5[_0x61b1('0x51')]['id']}})[_0x61b1('0x30')](handleEntityNotFound(_0x5615c0,null))[_0x61b1('0x30')](saveUpdates(_0x325ce5[_0x61b1('0x50')],null))[_0x61b1('0x30')](respondWithResult(_0x5615c0,null))[_0x61b1('0x23')](handleError(_0x5615c0,null));};exports[_0x61b1('0x31')]=function(_0x3c6844,_0x217b54){return db[_0x61b1('0x36')]['find']({'where':{'id':_0x3c6844[_0x61b1('0x51')]['id']}})[_0x61b1('0x30')](handleEntityNotFound(_0x217b54,null))['then'](removeEntity(_0x217b54,null))[_0x61b1('0x23')](handleError(_0x217b54,null));};exports[_0x61b1('0x52')]=function(_0x3c3a29,_0x287db8,_0x207b90){var _0x35cdbc={};var _0x10b9f2={};var _0x589117;var _0x576104;return db[_0x61b1('0x36')][_0x61b1('0x53')]({'where':{'id':_0x3c3a29[_0x61b1('0x51')]['id']}})['then'](handleEntityNotFound(_0x287db8,null))[_0x61b1('0x30')](function(_0x40ed37){if(_0x40ed37){_0x589117=_0x40ed37;_0x10b9f2['model']=_[_0x61b1('0x3d')](db[_0x61b1('0x54')][_0x61b1('0x37')]);_0x10b9f2['query']=_[_0x61b1('0x3d')](_0x3c3a29[_0x61b1('0x3c')]);_0x10b9f2[_0x61b1('0x3e')]=_[_0x61b1('0x3f')](_0x10b9f2['model'],_0x10b9f2[_0x61b1('0x3c')]);_0x35cdbc[_0x61b1('0x40')]=_[_0x61b1('0x3f')](_0x10b9f2[_0x61b1('0x3b')],qs[_0x61b1('0x41')](_0x3c3a29[_0x61b1('0x3c')][_0x61b1('0x41')]));_0x35cdbc['attributes']=_0x35cdbc[_0x61b1('0x40')][_0x61b1('0x55')]?_0x35cdbc[_0x61b1('0x40')]:_0x10b9f2[_0x61b1('0x3b')];_0x35cdbc[_0x61b1('0x44')]=qs[_0x61b1('0x45')](_0x3c3a29[_0x61b1('0x3c')][_0x61b1('0x45')]);_0x35cdbc[_0x61b1('0x47')]=qs[_0x61b1('0x3e')](_[_0x61b1('0x46')](_0x3c3a29[_0x61b1('0x3c')],_0x10b9f2['filters']));if(_0x3c3a29[_0x61b1('0x3c')][_0x61b1('0x56')]){_0x35cdbc[_0x61b1('0x47')]=_[_0x61b1('0x48')](_0x35cdbc['where'],{'$or':_[_0x61b1('0x35')](_0x35cdbc[_0x61b1('0x40')],function(_0x13f65f){var _0x18b38a={};_0x18b38a[_0x13f65f]={'$like':'%'+_0x3c3a29[_0x61b1('0x3c')][_0x61b1('0x56')]+'%'};return _0x18b38a;})});}_0x35cdbc=_[_0x61b1('0x48')]({},_0x35cdbc,_0x3c3a29['options']);return _0x589117[_0x61b1('0x52')](_0x35cdbc);}})[_0x61b1('0x30')](function(_0x2c4788){if(_0x2c4788){_0x576104=_0x2c4788['length'];if(!_0x3c3a29['query'][_0x61b1('0x42')]('nolimit')){_0x35cdbc['limit']=qs['limit'](_0x3c3a29[_0x61b1('0x3c')][_0x61b1('0x29')]);_0x35cdbc[_0x61b1('0x28')]=qs[_0x61b1('0x28')](_0x3c3a29[_0x61b1('0x3c')]['offset']);}return _0x589117[_0x61b1('0x52')](_0x35cdbc);}})[_0x61b1('0x30')](function(_0x25ea59){if(_0x25ea59){return _0x25ea59?{'count':_0x576104,'rows':_0x25ea59}:null;}})[_0x61b1('0x30')](respondWithResult(_0x287db8,null))[_0x61b1('0x23')](handleError(_0x287db8,null));};exports[_0x61b1('0x57')]=function(_0x290a46,_0x179ebf,_0x5aa237){var _0x1c12da={};var _0x4eb3f9={};var _0x934bfd;var _0x558166;return db['FreshdeskConfiguration'][_0x61b1('0x53')]({'where':{'id':_0x290a46['params']['id']}})[_0x61b1('0x30')](handleEntityNotFound(_0x179ebf,null))[_0x61b1('0x30')](function(_0x55eee8){if(_0x55eee8){_0x934bfd=_0x55eee8;_0x4eb3f9[_0x61b1('0x3b')]=_[_0x61b1('0x3d')](db[_0x61b1('0x54')][_0x61b1('0x37')]);_0x4eb3f9[_0x61b1('0x3c')]=_[_0x61b1('0x3d')](_0x290a46[_0x61b1('0x3c')]);_0x4eb3f9[_0x61b1('0x3e')]=_[_0x61b1('0x3f')](_0x4eb3f9['model'],_0x4eb3f9[_0x61b1('0x3c')]);_0x1c12da[_0x61b1('0x40')]=_['intersection'](_0x4eb3f9[_0x61b1('0x3b')],qs[_0x61b1('0x41')](_0x290a46[_0x61b1('0x3c')]['fields']));_0x1c12da['attributes']=_0x1c12da[_0x61b1('0x40')][_0x61b1('0x55')]?_0x1c12da[_0x61b1('0x40')]:_0x4eb3f9[_0x61b1('0x3b')];_0x1c12da[_0x61b1('0x44')]=qs['sort'](_0x290a46[_0x61b1('0x3c')][_0x61b1('0x45')]);_0x1c12da[_0x61b1('0x47')]=qs[_0x61b1('0x3e')](_['pick'](_0x290a46['query'],_0x4eb3f9[_0x61b1('0x3e')]));if(_0x290a46['query'][_0x61b1('0x56')]){_0x1c12da[_0x61b1('0x47')]=_[_0x61b1('0x48')](_0x1c12da[_0x61b1('0x47')],{'$or':_[_0x61b1('0x35')](_0x1c12da[_0x61b1('0x40')],function(_0x4fc0ad){var _0x29d731={};_0x29d731[_0x4fc0ad]={'$like':'%'+_0x290a46[_0x61b1('0x3c')]['filter']+'%'};return _0x29d731;})});}_0x1c12da=_[_0x61b1('0x48')]({},_0x1c12da,_0x290a46[_0x61b1('0x49')]);return _0x934bfd[_0x61b1('0x57')](_0x1c12da);}})[_0x61b1('0x30')](function(_0x5a3b12){if(_0x5a3b12){_0x558166=_0x5a3b12['length'];if(!_0x290a46[_0x61b1('0x3c')][_0x61b1('0x42')](_0x61b1('0x43'))){_0x1c12da[_0x61b1('0x29')]=qs['limit'](_0x290a46['query'][_0x61b1('0x29')]);_0x1c12da[_0x61b1('0x28')]=qs[_0x61b1('0x28')](_0x290a46[_0x61b1('0x3c')]['offset']);}return _0x934bfd[_0x61b1('0x57')](_0x1c12da);}})['then'](function(_0x5b920e){if(_0x5b920e){return _0x5b920e?{'count':_0x558166,'rows':_0x5b920e}:null;}})[_0x61b1('0x30')](respondWithResult(_0x179ebf,null))[_0x61b1('0x23')](handleError(_0x179ebf,null));};exports[_0x61b1('0x58')]=function(_0x31cace,_0x266683,_0x4f5534){var _0x2adf85={};var _0x30c29b={};var _0x43aa57;var _0x15e167;return db[_0x61b1('0x36')][_0x61b1('0x53')]({'where':{'id':_0x31cace[_0x61b1('0x51')]['id']}})[_0x61b1('0x30')](handleEntityNotFound(_0x266683,null))['then'](function(_0x26ccb1){if(_0x26ccb1){_0x43aa57=_0x26ccb1;_0x30c29b[_0x61b1('0x3b')]=_[_0x61b1('0x3d')](db['FreshdeskField'][_0x61b1('0x37')]);_0x30c29b['query']=_[_0x61b1('0x3d')](_0x31cace[_0x61b1('0x3c')]);_0x30c29b['filters']=_['intersection'](_0x30c29b[_0x61b1('0x3b')],_0x30c29b['query']);_0x2adf85[_0x61b1('0x40')]=_[_0x61b1('0x3f')](_0x30c29b[_0x61b1('0x3b')],qs[_0x61b1('0x41')](_0x31cace[_0x61b1('0x3c')][_0x61b1('0x41')]));_0x2adf85[_0x61b1('0x40')]=_0x2adf85[_0x61b1('0x40')][_0x61b1('0x55')]?_0x2adf85[_0x61b1('0x40')]:_0x30c29b[_0x61b1('0x3b')];_0x2adf85[_0x61b1('0x44')]=qs[_0x61b1('0x45')](_0x31cace['query'][_0x61b1('0x45')]);_0x2adf85[_0x61b1('0x47')]=qs[_0x61b1('0x3e')](_['pick'](_0x31cace[_0x61b1('0x3c')],_0x30c29b[_0x61b1('0x3e')]));if(_0x31cace[_0x61b1('0x3c')][_0x61b1('0x56')]){_0x2adf85['where']=_[_0x61b1('0x48')](_0x2adf85[_0x61b1('0x47')],{'$or':_[_0x61b1('0x35')](_0x2adf85[_0x61b1('0x40')],function(_0x57b10a){var _0x3ae803={};_0x3ae803[_0x57b10a]={'$like':'%'+_0x31cace[_0x61b1('0x3c')]['filter']+'%'};return _0x3ae803;})});}_0x2adf85=_[_0x61b1('0x48')]({},_0x2adf85,_0x31cace[_0x61b1('0x49')]);return _0x43aa57['getDescriptions'](_0x2adf85);}})['then'](function(_0x387077){if(_0x387077){_0x15e167=_0x387077[_0x61b1('0x55')];if(!_0x31cace['query'][_0x61b1('0x42')](_0x61b1('0x43'))){_0x2adf85[_0x61b1('0x29')]=qs['limit'](_0x31cace[_0x61b1('0x3c')][_0x61b1('0x29')]);_0x2adf85[_0x61b1('0x28')]=qs[_0x61b1('0x28')](_0x31cace[_0x61b1('0x3c')][_0x61b1('0x28')]);}return _0x43aa57[_0x61b1('0x58')](_0x2adf85);}})[_0x61b1('0x30')](function(_0x540d22){if(_0x540d22){return _0x540d22?{'count':_0x15e167,'rows':_0x540d22}:null;}})[_0x61b1('0x30')](respondWithResult(_0x266683,null))[_0x61b1('0x23')](handleError(_0x266683,null));};exports[_0x61b1('0x59')]=function(_0x8886f8,_0x535120,_0x55ce24){var _0x426fef={};var _0x302c57={};var _0x1393b4;var _0x143125;return db[_0x61b1('0x36')][_0x61b1('0x53')]({'where':{'id':_0x8886f8[_0x61b1('0x51')]['id']}})[_0x61b1('0x30')](handleEntityNotFound(_0x535120,null))[_0x61b1('0x30')](function(_0x553696){if(_0x553696){_0x1393b4=_0x553696;_0x302c57[_0x61b1('0x3b')]=_[_0x61b1('0x3d')](db[_0x61b1('0x5a')]['rawAttributes']);_0x302c57['query']=_['keys'](_0x8886f8[_0x61b1('0x3c')]);_0x302c57['filters']=_[_0x61b1('0x3f')](_0x302c57[_0x61b1('0x3b')],_0x302c57[_0x61b1('0x3c')]);_0x426fef['attributes']=_['intersection'](_0x302c57[_0x61b1('0x3b')],qs['fields'](_0x8886f8['query'][_0x61b1('0x41')]));_0x426fef[_0x61b1('0x40')]=_0x426fef[_0x61b1('0x40')]['length']?_0x426fef[_0x61b1('0x40')]:_0x302c57[_0x61b1('0x3b')];_0x426fef[_0x61b1('0x44')]=qs[_0x61b1('0x45')](_0x8886f8[_0x61b1('0x3c')][_0x61b1('0x45')]);_0x426fef[_0x61b1('0x47')]=qs[_0x61b1('0x3e')](_[_0x61b1('0x46')](_0x8886f8[_0x61b1('0x3c')],_0x302c57[_0x61b1('0x3e')]));if(_0x8886f8[_0x61b1('0x3c')]['filter']){_0x426fef[_0x61b1('0x47')]=_[_0x61b1('0x48')](_0x426fef[_0x61b1('0x47')],{'$or':_[_0x61b1('0x35')](_0x426fef[_0x61b1('0x40')],function(_0x2b7d66){var _0xee3a1c={};_0xee3a1c[_0x2b7d66]={'$like':'%'+_0x8886f8[_0x61b1('0x3c')][_0x61b1('0x56')]+'%'};return _0xee3a1c;})});}_0x426fef=_['merge']({},_0x426fef,_0x8886f8['options']);return _0x1393b4['getTags'](_0x426fef);}})[_0x61b1('0x30')](function(_0x21f8f5){if(_0x21f8f5){_0x143125=_0x21f8f5[_0x61b1('0x55')];if(!_0x8886f8[_0x61b1('0x3c')]['hasOwnProperty']('nolimit')){_0x426fef['limit']=qs[_0x61b1('0x29')](_0x8886f8[_0x61b1('0x3c')][_0x61b1('0x29')]);_0x426fef[_0x61b1('0x28')]=qs[_0x61b1('0x28')](_0x8886f8[_0x61b1('0x3c')][_0x61b1('0x28')]);}return _0x1393b4[_0x61b1('0x59')](_0x426fef);}})[_0x61b1('0x30')](function(_0x44b809){if(_0x44b809){return _0x44b809?{'count':_0x143125,'rows':_0x44b809}:null;}})['then'](respondWithResult(_0x535120,null))[_0x61b1('0x23')](handleError(_0x535120,null));};exports['setTags']=function(_0x4e1d2b,_0x507d9f,_0x5553a4){if(_0x4e1d2b['body']['id']){delete _0x4e1d2b['body']['id'];}return db[_0x61b1('0x36')][_0x61b1('0x53')]({'where':{'id':_0x4e1d2b[_0x61b1('0x51')]['id']}})[_0x61b1('0x30')](handleEntityNotFound(_0x507d9f,null))[_0x61b1('0x30')](function(_0x749511){if(_0x749511){return _0x749511[_0x61b1('0x5b')](_0x4e1d2b[_0x61b1('0x50')]['ids']||[]);}return null;})[_0x61b1('0x30')](respondWithResult(_0x507d9f,null))[_0x61b1('0x23')](handleError(_0x507d9f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index a53a6db..56ceb8f 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 _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 +var _0xe748=['int_freshdesk_configurations','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe748,0xfe));var _0x8e74=function(_0x4a9b81,_0x618006){_0x4a9b81=_0x4a9b81-0x0;var _0x537749=_0xe748[_0x4a9b81];return _0x537749;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8e74('0x0'))(_0x8e74('0x1'));var moment=require(_0x8e74('0x2'));var BPromise=require(_0x8e74('0x3'));var rp=require(_0x8e74('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e74('0x5'));var config=require(_0x8e74('0x6'));var attributes=require(_0x8e74('0x7'));module[_0x8e74('0x8')]=function(_0xa60638,_0x380345){return _0xa60638[_0x8e74('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0x8e74('0xa'),'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 c28f893..07dd328 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 _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 +var _0x049a=['FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0x049a,0x179));var _0xa049=function(_0x9d14e3,_0x5a6072){_0x9d14e3=_0x9d14e3-0x0;var _0x19bf32=_0x049a[_0x9d14e3];return _0x19bf32;};'use strict';var _=require(_0xa049('0x0'));var util=require(_0xa049('0x1'));var moment=require('moment');var BPromise=require(_0xa049('0x2'));var rs=require(_0xa049('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa049('0x4'))['db'];var utils=require(_0xa049('0x5'));var logger=require(_0xa049('0x6'))(_0xa049('0x7'));var config=require(_0xa049('0x8'));var jayson=require(_0xa049('0x9'));var client=jayson['client'][_0xa049('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16245d,_0x543c8b,_0x3074fa){return new BPromise(function(_0x34a1d0,_0x165b91){return client[_0xa049('0xb')](_0x16245d,_0x3074fa)[_0xa049('0xc')](function(_0x2febe9){logger['info'](_0xa049('0xd'),_0x543c8b,'request\x20sent');logger['debug'](_0xa049('0xe'),_0x543c8b,_0xa049('0xf'),JSON[_0xa049('0x10')](_0x2febe9));if(_0x2febe9[_0xa049('0x11')]){if(_0x2febe9['error'][_0xa049('0x12')]===0x1f4){logger[_0xa049('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x543c8b,_0x2febe9[_0xa049('0x11')][_0xa049('0x13')]);return _0x165b91(_0x2febe9[_0xa049('0x11')]['message']);}logger['error'](_0xa049('0xd'),_0x543c8b,_0x2febe9[_0xa049('0x11')]['message']);return _0x34a1d0(_0x2febe9['error'][_0xa049('0x13')]);}else{logger[_0xa049('0x14')](_0xa049('0xd'),_0x543c8b,_0xa049('0xf'));_0x34a1d0(_0x2febe9[_0xa049('0x15')]['message']);}})[_0xa049('0x16')](function(_0x5348e9){logger['error'](_0xa049('0xd'),_0x543c8b,_0x5348e9);_0x165b91(_0x5348e9);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 10c6f00..546f216 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(_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 +var _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x3fa479,_0x222259){var _0x23feb5=function(_0x115e68){while(--_0x115e68){_0x3fa479['push'](_0x3fa479['shift']());}};_0x23feb5(++_0x222259);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 793f95c..25a6baa 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 _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 +var _0x3d5d=['exports','variable','customVariable','keyValue','STRING','ENUM','string','BOOLEAN','sequelize'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x3d5d,0x104));var _0xd3d5=function(_0x34b1b8,_0x54c9bf){_0x34b1b8=_0x34b1b8-0x0;var _0x542dd8=_0x3d5d[_0x34b1b8];return _0x542dd8;};'use strict';var Sequelize=require(_0xd3d5('0x0'));module[_0xd3d5('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xd3d5('0x2'),_0xd3d5('0x3'),_0xd3d5('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd3d5('0x5')]},'key':{'type':Sequelize[_0xd3d5('0x5')]},'keyType':{'type':Sequelize[_0xd3d5('0x6')](_0xd3d5('0x7'),'variable',_0xd3d5('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd3d5('0x5')]},'nameField':{'type':Sequelize[_0xd3d5('0x5')]},'customField':{'type':Sequelize[_0xd3d5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd3d5('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 587feb6..05d828e 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 _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 +var _0xc4b6=['keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','Content-Range','json','apply','reject','save','update','then','end','stack','name','map','FreshdeskField','rawAttributes','key','model','query'];(function(_0x2b59f7,_0x5cf2af){var _0x7ffe2e=function(_0x25434c){while(--_0x25434c){_0x2b59f7['push'](_0x2b59f7['shift']());}};_0x7ffe2e(++_0x5cf2af);}(_0xc4b6,0x1b8));var _0x6c4b=function(_0x2cb237,_0x393e4a){_0x2cb237=_0x2cb237-0x0;var _0x1ce9c9=_0xc4b6[_0x2cb237];return _0x1ce9c9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6c4b('0x0'));var rimraf=require(_0x6c4b('0x1'));var zipdir=require(_0x6c4b('0x2'));var jsonpatch=require(_0x6c4b('0x3'));var rp=require('request-promise');var moment=require(_0x6c4b('0x4'));var BPromise=require(_0x6c4b('0x5'));var Mustache=require(_0x6c4b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6c4b('0x7'));var csv=require(_0x6c4b('0x8'));var ejs=require(_0x6c4b('0x9'));var fs=require('fs');var _=require(_0x6c4b('0xa'));var squel=require(_0x6c4b('0xb'));var crypto=require(_0x6c4b('0xc'));var jsforce=require(_0x6c4b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6c4b('0x8'));var querystring=require(_0x6c4b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6c4b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6c4b('0x10'));var hardwareService=require(_0x6c4b('0x11'));var logger=require(_0x6c4b('0x12'))(_0x6c4b('0x13'));var utils=require(_0x6c4b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6c4b('0x15'));var db=require(_0x6c4b('0x16'))['db'];function respondWithStatusCode(_0x510419,_0x326113){_0x326113=_0x326113||0xcc;return function(_0x23559b){if(_0x23559b){return _0x510419[_0x6c4b('0x17')](_0x326113);}return _0x510419['status'](_0x326113)['end']();};}function respondWithResult(_0x56a684,_0x2142f3){_0x2142f3=_0x2142f3||0xc8;return function(_0x36797e){if(_0x36797e){return _0x56a684[_0x6c4b('0x18')](_0x2142f3)['json'](_0x36797e);}};}function respondWithFilteredResult(_0x4b9ecf,_0xa6fcf){return function(_0x1a10dc){if(_0x1a10dc){var _0x326583=_0x1a10dc[_0x6c4b('0x19')],_0x3f010e=_0xa6fcf[_0x6c4b('0x1a')],_0x58c1cb=_0xa6fcf['offset']+_0xa6fcf['limit'],_0x344db8;if(_0x58c1cb>=_0x326583){_0x58c1cb=_0x326583;_0x344db8=0xc8;}else{_0x344db8=0xce;}_0x4b9ecf['status'](_0x344db8);return _0x4b9ecf['set'](_0x6c4b('0x1b'),_0x3f010e+'-'+_0x58c1cb+'/'+_0x326583)[_0x6c4b('0x1c')](_0x1a10dc);}return null;};}function patchUpdates(_0x28ffbe){return function(_0x2af2b8){try{jsonpatch[_0x6c4b('0x1d')](_0x2af2b8,_0x28ffbe,!![]);}catch(_0x252448){return BPromise[_0x6c4b('0x1e')](_0x252448);}return _0x2af2b8[_0x6c4b('0x1f')]();};}function saveUpdates(_0x8c75c3,_0x538c44){return function(_0x317f1d){if(_0x317f1d){return _0x317f1d[_0x6c4b('0x20')](_0x8c75c3)[_0x6c4b('0x21')](function(_0x197f24){return _0x197f24;});}return null;};}function removeEntity(_0x396ef3,_0x4068af){return function(_0x42d4f2){if(_0x42d4f2){return _0x42d4f2['destroy']()[_0x6c4b('0x21')](function(){_0x396ef3['status'](0xcc)[_0x6c4b('0x22')]();});}};}function handleEntityNotFound(_0x536d5f,_0x1e3fd4){return function(_0x4d5297){if(!_0x4d5297){_0x536d5f[_0x6c4b('0x17')](0x194);}return _0x4d5297;};}function handleError(_0x432e3b,_0x46ab46){_0x46ab46=_0x46ab46||0x1f4;return function(_0x295c25){logger['error'](_0x295c25[_0x6c4b('0x23')]);if(_0x295c25[_0x6c4b('0x24')]){delete _0x295c25['name'];}_0x432e3b['status'](_0x46ab46)['send'](_0x295c25);};}exports['index']=function(_0x101885,_0x141f06){var _0x1dcf68={},_0x5d2ce5={},_0x5a2b36={'count':0x0,'rows':[]};var _0x43ad65=_[_0x6c4b('0x25')](db[_0x6c4b('0x26')][_0x6c4b('0x27')],function(_0x4f1394){return{'name':_0x4f1394['fieldName'],'type':_0x4f1394['type'][_0x6c4b('0x28')]};});_0x5d2ce5[_0x6c4b('0x29')]=_[_0x6c4b('0x25')](_0x43ad65,_0x6c4b('0x24'));_0x5d2ce5[_0x6c4b('0x2a')]=_[_0x6c4b('0x2b')](_0x101885[_0x6c4b('0x2a')]);_0x5d2ce5['filters']=_[_0x6c4b('0x2c')](_0x5d2ce5[_0x6c4b('0x29')],_0x5d2ce5[_0x6c4b('0x2a')]);_0x1dcf68[_0x6c4b('0x2d')]=_[_0x6c4b('0x2c')](_0x5d2ce5['model'],qs[_0x6c4b('0x2e')](_0x101885[_0x6c4b('0x2a')][_0x6c4b('0x2e')]));_0x1dcf68[_0x6c4b('0x2d')]=_0x1dcf68[_0x6c4b('0x2d')][_0x6c4b('0x2f')]?_0x1dcf68[_0x6c4b('0x2d')]:_0x5d2ce5['model'];if(!_0x101885[_0x6c4b('0x2a')][_0x6c4b('0x30')](_0x6c4b('0x31'))){_0x1dcf68[_0x6c4b('0x32')]=qs[_0x6c4b('0x32')](_0x101885[_0x6c4b('0x2a')][_0x6c4b('0x32')]);_0x1dcf68[_0x6c4b('0x1a')]=qs[_0x6c4b('0x1a')](_0x101885['query'][_0x6c4b('0x1a')]);}_0x1dcf68['order']=qs[_0x6c4b('0x33')](_0x101885['query'][_0x6c4b('0x33')]);_0x1dcf68['where']=qs[_0x6c4b('0x34')](_[_0x6c4b('0x35')](_0x101885[_0x6c4b('0x2a')],_0x5d2ce5[_0x6c4b('0x34')]),_0x43ad65);if(_0x101885[_0x6c4b('0x2a')][_0x6c4b('0x36')]){_0x1dcf68['where']=_[_0x6c4b('0x37')](_0x1dcf68[_0x6c4b('0x38')],{'$or':_[_0x6c4b('0x25')](_0x43ad65,function(_0x364a96){if(_0x364a96['type']!==_0x6c4b('0x39')){var _0x3acff4={};_0x3acff4[_0x364a96[_0x6c4b('0x24')]]={'$like':'%'+_0x101885['query'][_0x6c4b('0x36')]+'%'};return _0x3acff4;}})});}_0x1dcf68=_[_0x6c4b('0x37')]({},_0x1dcf68,_0x101885['options']);var _0x4b04c4={'where':_0x1dcf68[_0x6c4b('0x38')]};return db['FreshdeskField'][_0x6c4b('0x19')](_0x4b04c4)[_0x6c4b('0x21')](function(_0x2c56f0){_0x5a2b36['count']=_0x2c56f0;if(_0x101885['query'][_0x6c4b('0x3a')]){_0x1dcf68[_0x6c4b('0x3b')]=[{'all':!![]}];}return db['FreshdeskField'][_0x6c4b('0x3c')](_0x1dcf68);})[_0x6c4b('0x21')](function(_0x16c998){_0x5a2b36[_0x6c4b('0x3d')]=_0x16c998;return _0x5a2b36;})[_0x6c4b('0x21')](respondWithFilteredResult(_0x141f06,_0x1dcf68))[_0x6c4b('0x3e')](handleError(_0x141f06,null));};exports['show']=function(_0x1df574,_0x7be765){var _0x267535={'raw':!![],'where':{'id':_0x1df574[_0x6c4b('0x3f')]['id']}},_0x46c3ce={};_0x46c3ce[_0x6c4b('0x29')]=_[_0x6c4b('0x2b')](db['FreshdeskField']['rawAttributes']);_0x46c3ce[_0x6c4b('0x2a')]=_[_0x6c4b('0x2b')](_0x1df574[_0x6c4b('0x2a')]);_0x46c3ce['filters']=_[_0x6c4b('0x2c')](_0x46c3ce[_0x6c4b('0x29')],_0x46c3ce[_0x6c4b('0x2a')]);_0x267535[_0x6c4b('0x2d')]=_['intersection'](_0x46c3ce['model'],qs['fields'](_0x1df574[_0x6c4b('0x2a')]['fields']));_0x267535[_0x6c4b('0x2d')]=_0x267535[_0x6c4b('0x2d')][_0x6c4b('0x2f')]?_0x267535[_0x6c4b('0x2d')]:_0x46c3ce[_0x6c4b('0x29')];if(_0x1df574['query'][_0x6c4b('0x3a')]){_0x267535[_0x6c4b('0x3b')]=[{'all':!![]}];}_0x267535=_[_0x6c4b('0x37')]({},_0x267535,_0x1df574[_0x6c4b('0x40')]);return db[_0x6c4b('0x26')][_0x6c4b('0x41')](_0x267535)[_0x6c4b('0x21')](handleEntityNotFound(_0x7be765,null))[_0x6c4b('0x21')](respondWithResult(_0x7be765,null))[_0x6c4b('0x3e')](handleError(_0x7be765,null));};exports[_0x6c4b('0x42')]=function(_0xdaa595,_0x4ffcc4){return db[_0x6c4b('0x26')][_0x6c4b('0x42')](_0xdaa595[_0x6c4b('0x43')],{})[_0x6c4b('0x21')](respondWithResult(_0x4ffcc4,0xc9))[_0x6c4b('0x3e')](handleError(_0x4ffcc4,null));};exports[_0x6c4b('0x20')]=function(_0x462f64,_0x40829f){if(_0x462f64[_0x6c4b('0x43')]['id']){delete _0x462f64[_0x6c4b('0x43')]['id'];}return db['FreshdeskField'][_0x6c4b('0x41')]({'where':{'id':_0x462f64[_0x6c4b('0x3f')]['id']}})[_0x6c4b('0x21')](handleEntityNotFound(_0x40829f,null))[_0x6c4b('0x21')](saveUpdates(_0x462f64['body'],null))[_0x6c4b('0x21')](respondWithResult(_0x40829f,null))['catch'](handleError(_0x40829f,null));};exports[_0x6c4b('0x44')]=function(_0x58ac67,_0x1fec87){return db[_0x6c4b('0x26')][_0x6c4b('0x41')]({'where':{'id':_0x58ac67[_0x6c4b('0x3f')]['id']}})[_0x6c4b('0x21')](handleEntityNotFound(_0x1fec87,null))[_0x6c4b('0x21')](removeEntity(_0x1fec87,null))[_0x6c4b('0x3e')](handleError(_0x1fec87,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index dba01cf..cc33c9e 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 _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 +var _0x77a7=['util','../../config/logger','moment','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash'];(function(_0x2ac020,_0x17da44){var _0x246a7f=function(_0x7762d6){while(--_0x7762d6){_0x2ac020['push'](_0x2ac020['shift']());}};_0x246a7f(++_0x17da44);}(_0x77a7,0x178));var _0x777a=function(_0x175b9b,_0x17cd98){_0x175b9b=_0x175b9b-0x0;var _0x1dd19e=_0x77a7[_0x175b9b];return _0x1dd19e;};'use strict';var _=require(_0x777a('0x0'));var util=require(_0x777a('0x1'));var logger=require(_0x777a('0x2'))('api');var moment=require(_0x777a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x777a('0x4'));var config=require(_0x777a('0x5'));var attributes=require(_0x777a('0x6'));module[_0x777a('0x7')]=function(_0x1cd294,_0x556e6c){return _0x1cd294['define'](_0x777a('0x8'),attributes,{'tableName':_0x777a('0x9'),'paranoid':![],'indexes':[{'name':_0x777a('0xa'),'fields':[_0x777a('0xb'),_0x777a('0xc')],'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 3a19752..33f0d92 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 _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 +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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x4de9ee,_0x2dc819){_0x4de9ee=_0x4de9ee-0x0;var _0x1d9e59=_0x7a54[_0x4de9ee];return _0x1d9e59;};'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 86b00cb..28594b1 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 _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 +var _0xa687=['delete','destroy','multer','path','connect-timeout','Router','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update'];(function(_0x1c5eff,_0x217859){var _0x1a3ad2=function(_0x9c2f8a){while(--_0x9c2f8a){_0x1c5eff['push'](_0x1c5eff['shift']());}};_0x1a3ad2(++_0x217859);}(_0xa687,0x12e));var _0x7a68=function(_0x4936fb,_0x10fda9){_0x4936fb=_0x4936fb-0x0;var _0x4430ab=_0xa687[_0x4936fb];return _0x4430ab;};'use strict';var multer=require(_0x7a68('0x0'));var util=require('util');var path=require(_0x7a68('0x1'));var timeout=require(_0x7a68('0x2'));var express=require('express');var router=express[_0x7a68('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7a68('0x4'));var controller=require(_0x7a68('0x5'));router[_0x7a68('0x6')]('/',auth[_0x7a68('0x7')](),controller[_0x7a68('0x8')]);router[_0x7a68('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7a68('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x7a68('0x9')]);router['get'](_0x7a68('0xa'),auth[_0x7a68('0x7')](),controller[_0x7a68('0xb')]);router[_0x7a68('0xc')]('/',auth[_0x7a68('0x7')](),controller[_0x7a68('0xd')]);router[_0x7a68('0xc')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x7a68('0xe')]);router[_0x7a68('0xf')](_0x7a68('0x10'),auth[_0x7a68('0x7')](),controller[_0x7a68('0x11')]);router[_0x7a68('0x12')](_0x7a68('0x10'),auth[_0x7a68('0x7')](),controller[_0x7a68('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 2ec608a..8604f8e 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 _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 +var _0x647e=['STRING','username','remoteUri','sequelize'];(function(_0x410671,_0x4a5900){var _0x39fae2=function(_0x57f346){while(--_0x57f346){_0x410671['push'](_0x410671['shift']());}};_0x39fae2(++_0x4a5900);}(_0x647e,0x18b));var _0xe647=function(_0x5cf58f,_0xe83a7c){_0x5cf58f=_0x5cf58f-0x0;var _0x1c06ba=_0x647e[_0x5cf58f];return _0x1c06ba;};'use strict';var Sequelize=require(_0xe647('0x0'));module['exports']={'name':{'type':Sequelize[_0xe647('0x1')]},'description':{'type':Sequelize[_0xe647('0x1')]},'username':{'type':Sequelize[_0xe647('0x1')],'unique':_0xe647('0x2')},'apiKey':{'type':Sequelize[_0xe647('0x1')]},'remoteUri':{'type':Sequelize[_0xe647('0x1')],'unique':_0xe647('0x3')},'serverUrl':{'type':Sequelize[_0xe647('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index f9ab850..a6efb23 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 _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 +var _0x91a7=['Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','count','offset','limit','set','save','update','then','destroy','sendStatus','stack','name','send','map','FreshsalesAccount','rawAttributes','type','model','query','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','show','params','keys','length','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration'];(function(_0x1b6e8a,_0x2d4835){var _0x3d3ea4=function(_0x184840){while(--_0x184840){_0x1b6e8a['push'](_0x1b6e8a['shift']());}};_0x3d3ea4(++_0x2d4835);}(_0x91a7,0xe7));var _0x791a=function(_0x1356e9,_0x54bad7){_0x1356e9=_0x1356e9-0x0;var _0x52dfcc=_0x91a7[_0x1356e9];return _0x52dfcc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x791a('0x0'));var rimraf=require(_0x791a('0x1'));var zipdir=require(_0x791a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x791a('0x3'));var moment=require('moment');var BPromise=require(_0x791a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x791a('0x5'));var sox=require(_0x791a('0x6'));var csv=require('to-csv');var ejs=require(_0x791a('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0xb'));var querystring=require(_0x791a('0xc'));var Papa=require(_0x791a('0xd'));var Redis=require(_0x791a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xf'));var as=require(_0x791a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x11'))(_0x791a('0x12'));var utils=require(_0x791a('0x13'));var config=require(_0x791a('0x14'));var licenseUtil=require(_0x791a('0x15'));var db=require(_0x791a('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x791a('0x17')][_0x791a('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4c56f0,_0x346c44,_0x3a2ec6,_0x5d5b11){return new BPromise(function(_0x2887f0,_0x31b86d){var _0x2ef5c5=_0x5d5b11||client;return _0x2ef5c5[_0x791a('0x19')](_0x4c56f0,_0x3a2ec6)['then'](function(_0x2ce2e0){logger['info'](_0x791a('0x1a'),_0x346c44,_0x791a('0x1b'));logger['debug'](_0x791a('0x1c'),_0x346c44,'request\x20sent',JSON[_0x791a('0x1d')](_0x2ce2e0));if(_0x2ce2e0['error']){if(_0x2ce2e0['error']['code']===0x1f4){logger[_0x791a('0x1e')]('FreshsalesAccount,\x20%s,\x20%s',_0x346c44,_0x2ce2e0['error'][_0x791a('0x1f')]);return _0x31b86d(_0x2ce2e0[_0x791a('0x1e')][_0x791a('0x1f')]);}logger[_0x791a('0x1e')]('FreshsalesAccount,\x20%s,\x20%s',_0x346c44,_0x2ce2e0[_0x791a('0x1e')][_0x791a('0x1f')]);return _0x2887f0(_0x2ce2e0[_0x791a('0x1e')][_0x791a('0x1f')]);}else{logger['info'](_0x791a('0x1a'),_0x346c44,_0x791a('0x1b'));_0x2887f0(_0x2ce2e0[_0x791a('0x20')][_0x791a('0x1f')]);}})[_0x791a('0x21')](function(_0x1091af){logger[_0x791a('0x1e')](_0x791a('0x1a'),_0x346c44,_0x1091af);_0x31b86d(_0x1091af);});});}function respondWithStatusCode(_0x323c6a,_0xe8e452){_0xe8e452=_0xe8e452||0xcc;return function(_0x137992){if(_0x137992){return _0x323c6a['sendStatus'](_0xe8e452);}return _0x323c6a[_0x791a('0x22')](_0xe8e452)[_0x791a('0x23')]();};}function respondWithResult(_0x380329,_0x2966b8){_0x2966b8=_0x2966b8||0xc8;return function(_0x4d748a){if(_0x4d748a){return _0x380329[_0x791a('0x22')](_0x2966b8)[_0x791a('0x24')](_0x4d748a);}};}function respondWithFilteredResult(_0x51dcca,_0xdfa84f){return function(_0x1785f5){if(_0x1785f5){var _0x16dbaf=_0x1785f5[_0x791a('0x25')],_0x4c1626=_0xdfa84f[_0x791a('0x26')],_0x29194d=_0xdfa84f[_0x791a('0x26')]+_0xdfa84f[_0x791a('0x27')],_0x2b3327;if(_0x29194d>=_0x16dbaf){_0x29194d=_0x16dbaf;_0x2b3327=0xc8;}else{_0x2b3327=0xce;}_0x51dcca[_0x791a('0x22')](_0x2b3327);return _0x51dcca[_0x791a('0x28')]('Content-Range',_0x4c1626+'-'+_0x29194d+'/'+_0x16dbaf)[_0x791a('0x24')](_0x1785f5);}return null;};}function patchUpdates(_0x9e9332){return function(_0x1b10a7){try{jsonpatch['apply'](_0x1b10a7,_0x9e9332,!![]);}catch(_0x1cdda9){return BPromise['reject'](_0x1cdda9);}return _0x1b10a7[_0x791a('0x29')]();};}function saveUpdates(_0x2e4ec8,_0xcde862){return function(_0xe72e0c){if(_0xe72e0c){return _0xe72e0c[_0x791a('0x2a')](_0x2e4ec8)[_0x791a('0x2b')](function(_0x15ff6e){return _0x15ff6e;});}return null;};}function removeEntity(_0x4f5506,_0x3662c6){return function(_0x401069){if(_0x401069){return _0x401069[_0x791a('0x2c')]()[_0x791a('0x2b')](function(){_0x4f5506[_0x791a('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42d650,_0x8e7002){return function(_0x423a1e){if(!_0x423a1e){_0x42d650[_0x791a('0x2d')](0x194);}return _0x423a1e;};}function handleError(_0xb6e59b,_0x4ef825){_0x4ef825=_0x4ef825||0x1f4;return function(_0x305836){logger[_0x791a('0x1e')](_0x305836[_0x791a('0x2e')]);if(_0x305836[_0x791a('0x2f')]){delete _0x305836[_0x791a('0x2f')];}_0xb6e59b['status'](_0x4ef825)[_0x791a('0x30')](_0x305836);};}exports['index']=function(_0x1cf048,_0x4cd047){var _0x5edb88={},_0x425675={},_0x404530={'count':0x0,'rows':[]};var _0x75458d=_[_0x791a('0x31')](db[_0x791a('0x32')][_0x791a('0x33')],function(_0x29762d){return{'name':_0x29762d['fieldName'],'type':_0x29762d[_0x791a('0x34')]['key']};});_0x425675[_0x791a('0x35')]=_['map'](_0x75458d,_0x791a('0x2f'));_0x425675[_0x791a('0x36')]=_['keys'](_0x1cf048[_0x791a('0x36')]);_0x425675[_0x791a('0x37')]=_['intersection'](_0x425675[_0x791a('0x35')],_0x425675[_0x791a('0x36')]);_0x5edb88[_0x791a('0x38')]=_[_0x791a('0x39')](_0x425675[_0x791a('0x35')],qs[_0x791a('0x3a')](_0x1cf048[_0x791a('0x36')][_0x791a('0x3a')]));_0x5edb88[_0x791a('0x38')]=_0x5edb88[_0x791a('0x38')]['length']?_0x5edb88[_0x791a('0x38')]:_0x425675[_0x791a('0x35')];if(!_0x1cf048[_0x791a('0x36')]['hasOwnProperty'](_0x791a('0x3b'))){_0x5edb88['limit']=qs['limit'](_0x1cf048['query'][_0x791a('0x27')]);_0x5edb88[_0x791a('0x26')]=qs['offset'](_0x1cf048[_0x791a('0x36')][_0x791a('0x26')]);}_0x5edb88[_0x791a('0x3c')]=qs[_0x791a('0x3d')](_0x1cf048['query']['sort']);_0x5edb88['where']=qs[_0x791a('0x37')](_[_0x791a('0x3e')](_0x1cf048['query'],_0x425675[_0x791a('0x37')]),_0x75458d);if(_0x1cf048[_0x791a('0x36')][_0x791a('0x3f')]){_0x5edb88[_0x791a('0x40')]=_['merge'](_0x5edb88[_0x791a('0x40')],{'$or':_['map'](_0x75458d,function(_0x3682db){if(_0x3682db[_0x791a('0x34')]!==_0x791a('0x41')){var _0xfa245e={};_0xfa245e[_0x3682db[_0x791a('0x2f')]]={'$like':'%'+_0x1cf048['query'][_0x791a('0x3f')]+'%'};return _0xfa245e;}})});}_0x5edb88=_[_0x791a('0x42')]({},_0x5edb88,_0x1cf048[_0x791a('0x43')]);var _0x1a5cac={'where':_0x5edb88[_0x791a('0x40')]};return db['FreshsalesAccount'][_0x791a('0x25')](_0x1a5cac)[_0x791a('0x2b')](function(_0x4e379e){_0x404530['count']=_0x4e379e;if(_0x1cf048[_0x791a('0x36')][_0x791a('0x44')]){_0x5edb88[_0x791a('0x45')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x5edb88);})[_0x791a('0x2b')](function(_0x378cc2){_0x404530['rows']=_0x378cc2;return _0x404530;})[_0x791a('0x2b')](respondWithFilteredResult(_0x4cd047,_0x5edb88))[_0x791a('0x21')](handleError(_0x4cd047,null));};exports[_0x791a('0x46')]=function(_0x549980,_0x5a30a6){var _0x2446fb={'raw':![],'where':{'id':_0x549980[_0x791a('0x47')]['id']}},_0x17acda={};_0x17acda[_0x791a('0x35')]=_['keys'](db[_0x791a('0x32')][_0x791a('0x33')]);_0x17acda[_0x791a('0x36')]=_[_0x791a('0x48')](_0x549980['query']);_0x17acda[_0x791a('0x37')]=_[_0x791a('0x39')](_0x17acda[_0x791a('0x35')],_0x17acda[_0x791a('0x36')]);_0x2446fb[_0x791a('0x38')]=_[_0x791a('0x39')](_0x17acda[_0x791a('0x35')],qs['fields'](_0x549980[_0x791a('0x36')][_0x791a('0x3a')]));_0x2446fb['attributes']=_0x2446fb[_0x791a('0x38')][_0x791a('0x49')]?_0x2446fb['attributes']:_0x17acda[_0x791a('0x35')];if(_0x549980[_0x791a('0x36')][_0x791a('0x44')]){_0x2446fb[_0x791a('0x45')]=[{'all':!![]}];}_0x2446fb=_[_0x791a('0x42')]({},_0x2446fb,_0x549980['options']);return db['FreshsalesAccount']['find'](_0x2446fb)[_0x791a('0x2b')](handleEntityNotFound(_0x5a30a6,null))['then'](respondWithResult(_0x5a30a6,null))['catch'](handleError(_0x5a30a6,null));};exports[_0x791a('0x4a')]=function(_0x548a4b,_0x3e0b17){return db[_0x791a('0x32')]['create'](_0x548a4b['body'],{})[_0x791a('0x2b')](respondWithResult(_0x3e0b17,0xc9))['catch'](handleError(_0x3e0b17,null));};exports[_0x791a('0x2a')]=function(_0x4294fb,_0x383031){if(_0x4294fb['body']['id']){delete _0x4294fb[_0x791a('0x4b')]['id'];}return db[_0x791a('0x32')]['find']({'where':{'id':_0x4294fb[_0x791a('0x47')]['id']}})[_0x791a('0x2b')](handleEntityNotFound(_0x383031,null))[_0x791a('0x2b')](saveUpdates(_0x4294fb[_0x791a('0x4b')],null))[_0x791a('0x2b')](respondWithResult(_0x383031,null))[_0x791a('0x21')](handleError(_0x383031,null));};exports['destroy']=function(_0x4dfe1e,_0x35ccdf){return db['FreshsalesAccount'][_0x791a('0x4c')]({'where':{'id':_0x4dfe1e[_0x791a('0x47')]['id']}})[_0x791a('0x2b')](handleEntityNotFound(_0x35ccdf,null))[_0x791a('0x2b')](removeEntity(_0x35ccdf,null))[_0x791a('0x21')](handleError(_0x35ccdf,null));};exports[_0x791a('0x4d')]=function(_0x353170,_0x5a215d,_0x1ac6e1){var _0x4691d9={};var _0xc34c5b={};var _0x1a4376;var _0x2d671f;return db[_0x791a('0x32')][_0x791a('0x4e')]({'where':{'id':_0x353170['params']['id']}})[_0x791a('0x2b')](handleEntityNotFound(_0x5a215d,null))['then'](function(_0x4c4fc5){if(_0x4c4fc5){_0x1a4376=_0x4c4fc5;_0xc34c5b[_0x791a('0x35')]=_[_0x791a('0x48')](db[_0x791a('0x4f')][_0x791a('0x33')]);_0xc34c5b[_0x791a('0x36')]=_[_0x791a('0x48')](_0x353170[_0x791a('0x36')]);_0xc34c5b[_0x791a('0x37')]=_[_0x791a('0x39')](_0xc34c5b[_0x791a('0x35')],_0xc34c5b[_0x791a('0x36')]);_0x4691d9[_0x791a('0x38')]=_[_0x791a('0x39')](_0xc34c5b[_0x791a('0x35')],qs[_0x791a('0x3a')](_0x353170[_0x791a('0x36')][_0x791a('0x3a')]));_0x4691d9[_0x791a('0x38')]=_0x4691d9[_0x791a('0x38')][_0x791a('0x49')]?_0x4691d9['attributes']:_0xc34c5b[_0x791a('0x35')];_0x4691d9[_0x791a('0x3c')]=qs[_0x791a('0x3d')](_0x353170[_0x791a('0x36')][_0x791a('0x3d')]);_0x4691d9['where']=qs[_0x791a('0x37')](_[_0x791a('0x3e')](_0x353170[_0x791a('0x36')],_0xc34c5b[_0x791a('0x37')]));if(_0x353170['query'][_0x791a('0x3f')]){_0x4691d9['where']=_['merge'](_0x4691d9['where'],{'$or':_['map'](_0x4691d9[_0x791a('0x38')],function(_0x40207b){var _0x11c11f={};_0x11c11f[_0x40207b]={'$like':'%'+_0x353170[_0x791a('0x36')][_0x791a('0x3f')]+'%'};return _0x11c11f;})});}_0x4691d9=_[_0x791a('0x42')]({},_0x4691d9,_0x353170[_0x791a('0x43')]);return _0x1a4376['getConfigurations'](_0x4691d9);}})['then'](function(_0x3b22e2){if(_0x3b22e2){_0x2d671f=_0x3b22e2[_0x791a('0x49')];if(!_0x353170['query']['hasOwnProperty'](_0x791a('0x3b'))){_0x4691d9[_0x791a('0x27')]=qs['limit'](_0x353170[_0x791a('0x36')][_0x791a('0x27')]);_0x4691d9[_0x791a('0x26')]=qs[_0x791a('0x26')](_0x353170['query']['offset']);}return _0x1a4376[_0x791a('0x4d')](_0x4691d9);}})[_0x791a('0x2b')](function(_0x566f0a){if(_0x566f0a){return _0x566f0a?{'count':_0x2d671f,'rows':_0x566f0a}:null;}})[_0x791a('0x2b')](respondWithResult(_0x5a215d,null))[_0x791a('0x21')](handleError(_0x5a215d,null));};exports[_0x791a('0x50')]=function(_0x3838c4,_0x565c83,_0x24efc2){if(_0x3838c4[_0x791a('0x4b')]['id']){delete _0x3838c4[_0x791a('0x4b')]['id'];}return db[_0x791a('0x32')][_0x791a('0x4e')]({'where':{'id':_0x3838c4[_0x791a('0x47')]['id']}})[_0x791a('0x2b')](handleEntityNotFound(_0x565c83,null))[_0x791a('0x2b')](function(_0x5567d3){if(_0x5567d3){_0x3838c4['body']['AccountId']=_0x5567d3['id'];_0x3838c4[_0x791a('0x4b')][_0x791a('0x51')]=integrations[_0x791a('0x52')](_0x3838c4[_0x791a('0x4b')][_0x791a('0x53')],_0x3838c4[_0x791a('0x4b')][_0x791a('0x34')]);_0x3838c4[_0x791a('0x4b')][_0x791a('0x54')]=integrations[_0x791a('0x55')](_0x3838c4['body'][_0x791a('0x53')],_0x3838c4[_0x791a('0x4b')]['type']);return db[_0x791a('0x4f')][_0x791a('0x4a')](_0x3838c4['body'],{'include':[{'model':db['FreshsalesField'],'as':_0x791a('0x51')},{'model':db[_0x791a('0x56')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x565c83,null))[_0x791a('0x21')](handleError(_0x565c83,null));};exports[_0x791a('0x57')]=function(_0x46737e,_0x5da9b8,_0x1b23a1){var _0x4b27a7='';var _0x438b1d='';return db[_0x791a('0x32')][_0x791a('0x4e')]({'where':{'id':_0x46737e[_0x791a('0x47')]['id']},'attributes':['id',_0x791a('0x58'),_0x791a('0x59'),'apiKey']})[_0x791a('0x2b')](handleEntityNotFound(_0x5da9b8,null))[_0x791a('0x2b')](function(_0x41d1a5){if(_0x41d1a5){_0x438b1d=_0x41d1a5[_0x791a('0x58')];_0x4b27a7=_0x41d1a5[_0x791a('0x59')];var _0x3133fd=_0x41d1a5[_0x791a('0x59')][_0x791a('0x5a')](-0x1);if(_0x3133fd==='/'){_0x4b27a7=_0x4b27a7[_0x791a('0x5b')](0x0,_0x4b27a7[_0x791a('0x5c')](_0x3133fd));}return rp({'method':_0x791a('0x5d'),'uri':util[_0x791a('0x5e')](_0x791a('0x5f'),_0x4b27a7,_0x791a('0x60')),'headers':{'Authorization':_0x791a('0x61')+_0x41d1a5[_0x791a('0x62')]},'json':!![]});}})[_0x791a('0x2b')](function(_0x424970){if(_0x424970){var _0x5347e5=_0x424970[_0x791a('0x63')];var _0xbd35f8=![];var _0x3126f1=null;for(_0x3126f1=0x0;_0x3126f1<_0x5347e5[_0x791a('0x49')];_0x3126f1++){if(_0x5347e5[_0x3126f1][_0x791a('0x64')]===_0x438b1d){_0xbd35f8=!![];}}if(_0xbd35f8){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x791a('0x2b')](respondWithResult(_0x5da9b8,null))['catch'](function(_0x467d65){var _0x48b8dc=_0x46737e[_0x791a('0x36')][_0x791a('0x65')]?0x1f4:_0x467d65['statusCode']||0x1f4;logger[_0x791a('0x1e')](_0x791a('0x66'),_0x791a('0x57'),_0x48b8dc,JSON['stringify'](_0x467d65));delete _0x467d65[_0x791a('0x2f')];if(_0x48b8dc===0x191){_0x48b8dc=0x190;}_0x5da9b8['status'](_0x48b8dc)[_0x791a('0x30')](_0x46737e['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x467d65[_0x791a('0x67')]}:_0x467d65);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 0656b31..b438248 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 _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 +var _0xf898=['lodash','util','api','moment','bluebird','request-promise','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xf898,0x14d));var _0x8f89=function(_0x1ebe8e,_0x1b6fff){_0x1ebe8e=_0x1ebe8e-0x0;var _0xe5db43=_0xf898[_0x1ebe8e];return _0xe5db43;};'use strict';var _=require(_0x8f89('0x0'));var util=require(_0x8f89('0x1'));var logger=require('../../config/logger')(_0x8f89('0x2'));var moment=require(_0x8f89('0x3'));var BPromise=require(_0x8f89('0x4'));var rp=require(_0x8f89('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8f89('0x6'));var integrations=require(_0x8f89('0x7'));module[_0x8f89('0x8')]=function(_0x43f8ee,_0x473667){return _0x43f8ee['define']('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','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 2efb93e..159b3cf 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 _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 +var _0xc2c7=['FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','info','catch','find','ShowFreshsalesAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3e6261,_0x24a6c9){var _0x982ab=function(_0xd6021e){while(--_0xd6021e){_0x3e6261['push'](_0x3e6261['shift']());}};_0x982ab(++_0x24a6c9);}(_0xc2c7,0x134));var _0x7c2c=function(_0x238f14,_0x3f2744){_0x238f14=_0x238f14-0x0;var _0x3fda43=_0xc2c7[_0x238f14];return _0x3fda43;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});}exports[_0x7c2c('0x15')]=function(_0x14453f){var _0x2a9539=this;return new Promise(function(_0x17df4a,_0x26be0f){return db[_0x7c2c('0x16')][_0x7c2c('0x17')]({'raw':_0x14453f[_0x7c2c('0x18')]?_0x14453f[_0x7c2c('0x18')][_0x7c2c('0x19')]===undefined?!![]:![]:!![],'where':_0x14453f[_0x7c2c('0x18')]?_0x14453f['options'][_0x7c2c('0x1a')]||null:null,'attributes':_0x14453f['options']?_0x14453f['options'][_0x7c2c('0x1b')]||null:null,'limit':_0x14453f[_0x7c2c('0x18')]?_0x14453f[_0x7c2c('0x18')][_0x7c2c('0x1c')]||null:null,'include':_0x14453f[_0x7c2c('0x18')]?_0x14453f[_0x7c2c('0x18')][_0x7c2c('0x1d')]?_['map'](_0x14453f[_0x7c2c('0x18')]['include'],function(_0x302c93){return{'model':db[_0x302c93['model']],'as':_0x302c93['as'],'attributes':_0x302c93[_0x7c2c('0x1b')],'include':_0x302c93[_0x7c2c('0x1d')]?_[_0x7c2c('0x1e')](_0x302c93['include'],function(_0x4d6ec7){return{'model':db[_0x4d6ec7[_0x7c2c('0x1f')]],'as':_0x4d6ec7['as'],'attributes':_0x4d6ec7[_0x7c2c('0x1b')],'include':_0x4d6ec7[_0x7c2c('0x1d')]?_[_0x7c2c('0x1e')](_0x4d6ec7[_0x7c2c('0x1d')],function(_0xa8e145){return{'model':db[_0xa8e145[_0x7c2c('0x1f')]],'as':_0xa8e145['as'],'attributes':_0xa8e145['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c2c('0xc')](function(_0xf39941){logger[_0x7c2c('0x20')](_0x7c2c('0x15'),_0x14453f);logger[_0x7c2c('0xf')](_0x7c2c('0x15'),_0x14453f,JSON[_0x7c2c('0x11')](_0xf39941));_0x17df4a(_0xf39941);})[_0x7c2c('0x21')](function(_0xa040ff){logger['error'](_0x7c2c('0x15'),_0xa040ff[_0x7c2c('0x14')],_0x14453f);_0x26be0f(_0x2a9539[_0x7c2c('0x12')](0x1f4,_0xa040ff[_0x7c2c('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0xcb98ba){var _0x30dd1c=this;return new Promise(function(_0x4192c8,_0x1ef88b){return db[_0x7c2c('0x16')][_0x7c2c('0x22')]({'raw':_0xcb98ba[_0x7c2c('0x18')]?_0xcb98ba['options'][_0x7c2c('0x19')]===undefined?!![]:![]:!![],'where':_0xcb98ba[_0x7c2c('0x18')]?_0xcb98ba[_0x7c2c('0x18')][_0x7c2c('0x1a')]||null:null,'attributes':_0xcb98ba[_0x7c2c('0x18')]?_0xcb98ba['options']['attributes']||null:null,'include':_0xcb98ba[_0x7c2c('0x18')]?_0xcb98ba['options']['include']?_[_0x7c2c('0x1e')](_0xcb98ba[_0x7c2c('0x18')][_0x7c2c('0x1d')],function(_0x156c03){return{'model':db[_0x156c03['model']],'as':_0x156c03['as'],'attributes':_0x156c03[_0x7c2c('0x1b')],'include':_0x156c03[_0x7c2c('0x1d')]?_[_0x7c2c('0x1e')](_0x156c03[_0x7c2c('0x1d')],function(_0x204968){return{'model':db[_0x204968[_0x7c2c('0x1f')]],'as':_0x204968['as'],'attributes':_0x204968[_0x7c2c('0x1b')],'include':_0x204968[_0x7c2c('0x1d')]?_[_0x7c2c('0x1e')](_0x204968[_0x7c2c('0x1d')],function(_0x3230a1){return{'model':db[_0x3230a1[_0x7c2c('0x1f')]],'as':_0x3230a1['as'],'attributes':_0x3230a1[_0x7c2c('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54cbb7){logger[_0x7c2c('0x20')]('ShowFreshsalesAccount',_0xcb98ba);logger['debug']('ShowFreshsalesAccount',_0xcb98ba,JSON[_0x7c2c('0x11')](_0x54cbb7));_0x4192c8(_0x54cbb7);})[_0x7c2c('0x21')](function(_0x129bf0){logger[_0x7c2c('0x12')](_0x7c2c('0x23'),_0x129bf0[_0x7c2c('0x14')],_0xcb98ba);_0x1ef88b(_0x30dd1c[_0x7c2c('0x12')](0x1f4,_0x129bf0[_0x7c2c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index c3c7ee7..d4e7009 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 _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 +var _0xe1c5=['get','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','post','/:id','destroy','multer','util','path','connect-timeout','express','Router','./intFreshsalesConfiguration.controller','isAuthenticated','index','show'];(function(_0x5f0861,_0x42207e){var _0x1442dc=function(_0x565212){while(--_0x565212){_0x5f0861['push'](_0x5f0861['shift']());}};_0x1442dc(++_0x42207e);}(_0xe1c5,0x1e4));var _0x5e1c=function(_0x334b6f,_0x1feae7){_0x334b6f=_0x334b6f-0x0;var _0x3697b1=_0xe1c5[_0x334b6f];return _0x3697b1;};'use strict';var multer=require(_0x5e1c('0x0'));var util=require(_0x5e1c('0x1'));var path=require(_0x5e1c('0x2'));var timeout=require(_0x5e1c('0x3'));var express=require(_0x5e1c('0x4'));var router=express[_0x5e1c('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5e1c('0x6'));router['get']('/',auth[_0x5e1c('0x7')](),controller[_0x5e1c('0x8')]);router['get']('/:id',auth[_0x5e1c('0x7')](),controller[_0x5e1c('0x9')]);router[_0x5e1c('0xa')](_0x5e1c('0xb'),auth[_0x5e1c('0x7')](),controller[_0x5e1c('0xc')]);router[_0x5e1c('0xa')](_0x5e1c('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x5e1c('0xa')](_0x5e1c('0xe'),auth[_0x5e1c('0x7')](),controller[_0x5e1c('0xf')]);router[_0x5e1c('0x10')]('/',auth[_0x5e1c('0x7')](),controller['create']);router['put'](_0x5e1c('0x11'),auth[_0x5e1c('0x7')](),controller['update']);router['delete'](_0x5e1c('0x11'),auth[_0x5e1c('0x7')](),controller[_0x5e1c('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 7e11539..5c61de8 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 _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 +var _0x9687=['exports','STRING'];(function(_0x1f5b54,_0x52d371){var _0x3f3a56=function(_0x21ae98){while(--_0x21ae98){_0x1f5b54['push'](_0x1f5b54['shift']());}};_0x3f3a56(++_0x52d371);}(_0x9687,0x96));var _0x7968=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x9687[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module[_0x7968('0x0')]={'name':{'type':Sequelize[_0x7968('0x1')]},'description':{'type':Sequelize[_0x7968('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 188cad7..c737e8c 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 _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 +var _0x7fbe=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','VIRTUAL','filter','merge','options','include','findAll','params','includeAll','find','catch','update','body','getSubjects','findOne','FreshsalesField','pick','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','end','status','json','count','offset','set','Content-Range','apply','save','then','destroy','stack','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key'];(function(_0x75f2c4,_0x4c3e0a){var _0x31093a=function(_0x3176a9){while(--_0x3176a9){_0x75f2c4['push'](_0x75f2c4['shift']());}};_0x31093a(++_0x4c3e0a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x32f9cd,_0x4ffb36){_0x32f9cd=_0x32f9cd-0x0;var _0xe80ced=_0x7fbe[_0x32f9cd];return _0xe80ced;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe7fb('0x0'));var zipdir=require(_0xe7fb('0x1'));var jsonpatch=require(_0xe7fb('0x2'));var rp=require(_0xe7fb('0x3'));var moment=require(_0xe7fb('0x4'));var BPromise=require(_0xe7fb('0x5'));var Mustache=require(_0xe7fb('0x6'));var util=require(_0xe7fb('0x7'));var path=require(_0xe7fb('0x8'));var sox=require(_0xe7fb('0x9'));var csv=require(_0xe7fb('0xa'));var ejs=require(_0xe7fb('0xb'));var fs=require('fs');var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0xa'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];var jayson=require(_0xe7fb('0x1b'));var client=jayson[_0xe7fb('0x1c')][_0xe7fb('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x45fe75,_0x7fe4d3,_0x598729,_0x278b75){return new BPromise(function(_0x2225e5,_0x5573ab){var _0x30015a=_0x278b75||client;return _0x30015a[_0xe7fb('0x1e')](_0x45fe75,_0x598729)['then'](function(_0xa76acf){logger['info'](_0xe7fb('0x1f'),_0x7fe4d3,_0xe7fb('0x20'));logger[_0xe7fb('0x21')](_0xe7fb('0x22'),_0x7fe4d3,'request\x20sent',JSON[_0xe7fb('0x23')](_0xa76acf));if(_0xa76acf['error']){if(_0xa76acf[_0xe7fb('0x24')]['code']===0x1f4){logger[_0xe7fb('0x24')](_0xe7fb('0x1f'),_0x7fe4d3,_0xa76acf[_0xe7fb('0x24')][_0xe7fb('0x25')]);return _0x5573ab(_0xa76acf['error'][_0xe7fb('0x25')]);}logger['error'](_0xe7fb('0x1f'),_0x7fe4d3,_0xa76acf['error'][_0xe7fb('0x25')]);return _0x2225e5(_0xa76acf['error'][_0xe7fb('0x25')]);}else{logger[_0xe7fb('0x26')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x7fe4d3,_0xe7fb('0x20'));_0x2225e5(_0xa76acf[_0xe7fb('0x27')][_0xe7fb('0x25')]);}})['catch'](function(_0x469d50){logger[_0xe7fb('0x24')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x7fe4d3,_0x469d50);_0x5573ab(_0x469d50);});});}function respondWithStatusCode(_0x5bea27,_0x52f08b){_0x52f08b=_0x52f08b||0xcc;return function(_0x35e4db){if(_0x35e4db){return _0x5bea27['sendStatus'](_0x52f08b);}return _0x5bea27['status'](_0x52f08b)[_0xe7fb('0x28')]();};}function respondWithResult(_0x32e8b2,_0x2996ae){_0x2996ae=_0x2996ae||0xc8;return function(_0x4f6c73){if(_0x4f6c73){return _0x32e8b2[_0xe7fb('0x29')](_0x2996ae)[_0xe7fb('0x2a')](_0x4f6c73);}};}function respondWithFilteredResult(_0x390f32,_0x1ceed8){return function(_0x392d75){if(_0x392d75){var _0x16237a=_0x392d75[_0xe7fb('0x2b')],_0x380130=_0x1ceed8[_0xe7fb('0x2c')],_0x59e015=_0x1ceed8[_0xe7fb('0x2c')]+_0x1ceed8['limit'],_0x5df9f2;if(_0x59e015>=_0x16237a){_0x59e015=_0x16237a;_0x5df9f2=0xc8;}else{_0x5df9f2=0xce;}_0x390f32[_0xe7fb('0x29')](_0x5df9f2);return _0x390f32[_0xe7fb('0x2d')](_0xe7fb('0x2e'),_0x380130+'-'+_0x59e015+'/'+_0x16237a)[_0xe7fb('0x2a')](_0x392d75);}return null;};}function patchUpdates(_0x219554){return function(_0x1256d4){try{jsonpatch[_0xe7fb('0x2f')](_0x1256d4,_0x219554,!![]);}catch(_0x3dd0be){return BPromise['reject'](_0x3dd0be);}return _0x1256d4[_0xe7fb('0x30')]();};}function saveUpdates(_0x1742f3,_0x29d1ca){return function(_0x547a04){if(_0x547a04){return _0x547a04['update'](_0x1742f3)[_0xe7fb('0x31')](function(_0x4a9fea){return _0x4a9fea;});}return null;};}function removeEntity(_0xac56b4,_0x2f8774){return function(_0xe49053){if(_0xe49053){return _0xe49053[_0xe7fb('0x32')]()['then'](function(){_0xac56b4[_0xe7fb('0x29')](0xcc)[_0xe7fb('0x28')]();});}};}function handleEntityNotFound(_0x18ed83,_0x2f8818){return function(_0x2d650d){if(!_0x2d650d){_0x18ed83['sendStatus'](0x194);}return _0x2d650d;};}function handleError(_0x256694,_0x121d19){_0x121d19=_0x121d19||0x1f4;return function(_0x209eaa){logger[_0xe7fb('0x24')](_0x209eaa[_0xe7fb('0x33')]);if(_0x209eaa[_0xe7fb('0x34')]){delete _0x209eaa[_0xe7fb('0x34')];}_0x256694[_0xe7fb('0x29')](_0x121d19)[_0xe7fb('0x35')](_0x209eaa);};}exports['index']=function(_0x44d8cf,_0x29ef52){var _0x2593e3={},_0x56e17b={},_0x1de75a={'count':0x0,'rows':[]};var _0x3502dc=_[_0xe7fb('0x36')](db[_0xe7fb('0x37')][_0xe7fb('0x38')],function(_0x35b828){return{'name':_0x35b828[_0xe7fb('0x39')],'type':_0x35b828[_0xe7fb('0x3a')][_0xe7fb('0x3b')]};});_0x56e17b[_0xe7fb('0x3c')]=_[_0xe7fb('0x36')](_0x3502dc,_0xe7fb('0x34'));_0x56e17b[_0xe7fb('0x3d')]=_[_0xe7fb('0x3e')](_0x44d8cf[_0xe7fb('0x3d')]);_0x56e17b[_0xe7fb('0x3f')]=_[_0xe7fb('0x40')](_0x56e17b[_0xe7fb('0x3c')],_0x56e17b[_0xe7fb('0x3d')]);_0x2593e3['attributes']=_[_0xe7fb('0x40')](_0x56e17b[_0xe7fb('0x3c')],qs[_0xe7fb('0x41')](_0x44d8cf[_0xe7fb('0x3d')]['fields']));_0x2593e3[_0xe7fb('0x42')]=_0x2593e3[_0xe7fb('0x42')][_0xe7fb('0x43')]?_0x2593e3[_0xe7fb('0x42')]:_0x56e17b['model'];if(!_0x44d8cf[_0xe7fb('0x3d')][_0xe7fb('0x44')](_0xe7fb('0x45'))){_0x2593e3[_0xe7fb('0x46')]=qs[_0xe7fb('0x46')](_0x44d8cf[_0xe7fb('0x3d')]['limit']);_0x2593e3[_0xe7fb('0x2c')]=qs[_0xe7fb('0x2c')](_0x44d8cf[_0xe7fb('0x3d')]['offset']);}_0x2593e3[_0xe7fb('0x47')]=qs[_0xe7fb('0x48')](_0x44d8cf['query']['sort']);_0x2593e3['where']=qs['filters'](_['pick'](_0x44d8cf[_0xe7fb('0x3d')],_0x56e17b[_0xe7fb('0x3f')]),_0x3502dc);if(_0x44d8cf[_0xe7fb('0x3d')]['filter']){_0x2593e3[_0xe7fb('0x49')]=_['merge'](_0x2593e3[_0xe7fb('0x49')],{'$or':_[_0xe7fb('0x36')](_0x3502dc,function(_0x4d29d3){if(_0x4d29d3[_0xe7fb('0x3a')]!==_0xe7fb('0x4a')){var _0x240efa={};_0x240efa[_0x4d29d3[_0xe7fb('0x34')]]={'$like':'%'+_0x44d8cf['query'][_0xe7fb('0x4b')]+'%'};return _0x240efa;}})});}_0x2593e3=_[_0xe7fb('0x4c')]({},_0x2593e3,_0x44d8cf[_0xe7fb('0x4d')]);var _0x56a84f={'where':_0x2593e3[_0xe7fb('0x49')]};return db[_0xe7fb('0x37')][_0xe7fb('0x2b')](_0x56a84f)[_0xe7fb('0x31')](function(_0xc07c40){_0x1de75a['count']=_0xc07c40;if(_0x44d8cf[_0xe7fb('0x3d')]['includeAll']){_0x2593e3[_0xe7fb('0x4e')]=[{'all':!![]}];}return db[_0xe7fb('0x37')][_0xe7fb('0x4f')](_0x2593e3);})[_0xe7fb('0x31')](function(_0x15cec3){_0x1de75a['rows']=_0x15cec3;return _0x1de75a;})[_0xe7fb('0x31')](respondWithFilteredResult(_0x29ef52,_0x2593e3))['catch'](handleError(_0x29ef52,null));};exports['show']=function(_0x12c828,_0x3d740f){var _0x16327f={'raw':![],'where':{'id':_0x12c828[_0xe7fb('0x50')]['id']}},_0x589555={};_0x589555[_0xe7fb('0x3c')]=_['keys'](db['FreshsalesConfiguration'][_0xe7fb('0x38')]);_0x589555[_0xe7fb('0x3d')]=_[_0xe7fb('0x3e')](_0x12c828[_0xe7fb('0x3d')]);_0x589555[_0xe7fb('0x3f')]=_[_0xe7fb('0x40')](_0x589555[_0xe7fb('0x3c')],_0x589555[_0xe7fb('0x3d')]);_0x16327f['attributes']=_[_0xe7fb('0x40')](_0x589555['model'],qs[_0xe7fb('0x41')](_0x12c828[_0xe7fb('0x3d')]['fields']));_0x16327f[_0xe7fb('0x42')]=_0x16327f['attributes'][_0xe7fb('0x43')]?_0x16327f['attributes']:_0x589555[_0xe7fb('0x3c')];if(_0x12c828['query'][_0xe7fb('0x51')]){_0x16327f['include']=[{'all':!![]}];}_0x16327f=_[_0xe7fb('0x4c')]({},_0x16327f,_0x12c828[_0xe7fb('0x4d')]);return db[_0xe7fb('0x37')][_0xe7fb('0x52')](_0x16327f)[_0xe7fb('0x31')](handleEntityNotFound(_0x3d740f,null))[_0xe7fb('0x31')](respondWithResult(_0x3d740f,null))[_0xe7fb('0x53')](handleError(_0x3d740f,null));};exports['create']=function(_0x5d20dc,_0x20aa55){return db['FreshsalesConfiguration']['create'](_0x5d20dc['body'],{})['then'](respondWithResult(_0x20aa55,0xc9))['catch'](handleError(_0x20aa55,null));};exports[_0xe7fb('0x54')]=function(_0x34dd69,_0xd2fd76){if(_0x34dd69[_0xe7fb('0x55')]['id']){delete _0x34dd69['body']['id'];}return db[_0xe7fb('0x37')][_0xe7fb('0x52')]({'where':{'id':_0x34dd69[_0xe7fb('0x50')]['id']}})['then'](handleEntityNotFound(_0xd2fd76,null))['then'](saveUpdates(_0x34dd69[_0xe7fb('0x55')],null))[_0xe7fb('0x31')](respondWithResult(_0xd2fd76,null))[_0xe7fb('0x53')](handleError(_0xd2fd76,null));};exports['destroy']=function(_0x27f860,_0x3d946b){return db[_0xe7fb('0x37')][_0xe7fb('0x52')]({'where':{'id':_0x27f860['params']['id']}})['then'](handleEntityNotFound(_0x3d946b,null))[_0xe7fb('0x31')](removeEntity(_0x3d946b,null))[_0xe7fb('0x53')](handleError(_0x3d946b,null));};exports[_0xe7fb('0x56')]=function(_0x2f61b1,_0x3b0147,_0x5dd7c8){var _0x9c45a={};var _0x349a2a={};var _0x23755b;var _0x590d7a;return db['FreshsalesConfiguration'][_0xe7fb('0x57')]({'where':{'id':_0x2f61b1[_0xe7fb('0x50')]['id']}})[_0xe7fb('0x31')](handleEntityNotFound(_0x3b0147,null))[_0xe7fb('0x31')](function(_0x40f546){if(_0x40f546){_0x23755b=_0x40f546;_0x349a2a[_0xe7fb('0x3c')]=_['keys'](db[_0xe7fb('0x58')][_0xe7fb('0x38')]);_0x349a2a[_0xe7fb('0x3d')]=_[_0xe7fb('0x3e')](_0x2f61b1[_0xe7fb('0x3d')]);_0x349a2a[_0xe7fb('0x3f')]=_['intersection'](_0x349a2a[_0xe7fb('0x3c')],_0x349a2a['query']);_0x9c45a[_0xe7fb('0x42')]=_[_0xe7fb('0x40')](_0x349a2a[_0xe7fb('0x3c')],qs[_0xe7fb('0x41')](_0x2f61b1['query']['fields']));_0x9c45a[_0xe7fb('0x42')]=_0x9c45a[_0xe7fb('0x42')][_0xe7fb('0x43')]?_0x9c45a[_0xe7fb('0x42')]:_0x349a2a[_0xe7fb('0x3c')];_0x9c45a['order']=qs[_0xe7fb('0x48')](_0x2f61b1['query'][_0xe7fb('0x48')]);_0x9c45a['where']=qs['filters'](_[_0xe7fb('0x59')](_0x2f61b1[_0xe7fb('0x3d')],_0x349a2a[_0xe7fb('0x3f')]));if(_0x2f61b1['query'][_0xe7fb('0x4b')]){_0x9c45a[_0xe7fb('0x49')]=_[_0xe7fb('0x4c')](_0x9c45a[_0xe7fb('0x49')],{'$or':_[_0xe7fb('0x36')](_0x9c45a['attributes'],function(_0x404498){var _0x3c153a={};_0x3c153a[_0x404498]={'$like':'%'+_0x2f61b1['query'][_0xe7fb('0x4b')]+'%'};return _0x3c153a;})});}_0x9c45a=_[_0xe7fb('0x4c')]({},_0x9c45a,_0x2f61b1['options']);return _0x23755b[_0xe7fb('0x56')](_0x9c45a);}})['then'](function(_0x2705ef){if(_0x2705ef){_0x590d7a=_0x2705ef[_0xe7fb('0x43')];if(!_0x2f61b1[_0xe7fb('0x3d')]['hasOwnProperty'](_0xe7fb('0x45'))){_0x9c45a[_0xe7fb('0x46')]=qs[_0xe7fb('0x46')](_0x2f61b1[_0xe7fb('0x3d')][_0xe7fb('0x46')]);_0x9c45a[_0xe7fb('0x2c')]=qs[_0xe7fb('0x2c')](_0x2f61b1[_0xe7fb('0x3d')]['offset']);}return _0x23755b['getSubjects'](_0x9c45a);}})[_0xe7fb('0x31')](function(_0x3a674e){if(_0x3a674e){return _0x3a674e?{'count':_0x590d7a,'rows':_0x3a674e}:null;}})[_0xe7fb('0x31')](respondWithResult(_0x3b0147,null))['catch'](handleError(_0x3b0147,null));};exports['getDescriptions']=function(_0x1ac1fd,_0x2b071c,_0xad7c53){var _0x1df857={};var _0x2d558c={};var _0x336fd3;var _0x188e57;return db[_0xe7fb('0x37')][_0xe7fb('0x57')]({'where':{'id':_0x1ac1fd[_0xe7fb('0x50')]['id']}})[_0xe7fb('0x31')](handleEntityNotFound(_0x2b071c,null))[_0xe7fb('0x31')](function(_0x12b91f){if(_0x12b91f){_0x336fd3=_0x12b91f;_0x2d558c['model']=_['keys'](db[_0xe7fb('0x58')][_0xe7fb('0x38')]);_0x2d558c[_0xe7fb('0x3d')]=_[_0xe7fb('0x3e')](_0x1ac1fd[_0xe7fb('0x3d')]);_0x2d558c['filters']=_[_0xe7fb('0x40')](_0x2d558c[_0xe7fb('0x3c')],_0x2d558c[_0xe7fb('0x3d')]);_0x1df857[_0xe7fb('0x42')]=_[_0xe7fb('0x40')](_0x2d558c[_0xe7fb('0x3c')],qs[_0xe7fb('0x41')](_0x1ac1fd[_0xe7fb('0x3d')][_0xe7fb('0x41')]));_0x1df857['attributes']=_0x1df857[_0xe7fb('0x42')]['length']?_0x1df857[_0xe7fb('0x42')]:_0x2d558c[_0xe7fb('0x3c')];_0x1df857[_0xe7fb('0x47')]=qs[_0xe7fb('0x48')](_0x1ac1fd[_0xe7fb('0x3d')]['sort']);_0x1df857[_0xe7fb('0x49')]=qs[_0xe7fb('0x3f')](_[_0xe7fb('0x59')](_0x1ac1fd[_0xe7fb('0x3d')],_0x2d558c[_0xe7fb('0x3f')]));if(_0x1ac1fd[_0xe7fb('0x3d')][_0xe7fb('0x4b')]){_0x1df857[_0xe7fb('0x49')]=_[_0xe7fb('0x4c')](_0x1df857[_0xe7fb('0x49')],{'$or':_[_0xe7fb('0x36')](_0x1df857[_0xe7fb('0x42')],function(_0x3a68c0){var _0x300a7c={};_0x300a7c[_0x3a68c0]={'$like':'%'+_0x1ac1fd['query']['filter']+'%'};return _0x300a7c;})});}_0x1df857=_['merge']({},_0x1df857,_0x1ac1fd[_0xe7fb('0x4d')]);return _0x336fd3[_0xe7fb('0x5a')](_0x1df857);}})[_0xe7fb('0x31')](function(_0x2789f0){if(_0x2789f0){_0x188e57=_0x2789f0['length'];if(!_0x1ac1fd[_0xe7fb('0x3d')][_0xe7fb('0x44')](_0xe7fb('0x45'))){_0x1df857[_0xe7fb('0x46')]=qs['limit'](_0x1ac1fd[_0xe7fb('0x3d')]['limit']);_0x1df857[_0xe7fb('0x2c')]=qs[_0xe7fb('0x2c')](_0x1ac1fd[_0xe7fb('0x3d')][_0xe7fb('0x2c')]);}return _0x336fd3[_0xe7fb('0x5a')](_0x1df857);}})['then'](function(_0x3ffd6c){if(_0x3ffd6c){return _0x3ffd6c?{'count':_0x188e57,'rows':_0x3ffd6c}:null;}})['then'](respondWithResult(_0x2b071c,null))[_0xe7fb('0x53')](handleError(_0x2b071c,null));};exports['getFields']=function(_0x2aeeed,_0x38f52c,_0x4c37cd){var _0x2b6d69={};var _0x31642f={};var _0xb19e94;var _0x4181fd;return db['FreshsalesConfiguration'][_0xe7fb('0x57')]({'where':{'id':_0x2aeeed[_0xe7fb('0x50')]['id']}})[_0xe7fb('0x31')](handleEntityNotFound(_0x38f52c,null))['then'](function(_0x11d5b6){if(_0x11d5b6){_0xb19e94=_0x11d5b6;_0x31642f['model']=_['keys'](db['FreshsalesField'][_0xe7fb('0x38')]);_0x31642f[_0xe7fb('0x3d')]=_['keys'](_0x2aeeed[_0xe7fb('0x3d')]);_0x31642f[_0xe7fb('0x3f')]=_[_0xe7fb('0x40')](_0x31642f[_0xe7fb('0x3c')],_0x31642f[_0xe7fb('0x3d')]);_0x2b6d69[_0xe7fb('0x42')]=_[_0xe7fb('0x40')](_0x31642f[_0xe7fb('0x3c')],qs[_0xe7fb('0x41')](_0x2aeeed[_0xe7fb('0x3d')][_0xe7fb('0x41')]));_0x2b6d69[_0xe7fb('0x42')]=_0x2b6d69[_0xe7fb('0x42')][_0xe7fb('0x43')]?_0x2b6d69[_0xe7fb('0x42')]:_0x31642f[_0xe7fb('0x3c')];_0x2b6d69[_0xe7fb('0x47')]=qs[_0xe7fb('0x48')](_0x2aeeed[_0xe7fb('0x3d')][_0xe7fb('0x48')]);_0x2b6d69['where']=qs[_0xe7fb('0x3f')](_[_0xe7fb('0x59')](_0x2aeeed[_0xe7fb('0x3d')],_0x31642f[_0xe7fb('0x3f')]));if(_0x2aeeed[_0xe7fb('0x3d')][_0xe7fb('0x4b')]){_0x2b6d69[_0xe7fb('0x49')]=_['merge'](_0x2b6d69['where'],{'$or':_[_0xe7fb('0x36')](_0x2b6d69['attributes'],function(_0x2f486){var _0x496205={};_0x496205[_0x2f486]={'$like':'%'+_0x2aeeed['query'][_0xe7fb('0x4b')]+'%'};return _0x496205;})});}_0x2b6d69=_[_0xe7fb('0x4c')]({},_0x2b6d69,_0x2aeeed[_0xe7fb('0x4d')]);return _0xb19e94[_0xe7fb('0x5b')](_0x2b6d69);}})[_0xe7fb('0x31')](function(_0x38cc9e){if(_0x38cc9e){_0x4181fd=_0x38cc9e['length'];if(!_0x2aeeed[_0xe7fb('0x3d')][_0xe7fb('0x44')](_0xe7fb('0x45'))){_0x2b6d69[_0xe7fb('0x46')]=qs[_0xe7fb('0x46')](_0x2aeeed[_0xe7fb('0x3d')]['limit']);_0x2b6d69['offset']=qs['offset'](_0x2aeeed[_0xe7fb('0x3d')][_0xe7fb('0x2c')]);}return _0xb19e94[_0xe7fb('0x5b')](_0x2b6d69);}})['then'](function(_0xfa895b){if(_0xfa895b){return _0xfa895b?{'count':_0x4181fd,'rows':_0xfa895b}:null;}})['then'](respondWithResult(_0x38f52c,null))[_0xe7fb('0x53')](handleError(_0x38f52c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 7625419..dad5662 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 _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 +var _0xd2ce=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesConfiguration','util','api','moment'];(function(_0xbe723e,_0x5f30d4){var _0x5855b3=function(_0xc011a8){while(--_0xc011a8){_0xbe723e['push'](_0xbe723e['shift']());}};_0x5855b3(++_0x5f30d4);}(_0xd2ce,0x13c));var _0xed2c=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xd2ce[_0x173d7e];return _0x2220d6;};'use strict';var _=require('lodash');var util=require(_0xed2c('0x0'));var logger=require('../../config/logger')(_0xed2c('0x1'));var moment=require(_0xed2c('0x2'));var BPromise=require(_0xed2c('0x3'));var rp=require(_0xed2c('0x4'));var fs=require('fs');var path=require(_0xed2c('0x5'));var rimraf=require(_0xed2c('0x6'));var config=require(_0xed2c('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xed2c('0x8')]=function(_0x5b6ccb,_0x38aa25){return _0x5b6ccb[_0xed2c('0x9')](_0xed2c('0xa'),attributes,{'tableName':'int_freshsales_configurations','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 9581ba5..6e0d798 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 _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 +var _0xe486=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','FreshsalesConfiguration,\x20%s,\x20%s','message','result'];(function(_0x5b319a,_0x3f6f34){var _0x395b01=function(_0x36aca4){while(--_0x36aca4){_0x5b319a['push'](_0x5b319a['shift']());}};_0x395b01(++_0x3f6f34);}(_0xe486,0x6a));var _0x6e48=function(_0x4858d6,_0x383e09){_0x4858d6=_0x4858d6-0x0;var _0x170bbe=_0xe486[_0x4858d6];return _0x170bbe;};'use strict';var _=require(_0x6e48('0x0'));var util=require(_0x6e48('0x1'));var moment=require(_0x6e48('0x2'));var BPromise=require(_0x6e48('0x3'));var rs=require(_0x6e48('0x4'));var fs=require('fs');var Redis=require(_0x6e48('0x5'));var db=require(_0x6e48('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6e48('0x7'));var config=require(_0x6e48('0x8'));var jayson=require(_0x6e48('0x9'));var client=jayson[_0x6e48('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ea941,_0x2dc190,_0x23d274){return new BPromise(function(_0x1aaa9e,_0x3d392e){return client['request'](_0x1ea941,_0x23d274)[_0x6e48('0xb')](function(_0x5d1b90){logger[_0x6e48('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2dc190,_0x6e48('0xd'));logger[_0x6e48('0xe')](_0x6e48('0xf'),_0x2dc190,_0x6e48('0xd'),JSON['stringify'](_0x5d1b90));if(_0x5d1b90[_0x6e48('0x10')]){if(_0x5d1b90['error']['code']===0x1f4){logger[_0x6e48('0x10')](_0x6e48('0x11'),_0x2dc190,_0x5d1b90[_0x6e48('0x10')][_0x6e48('0x12')]);return _0x3d392e(_0x5d1b90['error'][_0x6e48('0x12')]);}logger[_0x6e48('0x10')](_0x6e48('0x11'),_0x2dc190,_0x5d1b90[_0x6e48('0x10')][_0x6e48('0x12')]);return _0x1aaa9e(_0x5d1b90[_0x6e48('0x10')][_0x6e48('0x12')]);}else{logger[_0x6e48('0xc')](_0x6e48('0x11'),_0x2dc190,'request\x20sent');_0x1aaa9e(_0x5d1b90[_0x6e48('0x13')][_0x6e48('0x12')]);}})[_0x6e48('0x14')](function(_0x2ca234){logger['error'](_0x6e48('0x11'),_0x2dc190,_0x2ca234);_0x3d392e(_0x2ca234);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 9a057b7..f7e1275 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 _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 +var _0x6be0=['express','Router','../../components/auth/service','get','isAuthenticated','index','show','post','/:id','delete','destroy','util','path','connect-timeout'];(function(_0x451bf8,_0x364f73){var _0x53cec7=function(_0x32f3c0){while(--_0x32f3c0){_0x451bf8['push'](_0x451bf8['shift']());}};_0x53cec7(++_0x364f73);}(_0x6be0,0x1a1));var _0x06be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6be0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x06be('0x0'));var path=require(_0x06be('0x1'));var timeout=require(_0x06be('0x2'));var express=require(_0x06be('0x3'));var router=express[_0x06be('0x4')]();var auth=require(_0x06be('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router[_0x06be('0x6')]('/',auth[_0x06be('0x7')](),controller[_0x06be('0x8')]);router[_0x06be('0x6')]('/:id',auth[_0x06be('0x7')](),controller[_0x06be('0x9')]);router[_0x06be('0xa')]('/',auth[_0x06be('0x7')](),controller['create']);router['put'](_0x06be('0xb'),auth[_0x06be('0x7')](),controller['update']);router[_0x06be('0xc')]('/:id',auth[_0x06be('0x7')](),controller[_0x06be('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index fbfb803..336650b 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 _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 +var _0xac72=['keyValue','string','STRING','sequelize','exports','ENUM','variable','customVariable'];(function(_0x54c1fc,_0x441377){var _0x5bb64d=function(_0x1e3b35){while(--_0x1e3b35){_0x54c1fc['push'](_0x54c1fc['shift']());}};_0x5bb64d(++_0x441377);}(_0xac72,0x1eb));var _0x2ac7=function(_0xdbbaa3,_0x42bb79){_0xdbbaa3=_0xdbbaa3-0x0;var _0x37beee=_0xac72[_0xdbbaa3];return _0x37beee;};'use strict';var Sequelize=require(_0x2ac7('0x0'));module[_0x2ac7('0x1')]={'type':{'type':Sequelize[_0x2ac7('0x2')]('string',_0x2ac7('0x3'),_0x2ac7('0x4'),_0x2ac7('0x5')),'defaultValue':_0x2ac7('0x6')},'content':{'type':Sequelize[_0x2ac7('0x7')]},'key':{'type':Sequelize[_0x2ac7('0x7')]},'keyType':{'type':Sequelize[_0x2ac7('0x2')](_0x2ac7('0x6'),_0x2ac7('0x3'),_0x2ac7('0x4'))},'keyContent':{'type':Sequelize[_0x2ac7('0x7')]},'idField':{'type':Sequelize[_0x2ac7('0x7')]},'nameField':{'type':Sequelize[_0x2ac7('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2ac7('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 82baf6b..918e0ea 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 _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 +var _0x3672=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','limit','set','Content-Range','then','sendStatus','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','offset','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','catch','show','params','find','create','body','update','destroy','html-pdf','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x474ced,_0x522193){var _0x59c3eb=function(_0x1327e5){while(--_0x1327e5){_0x474ced['push'](_0x474ced['shift']());}};_0x59c3eb(++_0x522193);}(_0x3672,0x13c));var _0x2367=function(_0x54c9dd,_0x233a86){_0x54c9dd=_0x54c9dd-0x0;var _0x855156=_0x3672[_0x54c9dd];return _0x855156;};'use strict';var pdf=require(_0x2367('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2367('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2367('0x2'));var moment=require(_0x2367('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2367('0x4'));var util=require('util');var path=require(_0x2367('0x5'));var sox=require(_0x2367('0x6'));var csv=require(_0x2367('0x7'));var ejs=require(_0x2367('0x8'));var fs=require('fs');var _=require(_0x2367('0x9'));var squel=require('squel');var crypto=require(_0x2367('0xa'));var jsforce=require(_0x2367('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2367('0xc'));var Papa=require(_0x2367('0xd'));var Redis=require('ioredis');var authService=require(_0x2367('0xe'));var qs=require(_0x2367('0xf'));var as=require(_0x2367('0x10'));var hardwareService=require(_0x2367('0x11'));var logger=require(_0x2367('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x2367('0x13'));var licenseUtil=require(_0x2367('0x14'));var db=require(_0x2367('0x15'))['db'];function respondWithStatusCode(_0xbdc08b,_0x370629){_0x370629=_0x370629||0xcc;return function(_0x5f1a1b){if(_0x5f1a1b){return _0xbdc08b['sendStatus'](_0x370629);}return _0xbdc08b[_0x2367('0x16')](_0x370629)[_0x2367('0x17')]();};}function respondWithResult(_0x43a2f9,_0x107932){_0x107932=_0x107932||0xc8;return function(_0x1e4baa){if(_0x1e4baa){return _0x43a2f9[_0x2367('0x16')](_0x107932)[_0x2367('0x18')](_0x1e4baa);}};}function respondWithFilteredResult(_0x13807c,_0x3a1e78){return function(_0x33d842){if(_0x33d842){var _0x2ed61b=_0x33d842[_0x2367('0x19')],_0x3dd9ab=_0x3a1e78['offset'],_0x165f91=_0x3a1e78['offset']+_0x3a1e78[_0x2367('0x1a')],_0x1f1608;if(_0x165f91>=_0x2ed61b){_0x165f91=_0x2ed61b;_0x1f1608=0xc8;}else{_0x1f1608=0xce;}_0x13807c[_0x2367('0x16')](_0x1f1608);return _0x13807c[_0x2367('0x1b')](_0x2367('0x1c'),_0x3dd9ab+'-'+_0x165f91+'/'+_0x2ed61b)[_0x2367('0x18')](_0x33d842);}return null;};}function patchUpdates(_0x49d502){return function(_0x56a1f5){try{jsonpatch['apply'](_0x56a1f5,_0x49d502,!![]);}catch(_0x499608){return BPromise['reject'](_0x499608);}return _0x56a1f5['save']();};}function saveUpdates(_0x2421e8,_0xc2c2dd){return function(_0x4aa4ac){if(_0x4aa4ac){return _0x4aa4ac['update'](_0x2421e8)[_0x2367('0x1d')](function(_0x5c2337){return _0x5c2337;});}return null;};}function removeEntity(_0x32963e,_0x2075a1){return function(_0x26a12b){if(_0x26a12b){return _0x26a12b['destroy']()[_0x2367('0x1d')](function(){_0x32963e[_0x2367('0x16')](0xcc)[_0x2367('0x17')]();});}};}function handleEntityNotFound(_0x276c79,_0x1815ad){return function(_0x6c6e57){if(!_0x6c6e57){_0x276c79[_0x2367('0x1e')](0x194);}return _0x6c6e57;};}function handleError(_0x44c699,_0x5823fb){_0x5823fb=_0x5823fb||0x1f4;return function(_0x32111d){logger[_0x2367('0x1f')](_0x32111d[_0x2367('0x20')]);if(_0x32111d['name']){delete _0x32111d[_0x2367('0x21')];}_0x44c699[_0x2367('0x16')](_0x5823fb)[_0x2367('0x22')](_0x32111d);};}exports[_0x2367('0x23')]=function(_0x274536,_0x1ddd95){var _0x283b4d={},_0x12cbb5={},_0x56432c={'count':0x0,'rows':[]};var _0x3f1c27=_[_0x2367('0x24')](db[_0x2367('0x25')][_0x2367('0x26')],function(_0x2b0363){return{'name':_0x2b0363[_0x2367('0x27')],'type':_0x2b0363[_0x2367('0x28')][_0x2367('0x29')]};});_0x12cbb5['model']=_['map'](_0x3f1c27,_0x2367('0x21'));_0x12cbb5['query']=_['keys'](_0x274536[_0x2367('0x2a')]);_0x12cbb5[_0x2367('0x2b')]=_[_0x2367('0x2c')](_0x12cbb5[_0x2367('0x2d')],_0x12cbb5['query']);_0x283b4d[_0x2367('0x2e')]=_['intersection'](_0x12cbb5[_0x2367('0x2d')],qs[_0x2367('0x2f')](_0x274536[_0x2367('0x2a')][_0x2367('0x2f')]));_0x283b4d['attributes']=_0x283b4d[_0x2367('0x2e')][_0x2367('0x30')]?_0x283b4d['attributes']:_0x12cbb5['model'];if(!_0x274536['query']['hasOwnProperty']('nolimit')){_0x283b4d[_0x2367('0x1a')]=qs[_0x2367('0x1a')](_0x274536[_0x2367('0x2a')][_0x2367('0x1a')]);_0x283b4d[_0x2367('0x31')]=qs['offset'](_0x274536[_0x2367('0x2a')][_0x2367('0x31')]);}_0x283b4d['order']=qs[_0x2367('0x32')](_0x274536[_0x2367('0x2a')][_0x2367('0x32')]);_0x283b4d['where']=qs[_0x2367('0x2b')](_[_0x2367('0x33')](_0x274536[_0x2367('0x2a')],_0x12cbb5['filters']),_0x3f1c27);if(_0x274536[_0x2367('0x2a')]['filter']){_0x283b4d['where']=_['merge'](_0x283b4d[_0x2367('0x34')],{'$or':_[_0x2367('0x24')](_0x3f1c27,function(_0x5ea9b8){if(_0x5ea9b8[_0x2367('0x28')]!==_0x2367('0x35')){var _0x2aaa8c={};_0x2aaa8c[_0x5ea9b8[_0x2367('0x21')]]={'$like':'%'+_0x274536[_0x2367('0x2a')][_0x2367('0x36')]+'%'};return _0x2aaa8c;}})});}_0x283b4d=_[_0x2367('0x37')]({},_0x283b4d,_0x274536[_0x2367('0x38')]);var _0x7622b1={'where':_0x283b4d[_0x2367('0x34')]};return db[_0x2367('0x25')][_0x2367('0x19')](_0x7622b1)[_0x2367('0x1d')](function(_0x207ff4){_0x56432c['count']=_0x207ff4;if(_0x274536[_0x2367('0x2a')][_0x2367('0x39')]){_0x283b4d[_0x2367('0x3a')]=[{'all':!![]}];}return db[_0x2367('0x25')]['findAll'](_0x283b4d);})[_0x2367('0x1d')](function(_0x4bcdb5){_0x56432c['rows']=_0x4bcdb5;return _0x56432c;})[_0x2367('0x1d')](respondWithFilteredResult(_0x1ddd95,_0x283b4d))[_0x2367('0x3b')](handleError(_0x1ddd95,null));};exports[_0x2367('0x3c')]=function(_0x4b42a1,_0x4c3fd0){var _0x1009d4={'raw':!![],'where':{'id':_0x4b42a1[_0x2367('0x3d')]['id']}},_0x2f2bf9={};_0x2f2bf9[_0x2367('0x2d')]=_['keys'](db[_0x2367('0x25')][_0x2367('0x26')]);_0x2f2bf9['query']=_['keys'](_0x4b42a1['query']);_0x2f2bf9['filters']=_['intersection'](_0x2f2bf9['model'],_0x2f2bf9[_0x2367('0x2a')]);_0x1009d4['attributes']=_[_0x2367('0x2c')](_0x2f2bf9[_0x2367('0x2d')],qs[_0x2367('0x2f')](_0x4b42a1[_0x2367('0x2a')]['fields']));_0x1009d4[_0x2367('0x2e')]=_0x1009d4[_0x2367('0x2e')][_0x2367('0x30')]?_0x1009d4[_0x2367('0x2e')]:_0x2f2bf9[_0x2367('0x2d')];if(_0x4b42a1['query'][_0x2367('0x39')]){_0x1009d4[_0x2367('0x3a')]=[{'all':!![]}];}_0x1009d4=_[_0x2367('0x37')]({},_0x1009d4,_0x4b42a1['options']);return db[_0x2367('0x25')][_0x2367('0x3e')](_0x1009d4)[_0x2367('0x1d')](handleEntityNotFound(_0x4c3fd0,null))[_0x2367('0x1d')](respondWithResult(_0x4c3fd0,null))[_0x2367('0x3b')](handleError(_0x4c3fd0,null));};exports[_0x2367('0x3f')]=function(_0x59f5a5,_0x114e74){return db[_0x2367('0x25')]['create'](_0x59f5a5[_0x2367('0x40')],{})[_0x2367('0x1d')](respondWithResult(_0x114e74,0xc9))[_0x2367('0x3b')](handleError(_0x114e74,null));};exports[_0x2367('0x41')]=function(_0x12520a,_0x119bf4){if(_0x12520a[_0x2367('0x40')]['id']){delete _0x12520a[_0x2367('0x40')]['id'];}return db[_0x2367('0x25')]['find']({'where':{'id':_0x12520a['params']['id']}})[_0x2367('0x1d')](handleEntityNotFound(_0x119bf4,null))[_0x2367('0x1d')](saveUpdates(_0x12520a['body'],null))['then'](respondWithResult(_0x119bf4,null))[_0x2367('0x3b')](handleError(_0x119bf4,null));};exports[_0x2367('0x42')]=function(_0x4b7ffb,_0x5a1998){return db[_0x2367('0x25')]['find']({'where':{'id':_0x4b7ffb[_0x2367('0x3d')]['id']}})[_0x2367('0x1d')](handleEntityNotFound(_0x5a1998,null))[_0x2367('0x1d')](removeEntity(_0x5a1998,null))[_0x2367('0x3b')](handleError(_0x5a1998,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 5c27483..741d8b0 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 _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 +var _0xb658=['define','int_freshsales_fields','idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports'];(function(_0x96fa2a,_0x2c1cc0){var _0x5d9298=function(_0x1a4810){while(--_0x1a4810){_0x96fa2a['push'](_0x96fa2a['shift']());}};_0x5d9298(++_0x2c1cc0);}(_0xb658,0x122));var _0x8b65=function(_0x3add8e,_0x2b08b3){_0x3add8e=_0x3add8e-0x0;var _0x1a80f4=_0xb658[_0x3add8e];return _0x1a80f4;};'use strict';var _=require('lodash');var util=require(_0x8b65('0x0'));var logger=require(_0x8b65('0x1'))('api');var moment=require(_0x8b65('0x2'));var BPromise=require(_0x8b65('0x3'));var rp=require(_0x8b65('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b65('0x5'));var config=require(_0x8b65('0x6'));var attributes=require(_0x8b65('0x7'));module[_0x8b65('0x8')]=function(_0xe73de5,_0x2212b3){return _0xe73de5[_0x8b65('0x9')]('FreshsalesField',attributes,{'tableName':_0x8b65('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x8b65('0xb'),_0x8b65('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 8d21cdc..878cac5 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 _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 +var _0x8be0=['../../config/environment','jayson/promise','client','http','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x8be0,0x84));var _0x08be=function(_0x56f3db,_0x58d85c){_0x56f3db=_0x56f3db-0x0;var _0x5da295=_0x8be0[_0x56f3db];return _0x5da295;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x08be('0x0'));var rs=require(_0x08be('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x08be('0x2'));var logger=require(_0x08be('0x3'))('rpc');var config=require(_0x08be('0x4'));var jayson=require(_0x08be('0x5'));var client=jayson[_0x08be('0x6')][_0x08be('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5515a4,_0x1a2f35,_0x293194){return new BPromise(function(_0x2d67db,_0x5d1ffb){return client['request'](_0x5515a4,_0x293194)['then'](function(_0x7507ca){logger[_0x08be('0x8')](_0x08be('0x9'),_0x1a2f35,_0x08be('0xa'));logger[_0x08be('0xb')](_0x08be('0xc'),_0x1a2f35,'request\x20sent',JSON[_0x08be('0xd')](_0x7507ca));if(_0x7507ca[_0x08be('0xe')]){if(_0x7507ca['error']['code']===0x1f4){logger[_0x08be('0xe')](_0x08be('0x9'),_0x1a2f35,_0x7507ca[_0x08be('0xe')][_0x08be('0xf')]);return _0x5d1ffb(_0x7507ca[_0x08be('0xe')][_0x08be('0xf')]);}logger[_0x08be('0xe')](_0x08be('0x9'),_0x1a2f35,_0x7507ca[_0x08be('0xe')][_0x08be('0xf')]);return _0x2d67db(_0x7507ca[_0x08be('0xe')][_0x08be('0xf')]);}else{logger['info'](_0x08be('0x9'),_0x1a2f35,_0x08be('0xa'));_0x2d67db(_0x7507ca['result']['message']);}})[_0x08be('0x10')](function(_0x25c4ba){logger['error'](_0x08be('0x9'),_0x1a2f35,_0x25c4ba);_0x5d1ffb(_0x25c4ba);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index ff7541f..f8b6023 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 _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 +var _0xa837=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','exports','util','path'];(function(_0x1687b0,_0x37e2e0){var _0x47d0c3=function(_0x4f0773){while(--_0x4f0773){_0x1687b0['push'](_0x1687b0['shift']());}};_0x47d0c3(++_0x37e2e0);}(_0xa837,0x1a0));var _0x7a83=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa837[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x7a83('0x0'));var path=require(_0x7a83('0x1'));var timeout=require(_0x7a83('0x2'));var express=require(_0x7a83('0x3'));var router=express[_0x7a83('0x4')]();var auth=require(_0x7a83('0x5'));var interaction=require(_0x7a83('0x6'));var config=require(_0x7a83('0x7'));var controller=require('./intSalesforceAccount.controller');router[_0x7a83('0x8')]('/',auth[_0x7a83('0x9')](),controller[_0x7a83('0xa')]);router[_0x7a83('0x8')](_0x7a83('0xb'),auth['isAuthenticated'](),controller[_0x7a83('0xc')]);router[_0x7a83('0x8')]('/:id/configurations',auth[_0x7a83('0x9')](),controller[_0x7a83('0xd')]);router[_0x7a83('0x8')](_0x7a83('0xe'),auth[_0x7a83('0x9')](),controller[_0x7a83('0xf')]);router[_0x7a83('0x10')]('/',auth[_0x7a83('0x9')](),controller[_0x7a83('0x11')]);router[_0x7a83('0x10')]('/:id/configurations',auth[_0x7a83('0x9')](),controller[_0x7a83('0x12')]);router[_0x7a83('0x13')](_0x7a83('0xb'),auth[_0x7a83('0x9')](),controller[_0x7a83('0x14')]);router['delete'](_0x7a83('0xb'),auth[_0x7a83('0x9')](),controller['destroy']);module[_0x7a83('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 2547c72..3c332e3 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 _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 +var _0x7f06=['newTab','sequelize','exports','STRING','username','ENUM','integrationTab'];(function(_0x16c0bc,_0x3505ff){var _0x19360d=function(_0x4844cc){while(--_0x4844cc){_0x16c0bc['push'](_0x16c0bc['shift']());}};_0x19360d(++_0x3505ff);}(_0x7f06,0xe8));var _0x67f0=function(_0x4af829,_0x53ab70){_0x4af829=_0x4af829-0x0;var _0x52982c=_0x7f06[_0x4af829];return _0x52982c;};'use strict';var Sequelize=require(_0x67f0('0x0'));module[_0x67f0('0x1')]={'name':{'type':Sequelize[_0x67f0('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x67f0('0x2')],'unique':_0x67f0('0x3')},'remoteUri':{'type':Sequelize[_0x67f0('0x2')]},'password':{'type':Sequelize[_0x67f0('0x2')]},'clientId':{'type':Sequelize[_0x67f0('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x67f0('0x2')]},'serverUrl':{'type':Sequelize[_0x67f0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x67f0('0x4')](_0x67f0('0x5'),_0x67f0('0x6')),'defaultValue':_0x67f0('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index cb50a89..6ca298b 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 _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 +var _0x9b94=['includeAll','include','rows','show','params','create','body','find','SalesforceConfiguration','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','Connection','login','isNil','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Description','int','boolean','email','textarea','remove','includes','custom','picklistValues','label','value','True','true','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','debug','request\x20sent','stringify','error','message','info','SalesforceAccount,\x20%s,\x20%s','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','SalesforceAccount'];(function(_0x48a64b,_0x50dca1){var _0x11888a=function(_0x2c7b3e){while(--_0x2c7b3e){_0x48a64b['push'](_0x48a64b['shift']());}};_0x11888a(++_0x50dca1);}(_0x9b94,0x135));var _0x49b9=function(_0x2c8dbb,_0x54a6de){_0x2c8dbb=_0x2c8dbb-0x0;var _0x4462a3=_0x9b94[_0x2c8dbb];return _0x4462a3;};'use strict';var pdf=require(_0x49b9('0x0'));var emlformat=require(_0x49b9('0x1'));var rimraf=require(_0x49b9('0x2'));var zipdir=require(_0x49b9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x49b9('0x4'));var moment=require('moment');var BPromise=require(_0x49b9('0x5'));var Mustache=require(_0x49b9('0x6'));var util=require(_0x49b9('0x7'));var path=require(_0x49b9('0x8'));var sox=require(_0x49b9('0x9'));var csv=require(_0x49b9('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x49b9('0xb'));var squel=require(_0x49b9('0xc'));var crypto=require(_0x49b9('0xd'));var jsforce=require(_0x49b9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x49b9('0xa'));var querystring=require(_0x49b9('0xf'));var Papa=require(_0x49b9('0x10'));var Redis=require(_0x49b9('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x49b9('0x12'));var hardwareService=require(_0x49b9('0x13'));var logger=require('../../config/logger')(_0x49b9('0x14'));var utils=require('../../config/utils');var config=require(_0x49b9('0x15'));var licenseUtil=require(_0x49b9('0x16'));var db=require(_0x49b9('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x49b9('0x18'));var client=jayson['client'][_0x49b9('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x13d6de,_0x24269e,_0x75381b,_0x1e8959){return new BPromise(function(_0x50d2ad,_0x14a941){var _0x542a0e=_0x1e8959||client;return _0x542a0e[_0x49b9('0x1a')](_0x13d6de,_0x75381b)['then'](function(_0xa98e64){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x24269e,'request\x20sent');logger[_0x49b9('0x1b')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x24269e,_0x49b9('0x1c'),JSON[_0x49b9('0x1d')](_0xa98e64));if(_0xa98e64[_0x49b9('0x1e')]){if(_0xa98e64[_0x49b9('0x1e')]['code']===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x24269e,_0xa98e64['error'][_0x49b9('0x1f')]);return _0x14a941(_0xa98e64[_0x49b9('0x1e')][_0x49b9('0x1f')]);}logger[_0x49b9('0x1e')]('SalesforceAccount,\x20%s,\x20%s',_0x24269e,_0xa98e64['error'][_0x49b9('0x1f')]);return _0x50d2ad(_0xa98e64[_0x49b9('0x1e')]['message']);}else{logger[_0x49b9('0x20')](_0x49b9('0x21'),_0x24269e,'request\x20sent');_0x50d2ad(_0xa98e64[_0x49b9('0x22')][_0x49b9('0x1f')]);}})[_0x49b9('0x23')](function(_0x47aae4){logger['error'](_0x49b9('0x21'),_0x24269e,_0x47aae4);_0x14a941(_0x47aae4);});});}function respondWithStatusCode(_0x556b3b,_0x4e03d1){_0x4e03d1=_0x4e03d1||0xcc;return function(_0x5be6bd){if(_0x5be6bd){return _0x556b3b[_0x49b9('0x24')](_0x4e03d1);}return _0x556b3b[_0x49b9('0x25')](_0x4e03d1)['end']();};}function respondWithResult(_0x1bf018,_0x2caa6b){_0x2caa6b=_0x2caa6b||0xc8;return function(_0x155edf){if(_0x155edf){return _0x1bf018['status'](_0x2caa6b)[_0x49b9('0x26')](_0x155edf);}};}function respondWithFilteredResult(_0x4fe462,_0x2df49f){return function(_0x5ebc7c){if(_0x5ebc7c){var _0xca0caa=_0x5ebc7c[_0x49b9('0x27')],_0x2c162f=_0x2df49f[_0x49b9('0x28')],_0x31ed76=_0x2df49f[_0x49b9('0x28')]+_0x2df49f[_0x49b9('0x29')],_0x2a5b4b;if(_0x31ed76>=_0xca0caa){_0x31ed76=_0xca0caa;_0x2a5b4b=0xc8;}else{_0x2a5b4b=0xce;}_0x4fe462[_0x49b9('0x25')](_0x2a5b4b);return _0x4fe462[_0x49b9('0x2a')](_0x49b9('0x2b'),_0x2c162f+'-'+_0x31ed76+'/'+_0xca0caa)[_0x49b9('0x26')](_0x5ebc7c);}return null;};}function patchUpdates(_0x566284){return function(_0x1469aa){try{jsonpatch['apply'](_0x1469aa,_0x566284,!![]);}catch(_0x46b1b9){return BPromise[_0x49b9('0x2c')](_0x46b1b9);}return _0x1469aa[_0x49b9('0x2d')]();};}function saveUpdates(_0x5585af,_0x5e72ff){return function(_0x3b7b1e){if(_0x3b7b1e){return _0x3b7b1e[_0x49b9('0x2e')](_0x5585af)[_0x49b9('0x2f')](function(_0x18575f){return _0x18575f;});}return null;};}function removeEntity(_0x5c1340,_0x4377ca){return function(_0x1893c2){if(_0x1893c2){return _0x1893c2[_0x49b9('0x30')]()[_0x49b9('0x2f')](function(){_0x5c1340[_0x49b9('0x25')](0xcc)[_0x49b9('0x31')]();});}};}function handleEntityNotFound(_0x18a33e,_0x3dad82){return function(_0x5b296){if(!_0x5b296){_0x18a33e[_0x49b9('0x24')](0x194);}return _0x5b296;};}function handleError(_0x5466f7,_0x4ada16){_0x4ada16=_0x4ada16||0x1f4;return function(_0x27430e){logger[_0x49b9('0x1e')](_0x27430e[_0x49b9('0x32')]);if(_0x27430e[_0x49b9('0x33')]){delete _0x27430e['name'];}_0x5466f7['status'](_0x4ada16)['send'](_0x27430e);};}exports['index']=function(_0x3fcdcb,_0x124fed){var _0x2ef004={},_0x251c24={},_0x5b5ed3={'count':0x0,'rows':[]};var _0x5bb994=_[_0x49b9('0x34')](db['SalesforceAccount'][_0x49b9('0x35')],function(_0xa29c3e){return{'name':_0xa29c3e[_0x49b9('0x36')],'type':_0xa29c3e[_0x49b9('0x37')][_0x49b9('0x38')]};});_0x251c24[_0x49b9('0x39')]=_[_0x49b9('0x34')](_0x5bb994,'name');_0x251c24[_0x49b9('0x3a')]=_[_0x49b9('0x3b')](_0x3fcdcb['query']);_0x251c24[_0x49b9('0x3c')]=_[_0x49b9('0x3d')](_0x251c24['model'],_0x251c24['query']);_0x2ef004[_0x49b9('0x3e')]=_['intersection'](_0x251c24[_0x49b9('0x39')],qs[_0x49b9('0x3f')](_0x3fcdcb[_0x49b9('0x3a')][_0x49b9('0x3f')]));_0x2ef004[_0x49b9('0x3e')]=_0x2ef004[_0x49b9('0x3e')][_0x49b9('0x40')]?_0x2ef004['attributes']:_0x251c24[_0x49b9('0x39')];if(!_0x3fcdcb['query'][_0x49b9('0x41')](_0x49b9('0x42'))){_0x2ef004[_0x49b9('0x29')]=qs[_0x49b9('0x29')](_0x3fcdcb['query'][_0x49b9('0x29')]);_0x2ef004[_0x49b9('0x28')]=qs['offset'](_0x3fcdcb[_0x49b9('0x3a')][_0x49b9('0x28')]);}_0x2ef004[_0x49b9('0x43')]=qs[_0x49b9('0x44')](_0x3fcdcb[_0x49b9('0x3a')][_0x49b9('0x44')]);_0x2ef004['where']=qs[_0x49b9('0x3c')](_[_0x49b9('0x45')](_0x3fcdcb[_0x49b9('0x3a')],_0x251c24[_0x49b9('0x3c')]),_0x5bb994);if(_0x3fcdcb[_0x49b9('0x3a')][_0x49b9('0x46')]){_0x2ef004['where']=_[_0x49b9('0x47')](_0x2ef004[_0x49b9('0x48')],{'$or':_['map'](_0x5bb994,function(_0x7f61b8){if(_0x7f61b8[_0x49b9('0x37')]!=='VIRTUAL'){var _0x352d3c={};_0x352d3c[_0x7f61b8[_0x49b9('0x33')]]={'$like':'%'+_0x3fcdcb[_0x49b9('0x3a')][_0x49b9('0x46')]+'%'};return _0x352d3c;}})});}_0x2ef004=_[_0x49b9('0x47')]({},_0x2ef004,_0x3fcdcb[_0x49b9('0x49')]);var _0x47d099={'where':_0x2ef004[_0x49b9('0x48')]};return db[_0x49b9('0x4a')]['count'](_0x47d099)[_0x49b9('0x2f')](function(_0x2f0791){_0x5b5ed3['count']=_0x2f0791;if(_0x3fcdcb[_0x49b9('0x3a')][_0x49b9('0x4b')]){_0x2ef004[_0x49b9('0x4c')]=[{'all':!![]}];}return db[_0x49b9('0x4a')]['findAll'](_0x2ef004);})['then'](function(_0x4f3fc2){_0x5b5ed3[_0x49b9('0x4d')]=_0x4f3fc2;return _0x5b5ed3;})['then'](respondWithFilteredResult(_0x124fed,_0x2ef004))[_0x49b9('0x23')](handleError(_0x124fed,null));};exports[_0x49b9('0x4e')]=function(_0x3d7d20,_0x201120){var _0x2ef72f={'raw':![],'where':{'id':_0x3d7d20[_0x49b9('0x4f')]['id']}},_0xa4e210={};_0xa4e210[_0x49b9('0x39')]=_[_0x49b9('0x3b')](db['SalesforceAccount'][_0x49b9('0x35')]);_0xa4e210[_0x49b9('0x3a')]=_['keys'](_0x3d7d20[_0x49b9('0x3a')]);_0xa4e210[_0x49b9('0x3c')]=_[_0x49b9('0x3d')](_0xa4e210[_0x49b9('0x39')],_0xa4e210[_0x49b9('0x3a')]);_0x2ef72f['attributes']=_[_0x49b9('0x3d')](_0xa4e210[_0x49b9('0x39')],qs[_0x49b9('0x3f')](_0x3d7d20[_0x49b9('0x3a')]['fields']));_0x2ef72f[_0x49b9('0x3e')]=_0x2ef72f[_0x49b9('0x3e')][_0x49b9('0x40')]?_0x2ef72f[_0x49b9('0x3e')]:_0xa4e210[_0x49b9('0x39')];if(_0x3d7d20[_0x49b9('0x3a')][_0x49b9('0x4b')]){_0x2ef72f[_0x49b9('0x4c')]=[{'all':!![]}];}_0x2ef72f=_[_0x49b9('0x47')]({},_0x2ef72f,_0x3d7d20[_0x49b9('0x49')]);return db[_0x49b9('0x4a')]['find'](_0x2ef72f)[_0x49b9('0x2f')](handleEntityNotFound(_0x201120,null))[_0x49b9('0x2f')](respondWithResult(_0x201120,null))[_0x49b9('0x23')](handleError(_0x201120,null));};exports[_0x49b9('0x50')]=function(_0x39353e,_0x31e29d){return db['SalesforceAccount'][_0x49b9('0x50')](_0x39353e['body'],{})['then'](respondWithResult(_0x31e29d,0xc9))[_0x49b9('0x23')](handleError(_0x31e29d,null));};exports[_0x49b9('0x2e')]=function(_0x31f8c3,_0x156d4){if(_0x31f8c3[_0x49b9('0x51')]['id']){delete _0x31f8c3['body']['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x31f8c3[_0x49b9('0x4f')]['id']}})[_0x49b9('0x2f')](handleEntityNotFound(_0x156d4,null))[_0x49b9('0x2f')](saveUpdates(_0x31f8c3[_0x49b9('0x51')],null))[_0x49b9('0x2f')](respondWithResult(_0x156d4,null))[_0x49b9('0x23')](handleError(_0x156d4,null));};exports[_0x49b9('0x30')]=function(_0x42409d,_0x1ee785){return db[_0x49b9('0x4a')][_0x49b9('0x52')]({'where':{'id':_0x42409d['params']['id']}})[_0x49b9('0x2f')](handleEntityNotFound(_0x1ee785,null))['then'](removeEntity(_0x1ee785,null))[_0x49b9('0x23')](handleError(_0x1ee785,null));};exports['getConfigurations']=function(_0x1c483c,_0x210434,_0x42c581){var _0x36ebb9={};var _0x39721c={};var _0x31080c;var _0x24d2c4;return db[_0x49b9('0x4a')]['findOne']({'where':{'id':_0x1c483c[_0x49b9('0x4f')]['id']}})[_0x49b9('0x2f')](handleEntityNotFound(_0x210434,null))[_0x49b9('0x2f')](function(_0x67a437){if(_0x67a437){_0x31080c=_0x67a437;_0x39721c[_0x49b9('0x39')]=_[_0x49b9('0x3b')](db[_0x49b9('0x53')]['rawAttributes']);_0x39721c['query']=_[_0x49b9('0x3b')](_0x1c483c[_0x49b9('0x3a')]);_0x39721c[_0x49b9('0x3c')]=_[_0x49b9('0x3d')](_0x39721c['model'],_0x39721c['query']);_0x36ebb9['attributes']=_[_0x49b9('0x3d')](_0x39721c['model'],qs['fields'](_0x1c483c[_0x49b9('0x3a')][_0x49b9('0x3f')]));_0x36ebb9[_0x49b9('0x3e')]=_0x36ebb9[_0x49b9('0x3e')][_0x49b9('0x40')]?_0x36ebb9[_0x49b9('0x3e')]:_0x39721c['model'];_0x36ebb9[_0x49b9('0x43')]=qs[_0x49b9('0x44')](_0x1c483c[_0x49b9('0x3a')][_0x49b9('0x44')]);_0x36ebb9[_0x49b9('0x48')]=qs[_0x49b9('0x3c')](_[_0x49b9('0x45')](_0x1c483c[_0x49b9('0x3a')],_0x39721c['filters']));if(_0x1c483c[_0x49b9('0x3a')][_0x49b9('0x46')]){_0x36ebb9[_0x49b9('0x48')]=_[_0x49b9('0x47')](_0x36ebb9['where'],{'$or':_[_0x49b9('0x34')](_0x36ebb9[_0x49b9('0x3e')],function(_0x5ddd6d){var _0x55a165={};_0x55a165[_0x5ddd6d]={'$like':'%'+_0x1c483c[_0x49b9('0x3a')][_0x49b9('0x46')]+'%'};return _0x55a165;})});}_0x36ebb9=_[_0x49b9('0x47')]({},_0x36ebb9,_0x1c483c[_0x49b9('0x49')]);return _0x31080c[_0x49b9('0x54')](_0x36ebb9);}})[_0x49b9('0x2f')](function(_0x2c3723){if(_0x2c3723){_0x24d2c4=_0x2c3723[_0x49b9('0x40')];if(!_0x1c483c['query'][_0x49b9('0x41')]('nolimit')){_0x36ebb9[_0x49b9('0x29')]=qs[_0x49b9('0x29')](_0x1c483c[_0x49b9('0x3a')][_0x49b9('0x29')]);_0x36ebb9['offset']=qs[_0x49b9('0x28')](_0x1c483c['query']['offset']);}return _0x31080c[_0x49b9('0x54')](_0x36ebb9);}})['then'](function(_0x6cc2e6){if(_0x6cc2e6){return _0x6cc2e6?{'count':_0x24d2c4,'rows':_0x6cc2e6}:null;}})[_0x49b9('0x2f')](respondWithResult(_0x210434,null))[_0x49b9('0x23')](handleError(_0x210434,null));};exports[_0x49b9('0x55')]=function(_0x5616a5,_0x19f639,_0x2cc1b5){if(_0x5616a5[_0x49b9('0x51')]['id']){delete _0x5616a5[_0x49b9('0x51')]['id'];}return db[_0x49b9('0x4a')][_0x49b9('0x56')]({'where':{'id':_0x5616a5['params']['id']}})['then'](handleEntityNotFound(_0x19f639,null))['then'](function(_0x829625){if(_0x829625){_0x5616a5[_0x49b9('0x51')][_0x49b9('0x57')]=_0x829625['id'];_0x5616a5[_0x49b9('0x51')][_0x49b9('0x58')]=integrations['getSubjects'](_0x5616a5[_0x49b9('0x51')][_0x49b9('0x59')],_0x5616a5[_0x49b9('0x51')][_0x49b9('0x37')]);_0x5616a5[_0x49b9('0x51')][_0x49b9('0x5a')]=integrations[_0x49b9('0x5b')](_0x5616a5[_0x49b9('0x51')]['channel'],_0x5616a5[_0x49b9('0x51')]['type']);return db[_0x49b9('0x53')]['create'](_0x5616a5[_0x49b9('0x51')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x49b9('0x5c')],'as':_0x49b9('0x5a')}]});}return null;})[_0x49b9('0x2f')](respondWithResult(_0x19f639,null))['catch'](handleError(_0x19f639,null));};exports[_0x49b9('0x5d')]=function(_0x2848cd,_0x308d45,_0x4593f1){var _0x913170;var _0x1373f1='';var _0x58f0b6='Task';return db['SalesforceAccount'][_0x49b9('0x56')]({'where':{'id':_0x2848cd[_0x49b9('0x4f')]['id']},'attributes':['id',_0x49b9('0x5e'),_0x49b9('0x5f'),_0x49b9('0x60'),_0x49b9('0x61'),_0x49b9('0x62'),_0x49b9('0x63')]})[_0x49b9('0x2f')](handleEntityNotFound(_0x308d45,null))['then'](function(_0x4fec7a){if(_0x4fec7a){_0x1373f1=_0x4fec7a[_0x49b9('0x5e')];var _0x74678f=_0x1373f1[_0x49b9('0x64')](-0x1);if(_0x74678f==='/'){_0x1373f1=_0x1373f1[_0x49b9('0x65')](0x0,_0x1373f1['lastIndexOf'](_0x74678f));}_0x913170=new jsforce[(_0x49b9('0x66'))]({'oauth2':{'loginUrl':_0x1373f1,'clientId':_0x4fec7a['clientId'],'clientSecret':_0x4fec7a[_0x49b9('0x60')]}});return _0x913170[_0x49b9('0x67')](_0x4fec7a[_0x49b9('0x61')],_0x4fec7a[_0x49b9('0x62')]['concat'](_0x4fec7a[_0x49b9('0x63')]));}})[_0x49b9('0x2f')](function(_0x635a68){if(_0x635a68){if(!_[_0x49b9('0x68')](_0x2848cd[_0x49b9('0x3a')]['ticketType'])){_0x58f0b6=_0x2848cd[_0x49b9('0x3a')]['ticketType'];}return _0x913170[_0x49b9('0x69')](_0x58f0b6)['describe']();}})[_0x49b9('0x2f')](function(_0x875637){var _0x22e245=[_0x49b9('0x6a'),_0x49b9('0x6b'),_0x49b9('0x6c'),_0x49b9('0x6d'),'Subject',_0x49b9('0x6e')];var _0x2a59aa=['string',_0x49b9('0x6f'),'picklist',_0x49b9('0x70'),_0x49b9('0x71'),_0x49b9('0x72'),'phone'];if(_0x875637){_[_0x49b9('0x73')](_0x875637[_0x49b9('0x3f')],function(_0x31c40f){return _0x22e245[_0x49b9('0x74')](_0x31c40f[_0x49b9('0x33')])||!_0x2a59aa[_0x49b9('0x74')](_0x31c40f[_0x49b9('0x37')]);});return{'count':_0x875637['fields'][_0x49b9('0x40')],'rows':_[_0x49b9('0x34')](_0x875637[_0x49b9('0x3f')],function(_0x2830c7){return{'id':_0x2830c7['name'],'name':_0x2830c7['label'],'custom':_0x2830c7[_0x49b9('0x75')],'options':_0x2830c7[_0x49b9('0x76')]['length']>0x0?_[_0x49b9('0x34')](_0x2830c7['picklistValues'],function(_0x5ae720){return{'name':_0x5ae720[_0x49b9('0x77')],'value':_0x5ae720[_0x49b9('0x78')]};}):_0x2830c7[_0x49b9('0x37')]==_0x49b9('0x70')?[{'name':_0x49b9('0x79'),'value':_0x49b9('0x7a')},{'name':'False','value':'false'}]:[]};})};}})[_0x49b9('0x2f')](respondWithResult(_0x308d45,null))[_0x49b9('0x23')](function(_0x155200){var _0x2e211f=_0x2848cd[_0x49b9('0x3a')][_0x49b9('0x7b')]?0x1f4:_0x155200[_0x49b9('0x7c')]||0x1f4;logger[_0x49b9('0x1e')](_0x49b9('0x7d'),'getFields',_0x2e211f,JSON[_0x49b9('0x1d')](_0x155200));delete _0x155200[_0x49b9('0x33')];if(_0x2e211f===0x191){_0x2e211f=0x190;}_0x308d45[_0x49b9('0x25')](_0x2e211f)[_0x49b9('0x7e')](_0x2848cd['query'][_0x49b9('0x7b')]?{'message':_0x49b9('0x7f'),'statusCode':_0x155200['statusCode']}:_0x155200);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 6c3ca3e..0295c01 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 _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 +var _0xa7e0=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','int_salesforce_accounts','util'];(function(_0x4653f7,_0x3d3ae3){var _0x5454da=function(_0x448f55){while(--_0x448f55){_0x4653f7['push'](_0x4653f7['shift']());}};_0x5454da(++_0x3d3ae3);}(_0xa7e0,0x6b));var _0x0a7e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa7e0[_0x56482c];return _0x5aae7a;};'use strict';var _=require('lodash');var util=require(_0x0a7e('0x0'));var logger=require('../../config/logger')(_0x0a7e('0x1'));var moment=require(_0x0a7e('0x2'));var BPromise=require(_0x0a7e('0x3'));var rp=require(_0x0a7e('0x4'));var fs=require('fs');var path=require(_0x0a7e('0x5'));var rimraf=require(_0x0a7e('0x6'));var config=require(_0x0a7e('0x7'));var attributes=require(_0x0a7e('0x8'));var integrations=require(_0x0a7e('0x9'));module['exports']=function(_0x3dbeae,_0x4bef04){return _0x3dbeae[_0x0a7e('0xa')]('SalesforceAccount',attributes,{'tableName':_0x0a7e('0xb'),'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 9eecda6..6113748 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 _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 +var _0x2dae=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SalesforceAccount','options','where','attributes','include','map','model','info','GetSalesforceAccount','ShowSalesforceAccount','find','lodash','moment','bluebird'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2dae,0xc3));var _0xe2da=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0x2dae[_0x23be51];return _0x47a26d;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var moment=require(_0xe2da('0x1'));var BPromise=require(_0xe2da('0x2'));var rs=require(_0xe2da('0x3'));var fs=require('fs');var Redis=require(_0xe2da('0x4'));var db=require(_0xe2da('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2da('0x6'))(_0xe2da('0x7'));var config=require(_0xe2da('0x8'));var jayson=require(_0xe2da('0x9'));var client=jayson['client'][_0xe2da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x89c70b,_0x34cc98,_0x2efbd8){return new BPromise(function(_0x238da3,_0x1c71ea){return client[_0xe2da('0xb')](_0x89c70b,_0x2efbd8)[_0xe2da('0xc')](function(_0x68aa40){logger['info'](_0xe2da('0xd'),_0x34cc98,_0xe2da('0xe'));logger[_0xe2da('0xf')](_0xe2da('0x10'),_0x34cc98,_0xe2da('0xe'),JSON[_0xe2da('0x11')](_0x68aa40));if(_0x68aa40[_0xe2da('0x12')]){if(_0x68aa40[_0xe2da('0x12')]['code']===0x1f4){logger[_0xe2da('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x34cc98,_0x68aa40[_0xe2da('0x12')][_0xe2da('0x13')]);return _0x1c71ea(_0x68aa40[_0xe2da('0x12')][_0xe2da('0x13')]);}logger[_0xe2da('0x12')](_0xe2da('0xd'),_0x34cc98,_0x68aa40[_0xe2da('0x12')]['message']);return _0x238da3(_0x68aa40[_0xe2da('0x12')]['message']);}else{logger['info'](_0xe2da('0xd'),_0x34cc98,_0xe2da('0xe'));_0x238da3(_0x68aa40[_0xe2da('0x14')]['message']);}})[_0xe2da('0x15')](function(_0x2c0353){logger[_0xe2da('0x12')](_0xe2da('0xd'),_0x34cc98,_0x2c0353);_0x1c71ea(_0x2c0353);});});}exports['GetSalesforceAccount']=function(_0x45bb92){var _0x1f7d33=this;return new Promise(function(_0x417363,_0x2e5730){return db[_0xe2da('0x16')]['findAll']({'raw':_0x45bb92[_0xe2da('0x17')]?_0x45bb92[_0xe2da('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x45bb92[_0xe2da('0x17')]?_0x45bb92[_0xe2da('0x17')][_0xe2da('0x18')]||null:null,'attributes':_0x45bb92[_0xe2da('0x17')]?_0x45bb92[_0xe2da('0x17')][_0xe2da('0x19')]||null:null,'limit':_0x45bb92['options']?_0x45bb92[_0xe2da('0x17')]['limit']||null:null,'include':_0x45bb92[_0xe2da('0x17')]?_0x45bb92[_0xe2da('0x17')][_0xe2da('0x1a')]?_[_0xe2da('0x1b')](_0x45bb92[_0xe2da('0x17')][_0xe2da('0x1a')],function(_0x38f2c4){return{'model':db[_0x38f2c4[_0xe2da('0x1c')]],'as':_0x38f2c4['as'],'attributes':_0x38f2c4['attributes'],'include':_0x38f2c4[_0xe2da('0x1a')]?_[_0xe2da('0x1b')](_0x38f2c4[_0xe2da('0x1a')],function(_0x14704d){return{'model':db[_0x14704d[_0xe2da('0x1c')]],'as':_0x14704d['as'],'attributes':_0x14704d[_0xe2da('0x19')],'include':_0x14704d[_0xe2da('0x1a')]?_['map'](_0x14704d[_0xe2da('0x1a')],function(_0x3e23d7){return{'model':db[_0x3e23d7[_0xe2da('0x1c')]],'as':_0x3e23d7['as'],'attributes':_0x3e23d7[_0xe2da('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe2da('0xc')](function(_0x2b6c9e){logger[_0xe2da('0x1d')](_0xe2da('0x1e'),_0x45bb92);logger['debug']('GetSalesforceAccount',_0x45bb92,JSON['stringify'](_0x2b6c9e));_0x417363(_0x2b6c9e);})[_0xe2da('0x15')](function(_0x8c91db){logger[_0xe2da('0x12')](_0xe2da('0x1e'),_0x8c91db['message'],_0x45bb92);_0x2e5730(_0x1f7d33['error'](0x1f4,_0x8c91db[_0xe2da('0x13')]));});});};exports[_0xe2da('0x1f')]=function(_0x262d40){var _0x39f983=this;return new Promise(function(_0x7ab5ee,_0x15df33){return db[_0xe2da('0x16')][_0xe2da('0x20')]({'raw':_0x262d40[_0xe2da('0x17')]?_0x262d40['options']['raw']===undefined?!![]:![]:!![],'where':_0x262d40[_0xe2da('0x17')]?_0x262d40[_0xe2da('0x17')][_0xe2da('0x18')]||null:null,'attributes':_0x262d40[_0xe2da('0x17')]?_0x262d40[_0xe2da('0x17')][_0xe2da('0x19')]||null:null,'include':_0x262d40[_0xe2da('0x17')]?_0x262d40[_0xe2da('0x17')][_0xe2da('0x1a')]?_[_0xe2da('0x1b')](_0x262d40[_0xe2da('0x17')][_0xe2da('0x1a')],function(_0x4ef546){return{'model':db[_0x4ef546[_0xe2da('0x1c')]],'as':_0x4ef546['as'],'attributes':_0x4ef546[_0xe2da('0x19')],'include':_0x4ef546[_0xe2da('0x1a')]?_[_0xe2da('0x1b')](_0x4ef546[_0xe2da('0x1a')],function(_0x5a078e){return{'model':db[_0x5a078e[_0xe2da('0x1c')]],'as':_0x5a078e['as'],'attributes':_0x5a078e[_0xe2da('0x19')],'include':_0x5a078e[_0xe2da('0x1a')]?_['map'](_0x5a078e[_0xe2da('0x1a')],function(_0x10b8f5){return{'model':db[_0x10b8f5[_0xe2da('0x1c')]],'as':_0x10b8f5['as'],'attributes':_0x10b8f5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x156deb){logger[_0xe2da('0x1d')]('ShowSalesforceAccount',_0x262d40);logger[_0xe2da('0xf')](_0xe2da('0x1f'),_0x262d40,JSON[_0xe2da('0x11')](_0x156deb));_0x7ab5ee(_0x156deb);})[_0xe2da('0x15')](function(_0x3a6ca3){logger['error'](_0xe2da('0x1f'),_0x3a6ca3['message'],_0x262d40);_0x15df33(_0x39f983['error'](0x1f4,_0x3a6ca3[_0xe2da('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 141f34c..b8d1ff5 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 _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 +var _0xe54c=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','/:id','delete','destroy','exports'];(function(_0x36621a,_0x5642a3){var _0x247a1f=function(_0x5d92a8){while(--_0x5d92a8){_0x36621a['push'](_0x36621a['shift']());}};_0x247a1f(++_0x5642a3);}(_0xe54c,0xe7));var _0xce54=function(_0x39a71e,_0x128d6c){_0x39a71e=_0x39a71e-0x0;var _0x1d62fb=_0xe54c[_0x39a71e];return _0x1d62fb;};'use strict';var multer=require(_0xce54('0x0'));var util=require(_0xce54('0x1'));var path=require(_0xce54('0x2'));var timeout=require('connect-timeout');var express=require(_0xce54('0x3'));var router=express[_0xce54('0x4')]();var auth=require(_0xce54('0x5'));var interaction=require(_0xce54('0x6'));var config=require('../../config/environment');var controller=require(_0xce54('0x7'));router[_0xce54('0x8')]('/',auth['isAuthenticated'](),controller[_0xce54('0x9')]);router[_0xce54('0x8')]('/:id',auth[_0xce54('0xa')](),controller[_0xce54('0xb')]);router[_0xce54('0x8')](_0xce54('0xc'),auth['isAuthenticated'](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xce54('0xd')]);router[_0xce54('0x8')](_0xce54('0xe'),auth['isAuthenticated'](),controller[_0xce54('0xf')]);router[_0xce54('0x10')]('/',auth[_0xce54('0xa')](),controller['create']);router['put'](_0xce54('0x11'),auth[_0xce54('0xa')](),controller['update']);router[_0xce54('0x12')](_0xce54('0x11'),auth['isAuthenticated'](),controller[_0xce54('0x13')]);module[_0xce54('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index bbbaa4c..bd61565 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 _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 +var _0x9a22=['lead','nothing','contact','sequelize','STRING','ENUM','Case','Task','contact_lead'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x9a22,0xc9));var _0x29a2=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x9a22[_0x4b7b62];return _0x2280df;};'use strict';var Sequelize=require(_0x29a2('0x0'));module['exports']={'name':{'type':Sequelize[_0x29a2('0x1')]},'description':{'type':Sequelize[_0x29a2('0x1')]},'ticketType':{'type':Sequelize[_0x29a2('0x2')]('Task',_0x29a2('0x3')),'defaultValue':_0x29a2('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x29a2('0x5'),'contact',_0x29a2('0x6')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x29a2('0x2')](_0x29a2('0x7'),_0x29a2('0x8'),_0x29a2('0x6')),'defaultValue':'lead'}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 800fd8d..2db561e 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 _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 +var _0xc8d1=['debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','sendStatus','stack','name','index','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','includeAll','SalesforceConfiguration','findAll','rows','show','rawAttributes','include','options','find','create','update','body','params','getFields','findOne','merge','nolimit','SalesforceField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xc8d1,0x1c1));var _0x1c8d=function(_0x5dc0de,_0x25bba4){_0x5dc0de=_0x5dc0de-0x0;var _0x54ba0e=_0xc8d1[_0x5dc0de];return _0x54ba0e;};'use strict';var pdf=require(_0x1c8d('0x0'));var emlformat=require(_0x1c8d('0x1'));var rimraf=require(_0x1c8d('0x2'));var zipdir=require(_0x1c8d('0x3'));var jsonpatch=require(_0x1c8d('0x4'));var rp=require(_0x1c8d('0x5'));var moment=require(_0x1c8d('0x6'));var BPromise=require(_0x1c8d('0x7'));var Mustache=require(_0x1c8d('0x8'));var util=require(_0x1c8d('0x9'));var path=require(_0x1c8d('0xa'));var sox=require('sox');var csv=require(_0x1c8d('0xb'));var ejs=require(_0x1c8d('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1c8d('0xd'));var crypto=require(_0x1c8d('0xe'));var jsforce=require(_0x1c8d('0xf'));var deskjs=require(_0x1c8d('0x10'));var toCsv=require(_0x1c8d('0xb'));var querystring=require(_0x1c8d('0x11'));var Papa=require(_0x1c8d('0x12'));var Redis=require(_0x1c8d('0x13'));var authService=require(_0x1c8d('0x14'));var qs=require(_0x1c8d('0x15'));var as=require(_0x1c8d('0x16'));var hardwareService=require(_0x1c8d('0x17'));var logger=require(_0x1c8d('0x18'))(_0x1c8d('0x19'));var utils=require(_0x1c8d('0x1a'));var config=require(_0x1c8d('0x1b'));var licenseUtil=require(_0x1c8d('0x1c'));var db=require(_0x1c8d('0x1d'))['db'];var jayson=require(_0x1c8d('0x1e'));var client=jayson[_0x1c8d('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6f1880,_0x56e640,_0x495f62,_0xfd3242){return new BPromise(function(_0x2c40b1,_0x3c9084){var _0xb45041=_0xfd3242||client;return _0xb45041[_0x1c8d('0x20')](_0x6f1880,_0x495f62)[_0x1c8d('0x21')](function(_0x4382bc){logger['info'](_0x1c8d('0x22'),_0x56e640,_0x1c8d('0x23'));logger[_0x1c8d('0x24')](_0x1c8d('0x25'),_0x56e640,_0x1c8d('0x23'),JSON[_0x1c8d('0x26')](_0x4382bc));if(_0x4382bc['error']){if(_0x4382bc[_0x1c8d('0x27')][_0x1c8d('0x28')]===0x1f4){logger[_0x1c8d('0x27')]('SalesforceConfiguration,\x20%s,\x20%s',_0x56e640,_0x4382bc[_0x1c8d('0x27')][_0x1c8d('0x29')]);return _0x3c9084(_0x4382bc[_0x1c8d('0x27')][_0x1c8d('0x29')]);}logger[_0x1c8d('0x27')](_0x1c8d('0x22'),_0x56e640,_0x4382bc[_0x1c8d('0x27')]['message']);return _0x2c40b1(_0x4382bc['error'][_0x1c8d('0x29')]);}else{logger[_0x1c8d('0x2a')](_0x1c8d('0x22'),_0x56e640,'request\x20sent');_0x2c40b1(_0x4382bc['result'][_0x1c8d('0x29')]);}})[_0x1c8d('0x2b')](function(_0x35a2cc){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x56e640,_0x35a2cc);_0x3c9084(_0x35a2cc);});});}function respondWithStatusCode(_0x461616,_0x109027){_0x109027=_0x109027||0xcc;return function(_0x870682){if(_0x870682){return _0x461616['sendStatus'](_0x109027);}return _0x461616['status'](_0x109027)[_0x1c8d('0x2c')]();};}function respondWithResult(_0x20e553,_0x360c44){_0x360c44=_0x360c44||0xc8;return function(_0x323b72){if(_0x323b72){return _0x20e553[_0x1c8d('0x2d')](_0x360c44)['json'](_0x323b72);}};}function respondWithFilteredResult(_0x58640e,_0x1c84fd){return function(_0x520555){if(_0x520555){var _0x3a5168=_0x520555[_0x1c8d('0x2e')],_0x38863c=_0x1c84fd[_0x1c8d('0x2f')],_0x32e64d=_0x1c84fd[_0x1c8d('0x2f')]+_0x1c84fd[_0x1c8d('0x30')],_0x23ef5b;if(_0x32e64d>=_0x3a5168){_0x32e64d=_0x3a5168;_0x23ef5b=0xc8;}else{_0x23ef5b=0xce;}_0x58640e[_0x1c8d('0x2d')](_0x23ef5b);return _0x58640e[_0x1c8d('0x31')](_0x1c8d('0x32'),_0x38863c+'-'+_0x32e64d+'/'+_0x3a5168)[_0x1c8d('0x33')](_0x520555);}return null;};}function patchUpdates(_0xeba9ce){return function(_0x12c061){try{jsonpatch[_0x1c8d('0x34')](_0x12c061,_0xeba9ce,!![]);}catch(_0x53ba57){return BPromise[_0x1c8d('0x35')](_0x53ba57);}return _0x12c061[_0x1c8d('0x36')]();};}function saveUpdates(_0x51c431,_0x1573da){return function(_0x308990){if(_0x308990){return _0x308990['update'](_0x51c431)[_0x1c8d('0x21')](function(_0x4c00b3){return _0x4c00b3;});}return null;};}function removeEntity(_0x35ae3b,_0x20820d){return function(_0x198504){if(_0x198504){return _0x198504[_0x1c8d('0x37')]()['then'](function(){_0x35ae3b[_0x1c8d('0x2d')](0xcc)[_0x1c8d('0x2c')]();});}};}function handleEntityNotFound(_0x4fb7c9,_0x3b3757){return function(_0x8d43ac){if(!_0x8d43ac){_0x4fb7c9[_0x1c8d('0x38')](0x194);}return _0x8d43ac;};}function handleError(_0x4dbb28,_0x14ef7b){_0x14ef7b=_0x14ef7b||0x1f4;return function(_0x38b9e1){logger['error'](_0x38b9e1[_0x1c8d('0x39')]);if(_0x38b9e1[_0x1c8d('0x3a')]){delete _0x38b9e1['name'];}_0x4dbb28[_0x1c8d('0x2d')](_0x14ef7b)['send'](_0x38b9e1);};}exports[_0x1c8d('0x3b')]=function(_0x3d79a8,_0x559ea1){var _0x42c0d3={},_0x6f9b24={},_0x412006={'count':0x0,'rows':[]};var _0x9436f7=_['map'](db['SalesforceConfiguration']['rawAttributes'],function(_0x5a033b){return{'name':_0x5a033b['fieldName'],'type':_0x5a033b[_0x1c8d('0x3c')]['key']};});_0x6f9b24[_0x1c8d('0x3d')]=_[_0x1c8d('0x3e')](_0x9436f7,_0x1c8d('0x3a'));_0x6f9b24['query']=_[_0x1c8d('0x3f')](_0x3d79a8[_0x1c8d('0x40')]);_0x6f9b24[_0x1c8d('0x41')]=_[_0x1c8d('0x42')](_0x6f9b24[_0x1c8d('0x3d')],_0x6f9b24['query']);_0x42c0d3[_0x1c8d('0x43')]=_['intersection'](_0x6f9b24[_0x1c8d('0x3d')],qs[_0x1c8d('0x44')](_0x3d79a8['query'][_0x1c8d('0x44')]));_0x42c0d3[_0x1c8d('0x43')]=_0x42c0d3[_0x1c8d('0x43')][_0x1c8d('0x45')]?_0x42c0d3[_0x1c8d('0x43')]:_0x6f9b24[_0x1c8d('0x3d')];if(!_0x3d79a8[_0x1c8d('0x40')][_0x1c8d('0x46')]('nolimit')){_0x42c0d3[_0x1c8d('0x30')]=qs['limit'](_0x3d79a8[_0x1c8d('0x40')][_0x1c8d('0x30')]);_0x42c0d3[_0x1c8d('0x2f')]=qs[_0x1c8d('0x2f')](_0x3d79a8[_0x1c8d('0x40')][_0x1c8d('0x2f')]);}_0x42c0d3[_0x1c8d('0x47')]=qs[_0x1c8d('0x48')](_0x3d79a8[_0x1c8d('0x40')]['sort']);_0x42c0d3['where']=qs[_0x1c8d('0x41')](_[_0x1c8d('0x49')](_0x3d79a8[_0x1c8d('0x40')],_0x6f9b24[_0x1c8d('0x41')]),_0x9436f7);if(_0x3d79a8['query'][_0x1c8d('0x4a')]){_0x42c0d3[_0x1c8d('0x4b')]=_['merge'](_0x42c0d3[_0x1c8d('0x4b')],{'$or':_[_0x1c8d('0x3e')](_0x9436f7,function(_0x12efb4){if(_0x12efb4['type']!==_0x1c8d('0x4c')){var _0x374930={};_0x374930[_0x12efb4[_0x1c8d('0x3a')]]={'$like':'%'+_0x3d79a8['query'][_0x1c8d('0x4a')]+'%'};return _0x374930;}})});}_0x42c0d3=_['merge']({},_0x42c0d3,_0x3d79a8['options']);var _0x46e90f={'where':_0x42c0d3[_0x1c8d('0x4b')]};return db['SalesforceConfiguration'][_0x1c8d('0x2e')](_0x46e90f)[_0x1c8d('0x21')](function(_0x4d615f){_0x412006[_0x1c8d('0x2e')]=_0x4d615f;if(_0x3d79a8[_0x1c8d('0x40')][_0x1c8d('0x4d')]){_0x42c0d3['include']=[{'all':!![]}];}return db[_0x1c8d('0x4e')][_0x1c8d('0x4f')](_0x42c0d3);})[_0x1c8d('0x21')](function(_0x527bae){_0x412006[_0x1c8d('0x50')]=_0x527bae;return _0x412006;})['then'](respondWithFilteredResult(_0x559ea1,_0x42c0d3))['catch'](handleError(_0x559ea1,null));};exports[_0x1c8d('0x51')]=function(_0x23aea9,_0x1a5c12){var _0x31ca41={'raw':![],'where':{'id':_0x23aea9['params']['id']}},_0x3b981d={};_0x3b981d['model']=_[_0x1c8d('0x3f')](db[_0x1c8d('0x4e')][_0x1c8d('0x52')]);_0x3b981d['query']=_[_0x1c8d('0x3f')](_0x23aea9[_0x1c8d('0x40')]);_0x3b981d[_0x1c8d('0x41')]=_[_0x1c8d('0x42')](_0x3b981d['model'],_0x3b981d[_0x1c8d('0x40')]);_0x31ca41['attributes']=_[_0x1c8d('0x42')](_0x3b981d[_0x1c8d('0x3d')],qs[_0x1c8d('0x44')](_0x23aea9[_0x1c8d('0x40')][_0x1c8d('0x44')]));_0x31ca41['attributes']=_0x31ca41['attributes'][_0x1c8d('0x45')]?_0x31ca41[_0x1c8d('0x43')]:_0x3b981d[_0x1c8d('0x3d')];if(_0x23aea9[_0x1c8d('0x40')][_0x1c8d('0x4d')]){_0x31ca41[_0x1c8d('0x53')]=[{'all':!![]}];}_0x31ca41=_['merge']({},_0x31ca41,_0x23aea9[_0x1c8d('0x54')]);return db[_0x1c8d('0x4e')][_0x1c8d('0x55')](_0x31ca41)[_0x1c8d('0x21')](handleEntityNotFound(_0x1a5c12,null))[_0x1c8d('0x21')](respondWithResult(_0x1a5c12,null))['catch'](handleError(_0x1a5c12,null));};exports[_0x1c8d('0x56')]=function(_0x52836c,_0x11315f){return db[_0x1c8d('0x4e')][_0x1c8d('0x56')](_0x52836c['body'],{})[_0x1c8d('0x21')](respondWithResult(_0x11315f,0xc9))[_0x1c8d('0x2b')](handleError(_0x11315f,null));};exports[_0x1c8d('0x57')]=function(_0x23cd1f,_0x4e01c){if(_0x23cd1f[_0x1c8d('0x58')]['id']){delete _0x23cd1f[_0x1c8d('0x58')]['id'];}return db[_0x1c8d('0x4e')]['find']({'where':{'id':_0x23cd1f[_0x1c8d('0x59')]['id']}})[_0x1c8d('0x21')](handleEntityNotFound(_0x4e01c,null))[_0x1c8d('0x21')](saveUpdates(_0x23cd1f[_0x1c8d('0x58')],null))[_0x1c8d('0x21')](respondWithResult(_0x4e01c,null))[_0x1c8d('0x2b')](handleError(_0x4e01c,null));};exports[_0x1c8d('0x37')]=function(_0x5b1085,_0x4d155a){return db[_0x1c8d('0x4e')][_0x1c8d('0x55')]({'where':{'id':_0x5b1085[_0x1c8d('0x59')]['id']}})[_0x1c8d('0x21')](handleEntityNotFound(_0x4d155a,null))['then'](removeEntity(_0x4d155a,null))['catch'](handleError(_0x4d155a,null));};exports[_0x1c8d('0x5a')]=function(_0x23e691,_0x136989,_0x3f8a90){var _0x5f4ac1={};var _0x4ad685={};var _0x994344;var _0x55ce56;return db[_0x1c8d('0x4e')][_0x1c8d('0x5b')]({'where':{'id':_0x23e691[_0x1c8d('0x59')]['id']}})[_0x1c8d('0x21')](handleEntityNotFound(_0x136989,null))[_0x1c8d('0x21')](function(_0x4fdcf6){if(_0x4fdcf6){_0x994344=_0x4fdcf6;_0x4ad685[_0x1c8d('0x3d')]=_[_0x1c8d('0x3f')](db['SalesforceField']['rawAttributes']);_0x4ad685['query']=_['keys'](_0x23e691[_0x1c8d('0x40')]);_0x4ad685[_0x1c8d('0x41')]=_[_0x1c8d('0x42')](_0x4ad685[_0x1c8d('0x3d')],_0x4ad685['query']);_0x5f4ac1[_0x1c8d('0x43')]=_[_0x1c8d('0x42')](_0x4ad685[_0x1c8d('0x3d')],qs[_0x1c8d('0x44')](_0x23e691[_0x1c8d('0x40')][_0x1c8d('0x44')]));_0x5f4ac1[_0x1c8d('0x43')]=_0x5f4ac1['attributes'][_0x1c8d('0x45')]?_0x5f4ac1[_0x1c8d('0x43')]:_0x4ad685['model'];_0x5f4ac1[_0x1c8d('0x47')]=qs[_0x1c8d('0x48')](_0x23e691[_0x1c8d('0x40')][_0x1c8d('0x48')]);_0x5f4ac1[_0x1c8d('0x4b')]=qs[_0x1c8d('0x41')](_[_0x1c8d('0x49')](_0x23e691[_0x1c8d('0x40')],_0x4ad685[_0x1c8d('0x41')]));if(_0x23e691[_0x1c8d('0x40')][_0x1c8d('0x4a')]){_0x5f4ac1[_0x1c8d('0x4b')]=_[_0x1c8d('0x5c')](_0x5f4ac1[_0x1c8d('0x4b')],{'$or':_[_0x1c8d('0x3e')](_0x5f4ac1[_0x1c8d('0x43')],function(_0x31c6f7){var _0x4394e1={};_0x4394e1[_0x31c6f7]={'$like':'%'+_0x23e691['query']['filter']+'%'};return _0x4394e1;})});}_0x5f4ac1=_[_0x1c8d('0x5c')]({},_0x5f4ac1,_0x23e691[_0x1c8d('0x54')]);return _0x994344[_0x1c8d('0x5a')](_0x5f4ac1);}})['then'](function(_0x21a8ee){if(_0x21a8ee){_0x55ce56=_0x21a8ee[_0x1c8d('0x45')];if(!_0x23e691[_0x1c8d('0x40')]['hasOwnProperty'](_0x1c8d('0x5d'))){_0x5f4ac1['limit']=qs[_0x1c8d('0x30')](_0x23e691[_0x1c8d('0x40')][_0x1c8d('0x30')]);_0x5f4ac1[_0x1c8d('0x2f')]=qs[_0x1c8d('0x2f')](_0x23e691[_0x1c8d('0x40')][_0x1c8d('0x2f')]);}return _0x994344[_0x1c8d('0x5a')](_0x5f4ac1);}})[_0x1c8d('0x21')](function(_0x3b9a0c){if(_0x3b9a0c){return _0x3b9a0c?{'count':_0x55ce56,'rows':_0x3b9a0c}:null;}})[_0x1c8d('0x21')](respondWithResult(_0x136989,null))[_0x1c8d('0x2b')](handleError(_0x136989,null));};exports['getSubjects']=function(_0x9b430c,_0x3443c7,_0x50b335){var _0x1c6344={};var _0xd2361b={};var _0x23836d;var _0x49e207;return db[_0x1c8d('0x4e')]['findOne']({'where':{'id':_0x9b430c[_0x1c8d('0x59')]['id']}})[_0x1c8d('0x21')](handleEntityNotFound(_0x3443c7,null))[_0x1c8d('0x21')](function(_0x4f43cb){if(_0x4f43cb){_0x23836d=_0x4f43cb;_0xd2361b['model']=_[_0x1c8d('0x3f')](db[_0x1c8d('0x5e')][_0x1c8d('0x52')]);_0xd2361b[_0x1c8d('0x40')]=_['keys'](_0x9b430c[_0x1c8d('0x40')]);_0xd2361b['filters']=_[_0x1c8d('0x42')](_0xd2361b[_0x1c8d('0x3d')],_0xd2361b[_0x1c8d('0x40')]);_0x1c6344[_0x1c8d('0x43')]=_[_0x1c8d('0x42')](_0xd2361b[_0x1c8d('0x3d')],qs['fields'](_0x9b430c['query'][_0x1c8d('0x44')]));_0x1c6344[_0x1c8d('0x43')]=_0x1c6344[_0x1c8d('0x43')][_0x1c8d('0x45')]?_0x1c6344[_0x1c8d('0x43')]:_0xd2361b[_0x1c8d('0x3d')];_0x1c6344[_0x1c8d('0x47')]=qs[_0x1c8d('0x48')](_0x9b430c['query'][_0x1c8d('0x48')]);_0x1c6344[_0x1c8d('0x4b')]=qs['filters'](_['pick'](_0x9b430c[_0x1c8d('0x40')],_0xd2361b[_0x1c8d('0x41')]));if(_0x9b430c[_0x1c8d('0x40')][_0x1c8d('0x4a')]){_0x1c6344[_0x1c8d('0x4b')]=_[_0x1c8d('0x5c')](_0x1c6344[_0x1c8d('0x4b')],{'$or':_[_0x1c8d('0x3e')](_0x1c6344[_0x1c8d('0x43')],function(_0x40b9c8){var _0x386dcc={};_0x386dcc[_0x40b9c8]={'$like':'%'+_0x9b430c[_0x1c8d('0x40')][_0x1c8d('0x4a')]+'%'};return _0x386dcc;})});}_0x1c6344=_[_0x1c8d('0x5c')]({},_0x1c6344,_0x9b430c[_0x1c8d('0x54')]);return _0x23836d[_0x1c8d('0x5f')](_0x1c6344);}})[_0x1c8d('0x21')](function(_0x1a4ff3){if(_0x1a4ff3){_0x49e207=_0x1a4ff3['length'];if(!_0x9b430c['query'][_0x1c8d('0x46')]('nolimit')){_0x1c6344['limit']=qs[_0x1c8d('0x30')](_0x9b430c[_0x1c8d('0x40')]['limit']);_0x1c6344[_0x1c8d('0x2f')]=qs[_0x1c8d('0x2f')](_0x9b430c[_0x1c8d('0x40')]['offset']);}return _0x23836d[_0x1c8d('0x5f')](_0x1c6344);}})['then'](function(_0x3be5c3){if(_0x3be5c3){return _0x3be5c3?{'count':_0x49e207,'rows':_0x3be5c3}:null;}})['then'](respondWithResult(_0x3443c7,null))[_0x1c8d('0x2b')](handleError(_0x3443c7,null));};exports['getDescriptions']=function(_0x6ab534,_0x4486c7,_0x484898){var _0x1ff19b={};var _0x2e3754={};var _0x35c90f;var _0x2d7701;return db['SalesforceConfiguration'][_0x1c8d('0x5b')]({'where':{'id':_0x6ab534[_0x1c8d('0x59')]['id']}})[_0x1c8d('0x21')](handleEntityNotFound(_0x4486c7,null))[_0x1c8d('0x21')](function(_0x2975b5){if(_0x2975b5){_0x35c90f=_0x2975b5;_0x2e3754[_0x1c8d('0x3d')]=_[_0x1c8d('0x3f')](db[_0x1c8d('0x5e')][_0x1c8d('0x52')]);_0x2e3754[_0x1c8d('0x40')]=_['keys'](_0x6ab534[_0x1c8d('0x40')]);_0x2e3754[_0x1c8d('0x41')]=_[_0x1c8d('0x42')](_0x2e3754['model'],_0x2e3754[_0x1c8d('0x40')]);_0x1ff19b['attributes']=_['intersection'](_0x2e3754['model'],qs[_0x1c8d('0x44')](_0x6ab534[_0x1c8d('0x40')][_0x1c8d('0x44')]));_0x1ff19b[_0x1c8d('0x43')]=_0x1ff19b[_0x1c8d('0x43')][_0x1c8d('0x45')]?_0x1ff19b[_0x1c8d('0x43')]:_0x2e3754[_0x1c8d('0x3d')];_0x1ff19b[_0x1c8d('0x47')]=qs[_0x1c8d('0x48')](_0x6ab534[_0x1c8d('0x40')][_0x1c8d('0x48')]);_0x1ff19b[_0x1c8d('0x4b')]=qs[_0x1c8d('0x41')](_['pick'](_0x6ab534['query'],_0x2e3754[_0x1c8d('0x41')]));if(_0x6ab534[_0x1c8d('0x40')][_0x1c8d('0x4a')]){_0x1ff19b[_0x1c8d('0x4b')]=_[_0x1c8d('0x5c')](_0x1ff19b[_0x1c8d('0x4b')],{'$or':_[_0x1c8d('0x3e')](_0x1ff19b[_0x1c8d('0x43')],function(_0x25b327){var _0x4c5d61={};_0x4c5d61[_0x25b327]={'$like':'%'+_0x6ab534[_0x1c8d('0x40')][_0x1c8d('0x4a')]+'%'};return _0x4c5d61;})});}_0x1ff19b=_[_0x1c8d('0x5c')]({},_0x1ff19b,_0x6ab534[_0x1c8d('0x54')]);return _0x35c90f[_0x1c8d('0x60')](_0x1ff19b);}})['then'](function(_0x533bc0){if(_0x533bc0){_0x2d7701=_0x533bc0['length'];if(!_0x6ab534[_0x1c8d('0x40')][_0x1c8d('0x46')]('nolimit')){_0x1ff19b[_0x1c8d('0x30')]=qs[_0x1c8d('0x30')](_0x6ab534['query']['limit']);_0x1ff19b[_0x1c8d('0x2f')]=qs['offset'](_0x6ab534[_0x1c8d('0x40')]['offset']);}return _0x35c90f[_0x1c8d('0x60')](_0x1ff19b);}})[_0x1c8d('0x21')](function(_0x370184){if(_0x370184){return _0x370184?{'count':_0x2d7701,'rows':_0x370184}:null;}})['then'](respondWithResult(_0x4486c7,null))['catch'](handleError(_0x4486c7,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index d693e02..a4cc954 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 _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 +var _0x8586=['define','int_salesforce_configurations','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x572e14,_0x3618ce){var _0x4715d1=function(_0x4723dd){while(--_0x4723dd){_0x572e14['push'](_0x572e14['shift']());}};_0x4715d1(++_0x3618ce);}(_0x8586,0x124));var _0x6858=function(_0x41382c,_0xc3ffd1){_0x41382c=_0x41382c-0x0;var _0x4da35b=_0x8586[_0x41382c];return _0x4da35b;};'use strict';var _=require('lodash');var util=require(_0x6858('0x0'));var logger=require(_0x6858('0x1'))(_0x6858('0x2'));var moment=require(_0x6858('0x3'));var BPromise=require('bluebird');var rp=require(_0x6858('0x4'));var fs=require('fs');var path=require(_0x6858('0x5'));var rimraf=require('rimraf');var config=require(_0x6858('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x6858('0x7')]=function(_0x9640ed,_0x54ec31){return _0x9640ed[_0x6858('0x8')]('SalesforceConfiguration',attributes,{'tableName':_0x6858('0x9'),'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 fce3ea8..15769f7 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 _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 +var _0x9c7a=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result'];(function(_0x322719,_0x16b381){var _0x30cb6f=function(_0x1e5698){while(--_0x1e5698){_0x322719['push'](_0x322719['shift']());}};_0x30cb6f(++_0x16b381);}(_0x9c7a,0x18c));var _0xa9c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c7a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa9c7('0x0'));var util=require(_0xa9c7('0x1'));var moment=require(_0xa9c7('0x2'));var BPromise=require('bluebird');var rs=require(_0xa9c7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa9c7('0x4'))['db'];var utils=require(_0xa9c7('0x5'));var logger=require(_0xa9c7('0x6'))(_0xa9c7('0x7'));var config=require(_0xa9c7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa9c7('0x9')][_0xa9c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc112af,_0x35b7f4,_0x4e0e25){return new BPromise(function(_0x11b0e1,_0x1af024){return client[_0xa9c7('0xb')](_0xc112af,_0x4e0e25)[_0xa9c7('0xc')](function(_0x1d633f){logger[_0xa9c7('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x35b7f4,'request\x20sent');logger[_0xa9c7('0xe')](_0xa9c7('0xf'),_0x35b7f4,_0xa9c7('0x10'),JSON['stringify'](_0x1d633f));if(_0x1d633f[_0xa9c7('0x11')]){if(_0x1d633f[_0xa9c7('0x11')][_0xa9c7('0x12')]===0x1f4){logger[_0xa9c7('0x11')](_0xa9c7('0x13'),_0x35b7f4,_0x1d633f[_0xa9c7('0x11')]['message']);return _0x1af024(_0x1d633f[_0xa9c7('0x11')][_0xa9c7('0x14')]);}logger['error'](_0xa9c7('0x13'),_0x35b7f4,_0x1d633f['error'][_0xa9c7('0x14')]);return _0x11b0e1(_0x1d633f[_0xa9c7('0x11')][_0xa9c7('0x14')]);}else{logger[_0xa9c7('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x35b7f4,'request\x20sent');_0x11b0e1(_0x1d633f[_0xa9c7('0x15')][_0xa9c7('0x14')]);}})['catch'](function(_0x4deabb){logger[_0xa9c7('0x11')](_0xa9c7('0x13'),_0x35b7f4,_0x4deabb);_0x1af024(_0x4deabb);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index da5ebd3..3b81ec2 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 _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 +var _0xa6b0=['../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x547fd7,_0x4a6c18){_0x547fd7=_0x547fd7-0x0;var _0x24bed7=_0xa6b0[_0x547fd7];return _0x24bed7;};'use strict';var multer=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a6b('0x2'));var router=express[_0x0a6b('0x3')]();var auth=require(_0x0a6b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0a6b('0x5'));var controller=require(_0x0a6b('0x6'));router[_0x0a6b('0x7')]('/',auth[_0x0a6b('0x8')](),controller[_0x0a6b('0x9')]);router[_0x0a6b('0x7')](_0x0a6b('0xa'),auth[_0x0a6b('0x8')](),controller[_0x0a6b('0xb')]);router[_0x0a6b('0xc')]('/',auth[_0x0a6b('0x8')](),controller[_0x0a6b('0xd')]);router['put']('/:id',auth[_0x0a6b('0x8')](),controller[_0x0a6b('0xe')]);router[_0x0a6b('0xf')](_0x0a6b('0xa'),auth[_0x0a6b('0x8')](),controller[_0x0a6b('0x10')]);module[_0x0a6b('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 dd719f0..e1f9afa 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 _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 +var _0x7c3a=['ENUM','string','variable','keyValue','STRING','customVariable','sequelize','exports'];(function(_0x1eca3b,_0x2a648c){var _0x30d1af=function(_0x16a5aa){while(--_0x16a5aa){_0x1eca3b['push'](_0x1eca3b['shift']());}};_0x30d1af(++_0x2a648c);}(_0x7c3a,0x16e));var _0xa7c3=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0x7c3a[_0x292f93];return _0x5a94b1;};'use strict';var Sequelize=require(_0xa7c3('0x0'));module[_0xa7c3('0x1')]={'type':{'type':Sequelize[_0xa7c3('0x2')](_0xa7c3('0x3'),_0xa7c3('0x4'),'customVariable',_0xa7c3('0x5')),'defaultValue':_0xa7c3('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa7c3('0x6')]},'keyType':{'type':Sequelize[_0xa7c3('0x2')](_0xa7c3('0x3'),_0xa7c3('0x4'),_0xa7c3('0x7'))},'keyContent':{'type':Sequelize[_0xa7c3('0x6')]},'idField':{'type':Sequelize[_0xa7c3('0x6')]},'variableName':{'type':Sequelize[_0xa7c3('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index da2b3ee..8a24fed 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 _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 +var _0x7ac3=['show','keys','include','find','catch','create','body','params','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','Content-Range','apply','then','destroy','error','stack','name','SalesforceField','key','model','map','filters','query','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll'];(function(_0x25ceab,_0x4b9c34){var _0x360db6=function(_0x25c904){while(--_0x25c904){_0x25ceab['push'](_0x25ceab['shift']());}};_0x360db6(++_0x4b9c34);}(_0x7ac3,0x1cf));var _0x37ac=function(_0x1ace66,_0x46d682){_0x1ace66=_0x1ace66-0x0;var _0x262563=_0x7ac3[_0x1ace66];return _0x262563;};'use strict';var pdf=require(_0x37ac('0x0'));var emlformat=require(_0x37ac('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x37ac('0x2'));var rp=require(_0x37ac('0x3'));var moment=require(_0x37ac('0x4'));var BPromise=require(_0x37ac('0x5'));var Mustache=require('mustache');var util=require(_0x37ac('0x6'));var path=require(_0x37ac('0x7'));var sox=require(_0x37ac('0x8'));var csv=require(_0x37ac('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x37ac('0xa'));var squel=require('squel');var crypto=require(_0x37ac('0xb'));var jsforce=require(_0x37ac('0xc'));var deskjs=require(_0x37ac('0xd'));var toCsv=require(_0x37ac('0x9'));var querystring=require(_0x37ac('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x37ac('0xf'));var qs=require(_0x37ac('0x10'));var as=require(_0x37ac('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x37ac('0x12'));var utils=require(_0x37ac('0x13'));var config=require(_0x37ac('0x14'));var licenseUtil=require(_0x37ac('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe115c3,_0x427c32){_0x427c32=_0x427c32||0xcc;return function(_0x3e914c){if(_0x3e914c){return _0xe115c3[_0x37ac('0x16')](_0x427c32);}return _0xe115c3[_0x37ac('0x17')](_0x427c32)[_0x37ac('0x18')]();};}function respondWithResult(_0x4ab309,_0x397b85){_0x397b85=_0x397b85||0xc8;return function(_0x5cf50d){if(_0x5cf50d){return _0x4ab309[_0x37ac('0x17')](_0x397b85)[_0x37ac('0x19')](_0x5cf50d);}};}function respondWithFilteredResult(_0x450073,_0x5b88c3){return function(_0x411b8d){if(_0x411b8d){var _0x155bb4=_0x411b8d['count'],_0x1c9e3f=_0x5b88c3[_0x37ac('0x1a')],_0x58190c=_0x5b88c3[_0x37ac('0x1a')]+_0x5b88c3[_0x37ac('0x1b')],_0x5e4ab6;if(_0x58190c>=_0x155bb4){_0x58190c=_0x155bb4;_0x5e4ab6=0xc8;}else{_0x5e4ab6=0xce;}_0x450073[_0x37ac('0x17')](_0x5e4ab6);return _0x450073['set'](_0x37ac('0x1c'),_0x1c9e3f+'-'+_0x58190c+'/'+_0x155bb4)[_0x37ac('0x19')](_0x411b8d);}return null;};}function patchUpdates(_0x16fd6c){return function(_0x234af6){try{jsonpatch[_0x37ac('0x1d')](_0x234af6,_0x16fd6c,!![]);}catch(_0x228352){return BPromise['reject'](_0x228352);}return _0x234af6['save']();};}function saveUpdates(_0x3defa9,_0x5c6149){return function(_0x615e){if(_0x615e){return _0x615e['update'](_0x3defa9)[_0x37ac('0x1e')](function(_0x1210c4){return _0x1210c4;});}return null;};}function removeEntity(_0x3f5ef6,_0x198176){return function(_0x3ba195){if(_0x3ba195){return _0x3ba195[_0x37ac('0x1f')]()[_0x37ac('0x1e')](function(){_0x3f5ef6[_0x37ac('0x17')](0xcc)[_0x37ac('0x18')]();});}};}function handleEntityNotFound(_0x20a56c,_0x1cda60){return function(_0x3e5b95){if(!_0x3e5b95){_0x20a56c[_0x37ac('0x16')](0x194);}return _0x3e5b95;};}function handleError(_0x39812e,_0x26a7bc){_0x26a7bc=_0x26a7bc||0x1f4;return function(_0x4eb39c){logger[_0x37ac('0x20')](_0x4eb39c[_0x37ac('0x21')]);if(_0x4eb39c[_0x37ac('0x22')]){delete _0x4eb39c[_0x37ac('0x22')];}_0x39812e[_0x37ac('0x17')](_0x26a7bc)['send'](_0x4eb39c);};}exports['index']=function(_0x494754,_0x59a2d5){var _0x27adc1={},_0x238029={},_0x5913f6={'count':0x0,'rows':[]};var _0x32ce73=_['map'](db[_0x37ac('0x23')]['rawAttributes'],function(_0x1e658b){return{'name':_0x1e658b['fieldName'],'type':_0x1e658b['type'][_0x37ac('0x24')]};});_0x238029[_0x37ac('0x25')]=_[_0x37ac('0x26')](_0x32ce73,_0x37ac('0x22'));_0x238029['query']=_['keys'](_0x494754['query']);_0x238029[_0x37ac('0x27')]=_['intersection'](_0x238029['model'],_0x238029[_0x37ac('0x28')]);_0x27adc1[_0x37ac('0x29')]=_[_0x37ac('0x2a')](_0x238029[_0x37ac('0x25')],qs['fields'](_0x494754[_0x37ac('0x28')][_0x37ac('0x2b')]));_0x27adc1[_0x37ac('0x29')]=_0x27adc1[_0x37ac('0x29')][_0x37ac('0x2c')]?_0x27adc1[_0x37ac('0x29')]:_0x238029[_0x37ac('0x25')];if(!_0x494754['query']['hasOwnProperty'](_0x37ac('0x2d'))){_0x27adc1[_0x37ac('0x1b')]=qs[_0x37ac('0x1b')](_0x494754[_0x37ac('0x28')][_0x37ac('0x1b')]);_0x27adc1['offset']=qs[_0x37ac('0x1a')](_0x494754['query'][_0x37ac('0x1a')]);}_0x27adc1[_0x37ac('0x2e')]=qs[_0x37ac('0x2f')](_0x494754[_0x37ac('0x28')]['sort']);_0x27adc1[_0x37ac('0x30')]=qs[_0x37ac('0x27')](_[_0x37ac('0x31')](_0x494754[_0x37ac('0x28')],_0x238029[_0x37ac('0x27')]),_0x32ce73);if(_0x494754[_0x37ac('0x28')][_0x37ac('0x32')]){_0x27adc1['where']=_[_0x37ac('0x33')](_0x27adc1['where'],{'$or':_[_0x37ac('0x26')](_0x32ce73,function(_0xed8253){if(_0xed8253['type']!==_0x37ac('0x34')){var _0x25b31d={};_0x25b31d[_0xed8253[_0x37ac('0x22')]]={'$like':'%'+_0x494754[_0x37ac('0x28')]['filter']+'%'};return _0x25b31d;}})});}_0x27adc1=_[_0x37ac('0x33')]({},_0x27adc1,_0x494754[_0x37ac('0x35')]);var _0x33f1c0={'where':_0x27adc1[_0x37ac('0x30')]};return db[_0x37ac('0x23')]['count'](_0x33f1c0)[_0x37ac('0x1e')](function(_0x437f7b){_0x5913f6[_0x37ac('0x36')]=_0x437f7b;if(_0x494754['query'][_0x37ac('0x37')]){_0x27adc1['include']=[{'all':!![]}];}return db[_0x37ac('0x23')][_0x37ac('0x38')](_0x27adc1);})['then'](function(_0x18630b){_0x5913f6['rows']=_0x18630b;return _0x5913f6;})[_0x37ac('0x1e')](respondWithFilteredResult(_0x59a2d5,_0x27adc1))['catch'](handleError(_0x59a2d5,null));};exports[_0x37ac('0x39')]=function(_0x41c234,_0x18f11b){var _0x5e0b94={'raw':!![],'where':{'id':_0x41c234['params']['id']}},_0x10ffc2={};_0x10ffc2['model']=_[_0x37ac('0x3a')](db[_0x37ac('0x23')]['rawAttributes']);_0x10ffc2[_0x37ac('0x28')]=_['keys'](_0x41c234[_0x37ac('0x28')]);_0x10ffc2['filters']=_[_0x37ac('0x2a')](_0x10ffc2['model'],_0x10ffc2[_0x37ac('0x28')]);_0x5e0b94[_0x37ac('0x29')]=_[_0x37ac('0x2a')](_0x10ffc2['model'],qs[_0x37ac('0x2b')](_0x41c234[_0x37ac('0x28')]['fields']));_0x5e0b94[_0x37ac('0x29')]=_0x5e0b94[_0x37ac('0x29')][_0x37ac('0x2c')]?_0x5e0b94['attributes']:_0x10ffc2['model'];if(_0x41c234[_0x37ac('0x28')]['includeAll']){_0x5e0b94[_0x37ac('0x3b')]=[{'all':!![]}];}_0x5e0b94=_[_0x37ac('0x33')]({},_0x5e0b94,_0x41c234['options']);return db['SalesforceField'][_0x37ac('0x3c')](_0x5e0b94)[_0x37ac('0x1e')](handleEntityNotFound(_0x18f11b,null))[_0x37ac('0x1e')](respondWithResult(_0x18f11b,null))[_0x37ac('0x3d')](handleError(_0x18f11b,null));};exports[_0x37ac('0x3e')]=function(_0x326b4d,_0x4c3137){return db[_0x37ac('0x23')][_0x37ac('0x3e')](_0x326b4d[_0x37ac('0x3f')],{})[_0x37ac('0x1e')](respondWithResult(_0x4c3137,0xc9))['catch'](handleError(_0x4c3137,null));};exports['update']=function(_0x3e911e,_0x716929){if(_0x3e911e['body']['id']){delete _0x3e911e[_0x37ac('0x3f')]['id'];}return db[_0x37ac('0x23')][_0x37ac('0x3c')]({'where':{'id':_0x3e911e[_0x37ac('0x40')]['id']}})[_0x37ac('0x1e')](handleEntityNotFound(_0x716929,null))['then'](saveUpdates(_0x3e911e[_0x37ac('0x3f')],null))['then'](respondWithResult(_0x716929,null))[_0x37ac('0x3d')](handleError(_0x716929,null));};exports[_0x37ac('0x1f')]=function(_0x494472,_0x1b4f85){return db[_0x37ac('0x23')][_0x37ac('0x3c')]({'where':{'id':_0x494472[_0x37ac('0x40')]['id']}})[_0x37ac('0x1e')](handleEntityNotFound(_0x1b4f85,null))['then'](removeEntity(_0x1b4f85,null))[_0x37ac('0x3d')](handleError(_0x1b4f85,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index fc1eb88..ec727b6 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 _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 +var _0xa28b=['bluebird','request-promise','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','salesforce_unique_index','FieldId','lodash','util','../../config/logger','api'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xa28b,0x1dc));var _0xba28=function(_0x38129f,_0x502c91){_0x38129f=_0x38129f-0x0;var _0x3f1890=_0xa28b[_0x38129f];return _0x3f1890;};'use strict';var _=require(_0xba28('0x0'));var util=require(_0xba28('0x1'));var logger=require(_0xba28('0x2'))(_0xba28('0x3'));var moment=require('moment');var BPromise=require(_0xba28('0x4'));var rp=require(_0xba28('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xba28('0x6'));var attributes=require(_0xba28('0x7'));module[_0xba28('0x8')]=function(_0xb907d1,_0x23d641){return _0xb907d1['define'](_0xba28('0x9'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xba28('0xa'),'fields':['idField',_0xba28('0xb')],'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 a5309a0..0d8dc8a 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 _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 +var _0xb4e6=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4730bd,_0x1e9541){var _0x1b2849=function(_0x1fc5a8){while(--_0x1fc5a8){_0x4730bd['push'](_0x4730bd['shift']());}};_0x1b2849(++_0x1e9541);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x1fb4e1,_0x3d4ce6){_0x1fb4e1=_0x1fb4e1-0x0;var _0x22d1b0=_0xb4e6[_0x1fb4e1];return _0x22d1b0;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var moment=require(_0x6b4e('0x1'));var BPromise=require(_0x6b4e('0x2'));var rs=require(_0x6b4e('0x3'));var fs=require('fs');var Redis=require(_0x6b4e('0x4'));var db=require(_0x6b4e('0x5'))['db'];var utils=require(_0x6b4e('0x6'));var logger=require(_0x6b4e('0x7'))('rpc');var config=require(_0x6b4e('0x8'));var jayson=require(_0x6b4e('0x9'));var client=jayson[_0x6b4e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd3138f,_0x570346,_0x4f00be){return new BPromise(function(_0x2311d9,_0x48c870){return client['request'](_0xd3138f,_0x4f00be)[_0x6b4e('0xb')](function(_0x2bd576){logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));logger[_0x6b4e('0xf')](_0x6b4e('0x10'),_0x570346,'request\x20sent',JSON[_0x6b4e('0x11')](_0x2bd576));if(_0x2bd576[_0x6b4e('0x12')]){if(_0x2bd576['error'][_0x6b4e('0x13')]===0x1f4){logger[_0x6b4e('0x12')](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);return _0x48c870(_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);}logger['error'](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')]['message']);return _0x2311d9(_0x2bd576[_0x6b4e('0x12')]['message']);}else{logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));_0x2311d9(_0x2bd576[_0x6b4e('0x15')][_0x6b4e('0x14')]);}})[_0x6b4e('0x16')](function(_0x53a934){logger['error'](_0x6b4e('0xd'),_0x570346,_0x53a934);_0x48c870(_0x53a934);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 39ed428..ab4da74 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 _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 +var _0x5c96=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','delete','destroy','multer'];(function(_0x17543f,_0x34a3aa){var _0x479c57=function(_0x10207e){while(--_0x10207e){_0x17543f['push'](_0x17543f['shift']());}};_0x479c57(++_0x34a3aa);}(_0x5c96,0x133));var _0x65c9=function(_0x3b76b2,_0x5ae624){_0x3b76b2=_0x3b76b2-0x0;var _0x540f4f=_0x5c96[_0x3b76b2];return _0x540f4f;};'use strict';var multer=require(_0x65c9('0x0'));var util=require(_0x65c9('0x1'));var path=require(_0x65c9('0x2'));var timeout=require(_0x65c9('0x3'));var express=require('express');var router=express[_0x65c9('0x4')]();var auth=require(_0x65c9('0x5'));var interaction=require(_0x65c9('0x6'));var config=require(_0x65c9('0x7'));var controller=require(_0x65c9('0x8'));router[_0x65c9('0x9')]('/',auth[_0x65c9('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x65c9('0xb')]);router[_0x65c9('0x9')](_0x65c9('0xc'),auth['isAuthenticated'](),controller[_0x65c9('0xd')]);router[_0x65c9('0x9')](_0x65c9('0xe'),auth[_0x65c9('0xa')](),controller[_0x65c9('0xf')]);router[_0x65c9('0x10')]('/',auth[_0x65c9('0xa')](),controller['create']);router['post']('/:id/configurations',auth[_0x65c9('0xa')](),controller[_0x65c9('0x11')]);router[_0x65c9('0x12')](_0x65c9('0x13'),auth[_0x65c9('0xa')](),controller['update']);router[_0x65c9('0x14')](_0x65c9('0x13'),auth[_0x65c9('0xa')](),controller[_0x65c9('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 8d392d7..6c9bae9 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 _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 +var _0x755a=['sequelize','STRING','remoteUri'];(function(_0x111692,_0x19f8a9){var _0x11836f=function(_0x2f2714){while(--_0x2f2714){_0x111692['push'](_0x111692['shift']());}};_0x11836f(++_0x19f8a9);}(_0x755a,0x78));var _0xa755=function(_0x1da571,_0x5383ae){_0x1da571=_0x1da571-0x0;var _0x25cf8e=_0x755a[_0x1da571];return _0x25cf8e;};'use strict';var Sequelize=require(_0xa755('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa755('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xa755('0x1')]},'email':{'type':Sequelize[_0xa755('0x1')]},'remoteUri':{'type':Sequelize[_0xa755('0x1')],'unique':_0xa755('0x2')},'serverUrl':{'type':Sequelize[_0xa755('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index a79ba9c..a46fff6 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 _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 +var _0x773a=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','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','../../components/integrations/configuration','jayson/promise','client','request','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','ServicenowAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','create','body','find','params','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','notify','incident_state','severity','category','caused_by','watch_list','sys_updated_on','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','knowledge','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','caller_id','short_description','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','urgency','problem_id','reassignment_count','activity_due','comments','approval','sys_mod_count','sys_tags','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','statusCode','Wrong\x20credentials','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf'];(function(_0x39547c,_0x4d6794){var _0xd7ef29=function(_0x239cb9){while(--_0x239cb9){_0x39547c['push'](_0x39547c['shift']());}};_0xd7ef29(++_0x4d6794);}(_0x773a,0xbe));var _0xa773=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x773a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa773('0x0'));var rimraf=require(_0xa773('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa773('0x2'));var rp=require('request-promise');var moment=require(_0xa773('0x3'));var BPromise=require(_0xa773('0x4'));var Mustache=require(_0xa773('0x5'));var util=require(_0xa773('0x6'));var path=require(_0xa773('0x7'));var sox=require(_0xa773('0x8'));var csv=require(_0xa773('0x9'));var ejs=require(_0xa773('0xa'));var fs=require('fs');var _=require(_0xa773('0xb'));var squel=require(_0xa773('0xc'));var crypto=require(_0xa773('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa773('0x9'));var querystring=require(_0xa773('0xe'));var Papa=require(_0xa773('0xf'));var Redis=require(_0xa773('0x10'));var authService=require(_0xa773('0x11'));var qs=require(_0xa773('0x12'));var as=require(_0xa773('0x13'));var hardwareService=require(_0xa773('0x14'));var logger=require(_0xa773('0x15'))(_0xa773('0x16'));var utils=require(_0xa773('0x17'));var config=require(_0xa773('0x18'));var licenseUtil=require(_0xa773('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa773('0x1a'));var jayson=require(_0xa773('0x1b'));var client=jayson[_0xa773('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x420450,_0x1a8eb3,_0x4ffa3a,_0x151386){return new BPromise(function(_0x3de3fa,_0x221f86){var _0x2c00c0=_0x151386||client;return _0x2c00c0[_0xa773('0x1d')](_0x420450,_0x4ffa3a)['then'](function(_0x453570){logger['info'](_0xa773('0x1e'),_0x1a8eb3,_0xa773('0x1f'));logger[_0xa773('0x20')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1a8eb3,'request\x20sent',JSON[_0xa773('0x21')](_0x453570));if(_0x453570[_0xa773('0x22')]){if(_0x453570[_0xa773('0x22')][_0xa773('0x23')]===0x1f4){logger['error'](_0xa773('0x1e'),_0x1a8eb3,_0x453570['error'][_0xa773('0x24')]);return _0x221f86(_0x453570['error'][_0xa773('0x24')]);}logger[_0xa773('0x22')](_0xa773('0x1e'),_0x1a8eb3,_0x453570[_0xa773('0x22')][_0xa773('0x24')]);return _0x3de3fa(_0x453570[_0xa773('0x22')][_0xa773('0x24')]);}else{logger[_0xa773('0x25')]('ServicenowAccount,\x20%s,\x20%s',_0x1a8eb3,_0xa773('0x1f'));_0x3de3fa(_0x453570[_0xa773('0x26')]['message']);}})[_0xa773('0x27')](function(_0x3170b4){logger[_0xa773('0x22')]('ServicenowAccount,\x20%s,\x20%s',_0x1a8eb3,_0x3170b4);_0x221f86(_0x3170b4);});});}function respondWithStatusCode(_0x43d21a,_0x4ff351){_0x4ff351=_0x4ff351||0xcc;return function(_0xe91392){if(_0xe91392){return _0x43d21a['sendStatus'](_0x4ff351);}return _0x43d21a[_0xa773('0x28')](_0x4ff351)['end']();};}function respondWithResult(_0x5362aa,_0x33202e){_0x33202e=_0x33202e||0xc8;return function(_0x480b60){if(_0x480b60){return _0x5362aa[_0xa773('0x28')](_0x33202e)[_0xa773('0x29')](_0x480b60);}};}function respondWithFilteredResult(_0x4a45c8,_0x4e0710){return function(_0x2f8d08){if(_0x2f8d08){var _0x119637=_0x2f8d08[_0xa773('0x2a')],_0x1c8784=_0x4e0710[_0xa773('0x2b')],_0x5d7093=_0x4e0710[_0xa773('0x2b')]+_0x4e0710[_0xa773('0x2c')],_0x408998;if(_0x5d7093>=_0x119637){_0x5d7093=_0x119637;_0x408998=0xc8;}else{_0x408998=0xce;}_0x4a45c8[_0xa773('0x28')](_0x408998);return _0x4a45c8[_0xa773('0x2d')](_0xa773('0x2e'),_0x1c8784+'-'+_0x5d7093+'/'+_0x119637)[_0xa773('0x29')](_0x2f8d08);}return null;};}function patchUpdates(_0x21ae7b){return function(_0x4f647b){try{jsonpatch[_0xa773('0x2f')](_0x4f647b,_0x21ae7b,!![]);}catch(_0x28e9d2){return BPromise[_0xa773('0x30')](_0x28e9d2);}return _0x4f647b[_0xa773('0x31')]();};}function saveUpdates(_0x4263cc,_0x52a2ed){return function(_0x4de38a){if(_0x4de38a){return _0x4de38a[_0xa773('0x32')](_0x4263cc)[_0xa773('0x33')](function(_0x30c680){return _0x30c680;});}return null;};}function removeEntity(_0x318b02,_0xe5444e){return function(_0x421323){if(_0x421323){return _0x421323['destroy']()[_0xa773('0x33')](function(){_0x318b02[_0xa773('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1201f5,_0x3df512){return function(_0x5ec367){if(!_0x5ec367){_0x1201f5[_0xa773('0x34')](0x194);}return _0x5ec367;};}function handleError(_0x3923b0,_0x54ef59){_0x54ef59=_0x54ef59||0x1f4;return function(_0xc00932){logger[_0xa773('0x22')](_0xc00932[_0xa773('0x35')]);if(_0xc00932[_0xa773('0x36')]){delete _0xc00932[_0xa773('0x36')];}_0x3923b0[_0xa773('0x28')](_0x54ef59)[_0xa773('0x37')](_0xc00932);};}exports[_0xa773('0x38')]=function(_0x3d2ed5,_0x4b273e){var _0x5d0ed9={},_0x3ebace={},_0xd656e9={'count':0x0,'rows':[]};var _0x38948a=_['map'](db[_0xa773('0x39')][_0xa773('0x3a')],function(_0x3b589b){return{'name':_0x3b589b[_0xa773('0x3b')],'type':_0x3b589b[_0xa773('0x3c')][_0xa773('0x3d')]};});_0x3ebace[_0xa773('0x3e')]=_[_0xa773('0x3f')](_0x38948a,_0xa773('0x36'));_0x3ebace[_0xa773('0x40')]=_[_0xa773('0x41')](_0x3d2ed5[_0xa773('0x40')]);_0x3ebace[_0xa773('0x42')]=_[_0xa773('0x43')](_0x3ebace[_0xa773('0x3e')],_0x3ebace[_0xa773('0x40')]);_0x5d0ed9[_0xa773('0x44')]=_[_0xa773('0x43')](_0x3ebace[_0xa773('0x3e')],qs[_0xa773('0x45')](_0x3d2ed5['query']['fields']));_0x5d0ed9[_0xa773('0x44')]=_0x5d0ed9[_0xa773('0x44')][_0xa773('0x46')]?_0x5d0ed9[_0xa773('0x44')]:_0x3ebace[_0xa773('0x3e')];if(!_0x3d2ed5[_0xa773('0x40')][_0xa773('0x47')](_0xa773('0x48'))){_0x5d0ed9['limit']=qs[_0xa773('0x2c')](_0x3d2ed5[_0xa773('0x40')][_0xa773('0x2c')]);_0x5d0ed9[_0xa773('0x2b')]=qs[_0xa773('0x2b')](_0x3d2ed5[_0xa773('0x40')][_0xa773('0x2b')]);}_0x5d0ed9[_0xa773('0x49')]=qs[_0xa773('0x4a')](_0x3d2ed5[_0xa773('0x40')][_0xa773('0x4a')]);_0x5d0ed9[_0xa773('0x4b')]=qs['filters'](_[_0xa773('0x4c')](_0x3d2ed5['query'],_0x3ebace[_0xa773('0x42')]),_0x38948a);if(_0x3d2ed5['query']['filter']){_0x5d0ed9['where']=_[_0xa773('0x4d')](_0x5d0ed9['where'],{'$or':_[_0xa773('0x3f')](_0x38948a,function(_0x49f38a){if(_0x49f38a[_0xa773('0x3c')]!==_0xa773('0x4e')){var _0x1f9b66={};_0x1f9b66[_0x49f38a[_0xa773('0x36')]]={'$like':'%'+_0x3d2ed5[_0xa773('0x40')][_0xa773('0x4f')]+'%'};return _0x1f9b66;}})});}_0x5d0ed9=_[_0xa773('0x4d')]({},_0x5d0ed9,_0x3d2ed5[_0xa773('0x50')]);var _0x42d8e4={'where':_0x5d0ed9[_0xa773('0x4b')]};return db[_0xa773('0x39')][_0xa773('0x2a')](_0x42d8e4)[_0xa773('0x33')](function(_0x27dd05){_0xd656e9[_0xa773('0x2a')]=_0x27dd05;if(_0x3d2ed5[_0xa773('0x40')][_0xa773('0x51')]){_0x5d0ed9[_0xa773('0x52')]=[{'all':!![]}];}return db[_0xa773('0x39')][_0xa773('0x53')](_0x5d0ed9);})[_0xa773('0x33')](function(_0xf1959d){_0xd656e9['rows']=_0xf1959d;return _0xd656e9;})[_0xa773('0x33')](respondWithFilteredResult(_0x4b273e,_0x5d0ed9))[_0xa773('0x27')](handleError(_0x4b273e,null));};exports['show']=function(_0x29a4a8,_0x3d7c8d){var _0x1290fa={'raw':![],'where':{'id':_0x29a4a8['params']['id']}},_0x253c81={};_0x253c81[_0xa773('0x3e')]=_[_0xa773('0x41')](db[_0xa773('0x39')]['rawAttributes']);_0x253c81[_0xa773('0x40')]=_['keys'](_0x29a4a8[_0xa773('0x40')]);_0x253c81[_0xa773('0x42')]=_['intersection'](_0x253c81[_0xa773('0x3e')],_0x253c81['query']);_0x1290fa[_0xa773('0x44')]=_[_0xa773('0x43')](_0x253c81[_0xa773('0x3e')],qs[_0xa773('0x45')](_0x29a4a8[_0xa773('0x40')][_0xa773('0x45')]));_0x1290fa[_0xa773('0x44')]=_0x1290fa[_0xa773('0x44')][_0xa773('0x46')]?_0x1290fa[_0xa773('0x44')]:_0x253c81['model'];if(_0x29a4a8[_0xa773('0x40')][_0xa773('0x51')]){_0x1290fa[_0xa773('0x52')]=[{'all':!![]}];}_0x1290fa=_[_0xa773('0x4d')]({},_0x1290fa,_0x29a4a8['options']);return db[_0xa773('0x39')]['find'](_0x1290fa)['then'](handleEntityNotFound(_0x3d7c8d,null))[_0xa773('0x33')](respondWithResult(_0x3d7c8d,null))['catch'](handleError(_0x3d7c8d,null));};exports[_0xa773('0x54')]=function(_0x27b212,_0xa3de80){return db[_0xa773('0x39')][_0xa773('0x54')](_0x27b212['body'],{})['then'](respondWithResult(_0xa3de80,0xc9))['catch'](handleError(_0xa3de80,null));};exports[_0xa773('0x32')]=function(_0x570abb,_0x2ca930){if(_0x570abb[_0xa773('0x55')]['id']){delete _0x570abb['body']['id'];}return db[_0xa773('0x39')][_0xa773('0x56')]({'where':{'id':_0x570abb[_0xa773('0x57')]['id']}})[_0xa773('0x33')](handleEntityNotFound(_0x2ca930,null))[_0xa773('0x33')](saveUpdates(_0x570abb[_0xa773('0x55')],null))['then'](respondWithResult(_0x2ca930,null))[_0xa773('0x27')](handleError(_0x2ca930,null));};exports[_0xa773('0x58')]=function(_0x14fd21,_0x309dd9){return db[_0xa773('0x39')][_0xa773('0x56')]({'where':{'id':_0x14fd21[_0xa773('0x57')]['id']}})[_0xa773('0x33')](handleEntityNotFound(_0x309dd9,null))[_0xa773('0x33')](removeEntity(_0x309dd9,null))[_0xa773('0x27')](handleError(_0x309dd9,null));};exports[_0xa773('0x59')]=function(_0x4a3e58,_0x20f08a,_0x10291c){var _0x275c15={};var _0x2d64de={};var _0x798554;var _0x1fccc9;return db['ServicenowAccount'][_0xa773('0x5a')]({'where':{'id':_0x4a3e58['params']['id']}})['then'](handleEntityNotFound(_0x20f08a,null))[_0xa773('0x33')](function(_0x47c05b){if(_0x47c05b){_0x798554=_0x47c05b;_0x2d64de[_0xa773('0x3e')]=_[_0xa773('0x41')](db['ServicenowConfiguration'][_0xa773('0x3a')]);_0x2d64de[_0xa773('0x40')]=_[_0xa773('0x41')](_0x4a3e58[_0xa773('0x40')]);_0x2d64de[_0xa773('0x42')]=_[_0xa773('0x43')](_0x2d64de['model'],_0x2d64de[_0xa773('0x40')]);_0x275c15[_0xa773('0x44')]=_[_0xa773('0x43')](_0x2d64de['model'],qs[_0xa773('0x45')](_0x4a3e58[_0xa773('0x40')][_0xa773('0x45')]));_0x275c15['attributes']=_0x275c15[_0xa773('0x44')][_0xa773('0x46')]?_0x275c15[_0xa773('0x44')]:_0x2d64de[_0xa773('0x3e')];_0x275c15[_0xa773('0x49')]=qs[_0xa773('0x4a')](_0x4a3e58[_0xa773('0x40')][_0xa773('0x4a')]);_0x275c15['where']=qs[_0xa773('0x42')](_[_0xa773('0x4c')](_0x4a3e58['query'],_0x2d64de[_0xa773('0x42')]));if(_0x4a3e58['query']['filter']){_0x275c15['where']=_[_0xa773('0x4d')](_0x275c15[_0xa773('0x4b')],{'$or':_[_0xa773('0x3f')](_0x275c15[_0xa773('0x44')],function(_0x59a52c){var _0x109d0b={};_0x109d0b[_0x59a52c]={'$like':'%'+_0x4a3e58['query'][_0xa773('0x4f')]+'%'};return _0x109d0b;})});}_0x275c15=_[_0xa773('0x4d')]({},_0x275c15,_0x4a3e58['options']);return _0x798554['getConfigurations'](_0x275c15);}})['then'](function(_0x5c1803){if(_0x5c1803){_0x1fccc9=_0x5c1803[_0xa773('0x46')];if(!_0x4a3e58[_0xa773('0x40')][_0xa773('0x47')](_0xa773('0x48'))){_0x275c15['limit']=qs[_0xa773('0x2c')](_0x4a3e58[_0xa773('0x40')][_0xa773('0x2c')]);_0x275c15['offset']=qs[_0xa773('0x2b')](_0x4a3e58[_0xa773('0x40')]['offset']);}return _0x798554[_0xa773('0x59')](_0x275c15);}})[_0xa773('0x33')](function(_0x3fd390){if(_0x3fd390){return _0x3fd390?{'count':_0x1fccc9,'rows':_0x3fd390}:null;}})[_0xa773('0x33')](respondWithResult(_0x20f08a,null))[_0xa773('0x27')](handleError(_0x20f08a,null));};exports[_0xa773('0x5b')]=function(_0x4acbad,_0xc549e1,_0xe931e8){if(_0x4acbad[_0xa773('0x55')]['id']){delete _0x4acbad[_0xa773('0x55')]['id'];}return db[_0xa773('0x39')][_0xa773('0x5a')]({'where':{'id':_0x4acbad[_0xa773('0x57')]['id']}})[_0xa773('0x33')](handleEntityNotFound(_0xc549e1,null))[_0xa773('0x33')](function(_0x226491){if(_0x226491){_0x4acbad[_0xa773('0x55')][_0xa773('0x5c')]=_0x226491['id'];_0x4acbad[_0xa773('0x55')][_0xa773('0x5d')]=integrations[_0xa773('0x5e')](_0x4acbad['body']['channel'],_0x4acbad[_0xa773('0x55')]['type']);_0x4acbad[_0xa773('0x55')]['Descriptions']=integrations[_0xa773('0x5f')](_0x4acbad['body'][_0xa773('0x60')],_0x4acbad[_0xa773('0x55')]['type']);return db[_0xa773('0x61')][_0xa773('0x54')](_0x4acbad[_0xa773('0x55')],{'include':[{'model':db[_0xa773('0x62')],'as':_0xa773('0x5d')},{'model':db[_0xa773('0x62')],'as':'Descriptions'}]});}return null;})[_0xa773('0x33')](respondWithResult(_0xc549e1,null))[_0xa773('0x27')](handleError(_0xc549e1,null));};exports[_0xa773('0x63')]=function(_0x153e74,_0x3b0587,_0x34b22f){var _0xf2dd59=[_0xa773('0x64'),_0xa773('0x65'),'knowledge',_0xa773('0x66'),_0xa773('0x67'),_0xa773('0x68'),_0xa773('0x69'),_0xa773('0x6a'),_0xa773('0x6b')];var _0x308ecb=['parent',_0xa773('0x64'),_0xa773('0x6c'),_0xa773('0x6d'),'upon_reject',_0xa773('0x6e'),'child_incidents',_0xa773('0x65'),_0xa773('0x6f'),_0xa773('0x70'),_0xa773('0x71'),_0xa773('0x72'),_0xa773('0x73'),_0xa773('0x74'),_0xa773('0x75'),_0xa773('0x76'),_0xa773('0x77'),'sys_created_by',_0xa773('0x78'),'order','calendar_stc','closed_at','cmdb_ci',_0xa773('0x79'),_0xa773('0x7a'),_0xa773('0x7b'),_0xa773('0x7c'),_0xa773('0x7d'),_0xa773('0x7e'),_0xa773('0x7f'),_0xa773('0x80'),_0xa773('0x81'),_0xa773('0x82'),_0xa773('0x83'),_0xa773('0x84'),_0xa773('0x85'),_0xa773('0x86'),'reopened_time','resolved_at',_0xa773('0x87'),'approval_set',_0xa773('0x66'),'work_notes',_0xa773('0x88'),_0xa773('0x67'),_0xa773('0x89'),_0xa773('0x8a'),_0xa773('0x8b'),'assignment_group',_0xa773('0x8c'),_0xa773('0x8d'),'description',_0xa773('0x8e'),_0xa773('0x68'),'sys_class_name',_0xa773('0x8f'),_0xa773('0x90'),_0xa773('0x91'),_0xa773('0x92'),_0xa773('0x93'),'contact_type','reopened_by',_0xa773('0x69'),_0xa773('0x94'),_0xa773('0x95'),'company',_0xa773('0x96'),_0xa773('0x97'),'assigned_to',_0xa773('0x6a'),_0xa773('0x98'),'sla_due',_0xa773('0x99'),'comments_and_work_notes','due_date',_0xa773('0x9a'),'reopen_count',_0xa773('0x9b'),'escalation',_0xa773('0x9c'),_0xa773('0x9d'),_0xa773('0x9e'),'category'];var _0x4189b7='';var _0x1f8550='';var _0x59746e=[];var _0x38ee7b='';var _0x7cc97f='';var _0x3de55d=[];var _0x5284ce='';var _0x3f41cc='';var _0x5c75f0={};var _0x1d36c5='';return db[_0xa773('0x39')][_0xa773('0x5a')]({'where':{'id':_0x153e74[_0xa773('0x57')]['id']},'attributes':['id',_0xa773('0x9f'),_0xa773('0xa0'),_0xa773('0xa1'),_0xa773('0xa2'),_0xa773('0xa3')]})['then'](handleEntityNotFound(_0x3b0587,null))[_0xa773('0x33')](function(_0x2022d2){if(_0x2022d2){_0x1d36c5=_0x2022d2[_0xa773('0xa2')];var _0x50ea08=_0x1d36c5[_0xa773('0xa4')](-0x1);if(_0x50ea08==='/'){_0x1d36c5=_0x1d36c5[_0xa773('0xa5')](0x0,_0x1d36c5[_0xa773('0xa6')](_0x50ea08));}_0x3f41cc=util[_0xa773('0xa7')]('%s/api/now/doc/table/schema/',_0x1d36c5);_0x5284ce=util[_0xa773('0xa7')](_0xa773('0xa8'),_0x1d36c5);_0x5c75f0={'user':_0x2022d2['username'],'pass':_0x2022d2['password']};var _0x21328d={'method':_0xa773('0xa9'),'uri':_0x3f41cc+_0xa773('0xaa'),'auth':_0x5c75f0,'json':!![]};return rp(_0x21328d);}})[_0xa773('0x33')](function(_0x4de1ba){if(_0x4de1ba[_0xa773('0x26')][_0xa773('0x46')]>0x0){_0x4189b7=_0x4de1ba[_0xa773('0x26')];}console[_0xa773('0xab')](_0xa773('0xac'),_0x4189b7);_0x3de55d=[];_0x1f8550=Object[_0xa773('0xad')]([],_0x4189b7);_['remove'](_0x1f8550,function(_0x49c31d){return!_0xf2dd59[_0xa773('0xae')](_0x49c31d['name']);});_0x1f8550[_0xa773('0xaf')](function(_0x3fc313){var _0x553417=createFieldObject(_0x5284ce,_0x5c75f0,_0x3fc313[_0xa773('0xb0')],_0x3fc313[_0xa773('0x36')],_0x3fc313[_0xa773('0xb1')],![]);_0x3de55d[_0xa773('0xb2')](_0x553417);});return Promise['all'](_0x3de55d);})[_0xa773('0x33')](function(_0x35ffdf){_0x59746e=_0x35ffdf;_0x38ee7b=Object[_0xa773('0xad')]([],_0x4189b7);console['log'](_0xa773('0xb3'),_0x4189b7);_[_0xa773('0xb4')](_0x38ee7b,function(_0x1881a7){return _0x308ecb[_0xa773('0xae')](_0x1881a7[_0xa773('0x36')]);});console['log'](_0xa773('0xb5'),_0x38ee7b);_0x3de55d=[];_0x38ee7b[_0xa773('0xaf')](function(_0x12ee14){var _0x2eaf99=createFieldObject(_0x5284ce,_0x5c75f0,_0x12ee14[_0xa773('0xb0')],_0x12ee14['name'],_0x12ee14[_0xa773('0xb1')],!![]);_0x3de55d[_0xa773('0xb2')](_0x2eaf99);});return Promise['all'](_0x3de55d);})['then'](function(_0x5968e9){_0x7cc97f=_0x5968e9;var _0x4feef1=_0x59746e[_0xa773('0xb6')](_0x7cc97f);return{'count':_0x4feef1['length'],'rows':_0x4feef1};})[_0xa773('0x33')](respondWithResult(_0x3b0587,null))[_0xa773('0x27')](function(_0x5bd70b){console['log']('ServiceNow\x20error:\x20'+_0x5bd70b);var _0x1f29f1=_0x153e74[_0xa773('0x40')]['test']?0x1f4:_0x5bd70b[_0xa773('0xb7')]||0x1f4;logger[_0xa773('0x22')](_0x5bd70b[_0xa773('0x35')]);delete _0x5bd70b[_0xa773('0x36')];if(_0x1f29f1===0x191){_0x1f29f1=0x190;}_0x3b0587[_0xa773('0x28')](_0x1f29f1)[_0xa773('0x37')](_0x153e74[_0xa773('0x40')]['test']?{'message':_0xa773('0xb8'),'statusCode':_0x5bd70b['statusCode']}:_0x5bd70b);});};function createFieldObject(_0x5c8e3d,_0x97fed7,_0x3486eb,_0x3794e1,_0x19369f,_0x42d9c0){return new Promise(function(_0x57c255,_0x4f2e55){var _0x28dd05={'id':_0x3794e1,'name':_0x19369f,'custom':_0x42d9c0};if(_0x3486eb===_0xa773('0xb9')){_0x28dd05['options']=[{'name':'True','value':_0xa773('0xba')},{'name':_0xa773('0xbb'),'value':_0xa773('0xbc')}];_0x57c255(_0x28dd05);}else{var _0x1903e3={'method':_0xa773('0xa9'),'uri':_0x5c8e3d+_0xa773('0xbd')+_0x3794e1,'auth':_0x97fed7,'json':!![]};return rp(_0x1903e3)[_0xa773('0x33')](function(_0xa467d7){var _0x557454=[];if(_0xa467d7[_0xa773('0x26')][_0xa773('0x46')]>0x0){_0xa467d7[_0xa773('0x26')][_0xa773('0xaf')](function(_0x4029a3){if(_0x4029a3[_0xa773('0xbe')]==='false'){var _0x1bbfcf={'name':_0x4029a3[_0xa773('0xb1')],'value':_0x4029a3[_0xa773('0xbf')]};_0x557454[_0xa773('0xb2')](_0x1bbfcf);}});}_0x28dd05[_0xa773('0x50')]=_0x557454;if(_0x28dd05[_0xa773('0x50')][_0xa773('0x46')]>0x0){_0x57c255(_0x28dd05);}else{if(_0x42d9c0==![]){_0x57c255();}else{_0x57c255(_0x28dd05);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 8004b8f..8bfe97a 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 _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 +var _0x032e=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x1b4002,_0x5b4094){var _0x1716f3=function(_0x47cfd1){while(--_0x47cfd1){_0x1b4002['push'](_0x1b4002['shift']());}};_0x1716f3(++_0x5b4094);}(_0x032e,0x124));var _0xe032=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x032e[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var logger=require(_0xe032('0x1'))(_0xe032('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe032('0x3'));var fs=require('fs');var path=require(_0xe032('0x4'));var rimraf=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var attributes=require(_0xe032('0x7'));var integrations=require(_0xe032('0x8'));module[_0xe032('0x9')]=function(_0x33ad0b,_0x37432f){return _0x33ad0b[_0xe032('0xa')](_0xe032('0xb'),attributes,{'tableName':_0xe032('0xc'),'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 a601636..7a67f91 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 _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 +var _0xc61c=['../../config/logger','rpc','../../config/environment','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ServicenowAccount','findAll','options','where','attributes','limit','include','map','model','GetServicenowAccount','stringify','find','ShowServicenowAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x2efc88,_0x514a6a){var _0x1e2532=function(_0x242da0){while(--_0x242da0){_0x2efc88['push'](_0x2efc88['shift']());}};_0x1e2532(++_0x514a6a);}(_0xc61c,0x1cd));var _0xcc61=function(_0x231fb1,_0x53a98a){_0x231fb1=_0x231fb1-0x0;var _0x2221a6=_0xc61c[_0x231fb1];return _0x2221a6;};'use strict';var _=require(_0xcc61('0x0'));var util=require(_0xcc61('0x1'));var moment=require(_0xcc61('0x2'));var BPromise=require(_0xcc61('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc61('0x4'));var db=require(_0xcc61('0x5'))['db'];var utils=require(_0xcc61('0x6'));var logger=require(_0xcc61('0x7'))(_0xcc61('0x8'));var config=require(_0xcc61('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcc61('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f0546,_0x145299,_0x4bd11d){return new BPromise(function(_0x74fb61,_0x205e3c){return client[_0xcc61('0xb')](_0x2f0546,_0x4bd11d)[_0xcc61('0xc')](function(_0x11630a){logger[_0xcc61('0xd')](_0xcc61('0xe'),_0x145299,'request\x20sent');logger[_0xcc61('0xf')](_0xcc61('0x10'),_0x145299,_0xcc61('0x11'),JSON['stringify'](_0x11630a));if(_0x11630a[_0xcc61('0x12')]){if(_0x11630a[_0xcc61('0x12')][_0xcc61('0x13')]===0x1f4){logger[_0xcc61('0x12')](_0xcc61('0xe'),_0x145299,_0x11630a[_0xcc61('0x12')][_0xcc61('0x14')]);return _0x205e3c(_0x11630a['error']['message']);}logger[_0xcc61('0x12')](_0xcc61('0xe'),_0x145299,_0x11630a[_0xcc61('0x12')]['message']);return _0x74fb61(_0x11630a['error'][_0xcc61('0x14')]);}else{logger[_0xcc61('0xd')](_0xcc61('0xe'),_0x145299,_0xcc61('0x11'));_0x74fb61(_0x11630a[_0xcc61('0x15')][_0xcc61('0x14')]);}})[_0xcc61('0x16')](function(_0x4c4d63){logger[_0xcc61('0x12')](_0xcc61('0xe'),_0x145299,_0x4c4d63);_0x205e3c(_0x4c4d63);});});}exports['GetServicenowAccount']=function(_0x4f6a42){var _0x3dd59b=this;return new Promise(function(_0x23bfd9,_0x1f5e02){return db[_0xcc61('0x17')][_0xcc61('0x18')]({'raw':_0x4f6a42[_0xcc61('0x19')]?_0x4f6a42[_0xcc61('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4f6a42[_0xcc61('0x19')]?_0x4f6a42[_0xcc61('0x19')][_0xcc61('0x1a')]||null:null,'attributes':_0x4f6a42[_0xcc61('0x19')]?_0x4f6a42[_0xcc61('0x19')][_0xcc61('0x1b')]||null:null,'limit':_0x4f6a42[_0xcc61('0x19')]?_0x4f6a42[_0xcc61('0x19')][_0xcc61('0x1c')]||null:null,'include':_0x4f6a42['options']?_0x4f6a42['options'][_0xcc61('0x1d')]?_[_0xcc61('0x1e')](_0x4f6a42[_0xcc61('0x19')][_0xcc61('0x1d')],function(_0x470c33){return{'model':db[_0x470c33['model']],'as':_0x470c33['as'],'attributes':_0x470c33[_0xcc61('0x1b')],'include':_0x470c33[_0xcc61('0x1d')]?_[_0xcc61('0x1e')](_0x470c33[_0xcc61('0x1d')],function(_0x33803b){return{'model':db[_0x33803b[_0xcc61('0x1f')]],'as':_0x33803b['as'],'attributes':_0x33803b[_0xcc61('0x1b')],'include':_0x33803b[_0xcc61('0x1d')]?_[_0xcc61('0x1e')](_0x33803b[_0xcc61('0x1d')],function(_0x501364){return{'model':db[_0x501364[_0xcc61('0x1f')]],'as':_0x501364['as'],'attributes':_0x501364[_0xcc61('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcc61('0xc')](function(_0x20131d){logger[_0xcc61('0xd')](_0xcc61('0x20'),_0x4f6a42);logger['debug']('GetServicenowAccount',_0x4f6a42,JSON[_0xcc61('0x21')](_0x20131d));_0x23bfd9(_0x20131d);})[_0xcc61('0x16')](function(_0x1fc538){logger[_0xcc61('0x12')](_0xcc61('0x20'),_0x1fc538['message'],_0x4f6a42);_0x1f5e02(_0x3dd59b[_0xcc61('0x12')](0x1f4,_0x1fc538['message']));});});};exports['ShowServicenowAccount']=function(_0x42ebd1){var _0x23733b=this;return new Promise(function(_0x335a85,_0x5e8378){return db['ServicenowAccount'][_0xcc61('0x22')]({'raw':_0x42ebd1['options']?_0x42ebd1[_0xcc61('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x42ebd1[_0xcc61('0x19')]?_0x42ebd1[_0xcc61('0x19')][_0xcc61('0x1a')]||null:null,'attributes':_0x42ebd1[_0xcc61('0x19')]?_0x42ebd1[_0xcc61('0x19')][_0xcc61('0x1b')]||null:null,'include':_0x42ebd1[_0xcc61('0x19')]?_0x42ebd1[_0xcc61('0x19')][_0xcc61('0x1d')]?_[_0xcc61('0x1e')](_0x42ebd1['options'][_0xcc61('0x1d')],function(_0x395aee){return{'model':db[_0x395aee[_0xcc61('0x1f')]],'as':_0x395aee['as'],'attributes':_0x395aee[_0xcc61('0x1b')],'include':_0x395aee[_0xcc61('0x1d')]?_[_0xcc61('0x1e')](_0x395aee['include'],function(_0x4a5d43){return{'model':db[_0x4a5d43[_0xcc61('0x1f')]],'as':_0x4a5d43['as'],'attributes':_0x4a5d43[_0xcc61('0x1b')],'include':_0x4a5d43['include']?_['map'](_0x4a5d43[_0xcc61('0x1d')],function(_0x3377b3){return{'model':db[_0x3377b3[_0xcc61('0x1f')]],'as':_0x3377b3['as'],'attributes':_0x3377b3[_0xcc61('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcc61('0xc')](function(_0xe4a625){logger[_0xcc61('0xd')](_0xcc61('0x23'),_0x42ebd1);logger[_0xcc61('0xf')](_0xcc61('0x23'),_0x42ebd1,JSON[_0xcc61('0x21')](_0xe4a625));_0x335a85(_0xe4a625);})['catch'](function(_0x588e91){logger['error'](_0xcc61('0x23'),_0x588e91['message'],_0x42ebd1);_0x5e8378(_0x23733b[_0xcc61('0x12')](0x1f4,_0x588e91[_0xcc61('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index d70e8f7..5baa686 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 _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 +var _0x6dda=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','update','delete','destroy','util','path'];(function(_0x123375,_0x1f0596){var _0x1946c2=function(_0x1d1bf9){while(--_0x1d1bf9){_0x123375['push'](_0x123375['shift']());}};_0x1946c2(++_0x1f0596);}(_0x6dda,0x14e));var _0xa6dd=function(_0x37c509,_0x3c24bb){_0x37c509=_0x37c509-0x0;var _0x44ea39=_0x6dda[_0x37c509];return _0x44ea39;};'use strict';var multer=require('multer');var util=require(_0xa6dd('0x0'));var path=require(_0xa6dd('0x1'));var timeout=require(_0xa6dd('0x2'));var express=require(_0xa6dd('0x3'));var router=express[_0xa6dd('0x4')]();var auth=require(_0xa6dd('0x5'));var interaction=require(_0xa6dd('0x6'));var config=require(_0xa6dd('0x7'));var controller=require('./intServicenowConfiguration.controller');router[_0xa6dd('0x8')]('/',auth[_0xa6dd('0x9')](),controller[_0xa6dd('0xa')]);router[_0xa6dd('0x8')](_0xa6dd('0xb'),auth[_0xa6dd('0x9')](),controller['show']);router[_0xa6dd('0x8')](_0xa6dd('0xc'),auth['isAuthenticated'](),controller[_0xa6dd('0xd')]);router[_0xa6dd('0x8')](_0xa6dd('0xe'),auth[_0xa6dd('0x9')](),controller['getSubjects']);router[_0xa6dd('0x8')](_0xa6dd('0xf'),auth[_0xa6dd('0x9')](),controller[_0xa6dd('0x10')]);router[_0xa6dd('0x11')]('/',auth[_0xa6dd('0x9')](),controller['create']);router['put'](_0xa6dd('0xb'),auth[_0xa6dd('0x9')](),controller[_0xa6dd('0x12')]);router[_0xa6dd('0x13')](_0xa6dd('0xb'),auth['isAuthenticated'](),controller[_0xa6dd('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 4550a5b..53a1aa4 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 _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 +var _0x4fd3=['sequelize','exports','STRING'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x4fd3,0x189));var _0x34fd=function(_0x4f5a3c,_0x50ac0f){_0x4f5a3c=_0x4f5a3c-0x0;var _0x3958d8=_0x4fd3[_0x4f5a3c];return _0x3958d8;};'use strict';var Sequelize=require(_0x34fd('0x0'));module[_0x34fd('0x1')]={'name':{'type':Sequelize[_0x34fd('0x2')]},'description':{'type':Sequelize[_0x34fd('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index b7dc7e9..ef1173c 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 _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 +var _0x1cd4=['end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','body','findOne','ServicenowField','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','jayson/promise','client','request','then','info','debug','request\x20sent','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result'];(function(_0x32792d,_0x2f0aae){var _0x4e09aa=function(_0x133f75){while(--_0x133f75){_0x32792d['push'](_0x32792d['shift']());}};_0x4e09aa(++_0x2f0aae);}(_0x1cd4,0x91));var _0x41cd=function(_0x204d1d,_0x35aa3d){_0x204d1d=_0x204d1d-0x0;var _0x2ebcef=_0x1cd4[_0x204d1d];return _0x2ebcef;};'use strict';var pdf=require(_0x41cd('0x0'));var emlformat=require(_0x41cd('0x1'));var rimraf=require(_0x41cd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41cd('0x3'));var rp=require(_0x41cd('0x4'));var moment=require(_0x41cd('0x5'));var BPromise=require(_0x41cd('0x6'));var Mustache=require(_0x41cd('0x7'));var util=require(_0x41cd('0x8'));var path=require(_0x41cd('0x9'));var sox=require(_0x41cd('0xa'));var csv=require(_0x41cd('0xb'));var ejs=require(_0x41cd('0xc'));var fs=require('fs');var _=require(_0x41cd('0xd'));var squel=require('squel');var crypto=require(_0x41cd('0xe'));var jsforce=require(_0x41cd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x41cd('0xb'));var querystring=require('querystring');var Papa=require(_0x41cd('0x10'));var Redis=require(_0x41cd('0x11'));var authService=require(_0x41cd('0x12'));var qs=require(_0x41cd('0x13'));var as=require(_0x41cd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x41cd('0x15'));var licenseUtil=require(_0x41cd('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x41cd('0x17'));var client=jayson[_0x41cd('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1322f7,_0x497021,_0x58a515,_0x135e92){return new BPromise(function(_0x4c6bab,_0x2ef4c9){var _0x54c7ee=_0x135e92||client;return _0x54c7ee[_0x41cd('0x19')](_0x1322f7,_0x58a515)[_0x41cd('0x1a')](function(_0x937ed3){logger[_0x41cd('0x1b')]('ServicenowConfiguration,\x20%s,\x20%s',_0x497021,'request\x20sent');logger[_0x41cd('0x1c')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x497021,_0x41cd('0x1d'),JSON['stringify'](_0x937ed3));if(_0x937ed3[_0x41cd('0x1e')]){if(_0x937ed3['error'][_0x41cd('0x1f')]===0x1f4){logger[_0x41cd('0x1e')](_0x41cd('0x20'),_0x497021,_0x937ed3[_0x41cd('0x1e')][_0x41cd('0x21')]);return _0x2ef4c9(_0x937ed3[_0x41cd('0x1e')][_0x41cd('0x21')]);}logger[_0x41cd('0x1e')]('ServicenowConfiguration,\x20%s,\x20%s',_0x497021,_0x937ed3[_0x41cd('0x1e')][_0x41cd('0x21')]);return _0x4c6bab(_0x937ed3[_0x41cd('0x1e')][_0x41cd('0x21')]);}else{logger[_0x41cd('0x1b')](_0x41cd('0x20'),_0x497021,_0x41cd('0x1d'));_0x4c6bab(_0x937ed3[_0x41cd('0x22')][_0x41cd('0x21')]);}})['catch'](function(_0x1afdaa){logger[_0x41cd('0x1e')](_0x41cd('0x20'),_0x497021,_0x1afdaa);_0x2ef4c9(_0x1afdaa);});});}function respondWithStatusCode(_0x2741fe,_0x25d060){_0x25d060=_0x25d060||0xcc;return function(_0x3e09fc){if(_0x3e09fc){return _0x2741fe['sendStatus'](_0x25d060);}return _0x2741fe['status'](_0x25d060)[_0x41cd('0x23')]();};}function respondWithResult(_0x527b00,_0x331d5b){_0x331d5b=_0x331d5b||0xc8;return function(_0x4a47dd){if(_0x4a47dd){return _0x527b00[_0x41cd('0x24')](_0x331d5b)[_0x41cd('0x25')](_0x4a47dd);}};}function respondWithFilteredResult(_0xb0b9c3,_0xb0f51c){return function(_0x2a0f39){if(_0x2a0f39){var _0xc06868=_0x2a0f39[_0x41cd('0x26')],_0x2e6895=_0xb0f51c[_0x41cd('0x27')],_0x1cbb0e=_0xb0f51c[_0x41cd('0x27')]+_0xb0f51c[_0x41cd('0x28')],_0x33046f;if(_0x1cbb0e>=_0xc06868){_0x1cbb0e=_0xc06868;_0x33046f=0xc8;}else{_0x33046f=0xce;}_0xb0b9c3['status'](_0x33046f);return _0xb0b9c3[_0x41cd('0x29')](_0x41cd('0x2a'),_0x2e6895+'-'+_0x1cbb0e+'/'+_0xc06868)['json'](_0x2a0f39);}return null;};}function patchUpdates(_0x28518e){return function(_0x36e17b){try{jsonpatch[_0x41cd('0x2b')](_0x36e17b,_0x28518e,!![]);}catch(_0x44c905){return BPromise[_0x41cd('0x2c')](_0x44c905);}return _0x36e17b[_0x41cd('0x2d')]();};}function saveUpdates(_0x32366d,_0x40b0b5){return function(_0x24bf4a){if(_0x24bf4a){return _0x24bf4a['update'](_0x32366d)['then'](function(_0x4a21e0){return _0x4a21e0;});}return null;};}function removeEntity(_0x5e27cf,_0x1c5925){return function(_0x26d357){if(_0x26d357){return _0x26d357[_0x41cd('0x2e')]()[_0x41cd('0x1a')](function(){_0x5e27cf[_0x41cd('0x24')](0xcc)[_0x41cd('0x23')]();});}};}function handleEntityNotFound(_0x537218,_0x14be4c){return function(_0x5111ef){if(!_0x5111ef){_0x537218[_0x41cd('0x2f')](0x194);}return _0x5111ef;};}function handleError(_0x44be61,_0x2ac96b){_0x2ac96b=_0x2ac96b||0x1f4;return function(_0xe12d87){logger[_0x41cd('0x1e')](_0xe12d87[_0x41cd('0x30')]);if(_0xe12d87[_0x41cd('0x31')]){delete _0xe12d87[_0x41cd('0x31')];}_0x44be61[_0x41cd('0x24')](_0x2ac96b)[_0x41cd('0x32')](_0xe12d87);};}exports[_0x41cd('0x33')]=function(_0x4798ff,_0x2eda02){var _0x347cf9={},_0x57b4df={},_0x14f557={'count':0x0,'rows':[]};var _0x4ff264=_['map'](db[_0x41cd('0x34')][_0x41cd('0x35')],function(_0x97255e){return{'name':_0x97255e[_0x41cd('0x36')],'type':_0x97255e['type'][_0x41cd('0x37')]};});_0x57b4df['model']=_['map'](_0x4ff264,_0x41cd('0x31'));_0x57b4df[_0x41cd('0x38')]=_[_0x41cd('0x39')](_0x4798ff[_0x41cd('0x38')]);_0x57b4df[_0x41cd('0x3a')]=_['intersection'](_0x57b4df[_0x41cd('0x3b')],_0x57b4df['query']);_0x347cf9['attributes']=_[_0x41cd('0x3c')](_0x57b4df[_0x41cd('0x3b')],qs[_0x41cd('0x3d')](_0x4798ff['query'][_0x41cd('0x3d')]));_0x347cf9['attributes']=_0x347cf9[_0x41cd('0x3e')]['length']?_0x347cf9[_0x41cd('0x3e')]:_0x57b4df[_0x41cd('0x3b')];if(!_0x4798ff['query'][_0x41cd('0x3f')](_0x41cd('0x40'))){_0x347cf9['limit']=qs[_0x41cd('0x28')](_0x4798ff['query'][_0x41cd('0x28')]);_0x347cf9[_0x41cd('0x27')]=qs[_0x41cd('0x27')](_0x4798ff['query']['offset']);}_0x347cf9[_0x41cd('0x41')]=qs[_0x41cd('0x42')](_0x4798ff[_0x41cd('0x38')][_0x41cd('0x42')]);_0x347cf9[_0x41cd('0x43')]=qs[_0x41cd('0x3a')](_[_0x41cd('0x44')](_0x4798ff[_0x41cd('0x38')],_0x57b4df[_0x41cd('0x3a')]),_0x4ff264);if(_0x4798ff[_0x41cd('0x38')][_0x41cd('0x45')]){_0x347cf9[_0x41cd('0x43')]=_['merge'](_0x347cf9[_0x41cd('0x43')],{'$or':_[_0x41cd('0x46')](_0x4ff264,function(_0x3d8a17){if(_0x3d8a17[_0x41cd('0x47')]!==_0x41cd('0x48')){var _0x51e7d9={};_0x51e7d9[_0x3d8a17['name']]={'$like':'%'+_0x4798ff[_0x41cd('0x38')][_0x41cd('0x45')]+'%'};return _0x51e7d9;}})});}_0x347cf9=_[_0x41cd('0x49')]({},_0x347cf9,_0x4798ff[_0x41cd('0x4a')]);var _0x4cac2a={'where':_0x347cf9[_0x41cd('0x43')]};return db['ServicenowConfiguration'][_0x41cd('0x26')](_0x4cac2a)['then'](function(_0x2ce157){_0x14f557['count']=_0x2ce157;if(_0x4798ff[_0x41cd('0x38')][_0x41cd('0x4b')]){_0x347cf9[_0x41cd('0x4c')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x41cd('0x4d')](_0x347cf9);})[_0x41cd('0x1a')](function(_0x1f232c){_0x14f557['rows']=_0x1f232c;return _0x14f557;})[_0x41cd('0x1a')](respondWithFilteredResult(_0x2eda02,_0x347cf9))[_0x41cd('0x4e')](handleError(_0x2eda02,null));};exports[_0x41cd('0x4f')]=function(_0x118005,_0x41aa65){var _0x23cabb={'raw':![],'where':{'id':_0x118005[_0x41cd('0x50')]['id']}},_0x64f1ae={};_0x64f1ae[_0x41cd('0x3b')]=_[_0x41cd('0x39')](db['ServicenowConfiguration'][_0x41cd('0x35')]);_0x64f1ae['query']=_[_0x41cd('0x39')](_0x118005[_0x41cd('0x38')]);_0x64f1ae[_0x41cd('0x3a')]=_[_0x41cd('0x3c')](_0x64f1ae[_0x41cd('0x3b')],_0x64f1ae[_0x41cd('0x38')]);_0x23cabb[_0x41cd('0x3e')]=_[_0x41cd('0x3c')](_0x64f1ae['model'],qs[_0x41cd('0x3d')](_0x118005['query'][_0x41cd('0x3d')]));_0x23cabb[_0x41cd('0x3e')]=_0x23cabb['attributes'][_0x41cd('0x51')]?_0x23cabb['attributes']:_0x64f1ae['model'];if(_0x118005[_0x41cd('0x38')]['includeAll']){_0x23cabb[_0x41cd('0x4c')]=[{'all':!![]}];}_0x23cabb=_['merge']({},_0x23cabb,_0x118005[_0x41cd('0x4a')]);return db['ServicenowConfiguration'][_0x41cd('0x52')](_0x23cabb)[_0x41cd('0x1a')](handleEntityNotFound(_0x41aa65,null))[_0x41cd('0x1a')](respondWithResult(_0x41aa65,null))[_0x41cd('0x4e')](handleError(_0x41aa65,null));};exports[_0x41cd('0x53')]=function(_0x14a273,_0x5b500b){return db['ServicenowConfiguration'][_0x41cd('0x53')](_0x14a273[_0x41cd('0x54')],{})[_0x41cd('0x1a')](respondWithResult(_0x5b500b,0xc9))[_0x41cd('0x4e')](handleError(_0x5b500b,null));};exports['update']=function(_0x5f588f,_0x374c14){if(_0x5f588f[_0x41cd('0x54')]['id']){delete _0x5f588f[_0x41cd('0x54')]['id'];}return db[_0x41cd('0x34')][_0x41cd('0x52')]({'where':{'id':_0x5f588f[_0x41cd('0x50')]['id']}})[_0x41cd('0x1a')](handleEntityNotFound(_0x374c14,null))['then'](saveUpdates(_0x5f588f[_0x41cd('0x54')],null))[_0x41cd('0x1a')](respondWithResult(_0x374c14,null))['catch'](handleError(_0x374c14,null));};exports['destroy']=function(_0x2286dc,_0x457929){return db[_0x41cd('0x34')]['find']({'where':{'id':_0x2286dc['params']['id']}})[_0x41cd('0x1a')](handleEntityNotFound(_0x457929,null))['then'](removeEntity(_0x457929,null))['catch'](handleError(_0x457929,null));};exports['getFields']=function(_0x2cad68,_0x2ebc2e,_0x1c4c67){var _0x412187={};var _0x4fced6={};var _0x555caa;var _0x1a0785;return db[_0x41cd('0x34')][_0x41cd('0x55')]({'where':{'id':_0x2cad68[_0x41cd('0x50')]['id']}})[_0x41cd('0x1a')](handleEntityNotFound(_0x2ebc2e,null))[_0x41cd('0x1a')](function(_0x291bdd){if(_0x291bdd){_0x555caa=_0x291bdd;_0x4fced6['model']=_[_0x41cd('0x39')](db[_0x41cd('0x56')][_0x41cd('0x35')]);_0x4fced6['query']=_[_0x41cd('0x39')](_0x2cad68[_0x41cd('0x38')]);_0x4fced6['filters']=_[_0x41cd('0x3c')](_0x4fced6[_0x41cd('0x3b')],_0x4fced6[_0x41cd('0x38')]);_0x412187[_0x41cd('0x3e')]=_['intersection'](_0x4fced6['model'],qs[_0x41cd('0x3d')](_0x2cad68['query'][_0x41cd('0x3d')]));_0x412187[_0x41cd('0x3e')]=_0x412187['attributes']['length']?_0x412187['attributes']:_0x4fced6['model'];_0x412187[_0x41cd('0x41')]=qs[_0x41cd('0x42')](_0x2cad68[_0x41cd('0x38')][_0x41cd('0x42')]);_0x412187[_0x41cd('0x43')]=qs['filters'](_[_0x41cd('0x44')](_0x2cad68['query'],_0x4fced6[_0x41cd('0x3a')]));if(_0x2cad68['query'][_0x41cd('0x45')]){_0x412187[_0x41cd('0x43')]=_['merge'](_0x412187['where'],{'$or':_[_0x41cd('0x46')](_0x412187['attributes'],function(_0x2545d0){var _0x244238={};_0x244238[_0x2545d0]={'$like':'%'+_0x2cad68[_0x41cd('0x38')][_0x41cd('0x45')]+'%'};return _0x244238;})});}_0x412187=_[_0x41cd('0x49')]({},_0x412187,_0x2cad68['options']);return _0x555caa[_0x41cd('0x57')](_0x412187);}})[_0x41cd('0x1a')](function(_0x366d4c){if(_0x366d4c){_0x1a0785=_0x366d4c[_0x41cd('0x51')];if(!_0x2cad68[_0x41cd('0x38')][_0x41cd('0x3f')](_0x41cd('0x40'))){_0x412187['limit']=qs[_0x41cd('0x28')](_0x2cad68[_0x41cd('0x38')][_0x41cd('0x28')]);_0x412187[_0x41cd('0x27')]=qs[_0x41cd('0x27')](_0x2cad68[_0x41cd('0x38')][_0x41cd('0x27')]);}return _0x555caa[_0x41cd('0x57')](_0x412187);}})['then'](function(_0x2ae4ed){if(_0x2ae4ed){return _0x2ae4ed?{'count':_0x1a0785,'rows':_0x2ae4ed}:null;}})[_0x41cd('0x1a')](respondWithResult(_0x2ebc2e,null))[_0x41cd('0x4e')](handleError(_0x2ebc2e,null));};exports[_0x41cd('0x58')]=function(_0x2bc896,_0x584c9e,_0x1db323){var _0x12e4ff={};var _0x43fa5f={};var _0x15e6b3;var _0x52b6b7;return db[_0x41cd('0x34')][_0x41cd('0x55')]({'where':{'id':_0x2bc896[_0x41cd('0x50')]['id']}})[_0x41cd('0x1a')](handleEntityNotFound(_0x584c9e,null))[_0x41cd('0x1a')](function(_0x66081c){if(_0x66081c){_0x15e6b3=_0x66081c;_0x43fa5f[_0x41cd('0x3b')]=_[_0x41cd('0x39')](db[_0x41cd('0x56')][_0x41cd('0x35')]);_0x43fa5f['query']=_[_0x41cd('0x39')](_0x2bc896['query']);_0x43fa5f[_0x41cd('0x3a')]=_[_0x41cd('0x3c')](_0x43fa5f['model'],_0x43fa5f[_0x41cd('0x38')]);_0x12e4ff['attributes']=_[_0x41cd('0x3c')](_0x43fa5f[_0x41cd('0x3b')],qs[_0x41cd('0x3d')](_0x2bc896['query'][_0x41cd('0x3d')]));_0x12e4ff['attributes']=_0x12e4ff[_0x41cd('0x3e')][_0x41cd('0x51')]?_0x12e4ff[_0x41cd('0x3e')]:_0x43fa5f[_0x41cd('0x3b')];_0x12e4ff[_0x41cd('0x41')]=qs[_0x41cd('0x42')](_0x2bc896['query'][_0x41cd('0x42')]);_0x12e4ff['where']=qs[_0x41cd('0x3a')](_[_0x41cd('0x44')](_0x2bc896[_0x41cd('0x38')],_0x43fa5f[_0x41cd('0x3a')]));if(_0x2bc896[_0x41cd('0x38')][_0x41cd('0x45')]){_0x12e4ff[_0x41cd('0x43')]=_[_0x41cd('0x49')](_0x12e4ff[_0x41cd('0x43')],{'$or':_['map'](_0x12e4ff['attributes'],function(_0x2b7e93){var _0x248439={};_0x248439[_0x2b7e93]={'$like':'%'+_0x2bc896['query']['filter']+'%'};return _0x248439;})});}_0x12e4ff=_[_0x41cd('0x49')]({},_0x12e4ff,_0x2bc896['options']);return _0x15e6b3[_0x41cd('0x58')](_0x12e4ff);}})[_0x41cd('0x1a')](function(_0x2decdf){if(_0x2decdf){_0x52b6b7=_0x2decdf['length'];if(!_0x2bc896['query'][_0x41cd('0x3f')](_0x41cd('0x40'))){_0x12e4ff[_0x41cd('0x28')]=qs[_0x41cd('0x28')](_0x2bc896[_0x41cd('0x38')][_0x41cd('0x28')]);_0x12e4ff[_0x41cd('0x27')]=qs[_0x41cd('0x27')](_0x2bc896[_0x41cd('0x38')]['offset']);}return _0x15e6b3[_0x41cd('0x58')](_0x12e4ff);}})[_0x41cd('0x1a')](function(_0xc4beab){if(_0xc4beab){return _0xc4beab?{'count':_0x52b6b7,'rows':_0xc4beab}:null;}})[_0x41cd('0x1a')](respondWithResult(_0x584c9e,null))[_0x41cd('0x4e')](handleError(_0x584c9e,null));};exports['getDescriptions']=function(_0x5a86bd,_0x5e9ca7,_0x96fa4d){var _0x1c4230={};var _0x2b9573={};var _0x1f576b;var _0x2b8b1a;return db[_0x41cd('0x34')]['findOne']({'where':{'id':_0x5a86bd[_0x41cd('0x50')]['id']}})[_0x41cd('0x1a')](handleEntityNotFound(_0x5e9ca7,null))[_0x41cd('0x1a')](function(_0x4acce6){if(_0x4acce6){_0x1f576b=_0x4acce6;_0x2b9573[_0x41cd('0x3b')]=_['keys'](db['ServicenowField'][_0x41cd('0x35')]);_0x2b9573[_0x41cd('0x38')]=_[_0x41cd('0x39')](_0x5a86bd[_0x41cd('0x38')]);_0x2b9573['filters']=_[_0x41cd('0x3c')](_0x2b9573[_0x41cd('0x3b')],_0x2b9573[_0x41cd('0x38')]);_0x1c4230['attributes']=_[_0x41cd('0x3c')](_0x2b9573[_0x41cd('0x3b')],qs['fields'](_0x5a86bd[_0x41cd('0x38')]['fields']));_0x1c4230[_0x41cd('0x3e')]=_0x1c4230[_0x41cd('0x3e')]['length']?_0x1c4230[_0x41cd('0x3e')]:_0x2b9573['model'];_0x1c4230[_0x41cd('0x41')]=qs[_0x41cd('0x42')](_0x5a86bd[_0x41cd('0x38')][_0x41cd('0x42')]);_0x1c4230['where']=qs[_0x41cd('0x3a')](_[_0x41cd('0x44')](_0x5a86bd[_0x41cd('0x38')],_0x2b9573[_0x41cd('0x3a')]));if(_0x5a86bd[_0x41cd('0x38')][_0x41cd('0x45')]){_0x1c4230[_0x41cd('0x43')]=_[_0x41cd('0x49')](_0x1c4230['where'],{'$or':_[_0x41cd('0x46')](_0x1c4230['attributes'],function(_0x2f8758){var _0x1fa0fe={};_0x1fa0fe[_0x2f8758]={'$like':'%'+_0x5a86bd['query'][_0x41cd('0x45')]+'%'};return _0x1fa0fe;})});}_0x1c4230=_['merge']({},_0x1c4230,_0x5a86bd[_0x41cd('0x4a')]);return _0x1f576b['getDescriptions'](_0x1c4230);}})['then'](function(_0x54b7dd){if(_0x54b7dd){_0x2b8b1a=_0x54b7dd[_0x41cd('0x51')];if(!_0x5a86bd['query']['hasOwnProperty'](_0x41cd('0x40'))){_0x1c4230['limit']=qs[_0x41cd('0x28')](_0x5a86bd[_0x41cd('0x38')][_0x41cd('0x28')]);_0x1c4230[_0x41cd('0x27')]=qs[_0x41cd('0x27')](_0x5a86bd[_0x41cd('0x38')][_0x41cd('0x27')]);}return _0x1f576b[_0x41cd('0x59')](_0x1c4230);}})[_0x41cd('0x1a')](function(_0x3465a6){if(_0x3465a6){return _0x3465a6?{'count':_0x2b8b1a,'rows':_0x3465a6}:null;}})['then'](respondWithResult(_0x5e9ca7,null))[_0x41cd('0x4e')](handleError(_0x5e9ca7,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index ba6e913..01c51ef 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 _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 +var _0xaded=['int_servicenow_configurations','lodash','../../config/logger','moment','request-promise','path','./intServicenowConfiguration.attributes','define','ServicenowConfiguration'];(function(_0x178693,_0xb4ad94){var _0x3172f0=function(_0x230c2b){while(--_0x230c2b){_0x178693['push'](_0x178693['shift']());}};_0x3172f0(++_0xb4ad94);}(_0xaded,0x88));var _0xdade=function(_0x2fd05d,_0x22cb2e){_0x2fd05d=_0x2fd05d-0x0;var _0xe2bbef=_0xaded[_0x2fd05d];return _0xe2bbef;};'use strict';var _=require(_0xdade('0x0'));var util=require('util');var logger=require(_0xdade('0x1'))('api');var moment=require(_0xdade('0x2'));var BPromise=require('bluebird');var rp=require(_0xdade('0x3'));var fs=require('fs');var path=require(_0xdade('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdade('0x5'));module['exports']=function(_0x39197d,_0x5634dd){return _0x39197d[_0xdade('0x6')](_0xdade('0x7'),attributes,{'tableName':_0xdade('0x8'),'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 6711880..571bc0a 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 _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 +var _0x1198=['error','code','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5e2c54,_0x65d68e){var _0x71e591=function(_0x1f4468){while(--_0x1f4468){_0x5e2c54['push'](_0x5e2c54['shift']());}};_0x71e591(++_0x65d68e);}(_0x1198,0x9c));var _0x8119=function(_0x593bb5,_0x20506b){_0x593bb5=_0x593bb5-0x0;var _0x416968=_0x1198[_0x593bb5];return _0x416968;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8119('0x0'));var rs=require(_0x8119('0x1'));var fs=require('fs');var Redis=require(_0x8119('0x2'));var db=require(_0x8119('0x3'))['db'];var utils=require(_0x8119('0x4'));var logger=require(_0x8119('0x5'))(_0x8119('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8119('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x369643,_0x1430fe,_0x4c8fef){return new BPromise(function(_0x4fdf0e,_0x505a80){return client[_0x8119('0x8')](_0x369643,_0x4c8fef)[_0x8119('0x9')](function(_0x585db8){logger[_0x8119('0xa')](_0x8119('0xb'),_0x1430fe,'request\x20sent');logger['debug'](_0x8119('0xc'),_0x1430fe,_0x8119('0xd'),JSON[_0x8119('0xe')](_0x585db8));if(_0x585db8[_0x8119('0xf')]){if(_0x585db8['error'][_0x8119('0x10')]===0x1f4){logger[_0x8119('0xf')](_0x8119('0xb'),_0x1430fe,_0x585db8['error']['message']);return _0x505a80(_0x585db8[_0x8119('0xf')][_0x8119('0x11')]);}logger[_0x8119('0xf')](_0x8119('0xb'),_0x1430fe,_0x585db8[_0x8119('0xf')][_0x8119('0x11')]);return _0x4fdf0e(_0x585db8[_0x8119('0xf')][_0x8119('0x11')]);}else{logger[_0x8119('0xa')](_0x8119('0xb'),_0x1430fe,_0x8119('0xd'));_0x4fdf0e(_0x585db8[_0x8119('0x12')][_0x8119('0x11')]);}})['catch'](function(_0x379858){logger[_0x8119('0xf')](_0x8119('0xb'),_0x1430fe,_0x379858);_0x505a80(_0x379858);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 36992a3..55c0b0b 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 _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 +var _0x2ddb=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','put','/:id','update','destroy','exports','multer','util','path','express','Router'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0x2ddb,0x8b));var _0xb2dd=function(_0x1368cb,_0x39ec61){_0x1368cb=_0x1368cb-0x0;var _0xffca30=_0x2ddb[_0x1368cb];return _0xffca30;};'use strict';var multer=require(_0xb2dd('0x0'));var util=require(_0xb2dd('0x1'));var path=require(_0xb2dd('0x2'));var timeout=require('connect-timeout');var express=require(_0xb2dd('0x3'));var router=express[_0xb2dd('0x4')]();var auth=require(_0xb2dd('0x5'));var interaction=require(_0xb2dd('0x6'));var config=require(_0xb2dd('0x7'));var controller=require('./intServicenowField.controller');router[_0xb2dd('0x8')]('/',auth[_0xb2dd('0x9')](),controller[_0xb2dd('0xa')]);router[_0xb2dd('0x8')]('/:id',auth[_0xb2dd('0x9')](),controller[_0xb2dd('0xb')]);router[_0xb2dd('0xc')]('/',auth[_0xb2dd('0x9')](),controller['create']);router[_0xb2dd('0xd')](_0xb2dd('0xe'),auth[_0xb2dd('0x9')](),controller[_0xb2dd('0xf')]);router['delete'](_0xb2dd('0xe'),auth['isAuthenticated'](),controller[_0xb2dd('0x10')]);module[_0xb2dd('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 40e9367..1d07950 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 _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 +var _0x976a=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x976a,0xf4));var _0xa976=function(_0x9d53fb,_0x4b898b){_0x9d53fb=_0x9d53fb-0x0;var _0x12f955=_0x976a[_0x9d53fb];return _0x12f955;};'use strict';var Sequelize=require(_0xa976('0x0'));module[_0xa976('0x1')]={'type':{'type':Sequelize[_0xa976('0x2')]('string',_0xa976('0x3'),_0xa976('0x4'),_0xa976('0x5')),'defaultValue':_0xa976('0x6')},'content':{'type':Sequelize[_0xa976('0x7')]},'key':{'type':Sequelize[_0xa976('0x7')]},'keyType':{'type':Sequelize[_0xa976('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xa976('0x7')]},'idField':{'type':Sequelize[_0xa976('0x7')]},'nameField':{'type':Sequelize[_0xa976('0x7')]},'customField':{'type':Sequelize[_0xa976('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa976('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 51103b4..aa5595f 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 _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 +var _0x143a=['include','findAll','rows','catch','params','keys','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','save','update','destroy','error','stack','name','send','index','ServicenowField','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','length','attributes','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll'];(function(_0x410f5b,_0x1ced96){var _0x227ad9=function(_0x22fb17){while(--_0x22fb17){_0x410f5b['push'](_0x410f5b['shift']());}};_0x227ad9(++_0x1ced96);}(_0x143a,0x1b9));var _0xa143=function(_0x16ab75,_0x2143a6){_0x16ab75=_0x16ab75-0x0;var _0xb88c63=_0x143a[_0x16ab75];return _0xb88c63;};'use strict';var pdf=require(_0xa143('0x0'));var emlformat=require(_0xa143('0x1'));var rimraf=require(_0xa143('0x2'));var zipdir=require(_0xa143('0x3'));var jsonpatch=require(_0xa143('0x4'));var rp=require('request-promise');var moment=require(_0xa143('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa143('0x6'));var util=require('util');var path=require(_0xa143('0x7'));var sox=require(_0xa143('0x8'));var csv=require(_0xa143('0x9'));var ejs=require(_0xa143('0xa'));var fs=require('fs');var _=require(_0xa143('0xb'));var squel=require(_0xa143('0xc'));var crypto=require(_0xa143('0xd'));var jsforce=require(_0xa143('0xe'));var deskjs=require(_0xa143('0xf'));var toCsv=require(_0xa143('0x9'));var querystring=require(_0xa143('0x10'));var Papa=require(_0xa143('0x11'));var Redis=require('ioredis');var authService=require(_0xa143('0x12'));var qs=require(_0xa143('0x13'));var as=require(_0xa143('0x14'));var hardwareService=require(_0xa143('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xa143('0x16'));var config=require(_0xa143('0x17'));var licenseUtil=require(_0xa143('0x18'));var db=require(_0xa143('0x19'))['db'];function respondWithStatusCode(_0xc3cc21,_0x3a5c00){_0x3a5c00=_0x3a5c00||0xcc;return function(_0x226303){if(_0x226303){return _0xc3cc21[_0xa143('0x1a')](_0x3a5c00);}return _0xc3cc21[_0xa143('0x1b')](_0x3a5c00)[_0xa143('0x1c')]();};}function respondWithResult(_0x49807f,_0x1988fe){_0x1988fe=_0x1988fe||0xc8;return function(_0x29146e){if(_0x29146e){return _0x49807f[_0xa143('0x1b')](_0x1988fe)[_0xa143('0x1d')](_0x29146e);}};}function respondWithFilteredResult(_0x4318c1,_0x47d554){return function(_0x72f2c7){if(_0x72f2c7){var _0x3f2771=_0x72f2c7[_0xa143('0x1e')],_0x3e6572=_0x47d554[_0xa143('0x1f')],_0x5aab5f=_0x47d554['offset']+_0x47d554[_0xa143('0x20')],_0x4935ad;if(_0x5aab5f>=_0x3f2771){_0x5aab5f=_0x3f2771;_0x4935ad=0xc8;}else{_0x4935ad=0xce;}_0x4318c1[_0xa143('0x1b')](_0x4935ad);return _0x4318c1['set']('Content-Range',_0x3e6572+'-'+_0x5aab5f+'/'+_0x3f2771)[_0xa143('0x1d')](_0x72f2c7);}return null;};}function patchUpdates(_0x147a4d){return function(_0xae3471){try{jsonpatch['apply'](_0xae3471,_0x147a4d,!![]);}catch(_0x3d6453){return BPromise['reject'](_0x3d6453);}return _0xae3471[_0xa143('0x21')]();};}function saveUpdates(_0x25254a,_0x27d8a8){return function(_0xedb252){if(_0xedb252){return _0xedb252[_0xa143('0x22')](_0x25254a)['then'](function(_0x3170b2){return _0x3170b2;});}return null;};}function removeEntity(_0x3a1998,_0x51eb32){return function(_0x419024){if(_0x419024){return _0x419024[_0xa143('0x23')]()['then'](function(){_0x3a1998[_0xa143('0x1b')](0xcc)[_0xa143('0x1c')]();});}};}function handleEntityNotFound(_0x320f20,_0x317b5f){return function(_0x474000){if(!_0x474000){_0x320f20[_0xa143('0x1a')](0x194);}return _0x474000;};}function handleError(_0x26b7f1,_0x10def0){_0x10def0=_0x10def0||0x1f4;return function(_0x2467ac){logger[_0xa143('0x24')](_0x2467ac[_0xa143('0x25')]);if(_0x2467ac['name']){delete _0x2467ac[_0xa143('0x26')];}_0x26b7f1['status'](_0x10def0)[_0xa143('0x27')](_0x2467ac);};}exports[_0xa143('0x28')]=function(_0x422e04,_0x4fc21e){var _0x5b68e0={},_0x565580={},_0x533e13={'count':0x0,'rows':[]};var _0x1fc193=_['map'](db[_0xa143('0x29')][_0xa143('0x2a')],function(_0xb6144c){return{'name':_0xb6144c[_0xa143('0x2b')],'type':_0xb6144c[_0xa143('0x2c')]['key']};});_0x565580[_0xa143('0x2d')]=_[_0xa143('0x2e')](_0x1fc193,'name');_0x565580['query']=_['keys'](_0x422e04[_0xa143('0x2f')]);_0x565580[_0xa143('0x30')]=_[_0xa143('0x31')](_0x565580[_0xa143('0x2d')],_0x565580[_0xa143('0x2f')]);_0x5b68e0['attributes']=_[_0xa143('0x31')](_0x565580[_0xa143('0x2d')],qs[_0xa143('0x32')](_0x422e04[_0xa143('0x2f')][_0xa143('0x32')]));_0x5b68e0['attributes']=_0x5b68e0['attributes'][_0xa143('0x33')]?_0x5b68e0[_0xa143('0x34')]:_0x565580[_0xa143('0x2d')];if(!_0x422e04[_0xa143('0x2f')]['hasOwnProperty'](_0xa143('0x35'))){_0x5b68e0['limit']=qs[_0xa143('0x20')](_0x422e04[_0xa143('0x2f')][_0xa143('0x20')]);_0x5b68e0[_0xa143('0x1f')]=qs[_0xa143('0x1f')](_0x422e04[_0xa143('0x2f')]['offset']);}_0x5b68e0['order']=qs['sort'](_0x422e04['query'][_0xa143('0x36')]);_0x5b68e0[_0xa143('0x37')]=qs[_0xa143('0x30')](_[_0xa143('0x38')](_0x422e04[_0xa143('0x2f')],_0x565580[_0xa143('0x30')]),_0x1fc193);if(_0x422e04[_0xa143('0x2f')][_0xa143('0x39')]){_0x5b68e0[_0xa143('0x37')]=_['merge'](_0x5b68e0[_0xa143('0x37')],{'$or':_['map'](_0x1fc193,function(_0x26bc2f){if(_0x26bc2f[_0xa143('0x2c')]!==_0xa143('0x3a')){var _0x2ddc21={};_0x2ddc21[_0x26bc2f[_0xa143('0x26')]]={'$like':'%'+_0x422e04['query'][_0xa143('0x39')]+'%'};return _0x2ddc21;}})});}_0x5b68e0=_[_0xa143('0x3b')]({},_0x5b68e0,_0x422e04[_0xa143('0x3c')]);var _0x342eac={'where':_0x5b68e0[_0xa143('0x37')]};return db[_0xa143('0x29')]['count'](_0x342eac)[_0xa143('0x3d')](function(_0x4a6057){_0x533e13[_0xa143('0x1e')]=_0x4a6057;if(_0x422e04[_0xa143('0x2f')][_0xa143('0x3e')]){_0x5b68e0[_0xa143('0x3f')]=[{'all':!![]}];}return db['ServicenowField'][_0xa143('0x40')](_0x5b68e0);})['then'](function(_0x8a24c5){_0x533e13[_0xa143('0x41')]=_0x8a24c5;return _0x533e13;})[_0xa143('0x3d')](respondWithFilteredResult(_0x4fc21e,_0x5b68e0))[_0xa143('0x42')](handleError(_0x4fc21e,null));};exports['show']=function(_0x18a00e,_0x5e2f11){var _0x5218e5={'raw':!![],'where':{'id':_0x18a00e[_0xa143('0x43')]['id']}},_0x172f33={};_0x172f33[_0xa143('0x2d')]=_[_0xa143('0x44')](db[_0xa143('0x29')]['rawAttributes']);_0x172f33[_0xa143('0x2f')]=_[_0xa143('0x44')](_0x18a00e[_0xa143('0x2f')]);_0x172f33['filters']=_[_0xa143('0x31')](_0x172f33['model'],_0x172f33[_0xa143('0x2f')]);_0x5218e5[_0xa143('0x34')]=_[_0xa143('0x31')](_0x172f33[_0xa143('0x2d')],qs[_0xa143('0x32')](_0x18a00e[_0xa143('0x2f')]['fields']));_0x5218e5[_0xa143('0x34')]=_0x5218e5[_0xa143('0x34')][_0xa143('0x33')]?_0x5218e5['attributes']:_0x172f33[_0xa143('0x2d')];if(_0x18a00e['query'][_0xa143('0x3e')]){_0x5218e5[_0xa143('0x3f')]=[{'all':!![]}];}_0x5218e5=_[_0xa143('0x3b')]({},_0x5218e5,_0x18a00e[_0xa143('0x3c')]);return db[_0xa143('0x29')]['find'](_0x5218e5)[_0xa143('0x3d')](handleEntityNotFound(_0x5e2f11,null))['then'](respondWithResult(_0x5e2f11,null))[_0xa143('0x42')](handleError(_0x5e2f11,null));};exports['create']=function(_0x1d461d,_0x10fb5c){return db[_0xa143('0x29')][_0xa143('0x45')](_0x1d461d[_0xa143('0x46')],{})['then'](respondWithResult(_0x10fb5c,0xc9))[_0xa143('0x42')](handleError(_0x10fb5c,null));};exports[_0xa143('0x22')]=function(_0x16c60d,_0x1aef5){if(_0x16c60d[_0xa143('0x46')]['id']){delete _0x16c60d[_0xa143('0x46')]['id'];}return db['ServicenowField'][_0xa143('0x47')]({'where':{'id':_0x16c60d['params']['id']}})[_0xa143('0x3d')](handleEntityNotFound(_0x1aef5,null))[_0xa143('0x3d')](saveUpdates(_0x16c60d[_0xa143('0x46')],null))[_0xa143('0x3d')](respondWithResult(_0x1aef5,null))['catch'](handleError(_0x1aef5,null));};exports[_0xa143('0x23')]=function(_0x27369f,_0x2b8b4a){return db[_0xa143('0x29')][_0xa143('0x47')]({'where':{'id':_0x27369f['params']['id']}})['then'](handleEntityNotFound(_0x2b8b4a,null))[_0xa143('0x3d')](removeEntity(_0x2b8b4a,null))['catch'](handleError(_0x2b8b4a,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 768cedc..4a8dfdc 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 _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 +var _0x54ae=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0x54ae,0x1c1));var _0xe54a=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0x54ae[_0x184759];return _0xf26d5f;};'use strict';var _=require(_0xe54a('0x0'));var util=require(_0xe54a('0x1'));var logger=require(_0xe54a('0x2'))(_0xe54a('0x3'));var moment=require('moment');var BPromise=require(_0xe54a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe54a('0x5'));var rimraf=require(_0xe54a('0x6'));var config=require(_0xe54a('0x7'));var attributes=require(_0xe54a('0x8'));module[_0xe54a('0x9')]=function(_0x1de682,_0x2eaa29){return _0x1de682[_0xe54a('0xa')](_0xe54a('0xb'),attributes,{'tableName':_0xe54a('0xc'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xe54a('0xd'),_0xe54a('0xe')],'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 874023a..d44ae0b 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 _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 +var _0x8369=['debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','../../mysqldb','rpc','jayson/promise','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent'];(function(_0x273ae9,_0x91023d){var _0x3a0da6=function(_0xcf9cf5){while(--_0xcf9cf5){_0x273ae9['push'](_0x273ae9['shift']());}};_0x3a0da6(++_0x91023d);}(_0x8369,0x1f4));var _0x9836=function(_0x418b44,_0x457196){_0x418b44=_0x418b44-0x0;var _0x5c70ab=_0x8369[_0x418b44];return _0x5c70ab;};'use strict';var _=require(_0x9836('0x0'));var util=require(_0x9836('0x1'));var moment=require(_0x9836('0x2'));var BPromise=require('bluebird');var rs=require(_0x9836('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9836('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9836('0x5'));var config=require('../../config/environment');var jayson=require(_0x9836('0x6'));var client=jayson['client'][_0x9836('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x527c45,_0x173c44,_0x2c1243){return new BPromise(function(_0xc50d60,_0x4369b5){return client[_0x9836('0x8')](_0x527c45,_0x2c1243)[_0x9836('0x9')](function(_0x57da48){logger[_0x9836('0xa')](_0x9836('0xb'),_0x173c44,_0x9836('0xc'));logger[_0x9836('0xd')](_0x9836('0xe'),_0x173c44,_0x9836('0xc'),JSON[_0x9836('0xf')](_0x57da48));if(_0x57da48['error']){if(_0x57da48[_0x9836('0x10')][_0x9836('0x11')]===0x1f4){logger[_0x9836('0x10')](_0x9836('0xb'),_0x173c44,_0x57da48['error'][_0x9836('0x12')]);return _0x4369b5(_0x57da48[_0x9836('0x10')]['message']);}logger[_0x9836('0x10')](_0x9836('0xb'),_0x173c44,_0x57da48[_0x9836('0x10')]['message']);return _0xc50d60(_0x57da48[_0x9836('0x10')][_0x9836('0x12')]);}else{logger[_0x9836('0xa')](_0x9836('0xb'),_0x173c44,_0x9836('0xc'));_0xc50d60(_0x57da48['result'][_0x9836('0x12')]);}})['catch'](function(_0x182128){logger[_0x9836('0x10')](_0x9836('0xb'),_0x173c44,_0x182128);_0x4369b5(_0x182128);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 1fad374..3bf5ae8 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 _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 +var _0xbaa9=['post','create','addConfiguration','put','update','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x28734d,_0x4d9ce9){var _0x43bd5f=function(_0x3c114b){while(--_0x3c114b){_0x28734d['push'](_0x28734d['shift']());}};_0x43bd5f(++_0x4d9ce9);}(_0xbaa9,0x188));var _0x9baa=function(_0x43be88,_0x439614){_0x43be88=_0x43be88-0x0;var _0x3d4e6c=_0xbaa9[_0x43be88];return _0x3d4e6c;};'use strict';var multer=require(_0x9baa('0x0'));var util=require('util');var path=require(_0x9baa('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9baa('0x2')]();var auth=require(_0x9baa('0x3'));var interaction=require(_0x9baa('0x4'));var config=require(_0x9baa('0x5'));var controller=require(_0x9baa('0x6'));router[_0x9baa('0x7')]('/',auth['isAuthenticated'](),controller[_0x9baa('0x8')]);router['get'](_0x9baa('0x9'),auth[_0x9baa('0xa')](),controller[_0x9baa('0xb')]);router[_0x9baa('0x7')](_0x9baa('0xc'),auth['isAuthenticated'](),controller[_0x9baa('0xd')]);router[_0x9baa('0x7')](_0x9baa('0xe'),auth[_0x9baa('0xa')](),controller[_0x9baa('0xf')]);router[_0x9baa('0x10')]('/',auth[_0x9baa('0xa')](),controller[_0x9baa('0x11')]);router['post'](_0x9baa('0xc'),auth[_0x9baa('0xa')](),controller[_0x9baa('0x12')]);router[_0x9baa('0x13')](_0x9baa('0x9'),auth[_0x9baa('0xa')](),controller[_0x9baa('0x14')]);router[_0x9baa('0x15')](_0x9baa('0x9'),auth[_0x9baa('0xa')](),controller[_0x9baa('0x16')]);module[_0x9baa('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index b707240..f19342c 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 _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 +var _0x0490=['STRING','username','remoteUri','exports'];(function(_0x29424b,_0x13c4d5){var _0x370548=function(_0x20dac0){while(--_0x20dac0){_0x29424b['push'](_0x29424b['shift']());}};_0x370548(++_0x13c4d5);}(_0x0490,0x137));var _0x0049=function(_0x27fd15,_0x553a8d){_0x27fd15=_0x27fd15-0x0;var _0x12b06c=_0x0490[_0x27fd15];return _0x12b06c;};'use strict';var Sequelize=require('sequelize');module[_0x0049('0x0')]={'name':{'type':Sequelize[_0x0049('0x1')]},'description':{'type':Sequelize[_0x0049('0x1')]},'username':{'type':Sequelize[_0x0049('0x1')],'unique':_0x0049('0x2')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0049('0x1')],'unique':_0x0049('0x3')},'serverUrl':{'type':Sequelize[_0x0049('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 3554b4d..0253b18 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 _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 +var _0x3f26=['addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction','username','password','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','POST','get_module_fields','Calls','module_fields','remove','includes','label','endsWith','values','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','apply','destroy','end','name','send','SugarcrmAccount','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','update','getConfigurations','findOne','options'];(function(_0x27d0d6,_0xc29871){var _0x8c2773=function(_0x39db79){while(--_0x39db79){_0x27d0d6['push'](_0x27d0d6['shift']());}};_0x8c2773(++_0xc29871);}(_0x3f26,0x1a6));var _0x63f2=function(_0x5a4c25,_0x332e73){_0x5a4c25=_0x5a4c25-0x0;var _0xbd8c49=_0x3f26[_0x5a4c25];return _0xbd8c49;};'use strict';var pdf=require(_0x63f2('0x0'));var emlformat=require(_0x63f2('0x1'));var rimraf=require(_0x63f2('0x2'));var zipdir=require(_0x63f2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x63f2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x63f2('0x5'));var util=require(_0x63f2('0x6'));var path=require(_0x63f2('0x7'));var sox=require(_0x63f2('0x8'));var csv=require(_0x63f2('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x63f2('0xa'));var squel=require(_0x63f2('0xb'));var crypto=require(_0x63f2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x63f2('0xd'));var toCsv=require(_0x63f2('0x9'));var querystring=require(_0x63f2('0xe'));var Papa=require(_0x63f2('0xf'));var Redis=require(_0x63f2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x63f2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x63f2('0x12'));var logger=require(_0x63f2('0x13'))(_0x63f2('0x14'));var utils=require('../../config/utils');var config=require(_0x63f2('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x63f2('0x16'));var jayson=require(_0x63f2('0x17'));var client=jayson[_0x63f2('0x18')][_0x63f2('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x22eaf6,_0x3d526d,_0x3dab8f,_0x223332){return new BPromise(function(_0x3c59fa,_0xfe0054){var _0x2a5e20=_0x223332||client;return _0x2a5e20[_0x63f2('0x1a')](_0x22eaf6,_0x3dab8f)[_0x63f2('0x1b')](function(_0x103ea4){logger[_0x63f2('0x1c')](_0x63f2('0x1d'),_0x3d526d,'request\x20sent');logger[_0x63f2('0x1e')](_0x63f2('0x1f'),_0x3d526d,'request\x20sent',JSON['stringify'](_0x103ea4));if(_0x103ea4[_0x63f2('0x20')]){if(_0x103ea4['error']['code']===0x1f4){logger[_0x63f2('0x20')](_0x63f2('0x1d'),_0x3d526d,_0x103ea4['error'][_0x63f2('0x21')]);return _0xfe0054(_0x103ea4['error'][_0x63f2('0x21')]);}logger[_0x63f2('0x20')](_0x63f2('0x1d'),_0x3d526d,_0x103ea4[_0x63f2('0x20')][_0x63f2('0x21')]);return _0x3c59fa(_0x103ea4[_0x63f2('0x20')][_0x63f2('0x21')]);}else{logger[_0x63f2('0x1c')](_0x63f2('0x1d'),_0x3d526d,'request\x20sent');_0x3c59fa(_0x103ea4[_0x63f2('0x22')][_0x63f2('0x21')]);}})[_0x63f2('0x23')](function(_0x4abcf2){logger[_0x63f2('0x20')]('SugarcrmAccount,\x20%s,\x20%s',_0x3d526d,_0x4abcf2);_0xfe0054(_0x4abcf2);});});}function respondWithStatusCode(_0x29fc52,_0x2ce63f){_0x2ce63f=_0x2ce63f||0xcc;return function(_0x283c3c){if(_0x283c3c){return _0x29fc52[_0x63f2('0x24')](_0x2ce63f);}return _0x29fc52[_0x63f2('0x25')](_0x2ce63f)['end']();};}function respondWithResult(_0x4a2ded,_0x589e22){_0x589e22=_0x589e22||0xc8;return function(_0x58b260){if(_0x58b260){return _0x4a2ded[_0x63f2('0x25')](_0x589e22)['json'](_0x58b260);}};}function respondWithFilteredResult(_0x57739c,_0x57f27b){return function(_0x3237e3){if(_0x3237e3){var _0x46066e=_0x3237e3[_0x63f2('0x26')],_0x3da56c=_0x57f27b[_0x63f2('0x27')],_0x38b65a=_0x57f27b['offset']+_0x57f27b[_0x63f2('0x28')],_0x9a9cf8;if(_0x38b65a>=_0x46066e){_0x38b65a=_0x46066e;_0x9a9cf8=0xc8;}else{_0x9a9cf8=0xce;}_0x57739c[_0x63f2('0x25')](_0x9a9cf8);return _0x57739c[_0x63f2('0x29')](_0x63f2('0x2a'),_0x3da56c+'-'+_0x38b65a+'/'+_0x46066e)['json'](_0x3237e3);}return null;};}function patchUpdates(_0x589dd8){return function(_0x2a45eb){try{jsonpatch[_0x63f2('0x2b')](_0x2a45eb,_0x589dd8,!![]);}catch(_0x1a9bed){return BPromise['reject'](_0x1a9bed);}return _0x2a45eb['save']();};}function saveUpdates(_0x102f1e,_0x490313){return function(_0x490549){if(_0x490549){return _0x490549['update'](_0x102f1e)[_0x63f2('0x1b')](function(_0x4573e9){return _0x4573e9;});}return null;};}function removeEntity(_0x21b85b,_0x4c4a23){return function(_0x237663){if(_0x237663){return _0x237663[_0x63f2('0x2c')]()[_0x63f2('0x1b')](function(){_0x21b85b[_0x63f2('0x25')](0xcc)[_0x63f2('0x2d')]();});}};}function handleEntityNotFound(_0x365a19,_0x127760){return function(_0x5bfe2b){if(!_0x5bfe2b){_0x365a19['sendStatus'](0x194);}return _0x5bfe2b;};}function handleError(_0x197c9d,_0x454d8b){_0x454d8b=_0x454d8b||0x1f4;return function(_0x47af0a){logger[_0x63f2('0x20')](_0x47af0a['stack']);if(_0x47af0a[_0x63f2('0x2e')]){delete _0x47af0a[_0x63f2('0x2e')];}_0x197c9d[_0x63f2('0x25')](_0x454d8b)[_0x63f2('0x2f')](_0x47af0a);};}exports['index']=function(_0xc5cfc7,_0x4f6bb8){var _0x1dc66b={},_0x5b5b60={},_0x3ce130={'count':0x0,'rows':[]};var _0x61ff79=_['map'](db[_0x63f2('0x30')]['rawAttributes'],function(_0x2cdf12){return{'name':_0x2cdf12['fieldName'],'type':_0x2cdf12[_0x63f2('0x31')]['key']};});_0x5b5b60[_0x63f2('0x32')]=_[_0x63f2('0x33')](_0x61ff79,'name');_0x5b5b60[_0x63f2('0x34')]=_[_0x63f2('0x35')](_0xc5cfc7[_0x63f2('0x34')]);_0x5b5b60['filters']=_[_0x63f2('0x36')](_0x5b5b60[_0x63f2('0x32')],_0x5b5b60['query']);_0x1dc66b[_0x63f2('0x37')]=_[_0x63f2('0x36')](_0x5b5b60[_0x63f2('0x32')],qs[_0x63f2('0x38')](_0xc5cfc7[_0x63f2('0x34')][_0x63f2('0x38')]));_0x1dc66b[_0x63f2('0x37')]=_0x1dc66b['attributes'][_0x63f2('0x39')]?_0x1dc66b[_0x63f2('0x37')]:_0x5b5b60['model'];if(!_0xc5cfc7['query'][_0x63f2('0x3a')](_0x63f2('0x3b'))){_0x1dc66b[_0x63f2('0x28')]=qs['limit'](_0xc5cfc7[_0x63f2('0x34')]['limit']);_0x1dc66b[_0x63f2('0x27')]=qs[_0x63f2('0x27')](_0xc5cfc7[_0x63f2('0x34')]['offset']);}_0x1dc66b[_0x63f2('0x3c')]=qs[_0x63f2('0x3d')](_0xc5cfc7[_0x63f2('0x34')][_0x63f2('0x3d')]);_0x1dc66b[_0x63f2('0x3e')]=qs[_0x63f2('0x3f')](_[_0x63f2('0x40')](_0xc5cfc7['query'],_0x5b5b60['filters']),_0x61ff79);if(_0xc5cfc7[_0x63f2('0x34')]['filter']){_0x1dc66b[_0x63f2('0x3e')]=_['merge'](_0x1dc66b[_0x63f2('0x3e')],{'$or':_['map'](_0x61ff79,function(_0x20c381){if(_0x20c381[_0x63f2('0x31')]!==_0x63f2('0x41')){var _0x2cadde={};_0x2cadde[_0x20c381['name']]={'$like':'%'+_0xc5cfc7[_0x63f2('0x34')][_0x63f2('0x42')]+'%'};return _0x2cadde;}})});}_0x1dc66b=_[_0x63f2('0x43')]({},_0x1dc66b,_0xc5cfc7['options']);var _0x4d527f={'where':_0x1dc66b[_0x63f2('0x3e')]};return db[_0x63f2('0x30')][_0x63f2('0x26')](_0x4d527f)[_0x63f2('0x1b')](function(_0x33afee){_0x3ce130[_0x63f2('0x26')]=_0x33afee;if(_0xc5cfc7[_0x63f2('0x34')][_0x63f2('0x44')]){_0x1dc66b[_0x63f2('0x45')]=[{'all':!![]}];}return db[_0x63f2('0x30')][_0x63f2('0x46')](_0x1dc66b);})[_0x63f2('0x1b')](function(_0x3ac99e){_0x3ce130[_0x63f2('0x47')]=_0x3ac99e;return _0x3ce130;})[_0x63f2('0x1b')](respondWithFilteredResult(_0x4f6bb8,_0x1dc66b))[_0x63f2('0x23')](handleError(_0x4f6bb8,null));};exports[_0x63f2('0x48')]=function(_0x4ab637,_0x5a4c8d){var _0x58815c={'raw':![],'where':{'id':_0x4ab637[_0x63f2('0x49')]['id']}},_0x438129={};_0x438129['model']=_[_0x63f2('0x35')](db[_0x63f2('0x30')][_0x63f2('0x4a')]);_0x438129[_0x63f2('0x34')]=_[_0x63f2('0x35')](_0x4ab637[_0x63f2('0x34')]);_0x438129['filters']=_[_0x63f2('0x36')](_0x438129[_0x63f2('0x32')],_0x438129[_0x63f2('0x34')]);_0x58815c[_0x63f2('0x37')]=_[_0x63f2('0x36')](_0x438129[_0x63f2('0x32')],qs[_0x63f2('0x38')](_0x4ab637[_0x63f2('0x34')][_0x63f2('0x38')]));_0x58815c[_0x63f2('0x37')]=_0x58815c['attributes'][_0x63f2('0x39')]?_0x58815c[_0x63f2('0x37')]:_0x438129[_0x63f2('0x32')];if(_0x4ab637[_0x63f2('0x34')]['includeAll']){_0x58815c[_0x63f2('0x45')]=[{'all':!![]}];}_0x58815c=_['merge']({},_0x58815c,_0x4ab637['options']);return db[_0x63f2('0x30')][_0x63f2('0x4b')](_0x58815c)[_0x63f2('0x1b')](handleEntityNotFound(_0x5a4c8d,null))['then'](respondWithResult(_0x5a4c8d,null))[_0x63f2('0x23')](handleError(_0x5a4c8d,null));};exports[_0x63f2('0x4c')]=function(_0x46f33b,_0xc77149){return db[_0x63f2('0x30')]['create'](_0x46f33b[_0x63f2('0x4d')],{})[_0x63f2('0x1b')](respondWithResult(_0xc77149,0xc9))[_0x63f2('0x23')](handleError(_0xc77149,null));};exports[_0x63f2('0x4e')]=function(_0x33eeca,_0x1e4ceb){if(_0x33eeca[_0x63f2('0x4d')]['id']){delete _0x33eeca['body']['id'];}return db[_0x63f2('0x30')]['find']({'where':{'id':_0x33eeca[_0x63f2('0x49')]['id']}})['then'](handleEntityNotFound(_0x1e4ceb,null))[_0x63f2('0x1b')](saveUpdates(_0x33eeca['body'],null))[_0x63f2('0x1b')](respondWithResult(_0x1e4ceb,null))[_0x63f2('0x23')](handleError(_0x1e4ceb,null));};exports[_0x63f2('0x2c')]=function(_0x12c327,_0x10516a){return db[_0x63f2('0x30')][_0x63f2('0x4b')]({'where':{'id':_0x12c327['params']['id']}})['then'](handleEntityNotFound(_0x10516a,null))[_0x63f2('0x1b')](removeEntity(_0x10516a,null))['catch'](handleError(_0x10516a,null));};exports[_0x63f2('0x4f')]=function(_0xccb434,_0x454d5b,_0x1d33bc){var _0x10aebd={};var _0x124484={};var _0x31240a;var _0x535a82;return db[_0x63f2('0x30')][_0x63f2('0x50')]({'where':{'id':_0xccb434[_0x63f2('0x49')]['id']}})[_0x63f2('0x1b')](handleEntityNotFound(_0x454d5b,null))[_0x63f2('0x1b')](function(_0x2eea3c){if(_0x2eea3c){_0x31240a=_0x2eea3c;_0x124484[_0x63f2('0x32')]=_[_0x63f2('0x35')](db['SugarcrmConfiguration']['rawAttributes']);_0x124484[_0x63f2('0x34')]=_['keys'](_0xccb434[_0x63f2('0x34')]);_0x124484[_0x63f2('0x3f')]=_['intersection'](_0x124484[_0x63f2('0x32')],_0x124484[_0x63f2('0x34')]);_0x10aebd[_0x63f2('0x37')]=_['intersection'](_0x124484[_0x63f2('0x32')],qs['fields'](_0xccb434[_0x63f2('0x34')]['fields']));_0x10aebd[_0x63f2('0x37')]=_0x10aebd[_0x63f2('0x37')]['length']?_0x10aebd['attributes']:_0x124484[_0x63f2('0x32')];_0x10aebd['order']=qs['sort'](_0xccb434[_0x63f2('0x34')][_0x63f2('0x3d')]);_0x10aebd[_0x63f2('0x3e')]=qs[_0x63f2('0x3f')](_['pick'](_0xccb434[_0x63f2('0x34')],_0x124484[_0x63f2('0x3f')]));if(_0xccb434['query'][_0x63f2('0x42')]){_0x10aebd[_0x63f2('0x3e')]=_[_0x63f2('0x43')](_0x10aebd[_0x63f2('0x3e')],{'$or':_['map'](_0x10aebd[_0x63f2('0x37')],function(_0x3e3afd){var _0x12676e={};_0x12676e[_0x3e3afd]={'$like':'%'+_0xccb434[_0x63f2('0x34')][_0x63f2('0x42')]+'%'};return _0x12676e;})});}_0x10aebd=_['merge']({},_0x10aebd,_0xccb434[_0x63f2('0x51')]);return _0x31240a[_0x63f2('0x4f')](_0x10aebd);}})[_0x63f2('0x1b')](function(_0x2bd7ad){if(_0x2bd7ad){_0x535a82=_0x2bd7ad[_0x63f2('0x39')];if(!_0xccb434[_0x63f2('0x34')][_0x63f2('0x3a')]('nolimit')){_0x10aebd[_0x63f2('0x28')]=qs[_0x63f2('0x28')](_0xccb434[_0x63f2('0x34')][_0x63f2('0x28')]);_0x10aebd[_0x63f2('0x27')]=qs['offset'](_0xccb434['query'][_0x63f2('0x27')]);}return _0x31240a[_0x63f2('0x4f')](_0x10aebd);}})['then'](function(_0x4afc96){if(_0x4afc96){return _0x4afc96?{'count':_0x535a82,'rows':_0x4afc96}:null;}})[_0x63f2('0x1b')](respondWithResult(_0x454d5b,null))[_0x63f2('0x23')](handleError(_0x454d5b,null));};exports[_0x63f2('0x52')]=function(_0x1d4f2d,_0x46fe4e,_0x4cf4ef){if(_0x1d4f2d[_0x63f2('0x4d')]['id']){delete _0x1d4f2d[_0x63f2('0x4d')]['id'];}return db[_0x63f2('0x30')][_0x63f2('0x50')]({'where':{'id':_0x1d4f2d[_0x63f2('0x49')]['id']}})[_0x63f2('0x1b')](handleEntityNotFound(_0x46fe4e,null))[_0x63f2('0x1b')](function(_0x352c08){if(_0x352c08){_0x1d4f2d['body'][_0x63f2('0x53')]=_0x352c08['id'];_0x1d4f2d[_0x63f2('0x4d')][_0x63f2('0x54')]=integrations['getSubjects'](_0x1d4f2d['body']['channel'],_0x1d4f2d['body'][_0x63f2('0x31')]);_0x1d4f2d[_0x63f2('0x4d')][_0x63f2('0x55')]=integrations[_0x63f2('0x56')](_0x1d4f2d['body'][_0x63f2('0x57')],_0x1d4f2d[_0x63f2('0x4d')][_0x63f2('0x31')]);return db['SugarcrmConfiguration'][_0x63f2('0x4c')](_0x1d4f2d[_0x63f2('0x4d')],{'include':[{'model':db[_0x63f2('0x58')],'as':_0x63f2('0x54')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0x63f2('0x1b')](respondWithResult(_0x46fe4e,null))[_0x63f2('0x23')](handleError(_0x46fe4e,null));};exports[_0x63f2('0x59')]=function(_0xa239b,_0x12b020,_0xafa1ad){var _0x25e1fb='';var _0x2baf76=['id',_0x63f2('0x2e'),_0x63f2('0x5a'),_0x63f2('0x5b'),_0x63f2('0x5c'),_0x63f2('0x5d'),_0x63f2('0x5e'),_0x63f2('0x5f'),_0x63f2('0x60'),_0x63f2('0x61'),'parent_name',_0x63f2('0x62')];return db[_0x63f2('0x30')][_0x63f2('0x50')]({'where':{'id':_0xa239b[_0x63f2('0x49')]['id']},'attributes':['id',_0x63f2('0x63'),_0x63f2('0x64'),'remoteUri']})[_0x63f2('0x1b')](handleEntityNotFound(_0x12b020,null))['then'](function(_0x72a6aa){if(_0x72a6aa){_0x25e1fb=_0x72a6aa['remoteUri'];var _0x26d0a5=_0x25e1fb[_0x63f2('0x65')](-0x1);if(_0x26d0a5==='/'){_0x25e1fb=_0x25e1fb[_0x63f2('0x66')](0x0,_0x25e1fb[_0x63f2('0x67')](_0x26d0a5));}return rp({'method':'POST','uri':util[_0x63f2('0x68')](_0x63f2('0x69'),_0x25e1fb,_0x63f2('0x6a')),'json':!![],'form':{'method':'login','input_type':_0x63f2('0x6b'),'response_type':_0x63f2('0x6b'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x72a6aa[_0x63f2('0x63')],'password':_0x72a6aa[_0x63f2('0x64')],'encryption':_0x63f2('0x6c')},'application':_0x63f2('0x6d')})}});}})['then'](function(_0x2a6ad1){if(_0x2a6ad1&&_0x2a6ad1[_0x63f2('0x2e')]!==_0x63f2('0x6e')&&_0x2a6ad1[_0x63f2('0x2e')]!=='Password\x20Expired'){return rp({'method':_0x63f2('0x6f'),'uri':util[_0x63f2('0x68')]('%s%s',_0x25e1fb,_0x63f2('0x6a')),'json':!![],'form':{'method':_0x63f2('0x70'),'input_type':_0x63f2('0x6b'),'response_type':_0x63f2('0x6b'),'rest_data':JSON['stringify']({'session':_0x2a6ad1['id'],'module_name':_0x63f2('0x71')})}})[_0x63f2('0x1b')](function(_0x4918a9){if(_0x4918a9){var _0x20c826=_['values'](_0x4918a9[_0x63f2('0x72')]);_[_0x63f2('0x73')](_0x20c826,function(_0x26b97f){return _0x2baf76[_0x63f2('0x74')](_0x26b97f[_0x63f2('0x2e')]);});return{'count':_0x20c826[_0x63f2('0x39')],'rows':_[_0x63f2('0x33')](_0x20c826,function(_0x11e68e){return{'id':_0x11e68e[_0x63f2('0x2e')],'name':_0x11e68e[_0x63f2('0x75')],'custom':_[_0x63f2('0x76')](_0x11e68e[_0x63f2('0x2e')],'_c')?!![]:![],'options':_0x11e68e[_0x63f2('0x51')]?_[_0x63f2('0x33')](_[_0x63f2('0x77')](_0x11e68e[_0x63f2('0x51')]),function(_0x408e9d){return{'name':_0x408e9d[_0x63f2('0x78')],'value':_0x408e9d[_0x63f2('0x2e')]};}):[]};})};}})[_0x63f2('0x1b')](respondWithResult(_0x12b020,null))[_0x63f2('0x23')](function(_0x42a130){var _0x3c1b75=_0xa239b[_0x63f2('0x34')][_0x63f2('0x79')]?0x1f4:_0x42a130[_0x63f2('0x7a')]||0x1f4;logger[_0x63f2('0x20')](_0x63f2('0x7b'),_0x63f2('0x59'),_0x3c1b75,JSON[_0x63f2('0x7c')](_0x42a130));delete _0x42a130['name'];if(_0x3c1b75===0x191){_0x3c1b75=0x190;}_0x12b020[_0x63f2('0x25')](_0x3c1b75)[_0x63f2('0x2f')](_0xa239b[_0x63f2('0x34')]['test']?{'message':_0x63f2('0x7d'),'statusCode':_0x42a130[_0x63f2('0x7a')]}:_0x42a130);});}else{var _0x4e9de7=0x1f4;_0x12b020[_0x63f2('0x25')](_0x4e9de7)[_0x63f2('0x2f')]({'message':_0x63f2('0x7d'),'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 aa5b56c..c244a1d 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 _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 +var _0xd8e1=['bluebird','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','int_sugarcrm_accounts','lodash','util','moment'];(function(_0x3b76f7,_0x566c53){var _0x43984e=function(_0x164f77){while(--_0x164f77){_0x3b76f7['push'](_0x3b76f7['shift']());}};_0x43984e(++_0x566c53);}(_0xd8e1,0x1e1));var _0x1d8e=function(_0x26b4ba,_0x469d3d){_0x26b4ba=_0x26b4ba-0x0;var _0x577e09=_0xd8e1[_0x26b4ba];return _0x577e09;};'use strict';var _=require(_0x1d8e('0x0'));var util=require(_0x1d8e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1d8e('0x2'));var BPromise=require(_0x1d8e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1d8e('0x4'));var rimraf=require(_0x1d8e('0x5'));var config=require(_0x1d8e('0x6'));var attributes=require(_0x1d8e('0x7'));var integrations=require(_0x1d8e('0x8'));module['exports']=function(_0x1f1472,_0x5bb982){return _0x1f1472[_0x1d8e('0x9')]('SugarcrmAccount',attributes,{'tableName':_0x1d8e('0xa'),'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 83e0c50..1f85377 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 _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 +var _0x7f86=['map','model','include','attributes','ShowSugarcrmAccount','find','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f86,0x12f));var _0x67f8=function(_0x570902,_0x53de1b){_0x570902=_0x570902-0x0;var _0x567d29=_0x7f86[_0x570902];return _0x567d29;};'use strict';var _=require(_0x67f8('0x0'));var util=require(_0x67f8('0x1'));var moment=require(_0x67f8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x67f8('0x3'));var db=require(_0x67f8('0x4'))['db'];var utils=require(_0x67f8('0x5'));var logger=require(_0x67f8('0x6'))(_0x67f8('0x7'));var config=require('../../config/environment');var jayson=require(_0x67f8('0x8'));var client=jayson[_0x67f8('0x9')][_0x67f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x274381,_0x34c4a7,_0x394951){return new BPromise(function(_0x45938e,_0x372658){return client[_0x67f8('0xb')](_0x274381,_0x394951)[_0x67f8('0xc')](function(_0xe7716){logger[_0x67f8('0xd')](_0x67f8('0xe'),_0x34c4a7,_0x67f8('0xf'));logger['debug'](_0x67f8('0x10'),_0x34c4a7,'request\x20sent',JSON[_0x67f8('0x11')](_0xe7716));if(_0xe7716['error']){if(_0xe7716[_0x67f8('0x12')][_0x67f8('0x13')]===0x1f4){logger[_0x67f8('0x12')](_0x67f8('0xe'),_0x34c4a7,_0xe7716[_0x67f8('0x12')][_0x67f8('0x14')]);return _0x372658(_0xe7716[_0x67f8('0x12')]['message']);}logger[_0x67f8('0x12')](_0x67f8('0xe'),_0x34c4a7,_0xe7716[_0x67f8('0x12')][_0x67f8('0x14')]);return _0x45938e(_0xe7716[_0x67f8('0x12')][_0x67f8('0x14')]);}else{logger[_0x67f8('0xd')](_0x67f8('0xe'),_0x34c4a7,_0x67f8('0xf'));_0x45938e(_0xe7716[_0x67f8('0x15')][_0x67f8('0x14')]);}})[_0x67f8('0x16')](function(_0x442aa7){logger['error'](_0x67f8('0xe'),_0x34c4a7,_0x442aa7);_0x372658(_0x442aa7);});});}exports[_0x67f8('0x17')]=function(_0x2756e3){var _0x43052c=this;return new Promise(function(_0x489bf3,_0x2da2fc){return db[_0x67f8('0x18')][_0x67f8('0x19')]({'raw':_0x2756e3['options']?_0x2756e3[_0x67f8('0x1a')][_0x67f8('0x1b')]===undefined?!![]:![]:!![],'where':_0x2756e3['options']?_0x2756e3[_0x67f8('0x1a')][_0x67f8('0x1c')]||null:null,'attributes':_0x2756e3[_0x67f8('0x1a')]?_0x2756e3[_0x67f8('0x1a')]['attributes']||null:null,'limit':_0x2756e3[_0x67f8('0x1a')]?_0x2756e3['options'][_0x67f8('0x1d')]||null:null,'include':_0x2756e3[_0x67f8('0x1a')]?_0x2756e3[_0x67f8('0x1a')]['include']?_[_0x67f8('0x1e')](_0x2756e3[_0x67f8('0x1a')]['include'],function(_0x5c7126){return{'model':db[_0x5c7126[_0x67f8('0x1f')]],'as':_0x5c7126['as'],'attributes':_0x5c7126['attributes'],'include':_0x5c7126['include']?_[_0x67f8('0x1e')](_0x5c7126[_0x67f8('0x20')],function(_0x4ce14d){return{'model':db[_0x4ce14d['model']],'as':_0x4ce14d['as'],'attributes':_0x4ce14d[_0x67f8('0x21')],'include':_0x4ce14d[_0x67f8('0x20')]?_[_0x67f8('0x1e')](_0x4ce14d[_0x67f8('0x20')],function(_0x39e6fc){return{'model':db[_0x39e6fc[_0x67f8('0x1f')]],'as':_0x39e6fc['as'],'attributes':_0x39e6fc[_0x67f8('0x21')]};}):[]};}):[]};}):[]:[]})[_0x67f8('0xc')](function(_0x59502e){logger['info'](_0x67f8('0x17'),_0x2756e3);logger['debug'](_0x67f8('0x17'),_0x2756e3,JSON['stringify'](_0x59502e));_0x489bf3(_0x59502e);})[_0x67f8('0x16')](function(_0x34865d){logger[_0x67f8('0x12')](_0x67f8('0x17'),_0x34865d[_0x67f8('0x14')],_0x2756e3);_0x2da2fc(_0x43052c['error'](0x1f4,_0x34865d[_0x67f8('0x14')]));});});};exports[_0x67f8('0x22')]=function(_0x3713ea){var _0x59664b=this;return new Promise(function(_0x450027,_0x1f6813){return db[_0x67f8('0x18')][_0x67f8('0x23')]({'raw':_0x3713ea[_0x67f8('0x1a')]?_0x3713ea[_0x67f8('0x1a')][_0x67f8('0x1b')]===undefined?!![]:![]:!![],'where':_0x3713ea[_0x67f8('0x1a')]?_0x3713ea['options']['where']||null:null,'attributes':_0x3713ea[_0x67f8('0x1a')]?_0x3713ea[_0x67f8('0x1a')][_0x67f8('0x21')]||null:null,'include':_0x3713ea[_0x67f8('0x1a')]?_0x3713ea['options'][_0x67f8('0x20')]?_[_0x67f8('0x1e')](_0x3713ea[_0x67f8('0x1a')]['include'],function(_0x507391){return{'model':db[_0x507391['model']],'as':_0x507391['as'],'attributes':_0x507391[_0x67f8('0x21')],'include':_0x507391[_0x67f8('0x20')]?_[_0x67f8('0x1e')](_0x507391['include'],function(_0x3a1b83){return{'model':db[_0x3a1b83['model']],'as':_0x3a1b83['as'],'attributes':_0x3a1b83[_0x67f8('0x21')],'include':_0x3a1b83[_0x67f8('0x20')]?_[_0x67f8('0x1e')](_0x3a1b83[_0x67f8('0x20')],function(_0x3809fc){return{'model':db[_0x3809fc[_0x67f8('0x1f')]],'as':_0x3809fc['as'],'attributes':_0x3809fc[_0x67f8('0x21')]};}):[]};}):[]};}):[]:[]})[_0x67f8('0xc')](function(_0x202a28){logger[_0x67f8('0xd')](_0x67f8('0x22'),_0x3713ea);logger[_0x67f8('0x24')]('ShowSugarcrmAccount',_0x3713ea,JSON[_0x67f8('0x11')](_0x202a28));_0x450027(_0x202a28);})[_0x67f8('0x16')](function(_0x470ba2){logger[_0x67f8('0x12')](_0x67f8('0x22'),_0x470ba2[_0x67f8('0x14')],_0x3713ea);_0x1f6813(_0x59664b[_0x67f8('0x12')](0x1f4,_0x470ba2[_0x67f8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index b553ee1..c51075b 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 _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 +var _0xd33d=['get','/:id','show','/:id/fields','/:id/subjects','getSubjects','isAuthenticated','getDescriptions','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','index'];(function(_0x4e990b,_0x5616f1){var _0xc272e8=function(_0xda2ef1){while(--_0xda2ef1){_0x4e990b['push'](_0x4e990b['shift']());}};_0xc272e8(++_0x5616f1);}(_0xd33d,0x15f));var _0xdd33=function(_0xef32e8,_0x3ec411){_0xef32e8=_0xef32e8-0x0;var _0x158cd6=_0xd33d[_0xef32e8];return _0x158cd6;};'use strict';var multer=require(_0xdd33('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdd33('0x1'));var express=require(_0xdd33('0x2'));var router=express[_0xdd33('0x3')]();var auth=require(_0xdd33('0x4'));var interaction=require(_0xdd33('0x5'));var config=require(_0xdd33('0x6'));var controller=require(_0xdd33('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xdd33('0x8')]);router[_0xdd33('0x9')](_0xdd33('0xa'),auth['isAuthenticated'](),controller[_0xdd33('0xb')]);router[_0xdd33('0x9')](_0xdd33('0xc'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0xdd33('0xd'),auth['isAuthenticated'](),controller[_0xdd33('0xe')]);router[_0xdd33('0x9')]('/:id/descriptions',auth[_0xdd33('0xf')](),controller[_0xdd33('0x10')]);router[_0xdd33('0x11')]('/',auth[_0xdd33('0xf')](),controller[_0xdd33('0x12')]);router[_0xdd33('0x13')](_0xdd33('0xa'),auth[_0xdd33('0xf')](),controller[_0xdd33('0x14')]);router[_0xdd33('0x15')](_0xdd33('0xa'),auth['isAuthenticated'](),controller[_0xdd33('0x16')]);module[_0xdd33('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index fb635c1..b530d24 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 _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 +var _0x0c76=['STRING','exports'];(function(_0x35a5c6,_0x1702a8){var _0x37b996=function(_0x320dc9){while(--_0x320dc9){_0x35a5c6['push'](_0x35a5c6['shift']());}};_0x37b996(++_0x1702a8);}(_0x0c76,0x1b9));var _0x60c7=function(_0x2de7ed,_0xa027dc){_0x2de7ed=_0x2de7ed-0x0;var _0x5b5f77=_0x0c76[_0x2de7ed];return _0x5b5f77;};'use strict';var Sequelize=require('sequelize');module[_0x60c7('0x0')]={'name':{'type':Sequelize[_0x60c7('0x1')]},'description':{'type':Sequelize[_0x60c7('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 9708ad6..9412395 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 _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 +var _0xb281=['request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','keys','include','find','create','body','params','getFields','findOne','getSubjects','SugarcrmField','order','getDescriptions','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xb281,0x147));var _0x1b28=function(_0x55103c,_0x3bf1dc){_0x55103c=_0x55103c-0x0;var _0x450b8d=_0xb281[_0x55103c];return _0x450b8d;};'use strict';var pdf=require(_0x1b28('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1b28('0x1'));var zipdir=require(_0x1b28('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b28('0x3'));var moment=require(_0x1b28('0x4'));var BPromise=require(_0x1b28('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1b28('0x6'));var sox=require(_0x1b28('0x7'));var csv=require(_0x1b28('0x8'));var ejs=require(_0x1b28('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1b28('0xa'));var deskjs=require(_0x1b28('0xb'));var toCsv=require(_0x1b28('0x8'));var querystring=require(_0x1b28('0xc'));var Papa=require('papaparse');var Redis=require(_0x1b28('0xd'));var authService=require(_0x1b28('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b28('0xf'));var logger=require('../../config/logger')(_0x1b28('0x10'));var utils=require(_0x1b28('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x1b28('0x12'));var db=require(_0x1b28('0x13'))['db'];var jayson=require(_0x1b28('0x14'));var client=jayson[_0x1b28('0x15')][_0x1b28('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x2efed5,_0x274b79,_0x1c503b,_0xe069e4){return new BPromise(function(_0x484e46,_0x461819){var _0x3e84c8=_0xe069e4||client;return _0x3e84c8['request'](_0x2efed5,_0x1c503b)[_0x1b28('0x17')](function(_0x1a9e6f){logger[_0x1b28('0x18')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x274b79,_0x1b28('0x19'));logger[_0x1b28('0x1a')](_0x1b28('0x1b'),_0x274b79,_0x1b28('0x19'),JSON[_0x1b28('0x1c')](_0x1a9e6f));if(_0x1a9e6f[_0x1b28('0x1d')]){if(_0x1a9e6f[_0x1b28('0x1d')][_0x1b28('0x1e')]===0x1f4){logger[_0x1b28('0x1d')](_0x1b28('0x1f'),_0x274b79,_0x1a9e6f[_0x1b28('0x1d')][_0x1b28('0x20')]);return _0x461819(_0x1a9e6f[_0x1b28('0x1d')][_0x1b28('0x20')]);}logger[_0x1b28('0x1d')](_0x1b28('0x1f'),_0x274b79,_0x1a9e6f[_0x1b28('0x1d')][_0x1b28('0x20')]);return _0x484e46(_0x1a9e6f[_0x1b28('0x1d')][_0x1b28('0x20')]);}else{logger[_0x1b28('0x18')](_0x1b28('0x1f'),_0x274b79,_0x1b28('0x19'));_0x484e46(_0x1a9e6f[_0x1b28('0x21')][_0x1b28('0x20')]);}})[_0x1b28('0x22')](function(_0x43ffd9){logger['error'](_0x1b28('0x1f'),_0x274b79,_0x43ffd9);_0x461819(_0x43ffd9);});});}function respondWithStatusCode(_0x11d9fd,_0x3bbbcd){_0x3bbbcd=_0x3bbbcd||0xcc;return function(_0x5381c5){if(_0x5381c5){return _0x11d9fd[_0x1b28('0x23')](_0x3bbbcd);}return _0x11d9fd[_0x1b28('0x24')](_0x3bbbcd)['end']();};}function respondWithResult(_0x5a5218,_0x587ffd){_0x587ffd=_0x587ffd||0xc8;return function(_0x587981){if(_0x587981){return _0x5a5218[_0x1b28('0x24')](_0x587ffd)[_0x1b28('0x25')](_0x587981);}};}function respondWithFilteredResult(_0x4a456b,_0x258a4d){return function(_0x3a1c5c){if(_0x3a1c5c){var _0x6fa482=_0x3a1c5c[_0x1b28('0x26')],_0x525eb5=_0x258a4d['offset'],_0x519835=_0x258a4d[_0x1b28('0x27')]+_0x258a4d['limit'],_0xc5a447;if(_0x519835>=_0x6fa482){_0x519835=_0x6fa482;_0xc5a447=0xc8;}else{_0xc5a447=0xce;}_0x4a456b['status'](_0xc5a447);return _0x4a456b[_0x1b28('0x28')](_0x1b28('0x29'),_0x525eb5+'-'+_0x519835+'/'+_0x6fa482)[_0x1b28('0x25')](_0x3a1c5c);}return null;};}function patchUpdates(_0x5560fa){return function(_0x37e70f){try{jsonpatch[_0x1b28('0x2a')](_0x37e70f,_0x5560fa,!![]);}catch(_0x171a5c){return BPromise[_0x1b28('0x2b')](_0x171a5c);}return _0x37e70f[_0x1b28('0x2c')]();};}function saveUpdates(_0x2c8d0b,_0x1d4993){return function(_0x1d05e9){if(_0x1d05e9){return _0x1d05e9[_0x1b28('0x2d')](_0x2c8d0b)[_0x1b28('0x17')](function(_0x1dc8a1){return _0x1dc8a1;});}return null;};}function removeEntity(_0x19c218,_0x5c9787){return function(_0x237374){if(_0x237374){return _0x237374[_0x1b28('0x2e')]()[_0x1b28('0x17')](function(){_0x19c218['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x176fa6,_0x508917){return function(_0x48a7a3){if(!_0x48a7a3){_0x176fa6[_0x1b28('0x23')](0x194);}return _0x48a7a3;};}function handleError(_0x2e7c44,_0x21a2dd){_0x21a2dd=_0x21a2dd||0x1f4;return function(_0x27d620){logger[_0x1b28('0x1d')](_0x27d620[_0x1b28('0x2f')]);if(_0x27d620['name']){delete _0x27d620[_0x1b28('0x30')];}_0x2e7c44[_0x1b28('0x24')](_0x21a2dd)['send'](_0x27d620);};}exports[_0x1b28('0x31')]=function(_0x57114c,_0x290d79){var _0x32b2c0={},_0x266abd={},_0x4684f2={'count':0x0,'rows':[]};var _0x2117ed=_[_0x1b28('0x32')](db[_0x1b28('0x33')][_0x1b28('0x34')],function(_0x522274){return{'name':_0x522274[_0x1b28('0x35')],'type':_0x522274[_0x1b28('0x36')][_0x1b28('0x37')]};});_0x266abd[_0x1b28('0x38')]=_[_0x1b28('0x32')](_0x2117ed,_0x1b28('0x30'));_0x266abd[_0x1b28('0x39')]=_['keys'](_0x57114c[_0x1b28('0x39')]);_0x266abd[_0x1b28('0x3a')]=_[_0x1b28('0x3b')](_0x266abd[_0x1b28('0x38')],_0x266abd[_0x1b28('0x39')]);_0x32b2c0[_0x1b28('0x3c')]=_['intersection'](_0x266abd[_0x1b28('0x38')],qs['fields'](_0x57114c[_0x1b28('0x39')][_0x1b28('0x3d')]));_0x32b2c0[_0x1b28('0x3c')]=_0x32b2c0['attributes'][_0x1b28('0x3e')]?_0x32b2c0[_0x1b28('0x3c')]:_0x266abd[_0x1b28('0x38')];if(!_0x57114c[_0x1b28('0x39')][_0x1b28('0x3f')](_0x1b28('0x40'))){_0x32b2c0[_0x1b28('0x41')]=qs['limit'](_0x57114c[_0x1b28('0x39')][_0x1b28('0x41')]);_0x32b2c0[_0x1b28('0x27')]=qs['offset'](_0x57114c[_0x1b28('0x39')][_0x1b28('0x27')]);}_0x32b2c0['order']=qs[_0x1b28('0x42')](_0x57114c['query']['sort']);_0x32b2c0[_0x1b28('0x43')]=qs[_0x1b28('0x3a')](_[_0x1b28('0x44')](_0x57114c[_0x1b28('0x39')],_0x266abd[_0x1b28('0x3a')]),_0x2117ed);if(_0x57114c[_0x1b28('0x39')][_0x1b28('0x45')]){_0x32b2c0[_0x1b28('0x43')]=_['merge'](_0x32b2c0[_0x1b28('0x43')],{'$or':_[_0x1b28('0x32')](_0x2117ed,function(_0x56d1d1){if(_0x56d1d1[_0x1b28('0x36')]!=='VIRTUAL'){var _0x335007={};_0x335007[_0x56d1d1[_0x1b28('0x30')]]={'$like':'%'+_0x57114c['query'][_0x1b28('0x45')]+'%'};return _0x335007;}})});}_0x32b2c0=_[_0x1b28('0x46')]({},_0x32b2c0,_0x57114c[_0x1b28('0x47')]);var _0x22a66e={'where':_0x32b2c0[_0x1b28('0x43')]};return db['SugarcrmConfiguration'][_0x1b28('0x26')](_0x22a66e)[_0x1b28('0x17')](function(_0x1cdb4c){_0x4684f2[_0x1b28('0x26')]=_0x1cdb4c;if(_0x57114c[_0x1b28('0x39')][_0x1b28('0x48')]){_0x32b2c0['include']=[{'all':!![]}];}return db[_0x1b28('0x33')][_0x1b28('0x49')](_0x32b2c0);})[_0x1b28('0x17')](function(_0x5c1abd){_0x4684f2[_0x1b28('0x4a')]=_0x5c1abd;return _0x4684f2;})['then'](respondWithFilteredResult(_0x290d79,_0x32b2c0))[_0x1b28('0x22')](handleError(_0x290d79,null));};exports[_0x1b28('0x4b')]=function(_0x4be3ab,_0x1474f4){var _0x7287d3={'raw':![],'where':{'id':_0x4be3ab['params']['id']}},_0x47f22a={};_0x47f22a['model']=_[_0x1b28('0x4c')](db[_0x1b28('0x33')][_0x1b28('0x34')]);_0x47f22a[_0x1b28('0x39')]=_[_0x1b28('0x4c')](_0x4be3ab['query']);_0x47f22a[_0x1b28('0x3a')]=_[_0x1b28('0x3b')](_0x47f22a[_0x1b28('0x38')],_0x47f22a[_0x1b28('0x39')]);_0x7287d3[_0x1b28('0x3c')]=_[_0x1b28('0x3b')](_0x47f22a[_0x1b28('0x38')],qs[_0x1b28('0x3d')](_0x4be3ab['query'][_0x1b28('0x3d')]));_0x7287d3[_0x1b28('0x3c')]=_0x7287d3[_0x1b28('0x3c')]['length']?_0x7287d3['attributes']:_0x47f22a[_0x1b28('0x38')];if(_0x4be3ab[_0x1b28('0x39')][_0x1b28('0x48')]){_0x7287d3[_0x1b28('0x4d')]=[{'all':!![]}];}_0x7287d3=_['merge']({},_0x7287d3,_0x4be3ab['options']);return db['SugarcrmConfiguration'][_0x1b28('0x4e')](_0x7287d3)[_0x1b28('0x17')](handleEntityNotFound(_0x1474f4,null))[_0x1b28('0x17')](respondWithResult(_0x1474f4,null))['catch'](handleError(_0x1474f4,null));};exports['create']=function(_0x2bf937,_0x46e341){return db[_0x1b28('0x33')][_0x1b28('0x4f')](_0x2bf937[_0x1b28('0x50')],{})['then'](respondWithResult(_0x46e341,0xc9))['catch'](handleError(_0x46e341,null));};exports['update']=function(_0x908c69,_0x111c8f){if(_0x908c69[_0x1b28('0x50')]['id']){delete _0x908c69[_0x1b28('0x50')]['id'];}return db[_0x1b28('0x33')][_0x1b28('0x4e')]({'where':{'id':_0x908c69[_0x1b28('0x51')]['id']}})['then'](handleEntityNotFound(_0x111c8f,null))[_0x1b28('0x17')](saveUpdates(_0x908c69['body'],null))['then'](respondWithResult(_0x111c8f,null))['catch'](handleError(_0x111c8f,null));};exports[_0x1b28('0x2e')]=function(_0xc418e3,_0xbb8b6a){return db['SugarcrmConfiguration']['find']({'where':{'id':_0xc418e3['params']['id']}})[_0x1b28('0x17')](handleEntityNotFound(_0xbb8b6a,null))[_0x1b28('0x17')](removeEntity(_0xbb8b6a,null))[_0x1b28('0x22')](handleError(_0xbb8b6a,null));};exports[_0x1b28('0x52')]=function(_0x44f590,_0x56c3fa,_0x428107){var _0x4a8994={};var _0x494957={};var _0x370222;var _0x370cca;return db['SugarcrmConfiguration'][_0x1b28('0x53')]({'where':{'id':_0x44f590[_0x1b28('0x51')]['id']}})['then'](handleEntityNotFound(_0x56c3fa,null))[_0x1b28('0x17')](function(_0x2d86aa){if(_0x2d86aa){_0x370222=_0x2d86aa;_0x494957[_0x1b28('0x38')]=_[_0x1b28('0x4c')](db['SugarcrmField'][_0x1b28('0x34')]);_0x494957[_0x1b28('0x39')]=_[_0x1b28('0x4c')](_0x44f590['query']);_0x494957[_0x1b28('0x3a')]=_[_0x1b28('0x3b')](_0x494957[_0x1b28('0x38')],_0x494957['query']);_0x4a8994[_0x1b28('0x3c')]=_['intersection'](_0x494957[_0x1b28('0x38')],qs[_0x1b28('0x3d')](_0x44f590[_0x1b28('0x39')][_0x1b28('0x3d')]));_0x4a8994[_0x1b28('0x3c')]=_0x4a8994['attributes'][_0x1b28('0x3e')]?_0x4a8994[_0x1b28('0x3c')]:_0x494957[_0x1b28('0x38')];_0x4a8994['order']=qs[_0x1b28('0x42')](_0x44f590[_0x1b28('0x39')][_0x1b28('0x42')]);_0x4a8994[_0x1b28('0x43')]=qs[_0x1b28('0x3a')](_[_0x1b28('0x44')](_0x44f590[_0x1b28('0x39')],_0x494957[_0x1b28('0x3a')]));if(_0x44f590['query'][_0x1b28('0x45')]){_0x4a8994[_0x1b28('0x43')]=_['merge'](_0x4a8994[_0x1b28('0x43')],{'$or':_[_0x1b28('0x32')](_0x4a8994['attributes'],function(_0x2fc86a){var _0x54fe45={};_0x54fe45[_0x2fc86a]={'$like':'%'+_0x44f590['query'][_0x1b28('0x45')]+'%'};return _0x54fe45;})});}_0x4a8994=_[_0x1b28('0x46')]({},_0x4a8994,_0x44f590[_0x1b28('0x47')]);return _0x370222['getFields'](_0x4a8994);}})[_0x1b28('0x17')](function(_0xcf35a2){if(_0xcf35a2){_0x370cca=_0xcf35a2['length'];if(!_0x44f590[_0x1b28('0x39')][_0x1b28('0x3f')]('nolimit')){_0x4a8994['limit']=qs[_0x1b28('0x41')](_0x44f590['query'][_0x1b28('0x41')]);_0x4a8994[_0x1b28('0x27')]=qs[_0x1b28('0x27')](_0x44f590['query'][_0x1b28('0x27')]);}return _0x370222['getFields'](_0x4a8994);}})[_0x1b28('0x17')](function(_0x44cbd3){if(_0x44cbd3){return _0x44cbd3?{'count':_0x370cca,'rows':_0x44cbd3}:null;}})[_0x1b28('0x17')](respondWithResult(_0x56c3fa,null))[_0x1b28('0x22')](handleError(_0x56c3fa,null));};exports[_0x1b28('0x54')]=function(_0xe742b0,_0x154397,_0x5c8465){var _0x16f2f4={};var _0xec0404={};var _0x26115e;var _0x4c0eaf;return db[_0x1b28('0x33')][_0x1b28('0x53')]({'where':{'id':_0xe742b0['params']['id']}})[_0x1b28('0x17')](handleEntityNotFound(_0x154397,null))[_0x1b28('0x17')](function(_0x5f5373){if(_0x5f5373){_0x26115e=_0x5f5373;_0xec0404[_0x1b28('0x38')]=_[_0x1b28('0x4c')](db[_0x1b28('0x55')][_0x1b28('0x34')]);_0xec0404[_0x1b28('0x39')]=_[_0x1b28('0x4c')](_0xe742b0['query']);_0xec0404[_0x1b28('0x3a')]=_[_0x1b28('0x3b')](_0xec0404[_0x1b28('0x38')],_0xec0404[_0x1b28('0x39')]);_0x16f2f4[_0x1b28('0x3c')]=_['intersection'](_0xec0404[_0x1b28('0x38')],qs[_0x1b28('0x3d')](_0xe742b0[_0x1b28('0x39')][_0x1b28('0x3d')]));_0x16f2f4[_0x1b28('0x3c')]=_0x16f2f4['attributes'][_0x1b28('0x3e')]?_0x16f2f4['attributes']:_0xec0404['model'];_0x16f2f4[_0x1b28('0x56')]=qs[_0x1b28('0x42')](_0xe742b0[_0x1b28('0x39')]['sort']);_0x16f2f4[_0x1b28('0x43')]=qs[_0x1b28('0x3a')](_['pick'](_0xe742b0[_0x1b28('0x39')],_0xec0404['filters']));if(_0xe742b0[_0x1b28('0x39')][_0x1b28('0x45')]){_0x16f2f4['where']=_[_0x1b28('0x46')](_0x16f2f4[_0x1b28('0x43')],{'$or':_[_0x1b28('0x32')](_0x16f2f4[_0x1b28('0x3c')],function(_0x5f1e42){var _0x5d580c={};_0x5d580c[_0x5f1e42]={'$like':'%'+_0xe742b0[_0x1b28('0x39')][_0x1b28('0x45')]+'%'};return _0x5d580c;})});}_0x16f2f4=_[_0x1b28('0x46')]({},_0x16f2f4,_0xe742b0[_0x1b28('0x47')]);return _0x26115e[_0x1b28('0x54')](_0x16f2f4);}})[_0x1b28('0x17')](function(_0x19c9fc){if(_0x19c9fc){_0x4c0eaf=_0x19c9fc['length'];if(!_0xe742b0['query'][_0x1b28('0x3f')](_0x1b28('0x40'))){_0x16f2f4[_0x1b28('0x41')]=qs[_0x1b28('0x41')](_0xe742b0['query']['limit']);_0x16f2f4[_0x1b28('0x27')]=qs[_0x1b28('0x27')](_0xe742b0[_0x1b28('0x39')][_0x1b28('0x27')]);}return _0x26115e[_0x1b28('0x54')](_0x16f2f4);}})[_0x1b28('0x17')](function(_0x321134){if(_0x321134){return _0x321134?{'count':_0x4c0eaf,'rows':_0x321134}:null;}})[_0x1b28('0x17')](respondWithResult(_0x154397,null))['catch'](handleError(_0x154397,null));};exports[_0x1b28('0x57')]=function(_0x1f1ff5,_0x3552ef,_0x57fb4b){var _0x483dfa={};var _0x5918f4={};var _0x4e93c1;var _0x16687a;return db[_0x1b28('0x33')][_0x1b28('0x53')]({'where':{'id':_0x1f1ff5[_0x1b28('0x51')]['id']}})[_0x1b28('0x17')](handleEntityNotFound(_0x3552ef,null))[_0x1b28('0x17')](function(_0x3187f2){if(_0x3187f2){_0x4e93c1=_0x3187f2;_0x5918f4['model']=_[_0x1b28('0x4c')](db[_0x1b28('0x55')][_0x1b28('0x34')]);_0x5918f4[_0x1b28('0x39')]=_[_0x1b28('0x4c')](_0x1f1ff5[_0x1b28('0x39')]);_0x5918f4[_0x1b28('0x3a')]=_['intersection'](_0x5918f4[_0x1b28('0x38')],_0x5918f4['query']);_0x483dfa[_0x1b28('0x3c')]=_[_0x1b28('0x3b')](_0x5918f4[_0x1b28('0x38')],qs[_0x1b28('0x3d')](_0x1f1ff5[_0x1b28('0x39')][_0x1b28('0x3d')]));_0x483dfa[_0x1b28('0x3c')]=_0x483dfa[_0x1b28('0x3c')][_0x1b28('0x3e')]?_0x483dfa['attributes']:_0x5918f4[_0x1b28('0x38')];_0x483dfa['order']=qs['sort'](_0x1f1ff5[_0x1b28('0x39')][_0x1b28('0x42')]);_0x483dfa[_0x1b28('0x43')]=qs[_0x1b28('0x3a')](_[_0x1b28('0x44')](_0x1f1ff5[_0x1b28('0x39')],_0x5918f4['filters']));if(_0x1f1ff5[_0x1b28('0x39')][_0x1b28('0x45')]){_0x483dfa['where']=_[_0x1b28('0x46')](_0x483dfa[_0x1b28('0x43')],{'$or':_[_0x1b28('0x32')](_0x483dfa[_0x1b28('0x3c')],function(_0x5f3084){var _0x988844={};_0x988844[_0x5f3084]={'$like':'%'+_0x1f1ff5[_0x1b28('0x39')][_0x1b28('0x45')]+'%'};return _0x988844;})});}_0x483dfa=_['merge']({},_0x483dfa,_0x1f1ff5[_0x1b28('0x47')]);return _0x4e93c1[_0x1b28('0x57')](_0x483dfa);}})[_0x1b28('0x17')](function(_0x2054e9){if(_0x2054e9){_0x16687a=_0x2054e9['length'];if(!_0x1f1ff5['query'][_0x1b28('0x3f')](_0x1b28('0x40'))){_0x483dfa[_0x1b28('0x41')]=qs[_0x1b28('0x41')](_0x1f1ff5['query'][_0x1b28('0x41')]);_0x483dfa[_0x1b28('0x27')]=qs[_0x1b28('0x27')](_0x1f1ff5[_0x1b28('0x39')][_0x1b28('0x27')]);}return _0x4e93c1['getDescriptions'](_0x483dfa);}})[_0x1b28('0x17')](function(_0x13e20e){if(_0x13e20e){return _0x13e20e?{'count':_0x16687a,'rows':_0x13e20e}:null;}})[_0x1b28('0x17')](respondWithResult(_0x3552ef,null))[_0x1b28('0x22')](handleError(_0x3552ef,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 490e038..573183f 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 _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 +var _0x378a=['request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x10ccae,_0x48508c){var _0x34a8cf=function(_0x3ad775){while(--_0x3ad775){_0x10ccae['push'](_0x10ccae['shift']());}};_0x34a8cf(++_0x48508c);}(_0x378a,0x12e));var _0xa378=function(_0x560a48,_0x29f9ae){_0x560a48=_0x560a48-0x0;var _0x600970=_0x378a[_0x560a48];return _0x600970;};'use strict';var _=require(_0xa378('0x0'));var util=require(_0xa378('0x1'));var logger=require(_0xa378('0x2'))(_0xa378('0x3'));var moment=require(_0xa378('0x4'));var BPromise=require(_0xa378('0x5'));var rp=require(_0xa378('0x6'));var fs=require('fs');var path=require(_0xa378('0x7'));var rimraf=require(_0xa378('0x8'));var config=require(_0xa378('0x9'));var attributes=require(_0xa378('0xa'));module[_0xa378('0xb')]=function(_0x1bbe27,_0x4c0da7){return _0x1bbe27[_0xa378('0xc')](_0xa378('0xd'),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 503ec57..91d6537 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 _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 +var _0x1881=['request\x20sent','debug','stringify','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x40957b,_0x3c579d){var _0x35ed3f=function(_0x4fa74c){while(--_0x4fa74c){_0x40957b['push'](_0x40957b['shift']());}};_0x35ed3f(++_0x3c579d);}(_0x1881,0x171));var _0x1188=function(_0x385669,_0x43d386){_0x385669=_0x385669-0x0;var _0x11e2d2=_0x1881[_0x385669];return _0x11e2d2;};'use strict';var _=require(_0x1188('0x0'));var util=require(_0x1188('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1188('0x2'));var fs=require('fs');var Redis=require(_0x1188('0x3'));var db=require(_0x1188('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1188('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1188('0x6'));var client=jayson[_0x1188('0x7')][_0x1188('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb9d851,_0x3c5800,_0x25b260){return new BPromise(function(_0x11a4cc,_0x4abeec){return client[_0x1188('0x9')](_0xb9d851,_0x25b260)[_0x1188('0xa')](function(_0xacd61d){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x3c5800,_0x1188('0xb'));logger[_0x1188('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x3c5800,_0x1188('0xb'),JSON[_0x1188('0xd')](_0xacd61d));if(_0xacd61d[_0x1188('0xe')]){if(_0xacd61d[_0x1188('0xe')][_0x1188('0xf')]===0x1f4){logger[_0x1188('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3c5800,_0xacd61d[_0x1188('0xe')][_0x1188('0x10')]);return _0x4abeec(_0xacd61d[_0x1188('0xe')]['message']);}logger[_0x1188('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3c5800,_0xacd61d[_0x1188('0xe')][_0x1188('0x10')]);return _0x11a4cc(_0xacd61d[_0x1188('0xe')][_0x1188('0x10')]);}else{logger['info'](_0x1188('0x11'),_0x3c5800,_0x1188('0xb'));_0x11a4cc(_0xacd61d[_0x1188('0x12')][_0x1188('0x10')]);}})[_0x1188('0x13')](function(_0x40cba7){logger[_0x1188('0xe')](_0x1188('0x11'),_0x3c5800,_0x40cba7);_0x4abeec(_0x40cba7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index e23f508..dfe2ab5 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 _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 +var _0x1410=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','index','/:id','show','isAuthenticated'];(function(_0x18c458,_0xb5b67a){var _0x445566=function(_0x24c937){while(--_0x24c937){_0x18c458['push'](_0x18c458['shift']());}};_0x445566(++_0xb5b67a);}(_0x1410,0x17e));var _0x0141=function(_0x57f329,_0x1dd4cc){_0x57f329=_0x57f329-0x0;var _0x105312=_0x1410[_0x57f329];return _0x105312;};'use strict';var multer=require(_0x0141('0x0'));var util=require('util');var path=require(_0x0141('0x1'));var timeout=require(_0x0141('0x2'));var express=require(_0x0141('0x3'));var router=express[_0x0141('0x4')]();var auth=require(_0x0141('0x5'));var interaction=require(_0x0141('0x6'));var config=require(_0x0141('0x7'));var controller=require(_0x0141('0x8'));router[_0x0141('0x9')]('/',auth['isAuthenticated'](),controller[_0x0141('0xa')]);router[_0x0141('0x9')](_0x0141('0xb'),auth['isAuthenticated'](),controller[_0x0141('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0141('0xb'),auth[_0x0141('0xd')](),controller[_0x0141('0xe')]);router[_0x0141('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x0141('0x10')]);module[_0x0141('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 7ae1a79..cbb3f5b 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 _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 +var _0x649b=['BOOLEAN','ENUM','string','keyValue','STRING','variable','customVariable'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0x649b,0x166));var _0xb649=function(_0x303f7f,_0xdf2610){_0x303f7f=_0x303f7f-0x0;var _0x44cc80=_0x649b[_0x303f7f];return _0x44cc80;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xb649('0x0')](_0xb649('0x1'),'variable','customVariable',_0xb649('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb649('0x3')]},'key':{'type':Sequelize[_0xb649('0x3')]},'keyType':{'type':Sequelize[_0xb649('0x0')]('string',_0xb649('0x4'),_0xb649('0x5'))},'keyContent':{'type':Sequelize[_0xb649('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb649('0x6')],'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 a000fd2..3ba5e90 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 _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 +var _0x5162=['sendStatus','status','end','json','count','offset','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','SugarcrmField','includeAll','include','findAll','rows','catch','params','fields','find','create','body','html-pdf','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x454918,_0x1dbc64){var _0x3a814b=function(_0x3d1c39){while(--_0x3d1c39){_0x454918['push'](_0x454918['shift']());}};_0x3a814b(++_0x1dbc64);}(_0x5162,0x103));var _0x2516=function(_0x2418e0,_0x7215b0){_0x2418e0=_0x2418e0-0x0;var _0x55ffbf=_0x5162[_0x2418e0];return _0x55ffbf;};'use strict';var pdf=require(_0x2516('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2516('0x1'));var moment=require(_0x2516('0x2'));var BPromise=require(_0x2516('0x3'));var Mustache=require(_0x2516('0x4'));var util=require(_0x2516('0x5'));var path=require(_0x2516('0x6'));var sox=require(_0x2516('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2516('0x8'));var crypto=require(_0x2516('0x9'));var jsforce=require(_0x2516('0xa'));var deskjs=require(_0x2516('0xb'));var toCsv=require(_0x2516('0xc'));var querystring=require(_0x2516('0xd'));var Papa=require(_0x2516('0xe'));var Redis=require('ioredis');var authService=require(_0x2516('0xf'));var qs=require(_0x2516('0x10'));var as=require(_0x2516('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2516('0x12'));var licenseUtil=require(_0x2516('0x13'));var db=require(_0x2516('0x14'))['db'];function respondWithStatusCode(_0x3ef6ff,_0x56c69c){_0x56c69c=_0x56c69c||0xcc;return function(_0x33496b){if(_0x33496b){return _0x3ef6ff[_0x2516('0x15')](_0x56c69c);}return _0x3ef6ff[_0x2516('0x16')](_0x56c69c)[_0x2516('0x17')]();};}function respondWithResult(_0x42c771,_0x558d20){_0x558d20=_0x558d20||0xc8;return function(_0x3e5e0f){if(_0x3e5e0f){return _0x42c771[_0x2516('0x16')](_0x558d20)[_0x2516('0x18')](_0x3e5e0f);}};}function respondWithFilteredResult(_0x181a28,_0x2637e8){return function(_0x2ec31f){if(_0x2ec31f){var _0x19aacb=_0x2ec31f[_0x2516('0x19')],_0x5dee15=_0x2637e8[_0x2516('0x1a')],_0x3543d=_0x2637e8[_0x2516('0x1a')]+_0x2637e8['limit'],_0x5623be;if(_0x3543d>=_0x19aacb){_0x3543d=_0x19aacb;_0x5623be=0xc8;}else{_0x5623be=0xce;}_0x181a28[_0x2516('0x16')](_0x5623be);return _0x181a28['set']('Content-Range',_0x5dee15+'-'+_0x3543d+'/'+_0x19aacb)[_0x2516('0x18')](_0x2ec31f);}return null;};}function patchUpdates(_0x3583cf){return function(_0x151168){try{jsonpatch[_0x2516('0x1b')](_0x151168,_0x3583cf,!![]);}catch(_0x198b93){return BPromise[_0x2516('0x1c')](_0x198b93);}return _0x151168[_0x2516('0x1d')]();};}function saveUpdates(_0x113616,_0x248c5a){return function(_0x37485b){if(_0x37485b){return _0x37485b[_0x2516('0x1e')](_0x113616)[_0x2516('0x1f')](function(_0x1b0831){return _0x1b0831;});}return null;};}function removeEntity(_0x4fb7d9,_0x559a3e){return function(_0x12db4d){if(_0x12db4d){return _0x12db4d[_0x2516('0x20')]()[_0x2516('0x1f')](function(){_0x4fb7d9[_0x2516('0x16')](0xcc)[_0x2516('0x17')]();});}};}function handleEntityNotFound(_0x32de7a,_0x3d906d){return function(_0x950477){if(!_0x950477){_0x32de7a['sendStatus'](0x194);}return _0x950477;};}function handleError(_0xa4538d,_0x39c63f){_0x39c63f=_0x39c63f||0x1f4;return function(_0x774b60){logger[_0x2516('0x21')](_0x774b60['stack']);if(_0x774b60[_0x2516('0x22')]){delete _0x774b60[_0x2516('0x22')];}_0xa4538d[_0x2516('0x16')](_0x39c63f)[_0x2516('0x23')](_0x774b60);};}exports[_0x2516('0x24')]=function(_0x4a3dc8,_0x3c5c3c){var _0x1750e7={},_0x935035={},_0x2cb847={'count':0x0,'rows':[]};var _0x38ec50=_[_0x2516('0x25')](db['SugarcrmField'][_0x2516('0x26')],function(_0x20dc9f){return{'name':_0x20dc9f['fieldName'],'type':_0x20dc9f[_0x2516('0x27')][_0x2516('0x28')]};});_0x935035[_0x2516('0x29')]=_[_0x2516('0x25')](_0x38ec50,_0x2516('0x22'));_0x935035[_0x2516('0x2a')]=_[_0x2516('0x2b')](_0x4a3dc8[_0x2516('0x2a')]);_0x935035[_0x2516('0x2c')]=_[_0x2516('0x2d')](_0x935035[_0x2516('0x29')],_0x935035[_0x2516('0x2a')]);_0x1750e7[_0x2516('0x2e')]=_[_0x2516('0x2d')](_0x935035[_0x2516('0x29')],qs['fields'](_0x4a3dc8[_0x2516('0x2a')]['fields']));_0x1750e7[_0x2516('0x2e')]=_0x1750e7['attributes'][_0x2516('0x2f')]?_0x1750e7['attributes']:_0x935035[_0x2516('0x29')];if(!_0x4a3dc8[_0x2516('0x2a')][_0x2516('0x30')](_0x2516('0x31'))){_0x1750e7[_0x2516('0x32')]=qs[_0x2516('0x32')](_0x4a3dc8[_0x2516('0x2a')][_0x2516('0x32')]);_0x1750e7[_0x2516('0x1a')]=qs['offset'](_0x4a3dc8[_0x2516('0x2a')][_0x2516('0x1a')]);}_0x1750e7[_0x2516('0x33')]=qs[_0x2516('0x34')](_0x4a3dc8['query']['sort']);_0x1750e7[_0x2516('0x35')]=qs[_0x2516('0x2c')](_[_0x2516('0x36')](_0x4a3dc8[_0x2516('0x2a')],_0x935035[_0x2516('0x2c')]),_0x38ec50);if(_0x4a3dc8[_0x2516('0x2a')][_0x2516('0x37')]){_0x1750e7[_0x2516('0x35')]=_[_0x2516('0x38')](_0x1750e7[_0x2516('0x35')],{'$or':_['map'](_0x38ec50,function(_0x4844a1){if(_0x4844a1[_0x2516('0x27')]!==_0x2516('0x39')){var _0x494b51={};_0x494b51[_0x4844a1['name']]={'$like':'%'+_0x4a3dc8[_0x2516('0x2a')][_0x2516('0x37')]+'%'};return _0x494b51;}})});}_0x1750e7=_['merge']({},_0x1750e7,_0x4a3dc8[_0x2516('0x3a')]);var _0x52ef6b={'where':_0x1750e7[_0x2516('0x35')]};return db[_0x2516('0x3b')]['count'](_0x52ef6b)[_0x2516('0x1f')](function(_0x23629d){_0x2cb847[_0x2516('0x19')]=_0x23629d;if(_0x4a3dc8[_0x2516('0x2a')][_0x2516('0x3c')]){_0x1750e7[_0x2516('0x3d')]=[{'all':!![]}];}return db[_0x2516('0x3b')][_0x2516('0x3e')](_0x1750e7);})[_0x2516('0x1f')](function(_0xc1c0fb){_0x2cb847[_0x2516('0x3f')]=_0xc1c0fb;return _0x2cb847;})[_0x2516('0x1f')](respondWithFilteredResult(_0x3c5c3c,_0x1750e7))[_0x2516('0x40')](handleError(_0x3c5c3c,null));};exports['show']=function(_0x1b72cd,_0x1bc0e){var _0x5debf2={'raw':!![],'where':{'id':_0x1b72cd[_0x2516('0x41')]['id']}},_0xfd6236={};_0xfd6236[_0x2516('0x29')]=_[_0x2516('0x2b')](db[_0x2516('0x3b')]['rawAttributes']);_0xfd6236[_0x2516('0x2a')]=_[_0x2516('0x2b')](_0x1b72cd[_0x2516('0x2a')]);_0xfd6236[_0x2516('0x2c')]=_[_0x2516('0x2d')](_0xfd6236[_0x2516('0x29')],_0xfd6236['query']);_0x5debf2[_0x2516('0x2e')]=_[_0x2516('0x2d')](_0xfd6236[_0x2516('0x29')],qs[_0x2516('0x42')](_0x1b72cd[_0x2516('0x2a')][_0x2516('0x42')]));_0x5debf2[_0x2516('0x2e')]=_0x5debf2['attributes'][_0x2516('0x2f')]?_0x5debf2['attributes']:_0xfd6236[_0x2516('0x29')];if(_0x1b72cd['query'][_0x2516('0x3c')]){_0x5debf2[_0x2516('0x3d')]=[{'all':!![]}];}_0x5debf2=_[_0x2516('0x38')]({},_0x5debf2,_0x1b72cd['options']);return db['SugarcrmField'][_0x2516('0x43')](_0x5debf2)[_0x2516('0x1f')](handleEntityNotFound(_0x1bc0e,null))['then'](respondWithResult(_0x1bc0e,null))['catch'](handleError(_0x1bc0e,null));};exports[_0x2516('0x44')]=function(_0x147e05,_0x34f3d5){return db['SugarcrmField'][_0x2516('0x44')](_0x147e05['body'],{})[_0x2516('0x1f')](respondWithResult(_0x34f3d5,0xc9))[_0x2516('0x40')](handleError(_0x34f3d5,null));};exports[_0x2516('0x1e')]=function(_0x3af4c9,_0x579371){if(_0x3af4c9[_0x2516('0x45')]['id']){delete _0x3af4c9[_0x2516('0x45')]['id'];}return db[_0x2516('0x3b')][_0x2516('0x43')]({'where':{'id':_0x3af4c9[_0x2516('0x41')]['id']}})['then'](handleEntityNotFound(_0x579371,null))[_0x2516('0x1f')](saveUpdates(_0x3af4c9[_0x2516('0x45')],null))[_0x2516('0x1f')](respondWithResult(_0x579371,null))[_0x2516('0x40')](handleError(_0x579371,null));};exports['destroy']=function(_0x45e179,_0x35c1a5){return db[_0x2516('0x3b')][_0x2516('0x43')]({'where':{'id':_0x45e179[_0x2516('0x41')]['id']}})['then'](handleEntityNotFound(_0x35c1a5,null))[_0x2516('0x1f')](removeEntity(_0x35c1a5,null))[_0x2516('0x40')](handleError(_0x35c1a5,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 176b7f0..4342328 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 _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 +var _0x7496=['rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x5138e0,_0x24fbbc){var _0x18e57b=function(_0x5eda17){while(--_0x5eda17){_0x5138e0['push'](_0x5138e0['shift']());}};_0x18e57b(++_0x24fbbc);}(_0x7496,0x149));var _0x6749=function(_0x6da7ba,_0x3b0caa){_0x6da7ba=_0x6da7ba-0x0;var _0x5393ff=_0x7496[_0x6da7ba];return _0x5393ff;};'use strict';var _=require(_0x6749('0x0'));var util=require(_0x6749('0x1'));var logger=require(_0x6749('0x2'))('api');var moment=require(_0x6749('0x3'));var BPromise=require(_0x6749('0x4'));var rp=require(_0x6749('0x5'));var fs=require('fs');var path=require(_0x6749('0x6'));var rimraf=require(_0x6749('0x7'));var config=require(_0x6749('0x8'));var attributes=require(_0x6749('0x9'));module[_0x6749('0xa')]=function(_0x2e5a4e,_0x507c57){return _0x2e5a4e[_0x6749('0xb')](_0x6749('0xc'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x6749('0xd'),'fields':[_0x6749('0xe'),_0x6749('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 57eef57..ed985ef 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 _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 +var _0x5eb8=['info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x307c2e,_0x508f11){var _0xf7f8ed=function(_0x238d47){while(--_0x238d47){_0x307c2e['push'](_0x307c2e['shift']());}};_0xf7f8ed(++_0x508f11);}(_0x5eb8,0xb0));var _0x85eb=function(_0x58803c,_0x4a34df){_0x58803c=_0x58803c-0x0;var _0xf95b9b=_0x5eb8[_0x58803c];return _0xf95b9b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index cb04f74..157c540 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 _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 +var _0x4145=['util','connect-timeout','express','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','post','addConfiguration','put','destroy','exports'];(function(_0x5d7d98,_0x3a7b6f){var _0xa764e6=function(_0x473a90){while(--_0x473a90){_0x5d7d98['push'](_0x5d7d98['shift']());}};_0xa764e6(++_0x3a7b6f);}(_0x4145,0x77));var _0x5414=function(_0x154abf,_0x159b0a){_0x154abf=_0x154abf-0x0;var _0xf53fb5=_0x4145[_0x154abf];return _0xf53fb5;};'use strict';var multer=require('multer');var util=require(_0x5414('0x0'));var path=require('path');var timeout=require(_0x5414('0x1'));var express=require(_0x5414('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5414('0x3'));var config=require(_0x5414('0x4'));var controller=require(_0x5414('0x5'));router[_0x5414('0x6')]('/',auth[_0x5414('0x7')](),controller[_0x5414('0x8')]);router[_0x5414('0x6')](_0x5414('0x9'),auth[_0x5414('0x7')](),controller[_0x5414('0xa')]);router['get']('/:id/configurations',auth[_0x5414('0x7')](),controller['getConfigurations']);router[_0x5414('0x6')](_0x5414('0xb'),auth[_0x5414('0x7')](),controller['getFields']);router['post']('/',auth[_0x5414('0x7')](),controller['create']);router[_0x5414('0xc')]('/:id/configurations',auth[_0x5414('0x7')](),controller[_0x5414('0xd')]);router[_0x5414('0xe')]('/:id',auth[_0x5414('0x7')](),controller['update']);router['delete'](_0x5414('0x9'),auth[_0x5414('0x7')](),controller[_0x5414('0xf')]);module[_0x5414('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 87722c8..cf6422f 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 _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 +var _0xdb26=['sequelize','STRING','HelpDesk'];(function(_0x1dc8d0,_0x2f78eb){var _0x2aa453=function(_0x198475){while(--_0x198475){_0x1dc8d0['push'](_0x1dc8d0['shift']());}};_0x2aa453(++_0x2f78eb);}(_0xdb26,0xb7));var _0x6db2=function(_0x456ce8,_0x336e87){_0x456ce8=_0x456ce8-0x0;var _0x4086ff=_0xdb26[_0x456ce8];return _0x4086ff;};'use strict';var Sequelize=require(_0x6db2('0x0'));module['exports']={'name':{'type':Sequelize[_0x6db2('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6db2('0x1')]},'username':{'type':Sequelize[_0x6db2('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6db2('0x1')],'allowNull':![],'defaultValue':_0x6db2('0x2')},'remoteUri':{'type':Sequelize[_0x6db2('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x6db2('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x6db2('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index edc5484..b6ed6a0 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 _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 +var _0xbf25=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','stack','name','send','map','VtigerAccount','rawAttributes','model','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','findAll','params','include','options','find','create','body','getConfigurations','keys','VtigerConfiguration','addConfiguration','findOne','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','moduleName','remoteUri','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','token','sessionName','autogenerated','reference','owner','remove','label','startsWith','cf_','picklistValues','log','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xbf25,0x15e));var _0x5bf2=function(_0x45e278,_0x2eef7a){_0x45e278=_0x45e278-0x0;var _0x419382=_0xbf25[_0x45e278];return _0x419382;};'use strict';var pdf=require(_0x5bf2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5bf2('0x1'));var zipdir=require(_0x5bf2('0x2'));var jsonpatch=require(_0x5bf2('0x3'));var rp=require(_0x5bf2('0x4'));var moment=require(_0x5bf2('0x5'));var BPromise=require(_0x5bf2('0x6'));var Mustache=require('mustache');var util=require(_0x5bf2('0x7'));var path=require('path');var sox=require(_0x5bf2('0x8'));var csv=require(_0x5bf2('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5bf2('0xa'));var squel=require(_0x5bf2('0xb'));var crypto=require(_0x5bf2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5bf2('0xd'));var toCsv=require(_0x5bf2('0x9'));var querystring=require(_0x5bf2('0xe'));var Papa=require('papaparse');var Redis=require(_0x5bf2('0xf'));var authService=require(_0x5bf2('0x10'));var qs=require(_0x5bf2('0x11'));var as=require(_0x5bf2('0x12'));var hardwareService=require(_0x5bf2('0x13'));var logger=require(_0x5bf2('0x14'))(_0x5bf2('0x15'));var utils=require(_0x5bf2('0x16'));var config=require(_0x5bf2('0x17'));var licenseUtil=require(_0x5bf2('0x18'));var db=require(_0x5bf2('0x19'))['db'];var integrations=require(_0x5bf2('0x1a'));var jayson=require(_0x5bf2('0x1b'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b2e52,_0x370f33,_0x5d3cb6,_0x10c8a1){return new BPromise(function(_0x43a83b,_0x1bdb56){var _0x21a3a1=_0x10c8a1||client;return _0x21a3a1[_0x5bf2('0x1c')](_0x2b2e52,_0x5d3cb6)[_0x5bf2('0x1d')](function(_0x3083cd){logger[_0x5bf2('0x1e')](_0x5bf2('0x1f'),_0x370f33,_0x5bf2('0x20'));logger[_0x5bf2('0x21')](_0x5bf2('0x22'),_0x370f33,'request\x20sent',JSON['stringify'](_0x3083cd));if(_0x3083cd[_0x5bf2('0x23')]){if(_0x3083cd['error'][_0x5bf2('0x24')]===0x1f4){logger[_0x5bf2('0x23')]('VtigerAccount,\x20%s,\x20%s',_0x370f33,_0x3083cd['error'][_0x5bf2('0x25')]);return _0x1bdb56(_0x3083cd[_0x5bf2('0x23')][_0x5bf2('0x25')]);}logger[_0x5bf2('0x23')](_0x5bf2('0x1f'),_0x370f33,_0x3083cd[_0x5bf2('0x23')][_0x5bf2('0x25')]);return _0x43a83b(_0x3083cd[_0x5bf2('0x23')][_0x5bf2('0x25')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x370f33,_0x5bf2('0x20'));_0x43a83b(_0x3083cd[_0x5bf2('0x26')][_0x5bf2('0x25')]);}})[_0x5bf2('0x27')](function(_0x18caac){logger[_0x5bf2('0x23')](_0x5bf2('0x1f'),_0x370f33,_0x18caac);_0x1bdb56(_0x18caac);});});}function respondWithStatusCode(_0x2eea63,_0x239206){_0x239206=_0x239206||0xcc;return function(_0x2825c7){if(_0x2825c7){return _0x2eea63[_0x5bf2('0x28')](_0x239206);}return _0x2eea63[_0x5bf2('0x29')](_0x239206)[_0x5bf2('0x2a')]();};}function respondWithResult(_0x5ae161,_0x1a90e7){_0x1a90e7=_0x1a90e7||0xc8;return function(_0x4d3067){if(_0x4d3067){return _0x5ae161[_0x5bf2('0x29')](_0x1a90e7)[_0x5bf2('0x2b')](_0x4d3067);}};}function respondWithFilteredResult(_0x569d26,_0xc028a0){return function(_0x427e7f){if(_0x427e7f){var _0x5cefb3=_0x427e7f[_0x5bf2('0x2c')],_0x5426f9=_0xc028a0[_0x5bf2('0x2d')],_0x8c54cd=_0xc028a0['offset']+_0xc028a0[_0x5bf2('0x2e')],_0x2ec339;if(_0x8c54cd>=_0x5cefb3){_0x8c54cd=_0x5cefb3;_0x2ec339=0xc8;}else{_0x2ec339=0xce;}_0x569d26[_0x5bf2('0x29')](_0x2ec339);return _0x569d26[_0x5bf2('0x2f')](_0x5bf2('0x30'),_0x5426f9+'-'+_0x8c54cd+'/'+_0x5cefb3)[_0x5bf2('0x2b')](_0x427e7f);}return null;};}function patchUpdates(_0x1dbb36){return function(_0x5a68bc){try{jsonpatch[_0x5bf2('0x31')](_0x5a68bc,_0x1dbb36,!![]);}catch(_0x2ea937){return BPromise[_0x5bf2('0x32')](_0x2ea937);}return _0x5a68bc['save']();};}function saveUpdates(_0x7023ae,_0x432de6){return function(_0x39b78c){if(_0x39b78c){return _0x39b78c['update'](_0x7023ae)['then'](function(_0x5284fe){return _0x5284fe;});}return null;};}function removeEntity(_0x3d1840,_0x19f46e){return function(_0x313c03){if(_0x313c03){return _0x313c03[_0x5bf2('0x33')]()[_0x5bf2('0x1d')](function(){_0x3d1840['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19a3ef,_0x4d4080){return function(_0x8904f0){if(!_0x8904f0){_0x19a3ef[_0x5bf2('0x28')](0x194);}return _0x8904f0;};}function handleError(_0x3245ae,_0x1128f8){_0x1128f8=_0x1128f8||0x1f4;return function(_0x3f2546){logger[_0x5bf2('0x23')](_0x3f2546[_0x5bf2('0x34')]);if(_0x3f2546[_0x5bf2('0x35')]){delete _0x3f2546[_0x5bf2('0x35')];}_0x3245ae[_0x5bf2('0x29')](_0x1128f8)[_0x5bf2('0x36')](_0x3f2546);};}exports['index']=function(_0x47152b,_0x510340){var _0x537e3b={},_0x5dbee1={},_0x5e472c={'count':0x0,'rows':[]};var _0x15caaf=_[_0x5bf2('0x37')](db[_0x5bf2('0x38')][_0x5bf2('0x39')],function(_0x122e64){return{'name':_0x122e64['fieldName'],'type':_0x122e64['type']['key']};});_0x5dbee1[_0x5bf2('0x3a')]=_[_0x5bf2('0x37')](_0x15caaf,'name');_0x5dbee1['query']=_['keys'](_0x47152b['query']);_0x5dbee1[_0x5bf2('0x3b')]=_['intersection'](_0x5dbee1[_0x5bf2('0x3a')],_0x5dbee1[_0x5bf2('0x3c')]);_0x537e3b[_0x5bf2('0x3d')]=_[_0x5bf2('0x3e')](_0x5dbee1[_0x5bf2('0x3a')],qs['fields'](_0x47152b['query'][_0x5bf2('0x3f')]));_0x537e3b[_0x5bf2('0x3d')]=_0x537e3b[_0x5bf2('0x3d')][_0x5bf2('0x40')]?_0x537e3b['attributes']:_0x5dbee1['model'];if(!_0x47152b[_0x5bf2('0x3c')][_0x5bf2('0x41')](_0x5bf2('0x42'))){_0x537e3b['limit']=qs[_0x5bf2('0x2e')](_0x47152b['query'][_0x5bf2('0x2e')]);_0x537e3b['offset']=qs[_0x5bf2('0x2d')](_0x47152b[_0x5bf2('0x3c')][_0x5bf2('0x2d')]);}_0x537e3b[_0x5bf2('0x43')]=qs[_0x5bf2('0x44')](_0x47152b[_0x5bf2('0x3c')][_0x5bf2('0x44')]);_0x537e3b['where']=qs['filters'](_[_0x5bf2('0x45')](_0x47152b['query'],_0x5dbee1['filters']),_0x15caaf);if(_0x47152b[_0x5bf2('0x3c')][_0x5bf2('0x46')]){_0x537e3b[_0x5bf2('0x47')]=_[_0x5bf2('0x48')](_0x537e3b[_0x5bf2('0x47')],{'$or':_['map'](_0x15caaf,function(_0x16703f){if(_0x16703f[_0x5bf2('0x49')]!==_0x5bf2('0x4a')){var _0x55acb6={};_0x55acb6[_0x16703f[_0x5bf2('0x35')]]={'$like':'%'+_0x47152b['query'][_0x5bf2('0x46')]+'%'};return _0x55acb6;}})});}_0x537e3b=_[_0x5bf2('0x48')]({},_0x537e3b,_0x47152b['options']);var _0x1cac50={'where':_0x537e3b['where']};return db['VtigerAccount'][_0x5bf2('0x2c')](_0x1cac50)['then'](function(_0x5e3abd){_0x5e472c['count']=_0x5e3abd;if(_0x47152b[_0x5bf2('0x3c')][_0x5bf2('0x4b')]){_0x537e3b['include']=[{'all':!![]}];}return db[_0x5bf2('0x38')][_0x5bf2('0x4c')](_0x537e3b);})[_0x5bf2('0x1d')](function(_0xe99fd9){_0x5e472c['rows']=_0xe99fd9;return _0x5e472c;})[_0x5bf2('0x1d')](respondWithFilteredResult(_0x510340,_0x537e3b))[_0x5bf2('0x27')](handleError(_0x510340,null));};exports['show']=function(_0x5b09c7,_0x1d7ea2){var _0x4f5d18={'raw':![],'where':{'id':_0x5b09c7[_0x5bf2('0x4d')]['id']}},_0x278e21={};_0x278e21['model']=_['keys'](db[_0x5bf2('0x38')]['rawAttributes']);_0x278e21[_0x5bf2('0x3c')]=_['keys'](_0x5b09c7['query']);_0x278e21[_0x5bf2('0x3b')]=_[_0x5bf2('0x3e')](_0x278e21[_0x5bf2('0x3a')],_0x278e21['query']);_0x4f5d18[_0x5bf2('0x3d')]=_[_0x5bf2('0x3e')](_0x278e21['model'],qs['fields'](_0x5b09c7[_0x5bf2('0x3c')]['fields']));_0x4f5d18[_0x5bf2('0x3d')]=_0x4f5d18[_0x5bf2('0x3d')]['length']?_0x4f5d18['attributes']:_0x278e21[_0x5bf2('0x3a')];if(_0x5b09c7[_0x5bf2('0x3c')][_0x5bf2('0x4b')]){_0x4f5d18[_0x5bf2('0x4e')]=[{'all':!![]}];}_0x4f5d18=_[_0x5bf2('0x48')]({},_0x4f5d18,_0x5b09c7[_0x5bf2('0x4f')]);return db[_0x5bf2('0x38')][_0x5bf2('0x50')](_0x4f5d18)[_0x5bf2('0x1d')](handleEntityNotFound(_0x1d7ea2,null))['then'](respondWithResult(_0x1d7ea2,null))['catch'](handleError(_0x1d7ea2,null));};exports[_0x5bf2('0x51')]=function(_0x27e7e2,_0x208bfa){return db['VtigerAccount']['create'](_0x27e7e2['body'],{})['then'](respondWithResult(_0x208bfa,0xc9))[_0x5bf2('0x27')](handleError(_0x208bfa,null));};exports['update']=function(_0x3bc117,_0x1283da){if(_0x3bc117['body']['id']){delete _0x3bc117[_0x5bf2('0x52')]['id'];}return db[_0x5bf2('0x38')][_0x5bf2('0x50')]({'where':{'id':_0x3bc117['params']['id']}})[_0x5bf2('0x1d')](handleEntityNotFound(_0x1283da,null))[_0x5bf2('0x1d')](saveUpdates(_0x3bc117[_0x5bf2('0x52')],null))['then'](respondWithResult(_0x1283da,null))[_0x5bf2('0x27')](handleError(_0x1283da,null));};exports[_0x5bf2('0x33')]=function(_0x304937,_0x3f9b08){return db['VtigerAccount'][_0x5bf2('0x50')]({'where':{'id':_0x304937['params']['id']}})['then'](handleEntityNotFound(_0x3f9b08,null))[_0x5bf2('0x1d')](removeEntity(_0x3f9b08,null))[_0x5bf2('0x27')](handleError(_0x3f9b08,null));};exports[_0x5bf2('0x53')]=function(_0x5a375f,_0x109754,_0x4f2e7c){var _0x5428a7={};var _0x4452f6={};var _0x11a6ce;var _0x687931;return db[_0x5bf2('0x38')]['findOne']({'where':{'id':_0x5a375f[_0x5bf2('0x4d')]['id']}})[_0x5bf2('0x1d')](handleEntityNotFound(_0x109754,null))[_0x5bf2('0x1d')](function(_0x1342c2){if(_0x1342c2){_0x11a6ce=_0x1342c2;_0x4452f6[_0x5bf2('0x3a')]=_[_0x5bf2('0x54')](db[_0x5bf2('0x55')][_0x5bf2('0x39')]);_0x4452f6[_0x5bf2('0x3c')]=_[_0x5bf2('0x54')](_0x5a375f[_0x5bf2('0x3c')]);_0x4452f6[_0x5bf2('0x3b')]=_[_0x5bf2('0x3e')](_0x4452f6[_0x5bf2('0x3a')],_0x4452f6[_0x5bf2('0x3c')]);_0x5428a7[_0x5bf2('0x3d')]=_[_0x5bf2('0x3e')](_0x4452f6[_0x5bf2('0x3a')],qs[_0x5bf2('0x3f')](_0x5a375f[_0x5bf2('0x3c')][_0x5bf2('0x3f')]));_0x5428a7[_0x5bf2('0x3d')]=_0x5428a7[_0x5bf2('0x3d')]['length']?_0x5428a7[_0x5bf2('0x3d')]:_0x4452f6['model'];_0x5428a7[_0x5bf2('0x43')]=qs[_0x5bf2('0x44')](_0x5a375f[_0x5bf2('0x3c')]['sort']);_0x5428a7[_0x5bf2('0x47')]=qs[_0x5bf2('0x3b')](_[_0x5bf2('0x45')](_0x5a375f[_0x5bf2('0x3c')],_0x4452f6[_0x5bf2('0x3b')]));if(_0x5a375f[_0x5bf2('0x3c')][_0x5bf2('0x46')]){_0x5428a7[_0x5bf2('0x47')]=_[_0x5bf2('0x48')](_0x5428a7[_0x5bf2('0x47')],{'$or':_[_0x5bf2('0x37')](_0x5428a7[_0x5bf2('0x3d')],function(_0x27a46d){var _0x552f31={};_0x552f31[_0x27a46d]={'$like':'%'+_0x5a375f['query'][_0x5bf2('0x46')]+'%'};return _0x552f31;})});}_0x5428a7=_[_0x5bf2('0x48')]({},_0x5428a7,_0x5a375f[_0x5bf2('0x4f')]);return _0x11a6ce[_0x5bf2('0x53')](_0x5428a7);}})['then'](function(_0x3615ff){if(_0x3615ff){_0x687931=_0x3615ff[_0x5bf2('0x40')];if(!_0x5a375f[_0x5bf2('0x3c')][_0x5bf2('0x41')]('nolimit')){_0x5428a7[_0x5bf2('0x2e')]=qs[_0x5bf2('0x2e')](_0x5a375f['query'][_0x5bf2('0x2e')]);_0x5428a7['offset']=qs[_0x5bf2('0x2d')](_0x5a375f['query'][_0x5bf2('0x2d')]);}return _0x11a6ce[_0x5bf2('0x53')](_0x5428a7);}})['then'](function(_0x408a96){if(_0x408a96){return _0x408a96?{'count':_0x687931,'rows':_0x408a96}:null;}})[_0x5bf2('0x1d')](respondWithResult(_0x109754,null))[_0x5bf2('0x27')](handleError(_0x109754,null));};exports[_0x5bf2('0x56')]=function(_0x35cdb9,_0x5ba65c,_0x11b9c6){if(_0x35cdb9[_0x5bf2('0x52')]['id']){delete _0x35cdb9['body']['id'];}return db[_0x5bf2('0x38')][_0x5bf2('0x57')]({'where':{'id':_0x35cdb9[_0x5bf2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5ba65c,null))['then'](function(_0xe363eb){if(_0xe363eb){_0x35cdb9[_0x5bf2('0x52')]['AccountId']=_0xe363eb['id'];_0x35cdb9[_0x5bf2('0x52')]['Subjects']=integrations[_0x5bf2('0x58')](_0x35cdb9['body'][_0x5bf2('0x59')],_0x35cdb9[_0x5bf2('0x52')][_0x5bf2('0x49')]);_0x35cdb9[_0x5bf2('0x52')][_0x5bf2('0x5a')]=integrations[_0x5bf2('0x5b')](_0x35cdb9[_0x5bf2('0x52')]['channel'],_0x35cdb9[_0x5bf2('0x52')][_0x5bf2('0x49')]);return db[_0x5bf2('0x55')][_0x5bf2('0x51')](_0x35cdb9['body'],{'include':[{'model':db[_0x5bf2('0x5c')],'as':'Subjects'},{'model':db[_0x5bf2('0x5c')],'as':_0x5bf2('0x5a')}]});}return null;})[_0x5bf2('0x1d')](respondWithResult(_0x5ba65c,null))['catch'](handleError(_0x5ba65c,null));};var md5=require(_0x5bf2('0x5d'));exports[_0x5bf2('0x5e')]=function(_0x2b9671,_0xddac84,_0x127e9e){var _0x1ab4f4=null;var _0x2a4ec5=null;var _0x533824=null;var _0x6bb884=null;var _0x33eeb5='';return db['VtigerAccount'][_0x5bf2('0x57')]({'where':{'id':_0x2b9671[_0x5bf2('0x4d')]['id']},'attributes':['id',_0x5bf2('0x35'),_0x5bf2('0x5f'),'description',_0x5bf2('0x60'),_0x5bf2('0x61'),'serverUrl','accessKey']})[_0x5bf2('0x1d')](handleEntityNotFound(_0xddac84,null))['then'](function(_0xff3bdb){if(_0xff3bdb){_0x1ab4f4=_0xff3bdb['username'];_0x2a4ec5=_0xff3bdb[_0x5bf2('0x62')];_0x533824=_0xff3bdb[_0x5bf2('0x60')];_0x33eeb5=_0xff3bdb['remoteUri'];var _0x3d23cb=_0x33eeb5[_0x5bf2('0x63')](-0x1);if(_0x3d23cb==='/'){_0x33eeb5=_0x33eeb5[_0x5bf2('0x64')](0x0,_0x33eeb5[_0x5bf2('0x65')](_0x3d23cb));}_0x6bb884=util[_0x5bf2('0x66')](_0x5bf2('0x67'),_0x33eeb5);var _0x5f0d18={'method':_0x5bf2('0x68'),'uri':_0x6bb884,'qs':{'operation':_0x5bf2('0x69'),'username':_0xff3bdb[_0x5bf2('0x5f')]},'json':!![]};return rp(_0x5f0d18);}})['then'](function(_0x12a4bf){if(_0x12a4bf[_0x5bf2('0x6a')]){var _0x4d3bfa={'method':_0x5bf2('0x6b'),'uri':_0x6bb884,'form':{'operation':_0x5bf2('0x6c'),'username':_0x1ab4f4,'accessKey':md5(_0x12a4bf[_0x5bf2('0x26')][_0x5bf2('0x6d')]+_0x2a4ec5)},'json':!![]};return rp(_0x4d3bfa);}})[_0x5bf2('0x1d')](function(_0x48e5c1){if(_0x48e5c1[_0x5bf2('0x6a')]){var _0x41d8d7={'method':'GET','uri':_0x6bb884,'qs':{'operation':'describe','username':_0x1ab4f4,'sessionName':_0x48e5c1[_0x5bf2('0x26')][_0x5bf2('0x6e')],'elementType':_0x533824},'json':!![]};return rp(_0x41d8d7);}})[_0x5bf2('0x1d')](function(_0x468df9){if(_0x468df9[_0x5bf2('0x6a')]){var _0x137cf8=[_0x5bf2('0x6f'),_0x5bf2('0x70'),_0x5bf2('0x71')];_[_0x5bf2('0x72')](_0x468df9['result'][_0x5bf2('0x3f')],function(_0x501604){return _0x137cf8['includes'](_0x501604['type'][_0x5bf2('0x35')]);});_[_0x5bf2('0x72')](_0x468df9[_0x5bf2('0x26')]['fields'],function(_0x2aae71){return _0x2aae71['editable']==='false';});return{'count':_0x468df9[_0x5bf2('0x26')][_0x5bf2('0x3f')][_0x5bf2('0x40')],'rows':_[_0x5bf2('0x37')](_0x468df9[_0x5bf2('0x26')][_0x5bf2('0x3f')],function(_0x1ad8cc){return{'id':_0x1ad8cc[_0x5bf2('0x35')],'name':_0x1ad8cc[_0x5bf2('0x73')],'custom':_[_0x5bf2('0x74')](_0x1ad8cc[_0x5bf2('0x35')],_0x5bf2('0x75'))?!![]:![],'options':_0x1ad8cc[_0x5bf2('0x49')][_0x5bf2('0x35')]==='picklist'&&_0x1ad8cc[_0x5bf2('0x49')][_0x5bf2('0x76')][_0x5bf2('0x40')]>0x0?_[_0x5bf2('0x37')](_0x1ad8cc[_0x5bf2('0x49')][_0x5bf2('0x76')],function(_0x525a89){return{'name':_0x525a89[_0x5bf2('0x73')],'value':_0x525a89['value']};}):[]};})};}})[_0x5bf2('0x1d')](respondWithResult(_0xddac84,null))['catch'](function(_0x2501ff){console[_0x5bf2('0x77')]('vTiger\x20error:\x20'+_0x2501ff);var _0x4ab74d=_0x2b9671['query']['test']?0x1f4:_0x2501ff[_0x5bf2('0x78')]||0x1f4;logger['error'](_0x5bf2('0x79'),_0x5bf2('0x5e'),_0x4ab74d,JSON[_0x5bf2('0x7a')](_0x2501ff));delete _0x2501ff[_0x5bf2('0x35')];if(_0x4ab74d===0x191){_0x4ab74d=0x190;}_0xddac84[_0x5bf2('0x29')](_0x4ab74d)['send'](_0x2b9671[_0x5bf2('0x3c')][_0x5bf2('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x2501ff[_0x5bf2('0x78')]}:_0x2501ff);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 516b5ed..528e417 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 _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 +var _0x655a=['bluebird','request-promise','../../components/integrations/configuration','define','lodash','util','../../config/logger','api'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x655a,0x6c));var _0xa655=function(_0x3bdfb8,_0x27c0d5){_0x3bdfb8=_0x3bdfb8-0x0;var _0x34d285=_0x655a[_0x3bdfb8];return _0x34d285;};'use strict';var _=require(_0xa655('0x0'));var util=require(_0xa655('0x1'));var logger=require(_0xa655('0x2'))(_0xa655('0x3'));var moment=require('moment');var BPromise=require(_0xa655('0x4'));var rp=require(_0xa655('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xa655('0x6'));module['exports']=function(_0x1d7d99,_0x3202fe){return _0x1d7d99[_0xa655('0x7')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','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 a26ff3d..4edd43b 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 _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 +var _0x9fae=['debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVtigerAccount','findAll','options','map','include','model','attributes','catch','ShowVtigerAccount','VtigerAccount','find','raw','where','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x29a390,_0x599343){var _0x83c7e0=function(_0x599fd5){while(--_0x599fd5){_0x29a390['push'](_0x29a390['shift']());}};_0x83c7e0(++_0x599343);}(_0x9fae,0x194));var _0xe9fa=function(_0x43626b,_0x1d5c35){_0x43626b=_0x43626b-0x0;var _0xbe72d3=_0x9fae[_0x43626b];return _0xbe72d3;};'use strict';var _=require(_0xe9fa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe9fa('0x1'));var rs=require(_0xe9fa('0x2'));var fs=require('fs');var Redis=require(_0xe9fa('0x3'));var db=require(_0xe9fa('0x4'))['db'];var utils=require(_0xe9fa('0x5'));var logger=require(_0xe9fa('0x6'))('rpc');var config=require(_0xe9fa('0x7'));var jayson=require(_0xe9fa('0x8'));var client=jayson[_0xe9fa('0x9')][_0xe9fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8b655c,_0x5a0a00,_0x8a2467){return new BPromise(function(_0x126407,_0x189852){return client[_0xe9fa('0xb')](_0x8b655c,_0x8a2467)[_0xe9fa('0xc')](function(_0x392333){logger[_0xe9fa('0xd')](_0xe9fa('0xe'),_0x5a0a00,_0xe9fa('0xf'));logger[_0xe9fa('0x10')](_0xe9fa('0x11'),_0x5a0a00,_0xe9fa('0xf'),JSON[_0xe9fa('0x12')](_0x392333));if(_0x392333[_0xe9fa('0x13')]){if(_0x392333[_0xe9fa('0x13')]['code']===0x1f4){logger[_0xe9fa('0x13')](_0xe9fa('0xe'),_0x5a0a00,_0x392333['error'][_0xe9fa('0x14')]);return _0x189852(_0x392333[_0xe9fa('0x13')][_0xe9fa('0x14')]);}logger[_0xe9fa('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x5a0a00,_0x392333[_0xe9fa('0x13')][_0xe9fa('0x14')]);return _0x126407(_0x392333['error'][_0xe9fa('0x14')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x5a0a00,_0xe9fa('0xf'));_0x126407(_0x392333[_0xe9fa('0x15')][_0xe9fa('0x14')]);}})['catch'](function(_0x4349b3){logger[_0xe9fa('0x13')](_0xe9fa('0xe'),_0x5a0a00,_0x4349b3);_0x189852(_0x4349b3);});});}exports[_0xe9fa('0x16')]=function(_0x6b165){var _0x1ce427=this;return new Promise(function(_0x331776,_0x566c80){return db['VtigerAccount'][_0xe9fa('0x17')]({'raw':_0x6b165['options']?_0x6b165[_0xe9fa('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x6b165[_0xe9fa('0x18')]?_0x6b165[_0xe9fa('0x18')]['where']||null:null,'attributes':_0x6b165['options']?_0x6b165[_0xe9fa('0x18')]['attributes']||null:null,'limit':_0x6b165[_0xe9fa('0x18')]?_0x6b165[_0xe9fa('0x18')]['limit']||null:null,'include':_0x6b165[_0xe9fa('0x18')]?_0x6b165[_0xe9fa('0x18')]['include']?_[_0xe9fa('0x19')](_0x6b165[_0xe9fa('0x18')][_0xe9fa('0x1a')],function(_0x2e454e){return{'model':db[_0x2e454e[_0xe9fa('0x1b')]],'as':_0x2e454e['as'],'attributes':_0x2e454e[_0xe9fa('0x1c')],'include':_0x2e454e['include']?_['map'](_0x2e454e[_0xe9fa('0x1a')],function(_0xd5fcd){return{'model':db[_0xd5fcd['model']],'as':_0xd5fcd['as'],'attributes':_0xd5fcd[_0xe9fa('0x1c')],'include':_0xd5fcd[_0xe9fa('0x1a')]?_['map'](_0xd5fcd['include'],function(_0x2e2cbb){return{'model':db[_0x2e2cbb[_0xe9fa('0x1b')]],'as':_0x2e2cbb['as'],'attributes':_0x2e2cbb[_0xe9fa('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe9fa('0xc')](function(_0x363209){logger[_0xe9fa('0xd')](_0xe9fa('0x16'),_0x6b165);logger[_0xe9fa('0x10')](_0xe9fa('0x16'),_0x6b165,JSON['stringify'](_0x363209));_0x331776(_0x363209);})[_0xe9fa('0x1d')](function(_0xbc8688){logger[_0xe9fa('0x13')](_0xe9fa('0x16'),_0xbc8688[_0xe9fa('0x14')],_0x6b165);_0x566c80(_0x1ce427['error'](0x1f4,_0xbc8688[_0xe9fa('0x14')]));});});};exports[_0xe9fa('0x1e')]=function(_0x2af5f7){var _0x46eb67=this;return new Promise(function(_0x446fae,_0x14c415){return db[_0xe9fa('0x1f')][_0xe9fa('0x20')]({'raw':_0x2af5f7[_0xe9fa('0x18')]?_0x2af5f7[_0xe9fa('0x18')][_0xe9fa('0x21')]===undefined?!![]:![]:!![],'where':_0x2af5f7['options']?_0x2af5f7['options'][_0xe9fa('0x22')]||null:null,'attributes':_0x2af5f7['options']?_0x2af5f7[_0xe9fa('0x18')][_0xe9fa('0x1c')]||null:null,'include':_0x2af5f7[_0xe9fa('0x18')]?_0x2af5f7[_0xe9fa('0x18')][_0xe9fa('0x1a')]?_[_0xe9fa('0x19')](_0x2af5f7[_0xe9fa('0x18')][_0xe9fa('0x1a')],function(_0x1341fa){return{'model':db[_0x1341fa['model']],'as':_0x1341fa['as'],'attributes':_0x1341fa[_0xe9fa('0x1c')],'include':_0x1341fa[_0xe9fa('0x1a')]?_[_0xe9fa('0x19')](_0x1341fa[_0xe9fa('0x1a')],function(_0x36571a){return{'model':db[_0x36571a[_0xe9fa('0x1b')]],'as':_0x36571a['as'],'attributes':_0x36571a[_0xe9fa('0x1c')],'include':_0x36571a[_0xe9fa('0x1a')]?_[_0xe9fa('0x19')](_0x36571a['include'],function(_0x4ccf3e){return{'model':db[_0x4ccf3e[_0xe9fa('0x1b')]],'as':_0x4ccf3e['as'],'attributes':_0x4ccf3e[_0xe9fa('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe9fa('0xc')](function(_0x2b556f){logger[_0xe9fa('0xd')](_0xe9fa('0x1e'),_0x2af5f7);logger[_0xe9fa('0x10')](_0xe9fa('0x1e'),_0x2af5f7,JSON[_0xe9fa('0x12')](_0x2b556f));_0x446fae(_0x2b556f);})[_0xe9fa('0x1d')](function(_0x200e4f){logger[_0xe9fa('0x13')]('ShowVtigerAccount',_0x200e4f[_0xe9fa('0x14')],_0x2af5f7);_0x14c415(_0x46eb67['error'](0x1f4,_0x200e4f[_0xe9fa('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index f4dfeb5..069db88 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(_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 +var _0xd8b0=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','show'];(function(_0x50e7e0,_0x5affce){var _0x1a0307=function(_0x32d343){while(--_0x32d343){_0x50e7e0['push'](_0x50e7e0['shift']());}};_0x1a0307(++_0x5affce);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 0d12286..809559a 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 _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 +var _0x0c6a=['exports','STRING','sequelize'];(function(_0x4235f8,_0x2aecd1){var _0x5c527a=function(_0x1699d9){while(--_0x1699d9){_0x4235f8['push'](_0x4235f8['shift']());}};_0x5c527a(++_0x2aecd1);}(_0x0c6a,0xd7));var _0xa0c6=function(_0x4caade,_0x549ce1){_0x4caade=_0x4caade-0x0;var _0x2041ff=_0x0c6a[_0x4caade];return _0x2041ff;};'use strict';var Sequelize=require(_0xa0c6('0x0'));module[_0xa0c6('0x1')]={'name':{'type':Sequelize[_0xa0c6('0x2')]},'description':{'type':Sequelize[_0xa0c6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 01e4201..bab2871 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 _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 +var _0x1ae3=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','show','params','options','find','create','body','VtigerField','length','getFields','getSubjects','findOne','getDescriptions','html-pdf','eml-format','zip-dir','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','api','../../config/utils','../../config/license/util','jayson/promise','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','VtigerConfiguration'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x1ae3,0x139));var _0x31ae=function(_0x30f251,_0x4428fe){_0x30f251=_0x30f251-0x0;var _0x51a94d=_0x1ae3[_0x30f251];return _0x51a94d;};'use strict';var pdf=require(_0x31ae('0x0'));var emlformat=require(_0x31ae('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x31ae('0x2'));var jsonpatch=require(_0x31ae('0x3'));var rp=require(_0x31ae('0x4'));var moment=require(_0x31ae('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x31ae('0x6'));var util=require(_0x31ae('0x7'));var path=require(_0x31ae('0x8'));var sox=require(_0x31ae('0x9'));var csv=require(_0x31ae('0xa'));var ejs=require(_0x31ae('0xb'));var fs=require('fs');var _=require(_0x31ae('0xc'));var squel=require(_0x31ae('0xd'));var crypto=require(_0x31ae('0xe'));var jsforce=require(_0x31ae('0xf'));var deskjs=require(_0x31ae('0x10'));var toCsv=require(_0x31ae('0xa'));var querystring=require(_0x31ae('0x11'));var Papa=require(_0x31ae('0x12'));var Redis=require(_0x31ae('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x31ae('0x14'));var as=require(_0x31ae('0x15'));var hardwareService=require(_0x31ae('0x16'));var logger=require('../../config/logger')(_0x31ae('0x17'));var utils=require(_0x31ae('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x31ae('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x31ae('0x1a'));var client=jayson[_0x31ae('0x1b')][_0x31ae('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5a4a21,_0x4142ff,_0x2837c9,_0x201e43){return new BPromise(function(_0x3ba04a,_0x2b1fc2){var _0x273c94=_0x201e43||client;return _0x273c94['request'](_0x5a4a21,_0x2837c9)[_0x31ae('0x1d')](function(_0x11abd4){logger[_0x31ae('0x1e')](_0x31ae('0x1f'),_0x4142ff,_0x31ae('0x20'));logger[_0x31ae('0x21')](_0x31ae('0x22'),_0x4142ff,_0x31ae('0x20'),JSON['stringify'](_0x11abd4));if(_0x11abd4[_0x31ae('0x23')]){if(_0x11abd4['error'][_0x31ae('0x24')]===0x1f4){logger[_0x31ae('0x23')](_0x31ae('0x1f'),_0x4142ff,_0x11abd4[_0x31ae('0x23')][_0x31ae('0x25')]);return _0x2b1fc2(_0x11abd4[_0x31ae('0x23')][_0x31ae('0x25')]);}logger[_0x31ae('0x23')](_0x31ae('0x1f'),_0x4142ff,_0x11abd4[_0x31ae('0x23')][_0x31ae('0x25')]);return _0x3ba04a(_0x11abd4[_0x31ae('0x23')]['message']);}else{logger[_0x31ae('0x1e')](_0x31ae('0x1f'),_0x4142ff,_0x31ae('0x20'));_0x3ba04a(_0x11abd4[_0x31ae('0x26')]['message']);}})[_0x31ae('0x27')](function(_0x1828b1){logger['error'](_0x31ae('0x1f'),_0x4142ff,_0x1828b1);_0x2b1fc2(_0x1828b1);});});}function respondWithStatusCode(_0x4969e3,_0xd24bd5){_0xd24bd5=_0xd24bd5||0xcc;return function(_0x56f9c4){if(_0x56f9c4){return _0x4969e3['sendStatus'](_0xd24bd5);}return _0x4969e3[_0x31ae('0x28')](_0xd24bd5)[_0x31ae('0x29')]();};}function respondWithResult(_0x2a9bf6,_0x4c86ba){_0x4c86ba=_0x4c86ba||0xc8;return function(_0x4d18c0){if(_0x4d18c0){return _0x2a9bf6['status'](_0x4c86ba)[_0x31ae('0x2a')](_0x4d18c0);}};}function respondWithFilteredResult(_0x579cbe,_0x43ca3d){return function(_0x2b5230){if(_0x2b5230){var _0xf49658=_0x2b5230[_0x31ae('0x2b')],_0xb99935=_0x43ca3d[_0x31ae('0x2c')],_0x3bb96a=_0x43ca3d['offset']+_0x43ca3d[_0x31ae('0x2d')],_0x2e4222;if(_0x3bb96a>=_0xf49658){_0x3bb96a=_0xf49658;_0x2e4222=0xc8;}else{_0x2e4222=0xce;}_0x579cbe[_0x31ae('0x28')](_0x2e4222);return _0x579cbe[_0x31ae('0x2e')](_0x31ae('0x2f'),_0xb99935+'-'+_0x3bb96a+'/'+_0xf49658)['json'](_0x2b5230);}return null;};}function patchUpdates(_0x14f472){return function(_0x418d59){try{jsonpatch[_0x31ae('0x30')](_0x418d59,_0x14f472,!![]);}catch(_0x2c278b){return BPromise[_0x31ae('0x31')](_0x2c278b);}return _0x418d59[_0x31ae('0x32')]();};}function saveUpdates(_0x47b1ba,_0x4d2172){return function(_0x508f3c){if(_0x508f3c){return _0x508f3c[_0x31ae('0x33')](_0x47b1ba)['then'](function(_0x36baec){return _0x36baec;});}return null;};}function removeEntity(_0x3d7e2e,_0x523e4e){return function(_0x2008a5){if(_0x2008a5){return _0x2008a5[_0x31ae('0x34')]()[_0x31ae('0x1d')](function(){_0x3d7e2e[_0x31ae('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21466d,_0x130ee9){return function(_0x4d22cf){if(!_0x4d22cf){_0x21466d['sendStatus'](0x194);}return _0x4d22cf;};}function handleError(_0x50b12e,_0x46ffb1){_0x46ffb1=_0x46ffb1||0x1f4;return function(_0x3553e0){logger[_0x31ae('0x23')](_0x3553e0[_0x31ae('0x35')]);if(_0x3553e0[_0x31ae('0x36')]){delete _0x3553e0['name'];}_0x50b12e[_0x31ae('0x28')](_0x46ffb1)[_0x31ae('0x37')](_0x3553e0);};}exports[_0x31ae('0x38')]=function(_0x3506e0,_0x3cf048){var _0x3d6c3c={},_0x358e99={},_0x39c3b6={'count':0x0,'rows':[]};var _0x13626b=_[_0x31ae('0x39')](db[_0x31ae('0x3a')][_0x31ae('0x3b')],function(_0x50bc0c){return{'name':_0x50bc0c[_0x31ae('0x3c')],'type':_0x50bc0c[_0x31ae('0x3d')]['key']};});_0x358e99[_0x31ae('0x3e')]=_[_0x31ae('0x39')](_0x13626b,_0x31ae('0x36'));_0x358e99[_0x31ae('0x3f')]=_[_0x31ae('0x40')](_0x3506e0['query']);_0x358e99[_0x31ae('0x41')]=_['intersection'](_0x358e99['model'],_0x358e99[_0x31ae('0x3f')]);_0x3d6c3c['attributes']=_[_0x31ae('0x42')](_0x358e99['model'],qs['fields'](_0x3506e0[_0x31ae('0x3f')][_0x31ae('0x43')]));_0x3d6c3c[_0x31ae('0x44')]=_0x3d6c3c[_0x31ae('0x44')]['length']?_0x3d6c3c[_0x31ae('0x44')]:_0x358e99[_0x31ae('0x3e')];if(!_0x3506e0[_0x31ae('0x3f')][_0x31ae('0x45')](_0x31ae('0x46'))){_0x3d6c3c[_0x31ae('0x2d')]=qs['limit'](_0x3506e0['query'][_0x31ae('0x2d')]);_0x3d6c3c[_0x31ae('0x2c')]=qs['offset'](_0x3506e0[_0x31ae('0x3f')][_0x31ae('0x2c')]);}_0x3d6c3c[_0x31ae('0x47')]=qs[_0x31ae('0x48')](_0x3506e0[_0x31ae('0x3f')][_0x31ae('0x48')]);_0x3d6c3c['where']=qs[_0x31ae('0x41')](_[_0x31ae('0x49')](_0x3506e0[_0x31ae('0x3f')],_0x358e99['filters']),_0x13626b);if(_0x3506e0[_0x31ae('0x3f')][_0x31ae('0x4a')]){_0x3d6c3c['where']=_[_0x31ae('0x4b')](_0x3d6c3c[_0x31ae('0x4c')],{'$or':_[_0x31ae('0x39')](_0x13626b,function(_0x5bbe16){if(_0x5bbe16[_0x31ae('0x3d')]!==_0x31ae('0x4d')){var _0x2bd751={};_0x2bd751[_0x5bbe16['name']]={'$like':'%'+_0x3506e0[_0x31ae('0x3f')][_0x31ae('0x4a')]+'%'};return _0x2bd751;}})});}_0x3d6c3c=_[_0x31ae('0x4b')]({},_0x3d6c3c,_0x3506e0['options']);var _0x2995c7={'where':_0x3d6c3c[_0x31ae('0x4c')]};return db['VtigerConfiguration'][_0x31ae('0x2b')](_0x2995c7)[_0x31ae('0x1d')](function(_0x20f33a){_0x39c3b6[_0x31ae('0x2b')]=_0x20f33a;if(_0x3506e0[_0x31ae('0x3f')][_0x31ae('0x4e')]){_0x3d6c3c[_0x31ae('0x4f')]=[{'all':!![]}];}return db[_0x31ae('0x3a')][_0x31ae('0x50')](_0x3d6c3c);})[_0x31ae('0x1d')](function(_0x3eba5d){_0x39c3b6['rows']=_0x3eba5d;return _0x39c3b6;})[_0x31ae('0x1d')](respondWithFilteredResult(_0x3cf048,_0x3d6c3c))['catch'](handleError(_0x3cf048,null));};exports[_0x31ae('0x51')]=function(_0x44546a,_0x20980d){var _0x23ebcb={'raw':![],'where':{'id':_0x44546a[_0x31ae('0x52')]['id']}},_0x381f2a={};_0x381f2a[_0x31ae('0x3e')]=_[_0x31ae('0x40')](db[_0x31ae('0x3a')][_0x31ae('0x3b')]);_0x381f2a[_0x31ae('0x3f')]=_[_0x31ae('0x40')](_0x44546a['query']);_0x381f2a[_0x31ae('0x41')]=_[_0x31ae('0x42')](_0x381f2a[_0x31ae('0x3e')],_0x381f2a[_0x31ae('0x3f')]);_0x23ebcb[_0x31ae('0x44')]=_[_0x31ae('0x42')](_0x381f2a[_0x31ae('0x3e')],qs[_0x31ae('0x43')](_0x44546a[_0x31ae('0x3f')][_0x31ae('0x43')]));_0x23ebcb['attributes']=_0x23ebcb[_0x31ae('0x44')]['length']?_0x23ebcb[_0x31ae('0x44')]:_0x381f2a['model'];if(_0x44546a[_0x31ae('0x3f')]['includeAll']){_0x23ebcb[_0x31ae('0x4f')]=[{'all':!![]}];}_0x23ebcb=_[_0x31ae('0x4b')]({},_0x23ebcb,_0x44546a[_0x31ae('0x53')]);return db[_0x31ae('0x3a')][_0x31ae('0x54')](_0x23ebcb)[_0x31ae('0x1d')](handleEntityNotFound(_0x20980d,null))[_0x31ae('0x1d')](respondWithResult(_0x20980d,null))[_0x31ae('0x27')](handleError(_0x20980d,null));};exports['create']=function(_0x2e1b23,_0x2c3963){return db[_0x31ae('0x3a')][_0x31ae('0x55')](_0x2e1b23[_0x31ae('0x56')],{})[_0x31ae('0x1d')](respondWithResult(_0x2c3963,0xc9))[_0x31ae('0x27')](handleError(_0x2c3963,null));};exports[_0x31ae('0x33')]=function(_0x780eae,_0x442cb9){if(_0x780eae['body']['id']){delete _0x780eae['body']['id'];}return db[_0x31ae('0x3a')][_0x31ae('0x54')]({'where':{'id':_0x780eae[_0x31ae('0x52')]['id']}})['then'](handleEntityNotFound(_0x442cb9,null))[_0x31ae('0x1d')](saveUpdates(_0x780eae[_0x31ae('0x56')],null))[_0x31ae('0x1d')](respondWithResult(_0x442cb9,null))[_0x31ae('0x27')](handleError(_0x442cb9,null));};exports[_0x31ae('0x34')]=function(_0xdc9162,_0xb2f63a){return db[_0x31ae('0x3a')]['find']({'where':{'id':_0xdc9162['params']['id']}})['then'](handleEntityNotFound(_0xb2f63a,null))['then'](removeEntity(_0xb2f63a,null))[_0x31ae('0x27')](handleError(_0xb2f63a,null));};exports['getFields']=function(_0x1f9a46,_0x45ee34,_0x21930d){var _0x497a47={};var _0x1d2bcd={};var _0x171c79;var _0x3cb502;return db[_0x31ae('0x3a')]['findOne']({'where':{'id':_0x1f9a46['params']['id']}})[_0x31ae('0x1d')](handleEntityNotFound(_0x45ee34,null))['then'](function(_0x5d3903){if(_0x5d3903){_0x171c79=_0x5d3903;_0x1d2bcd[_0x31ae('0x3e')]=_['keys'](db[_0x31ae('0x57')][_0x31ae('0x3b')]);_0x1d2bcd[_0x31ae('0x3f')]=_[_0x31ae('0x40')](_0x1f9a46[_0x31ae('0x3f')]);_0x1d2bcd[_0x31ae('0x41')]=_[_0x31ae('0x42')](_0x1d2bcd[_0x31ae('0x3e')],_0x1d2bcd['query']);_0x497a47[_0x31ae('0x44')]=_[_0x31ae('0x42')](_0x1d2bcd[_0x31ae('0x3e')],qs[_0x31ae('0x43')](_0x1f9a46[_0x31ae('0x3f')][_0x31ae('0x43')]));_0x497a47['attributes']=_0x497a47[_0x31ae('0x44')][_0x31ae('0x58')]?_0x497a47[_0x31ae('0x44')]:_0x1d2bcd[_0x31ae('0x3e')];_0x497a47[_0x31ae('0x47')]=qs['sort'](_0x1f9a46[_0x31ae('0x3f')][_0x31ae('0x48')]);_0x497a47[_0x31ae('0x4c')]=qs[_0x31ae('0x41')](_['pick'](_0x1f9a46['query'],_0x1d2bcd[_0x31ae('0x41')]));if(_0x1f9a46[_0x31ae('0x3f')][_0x31ae('0x4a')]){_0x497a47[_0x31ae('0x4c')]=_[_0x31ae('0x4b')](_0x497a47[_0x31ae('0x4c')],{'$or':_[_0x31ae('0x39')](_0x497a47[_0x31ae('0x44')],function(_0x2295c0){var _0xb3bba1={};_0xb3bba1[_0x2295c0]={'$like':'%'+_0x1f9a46['query'][_0x31ae('0x4a')]+'%'};return _0xb3bba1;})});}_0x497a47=_[_0x31ae('0x4b')]({},_0x497a47,_0x1f9a46[_0x31ae('0x53')]);return _0x171c79[_0x31ae('0x59')](_0x497a47);}})[_0x31ae('0x1d')](function(_0x531056){if(_0x531056){_0x3cb502=_0x531056[_0x31ae('0x58')];if(!_0x1f9a46[_0x31ae('0x3f')]['hasOwnProperty'](_0x31ae('0x46'))){_0x497a47[_0x31ae('0x2d')]=qs['limit'](_0x1f9a46['query'][_0x31ae('0x2d')]);_0x497a47[_0x31ae('0x2c')]=qs[_0x31ae('0x2c')](_0x1f9a46['query'][_0x31ae('0x2c')]);}return _0x171c79[_0x31ae('0x59')](_0x497a47);}})[_0x31ae('0x1d')](function(_0x12ac4e){if(_0x12ac4e){return _0x12ac4e?{'count':_0x3cb502,'rows':_0x12ac4e}:null;}})[_0x31ae('0x1d')](respondWithResult(_0x45ee34,null))[_0x31ae('0x27')](handleError(_0x45ee34,null));};exports[_0x31ae('0x5a')]=function(_0x124a6a,_0x4dfe04,_0x4f0e7c){var _0x5be3d4={};var _0x369d73={};var _0x1b5df9;var _0x1eafa1;return db[_0x31ae('0x3a')][_0x31ae('0x5b')]({'where':{'id':_0x124a6a['params']['id']}})[_0x31ae('0x1d')](handleEntityNotFound(_0x4dfe04,null))[_0x31ae('0x1d')](function(_0x58805d){if(_0x58805d){_0x1b5df9=_0x58805d;_0x369d73[_0x31ae('0x3e')]=_['keys'](db[_0x31ae('0x57')][_0x31ae('0x3b')]);_0x369d73[_0x31ae('0x3f')]=_[_0x31ae('0x40')](_0x124a6a[_0x31ae('0x3f')]);_0x369d73['filters']=_[_0x31ae('0x42')](_0x369d73[_0x31ae('0x3e')],_0x369d73[_0x31ae('0x3f')]);_0x5be3d4[_0x31ae('0x44')]=_[_0x31ae('0x42')](_0x369d73[_0x31ae('0x3e')],qs[_0x31ae('0x43')](_0x124a6a[_0x31ae('0x3f')][_0x31ae('0x43')]));_0x5be3d4[_0x31ae('0x44')]=_0x5be3d4[_0x31ae('0x44')][_0x31ae('0x58')]?_0x5be3d4[_0x31ae('0x44')]:_0x369d73['model'];_0x5be3d4[_0x31ae('0x47')]=qs[_0x31ae('0x48')](_0x124a6a[_0x31ae('0x3f')]['sort']);_0x5be3d4[_0x31ae('0x4c')]=qs[_0x31ae('0x41')](_[_0x31ae('0x49')](_0x124a6a['query'],_0x369d73[_0x31ae('0x41')]));if(_0x124a6a[_0x31ae('0x3f')]['filter']){_0x5be3d4[_0x31ae('0x4c')]=_[_0x31ae('0x4b')](_0x5be3d4[_0x31ae('0x4c')],{'$or':_[_0x31ae('0x39')](_0x5be3d4[_0x31ae('0x44')],function(_0x2aa5c2){var _0x225af5={};_0x225af5[_0x2aa5c2]={'$like':'%'+_0x124a6a['query'][_0x31ae('0x4a')]+'%'};return _0x225af5;})});}_0x5be3d4=_[_0x31ae('0x4b')]({},_0x5be3d4,_0x124a6a[_0x31ae('0x53')]);return _0x1b5df9['getSubjects'](_0x5be3d4);}})[_0x31ae('0x1d')](function(_0x2c9e6a){if(_0x2c9e6a){_0x1eafa1=_0x2c9e6a[_0x31ae('0x58')];if(!_0x124a6a[_0x31ae('0x3f')][_0x31ae('0x45')](_0x31ae('0x46'))){_0x5be3d4[_0x31ae('0x2d')]=qs['limit'](_0x124a6a[_0x31ae('0x3f')][_0x31ae('0x2d')]);_0x5be3d4[_0x31ae('0x2c')]=qs[_0x31ae('0x2c')](_0x124a6a[_0x31ae('0x3f')][_0x31ae('0x2c')]);}return _0x1b5df9['getSubjects'](_0x5be3d4);}})['then'](function(_0x3932cd){if(_0x3932cd){return _0x3932cd?{'count':_0x1eafa1,'rows':_0x3932cd}:null;}})[_0x31ae('0x1d')](respondWithResult(_0x4dfe04,null))[_0x31ae('0x27')](handleError(_0x4dfe04,null));};exports[_0x31ae('0x5c')]=function(_0x154012,_0x5ecb70,_0x22d231){var _0xd3449={};var _0x40d9ce={};var _0x17dcb1;var _0x426121;return db[_0x31ae('0x3a')][_0x31ae('0x5b')]({'where':{'id':_0x154012[_0x31ae('0x52')]['id']}})[_0x31ae('0x1d')](handleEntityNotFound(_0x5ecb70,null))['then'](function(_0xdbcb2e){if(_0xdbcb2e){_0x17dcb1=_0xdbcb2e;_0x40d9ce[_0x31ae('0x3e')]=_[_0x31ae('0x40')](db['VtigerField'][_0x31ae('0x3b')]);_0x40d9ce[_0x31ae('0x3f')]=_[_0x31ae('0x40')](_0x154012[_0x31ae('0x3f')]);_0x40d9ce[_0x31ae('0x41')]=_['intersection'](_0x40d9ce[_0x31ae('0x3e')],_0x40d9ce['query']);_0xd3449['attributes']=_['intersection'](_0x40d9ce[_0x31ae('0x3e')],qs[_0x31ae('0x43')](_0x154012[_0x31ae('0x3f')][_0x31ae('0x43')]));_0xd3449[_0x31ae('0x44')]=_0xd3449['attributes']['length']?_0xd3449[_0x31ae('0x44')]:_0x40d9ce[_0x31ae('0x3e')];_0xd3449[_0x31ae('0x47')]=qs[_0x31ae('0x48')](_0x154012[_0x31ae('0x3f')][_0x31ae('0x48')]);_0xd3449[_0x31ae('0x4c')]=qs[_0x31ae('0x41')](_[_0x31ae('0x49')](_0x154012['query'],_0x40d9ce[_0x31ae('0x41')]));if(_0x154012['query'][_0x31ae('0x4a')]){_0xd3449['where']=_[_0x31ae('0x4b')](_0xd3449[_0x31ae('0x4c')],{'$or':_[_0x31ae('0x39')](_0xd3449[_0x31ae('0x44')],function(_0x18eeee){var _0xb99ee7={};_0xb99ee7[_0x18eeee]={'$like':'%'+_0x154012[_0x31ae('0x3f')][_0x31ae('0x4a')]+'%'};return _0xb99ee7;})});}_0xd3449=_['merge']({},_0xd3449,_0x154012[_0x31ae('0x53')]);return _0x17dcb1[_0x31ae('0x5c')](_0xd3449);}})[_0x31ae('0x1d')](function(_0x1f3134){if(_0x1f3134){_0x426121=_0x1f3134['length'];if(!_0x154012[_0x31ae('0x3f')]['hasOwnProperty'](_0x31ae('0x46'))){_0xd3449[_0x31ae('0x2d')]=qs[_0x31ae('0x2d')](_0x154012[_0x31ae('0x3f')][_0x31ae('0x2d')]);_0xd3449[_0x31ae('0x2c')]=qs['offset'](_0x154012[_0x31ae('0x3f')][_0x31ae('0x2c')]);}return _0x17dcb1['getDescriptions'](_0xd3449);}})[_0x31ae('0x1d')](function(_0x375346){if(_0x375346){return _0x375346?{'count':_0x426121,'rows':_0x375346}:null;}})[_0x31ae('0x1d')](respondWithResult(_0x5ecb70,null))['catch'](handleError(_0x5ecb70,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 2aebbd1..92f4c2e 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 _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 +var _0xa09f=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intVtigerConfiguration.attributes','define','int_vtiger_configurations','lodash'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xa09f,0xc5));var _0xfa09=function(_0x48adf2,_0x12c0c7){_0x48adf2=_0x48adf2-0x0;var _0x16d022=_0xa09f[_0x48adf2];return _0x16d022;};'use strict';var _=require(_0xfa09('0x0'));var util=require(_0xfa09('0x1'));var logger=require(_0xfa09('0x2'))('api');var moment=require(_0xfa09('0x3'));var BPromise=require(_0xfa09('0x4'));var rp=require(_0xfa09('0x5'));var fs=require('fs');var path=require(_0xfa09('0x6'));var rimraf=require(_0xfa09('0x7'));var config=require('../../config/environment');var attributes=require(_0xfa09('0x8'));module['exports']=function(_0x6fd741,_0x222a17){return _0x6fd741[_0xfa09('0x9')]('VtigerConfiguration',attributes,{'tableName':_0xfa09('0xa'),'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 c24127d..3761eae 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 _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 +var _0x5128=['result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x5128,0xd1));var _0x8512=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x5128[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x8512('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8512('0x1'));var rs=require(_0x8512('0x2'));var fs=require('fs');var Redis=require(_0x8512('0x3'));var db=require(_0x8512('0x4'))['db'];var utils=require(_0x8512('0x5'));var logger=require(_0x8512('0x6'))(_0x8512('0x7'));var config=require(_0x8512('0x8'));var jayson=require(_0x8512('0x9'));var client=jayson[_0x8512('0xa')][_0x8512('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x212d5d,_0x222e94,_0x71ab53){return new BPromise(function(_0xa32977,_0x166a3f){return client[_0x8512('0xc')](_0x212d5d,_0x71ab53)['then'](function(_0xb07c61){logger[_0x8512('0xd')](_0x8512('0xe'),_0x222e94,_0x8512('0xf'));logger[_0x8512('0x10')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x222e94,_0x8512('0xf'),JSON[_0x8512('0x11')](_0xb07c61));if(_0xb07c61[_0x8512('0x12')]){if(_0xb07c61[_0x8512('0x12')][_0x8512('0x13')]===0x1f4){logger[_0x8512('0x12')](_0x8512('0xe'),_0x222e94,_0xb07c61[_0x8512('0x12')][_0x8512('0x14')]);return _0x166a3f(_0xb07c61[_0x8512('0x12')][_0x8512('0x14')]);}logger['error'](_0x8512('0xe'),_0x222e94,_0xb07c61[_0x8512('0x12')]['message']);return _0xa32977(_0xb07c61['error'][_0x8512('0x14')]);}else{logger[_0x8512('0xd')](_0x8512('0xe'),_0x222e94,_0x8512('0xf'));_0xa32977(_0xb07c61[_0x8512('0x15')]['message']);}})[_0x8512('0x16')](function(_0x5cbaac){logger[_0x8512('0x12')](_0x8512('0xe'),_0x222e94,_0x5cbaac);_0x166a3f(_0x5cbaac);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 477bbc9..87bb784 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 _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 +var _0x3562=['show','post','put','update','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x456032,_0x1a799d){var _0x1a53cd=function(_0x162cc8){while(--_0x162cc8){_0x456032['push'](_0x456032['shift']());}};_0x1a53cd(++_0x1a799d);}(_0x3562,0xc9));var _0x2356=function(_0x13a219,_0x25acd3){_0x13a219=_0x13a219-0x0;var _0x50e371=_0x3562[_0x13a219];return _0x50e371;};'use strict';var multer=require(_0x2356('0x0'));var util=require('util');var path=require(_0x2356('0x1'));var timeout=require(_0x2356('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x2356('0x3'));var interaction=require(_0x2356('0x4'));var config=require(_0x2356('0x5'));var controller=require('./intVtigerField.controller');router[_0x2356('0x6')]('/',auth[_0x2356('0x7')](),controller['index']);router[_0x2356('0x6')](_0x2356('0x8'),auth[_0x2356('0x7')](),controller[_0x2356('0x9')]);router[_0x2356('0xa')]('/',auth[_0x2356('0x7')](),controller['create']);router[_0x2356('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x2356('0xc')]);router['delete'](_0x2356('0x8'),auth[_0x2356('0x7')](),controller[_0x2356('0xd')]);module[_0x2356('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 0b187a3..6eb2a30 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 _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 +var _0xdbad=['string','variable','keyValue','customVariable','STRING','sequelize','exports','ENUM'];(function(_0x4815dd,_0x4b4f03){var _0x36b9b5=function(_0x495657){while(--_0x495657){_0x4815dd['push'](_0x4815dd['shift']());}};_0x36b9b5(++_0x4b4f03);}(_0xdbad,0x8d));var _0xddba=function(_0x1a85bc,_0x1eabcd){_0x1a85bc=_0x1a85bc-0x0;var _0x4d53d3=_0xdbad[_0x1a85bc];return _0x4d53d3;};'use strict';var Sequelize=require(_0xddba('0x0'));module[_0xddba('0x1')]={'type':{'type':Sequelize[_0xddba('0x2')](_0xddba('0x3'),_0xddba('0x4'),'customVariable',_0xddba('0x5')),'defaultValue':_0xddba('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xddba('0x2')](_0xddba('0x3'),'variable',_0xddba('0x6'))},'keyContent':{'type':Sequelize[_0xddba('0x7')]},'idField':{'type':Sequelize[_0xddba('0x7')]},'nameField':{'type':Sequelize[_0xddba('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 432892a..b9b90d7 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 _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 +var _0x06ae=['query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','limit','set','apply','reject','update','then','destroy','sendStatus','error','name','send','map','VtigerField','rawAttributes','fieldName','type','key','model'];(function(_0x20b29c,_0xe22528){var _0x20d81b=function(_0xd63a71){while(--_0xd63a71){_0x20b29c['push'](_0x20b29c['shift']());}};_0x20d81b(++_0xe22528);}(_0x06ae,0x16e));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe06a('0x0'));var rimraf=require(_0xe06a('0x1'));var zipdir=require(_0xe06a('0x2'));var jsonpatch=require(_0xe06a('0x3'));var rp=require(_0xe06a('0x4'));var moment=require(_0xe06a('0x5'));var BPromise=require(_0xe06a('0x6'));var Mustache=require(_0xe06a('0x7'));var util=require(_0xe06a('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe06a('0x9'));var fs=require('fs');var _=require(_0xe06a('0xa'));var squel=require(_0xe06a('0xb'));var crypto=require(_0xe06a('0xc'));var jsforce=require(_0xe06a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe06a('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe06a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe06a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe06a('0x11'))(_0xe06a('0x12'));var utils=require('../../config/utils');var config=require(_0xe06a('0x13'));var licenseUtil=require(_0xe06a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb402c7,_0x87ff63){_0x87ff63=_0x87ff63||0xcc;return function(_0x3aaf53){if(_0x3aaf53){return _0xb402c7['sendStatus'](_0x87ff63);}return _0xb402c7[_0xe06a('0x15')](_0x87ff63)[_0xe06a('0x16')]();};}function respondWithResult(_0x359273,_0xf8a9a7){_0xf8a9a7=_0xf8a9a7||0xc8;return function(_0x335c0d){if(_0x335c0d){return _0x359273['status'](_0xf8a9a7)[_0xe06a('0x17')](_0x335c0d);}};}function respondWithFilteredResult(_0x1080da,_0x171b77){return function(_0xe471a9){if(_0xe471a9){var _0x4d0e41=_0xe471a9['count'],_0x403a92=_0x171b77['offset'],_0x57b590=_0x171b77['offset']+_0x171b77[_0xe06a('0x18')],_0xa9b1af;if(_0x57b590>=_0x4d0e41){_0x57b590=_0x4d0e41;_0xa9b1af=0xc8;}else{_0xa9b1af=0xce;}_0x1080da[_0xe06a('0x15')](_0xa9b1af);return _0x1080da[_0xe06a('0x19')]('Content-Range',_0x403a92+'-'+_0x57b590+'/'+_0x4d0e41)[_0xe06a('0x17')](_0xe471a9);}return null;};}function patchUpdates(_0x6483d4){return function(_0x5806b6){try{jsonpatch[_0xe06a('0x1a')](_0x5806b6,_0x6483d4,!![]);}catch(_0x5382a6){return BPromise[_0xe06a('0x1b')](_0x5382a6);}return _0x5806b6['save']();};}function saveUpdates(_0x550ff8,_0x70d702){return function(_0x99dcd5){if(_0x99dcd5){return _0x99dcd5[_0xe06a('0x1c')](_0x550ff8)[_0xe06a('0x1d')](function(_0xf8921e){return _0xf8921e;});}return null;};}function removeEntity(_0xd2adcd,_0x2ab25f){return function(_0x2c30c7){if(_0x2c30c7){return _0x2c30c7[_0xe06a('0x1e')]()[_0xe06a('0x1d')](function(){_0xd2adcd['status'](0xcc)[_0xe06a('0x16')]();});}};}function handleEntityNotFound(_0x31c2cb,_0xf13325){return function(_0x82ba72){if(!_0x82ba72){_0x31c2cb[_0xe06a('0x1f')](0x194);}return _0x82ba72;};}function handleError(_0x2c96bd,_0x3f468e){_0x3f468e=_0x3f468e||0x1f4;return function(_0x19a7e0){logger[_0xe06a('0x20')](_0x19a7e0['stack']);if(_0x19a7e0['name']){delete _0x19a7e0[_0xe06a('0x21')];}_0x2c96bd['status'](_0x3f468e)[_0xe06a('0x22')](_0x19a7e0);};}exports['index']=function(_0x4afa75,_0x5e0b56){var _0x37ff49={},_0x4316bb={},_0x58525a={'count':0x0,'rows':[]};var _0x217f24=_[_0xe06a('0x23')](db[_0xe06a('0x24')][_0xe06a('0x25')],function(_0x15cf61){return{'name':_0x15cf61[_0xe06a('0x26')],'type':_0x15cf61[_0xe06a('0x27')][_0xe06a('0x28')]};});_0x4316bb[_0xe06a('0x29')]=_['map'](_0x217f24,'name');_0x4316bb[_0xe06a('0x2a')]=_[_0xe06a('0x2b')](_0x4afa75[_0xe06a('0x2a')]);_0x4316bb[_0xe06a('0x2c')]=_['intersection'](_0x4316bb[_0xe06a('0x29')],_0x4316bb['query']);_0x37ff49[_0xe06a('0x2d')]=_[_0xe06a('0x2e')](_0x4316bb[_0xe06a('0x29')],qs[_0xe06a('0x2f')](_0x4afa75['query'][_0xe06a('0x2f')]));_0x37ff49[_0xe06a('0x2d')]=_0x37ff49[_0xe06a('0x2d')][_0xe06a('0x30')]?_0x37ff49['attributes']:_0x4316bb['model'];if(!_0x4afa75[_0xe06a('0x2a')][_0xe06a('0x31')](_0xe06a('0x32'))){_0x37ff49[_0xe06a('0x18')]=qs[_0xe06a('0x18')](_0x4afa75[_0xe06a('0x2a')]['limit']);_0x37ff49['offset']=qs[_0xe06a('0x33')](_0x4afa75['query'][_0xe06a('0x33')]);}_0x37ff49['order']=qs[_0xe06a('0x34')](_0x4afa75[_0xe06a('0x2a')][_0xe06a('0x34')]);_0x37ff49['where']=qs['filters'](_[_0xe06a('0x35')](_0x4afa75[_0xe06a('0x2a')],_0x4316bb[_0xe06a('0x2c')]),_0x217f24);if(_0x4afa75[_0xe06a('0x2a')][_0xe06a('0x36')]){_0x37ff49[_0xe06a('0x37')]=_['merge'](_0x37ff49['where'],{'$or':_['map'](_0x217f24,function(_0x598caf){if(_0x598caf[_0xe06a('0x27')]!==_0xe06a('0x38')){var _0x33499a={};_0x33499a[_0x598caf[_0xe06a('0x21')]]={'$like':'%'+_0x4afa75[_0xe06a('0x2a')]['filter']+'%'};return _0x33499a;}})});}_0x37ff49=_[_0xe06a('0x39')]({},_0x37ff49,_0x4afa75[_0xe06a('0x3a')]);var _0x9c0671={'where':_0x37ff49['where']};return db[_0xe06a('0x24')][_0xe06a('0x3b')](_0x9c0671)[_0xe06a('0x1d')](function(_0x27f6cb){_0x58525a[_0xe06a('0x3b')]=_0x27f6cb;if(_0x4afa75[_0xe06a('0x2a')][_0xe06a('0x3c')]){_0x37ff49[_0xe06a('0x3d')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x37ff49);})[_0xe06a('0x1d')](function(_0x5730f7){_0x58525a['rows']=_0x5730f7;return _0x58525a;})[_0xe06a('0x1d')](respondWithFilteredResult(_0x5e0b56,_0x37ff49))[_0xe06a('0x3e')](handleError(_0x5e0b56,null));};exports[_0xe06a('0x3f')]=function(_0x54da2b,_0x57c990){var _0x13ac63={'raw':!![],'where':{'id':_0x54da2b[_0xe06a('0x40')]['id']}},_0x353349={};_0x353349[_0xe06a('0x29')]=_['keys'](db[_0xe06a('0x24')]['rawAttributes']);_0x353349[_0xe06a('0x2a')]=_[_0xe06a('0x2b')](_0x54da2b['query']);_0x353349[_0xe06a('0x2c')]=_[_0xe06a('0x2e')](_0x353349['model'],_0x353349['query']);_0x13ac63['attributes']=_['intersection'](_0x353349[_0xe06a('0x29')],qs['fields'](_0x54da2b['query']['fields']));_0x13ac63['attributes']=_0x13ac63[_0xe06a('0x2d')][_0xe06a('0x30')]?_0x13ac63[_0xe06a('0x2d')]:_0x353349[_0xe06a('0x29')];if(_0x54da2b[_0xe06a('0x2a')][_0xe06a('0x3c')]){_0x13ac63['include']=[{'all':!![]}];}_0x13ac63=_[_0xe06a('0x39')]({},_0x13ac63,_0x54da2b[_0xe06a('0x3a')]);return db[_0xe06a('0x24')][_0xe06a('0x41')](_0x13ac63)[_0xe06a('0x1d')](handleEntityNotFound(_0x57c990,null))['then'](respondWithResult(_0x57c990,null))['catch'](handleError(_0x57c990,null));};exports[_0xe06a('0x42')]=function(_0x1030ba,_0x459faf){return db[_0xe06a('0x24')]['create'](_0x1030ba[_0xe06a('0x43')],{})[_0xe06a('0x1d')](respondWithResult(_0x459faf,0xc9))[_0xe06a('0x3e')](handleError(_0x459faf,null));};exports['update']=function(_0x590271,_0x5c533b){if(_0x590271[_0xe06a('0x43')]['id']){delete _0x590271[_0xe06a('0x43')]['id'];}return db[_0xe06a('0x24')][_0xe06a('0x41')]({'where':{'id':_0x590271['params']['id']}})[_0xe06a('0x1d')](handleEntityNotFound(_0x5c533b,null))[_0xe06a('0x1d')](saveUpdates(_0x590271[_0xe06a('0x43')],null))[_0xe06a('0x1d')](respondWithResult(_0x5c533b,null))[_0xe06a('0x3e')](handleError(_0x5c533b,null));};exports['destroy']=function(_0xa37eaa,_0x19ff97){return db[_0xe06a('0x24')][_0xe06a('0x41')]({'where':{'id':_0xa37eaa['params']['id']}})['then'](handleEntityNotFound(_0x19ff97,null))[_0xe06a('0x1d')](removeEntity(_0x19ff97,null))[_0xe06a('0x3e')](handleError(_0x19ff97,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index adf50ec..9096e28 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_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 +var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'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 aba7f86..47f3b8f 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 _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 +var _0xe6e4=['VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info'];(function(_0x384b7b,_0x5a54ef){var _0x414ce0=function(_0x516bff){while(--_0x516bff){_0x384b7b['push'](_0x384b7b['shift']());}};_0x414ce0(++_0x5a54ef);}(_0xe6e4,0xc1));var _0x4e6e=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0xe6e4[_0x454018];return _0x24697d;};'use strict';var _=require(_0x4e6e('0x0'));var util=require(_0x4e6e('0x1'));var moment=require(_0x4e6e('0x2'));var BPromise=require(_0x4e6e('0x3'));var rs=require(_0x4e6e('0x4'));var fs=require('fs');var Redis=require(_0x4e6e('0x5'));var db=require(_0x4e6e('0x6'))['db'];var utils=require(_0x4e6e('0x7'));var logger=require(_0x4e6e('0x8'))('rpc');var config=require(_0x4e6e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4e6e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x474042,_0x491cdc,_0x19d9e9){return new BPromise(function(_0x324547,_0x35523c){return client[_0x4e6e('0xb')](_0x474042,_0x19d9e9)[_0x4e6e('0xc')](function(_0x48ac3f){logger[_0x4e6e('0xd')](_0x4e6e('0xe'),_0x491cdc,_0x4e6e('0xf'));logger[_0x4e6e('0x10')](_0x4e6e('0x11'),_0x491cdc,'request\x20sent',JSON[_0x4e6e('0x12')](_0x48ac3f));if(_0x48ac3f[_0x4e6e('0x13')]){if(_0x48ac3f['error'][_0x4e6e('0x14')]===0x1f4){logger[_0x4e6e('0x13')](_0x4e6e('0xe'),_0x491cdc,_0x48ac3f[_0x4e6e('0x13')][_0x4e6e('0x15')]);return _0x35523c(_0x48ac3f[_0x4e6e('0x13')][_0x4e6e('0x15')]);}logger['error'](_0x4e6e('0xe'),_0x491cdc,_0x48ac3f[_0x4e6e('0x13')][_0x4e6e('0x15')]);return _0x324547(_0x48ac3f[_0x4e6e('0x13')][_0x4e6e('0x15')]);}else{logger[_0x4e6e('0xd')]('VtigerField,\x20%s,\x20%s',_0x491cdc,'request\x20sent');_0x324547(_0x48ac3f[_0x4e6e('0x16')][_0x4e6e('0x15')]);}})['catch'](function(_0x48a899){logger[_0x4e6e('0x13')](_0x4e6e('0xe'),_0x491cdc,_0x48a899);_0x35523c(_0x48a899);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 704161b..ed8bed9 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 _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 +var _0xc44d=['/:id/fields','getFields','create','post','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','get','/:id/configurations','getConfigurations'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc44d,0xc6));var _0xdc44=function(_0x1ba06b,_0x58a0d3){_0x1ba06b=_0x1ba06b-0x0;var _0x590a4e=_0xc44d[_0x1ba06b];return _0x590a4e;};'use strict';var multer=require(_0xdc44('0x0'));var util=require('util');var path=require(_0xdc44('0x1'));var timeout=require(_0xdc44('0x2'));var express=require(_0xdc44('0x3'));var router=express['Router']();var auth=require(_0xdc44('0x4'));var interaction=require(_0xdc44('0x5'));var config=require(_0xdc44('0x6'));var controller=require(_0xdc44('0x7'));router['get']('/',auth[_0xdc44('0x8')](),controller['index']);router[_0xdc44('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xdc44('0xa'),auth['isAuthenticated'](),controller[_0xdc44('0xb')]);router['get'](_0xdc44('0xc'),auth['isAuthenticated'](),controller[_0xdc44('0xd')]);router['post']('/',auth[_0xdc44('0x8')](),controller[_0xdc44('0xe')]);router[_0xdc44('0xf')](_0xdc44('0xa'),auth[_0xdc44('0x8')](),controller['addConfiguration']);router[_0xdc44('0x10')](_0xdc44('0x11'),auth[_0xdc44('0x8')](),controller['update']);router[_0xdc44('0x12')]('/:id',auth[_0xdc44('0x8')](),controller[_0xdc44('0x13')]);module[_0xdc44('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 965042f..b6450d3 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 _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 +var _0x703f=['username','password','token','integrationTab','sequelize','exports','STRING'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0x703f,0x1bd));var _0xf703=function(_0x9122f7,_0x5c3560){_0x9122f7=_0x9122f7-0x0;var _0x58af82=_0x703f[_0x9122f7];return _0x58af82;};'use strict';var Sequelize=require(_0xf703('0x0'));module[_0xf703('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf703('0x2')],'unique':_0xf703('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xf703('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0xf703('0x4'),_0xf703('0x5')),'defaultValue':_0xf703('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf703('0x6'),'newTab'),'defaultValue':_0xf703('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 109a8b9..7a59c49 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 _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 +var _0xe58a=['ZendeskConfiguration','ZendeskField','password','remoteUri','slice','substring','lastIndexOf','format','%s/%s','ticket_fields','authType','Basic\x20%s','%s:%s','username','token','headers','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','ZendeskAccount','rawAttributes','type','key','map','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','sort','where','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','include','find','create','body','getConfigurations','findOne','filters','order','pick','AccountId','Subjects','getSubjects','channel','Descriptions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe58a,0x9f));var _0xae58=function(_0x479688,_0x3279c1){_0x479688=_0x479688-0x0;var _0x79be1f=_0xe58a[_0x479688];return _0x79be1f;};'use strict';var pdf=require(_0xae58('0x0'));var emlformat=require(_0xae58('0x1'));var rimraf=require(_0xae58('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae58('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xae58('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xae58('0x5'));var sox=require('sox');var csv=require(_0xae58('0x6'));var ejs=require(_0xae58('0x7'));var fs=require('fs');var _=require(_0xae58('0x8'));var squel=require(_0xae58('0x9'));var crypto=require(_0xae58('0xa'));var jsforce=require(_0xae58('0xb'));var deskjs=require(_0xae58('0xc'));var toCsv=require(_0xae58('0x6'));var querystring=require(_0xae58('0xd'));var Papa=require(_0xae58('0xe'));var Redis=require('ioredis');var authService=require(_0xae58('0xf'));var qs=require(_0xae58('0x10'));var as=require(_0xae58('0x11'));var hardwareService=require(_0xae58('0x12'));var logger=require(_0xae58('0x13'))('api');var utils=require(_0xae58('0x14'));var config=require(_0xae58('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xae58('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xae58('0x17'));var client=jayson[_0xae58('0x18')][_0xae58('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1f84ec,_0x537715,_0x36ee75,_0x52503a){return new BPromise(function(_0x54f59c,_0x2aca09){var _0x26a637=_0x52503a||client;return _0x26a637[_0xae58('0x1a')](_0x1f84ec,_0x36ee75)[_0xae58('0x1b')](function(_0x4c57b9){logger[_0xae58('0x1c')](_0xae58('0x1d'),_0x537715,_0xae58('0x1e'));logger[_0xae58('0x1f')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x537715,'request\x20sent',JSON[_0xae58('0x20')](_0x4c57b9));if(_0x4c57b9[_0xae58('0x21')]){if(_0x4c57b9[_0xae58('0x21')][_0xae58('0x22')]===0x1f4){logger[_0xae58('0x21')]('ZendeskAccount,\x20%s,\x20%s',_0x537715,_0x4c57b9[_0xae58('0x21')][_0xae58('0x23')]);return _0x2aca09(_0x4c57b9[_0xae58('0x21')][_0xae58('0x23')]);}logger[_0xae58('0x21')](_0xae58('0x1d'),_0x537715,_0x4c57b9[_0xae58('0x21')][_0xae58('0x23')]);return _0x54f59c(_0x4c57b9[_0xae58('0x21')]['message']);}else{logger['info'](_0xae58('0x1d'),_0x537715,'request\x20sent');_0x54f59c(_0x4c57b9[_0xae58('0x24')]['message']);}})[_0xae58('0x25')](function(_0x2a1e1a){logger[_0xae58('0x21')](_0xae58('0x1d'),_0x537715,_0x2a1e1a);_0x2aca09(_0x2a1e1a);});});}function respondWithStatusCode(_0x41d2f2,_0x569f07){_0x569f07=_0x569f07||0xcc;return function(_0xb6b66b){if(_0xb6b66b){return _0x41d2f2[_0xae58('0x26')](_0x569f07);}return _0x41d2f2[_0xae58('0x27')](_0x569f07)[_0xae58('0x28')]();};}function respondWithResult(_0x557b6e,_0x2fdc7a){_0x2fdc7a=_0x2fdc7a||0xc8;return function(_0x567c8b){if(_0x567c8b){return _0x557b6e['status'](_0x2fdc7a)[_0xae58('0x29')](_0x567c8b);}};}function respondWithFilteredResult(_0x4e5bd5,_0x2c3876){return function(_0x51ceba){if(_0x51ceba){var _0x2d4a4d=_0x51ceba['count'],_0x39443e=_0x2c3876['offset'],_0x4474e8=_0x2c3876['offset']+_0x2c3876[_0xae58('0x2a')],_0x54c4ed;if(_0x4474e8>=_0x2d4a4d){_0x4474e8=_0x2d4a4d;_0x54c4ed=0xc8;}else{_0x54c4ed=0xce;}_0x4e5bd5['status'](_0x54c4ed);return _0x4e5bd5['set'](_0xae58('0x2b'),_0x39443e+'-'+_0x4474e8+'/'+_0x2d4a4d)[_0xae58('0x29')](_0x51ceba);}return null;};}function patchUpdates(_0xa1dcfe){return function(_0xcd1d7c){try{jsonpatch[_0xae58('0x2c')](_0xcd1d7c,_0xa1dcfe,!![]);}catch(_0x5eaea4){return BPromise[_0xae58('0x2d')](_0x5eaea4);}return _0xcd1d7c[_0xae58('0x2e')]();};}function saveUpdates(_0x2d1c86,_0x373df1){return function(_0x2ba351){if(_0x2ba351){return _0x2ba351[_0xae58('0x2f')](_0x2d1c86)[_0xae58('0x1b')](function(_0x42b252){return _0x42b252;});}return null;};}function removeEntity(_0x3c6a21,_0x296e46){return function(_0x2e67f5){if(_0x2e67f5){return _0x2e67f5[_0xae58('0x30')]()['then'](function(){_0x3c6a21[_0xae58('0x27')](0xcc)[_0xae58('0x28')]();});}};}function handleEntityNotFound(_0xdc554e,_0x21ab4d){return function(_0x16a1fd){if(!_0x16a1fd){_0xdc554e['sendStatus'](0x194);}return _0x16a1fd;};}function handleError(_0x3a49b6,_0x2160d2){_0x2160d2=_0x2160d2||0x1f4;return function(_0x59278e){logger[_0xae58('0x21')](_0x59278e[_0xae58('0x31')]);if(_0x59278e[_0xae58('0x32')]){delete _0x59278e[_0xae58('0x32')];}_0x3a49b6['status'](_0x2160d2)[_0xae58('0x33')](_0x59278e);};}exports['index']=function(_0xd5332b,_0xce2880){var _0x9b1f83={},_0x324158={},_0x487308={'count':0x0,'rows':[]};var _0x13c558=_['map'](db[_0xae58('0x34')][_0xae58('0x35')],function(_0x4c37ea){return{'name':_0x4c37ea['fieldName'],'type':_0x4c37ea[_0xae58('0x36')][_0xae58('0x37')]};});_0x324158['model']=_[_0xae58('0x38')](_0x13c558,_0xae58('0x32'));_0x324158[_0xae58('0x39')]=_[_0xae58('0x3a')](_0xd5332b[_0xae58('0x39')]);_0x324158['filters']=_[_0xae58('0x3b')](_0x324158['model'],_0x324158[_0xae58('0x39')]);_0x9b1f83[_0xae58('0x3c')]=_[_0xae58('0x3b')](_0x324158[_0xae58('0x3d')],qs[_0xae58('0x3e')](_0xd5332b[_0xae58('0x39')][_0xae58('0x3e')]));_0x9b1f83[_0xae58('0x3c')]=_0x9b1f83[_0xae58('0x3c')][_0xae58('0x3f')]?_0x9b1f83[_0xae58('0x3c')]:_0x324158[_0xae58('0x3d')];if(!_0xd5332b[_0xae58('0x39')][_0xae58('0x40')](_0xae58('0x41'))){_0x9b1f83[_0xae58('0x2a')]=qs[_0xae58('0x2a')](_0xd5332b[_0xae58('0x39')]['limit']);_0x9b1f83[_0xae58('0x42')]=qs['offset'](_0xd5332b[_0xae58('0x39')][_0xae58('0x42')]);}_0x9b1f83['order']=qs[_0xae58('0x43')](_0xd5332b[_0xae58('0x39')][_0xae58('0x43')]);_0x9b1f83[_0xae58('0x44')]=qs['filters'](_['pick'](_0xd5332b['query'],_0x324158['filters']),_0x13c558);if(_0xd5332b[_0xae58('0x39')][_0xae58('0x45')]){_0x9b1f83['where']=_[_0xae58('0x46')](_0x9b1f83['where'],{'$or':_[_0xae58('0x38')](_0x13c558,function(_0x95ffa7){if(_0x95ffa7[_0xae58('0x36')]!==_0xae58('0x47')){var _0x526162={};_0x526162[_0x95ffa7['name']]={'$like':'%'+_0xd5332b[_0xae58('0x39')]['filter']+'%'};return _0x526162;}})});}_0x9b1f83=_[_0xae58('0x46')]({},_0x9b1f83,_0xd5332b[_0xae58('0x48')]);var _0x4b93cd={'where':_0x9b1f83[_0xae58('0x44')]};return db[_0xae58('0x34')][_0xae58('0x49')](_0x4b93cd)[_0xae58('0x1b')](function(_0x23dd7d){_0x487308[_0xae58('0x49')]=_0x23dd7d;if(_0xd5332b[_0xae58('0x39')][_0xae58('0x4a')]){_0x9b1f83['include']=[{'all':!![]}];}return db[_0xae58('0x34')][_0xae58('0x4b')](_0x9b1f83);})[_0xae58('0x1b')](function(_0xb319b4){_0x487308[_0xae58('0x4c')]=_0xb319b4;return _0x487308;})[_0xae58('0x1b')](respondWithFilteredResult(_0xce2880,_0x9b1f83))[_0xae58('0x25')](handleError(_0xce2880,null));};exports[_0xae58('0x4d')]=function(_0x3a44e1,_0x368ad0){var _0x467dcf={'raw':![],'where':{'id':_0x3a44e1[_0xae58('0x4e')]['id']}},_0x20b030={};_0x20b030[_0xae58('0x3d')]=_[_0xae58('0x3a')](db['ZendeskAccount'][_0xae58('0x35')]);_0x20b030['query']=_[_0xae58('0x3a')](_0x3a44e1['query']);_0x20b030['filters']=_['intersection'](_0x20b030[_0xae58('0x3d')],_0x20b030[_0xae58('0x39')]);_0x467dcf['attributes']=_['intersection'](_0x20b030['model'],qs[_0xae58('0x3e')](_0x3a44e1[_0xae58('0x39')][_0xae58('0x3e')]));_0x467dcf[_0xae58('0x3c')]=_0x467dcf['attributes'][_0xae58('0x3f')]?_0x467dcf[_0xae58('0x3c')]:_0x20b030[_0xae58('0x3d')];if(_0x3a44e1[_0xae58('0x39')][_0xae58('0x4a')]){_0x467dcf[_0xae58('0x4f')]=[{'all':!![]}];}_0x467dcf=_[_0xae58('0x46')]({},_0x467dcf,_0x3a44e1[_0xae58('0x48')]);return db[_0xae58('0x34')][_0xae58('0x50')](_0x467dcf)[_0xae58('0x1b')](handleEntityNotFound(_0x368ad0,null))['then'](respondWithResult(_0x368ad0,null))[_0xae58('0x25')](handleError(_0x368ad0,null));};exports[_0xae58('0x51')]=function(_0x346089,_0x1c4baa){return db[_0xae58('0x34')][_0xae58('0x51')](_0x346089['body'],{})['then'](respondWithResult(_0x1c4baa,0xc9))[_0xae58('0x25')](handleError(_0x1c4baa,null));};exports[_0xae58('0x2f')]=function(_0x48e51a,_0x4fcc4f){if(_0x48e51a[_0xae58('0x52')]['id']){delete _0x48e51a['body']['id'];}return db[_0xae58('0x34')][_0xae58('0x50')]({'where':{'id':_0x48e51a['params']['id']}})[_0xae58('0x1b')](handleEntityNotFound(_0x4fcc4f,null))['then'](saveUpdates(_0x48e51a[_0xae58('0x52')],null))['then'](respondWithResult(_0x4fcc4f,null))[_0xae58('0x25')](handleError(_0x4fcc4f,null));};exports['destroy']=function(_0x1c89f8,_0xf2dbbe){return db[_0xae58('0x34')][_0xae58('0x50')]({'where':{'id':_0x1c89f8['params']['id']}})['then'](handleEntityNotFound(_0xf2dbbe,null))[_0xae58('0x1b')](removeEntity(_0xf2dbbe,null))[_0xae58('0x25')](handleError(_0xf2dbbe,null));};exports[_0xae58('0x53')]=function(_0x4f8e9c,_0x2feeaa,_0x166031){var _0x435887={};var _0x36f1ec={};var _0x24e9de;var _0x31d989;return db[_0xae58('0x34')][_0xae58('0x54')]({'where':{'id':_0x4f8e9c[_0xae58('0x4e')]['id']}})[_0xae58('0x1b')](handleEntityNotFound(_0x2feeaa,null))[_0xae58('0x1b')](function(_0xdee514){if(_0xdee514){_0x24e9de=_0xdee514;_0x36f1ec[_0xae58('0x3d')]=_[_0xae58('0x3a')](db['ZendeskConfiguration']['rawAttributes']);_0x36f1ec[_0xae58('0x39')]=_[_0xae58('0x3a')](_0x4f8e9c[_0xae58('0x39')]);_0x36f1ec[_0xae58('0x55')]=_['intersection'](_0x36f1ec[_0xae58('0x3d')],_0x36f1ec[_0xae58('0x39')]);_0x435887[_0xae58('0x3c')]=_[_0xae58('0x3b')](_0x36f1ec[_0xae58('0x3d')],qs[_0xae58('0x3e')](_0x4f8e9c[_0xae58('0x39')][_0xae58('0x3e')]));_0x435887[_0xae58('0x3c')]=_0x435887[_0xae58('0x3c')]['length']?_0x435887['attributes']:_0x36f1ec[_0xae58('0x3d')];_0x435887[_0xae58('0x56')]=qs[_0xae58('0x43')](_0x4f8e9c[_0xae58('0x39')][_0xae58('0x43')]);_0x435887[_0xae58('0x44')]=qs['filters'](_[_0xae58('0x57')](_0x4f8e9c[_0xae58('0x39')],_0x36f1ec[_0xae58('0x55')]));if(_0x4f8e9c[_0xae58('0x39')][_0xae58('0x45')]){_0x435887['where']=_[_0xae58('0x46')](_0x435887[_0xae58('0x44')],{'$or':_[_0xae58('0x38')](_0x435887[_0xae58('0x3c')],function(_0x4fb630){var _0x3261f6={};_0x3261f6[_0x4fb630]={'$like':'%'+_0x4f8e9c[_0xae58('0x39')]['filter']+'%'};return _0x3261f6;})});}_0x435887=_[_0xae58('0x46')]({},_0x435887,_0x4f8e9c['options']);return _0x24e9de[_0xae58('0x53')](_0x435887);}})[_0xae58('0x1b')](function(_0x33170e){if(_0x33170e){_0x31d989=_0x33170e[_0xae58('0x3f')];if(!_0x4f8e9c[_0xae58('0x39')][_0xae58('0x40')](_0xae58('0x41'))){_0x435887[_0xae58('0x2a')]=qs[_0xae58('0x2a')](_0x4f8e9c[_0xae58('0x39')]['limit']);_0x435887['offset']=qs[_0xae58('0x42')](_0x4f8e9c[_0xae58('0x39')][_0xae58('0x42')]);}return _0x24e9de['getConfigurations'](_0x435887);}})[_0xae58('0x1b')](function(_0x58887c){if(_0x58887c){return _0x58887c?{'count':_0x31d989,'rows':_0x58887c}:null;}})[_0xae58('0x1b')](respondWithResult(_0x2feeaa,null))[_0xae58('0x25')](handleError(_0x2feeaa,null));};exports['addConfiguration']=function(_0x5b8b3c,_0x56ba72,_0x1dc5cf){if(_0x5b8b3c[_0xae58('0x52')]['id']){delete _0x5b8b3c[_0xae58('0x52')]['id'];}return db[_0xae58('0x34')][_0xae58('0x54')]({'where':{'id':_0x5b8b3c[_0xae58('0x4e')]['id']}})[_0xae58('0x1b')](handleEntityNotFound(_0x56ba72,null))['then'](function(_0x3731fa){if(_0x3731fa){_0x5b8b3c[_0xae58('0x52')][_0xae58('0x58')]=_0x3731fa['id'];_0x5b8b3c[_0xae58('0x52')][_0xae58('0x59')]=integrations[_0xae58('0x5a')](_0x5b8b3c[_0xae58('0x52')][_0xae58('0x5b')],_0x5b8b3c[_0xae58('0x52')][_0xae58('0x36')]);_0x5b8b3c[_0xae58('0x52')][_0xae58('0x5c')]=integrations['getDescriptions'](_0x5b8b3c[_0xae58('0x52')]['channel'],_0x5b8b3c['body'][_0xae58('0x36')]);return db[_0xae58('0x5d')]['create'](_0x5b8b3c['body'],{'include':[{'model':db[_0xae58('0x5e')],'as':'Subjects'},{'model':db[_0xae58('0x5e')],'as':_0xae58('0x5c')}]});}return null;})[_0xae58('0x1b')](respondWithResult(_0x56ba72,null))[_0xae58('0x25')](handleError(_0x56ba72,null));};exports['getFields']=function(_0x5427b8,_0xec36cd,_0x4f4156){var _0x2d1be1='';return db[_0xae58('0x34')][_0xae58('0x54')]({'where':{'id':_0x5427b8[_0xae58('0x4e')]['id']},'attributes':['id','username',_0xae58('0x5f'),'token','authType',_0xae58('0x60')]})['then'](handleEntityNotFound(_0xec36cd,null))['then'](function(_0x11b204){if(_0x11b204){_0x2d1be1=_0x11b204[_0xae58('0x60')];var _0x285fb6=_0x2d1be1[_0xae58('0x61')](-0x1);if(_0x285fb6==='/'){_0x2d1be1=_0x2d1be1[_0xae58('0x62')](0x0,_0x2d1be1[_0xae58('0x63')](_0x285fb6));}var _0x1bb22a={'method':'GET','uri':util[_0xae58('0x64')](_0xae58('0x65'),_0x2d1be1,_0xae58('0x66')),'json':!![]};switch(_0x11b204[_0xae58('0x67')]){case _0xae58('0x5f'):_0x1bb22a['headers']={'Authorization':util[_0xae58('0x64')](_0xae58('0x68'),new Buffer(util[_0xae58('0x64')](_0xae58('0x69'),_0x11b204[_0xae58('0x6a')],_0x11b204[_0xae58('0x5f')]))['toString']('base64'))};break;case _0xae58('0x6b'):_0x1bb22a[_0xae58('0x6c')]={'Authorization':util[_0xae58('0x64')](_0xae58('0x68'),new Buffer(util[_0xae58('0x64')](_0xae58('0x6d'),_0x11b204[_0xae58('0x6a')],_0x11b204[_0xae58('0x6b')]))['toString']('base64'))};break;default:throw new db[(_0xae58('0x6e'))][(_0xae58('0x6f'))](_0xae58('0x70'));}return rp(_0x1bb22a);}})[_0xae58('0x1b')](function(_0x37d5d8){if(_0x37d5d8){var _0x3a28df=[_0xae58('0x71'),'description',_0xae58('0x72'),_0xae58('0x73')];_[_0xae58('0x74')](_0x37d5d8[_0xae58('0x66')],function(_0x4712ef){return _0x3a28df[_0xae58('0x75')](_0x4712ef[_0xae58('0x36')]);});return{'count':_0x37d5d8[_0xae58('0x66')]['length'],'rows':_[_0xae58('0x38')](_0x37d5d8[_0xae58('0x66')],function(_0x2bce32){return{'id':_0x2bce32['id'],'name':_0x2bce32[_0xae58('0x76')]>0x7?_0x2bce32[_0xae58('0x77')]:_0x2bce32[_0xae58('0x36')],'custom':_0x2bce32[_0xae58('0x76')]>0x7?!![]:![],'options':_0x2bce32['system_field_options']?_0x2bce32[_0xae58('0x78')]:_0x2bce32[_0xae58('0x79')]?_0x2bce32[_0xae58('0x79')]:[]};})};}})[_0xae58('0x1b')](respondWithResult(_0xec36cd,null))[_0xae58('0x25')](function(_0x4dbc3f){var _0xd9ac0a=_0x5427b8[_0xae58('0x39')][_0xae58('0x7a')]?0x1f4:_0x4dbc3f[_0xae58('0x7b')]||0x1f4;logger[_0xae58('0x21')](_0xae58('0x7c'),'getFields',_0xd9ac0a,JSON['stringify'](_0x4dbc3f));delete _0x4dbc3f[_0xae58('0x32')];if(_0xd9ac0a===0x191){_0xd9ac0a=0x190;}_0xec36cd[_0xae58('0x27')](_0xd9ac0a)[_0xae58('0x33')](_0x5427b8[_0xae58('0x39')][_0xae58('0x7a')]?{'message':_0xae58('0x7d'),'statusCode':_0x4dbc3f[_0xae58('0x7b')]}:_0x4dbc3f);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 1604517..380fff6 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 _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 +var _0xfd01=['../../components/integrations/configuration','define','int_zendesk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes'];(function(_0x294a0d,_0x4ccad7){var _0x49ce49=function(_0x1f4671){while(--_0x1f4671){_0x294a0d['push'](_0x294a0d['shift']());}};_0x49ce49(++_0x4ccad7);}(_0xfd01,0xab));var _0x1fd0=function(_0x16f91b,_0x42a22f){_0x16f91b=_0x16f91b-0x0;var _0x2f488f=_0xfd01[_0x16f91b];return _0x2f488f;};'use strict';var _=require(_0x1fd0('0x0'));var util=require(_0x1fd0('0x1'));var logger=require(_0x1fd0('0x2'))('api');var moment=require(_0x1fd0('0x3'));var BPromise=require(_0x1fd0('0x4'));var rp=require(_0x1fd0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1fd0('0x6'));var config=require(_0x1fd0('0x7'));var attributes=require(_0x1fd0('0x8'));var integrations=require(_0x1fd0('0x9'));module['exports']=function(_0x14660d,_0xa4a3f6){return _0x14660d[_0x1fd0('0xa')]('ZendeskAccount',attributes,{'tableName':_0x1fd0('0xb'),'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 1f75612..858bfc7 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(_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 +var _0x0713=['findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../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','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount'];(function(_0x30b64c,_0x2ff8fc){var _0x3b03c1=function(_0x5438b6){while(--_0x5438b6){_0x30b64c['push'](_0x30b64c['shift']());}};_0x3b03c1(++_0x2ff8fc);}(_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 moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetZendeskAccount',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowZendeskAccount',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index cb36fcf..f7c7f09 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 _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 +var _0x229b=['isAuthenticated','index','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x5cb00e,_0x4c9d16){var _0x13454d=function(_0x4ff920){while(--_0x4ff920){_0x5cb00e['push'](_0x5cb00e['shift']());}};_0x13454d(++_0x4c9d16);}(_0x229b,0xad));var _0xb229=function(_0x260736,_0x4cf70f){_0x260736=_0x260736-0x0;var _0xfc0af6=_0x229b[_0x260736];return _0xfc0af6;};'use strict';var multer=require(_0xb229('0x0'));var util=require(_0xb229('0x1'));var path=require(_0xb229('0x2'));var timeout=require('connect-timeout');var express=require(_0xb229('0x3'));var router=express[_0xb229('0x4')]();var auth=require(_0xb229('0x5'));var interaction=require(_0xb229('0x6'));var config=require(_0xb229('0x7'));var controller=require('./intZendeskConfiguration.controller');router[_0xb229('0x8')]('/',auth[_0xb229('0x9')](),controller[_0xb229('0xa')]);router[_0xb229('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb229('0xb')]);router[_0xb229('0x8')](_0xb229('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xb229('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xb229('0xd')]);router[_0xb229('0x8')](_0xb229('0xe'),auth[_0xb229('0x9')](),controller[_0xb229('0xf')]);router['get'](_0xb229('0x10'),auth[_0xb229('0x9')](),controller[_0xb229('0x11')]);router[_0xb229('0x12')]('/',auth[_0xb229('0x9')](),controller[_0xb229('0x13')]);router[_0xb229('0x12')](_0xb229('0x10'),auth['isAuthenticated'](),controller[_0xb229('0x14')]);router[_0xb229('0x15')]('/:id',auth[_0xb229('0x9')](),controller['update']);router[_0xb229('0x16')](_0xb229('0x17'),auth[_0xb229('0x9')](),controller[_0xb229('0x18')]);module[_0xb229('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 814227a..01d078b 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 _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 +var _0x32a5=['sequelize','exports','STRING'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x32a5,0x123));var _0x532a=function(_0x5dd412,_0x16a29e){_0x5dd412=_0x5dd412-0x0;var _0x1ce41a=_0x32a5[_0x5dd412];return _0x1ce41a;};'use strict';var Sequelize=require(_0x532a('0x0'));module[_0x532a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x532a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 05c846c..3ebf9ac 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 _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 +var _0xf501=['sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','stack','name','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','rows','show','params','keys','include','find','catch','create','body','update','destroy','getFields','findOne','ZendeskField','getSubjects','map','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path'];(function(_0xa6c203,_0x11d2d0){var _0x5aaf3f=function(_0x446617){while(--_0x446617){_0xa6c203['push'](_0xa6c203['shift']());}};_0x5aaf3f(++_0x11d2d0);}(_0xf501,0x1d6));var _0x1f50=function(_0xa53407,_0x5ccc27){_0xa53407=_0xa53407-0x0;var _0x312b22=_0xf501[_0xa53407];return _0x312b22;};'use strict';var pdf=require(_0x1f50('0x0'));var emlformat=require(_0x1f50('0x1'));var rimraf=require(_0x1f50('0x2'));var zipdir=require(_0x1f50('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f50('0x4'));var moment=require(_0x1f50('0x5'));var BPromise=require(_0x1f50('0x6'));var Mustache=require(_0x1f50('0x7'));var util=require(_0x1f50('0x8'));var path=require(_0x1f50('0x9'));var sox=require(_0x1f50('0xa'));var csv=require(_0x1f50('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1f50('0xc'));var squel=require('squel');var crypto=require(_0x1f50('0xd'));var jsforce=require(_0x1f50('0xe'));var deskjs=require(_0x1f50('0xf'));var toCsv=require(_0x1f50('0xb'));var querystring=require(_0x1f50('0x10'));var Papa=require(_0x1f50('0x11'));var Redis=require(_0x1f50('0x12'));var authService=require(_0x1f50('0x13'));var qs=require(_0x1f50('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f50('0x15'));var logger=require(_0x1f50('0x16'))(_0x1f50('0x17'));var utils=require('../../config/utils');var config=require(_0x1f50('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1f50('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1f50('0x1a')][_0x1f50('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1f070a,_0x3e533d,_0x2a6c67,_0x122b34){return new BPromise(function(_0x1e7976,_0x780d85){var _0x21e6f5=_0x122b34||client;return _0x21e6f5['request'](_0x1f070a,_0x2a6c67)[_0x1f50('0x1c')](function(_0x1aac60){logger[_0x1f50('0x1d')](_0x1f50('0x1e'),_0x3e533d,_0x1f50('0x1f'));logger[_0x1f50('0x20')](_0x1f50('0x21'),_0x3e533d,'request\x20sent',JSON[_0x1f50('0x22')](_0x1aac60));if(_0x1aac60[_0x1f50('0x23')]){if(_0x1aac60[_0x1f50('0x23')]['code']===0x1f4){logger['error'](_0x1f50('0x1e'),_0x3e533d,_0x1aac60[_0x1f50('0x23')]['message']);return _0x780d85(_0x1aac60[_0x1f50('0x23')][_0x1f50('0x24')]);}logger[_0x1f50('0x23')](_0x1f50('0x1e'),_0x3e533d,_0x1aac60[_0x1f50('0x23')][_0x1f50('0x24')]);return _0x1e7976(_0x1aac60[_0x1f50('0x23')][_0x1f50('0x24')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x3e533d,_0x1f50('0x1f'));_0x1e7976(_0x1aac60[_0x1f50('0x25')]['message']);}})['catch'](function(_0x4a06ef){logger[_0x1f50('0x23')](_0x1f50('0x1e'),_0x3e533d,_0x4a06ef);_0x780d85(_0x4a06ef);});});}function respondWithStatusCode(_0x818689,_0x17a415){_0x17a415=_0x17a415||0xcc;return function(_0x33d309){if(_0x33d309){return _0x818689[_0x1f50('0x26')](_0x17a415);}return _0x818689['status'](_0x17a415)[_0x1f50('0x27')]();};}function respondWithResult(_0x18a4d6,_0x37991b){_0x37991b=_0x37991b||0xc8;return function(_0x342778){if(_0x342778){return _0x18a4d6[_0x1f50('0x28')](_0x37991b)[_0x1f50('0x29')](_0x342778);}};}function respondWithFilteredResult(_0x877334,_0x402064){return function(_0x2b3f63){if(_0x2b3f63){var _0x5b40f8=_0x2b3f63[_0x1f50('0x2a')],_0x33dbc5=_0x402064[_0x1f50('0x2b')],_0x23c1ca=_0x402064[_0x1f50('0x2b')]+_0x402064[_0x1f50('0x2c')],_0x4145fa;if(_0x23c1ca>=_0x5b40f8){_0x23c1ca=_0x5b40f8;_0x4145fa=0xc8;}else{_0x4145fa=0xce;}_0x877334['status'](_0x4145fa);return _0x877334[_0x1f50('0x2d')](_0x1f50('0x2e'),_0x33dbc5+'-'+_0x23c1ca+'/'+_0x5b40f8)[_0x1f50('0x29')](_0x2b3f63);}return null;};}function patchUpdates(_0x9d17af){return function(_0xc29bae){try{jsonpatch[_0x1f50('0x2f')](_0xc29bae,_0x9d17af,!![]);}catch(_0x15aa5c){return BPromise[_0x1f50('0x30')](_0x15aa5c);}return _0xc29bae[_0x1f50('0x31')]();};}function saveUpdates(_0x38952d,_0x3314c5){return function(_0x479d81){if(_0x479d81){return _0x479d81['update'](_0x38952d)[_0x1f50('0x1c')](function(_0x4c80a2){return _0x4c80a2;});}return null;};}function removeEntity(_0x65a39f,_0x88e734){return function(_0x2b07c9){if(_0x2b07c9){return _0x2b07c9['destroy']()[_0x1f50('0x1c')](function(){_0x65a39f[_0x1f50('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ab1c9,_0x4ff6d5){return function(_0x2940c6){if(!_0x2940c6){_0x2ab1c9[_0x1f50('0x26')](0x194);}return _0x2940c6;};}function handleError(_0x5da12b,_0x178e82){_0x178e82=_0x178e82||0x1f4;return function(_0xcf4666){logger[_0x1f50('0x23')](_0xcf4666[_0x1f50('0x32')]);if(_0xcf4666['name']){delete _0xcf4666[_0x1f50('0x33')];}_0x5da12b[_0x1f50('0x28')](_0x178e82)['send'](_0xcf4666);};}exports['index']=function(_0x1d1eaa,_0x564eb4){var _0x42c0b4={},_0x57022d={},_0x482ff6={'count':0x0,'rows':[]};var _0x4d4e9b=_['map'](db[_0x1f50('0x34')][_0x1f50('0x35')],function(_0x3bb3b4){return{'name':_0x3bb3b4[_0x1f50('0x36')],'type':_0x3bb3b4[_0x1f50('0x37')][_0x1f50('0x38')]};});_0x57022d[_0x1f50('0x39')]=_['map'](_0x4d4e9b,_0x1f50('0x33'));_0x57022d['query']=_['keys'](_0x1d1eaa[_0x1f50('0x3a')]);_0x57022d['filters']=_[_0x1f50('0x3b')](_0x57022d[_0x1f50('0x39')],_0x57022d['query']);_0x42c0b4[_0x1f50('0x3c')]=_[_0x1f50('0x3b')](_0x57022d[_0x1f50('0x39')],qs[_0x1f50('0x3d')](_0x1d1eaa['query'][_0x1f50('0x3d')]));_0x42c0b4['attributes']=_0x42c0b4['attributes'][_0x1f50('0x3e')]?_0x42c0b4[_0x1f50('0x3c')]:_0x57022d[_0x1f50('0x39')];if(!_0x1d1eaa[_0x1f50('0x3a')][_0x1f50('0x3f')](_0x1f50('0x40'))){_0x42c0b4[_0x1f50('0x2c')]=qs[_0x1f50('0x2c')](_0x1d1eaa['query']['limit']);_0x42c0b4[_0x1f50('0x2b')]=qs[_0x1f50('0x2b')](_0x1d1eaa['query']['offset']);}_0x42c0b4[_0x1f50('0x41')]=qs[_0x1f50('0x42')](_0x1d1eaa[_0x1f50('0x3a')][_0x1f50('0x42')]);_0x42c0b4[_0x1f50('0x43')]=qs[_0x1f50('0x44')](_[_0x1f50('0x45')](_0x1d1eaa[_0x1f50('0x3a')],_0x57022d[_0x1f50('0x44')]),_0x4d4e9b);if(_0x1d1eaa['query'][_0x1f50('0x46')]){_0x42c0b4[_0x1f50('0x43')]=_['merge'](_0x42c0b4[_0x1f50('0x43')],{'$or':_['map'](_0x4d4e9b,function(_0x485ca8){if(_0x485ca8[_0x1f50('0x37')]!==_0x1f50('0x47')){var _0x4c62e7={};_0x4c62e7[_0x485ca8['name']]={'$like':'%'+_0x1d1eaa[_0x1f50('0x3a')][_0x1f50('0x46')]+'%'};return _0x4c62e7;}})});}_0x42c0b4=_[_0x1f50('0x48')]({},_0x42c0b4,_0x1d1eaa[_0x1f50('0x49')]);var _0x331af8={'where':_0x42c0b4[_0x1f50('0x43')]};return db[_0x1f50('0x34')]['count'](_0x331af8)[_0x1f50('0x1c')](function(_0x18fd47){_0x482ff6[_0x1f50('0x2a')]=_0x18fd47;if(_0x1d1eaa['query'][_0x1f50('0x4a')]){_0x42c0b4['include']=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x42c0b4);})[_0x1f50('0x1c')](function(_0x363af1){_0x482ff6[_0x1f50('0x4b')]=_0x363af1;return _0x482ff6;})[_0x1f50('0x1c')](respondWithFilteredResult(_0x564eb4,_0x42c0b4))['catch'](handleError(_0x564eb4,null));};exports[_0x1f50('0x4c')]=function(_0x4b8697,_0x5c7d8c){var _0x25cd8c={'raw':![],'where':{'id':_0x4b8697[_0x1f50('0x4d')]['id']}},_0x568a93={};_0x568a93['model']=_[_0x1f50('0x4e')](db['ZendeskConfiguration'][_0x1f50('0x35')]);_0x568a93[_0x1f50('0x3a')]=_[_0x1f50('0x4e')](_0x4b8697[_0x1f50('0x3a')]);_0x568a93[_0x1f50('0x44')]=_[_0x1f50('0x3b')](_0x568a93[_0x1f50('0x39')],_0x568a93['query']);_0x25cd8c[_0x1f50('0x3c')]=_[_0x1f50('0x3b')](_0x568a93[_0x1f50('0x39')],qs[_0x1f50('0x3d')](_0x4b8697[_0x1f50('0x3a')][_0x1f50('0x3d')]));_0x25cd8c[_0x1f50('0x3c')]=_0x25cd8c[_0x1f50('0x3c')][_0x1f50('0x3e')]?_0x25cd8c[_0x1f50('0x3c')]:_0x568a93[_0x1f50('0x39')];if(_0x4b8697[_0x1f50('0x3a')]['includeAll']){_0x25cd8c[_0x1f50('0x4f')]=[{'all':!![]}];}_0x25cd8c=_['merge']({},_0x25cd8c,_0x4b8697[_0x1f50('0x49')]);return db[_0x1f50('0x34')][_0x1f50('0x50')](_0x25cd8c)[_0x1f50('0x1c')](handleEntityNotFound(_0x5c7d8c,null))[_0x1f50('0x1c')](respondWithResult(_0x5c7d8c,null))[_0x1f50('0x51')](handleError(_0x5c7d8c,null));};exports[_0x1f50('0x52')]=function(_0x115384,_0x1c8e68){return db[_0x1f50('0x34')]['create'](_0x115384[_0x1f50('0x53')],{})[_0x1f50('0x1c')](respondWithResult(_0x1c8e68,0xc9))['catch'](handleError(_0x1c8e68,null));};exports[_0x1f50('0x54')]=function(_0x6f3f00,_0x46dbf8){if(_0x6f3f00[_0x1f50('0x53')]['id']){delete _0x6f3f00[_0x1f50('0x53')]['id'];}return db[_0x1f50('0x34')][_0x1f50('0x50')]({'where':{'id':_0x6f3f00[_0x1f50('0x4d')]['id']}})[_0x1f50('0x1c')](handleEntityNotFound(_0x46dbf8,null))[_0x1f50('0x1c')](saveUpdates(_0x6f3f00['body'],null))[_0x1f50('0x1c')](respondWithResult(_0x46dbf8,null))['catch'](handleError(_0x46dbf8,null));};exports[_0x1f50('0x55')]=function(_0x388983,_0x1ad207){return db[_0x1f50('0x34')][_0x1f50('0x50')]({'where':{'id':_0x388983[_0x1f50('0x4d')]['id']}})[_0x1f50('0x1c')](handleEntityNotFound(_0x1ad207,null))[_0x1f50('0x1c')](removeEntity(_0x1ad207,null))[_0x1f50('0x51')](handleError(_0x1ad207,null));};exports[_0x1f50('0x56')]=function(_0x25ba93,_0x431855,_0x3845f3){var _0x184fcd={};var _0x1463a2={};var _0x583fe6;var _0x56fa7c;return db[_0x1f50('0x34')][_0x1f50('0x57')]({'where':{'id':_0x25ba93[_0x1f50('0x4d')]['id']}})[_0x1f50('0x1c')](handleEntityNotFound(_0x431855,null))['then'](function(_0xebd442){if(_0xebd442){_0x583fe6=_0xebd442;_0x1463a2[_0x1f50('0x39')]=_[_0x1f50('0x4e')](db[_0x1f50('0x58')][_0x1f50('0x35')]);_0x1463a2['query']=_[_0x1f50('0x4e')](_0x25ba93['query']);_0x1463a2[_0x1f50('0x44')]=_[_0x1f50('0x3b')](_0x1463a2[_0x1f50('0x39')],_0x1463a2['query']);_0x184fcd['attributes']=_[_0x1f50('0x3b')](_0x1463a2['model'],qs[_0x1f50('0x3d')](_0x25ba93['query'][_0x1f50('0x3d')]));_0x184fcd[_0x1f50('0x3c')]=_0x184fcd[_0x1f50('0x3c')][_0x1f50('0x3e')]?_0x184fcd[_0x1f50('0x3c')]:_0x1463a2[_0x1f50('0x39')];_0x184fcd[_0x1f50('0x41')]=qs[_0x1f50('0x42')](_0x25ba93['query'][_0x1f50('0x42')]);_0x184fcd[_0x1f50('0x43')]=qs[_0x1f50('0x44')](_[_0x1f50('0x45')](_0x25ba93[_0x1f50('0x3a')],_0x1463a2[_0x1f50('0x44')]));if(_0x25ba93[_0x1f50('0x3a')][_0x1f50('0x46')]){_0x184fcd[_0x1f50('0x43')]=_[_0x1f50('0x48')](_0x184fcd[_0x1f50('0x43')],{'$or':_['map'](_0x184fcd[_0x1f50('0x3c')],function(_0x16fe69){var _0x216eed={};_0x216eed[_0x16fe69]={'$like':'%'+_0x25ba93[_0x1f50('0x3a')]['filter']+'%'};return _0x216eed;})});}_0x184fcd=_[_0x1f50('0x48')]({},_0x184fcd,_0x25ba93[_0x1f50('0x49')]);return _0x583fe6[_0x1f50('0x56')](_0x184fcd);}})[_0x1f50('0x1c')](function(_0x3ee60d){if(_0x3ee60d){_0x56fa7c=_0x3ee60d[_0x1f50('0x3e')];if(!_0x25ba93[_0x1f50('0x3a')][_0x1f50('0x3f')](_0x1f50('0x40'))){_0x184fcd[_0x1f50('0x2c')]=qs[_0x1f50('0x2c')](_0x25ba93[_0x1f50('0x3a')]['limit']);_0x184fcd[_0x1f50('0x2b')]=qs[_0x1f50('0x2b')](_0x25ba93['query']['offset']);}return _0x583fe6[_0x1f50('0x56')](_0x184fcd);}})['then'](function(_0x5e1ee5){if(_0x5e1ee5){return _0x5e1ee5?{'count':_0x56fa7c,'rows':_0x5e1ee5}:null;}})[_0x1f50('0x1c')](respondWithResult(_0x431855,null))[_0x1f50('0x51')](handleError(_0x431855,null));};exports[_0x1f50('0x59')]=function(_0x3b5ece,_0x3e966d,_0x5db784){var _0x76c768={};var _0x47a503={};var _0x1a4741;var _0x1a8238;return db[_0x1f50('0x34')][_0x1f50('0x57')]({'where':{'id':_0x3b5ece[_0x1f50('0x4d')]['id']}})[_0x1f50('0x1c')](handleEntityNotFound(_0x3e966d,null))[_0x1f50('0x1c')](function(_0x33d471){if(_0x33d471){_0x1a4741=_0x33d471;_0x47a503[_0x1f50('0x39')]=_['keys'](db[_0x1f50('0x58')][_0x1f50('0x35')]);_0x47a503[_0x1f50('0x3a')]=_[_0x1f50('0x4e')](_0x3b5ece[_0x1f50('0x3a')]);_0x47a503['filters']=_['intersection'](_0x47a503[_0x1f50('0x39')],_0x47a503[_0x1f50('0x3a')]);_0x76c768[_0x1f50('0x3c')]=_[_0x1f50('0x3b')](_0x47a503['model'],qs[_0x1f50('0x3d')](_0x3b5ece[_0x1f50('0x3a')][_0x1f50('0x3d')]));_0x76c768[_0x1f50('0x3c')]=_0x76c768[_0x1f50('0x3c')][_0x1f50('0x3e')]?_0x76c768[_0x1f50('0x3c')]:_0x47a503['model'];_0x76c768[_0x1f50('0x41')]=qs[_0x1f50('0x42')](_0x3b5ece[_0x1f50('0x3a')][_0x1f50('0x42')]);_0x76c768[_0x1f50('0x43')]=qs[_0x1f50('0x44')](_[_0x1f50('0x45')](_0x3b5ece[_0x1f50('0x3a')],_0x47a503[_0x1f50('0x44')]));if(_0x3b5ece[_0x1f50('0x3a')]['filter']){_0x76c768[_0x1f50('0x43')]=_['merge'](_0x76c768['where'],{'$or':_[_0x1f50('0x5a')](_0x76c768['attributes'],function(_0x291352){var _0x319de8={};_0x319de8[_0x291352]={'$like':'%'+_0x3b5ece['query'][_0x1f50('0x46')]+'%'};return _0x319de8;})});}_0x76c768=_[_0x1f50('0x48')]({},_0x76c768,_0x3b5ece['options']);return _0x1a4741[_0x1f50('0x59')](_0x76c768);}})[_0x1f50('0x1c')](function(_0x1504dd){if(_0x1504dd){_0x1a8238=_0x1504dd[_0x1f50('0x3e')];if(!_0x3b5ece[_0x1f50('0x3a')][_0x1f50('0x3f')](_0x1f50('0x40'))){_0x76c768[_0x1f50('0x2c')]=qs[_0x1f50('0x2c')](_0x3b5ece[_0x1f50('0x3a')][_0x1f50('0x2c')]);_0x76c768[_0x1f50('0x2b')]=qs[_0x1f50('0x2b')](_0x3b5ece[_0x1f50('0x3a')][_0x1f50('0x2b')]);}return _0x1a4741[_0x1f50('0x59')](_0x76c768);}})[_0x1f50('0x1c')](function(_0x40a03f){if(_0x40a03f){return _0x40a03f?{'count':_0x1a8238,'rows':_0x40a03f}:null;}})[_0x1f50('0x1c')](respondWithResult(_0x3e966d,null))[_0x1f50('0x51')](handleError(_0x3e966d,null));};exports[_0x1f50('0x5b')]=function(_0x2fb8ce,_0xfd9700,_0x19b2b5){var _0x4024ab={};var _0x1ea1fb={};var _0x52ce88;var _0x2c1f91;return db['ZendeskConfiguration'][_0x1f50('0x57')]({'where':{'id':_0x2fb8ce[_0x1f50('0x4d')]['id']}})[_0x1f50('0x1c')](handleEntityNotFound(_0xfd9700,null))[_0x1f50('0x1c')](function(_0x77bbe){if(_0x77bbe){_0x52ce88=_0x77bbe;_0x1ea1fb[_0x1f50('0x39')]=_['keys'](db['ZendeskField'][_0x1f50('0x35')]);_0x1ea1fb[_0x1f50('0x3a')]=_[_0x1f50('0x4e')](_0x2fb8ce[_0x1f50('0x3a')]);_0x1ea1fb[_0x1f50('0x44')]=_[_0x1f50('0x3b')](_0x1ea1fb['model'],_0x1ea1fb['query']);_0x4024ab[_0x1f50('0x3c')]=_[_0x1f50('0x3b')](_0x1ea1fb[_0x1f50('0x39')],qs['fields'](_0x2fb8ce['query'][_0x1f50('0x3d')]));_0x4024ab['attributes']=_0x4024ab[_0x1f50('0x3c')][_0x1f50('0x3e')]?_0x4024ab[_0x1f50('0x3c')]:_0x1ea1fb['model'];_0x4024ab[_0x1f50('0x41')]=qs[_0x1f50('0x42')](_0x2fb8ce[_0x1f50('0x3a')][_0x1f50('0x42')]);_0x4024ab[_0x1f50('0x43')]=qs[_0x1f50('0x44')](_['pick'](_0x2fb8ce[_0x1f50('0x3a')],_0x1ea1fb[_0x1f50('0x44')]));if(_0x2fb8ce['query']['filter']){_0x4024ab[_0x1f50('0x43')]=_[_0x1f50('0x48')](_0x4024ab['where'],{'$or':_['map'](_0x4024ab['attributes'],function(_0x1a34ed){var _0x4f6083={};_0x4f6083[_0x1a34ed]={'$like':'%'+_0x2fb8ce[_0x1f50('0x3a')][_0x1f50('0x46')]+'%'};return _0x4f6083;})});}_0x4024ab=_['merge']({},_0x4024ab,_0x2fb8ce[_0x1f50('0x49')]);return _0x52ce88[_0x1f50('0x5b')](_0x4024ab);}})['then'](function(_0x4946b5){if(_0x4946b5){_0x2c1f91=_0x4946b5[_0x1f50('0x3e')];if(!_0x2fb8ce[_0x1f50('0x3a')][_0x1f50('0x3f')](_0x1f50('0x40'))){_0x4024ab[_0x1f50('0x2c')]=qs[_0x1f50('0x2c')](_0x2fb8ce[_0x1f50('0x3a')]['limit']);_0x4024ab[_0x1f50('0x2b')]=qs['offset'](_0x2fb8ce[_0x1f50('0x3a')][_0x1f50('0x2b')]);}return _0x52ce88[_0x1f50('0x5b')](_0x4024ab);}})['then'](function(_0x1e8a48){if(_0x1e8a48){return _0x1e8a48?{'count':_0x2c1f91,'rows':_0x1e8a48}:null;}})[_0x1f50('0x1c')](respondWithResult(_0xfd9700,null))[_0x1f50('0x51')](handleError(_0xfd9700,null));};exports[_0x1f50('0x5c')]=function(_0x4efcb3,_0x297c3d,_0x1cc7d4){var _0x45dfb3={};var _0x47daf9={};var _0x35e025;var _0x2f560e;return db['ZendeskConfiguration'][_0x1f50('0x57')]({'where':{'id':_0x4efcb3[_0x1f50('0x4d')]['id']}})['then'](handleEntityNotFound(_0x297c3d,null))[_0x1f50('0x1c')](function(_0x18976f){if(_0x18976f){_0x35e025=_0x18976f;_0x47daf9[_0x1f50('0x39')]=_[_0x1f50('0x4e')](db[_0x1f50('0x5d')][_0x1f50('0x35')]);_0x47daf9[_0x1f50('0x3a')]=_['keys'](_0x4efcb3['query']);_0x47daf9[_0x1f50('0x44')]=_[_0x1f50('0x3b')](_0x47daf9[_0x1f50('0x39')],_0x47daf9[_0x1f50('0x3a')]);_0x45dfb3[_0x1f50('0x3c')]=_[_0x1f50('0x3b')](_0x47daf9['model'],qs['fields'](_0x4efcb3[_0x1f50('0x3a')][_0x1f50('0x3d')]));_0x45dfb3['attributes']=_0x45dfb3[_0x1f50('0x3c')]['length']?_0x45dfb3[_0x1f50('0x3c')]:_0x47daf9[_0x1f50('0x39')];_0x45dfb3[_0x1f50('0x41')]=qs['sort'](_0x4efcb3[_0x1f50('0x3a')][_0x1f50('0x42')]);_0x45dfb3[_0x1f50('0x43')]=qs['filters'](_['pick'](_0x4efcb3[_0x1f50('0x3a')],_0x47daf9[_0x1f50('0x44')]));if(_0x4efcb3[_0x1f50('0x3a')]['filter']){_0x45dfb3[_0x1f50('0x43')]=_[_0x1f50('0x48')](_0x45dfb3[_0x1f50('0x43')],{'$or':_[_0x1f50('0x5a')](_0x45dfb3[_0x1f50('0x3c')],function(_0x2307ae){var _0x2f1832={};_0x2f1832[_0x2307ae]={'$like':'%'+_0x4efcb3['query'][_0x1f50('0x46')]+'%'};return _0x2f1832;})});}_0x45dfb3=_[_0x1f50('0x48')]({},_0x45dfb3,_0x4efcb3[_0x1f50('0x49')]);return _0x35e025[_0x1f50('0x5c')](_0x45dfb3);}})['then'](function(_0x524105){if(_0x524105){_0x2f560e=_0x524105['length'];if(!_0x4efcb3[_0x1f50('0x3a')][_0x1f50('0x3f')](_0x1f50('0x40'))){_0x45dfb3['limit']=qs[_0x1f50('0x2c')](_0x4efcb3['query'][_0x1f50('0x2c')]);_0x45dfb3['offset']=qs[_0x1f50('0x2b')](_0x4efcb3[_0x1f50('0x3a')][_0x1f50('0x2b')]);}return _0x35e025[_0x1f50('0x5c')](_0x45dfb3);}})[_0x1f50('0x1c')](function(_0x34734d){if(_0x34734d){return _0x34734d?{'count':_0x2f560e,'rows':_0x34734d}:null;}})['then'](respondWithResult(_0x297c3d,null))[_0x1f50('0x51')](handleError(_0x297c3d,null));};exports[_0x1f50('0x5e')]=function(_0x1f4050,_0x19b157,_0x522c31){if(_0x1f4050['body']['id']){delete _0x1f4050['body']['id'];}return db[_0x1f50('0x34')][_0x1f50('0x57')]({'where':{'id':_0x1f4050['params']['id']}})[_0x1f50('0x1c')](handleEntityNotFound(_0x19b157,null))['then'](function(_0x2911ea){if(_0x2911ea){return _0x2911ea[_0x1f50('0x5e')](_0x1f4050['body'][_0x1f50('0x5f')]||[]);}return null;})[_0x1f50('0x1c')](respondWithResult(_0x19b157,null))['catch'](handleError(_0x19b157,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index ea5172c..ab137d6 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 _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 +var _0xe093=['path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash','api','moment','request-promise'];(function(_0x1e9db7,_0x19c432){var _0x219fb4=function(_0x259311){while(--_0x259311){_0x1e9db7['push'](_0x1e9db7['shift']());}};_0x219fb4(++_0x19c432);}(_0xe093,0x80));var _0x3e09=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xe093[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x3e09('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3e09('0x1'));var moment=require(_0x3e09('0x2'));var BPromise=require('bluebird');var rp=require(_0x3e09('0x3'));var fs=require('fs');var path=require(_0x3e09('0x4'));var rimraf=require(_0x3e09('0x5'));var config=require(_0x3e09('0x6'));var attributes=require(_0x3e09('0x7'));module[_0x3e09('0x8')]=function(_0x2d508d,_0x1e449d){return _0x2d508d[_0x3e09('0x9')](_0x3e09('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 e938c69..2d415a7 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 _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 +var _0x8a9c=['request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','http','request','info','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x1e2c67,_0x20db26){var _0x142720=function(_0x41e529){while(--_0x41e529){_0x1e2c67['push'](_0x1e2c67['shift']());}};_0x142720(++_0x20db26);}(_0x8a9c,0x16f));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8a9('0x0'));var util=require('util');var moment=require(_0xc8a9('0x1'));var BPromise=require(_0xc8a9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8a9('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc8a9('0x4'))(_0xc8a9('0x5'));var config=require(_0xc8a9('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc8a9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2db10e,_0x4ee6c1,_0x1a503f){return new BPromise(function(_0x39e0c2,_0x16f680){return client[_0xc8a9('0x8')](_0x2db10e,_0x1a503f)['then'](function(_0x4070d4){logger[_0xc8a9('0x9')](_0xc8a9('0xa'),_0x4ee6c1,_0xc8a9('0xb'));logger[_0xc8a9('0xc')](_0xc8a9('0xd'),_0x4ee6c1,'request\x20sent',JSON[_0xc8a9('0xe')](_0x4070d4));if(_0x4070d4['error']){if(_0x4070d4[_0xc8a9('0xf')][_0xc8a9('0x10')]===0x1f4){logger[_0xc8a9('0xf')](_0xc8a9('0xa'),_0x4ee6c1,_0x4070d4[_0xc8a9('0xf')]['message']);return _0x16f680(_0x4070d4[_0xc8a9('0xf')][_0xc8a9('0x11')]);}logger[_0xc8a9('0xf')](_0xc8a9('0xa'),_0x4ee6c1,_0x4070d4['error']['message']);return _0x39e0c2(_0x4070d4[_0xc8a9('0xf')][_0xc8a9('0x11')]);}else{logger['info'](_0xc8a9('0xa'),_0x4ee6c1,'request\x20sent');_0x39e0c2(_0x4070d4['result'][_0xc8a9('0x11')]);}})['catch'](function(_0x123230){logger[_0xc8a9('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4ee6c1,_0x123230);_0x16f680(_0x123230);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 5c89eb4..0d23174 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 _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 +var _0x28ff=['show','post','create','put','update','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated'];(function(_0x126b18,_0x383603){var _0xe166c2=function(_0xede5ea){while(--_0xede5ea){_0x126b18['push'](_0x126b18['shift']());}};_0xe166c2(++_0x383603);}(_0x28ff,0x138));var _0xf28f=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x28ff[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require(_0xf28f('0x0'));var path=require(_0xf28f('0x1'));var timeout=require(_0xf28f('0x2'));var express=require(_0xf28f('0x3'));var router=express[_0xf28f('0x4')]();var auth=require(_0xf28f('0x5'));var interaction=require(_0xf28f('0x6'));var config=require(_0xf28f('0x7'));var controller=require('./intZendeskField.controller');router[_0xf28f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf28f('0x8')](_0xf28f('0x9'),auth[_0xf28f('0xa')](),controller[_0xf28f('0xb')]);router[_0xf28f('0xc')]('/',auth[_0xf28f('0xa')](),controller[_0xf28f('0xd')]);router[_0xf28f('0xe')](_0xf28f('0x9'),auth[_0xf28f('0xa')](),controller[_0xf28f('0xf')]);router['delete']('/:id',auth[_0xf28f('0xa')](),controller[_0xf28f('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index d95a0f0..0abe0fe 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 _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 +var _0x83c8=['customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','string'];(function(_0x49f096,_0xfc45e){var _0x515854=function(_0x3ad888){while(--_0x3ad888){_0x49f096['push'](_0x49f096['shift']());}};_0x515854(++_0xfc45e);}(_0x83c8,0x8a));var _0x883c=function(_0x11c1a1,_0x17ba8c){_0x11c1a1=_0x11c1a1-0x0;var _0x483746=_0x83c8[_0x11c1a1];return _0x483746;};'use strict';var Sequelize=require(_0x883c('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x883c('0x1'),'variable',_0x883c('0x2'),_0x883c('0x3')),'defaultValue':_0x883c('0x1')},'content':{'type':Sequelize[_0x883c('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x883c('0x5'),_0x883c('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x883c('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index faa180c..500924e 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 _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 +var _0x0295=['error','name','send','ZendeskField','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','fields','length','find','create','body','update','html-pdf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','save','destroy','then'];(function(_0x574106,_0x3d8900){var _0x599274=function(_0x2e821c){while(--_0x2e821c){_0x574106['push'](_0x574106['shift']());}};_0x599274(++_0x3d8900);}(_0x0295,0x1f0));var _0x5029=function(_0x3cc8b9,_0x5c95f9){_0x3cc8b9=_0x3cc8b9-0x0;var _0x44d63f=_0x0295[_0x3cc8b9];return _0x44d63f;};'use strict';var pdf=require(_0x5029('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5029('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5029('0x2'));var BPromise=require(_0x5029('0x3'));var Mustache=require(_0x5029('0x4'));var util=require(_0x5029('0x5'));var path=require(_0x5029('0x6'));var sox=require(_0x5029('0x7'));var csv=require(_0x5029('0x8'));var ejs=require(_0x5029('0x9'));var fs=require('fs');var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=_0x10bf55[_0x5029('0x18')],_0x457c73=_0x317c20[_0x5029('0x19')],_0x353cba=_0x317c20['offset']+_0x317c20[_0x5029('0x1a')],_0x3786b5;if(_0x353cba>=_0x326923){_0x353cba=_0x326923;_0x3786b5=0xc8;}else{_0x3786b5=0xce;}_0xe278b7[_0x5029('0x16')](_0x3786b5);return _0xe278b7[_0x5029('0x1b')](_0x5029('0x1c'),_0x457c73+'-'+_0x353cba+'/'+_0x326923)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x5e115f){return function(_0xaba461){try{jsonpatch['apply'](_0xaba461,_0x5e115f,!![]);}catch(_0x226a5c){return BPromise['reject'](_0x226a5c);}return _0xaba461[_0x5029('0x1d')]();};}function saveUpdates(_0x8a414c,_0x2710aa){return function(_0x3cf0fb){if(_0x3cf0fb){return _0x3cf0fb['update'](_0x8a414c)['then'](function(_0x4c9184){return _0x4c9184;});}return null;};}function removeEntity(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1e')]()[_0x5029('0x1f')](function(){_0x4a49b6[_0x5029('0x16')](0xcc)[_0x5029('0x15')]();});}};}function handleEntityNotFound(_0x125c26,_0x356dac){return function(_0x3e857d){if(!_0x3e857d){_0x125c26['sendStatus'](0x194);}return _0x3e857d;};}function handleError(_0x564866,_0x49f347){_0x49f347=_0x49f347||0x1f4;return function(_0x588d90){logger[_0x5029('0x20')](_0x588d90['stack']);if(_0x588d90['name']){delete _0x588d90[_0x5029('0x21')];}_0x564866[_0x5029('0x16')](_0x49f347)[_0x5029('0x22')](_0x588d90);};}exports['index']=function(_0x2c501f,_0xb14bc){var _0x5e45c4={},_0x2b6d99={},_0x31f0a0={'count':0x0,'rows':[]};var _0x16ad8b=_['map'](db[_0x5029('0x23')][_0x5029('0x24')],function(_0xe5313e){return{'name':_0xe5313e['fieldName'],'type':_0xe5313e[_0x5029('0x25')][_0x5029('0x26')]};});_0x2b6d99['model']=_[_0x5029('0x27')](_0x16ad8b,_0x5029('0x21'));_0x2b6d99[_0x5029('0x28')]=_[_0x5029('0x29')](_0x2c501f[_0x5029('0x28')]);_0x2b6d99[_0x5029('0x2a')]=_[_0x5029('0x2b')](_0x2b6d99[_0x5029('0x2c')],_0x2b6d99[_0x5029('0x28')]);_0x5e45c4[_0x5029('0x2d')]=_[_0x5029('0x2b')](_0x2b6d99[_0x5029('0x2c')],qs['fields'](_0x2c501f[_0x5029('0x28')]['fields']));_0x5e45c4[_0x5029('0x2d')]=_0x5e45c4['attributes']['length']?_0x5e45c4[_0x5029('0x2d')]:_0x2b6d99[_0x5029('0x2c')];if(!_0x2c501f[_0x5029('0x28')]['hasOwnProperty'](_0x5029('0x2e'))){_0x5e45c4[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x2c501f[_0x5029('0x28')][_0x5029('0x1a')]);_0x5e45c4[_0x5029('0x19')]=qs[_0x5029('0x19')](_0x2c501f[_0x5029('0x28')][_0x5029('0x19')]);}_0x5e45c4['order']=qs[_0x5029('0x2f')](_0x2c501f[_0x5029('0x28')][_0x5029('0x2f')]);_0x5e45c4[_0x5029('0x30')]=qs['filters'](_[_0x5029('0x31')](_0x2c501f[_0x5029('0x28')],_0x2b6d99[_0x5029('0x2a')]),_0x16ad8b);if(_0x2c501f['query']['filter']){_0x5e45c4[_0x5029('0x30')]=_[_0x5029('0x32')](_0x5e45c4['where'],{'$or':_['map'](_0x16ad8b,function(_0x9656f2){if(_0x9656f2[_0x5029('0x25')]!==_0x5029('0x33')){var _0x3210cb={};_0x3210cb[_0x9656f2[_0x5029('0x21')]]={'$like':'%'+_0x2c501f[_0x5029('0x28')][_0x5029('0x34')]+'%'};return _0x3210cb;}})});}_0x5e45c4=_[_0x5029('0x32')]({},_0x5e45c4,_0x2c501f[_0x5029('0x35')]);var _0x3effa4={'where':_0x5e45c4[_0x5029('0x30')]};return db[_0x5029('0x23')][_0x5029('0x18')](_0x3effa4)[_0x5029('0x1f')](function(_0x5c547e){_0x31f0a0['count']=_0x5c547e;if(_0x2c501f[_0x5029('0x28')][_0x5029('0x36')]){_0x5e45c4[_0x5029('0x37')]=[{'all':!![]}];}return db['ZendeskField'][_0x5029('0x38')](_0x5e45c4);})[_0x5029('0x1f')](function(_0x52572a){_0x31f0a0[_0x5029('0x39')]=_0x52572a;return _0x31f0a0;})['then'](respondWithFilteredResult(_0xb14bc,_0x5e45c4))[_0x5029('0x3a')](handleError(_0xb14bc,null));};exports['show']=function(_0x2a6286,_0x359838){var _0x24a18d={'raw':!![],'where':{'id':_0x2a6286[_0x5029('0x3b')]['id']}},_0x78768={};_0x78768[_0x5029('0x2c')]=_[_0x5029('0x29')](db[_0x5029('0x23')][_0x5029('0x24')]);_0x78768['query']=_[_0x5029('0x29')](_0x2a6286[_0x5029('0x28')]);_0x78768[_0x5029('0x2a')]=_[_0x5029('0x2b')](_0x78768[_0x5029('0x2c')],_0x78768[_0x5029('0x28')]);_0x24a18d['attributes']=_[_0x5029('0x2b')](_0x78768[_0x5029('0x2c')],qs[_0x5029('0x3c')](_0x2a6286[_0x5029('0x28')][_0x5029('0x3c')]));_0x24a18d['attributes']=_0x24a18d[_0x5029('0x2d')][_0x5029('0x3d')]?_0x24a18d[_0x5029('0x2d')]:_0x78768[_0x5029('0x2c')];if(_0x2a6286[_0x5029('0x28')][_0x5029('0x36')]){_0x24a18d[_0x5029('0x37')]=[{'all':!![]}];}_0x24a18d=_[_0x5029('0x32')]({},_0x24a18d,_0x2a6286[_0x5029('0x35')]);return db['ZendeskField'][_0x5029('0x3e')](_0x24a18d)[_0x5029('0x1f')](handleEntityNotFound(_0x359838,null))[_0x5029('0x1f')](respondWithResult(_0x359838,null))[_0x5029('0x3a')](handleError(_0x359838,null));};exports['create']=function(_0x50d7c2,_0x17a515){return db[_0x5029('0x23')][_0x5029('0x3f')](_0x50d7c2[_0x5029('0x40')],{})[_0x5029('0x1f')](respondWithResult(_0x17a515,0xc9))[_0x5029('0x3a')](handleError(_0x17a515,null));};exports[_0x5029('0x41')]=function(_0x19a6ca,_0x1257a4){if(_0x19a6ca[_0x5029('0x40')]['id']){delete _0x19a6ca[_0x5029('0x40')]['id'];}return db[_0x5029('0x23')][_0x5029('0x3e')]({'where':{'id':_0x19a6ca[_0x5029('0x3b')]['id']}})[_0x5029('0x1f')](handleEntityNotFound(_0x1257a4,null))[_0x5029('0x1f')](saveUpdates(_0x19a6ca[_0x5029('0x40')],null))[_0x5029('0x1f')](respondWithResult(_0x1257a4,null))[_0x5029('0x3a')](handleError(_0x1257a4,null));};exports[_0x5029('0x1e')]=function(_0x1d0a38,_0x489457){return db[_0x5029('0x23')]['find']({'where':{'id':_0x1d0a38[_0x5029('0x3b')]['id']}})[_0x5029('0x1f')](handleEntityNotFound(_0x489457,null))['then'](removeEntity(_0x489457,null))['catch'](handleError(_0x489457,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 59fb335..5536843 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 _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 +var _0xf17f=['util','../../config/logger','moment','path','rimraf','../../config/environment','./intZendeskField.attributes','ZendeskField','int_zendesk_fields','idField','FieldId','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf17f,0x113));var _0xff17=function(_0x4d578c,_0x4d2ed2){_0x4d578c=_0x4d578c-0x0;var _0xf41cac=_0xf17f[_0x4d578c];return _0xf41cac;};'use strict';var _=require(_0xff17('0x0'));var util=require(_0xff17('0x1'));var logger=require(_0xff17('0x2'))('api');var moment=require(_0xff17('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xff17('0x4'));var rimraf=require(_0xff17('0x5'));var config=require(_0xff17('0x6'));var attributes=require(_0xff17('0x7'));module['exports']=function(_0x1d3d31,_0xb22fe2){return _0x1d3d31['define'](_0xff17('0x8'),attributes,{'tableName':_0xff17('0x9'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xff17('0xa'),_0xff17('0xb')],'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 392f8b3..59b7e4a 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 _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 +var _0xf617=['ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x4e723a,_0x5e9b46){var _0x25542c=function(_0x43f84c){while(--_0x43f84c){_0x4e723a['push'](_0x4e723a['shift']());}};_0x25542c(++_0x5e9b46);}(_0xf617,0x1e8));var _0x7f61=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf617[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7f61('0x0'));var util=require(_0x7f61('0x1'));var moment=require('moment');var BPromise=require(_0x7f61('0x2'));var rs=require(_0x7f61('0x3'));var fs=require('fs');var Redis=require(_0x7f61('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7f61('0x5'))('rpc');var config=require(_0x7f61('0x6'));var jayson=require(_0x7f61('0x7'));var client=jayson[_0x7f61('0x8')][_0x7f61('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40d6da,_0x156b44,_0x550a41){return new BPromise(function(_0xdc08e9,_0x1ca5ad){return client['request'](_0x40d6da,_0x550a41)[_0x7f61('0xa')](function(_0xdd2cd2){logger[_0x7f61('0xb')](_0x7f61('0xc'),_0x156b44,_0x7f61('0xd'));logger[_0x7f61('0xe')](_0x7f61('0xf'),_0x156b44,_0x7f61('0xd'),JSON['stringify'](_0xdd2cd2));if(_0xdd2cd2[_0x7f61('0x10')]){if(_0xdd2cd2['error'][_0x7f61('0x11')]===0x1f4){logger[_0x7f61('0x10')]('ZendeskField,\x20%s,\x20%s',_0x156b44,_0xdd2cd2[_0x7f61('0x10')]['message']);return _0x1ca5ad(_0xdd2cd2[_0x7f61('0x10')][_0x7f61('0x12')]);}logger[_0x7f61('0x10')]('ZendeskField,\x20%s,\x20%s',_0x156b44,_0xdd2cd2[_0x7f61('0x10')][_0x7f61('0x12')]);return _0xdc08e9(_0xdd2cd2[_0x7f61('0x10')]['message']);}else{logger['info'](_0x7f61('0xc'),_0x156b44,'request\x20sent');_0xdc08e9(_0xdd2cd2[_0x7f61('0x13')]['message']);}})['catch'](function(_0x53a744){logger[_0x7f61('0x10')](_0x7f61('0xc'),_0x156b44,_0x53a744);_0x1ca5ad(_0x53a744);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index c6abded..13da1bd 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(_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 +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(_0x5987d9,_0x56e3e4){var _0x573cc4=function(_0x48f0e8){while(--_0x48f0e8){_0x5987d9['push'](_0x5987d9['shift']());}};_0x573cc4(++_0x56e3e4);}(_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['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 09df5b6..7209e1c 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 _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 +var _0x016f=['sequelize','exports','STRING'];(function(_0x1284ec,_0x2dc1f9){var _0x18cca5=function(_0x32e73f){while(--_0x32e73f){_0x1284ec['push'](_0x1284ec['shift']());}};_0x18cca5(++_0x2dc1f9);}(_0x016f,0xc0));var _0xf016=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x016f[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0xf016('0x0'));module[_0xf016('0x1')]={'name':{'type':Sequelize[_0xf016('0x2')]},'description':{'type':Sequelize[_0xf016('0x2')]},'host':{'type':Sequelize[_0xf016('0x2')]},'zone':{'type':Sequelize[_0xf016('0x2')]},'clientId':{'type':Sequelize[_0xf016('0x2')]},'clientSecret':{'type':Sequelize[_0xf016('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xf016('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 681935c..a5a2c5a 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 _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 +var _0xb94c=['json','reject','update','destroy','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','where','merge','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','getConfigurations','filter','nolimit','findOne','AccountId','Subjects','getSubjects','Descriptions','channel','ZohoConfiguration','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','clientSecret','serverUrl','code','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','display_label','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','sendStatus','status','end','count','offset','set','Content-Range'];(function(_0x5f3905,_0x43a651){var _0x2923b1=function(_0x3c72d8){while(--_0x3c72d8){_0x5f3905['push'](_0x5f3905['shift']());}};_0x2923b1(++_0x43a651);}(_0xb94c,0x176));var _0xcb94=function(_0x4aca1b,_0x5741eb){_0x4aca1b=_0x4aca1b-0x0;var _0x6bdc98=_0xb94c[_0x4aca1b];return _0x6bdc98;};'use strict';var pdf=require(_0xcb94('0x0'));var emlformat=require(_0xcb94('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcb94('0x2'));var jsonpatch=require(_0xcb94('0x3'));var rp=require('request-promise');var moment=require(_0xcb94('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcb94('0x5'));var util=require(_0xcb94('0x6'));var path=require(_0xcb94('0x7'));var sox=require(_0xcb94('0x8'));var csv=require(_0xcb94('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcb94('0xa'));var squel=require(_0xcb94('0xb'));var crypto=require(_0xcb94('0xc'));var jsforce=require(_0xcb94('0xd'));var deskjs=require(_0xcb94('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcb94('0xf'));var Papa=require(_0xcb94('0x10'));var Redis=require(_0xcb94('0x11'));var authService=require(_0xcb94('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcb94('0x13'));var hardwareService=require(_0xcb94('0x14'));var logger=require(_0xcb94('0x15'))(_0xcb94('0x16'));var utils=require(_0xcb94('0x17'));var config=require(_0xcb94('0x18'));var licenseUtil=require(_0xcb94('0x19'));var db=require(_0xcb94('0x1a'))['db'];var integrations=require(_0xcb94('0x1b'));var jayson=require(_0xcb94('0x1c'));var client=jayson['client'][_0xcb94('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2c4e8e,_0x534271,_0x5c63c9,_0x481618){return new BPromise(function(_0x4bea1b,_0x167878){var _0x1e8d23=_0x481618||client;return _0x1e8d23[_0xcb94('0x1e')](_0x2c4e8e,_0x5c63c9)['then'](function(_0x27cd73){logger['info'](_0xcb94('0x1f'),_0x534271,_0xcb94('0x20'));logger[_0xcb94('0x21')](_0xcb94('0x22'),_0x534271,_0xcb94('0x20'),JSON['stringify'](_0x27cd73));if(_0x27cd73[_0xcb94('0x23')]){if(_0x27cd73['error']['code']===0x1f4){logger[_0xcb94('0x23')](_0xcb94('0x1f'),_0x534271,_0x27cd73[_0xcb94('0x23')][_0xcb94('0x24')]);return _0x167878(_0x27cd73[_0xcb94('0x23')][_0xcb94('0x24')]);}logger[_0xcb94('0x23')](_0xcb94('0x1f'),_0x534271,_0x27cd73[_0xcb94('0x23')][_0xcb94('0x24')]);return _0x4bea1b(_0x27cd73[_0xcb94('0x23')]['message']);}else{logger[_0xcb94('0x25')]('ZohoAccount,\x20%s,\x20%s',_0x534271,_0xcb94('0x20'));_0x4bea1b(_0x27cd73[_0xcb94('0x26')][_0xcb94('0x24')]);}})['catch'](function(_0x144711){logger[_0xcb94('0x23')](_0xcb94('0x1f'),_0x534271,_0x144711);_0x167878(_0x144711);});});}function respondWithStatusCode(_0x212ada,_0x494b01){_0x494b01=_0x494b01||0xcc;return function(_0x1fad6f){if(_0x1fad6f){return _0x212ada[_0xcb94('0x27')](_0x494b01);}return _0x212ada[_0xcb94('0x28')](_0x494b01)[_0xcb94('0x29')]();};}function respondWithResult(_0x58df93,_0x45a4f8){_0x45a4f8=_0x45a4f8||0xc8;return function(_0x2ff850){if(_0x2ff850){return _0x58df93[_0xcb94('0x28')](_0x45a4f8)['json'](_0x2ff850);}};}function respondWithFilteredResult(_0x4ecfa2,_0x24a06d){return function(_0x1f50d7){if(_0x1f50d7){var _0x4152fd=_0x1f50d7[_0xcb94('0x2a')],_0x165f7e=_0x24a06d[_0xcb94('0x2b')],_0x786768=_0x24a06d[_0xcb94('0x2b')]+_0x24a06d['limit'],_0x418be0;if(_0x786768>=_0x4152fd){_0x786768=_0x4152fd;_0x418be0=0xc8;}else{_0x418be0=0xce;}_0x4ecfa2[_0xcb94('0x28')](_0x418be0);return _0x4ecfa2[_0xcb94('0x2c')](_0xcb94('0x2d'),_0x165f7e+'-'+_0x786768+'/'+_0x4152fd)[_0xcb94('0x2e')](_0x1f50d7);}return null;};}function patchUpdates(_0x5c5be8){return function(_0xb25c24){try{jsonpatch['apply'](_0xb25c24,_0x5c5be8,!![]);}catch(_0x1c1c25){return BPromise[_0xcb94('0x2f')](_0x1c1c25);}return _0xb25c24['save']();};}function saveUpdates(_0x4bf816,_0x2f52f2){return function(_0xacb307){if(_0xacb307){return _0xacb307[_0xcb94('0x30')](_0x4bf816)['then'](function(_0x3b6c55){return _0x3b6c55;});}return null;};}function removeEntity(_0x960d93,_0x312b76){return function(_0x22b412){if(_0x22b412){return _0x22b412[_0xcb94('0x31')]()['then'](function(){_0x960d93[_0xcb94('0x28')](0xcc)[_0xcb94('0x29')]();});}};}function handleEntityNotFound(_0x777eee,_0x290ae0){return function(_0x2ce46e){if(!_0x2ce46e){_0x777eee[_0xcb94('0x27')](0x194);}return _0x2ce46e;};}function handleError(_0x3b3dcb,_0x5eeee7){_0x5eeee7=_0x5eeee7||0x1f4;return function(_0xfef3b4){logger[_0xcb94('0x23')](_0xfef3b4[_0xcb94('0x32')]);if(_0xfef3b4[_0xcb94('0x33')]){delete _0xfef3b4['name'];}_0x3b3dcb['status'](_0x5eeee7)[_0xcb94('0x34')](_0xfef3b4);};}exports[_0xcb94('0x35')]=function(_0x4e5083,_0x3ebb7b){var _0xd6e704={},_0x1a9927={},_0xb30e10={'count':0x0,'rows':[]};var _0x2af145=_[_0xcb94('0x36')](db[_0xcb94('0x37')][_0xcb94('0x38')],function(_0x5cf8a1){return{'name':_0x5cf8a1[_0xcb94('0x39')],'type':_0x5cf8a1[_0xcb94('0x3a')][_0xcb94('0x3b')]};});_0x1a9927[_0xcb94('0x3c')]=_['map'](_0x2af145,_0xcb94('0x33'));_0x1a9927[_0xcb94('0x3d')]=_['keys'](_0x4e5083['query']);_0x1a9927[_0xcb94('0x3e')]=_[_0xcb94('0x3f')](_0x1a9927[_0xcb94('0x3c')],_0x1a9927[_0xcb94('0x3d')]);_0xd6e704[_0xcb94('0x40')]=_[_0xcb94('0x3f')](_0x1a9927['model'],qs[_0xcb94('0x41')](_0x4e5083['query'][_0xcb94('0x41')]));_0xd6e704[_0xcb94('0x40')]=_0xd6e704[_0xcb94('0x40')][_0xcb94('0x42')]?_0xd6e704[_0xcb94('0x40')]:_0x1a9927[_0xcb94('0x3c')];if(!_0x4e5083[_0xcb94('0x3d')][_0xcb94('0x43')]('nolimit')){_0xd6e704[_0xcb94('0x44')]=qs[_0xcb94('0x44')](_0x4e5083[_0xcb94('0x3d')][_0xcb94('0x44')]);_0xd6e704[_0xcb94('0x2b')]=qs[_0xcb94('0x2b')](_0x4e5083[_0xcb94('0x3d')]['offset']);}_0xd6e704[_0xcb94('0x45')]=qs[_0xcb94('0x46')](_0x4e5083[_0xcb94('0x3d')]['sort']);_0xd6e704['where']=qs[_0xcb94('0x3e')](_[_0xcb94('0x47')](_0x4e5083[_0xcb94('0x3d')],_0x1a9927[_0xcb94('0x3e')]),_0x2af145);if(_0x4e5083[_0xcb94('0x3d')]['filter']){_0xd6e704[_0xcb94('0x48')]=_['merge'](_0xd6e704[_0xcb94('0x48')],{'$or':_[_0xcb94('0x36')](_0x2af145,function(_0x453822){if(_0x453822[_0xcb94('0x3a')]!=='VIRTUAL'){var _0x2e314c={};_0x2e314c[_0x453822['name']]={'$like':'%'+_0x4e5083['query']['filter']+'%'};return _0x2e314c;}})});}_0xd6e704=_[_0xcb94('0x49')]({},_0xd6e704,_0x4e5083['options']);var _0x2f1520={'where':_0xd6e704[_0xcb94('0x48')]};return db[_0xcb94('0x37')][_0xcb94('0x2a')](_0x2f1520)[_0xcb94('0x4a')](function(_0x430030){_0xb30e10[_0xcb94('0x2a')]=_0x430030;if(_0x4e5083[_0xcb94('0x3d')][_0xcb94('0x4b')]){_0xd6e704[_0xcb94('0x4c')]=[{'all':!![]}];}return db[_0xcb94('0x37')][_0xcb94('0x4d')](_0xd6e704);})[_0xcb94('0x4a')](function(_0x3d9024){_0xb30e10['rows']=_0x3d9024;return _0xb30e10;})['then'](respondWithFilteredResult(_0x3ebb7b,_0xd6e704))[_0xcb94('0x4e')](handleError(_0x3ebb7b,null));};exports[_0xcb94('0x4f')]=function(_0x34159c,_0x8018e6){var _0x3cbccc={'raw':![],'where':{'id':_0x34159c[_0xcb94('0x50')]['id']}},_0x110ceb={};_0x110ceb['model']=_['keys'](db[_0xcb94('0x37')][_0xcb94('0x38')]);_0x110ceb['query']=_[_0xcb94('0x51')](_0x34159c[_0xcb94('0x3d')]);_0x110ceb['filters']=_[_0xcb94('0x3f')](_0x110ceb['model'],_0x110ceb[_0xcb94('0x3d')]);_0x3cbccc[_0xcb94('0x40')]=_[_0xcb94('0x3f')](_0x110ceb['model'],qs[_0xcb94('0x41')](_0x34159c[_0xcb94('0x3d')][_0xcb94('0x41')]));_0x3cbccc[_0xcb94('0x40')]=_0x3cbccc['attributes'][_0xcb94('0x42')]?_0x3cbccc['attributes']:_0x110ceb[_0xcb94('0x3c')];if(_0x34159c[_0xcb94('0x3d')]['includeAll']){_0x3cbccc[_0xcb94('0x4c')]=[{'all':!![]}];}_0x3cbccc=_[_0xcb94('0x49')]({},_0x3cbccc,_0x34159c['options']);return db['ZohoAccount']['find'](_0x3cbccc)[_0xcb94('0x4a')](handleEntityNotFound(_0x8018e6,null))[_0xcb94('0x4a')](respondWithResult(_0x8018e6,null))[_0xcb94('0x4e')](handleError(_0x8018e6,null));};exports[_0xcb94('0x52')]=function(_0x42aed1,_0x272121){return db['ZohoAccount']['create'](_0x42aed1[_0xcb94('0x53')],{})[_0xcb94('0x4a')](respondWithResult(_0x272121,0xc9))['catch'](handleError(_0x272121,null));};exports['update']=function(_0x2cb0ee,_0x17c532){if(_0x2cb0ee[_0xcb94('0x53')]['id']){delete _0x2cb0ee[_0xcb94('0x53')]['id'];}return db['ZohoAccount'][_0xcb94('0x54')]({'where':{'id':_0x2cb0ee[_0xcb94('0x50')]['id']}})[_0xcb94('0x4a')](handleEntityNotFound(_0x17c532,null))[_0xcb94('0x4a')](saveUpdates(_0x2cb0ee['body'],null))[_0xcb94('0x4a')](respondWithResult(_0x17c532,null))[_0xcb94('0x4e')](handleError(_0x17c532,null));};exports[_0xcb94('0x31')]=function(_0x2d53a0,_0x14b200){return db[_0xcb94('0x37')]['find']({'where':{'id':_0x2d53a0['params']['id']}})[_0xcb94('0x4a')](handleEntityNotFound(_0x14b200,null))[_0xcb94('0x4a')](removeEntity(_0x14b200,null))[_0xcb94('0x4e')](handleError(_0x14b200,null));};exports[_0xcb94('0x55')]=function(_0x5f1274,_0x129094,_0x4b840c){var _0x523ede={};var _0x81a015={};var _0x279f7a;var _0x206970;return db[_0xcb94('0x37')]['findOne']({'where':{'id':_0x5f1274[_0xcb94('0x50')]['id']}})['then'](handleEntityNotFound(_0x129094,null))[_0xcb94('0x4a')](function(_0xdaf9a3){if(_0xdaf9a3){_0x279f7a=_0xdaf9a3;_0x81a015[_0xcb94('0x3c')]=_['keys'](db['ZohoConfiguration'][_0xcb94('0x38')]);_0x81a015[_0xcb94('0x3d')]=_[_0xcb94('0x51')](_0x5f1274['query']);_0x81a015[_0xcb94('0x3e')]=_[_0xcb94('0x3f')](_0x81a015[_0xcb94('0x3c')],_0x81a015['query']);_0x523ede[_0xcb94('0x40')]=_[_0xcb94('0x3f')](_0x81a015[_0xcb94('0x3c')],qs['fields'](_0x5f1274['query'][_0xcb94('0x41')]));_0x523ede[_0xcb94('0x40')]=_0x523ede['attributes'][_0xcb94('0x42')]?_0x523ede[_0xcb94('0x40')]:_0x81a015[_0xcb94('0x3c')];_0x523ede[_0xcb94('0x45')]=qs[_0xcb94('0x46')](_0x5f1274['query'][_0xcb94('0x46')]);_0x523ede[_0xcb94('0x48')]=qs[_0xcb94('0x3e')](_[_0xcb94('0x47')](_0x5f1274[_0xcb94('0x3d')],_0x81a015['filters']));if(_0x5f1274['query']['filter']){_0x523ede[_0xcb94('0x48')]=_[_0xcb94('0x49')](_0x523ede['where'],{'$or':_[_0xcb94('0x36')](_0x523ede[_0xcb94('0x40')],function(_0x561d5f){var _0x7c60be={};_0x7c60be[_0x561d5f]={'$like':'%'+_0x5f1274['query'][_0xcb94('0x56')]+'%'};return _0x7c60be;})});}_0x523ede=_['merge']({},_0x523ede,_0x5f1274['options']);return _0x279f7a[_0xcb94('0x55')](_0x523ede);}})['then'](function(_0x578f20){if(_0x578f20){_0x206970=_0x578f20[_0xcb94('0x42')];if(!_0x5f1274['query'][_0xcb94('0x43')](_0xcb94('0x57'))){_0x523ede[_0xcb94('0x44')]=qs['limit'](_0x5f1274['query'][_0xcb94('0x44')]);_0x523ede[_0xcb94('0x2b')]=qs[_0xcb94('0x2b')](_0x5f1274['query']['offset']);}return _0x279f7a[_0xcb94('0x55')](_0x523ede);}})['then'](function(_0x57b52d){if(_0x57b52d){return _0x57b52d?{'count':_0x206970,'rows':_0x57b52d}:null;}})[_0xcb94('0x4a')](respondWithResult(_0x129094,null))['catch'](handleError(_0x129094,null));};exports['addConfiguration']=function(_0xa55d1,_0x1921d6,_0x358f02){if(_0xa55d1[_0xcb94('0x53')]['id']){delete _0xa55d1['body']['id'];}return db['ZohoAccount'][_0xcb94('0x58')]({'where':{'id':_0xa55d1[_0xcb94('0x50')]['id']}})['then'](handleEntityNotFound(_0x1921d6,null))[_0xcb94('0x4a')](function(_0x4abf4e){if(_0x4abf4e){_0xa55d1[_0xcb94('0x53')][_0xcb94('0x59')]=_0x4abf4e['id'];_0xa55d1[_0xcb94('0x53')][_0xcb94('0x5a')]=integrations[_0xcb94('0x5b')](_0xa55d1['body']['channel'],_0xa55d1[_0xcb94('0x53')]['type']);_0xa55d1[_0xcb94('0x53')][_0xcb94('0x5c')]=integrations['getDescriptions'](_0xa55d1[_0xcb94('0x53')][_0xcb94('0x5d')],_0xa55d1['body'][_0xcb94('0x3a')]);return db[_0xcb94('0x5e')]['create'](_0xa55d1[_0xcb94('0x53')],{'include':[{'model':db[_0xcb94('0x5f')],'as':_0xcb94('0x5a')},{'model':db['ZohoField'],'as':_0xcb94('0x5c')}]});}return null;})[_0xcb94('0x4a')](respondWithResult(_0x1921d6,null))['catch'](handleError(_0x1921d6,null));};function getAccessToken(_0x2c80f5){return new Promise(function(_0x4d73ab,_0x21cb9a){var _0x46113c;switch(_0x2c80f5['zone']){case'US':_0x46113c=_0xcb94('0x60');break;case'AU':_0x46113c=_0xcb94('0x61');break;case'EU':_0x46113c='https://accounts.zoho.eu';break;case'IN':_0x46113c=_0xcb94('0x62');break;case'CN':_0x46113c=_0xcb94('0x63');break;default:_0x46113c='https://accounts.zoho.eu';break;}var _0x36a5fc={'method':'POST','uri':_0x46113c+_0xcb94('0x64'),'qs':{'refresh_token':_0x2c80f5[_0xcb94('0x65')],'client_id':_0x2c80f5['clientId'],'client_secret':_0x2c80f5['clientSecret'],'grant_type':_0xcb94('0x66')},'json':!![]};return rp(_0x36a5fc)[_0xcb94('0x4a')](function(_0x2328d1){if(_0x2328d1[_0xcb94('0x67')]){_0x4d73ab(_0x2328d1[_0xcb94('0x67')]);}else{_0x21cb9a(_0xcb94('0x68'));}})[_0xcb94('0x4e')](function(_0x354774){_0x21cb9a(_0x354774);});});}exports[_0xcb94('0x69')]=function(_0x3a78e3,_0x5063e7,_0x3a281d){var _0x3a8e65,_0x22a9d1,_0x38d956,_0x27513a,_0x538420;return db[_0xcb94('0x37')][_0xcb94('0x58')]({'where':{'id':_0x3a78e3['params']['id']},'attributes':['id',_0xcb94('0x6a'),_0xcb94('0x6b'),'clientId',_0xcb94('0x6c'),_0xcb94('0x6d'),_0xcb94('0x6e'),_0xcb94('0x65')]})['then'](handleEntityNotFound(_0x5063e7,null))[_0xcb94('0x4a')](function(_0x98ba7e){_0x538420=_0x98ba7e;_0x3a8e65=_0x538420['host'];_0x22a9d1=_0x3a8e65===_0xcb94('0x6f')?'eu':_0xcb94('0x70');_0x38d956=_0x538420['serverUrl'];var _0x4b350f=_0x38d956[_0xcb94('0x71')](-0x1);if(_0x4b350f==='/'||_0x4b350f==='\x5c'||_0x4b350f===':'){_0x38d956=_0x38d956['substring'](0x0,_0x38d956[_0xcb94('0x72')](_0x4b350f));}if(!_0x538420[_0xcb94('0x65')]){throw new Error(_0xcb94('0x73'));}return getAccessToken(_0x538420);})['then'](function(_0x94a248){if(_0x94a248){return rp({'method':_0xcb94('0x74'),'uri':util[_0xcb94('0x75')](_0xcb94('0x76'),_0x22a9d1),'qs':{'module':_0xcb94('0x77')},'headers':{'Authorization':_0xcb94('0x78')+_0x94a248},'json':!![]});}})[_0xcb94('0x4a')](function(_0x16fade){if(_0x16fade){if(_0x16fade[_0xcb94('0x79')]&&_0x16fade[_0xcb94('0x79')][_0xcb94('0x23')]){throw new Error(_0x16fade[_0xcb94('0x79')][_0xcb94('0x23')][_0xcb94('0x24')]);}var _0x529202=[];var _0x21de7e=[];var _0x4438f5=[_0xcb94('0x7a'),_0xcb94('0x7b'),_0xcb94('0x7c'),_0xcb94('0x7d'),_0xcb94('0x7e'),_0xcb94('0x7f'),_0xcb94('0x80'),_0xcb94('0x81')];_0x21de7e=_[_0xcb94('0x82')](_0x16fade[_0xcb94('0x41')],function(_0x379ab3){return _0x4438f5[_0xcb94('0x83')](_0x379ab3['api_name']);});for(var _0x324f01=0x0;_0x324f01<_0x21de7e['length'];_0x324f01++){if(_0x21de7e[_0x324f01]['system_mandatory']===![]){_0x529202['push']({'id':_0x21de7e[_0x324f01]['id'],'name':_0x21de7e[_0x324f01][_0xcb94('0x84')],'custom':_0x21de7e[_0x324f01]['custom_field'],'options':_0x21de7e[_0x324f01]['data_type']===_0xcb94('0x85')&&_0x21de7e[_0x324f01][_0xcb94('0x86')][_0xcb94('0x42')]>-0x1?_[_0xcb94('0x36')](_0x21de7e[_0x324f01][_0xcb94('0x86')],function(_0x152c24){return{'name':_0x152c24,'value':_0x152c24};}):[]});}}return{'count':_0x529202[_0xcb94('0x42')],'rows':_0x529202};}else{return{'count':0x0,'rows':[]};}})[_0xcb94('0x4a')](respondWithResult(_0x5063e7,null))[_0xcb94('0x4e')](function(_0x222f43){var _0x21d14d=_0x3a78e3['query']['test']?0x1f4:_0x222f43[_0xcb94('0x87')]||0x1f4;logger[_0xcb94('0x23')](_0xcb94('0x88'),'getFields',_0x21d14d,JSON[_0xcb94('0x89')](_0x222f43));delete _0x222f43[_0xcb94('0x33')];if(_0x21d14d===0x191){_0x21d14d=0x190;}_0x5063e7['status'](_0x21d14d)['send'](_0x3a78e3['query'][_0xcb94('0x8a')]?{'message':_0xcb94('0x8b'),'statusCode':_0x222f43[_0xcb94('0x87')]}:_0x222f43);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index d3c506c..ca93986 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 _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 +var _0x03b3=['catch','error','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','../../config/logger','moment','bluebird','path','rimraf','./intZohoAccount.attributes','define','int_zoho_accounts','changed','zone','clientId','clientSecret','host','serverUrl','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect'];(function(_0x38d405,_0x285127){var _0xb357f7=function(_0x391b95){while(--_0x391b95){_0x38d405['push'](_0x38d405['shift']());}};_0xb357f7(++_0x285127);}(_0x03b3,0x118));var _0x303b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03b3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x303b('0x0'));var util=require('util');var logger=require(_0x303b('0x1'))('api');var moment=require(_0x303b('0x2'));var BPromise=require(_0x303b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x303b('0x4'));var rimraf=require(_0x303b('0x5'));var config=require('../../config/environment');var attributes=require(_0x303b('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x12e499,_0x4e7bf1){return _0x12e499[_0x303b('0x7')]('ZohoAccount',attributes,{'tableName':_0x303b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x49ea3f,_0x4eb50b,_0x4a05d4){if(_0x49ea3f[_0x303b('0x9')](_0x303b('0xa'))||_0x49ea3f[_0x303b('0x9')]('serverUrl')||_0x49ea3f[_0x303b('0x9')](_0x303b('0xb'))||_0x49ea3f[_0x303b('0x9')](_0x303b('0xc'))||_0x49ea3f[_0x303b('0x9')]('code')||_0x49ea3f[_0x303b('0x9')](_0x303b('0xd'))){var _0xe3635f,_0x4bfa61;_0xe3635f=_0x49ea3f[_0x303b('0xe')];var _0x13504b=_0xe3635f[_0x303b('0xf')](-0x1);if(_0x13504b==='/'||_0x13504b==='\x5c'||_0x13504b===':'){_0xe3635f=_0xe3635f['substring'](0x0,_0xe3635f[_0x303b('0x10')](_0x13504b));}switch(_0x49ea3f[_0x303b('0xa')]){case'US':_0x4bfa61=_0x303b('0x11');break;case'AU':_0x4bfa61='https://accounts.zoho.com.au';break;case'IN':_0x4bfa61='https://accounts.zoho.in';break;case'CN':_0x4bfa61='https://accounts.zoho.com.cn';break;default:_0x4bfa61=_0x303b('0x12');break;}var _0x26812d={'method':'POST','uri':_0x4bfa61+_0x303b('0x13'),'form':{'grant_type':_0x303b('0x14'),'client_id':_0x49ea3f[_0x303b('0xb')],'client_secret':_0x49ea3f[_0x303b('0xc')],'redirect_uri':_0x49ea3f[_0x303b('0xe')],'code':_0x49ea3f[_0x303b('0x15')]},'headers':{'Content-Type':_0x303b('0x16')}};return rp(_0x26812d)[_0x303b('0x17')](function(_0x541ba5){var _0x2c1bba=JSON[_0x303b('0x18')](_0x541ba5);if(_0x2c1bba[_0x303b('0x19')]){_0x49ea3f[_0x303b('0x1a')]=_0x2c1bba[_0x303b('0x19')];logger[_0x303b('0x1b')](util[_0x303b('0x1c')](_0x303b('0x1d'),_0x49ea3f['name'],_0x49ea3f['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x49ea3f[_0x303b('0x1e')],_0x49ea3f['id']),util[_0x303b('0x1f')](_0x2c1bba,{'showHidden':![],'depth':null}));}return _0x4a05d4(null,_0x4eb50b);})[_0x303b('0x20')](function(_0x5bd050){logger[_0x303b('0x21')](util[_0x303b('0x1c')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x49ea3f['name'],_0x49ea3f['id']),util[_0x303b('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x4a05d4(_0x5bd050);});}else{return _0x4a05d4(null,_0x4eb50b);}},'beforeUpdate':function(_0x438935,_0x40add7,_0x2e06b1){if(_0x438935[_0x303b('0x9')](_0x303b('0xa'))||_0x438935[_0x303b('0x9')](_0x303b('0xe'))||_0x438935[_0x303b('0x9')]('clientId')||_0x438935[_0x303b('0x9')]('clientSecret')||_0x438935[_0x303b('0x9')](_0x303b('0x15'))||_0x438935[_0x303b('0x9')](_0x303b('0xd'))){var _0x1a6e38,_0x5acfd2;_0x1a6e38=_0x438935[_0x303b('0xe')];var _0x34e00f=_0x1a6e38[_0x303b('0xf')](-0x1);if(_0x34e00f==='/'||_0x34e00f==='\x5c'||_0x34e00f===':'){_0x1a6e38=_0x1a6e38['substring'](0x0,_0x1a6e38['lastIndexOf'](_0x34e00f));}switch(_0x438935[_0x303b('0xa')]){case'US':_0x5acfd2=_0x303b('0x11');break;case'AU':_0x5acfd2=_0x303b('0x22');break;case'IN':_0x5acfd2=_0x303b('0x23');break;case'CN':_0x5acfd2=_0x303b('0x24');break;default:_0x5acfd2='https://accounts.zoho.eu';break;}var _0x353f15={'method':_0x303b('0x25'),'uri':_0x5acfd2+_0x303b('0x13'),'form':{'grant_type':'authorization_code','client_id':_0x438935[_0x303b('0xb')],'client_secret':_0x438935['clientSecret'],'redirect_uri':_0x438935[_0x303b('0xe')],'code':_0x438935[_0x303b('0x15')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x353f15)[_0x303b('0x17')](function(_0x4daa20){var _0x1af595=JSON[_0x303b('0x18')](_0x4daa20);if(_0x1af595[_0x303b('0x19')]){_0x438935[_0x303b('0x1a')]=_0x1af595[_0x303b('0x19')];logger[_0x303b('0x1b')](util[_0x303b('0x1c')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x438935[_0x303b('0x1e')],_0x438935['id']));}else{logger['error'](util['format'](_0x303b('0x26'),_0x438935[_0x303b('0x1e')],_0x438935['id']),util[_0x303b('0x1f')](_0x1af595,{'showHidden':![],'depth':null}));}return _0x2e06b1(null,_0x40add7);})['catch'](function(_0x21574c){logger['error'](util[_0x303b('0x1c')](_0x303b('0x26'),_0x438935['name'],_0x438935['id']),util[_0x303b('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x2e06b1(_0x21574c);});}else{return _0x2e06b1(null,_0x40add7);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 76da8de..1db5fc9 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 _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 +var _0x4cbd=['ZohoAccount,\x20%s,\x20%s','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','limit','include','map','model','stringify','ShowZohoAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x30c92a,_0x28c148){var _0x3fbc6d=function(_0x3e3079){while(--_0x3e3079){_0x30c92a['push'](_0x30c92a['shift']());}};_0x3fbc6d(++_0x28c148);}(_0x4cbd,0xa9));var _0xd4cb=function(_0xdc0397,_0x20d1f1){_0xdc0397=_0xdc0397-0x0;var _0x553d02=_0x4cbd[_0xdc0397];return _0x553d02;};'use strict';var _=require(_0xd4cb('0x0'));var util=require(_0xd4cb('0x1'));var moment=require(_0xd4cb('0x2'));var BPromise=require(_0xd4cb('0x3'));var rs=require(_0xd4cb('0x4'));var fs=require('fs');var Redis=require(_0xd4cb('0x5'));var db=require(_0xd4cb('0x6'))['db'];var utils=require(_0xd4cb('0x7'));var logger=require(_0xd4cb('0x8'))(_0xd4cb('0x9'));var config=require('../../config/environment');var jayson=require(_0xd4cb('0xa'));var client=jayson[_0xd4cb('0xb')][_0xd4cb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf84e6c,_0x22747d,_0x323bfa){return new BPromise(function(_0x29ab66,_0x127a13){return client[_0xd4cb('0xd')](_0xf84e6c,_0x323bfa)[_0xd4cb('0xe')](function(_0x14fba9){logger[_0xd4cb('0xf')](_0xd4cb('0x10'),_0x22747d,'request\x20sent');logger['debug'](_0xd4cb('0x11'),_0x22747d,_0xd4cb('0x12'),JSON['stringify'](_0x14fba9));if(_0x14fba9[_0xd4cb('0x13')]){if(_0x14fba9['error'][_0xd4cb('0x14')]===0x1f4){logger[_0xd4cb('0x13')](_0xd4cb('0x10'),_0x22747d,_0x14fba9[_0xd4cb('0x13')][_0xd4cb('0x15')]);return _0x127a13(_0x14fba9[_0xd4cb('0x13')][_0xd4cb('0x15')]);}logger[_0xd4cb('0x13')](_0xd4cb('0x10'),_0x22747d,_0x14fba9['error']['message']);return _0x29ab66(_0x14fba9[_0xd4cb('0x13')]['message']);}else{logger[_0xd4cb('0xf')](_0xd4cb('0x10'),_0x22747d,_0xd4cb('0x12'));_0x29ab66(_0x14fba9['result'][_0xd4cb('0x15')]);}})[_0xd4cb('0x16')](function(_0x200cb9){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x22747d,_0x200cb9);_0x127a13(_0x200cb9);});});}exports[_0xd4cb('0x17')]=function(_0x1a7ca3){var _0x109880=this;return new Promise(function(_0x3c2d65,_0x2eb10d){return db[_0xd4cb('0x18')][_0xd4cb('0x19')]({'raw':_0x1a7ca3[_0xd4cb('0x1a')]?_0x1a7ca3[_0xd4cb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1a7ca3[_0xd4cb('0x1a')]?_0x1a7ca3[_0xd4cb('0x1a')][_0xd4cb('0x1b')]||null:null,'attributes':_0x1a7ca3[_0xd4cb('0x1a')]?_0x1a7ca3[_0xd4cb('0x1a')][_0xd4cb('0x1c')]||null:null,'limit':_0x1a7ca3[_0xd4cb('0x1a')]?_0x1a7ca3[_0xd4cb('0x1a')][_0xd4cb('0x1d')]||null:null,'include':_0x1a7ca3['options']?_0x1a7ca3[_0xd4cb('0x1a')][_0xd4cb('0x1e')]?_[_0xd4cb('0x1f')](_0x1a7ca3[_0xd4cb('0x1a')][_0xd4cb('0x1e')],function(_0x3fe3e5){return{'model':db[_0x3fe3e5[_0xd4cb('0x20')]],'as':_0x3fe3e5['as'],'attributes':_0x3fe3e5[_0xd4cb('0x1c')],'include':_0x3fe3e5[_0xd4cb('0x1e')]?_[_0xd4cb('0x1f')](_0x3fe3e5[_0xd4cb('0x1e')],function(_0x2942c3){return{'model':db[_0x2942c3[_0xd4cb('0x20')]],'as':_0x2942c3['as'],'attributes':_0x2942c3[_0xd4cb('0x1c')],'include':_0x2942c3['include']?_[_0xd4cb('0x1f')](_0x2942c3['include'],function(_0x1e21d2){return{'model':db[_0x1e21d2['model']],'as':_0x1e21d2['as'],'attributes':_0x1e21d2[_0xd4cb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd4cb('0xe')](function(_0x858271){logger[_0xd4cb('0xf')](_0xd4cb('0x17'),_0x1a7ca3);logger['debug'](_0xd4cb('0x17'),_0x1a7ca3,JSON[_0xd4cb('0x21')](_0x858271));_0x3c2d65(_0x858271);})[_0xd4cb('0x16')](function(_0x5b42cb){logger['error'](_0xd4cb('0x17'),_0x5b42cb[_0xd4cb('0x15')],_0x1a7ca3);_0x2eb10d(_0x109880[_0xd4cb('0x13')](0x1f4,_0x5b42cb['message']));});});};exports[_0xd4cb('0x22')]=function(_0x5ef103){var _0xc6fa26=this;return new Promise(function(_0x4cb7aa,_0x44c34a){return db['ZohoAccount'][_0xd4cb('0x23')]({'raw':_0x5ef103[_0xd4cb('0x1a')]?_0x5ef103[_0xd4cb('0x1a')][_0xd4cb('0x24')]===undefined?!![]:![]:!![],'where':_0x5ef103['options']?_0x5ef103[_0xd4cb('0x1a')][_0xd4cb('0x1b')]||null:null,'attributes':_0x5ef103[_0xd4cb('0x1a')]?_0x5ef103[_0xd4cb('0x1a')][_0xd4cb('0x1c')]||null:null,'include':_0x5ef103[_0xd4cb('0x1a')]?_0x5ef103[_0xd4cb('0x1a')][_0xd4cb('0x1e')]?_['map'](_0x5ef103[_0xd4cb('0x1a')][_0xd4cb('0x1e')],function(_0x58f59b){return{'model':db[_0x58f59b[_0xd4cb('0x20')]],'as':_0x58f59b['as'],'attributes':_0x58f59b['attributes'],'include':_0x58f59b['include']?_[_0xd4cb('0x1f')](_0x58f59b[_0xd4cb('0x1e')],function(_0xfd3983){return{'model':db[_0xfd3983[_0xd4cb('0x20')]],'as':_0xfd3983['as'],'attributes':_0xfd3983['attributes'],'include':_0xfd3983[_0xd4cb('0x1e')]?_[_0xd4cb('0x1f')](_0xfd3983['include'],function(_0x33ab4c){return{'model':db[_0x33ab4c[_0xd4cb('0x20')]],'as':_0x33ab4c['as'],'attributes':_0x33ab4c[_0xd4cb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd4cb('0xe')](function(_0x22e06e){logger[_0xd4cb('0xf')](_0xd4cb('0x22'),_0x5ef103);logger['debug']('ShowZohoAccount',_0x5ef103,JSON[_0xd4cb('0x21')](_0x22e06e));_0x4cb7aa(_0x22e06e);})[_0xd4cb('0x16')](function(_0xd3f12d){logger[_0xd4cb('0x13')](_0xd4cb('0x22'),_0xd3f12d[_0xd4cb('0x15')],_0x5ef103);_0x44c34a(_0xc6fa26[_0xd4cb('0x13')](0x1f4,_0xd3f12d[_0xd4cb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 56111cf..d4b0d90 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 _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 +var _0x91a7=['update','delete','destroy','util','path','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put'];(function(_0x324e14,_0x1d648b){var _0x1528cb=function(_0x4820c2){while(--_0x4820c2){_0x324e14['push'](_0x324e14['shift']());}};_0x1528cb(++_0x1d648b);}(_0x91a7,0xe7));var _0x791a=function(_0x1ca385,_0x168653){_0x1ca385=_0x1ca385-0x0;var _0x1ea84e=_0x91a7[_0x1ca385];return _0x1ea84e;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x791a('0x4'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0x791a('0x5')]('/',auth[_0x791a('0x6')](),controller['index']);router[_0x791a('0x5')]('/:id',auth[_0x791a('0x6')](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x6')](),controller[_0x791a('0x9')]);router[_0x791a('0x5')](_0x791a('0xa'),auth['isAuthenticated'](),controller[_0x791a('0xb')]);router[_0x791a('0x5')]('/:id/descriptions',auth[_0x791a('0x6')](),controller[_0x791a('0xc')]);router[_0x791a('0xd')]('/',auth[_0x791a('0x6')](),controller[_0x791a('0xe')]);router[_0x791a('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x791a('0x10')]);router[_0x791a('0x11')]('/:id',auth[_0x791a('0x6')](),controller[_0x791a('0x12')]);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 617fc02..90564aa 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 _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 +var _0xc2e6=['exports','STRING','ENUM','lead','contact','contact_lead','sequelize'];(function(_0x25d298,_0x456ccc){var _0x2a5700=function(_0x59689c){while(--_0x59689c){_0x25d298['push'](_0x25d298['shift']());}};_0x2a5700(++_0x456ccc);}(_0xc2e6,0xdf));var _0x6c2e=function(_0x18ba26,_0x4c142c){_0x18ba26=_0x18ba26-0x0;var _0x58ad0c=_0xc2e6[_0x18ba26];return _0x58ad0c;};'use strict';var Sequelize=require(_0x6c2e('0x0'));module[_0x6c2e('0x1')]={'name':{'type':Sequelize[_0x6c2e('0x2')]},'moduleCreate':{'type':Sequelize[_0x6c2e('0x3')](_0x6c2e('0x4'),_0x6c2e('0x5'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x6c2e('0x3')](_0x6c2e('0x6'),_0x6c2e('0x5'),_0x6c2e('0x4')),'defaultValue':_0x6c2e('0x6')},'description':{'type':Sequelize[_0x6c2e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 52ce4e9..02ab78c 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(_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 +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(_0x374ccf,_0xa945c4){var _0x443cde=function(_0x27ff10){while(--_0x27ff10){_0x374ccf['push'](_0x374ccf['shift']());}};_0x443cde(++_0xa945c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 8626f60..eeb5dc3 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 _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 +var _0xbf25=['api','moment','bluebird','request-promise','path','rimraf','exports','int_zoho_configurations','lodash','util','../../config/logger'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xbf25,0x17e));var _0x5bf2=function(_0x1e7d51,_0xc3c519){_0x1e7d51=_0x1e7d51-0x0;var _0x28d842=_0xbf25[_0x1e7d51];return _0x28d842;};'use strict';var _=require(_0x5bf2('0x0'));var util=require(_0x5bf2('0x1'));var logger=require(_0x5bf2('0x2'))(_0x5bf2('0x3'));var moment=require(_0x5bf2('0x4'));var BPromise=require(_0x5bf2('0x5'));var rp=require(_0x5bf2('0x6'));var fs=require('fs');var path=require(_0x5bf2('0x7'));var rimraf=require(_0x5bf2('0x8'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0x5bf2('0x9')]=function(_0x37f448,_0x597d17){return _0x37f448['define']('ZohoConfiguration',attributes,{'tableName':_0x5bf2('0xa'),'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 c439958..71d1595 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 _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 +var _0x453c=['client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4a69b2,_0x17fee7){var _0x32699d=function(_0x31f94a){while(--_0x31f94a){_0x4a69b2['push'](_0x4a69b2['shift']());}};_0x32699d(++_0x17fee7);}(_0x453c,0x15d));var _0xc453=function(_0x305c31,_0x466b17){_0x305c31=_0x305c31-0x0;var _0x17f39f=_0x453c[_0x305c31];return _0x17f39f;};'use strict';var _=require(_0xc453('0x0'));var util=require('util');var moment=require(_0xc453('0x1'));var BPromise=require('bluebird');var rs=require(_0xc453('0x2'));var fs=require('fs');var Redis=require(_0xc453('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc453('0x4'))(_0xc453('0x5'));var config=require(_0xc453('0x6'));var jayson=require(_0xc453('0x7'));var client=jayson[_0xc453('0x8')][_0xc453('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15cdda,_0x386d3f,_0x3a2492){return new BPromise(function(_0x2b36c2,_0x59b5de){return client['request'](_0x15cdda,_0x3a2492)[_0xc453('0xa')](function(_0xd1f15f){logger[_0xc453('0xb')](_0xc453('0xc'),_0x386d3f,_0xc453('0xd'));logger[_0xc453('0xe')](_0xc453('0xf'),_0x386d3f,_0xc453('0xd'),JSON[_0xc453('0x10')](_0xd1f15f));if(_0xd1f15f[_0xc453('0x11')]){if(_0xd1f15f[_0xc453('0x11')][_0xc453('0x12')]===0x1f4){logger['error'](_0xc453('0xc'),_0x386d3f,_0xd1f15f['error'][_0xc453('0x13')]);return _0x59b5de(_0xd1f15f[_0xc453('0x11')][_0xc453('0x13')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x386d3f,_0xd1f15f[_0xc453('0x11')][_0xc453('0x13')]);return _0x2b36c2(_0xd1f15f[_0xc453('0x11')][_0xc453('0x13')]);}else{logger['info'](_0xc453('0xc'),_0x386d3f,'request\x20sent');_0x2b36c2(_0xd1f15f['result']['message']);}})[_0xc453('0x14')](function(_0x1eba5c){logger[_0xc453('0x11')](_0xc453('0xc'),_0x386d3f,_0x1eba5c);_0x59b5de(_0x1eba5c);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index cfb31e7..6ce5e3c 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 _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 +var _0x5f2f=['create','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5ac1d5,_0x18cc79){_0x5ac1d5=_0x5ac1d5-0x0;var _0x528835=_0x5f2f[_0x5ac1d5];return _0x528835;};'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('./intZohoField.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xc')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xd')]);router['put'](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['delete'](_0xf5f2('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xf5f2('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 443d866..a4414ea 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 _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 +var _0x61a1=['ENUM','string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','exports'];(function(_0x54dbd0,_0x409d9c){var _0x4c3cd7=function(_0x5583c6){while(--_0x5583c6){_0x54dbd0['push'](_0x54dbd0['shift']());}};_0x4c3cd7(++_0x409d9c);}(_0x61a1,0x127));var _0x161a=function(_0x3598bb,_0x24befa){_0x3598bb=_0x3598bb-0x0;var _0x13c837=_0x61a1[_0x3598bb];return _0x13c837;};'use strict';var Sequelize=require(_0x161a('0x0'));module[_0x161a('0x1')]={'type':{'type':Sequelize[_0x161a('0x2')](_0x161a('0x3'),_0x161a('0x4'),'customVariable',_0x161a('0x5')),'defaultValue':_0x161a('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x161a('0x6')]},'keyType':{'type':Sequelize[_0x161a('0x2')](_0x161a('0x3'),_0x161a('0x4'),_0x161a('0x7'))},'keyContent':{'type':Sequelize[_0x161a('0x6')]},'idField':{'type':Sequelize[_0x161a('0x6')]},'nameField':{'type':Sequelize[_0x161a('0x6')]},'customField':{'type':Sequelize[_0x161a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x161a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 930548c..af476ca 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 _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 +var _0x12c6=['body','catch','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','destroy','then','stack','name','send','index','map','ZohoField','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','show','params','rawAttributes','include','find','create'];(function(_0x54c4f2,_0x2e40cb){var _0x29e671=function(_0x14effa){while(--_0x14effa){_0x54c4f2['push'](_0x54c4f2['shift']());}};_0x29e671(++_0x2e40cb);}(_0x12c6,0x112));var _0x612c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x12c6[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x612c('0x0'));var rimraf=require(_0x612c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x612c('0x2'));var rp=require(_0x612c('0x3'));var moment=require('moment');var BPromise=require(_0x612c('0x4'));var Mustache=require(_0x612c('0x5'));var util=require('util');var path=require('path');var sox=require(_0x612c('0x6'));var csv=require(_0x612c('0x7'));var ejs=require(_0x612c('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x612c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x612c('0xa'));var toCsv=require('to-csv');var querystring=require(_0x612c('0xb'));var Papa=require(_0x612c('0xc'));var Redis=require(_0x612c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x612c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x612c('0xf'));var logger=require(_0x612c('0x10'))(_0x612c('0x11'));var utils=require('../../config/utils');var config=require(_0x612c('0x12'));var licenseUtil=require(_0x612c('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x521fe6,_0x563034){_0x563034=_0x563034||0xcc;return function(_0x5ab7df){if(_0x5ab7df){return _0x521fe6[_0x612c('0x14')](_0x563034);}return _0x521fe6[_0x612c('0x15')](_0x563034)[_0x612c('0x16')]();};}function respondWithResult(_0x76231e,_0x604577){_0x604577=_0x604577||0xc8;return function(_0x5ec45a){if(_0x5ec45a){return _0x76231e[_0x612c('0x15')](_0x604577)[_0x612c('0x17')](_0x5ec45a);}};}function respondWithFilteredResult(_0x3c08be,_0x58d501){return function(_0x256109){if(_0x256109){var _0x2ac4eb=_0x256109['count'],_0x5caae7=_0x58d501['offset'],_0x1aaf3d=_0x58d501[_0x612c('0x18')]+_0x58d501[_0x612c('0x19')],_0x340628;if(_0x1aaf3d>=_0x2ac4eb){_0x1aaf3d=_0x2ac4eb;_0x340628=0xc8;}else{_0x340628=0xce;}_0x3c08be[_0x612c('0x15')](_0x340628);return _0x3c08be[_0x612c('0x1a')](_0x612c('0x1b'),_0x5caae7+'-'+_0x1aaf3d+'/'+_0x2ac4eb)[_0x612c('0x17')](_0x256109);}return null;};}function patchUpdates(_0x35f31b){return function(_0x360f8b){try{jsonpatch[_0x612c('0x1c')](_0x360f8b,_0x35f31b,!![]);}catch(_0x46b6f3){return BPromise['reject'](_0x46b6f3);}return _0x360f8b[_0x612c('0x1d')]();};}function saveUpdates(_0x4f75d2,_0x12fae5){return function(_0x5f2458){if(_0x5f2458){return _0x5f2458['update'](_0x4f75d2)['then'](function(_0x17f0da){return _0x17f0da;});}return null;};}function removeEntity(_0x90720b,_0x3762fb){return function(_0x5acfea){if(_0x5acfea){return _0x5acfea[_0x612c('0x1e')]()[_0x612c('0x1f')](function(){_0x90720b[_0x612c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x318e6a,_0x265f07){return function(_0x4c14d4){if(!_0x4c14d4){_0x318e6a[_0x612c('0x14')](0x194);}return _0x4c14d4;};}function handleError(_0x4a385d,_0x26372f){_0x26372f=_0x26372f||0x1f4;return function(_0x22e816){logger['error'](_0x22e816[_0x612c('0x20')]);if(_0x22e816[_0x612c('0x21')]){delete _0x22e816[_0x612c('0x21')];}_0x4a385d[_0x612c('0x15')](_0x26372f)[_0x612c('0x22')](_0x22e816);};}exports[_0x612c('0x23')]=function(_0x15ed8b,_0x55c3f7){var _0x5c4c4b={},_0x36fe87={},_0x2f8362={'count':0x0,'rows':[]};var _0x1e3d32=_[_0x612c('0x24')](db[_0x612c('0x25')]['rawAttributes'],function(_0x56532f){return{'name':_0x56532f['fieldName'],'type':_0x56532f[_0x612c('0x26')][_0x612c('0x27')]};});_0x36fe87[_0x612c('0x28')]=_[_0x612c('0x24')](_0x1e3d32,_0x612c('0x21'));_0x36fe87[_0x612c('0x29')]=_[_0x612c('0x2a')](_0x15ed8b[_0x612c('0x29')]);_0x36fe87[_0x612c('0x2b')]=_[_0x612c('0x2c')](_0x36fe87['model'],_0x36fe87['query']);_0x5c4c4b['attributes']=_['intersection'](_0x36fe87[_0x612c('0x28')],qs[_0x612c('0x2d')](_0x15ed8b[_0x612c('0x29')][_0x612c('0x2d')]));_0x5c4c4b[_0x612c('0x2e')]=_0x5c4c4b[_0x612c('0x2e')][_0x612c('0x2f')]?_0x5c4c4b[_0x612c('0x2e')]:_0x36fe87[_0x612c('0x28')];if(!_0x15ed8b['query'][_0x612c('0x30')](_0x612c('0x31'))){_0x5c4c4b[_0x612c('0x19')]=qs[_0x612c('0x19')](_0x15ed8b[_0x612c('0x29')][_0x612c('0x19')]);_0x5c4c4b[_0x612c('0x18')]=qs[_0x612c('0x18')](_0x15ed8b[_0x612c('0x29')][_0x612c('0x18')]);}_0x5c4c4b[_0x612c('0x32')]=qs[_0x612c('0x33')](_0x15ed8b[_0x612c('0x29')]['sort']);_0x5c4c4b[_0x612c('0x34')]=qs[_0x612c('0x2b')](_[_0x612c('0x35')](_0x15ed8b[_0x612c('0x29')],_0x36fe87[_0x612c('0x2b')]),_0x1e3d32);if(_0x15ed8b[_0x612c('0x29')][_0x612c('0x36')]){_0x5c4c4b[_0x612c('0x34')]=_[_0x612c('0x37')](_0x5c4c4b[_0x612c('0x34')],{'$or':_['map'](_0x1e3d32,function(_0x246da3){if(_0x246da3[_0x612c('0x26')]!=='VIRTUAL'){var _0x394da4={};_0x394da4[_0x246da3[_0x612c('0x21')]]={'$like':'%'+_0x15ed8b[_0x612c('0x29')]['filter']+'%'};return _0x394da4;}})});}_0x5c4c4b=_[_0x612c('0x37')]({},_0x5c4c4b,_0x15ed8b[_0x612c('0x38')]);var _0x4ae021={'where':_0x5c4c4b[_0x612c('0x34')]};return db[_0x612c('0x25')][_0x612c('0x39')](_0x4ae021)[_0x612c('0x1f')](function(_0x5a242c){_0x2f8362[_0x612c('0x39')]=_0x5a242c;if(_0x15ed8b[_0x612c('0x29')][_0x612c('0x3a')]){_0x5c4c4b['include']=[{'all':!![]}];}return db['ZohoField'][_0x612c('0x3b')](_0x5c4c4b);})[_0x612c('0x1f')](function(_0x5329f0){_0x2f8362['rows']=_0x5329f0;return _0x2f8362;})[_0x612c('0x1f')](respondWithFilteredResult(_0x55c3f7,_0x5c4c4b))['catch'](handleError(_0x55c3f7,null));};exports[_0x612c('0x3c')]=function(_0x303eea,_0x473960){var _0x32a03e={'raw':!![],'where':{'id':_0x303eea[_0x612c('0x3d')]['id']}},_0x462360={};_0x462360[_0x612c('0x28')]=_[_0x612c('0x2a')](db[_0x612c('0x25')][_0x612c('0x3e')]);_0x462360[_0x612c('0x29')]=_[_0x612c('0x2a')](_0x303eea[_0x612c('0x29')]);_0x462360[_0x612c('0x2b')]=_['intersection'](_0x462360[_0x612c('0x28')],_0x462360[_0x612c('0x29')]);_0x32a03e[_0x612c('0x2e')]=_[_0x612c('0x2c')](_0x462360[_0x612c('0x28')],qs[_0x612c('0x2d')](_0x303eea[_0x612c('0x29')]['fields']));_0x32a03e[_0x612c('0x2e')]=_0x32a03e[_0x612c('0x2e')]['length']?_0x32a03e[_0x612c('0x2e')]:_0x462360[_0x612c('0x28')];if(_0x303eea['query'][_0x612c('0x3a')]){_0x32a03e[_0x612c('0x3f')]=[{'all':!![]}];}_0x32a03e=_[_0x612c('0x37')]({},_0x32a03e,_0x303eea[_0x612c('0x38')]);return db[_0x612c('0x25')][_0x612c('0x40')](_0x32a03e)[_0x612c('0x1f')](handleEntityNotFound(_0x473960,null))['then'](respondWithResult(_0x473960,null))['catch'](handleError(_0x473960,null));};exports[_0x612c('0x41')]=function(_0x14cd0c,_0x3cf5e1){return db['ZohoField']['create'](_0x14cd0c['body'],{})[_0x612c('0x1f')](respondWithResult(_0x3cf5e1,0xc9))['catch'](handleError(_0x3cf5e1,null));};exports['update']=function(_0x44e955,_0x268ba0){if(_0x44e955['body']['id']){delete _0x44e955['body']['id'];}return db[_0x612c('0x25')][_0x612c('0x40')]({'where':{'id':_0x44e955[_0x612c('0x3d')]['id']}})[_0x612c('0x1f')](handleEntityNotFound(_0x268ba0,null))[_0x612c('0x1f')](saveUpdates(_0x44e955[_0x612c('0x42')],null))[_0x612c('0x1f')](respondWithResult(_0x268ba0,null))[_0x612c('0x43')](handleError(_0x268ba0,null));};exports[_0x612c('0x1e')]=function(_0x19263f,_0x3b10e8){return db[_0x612c('0x25')][_0x612c('0x40')]({'where':{'id':_0x19263f['params']['id']}})[_0x612c('0x1f')](handleEntityNotFound(_0x3b10e8,null))[_0x612c('0x1f')](removeEntity(_0x3b10e8,null))[_0x612c('0x43')](handleError(_0x3b10e8,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 57ed0f8..ec5935c 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 _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 +var _0x8f97=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','util','../../config/logger'];(function(_0x387f41,_0x3e868c){var _0x1a45aa=function(_0x2b1b50){while(--_0x2b1b50){_0x387f41['push'](_0x387f41['shift']());}};_0x1a45aa(++_0x3e868c);}(_0x8f97,0x195));var _0x78f9=function(_0x185f00,_0x1f9754){_0x185f00=_0x185f00-0x0;var _0x2ef08e=_0x8f97[_0x185f00];return _0x2ef08e;};'use strict';var _=require(_0x78f9('0x0'));var util=require(_0x78f9('0x1'));var logger=require(_0x78f9('0x2'))(_0x78f9('0x3'));var moment=require(_0x78f9('0x4'));var BPromise=require(_0x78f9('0x5'));var rp=require(_0x78f9('0x6'));var fs=require('fs');var path=require(_0x78f9('0x7'));var rimraf=require(_0x78f9('0x8'));var config=require(_0x78f9('0x9'));var attributes=require(_0x78f9('0xa'));module[_0x78f9('0xb')]=function(_0x46619e,_0x381632){return _0x46619e[_0x78f9('0xc')](_0x78f9('0xd'),attributes,{'tableName':_0x78f9('0xe'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x78f9('0xf'),_0x78f9('0x10')],'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 b0fa82d..f87762b 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 _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 +var _0xe5b3=['request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZohoField,\x20%s,\x20%s'];(function(_0x361078,_0x283dcb){var _0x22d9e8=function(_0x140b4b){while(--_0x140b4b){_0x361078['push'](_0x361078['shift']());}};_0x22d9e8(++_0x283dcb);}(_0xe5b3,0x133));var _0x3e5b=function(_0x3400fa,_0x4c9236){_0x3400fa=_0x3400fa-0x0;var _0x449dbc=_0xe5b3[_0x3400fa];return _0x449dbc;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dcf55,_0x534e7d,_0x41d46f){return new BPromise(function(_0x3901c2,_0x3c7c2e){return client[_0x3e5b('0xc')](_0x5dcf55,_0x41d46f)['then'](function(_0x4ed6bc){logger[_0x3e5b('0xd')](_0x3e5b('0xe'),_0x534e7d,_0x3e5b('0xf'));logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x534e7d,'request\x20sent',JSON[_0x3e5b('0x12')](_0x4ed6bc));if(_0x4ed6bc['error']){if(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x14')]===0x1f4){logger[_0x3e5b('0x13')](_0x3e5b('0xe'),_0x534e7d,_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);return _0x3c7c2e(_0x4ed6bc[_0x3e5b('0x13')]['message']);}logger[_0x3e5b('0x13')]('ZohoField,\x20%s,\x20%s',_0x534e7d,_0x4ed6bc['error']['message']);return _0x3901c2(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);}else{logger[_0x3e5b('0xd')]('ZohoField,\x20%s,\x20%s',_0x534e7d,_0x3e5b('0xf'));_0x3901c2(_0x4ed6bc['result']['message']);}})[_0x3e5b('0x16')](function(_0x11b41b){logger['error'](_0x3e5b('0xe'),_0x534e7d,_0x11b41b);_0x3c7c2e(_0x11b41b);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 03b4be0..bf5d541 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 _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 +var _0xd993=['path','express','Router','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x48e23c,_0x16f7dd){var _0xf42eb9=function(_0x27da18){while(--_0x27da18){_0x48e23c['push'](_0x48e23c['shift']());}};_0xf42eb9(++_0x16f7dd);}(_0xd993,0x1c6));var _0x3d99=function(_0x23179d,_0x20b4c7){_0x23179d=_0x23179d-0x0;var _0x402977=_0xd993[_0x23179d];return _0x402977;};'use strict';var multer=require(_0x3d99('0x0'));var util=require(_0x3d99('0x1'));var path=require(_0x3d99('0x2'));var timeout=require('connect-timeout');var express=require(_0x3d99('0x3'));var router=express[_0x3d99('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3d99('0x5'));var config=require(_0x3d99('0x6'));module[_0x3d99('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 5a76687..4b9c0a8 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 _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 +var _0x1752=['INTEGER','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x5de285,_0x58b242){var _0x36555a=function(_0x243b4e){while(--_0x243b4e){_0x5de285['push'](_0x5de285['shift']());}};_0x36555a(++_0x58b242);}(_0x1752,0xaa));var _0x2175=function(_0x3d692e,_0xfad1d3){_0x3d692e=_0x3d692e-0x0;var _0x861136=_0x1752[_0x3d692e];return _0x861136;};'use strict';var Sequelize=require(_0x2175('0x0'));module[_0x2175('0x1')]={'name':{'type':Sequelize[_0x2175('0x2')],'allowNull':![],'unique':_0x2175('0x3')},'version':{'type':Sequelize[_0x2175('0x2')],'allowNull':![],'unique':_0x2175('0x3')},'main':{'type':Sequelize[_0x2175('0x2')],'defaultValue':_0x2175('0x4')},'filename':{'type':Sequelize[_0x2175('0x2')]},'path':{'type':Sequelize[_0x2175('0x2')]},'type':{'type':Sequelize[_0x2175('0x2')]},'size':{'type':Sequelize[_0x2175('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x2175('0x2')]},'logo':{'type':Sequelize[_0x2175('0x2')]},'state':{'type':Sequelize[_0x2175('0x2')],'unique':_0x2175('0x6')},'description':{'type':Sequelize[_0x2175('0x2')]},'title':{'type':Sequelize[_0x2175('0x2')]},'remoteUri':{'type':Sequelize[_0x2175('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 2f37f53..d6bfaf2 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 _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 +var _0x5755=['util','path','sox','to-csv','ejs','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','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','then','destroy','stack','name','send','index','map','Integration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','find','create','update','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x5ebad6,_0x4495a6){var _0x5ea13b=function(_0x4a6127){while(--_0x4a6127){_0x5ebad6['push'](_0x5ebad6['shift']());}};_0x5ea13b(++_0x4495a6);}(_0x5755,0x8f));var _0x5575=function(_0x3ca829,_0xc55f17){_0x3ca829=_0x3ca829-0x0;var _0x3b416b=_0x5755[_0x3ca829];return _0x3b416b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5575('0x0'));var rimraf=require(_0x5575('0x1'));var zipdir=require(_0x5575('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5575('0x3'));var moment=require(_0x5575('0x4'));var BPromise=require(_0x5575('0x5'));var Mustache=require(_0x5575('0x6'));var util=require(_0x5575('0x7'));var path=require(_0x5575('0x8'));var sox=require(_0x5575('0x9'));var csv=require(_0x5575('0xa'));var ejs=require(_0x5575('0xb'));var fs=require('fs');var _=require(_0x5575('0xc'));var squel=require(_0x5575('0xd'));var crypto=require(_0x5575('0xe'));var jsforce=require(_0x5575('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5575('0x10'));var Papa=require(_0x5575('0x11'));var Redis=require(_0x5575('0x12'));var authService=require(_0x5575('0x13'));var qs=require(_0x5575('0x14'));var as=require(_0x5575('0x15'));var hardwareService=require(_0x5575('0x16'));var logger=require(_0x5575('0x17'))('api');var utils=require(_0x5575('0x18'));var config=require(_0x5575('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5657a3,_0x5c9e4a){_0x5c9e4a=_0x5c9e4a||0xcc;return function(_0x1f0db1){if(_0x1f0db1){return _0x5657a3[_0x5575('0x1a')](_0x5c9e4a);}return _0x5657a3[_0x5575('0x1b')](_0x5c9e4a)[_0x5575('0x1c')]();};}function respondWithResult(_0x544d55,_0x51d48e){_0x51d48e=_0x51d48e||0xc8;return function(_0x5d9f49){if(_0x5d9f49){return _0x544d55[_0x5575('0x1b')](_0x51d48e)['json'](_0x5d9f49);}};}function respondWithFilteredResult(_0x53e5a7,_0x50fbc5){return function(_0x2b8dca){if(_0x2b8dca){var _0x2e7711=_0x2b8dca['count'],_0x42e238=_0x50fbc5[_0x5575('0x1d')],_0x2c21bd=_0x50fbc5[_0x5575('0x1d')]+_0x50fbc5[_0x5575('0x1e')],_0x55c668;if(_0x2c21bd>=_0x2e7711){_0x2c21bd=_0x2e7711;_0x55c668=0xc8;}else{_0x55c668=0xce;}_0x53e5a7[_0x5575('0x1b')](_0x55c668);return _0x53e5a7[_0x5575('0x1f')](_0x5575('0x20'),_0x42e238+'-'+_0x2c21bd+'/'+_0x2e7711)[_0x5575('0x21')](_0x2b8dca);}return null;};}function patchUpdates(_0x331faa){return function(_0x4f5d0a){try{jsonpatch[_0x5575('0x22')](_0x4f5d0a,_0x331faa,!![]);}catch(_0x26f4ed){return BPromise[_0x5575('0x23')](_0x26f4ed);}return _0x4f5d0a['save']();};}function saveUpdates(_0x48d631,_0x4c2869){return function(_0x529304){if(_0x529304){return _0x529304['update'](_0x48d631)[_0x5575('0x24')](function(_0x3cc0b2){return _0x3cc0b2;});}return null;};}function removeEntity(_0x373939,_0x3380e7){return function(_0x58d5a8){if(_0x58d5a8){return _0x58d5a8[_0x5575('0x25')]()[_0x5575('0x24')](function(){_0x373939[_0x5575('0x1b')](0xcc)[_0x5575('0x1c')]();});}};}function handleEntityNotFound(_0x39d6ff,_0x195c20){return function(_0x4e989a){if(!_0x4e989a){_0x39d6ff['sendStatus'](0x194);}return _0x4e989a;};}function handleError(_0x579a46,_0x46aebe){_0x46aebe=_0x46aebe||0x1f4;return function(_0x1bcc86){logger['error'](_0x1bcc86[_0x5575('0x26')]);if(_0x1bcc86[_0x5575('0x27')]){delete _0x1bcc86[_0x5575('0x27')];}_0x579a46['status'](_0x46aebe)[_0x5575('0x28')](_0x1bcc86);};}exports[_0x5575('0x29')]=function(_0x4f7505,_0x233e03){var _0x54894b={},_0xcb47c9={},_0x551ba3={'count':0x0,'rows':[]};var _0x551a92=_[_0x5575('0x2a')](db[_0x5575('0x2b')][_0x5575('0x2c')],function(_0x2fabdc){return{'name':_0x2fabdc['fieldName'],'type':_0x2fabdc[_0x5575('0x2d')][_0x5575('0x2e')]};});_0xcb47c9[_0x5575('0x2f')]=_[_0x5575('0x2a')](_0x551a92,_0x5575('0x27'));_0xcb47c9['query']=_[_0x5575('0x30')](_0x4f7505[_0x5575('0x31')]);_0xcb47c9[_0x5575('0x32')]=_[_0x5575('0x33')](_0xcb47c9['model'],_0xcb47c9['query']);_0x54894b[_0x5575('0x34')]=_[_0x5575('0x33')](_0xcb47c9[_0x5575('0x2f')],qs[_0x5575('0x35')](_0x4f7505['query'][_0x5575('0x35')]));_0x54894b[_0x5575('0x34')]=_0x54894b[_0x5575('0x34')][_0x5575('0x36')]?_0x54894b[_0x5575('0x34')]:_0xcb47c9['model'];if(!_0x4f7505[_0x5575('0x31')]['hasOwnProperty'](_0x5575('0x37'))){_0x54894b['limit']=qs[_0x5575('0x1e')](_0x4f7505[_0x5575('0x31')][_0x5575('0x1e')]);_0x54894b[_0x5575('0x1d')]=qs[_0x5575('0x1d')](_0x4f7505[_0x5575('0x31')]['offset']);}_0x54894b[_0x5575('0x38')]=qs[_0x5575('0x39')](_0x4f7505['query'][_0x5575('0x39')]);_0x54894b['where']=qs[_0x5575('0x32')](_[_0x5575('0x3a')](_0x4f7505[_0x5575('0x31')],_0xcb47c9[_0x5575('0x32')]),_0x551a92);if(_0x4f7505['query'][_0x5575('0x3b')]){_0x54894b[_0x5575('0x3c')]=_[_0x5575('0x3d')](_0x54894b['where'],{'$or':_[_0x5575('0x2a')](_0x551a92,function(_0x714bc0){if(_0x714bc0[_0x5575('0x2d')]!==_0x5575('0x3e')){var _0x18c464={};_0x18c464[_0x714bc0[_0x5575('0x27')]]={'$like':'%'+_0x4f7505[_0x5575('0x31')][_0x5575('0x3b')]+'%'};return _0x18c464;}})});}_0x54894b=_[_0x5575('0x3d')]({},_0x54894b,_0x4f7505[_0x5575('0x3f')]);var _0x40363b={'where':_0x54894b[_0x5575('0x3c')]};return db[_0x5575('0x2b')][_0x5575('0x40')](_0x40363b)[_0x5575('0x24')](function(_0x503f65){_0x551ba3['count']=_0x503f65;if(_0x4f7505[_0x5575('0x31')][_0x5575('0x41')]){_0x54894b[_0x5575('0x42')]=[{'all':!![]}];}return db[_0x5575('0x2b')][_0x5575('0x43')](_0x54894b);})[_0x5575('0x24')](function(_0x573768){_0x551ba3['rows']=_0x573768;return _0x551ba3;})[_0x5575('0x24')](respondWithFilteredResult(_0x233e03,_0x54894b))[_0x5575('0x44')](handleError(_0x233e03,null));};exports[_0x5575('0x45')]=function(_0x274a8b,_0x10a8f0){var _0x5e246f={'raw':![],'where':{'id':_0x274a8b[_0x5575('0x46')]['id']}},_0x3e1328={};_0x3e1328['model']=_['keys'](db[_0x5575('0x2b')][_0x5575('0x2c')]);_0x3e1328[_0x5575('0x31')]=_[_0x5575('0x30')](_0x274a8b[_0x5575('0x31')]);_0x3e1328['filters']=_['intersection'](_0x3e1328[_0x5575('0x2f')],_0x3e1328[_0x5575('0x31')]);_0x5e246f['attributes']=_[_0x5575('0x33')](_0x3e1328[_0x5575('0x2f')],qs[_0x5575('0x35')](_0x274a8b[_0x5575('0x31')][_0x5575('0x35')]));_0x5e246f[_0x5575('0x34')]=_0x5e246f[_0x5575('0x34')][_0x5575('0x36')]?_0x5e246f[_0x5575('0x34')]:_0x3e1328[_0x5575('0x2f')];if(_0x274a8b[_0x5575('0x31')][_0x5575('0x41')]){_0x5e246f[_0x5575('0x42')]=[{'all':!![]}];}_0x5e246f=_[_0x5575('0x3d')]({},_0x5e246f,_0x274a8b[_0x5575('0x3f')]);return db[_0x5575('0x2b')][_0x5575('0x47')](_0x5e246f)['then'](handleEntityNotFound(_0x10a8f0,null))[_0x5575('0x24')](respondWithResult(_0x10a8f0,null))['catch'](handleError(_0x10a8f0,null));};exports[_0x5575('0x48')]=function(_0x36f18d,_0x161c98){return db[_0x5575('0x2b')][_0x5575('0x48')](_0x36f18d['body'],{})['then'](respondWithResult(_0x161c98,0xc9))[_0x5575('0x44')](handleError(_0x161c98,null));};exports[_0x5575('0x49')]=function(_0x595bdc,_0x4846ce){if(_0x595bdc['body']['id']){delete _0x595bdc['body']['id'];}return db[_0x5575('0x2b')][_0x5575('0x47')]({'where':{'id':_0x595bdc[_0x5575('0x46')]['id']}})[_0x5575('0x24')](handleEntityNotFound(_0x4846ce,null))[_0x5575('0x24')](saveUpdates(_0x595bdc[_0x5575('0x4a')],null))[_0x5575('0x24')](respondWithResult(_0x4846ce,null))[_0x5575('0x44')](handleError(_0x4846ce,null));};exports[_0x5575('0x25')]=function(_0x40f3df,_0x58e893){return db[_0x5575('0x2b')]['find']({'where':{'id':_0x40f3df['params']['id']}})[_0x5575('0x24')](handleEntityNotFound(_0x58e893,null))['then'](removeEntity(_0x58e893,null))[_0x5575('0x44')](handleError(_0x58e893,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 6e1dbcb..f440cd9 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 _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 +var _0xca74=['./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1d6af2,_0x3db4f3){var _0x2987a5=function(_0x4e5fcd){while(--_0x4e5fcd){_0x1d6af2['push'](_0x1d6af2['shift']());}};_0x2987a5(++_0x3db4f3);}(_0xca74,0x123));var _0x4ca7=function(_0x3d0e12,_0x41e165){_0x3d0e12=_0x3d0e12-0x0;var _0x22da51=_0xca74[_0x3d0e12];return _0x22da51;};'use strict';var _=require(_0x4ca7('0x0'));var util=require(_0x4ca7('0x1'));var logger=require(_0x4ca7('0x2'))(_0x4ca7('0x3'));var moment=require('moment');var BPromise=require(_0x4ca7('0x4'));var rp=require(_0x4ca7('0x5'));var fs=require('fs');var path=require(_0x4ca7('0x6'));var rimraf=require(_0x4ca7('0x7'));var config=require('../../config/environment');var attributes=require(_0x4ca7('0x8'));module[_0x4ca7('0x9')]=function(_0x135a76,_0x15c634){return _0x135a76[_0x4ca7('0xa')](_0x4ca7('0xb'),attributes,{'tableName':_0x4ca7('0xc'),'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 fe94b7e..bdd167e 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 _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 +var _0xb87c=['Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xb87c,0x1d7));var _0xcb87=function(_0x31e94f,_0x2446c8){_0x31e94f=_0x31e94f-0x0;var _0x4946fd=_0xb87c[_0x31e94f];return _0x4946fd;};'use strict';var _=require('lodash');var util=require(_0xcb87('0x0'));var moment=require(_0xcb87('0x1'));var BPromise=require(_0xcb87('0x2'));var rs=require(_0xcb87('0x3'));var fs=require('fs');var Redis=require(_0xcb87('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb87('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xcb87('0x6'));var jayson=require(_0xcb87('0x7'));var client=jayson[_0xcb87('0x8')][_0xcb87('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17404c,_0x145bae,_0x5f2085){return new BPromise(function(_0x177270,_0x1395d6){return client[_0xcb87('0xa')](_0x17404c,_0x5f2085)[_0xcb87('0xb')](function(_0x1ff79a){logger['info'](_0xcb87('0xc'),_0x145bae,_0xcb87('0xd'));logger[_0xcb87('0xe')](_0xcb87('0xf'),_0x145bae,_0xcb87('0xd'),JSON[_0xcb87('0x10')](_0x1ff79a));if(_0x1ff79a['error']){if(_0x1ff79a[_0xcb87('0x11')][_0xcb87('0x12')]===0x1f4){logger[_0xcb87('0x11')](_0xcb87('0xc'),_0x145bae,_0x1ff79a['error'][_0xcb87('0x13')]);return _0x1395d6(_0x1ff79a[_0xcb87('0x11')]['message']);}logger[_0xcb87('0x11')]('Integration,\x20%s,\x20%s',_0x145bae,_0x1ff79a[_0xcb87('0x11')]['message']);return _0x177270(_0x1ff79a[_0xcb87('0x11')]['message']);}else{logger['info'](_0xcb87('0xc'),_0x145bae,'request\x20sent');_0x177270(_0x1ff79a[_0xcb87('0x14')][_0xcb87('0x13')]);}})['catch'](function(_0x2b7ee5){logger[_0xcb87('0x11')](_0xcb87('0xc'),_0x145bae,_0x2b7ee5);_0x1395d6(_0x2b7ee5);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 9e01cad..61e61d0 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 _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 +var _0x96ee=['get','isAuthenticated','/describe','/:id','show','post','create','put','destroy','exports','util','path','../../components/interaction/service'];(function(_0x152220,_0x38a858){var _0xcb20e2=function(_0x49cfdc){while(--_0x49cfdc){_0x152220['push'](_0x152220['shift']());}};_0xcb20e2(++_0x38a858);}(_0x96ee,0x72));var _0xe96e=function(_0x5b6a86,_0x59489c){_0x5b6a86=_0x5b6a86-0x0;var _0x425888=_0x96ee[_0x5b6a86];return _0x425888;};'use strict';var multer=require('multer');var util=require(_0xe96e('0x0'));var path=require(_0xe96e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe96e('0x2'));var config=require('../../config/environment');var controller=require('./integrationReport.controller');router[_0xe96e('0x3')]('/',auth[_0xe96e('0x4')](),controller['index']);router[_0xe96e('0x3')](_0xe96e('0x5'),auth[_0xe96e('0x4')](),controller['describe']);router[_0xe96e('0x3')](_0xe96e('0x6'),auth[_0xe96e('0x4')](),controller[_0xe96e('0x7')]);router[_0xe96e('0x8')]('/',auth[_0xe96e('0x4')](),controller[_0xe96e('0x9')]);router[_0xe96e('0xa')](_0xe96e('0x6'),auth[_0xe96e('0x4')](),controller['update']);router['delete'](_0xe96e('0x6'),auth[_0xe96e('0x4')](),controller[_0xe96e('0xb')]);module[_0xe96e('0xc')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 61750dd..b284f77 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 _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 +var _0x92cf=['TEXT','ENUM','SENT','SENDING','RECEIVED','sequelize','STRING','INTEGER','DATE','BOOLEAN'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x92cf,0x87));var _0xf92c=function(_0x19258d,_0x5f2768){_0x19258d=_0x19258d-0x0;var _0x2239d7=_0x92cf[_0x19258d];return _0x2239d7;};'use strict';var Sequelize=require(_0xf92c('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xf92c('0x1')]},'integrationId':{'type':Sequelize[_0xf92c('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf92c('0x1')]},'calleridname':{'type':Sequelize[_0xf92c('0x1')]},'queue':{'type':Sequelize[_0xf92c('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xf92c('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xf92c('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xf92c('0x2')]},'agentacw':{'type':Sequelize[_0xf92c('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf92c('0x2')]},'reason':{'type':Sequelize[_0xf92c('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xf92c('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xf92c('0x3')]},'agentdump':{'type':Sequelize[_0xf92c('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf92c('0x3')]},'lastevent':{'type':Sequelize[_0xf92c('0x1')]},'channel':{'type':Sequelize[_0xf92c('0x1')]},'channelstate':{'type':Sequelize[_0xf92c('0x2')]},'channelstatedesc':{'type':Sequelize[_0xf92c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xf92c('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf92c('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf92c('0x1')]},'exten':{'type':Sequelize[_0xf92c('0x1')]},'priority':{'type':Sequelize[_0xf92c('0x1')]},'destchannel':{'type':Sequelize[_0xf92c('0x1')]},'destchannelstate':{'type':Sequelize[_0xf92c('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xf92c('0x1')]},'destcalleridnum':{'type':Sequelize[_0xf92c('0x1')]},'destcalleridname':{'type':Sequelize[_0xf92c('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xf92c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xf92c('0x1')]},'destlanguage':{'type':Sequelize[_0xf92c('0x1')]},'destaccountcode':{'type':Sequelize[_0xf92c('0x1')]},'destcontext':{'type':Sequelize[_0xf92c('0x1')]},'destexten':{'type':Sequelize[_0xf92c('0x1')]},'destpriority':{'type':Sequelize[_0xf92c('0x1')]},'destuniqueid':{'type':Sequelize[_0xf92c('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xf92c('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xf92c('0x1')]},'to':{'type':Sequelize[_0xf92c('0x1')]},'cc':{'type':Sequelize[_0xf92c('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xf92c('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xf92c('0x6')](_0xf92c('0x7'),_0xf92c('0x8'),_0xf92c('0x9'),'FAILED')},'url':{'type':Sequelize[_0xf92c('0x1')]},'app':{'type':Sequelize[_0xf92c('0x1')]},'appdata':{'type':Sequelize[_0xf92c('0x1')]},'projectId':{'type':Sequelize[_0xf92c('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index d3b8495..6e5f238 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 _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 +var _0x1b3a=['limit','sort','where','pick','filter','VIRTUAL','merge','options','then','include','findAll','rows','catch','params','fields','includeAll','find','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','count','offset','set','Content-Range','apply','update','end','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit'];(function(_0x465c45,_0x491323){var _0x11ed91=function(_0xfda3d){while(--_0xfda3d){_0x465c45['push'](_0x465c45['shift']());}};_0x11ed91(++_0x491323);}(_0x1b3a,0x16d));var _0xa1b3=function(_0x3049c8,_0x1ac2df){_0x3049c8=_0x3049c8-0x0;var _0x5616bb=_0x1b3a[_0x3049c8];return _0x5616bb;};'use strict';var pdf=require(_0xa1b3('0x0'));var emlformat=require(_0xa1b3('0x1'));var rimraf=require(_0xa1b3('0x2'));var zipdir=require(_0xa1b3('0x3'));var jsonpatch=require(_0xa1b3('0x4'));var rp=require(_0xa1b3('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa1b3('0x6'));var path=require('path');var sox=require(_0xa1b3('0x7'));var csv=require('to-csv');var ejs=require(_0xa1b3('0x8'));var fs=require('fs');var _=require(_0xa1b3('0x9'));var squel=require(_0xa1b3('0xa'));var crypto=require(_0xa1b3('0xb'));var jsforce=require(_0xa1b3('0xc'));var deskjs=require(_0xa1b3('0xd'));var toCsv=require(_0xa1b3('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa1b3('0xf'));var as=require(_0xa1b3('0x10'));var hardwareService=require(_0xa1b3('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xa1b3('0x12'));var config=require(_0xa1b3('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22bfbe,_0xf3d333){_0xf3d333=_0xf3d333||0xcc;return function(_0x2bba22){if(_0x2bba22){return _0x22bfbe[_0xa1b3('0x14')](_0xf3d333);}return _0x22bfbe[_0xa1b3('0x15')](_0xf3d333)['end']();};}function respondWithResult(_0x37a708,_0x20d6cc){_0x20d6cc=_0x20d6cc||0xc8;return function(_0x542a50){if(_0x542a50){return _0x37a708[_0xa1b3('0x15')](_0x20d6cc)['json'](_0x542a50);}};}function respondWithFilteredResult(_0x41005c,_0x272bcb){return function(_0x166bb3){if(_0x166bb3){var _0x241a89=_0x166bb3[_0xa1b3('0x16')],_0x19e892=_0x272bcb[_0xa1b3('0x17')],_0x228ae4=_0x272bcb[_0xa1b3('0x17')]+_0x272bcb['limit'],_0xedd674;if(_0x228ae4>=_0x241a89){_0x228ae4=_0x241a89;_0xedd674=0xc8;}else{_0xedd674=0xce;}_0x41005c[_0xa1b3('0x15')](_0xedd674);return _0x41005c[_0xa1b3('0x18')](_0xa1b3('0x19'),_0x19e892+'-'+_0x228ae4+'/'+_0x241a89)['json'](_0x166bb3);}return null;};}function patchUpdates(_0x523d78){return function(_0x4f4a2f){try{jsonpatch[_0xa1b3('0x1a')](_0x4f4a2f,_0x523d78,!![]);}catch(_0x53c4ca){return BPromise['reject'](_0x53c4ca);}return _0x4f4a2f['save']();};}function saveUpdates(_0x5887b3,_0x22171f){return function(_0xf16e88){if(_0xf16e88){return _0xf16e88[_0xa1b3('0x1b')](_0x5887b3)['then'](function(_0x5f60ff){return _0x5f60ff;});}return null;};}function removeEntity(_0x3fea65,_0x11d183){return function(_0x7a3a24){if(_0x7a3a24){return _0x7a3a24['destroy']()['then'](function(){_0x3fea65[_0xa1b3('0x15')](0xcc)[_0xa1b3('0x1c')]();});}};}function handleEntityNotFound(_0x38019d,_0x5470ef){return function(_0x4e4745){if(!_0x4e4745){_0x38019d['sendStatus'](0x194);}return _0x4e4745;};}function handleError(_0x1b9a73,_0x27ecf9){_0x27ecf9=_0x27ecf9||0x1f4;return function(_0xc68b11){logger[_0xa1b3('0x1d')](_0xc68b11[_0xa1b3('0x1e')]);if(_0xc68b11[_0xa1b3('0x1f')]){delete _0xc68b11[_0xa1b3('0x1f')];}_0x1b9a73['status'](_0x27ecf9)[_0xa1b3('0x20')](_0xc68b11);};}exports[_0xa1b3('0x21')]=function(_0x26febb,_0x33ec83){var _0x169d2={},_0x54e09d={},_0x3d1dc6={'count':0x0,'rows':[]};var _0x3a5a70=_[_0xa1b3('0x22')](db[_0xa1b3('0x23')][_0xa1b3('0x24')],function(_0x2cfa42){return{'name':_0x2cfa42[_0xa1b3('0x25')],'type':_0x2cfa42[_0xa1b3('0x26')][_0xa1b3('0x27')]};});_0x54e09d[_0xa1b3('0x28')]=_[_0xa1b3('0x22')](_0x3a5a70,_0xa1b3('0x1f'));_0x54e09d[_0xa1b3('0x29')]=_[_0xa1b3('0x2a')](_0x26febb[_0xa1b3('0x29')]);_0x54e09d[_0xa1b3('0x2b')]=_[_0xa1b3('0x2c')](_0x54e09d[_0xa1b3('0x28')],_0x54e09d[_0xa1b3('0x29')]);_0x169d2[_0xa1b3('0x2d')]=_[_0xa1b3('0x2c')](_0x54e09d[_0xa1b3('0x28')],qs['fields'](_0x26febb[_0xa1b3('0x29')]['fields']));_0x169d2[_0xa1b3('0x2d')]=_0x169d2['attributes'][_0xa1b3('0x2e')]?_0x169d2[_0xa1b3('0x2d')]:_0x54e09d['model'];if(!_0x26febb['query'][_0xa1b3('0x2f')](_0xa1b3('0x30'))){_0x169d2[_0xa1b3('0x31')]=qs[_0xa1b3('0x31')](_0x26febb[_0xa1b3('0x29')][_0xa1b3('0x31')]);_0x169d2[_0xa1b3('0x17')]=qs[_0xa1b3('0x17')](_0x26febb[_0xa1b3('0x29')][_0xa1b3('0x17')]);}_0x169d2['order']=qs[_0xa1b3('0x32')](_0x26febb['query'][_0xa1b3('0x32')]);_0x169d2[_0xa1b3('0x33')]=qs[_0xa1b3('0x2b')](_[_0xa1b3('0x34')](_0x26febb[_0xa1b3('0x29')],_0x54e09d[_0xa1b3('0x2b')]),_0x3a5a70);if(_0x26febb['query'][_0xa1b3('0x35')]){_0x169d2[_0xa1b3('0x33')]=_['merge'](_0x169d2[_0xa1b3('0x33')],{'$or':_['map'](_0x3a5a70,function(_0x424a8d){if(_0x424a8d[_0xa1b3('0x26')]!==_0xa1b3('0x36')){var _0x274d41={};_0x274d41[_0x424a8d[_0xa1b3('0x1f')]]={'$like':'%'+_0x26febb[_0xa1b3('0x29')][_0xa1b3('0x35')]+'%'};return _0x274d41;}})});}_0x169d2=_[_0xa1b3('0x37')]({},_0x169d2,_0x26febb[_0xa1b3('0x38')]);var _0x2b7628={'where':_0x169d2[_0xa1b3('0x33')]};return db[_0xa1b3('0x23')][_0xa1b3('0x16')](_0x2b7628)[_0xa1b3('0x39')](function(_0x4e3e36){_0x3d1dc6[_0xa1b3('0x16')]=_0x4e3e36;if(_0x26febb[_0xa1b3('0x29')]['includeAll']){_0x169d2[_0xa1b3('0x3a')]=[{'all':!![]}];}return db[_0xa1b3('0x23')][_0xa1b3('0x3b')](_0x169d2);})[_0xa1b3('0x39')](function(_0x52ebf3){_0x3d1dc6[_0xa1b3('0x3c')]=_0x52ebf3;return _0x3d1dc6;})['then'](respondWithFilteredResult(_0x33ec83,_0x169d2))[_0xa1b3('0x3d')](handleError(_0x33ec83,null));};exports['show']=function(_0x12cd99,_0x4bdfca){var _0x435ade={'raw':![],'where':{'id':_0x12cd99[_0xa1b3('0x3e')]['id']}},_0x513808={};_0x513808[_0xa1b3('0x28')]=_[_0xa1b3('0x2a')](db[_0xa1b3('0x23')]['rawAttributes']);_0x513808[_0xa1b3('0x29')]=_[_0xa1b3('0x2a')](_0x12cd99[_0xa1b3('0x29')]);_0x513808['filters']=_[_0xa1b3('0x2c')](_0x513808[_0xa1b3('0x28')],_0x513808['query']);_0x435ade[_0xa1b3('0x2d')]=_[_0xa1b3('0x2c')](_0x513808[_0xa1b3('0x28')],qs[_0xa1b3('0x3f')](_0x12cd99[_0xa1b3('0x29')][_0xa1b3('0x3f')]));_0x435ade[_0xa1b3('0x2d')]=_0x435ade[_0xa1b3('0x2d')][_0xa1b3('0x2e')]?_0x435ade[_0xa1b3('0x2d')]:_0x513808['model'];if(_0x12cd99[_0xa1b3('0x29')][_0xa1b3('0x40')]){_0x435ade['include']=[{'all':!![]}];}_0x435ade=_[_0xa1b3('0x37')]({},_0x435ade,_0x12cd99['options']);return db[_0xa1b3('0x23')][_0xa1b3('0x41')](_0x435ade)[_0xa1b3('0x39')](handleEntityNotFound(_0x4bdfca,null))[_0xa1b3('0x39')](respondWithResult(_0x4bdfca,null))['catch'](handleError(_0x4bdfca,null));};exports['create']=function(_0x2f9a15,_0x3a2362){return db['IntegrationReport']['create'](_0x2f9a15['body'],{})[_0xa1b3('0x39')](respondWithResult(_0x3a2362,0xc9))[_0xa1b3('0x3d')](handleError(_0x3a2362,null));};exports[_0xa1b3('0x1b')]=function(_0x5cd627,_0x1fb608){if(_0x5cd627[_0xa1b3('0x42')]['id']){delete _0x5cd627[_0xa1b3('0x42')]['id'];}return db[_0xa1b3('0x23')][_0xa1b3('0x41')]({'where':{'id':_0x5cd627['params']['id']}})[_0xa1b3('0x39')](handleEntityNotFound(_0x1fb608,null))['then'](saveUpdates(_0x5cd627[_0xa1b3('0x42')],null))['then'](respondWithResult(_0x1fb608,null))['catch'](handleError(_0x1fb608,null));};exports[_0xa1b3('0x43')]=function(_0x40f02b,_0x4b1017){return db['IntegrationReport'][_0xa1b3('0x41')]({'where':{'id':_0x40f02b[_0xa1b3('0x3e')]['id']}})[_0xa1b3('0x39')](handleEntityNotFound(_0x4b1017,null))[_0xa1b3('0x39')](removeEntity(_0x4b1017,null))[_0xa1b3('0x3d')](handleError(_0x4b1017,null));};exports[_0xa1b3('0x44')]=function(_0x583c3e,_0x53bbd7){return db[_0xa1b3('0x23')][_0xa1b3('0x44')]()['then'](respondWithResult(_0x53bbd7,null))[_0xa1b3('0x3d')](handleError(_0x53bbd7,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index c67b05d..72fe13a 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 _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 +var _0x79d9=['rimraf','../../config/environment','./integrationReport.attributes','exports','report_integration','lodash','util','api','moment','request-promise','path'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x79d9,0x118));var _0x979d=function(_0xd9052e,_0xa54fea){_0xd9052e=_0xd9052e-0x0;var _0x3b23be=_0x79d9[_0xd9052e];return _0x3b23be;};'use strict';var _=require(_0x979d('0x0'));var util=require(_0x979d('0x1'));var logger=require('../../config/logger')(_0x979d('0x2'));var moment=require(_0x979d('0x3'));var BPromise=require('bluebird');var rp=require(_0x979d('0x4'));var fs=require('fs');var path=require(_0x979d('0x5'));var rimraf=require(_0x979d('0x6'));var config=require(_0x979d('0x7'));var attributes=require(_0x979d('0x8'));module[_0x979d('0x9')]=function(_0x1e17a6,_0x2b573e){return _0x1e17a6['define']('IntegrationReport',attributes,{'tableName':_0x979d('0xa'),'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 7b50da6..b8d96ec 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_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 +var _0x4fc2=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0x4fc2,0x111));var _0x24fc=function(_0x2a1465,_0x8bf785){_0x2a1465=_0x2a1465-0x0;var _0x128933=_0x4fc2[_0x2a1465];return _0x128933;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index c4cc2b8..3097839 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 _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 +var _0x9c44=['../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','addInterval','addIntervals','put','update','destroy','exports','path','connect-timeout','express','Router'];(function(_0x29a1ba,_0x27f65a){var _0x1eaf80=function(_0xa1346a){while(--_0xa1346a){_0x29a1ba['push'](_0x29a1ba['shift']());}};_0x1eaf80(++_0x27f65a);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x49c4('0xd')](_0x49c4('0xb'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);router[_0x49c4('0xd')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x11')]);router['delete'](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);module[_0x49c4('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 663e1e1..13ff9f4 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 _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 +var _0xb22f=['STRING','sequelize','exports'];(function(_0xeae8ff,_0x3c1cbf){var _0x18369f=function(_0x30fc9f){while(--_0x30fc9f){_0xeae8ff['push'](_0xeae8ff['shift']());}};_0x18369f(++_0x3c1cbf);}(_0xb22f,0xfa));var _0xfb22=function(_0x348091,_0x2d3e35){_0x348091=_0x348091-0x0;var _0x151d69=_0xb22f[_0x348091];return _0x151d69;};'use strict';var Sequelize=require(_0xfb22('0x0'));module[_0xfb22('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xfb22('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 56073df..baf9dde 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 _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 +var _0x2138=['model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','keys','intersection','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addInterval','getIntervals','findOne','order','addIntervals','sequelize','IntervalId','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','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/extensions/rewrite','sendStatus','end','json','count','offset','status','set','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x2138,0x19d));var _0x8213=function(_0x28cde9,_0x4c30c2){_0x28cde9=_0x28cde9-0x0;var _0x3667e5=_0x2138[_0x28cde9];return _0x3667e5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8213('0x0'));var rimraf=require(_0x8213('0x1'));var zipdir=require(_0x8213('0x2'));var jsonpatch=require(_0x8213('0x3'));var rp=require('request-promise');var moment=require(_0x8213('0x4'));var BPromise=require(_0x8213('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8213('0x6'));var sox=require(_0x8213('0x7'));var csv=require(_0x8213('0x8'));var ejs=require(_0x8213('0x9'));var fs=require('fs');var _=require(_0x8213('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8213('0xb'));var deskjs=require(_0x8213('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8213('0xd'));var authService=require(_0x8213('0xe'));var qs=require(_0x8213('0xf'));var as=require(_0x8213('0x10'));var hardwareService=require(_0x8213('0x11'));var logger=require(_0x8213('0x12'))(_0x8213('0x13'));var utils=require(_0x8213('0x14'));var config=require(_0x8213('0x15'));var licenseUtil=require(_0x8213('0x16'));var db=require(_0x8213('0x17'))['db'];var extensions=require(_0x8213('0x18'));function respondWithStatusCode(_0x570d57,_0x33813b){_0x33813b=_0x33813b||0xcc;return function(_0x37215b){if(_0x37215b){return _0x570d57[_0x8213('0x19')](_0x33813b);}return _0x570d57['status'](_0x33813b)[_0x8213('0x1a')]();};}function respondWithResult(_0x575d90,_0x487ad6){_0x487ad6=_0x487ad6||0xc8;return function(_0x1146d2){if(_0x1146d2){return _0x575d90['status'](_0x487ad6)[_0x8213('0x1b')](_0x1146d2);}};}function respondWithFilteredResult(_0x2c47d5,_0x2304bf){return function(_0x185ca0){if(_0x185ca0){var _0x52547c=_0x185ca0[_0x8213('0x1c')],_0x4af8a7=_0x2304bf[_0x8213('0x1d')],_0x46b764=_0x2304bf[_0x8213('0x1d')]+_0x2304bf['limit'],_0x4aff2d;if(_0x46b764>=_0x52547c){_0x46b764=_0x52547c;_0x4aff2d=0xc8;}else{_0x4aff2d=0xce;}_0x2c47d5[_0x8213('0x1e')](_0x4aff2d);return _0x2c47d5[_0x8213('0x1f')]('Content-Range',_0x4af8a7+'-'+_0x46b764+'/'+_0x52547c)['json'](_0x185ca0);}return null;};}function patchUpdates(_0x525b14){return function(_0x75199e){try{jsonpatch[_0x8213('0x20')](_0x75199e,_0x525b14,!![]);}catch(_0x4776ef){return BPromise[_0x8213('0x21')](_0x4776ef);}return _0x75199e[_0x8213('0x22')]();};}function saveUpdates(_0x3125ae,_0x32540f){return function(_0x1758c1){if(_0x1758c1){return _0x1758c1[_0x8213('0x23')](_0x3125ae)[_0x8213('0x24')](function(_0x59ccbb){return _0x59ccbb;});}return null;};}function removeEntity(_0x5c8b17,_0x4ca7c6){return function(_0x16c89d){if(_0x16c89d){return _0x16c89d[_0x8213('0x25')]()['then'](function(){var _0x219d9b=_0x16c89d[_0x8213('0x26')]({'plain':!![]});var _0x228fce=_0x8213('0x27');return db[_0x8213('0x28')][_0x8213('0x25')]({'where':{'type':_0x228fce,'resourceId':_0x219d9b['id']}})['then'](function(){return _0x16c89d;});})[_0x8213('0x24')](function(){_0x5c8b17[_0x8213('0x1e')](0xcc)[_0x8213('0x1a')]();});}};}function handleEntityNotFound(_0x197bc6,_0x8187f5){return function(_0x65b521){if(!_0x65b521){_0x197bc6[_0x8213('0x19')](0x194);}return _0x65b521;};}function handleError(_0x44befd,_0x5ea854){_0x5ea854=_0x5ea854||0x1f4;return function(_0x2eea97){logger[_0x8213('0x29')](_0x2eea97[_0x8213('0x2a')]);if(_0x2eea97['name']){delete _0x2eea97[_0x8213('0x2b')];}_0x44befd['status'](_0x5ea854)[_0x8213('0x2c')](_0x2eea97);};}exports[_0x8213('0x2d')]=function(_0x271768,_0x2dc071){var _0x2524ea={},_0x1b0813={},_0x189448={'count':0x0,'rows':[]};var _0x5d10bf=_[_0x8213('0x2e')](db[_0x8213('0x2f')][_0x8213('0x30')],function(_0x43baf0){return{'name':_0x43baf0[_0x8213('0x31')],'type':_0x43baf0[_0x8213('0x32')][_0x8213('0x33')]};});_0x1b0813[_0x8213('0x34')]=_[_0x8213('0x2e')](_0x5d10bf,_0x8213('0x2b'));_0x1b0813[_0x8213('0x35')]=_['keys'](_0x271768[_0x8213('0x35')]);_0x1b0813[_0x8213('0x36')]=_['intersection'](_0x1b0813[_0x8213('0x34')],_0x1b0813[_0x8213('0x35')]);_0x2524ea[_0x8213('0x37')]=_['intersection'](_0x1b0813[_0x8213('0x34')],qs[_0x8213('0x38')](_0x271768['query'][_0x8213('0x38')]));_0x2524ea['attributes']=_0x2524ea[_0x8213('0x37')][_0x8213('0x39')]?_0x2524ea[_0x8213('0x37')]:_0x1b0813['model'];if(!_0x271768[_0x8213('0x35')][_0x8213('0x3a')](_0x8213('0x3b'))){_0x2524ea[_0x8213('0x3c')]=qs['limit'](_0x271768[_0x8213('0x35')][_0x8213('0x3c')]);_0x2524ea[_0x8213('0x1d')]=qs[_0x8213('0x1d')](_0x271768[_0x8213('0x35')][_0x8213('0x1d')]);}_0x2524ea['order']=qs[_0x8213('0x3d')](_0x271768[_0x8213('0x35')][_0x8213('0x3d')]);_0x2524ea[_0x8213('0x3e')]=qs[_0x8213('0x36')](_[_0x8213('0x3f')](_0x271768[_0x8213('0x35')],_0x1b0813[_0x8213('0x36')]),_0x5d10bf);if(_0x271768['query'][_0x8213('0x40')]){_0x2524ea[_0x8213('0x3e')]=_[_0x8213('0x41')](_0x2524ea[_0x8213('0x3e')],{'$or':_['map'](_0x5d10bf,function(_0x1b8b49){if(_0x1b8b49[_0x8213('0x32')]!==_0x8213('0x42')){var _0x43a54c={};_0x43a54c[_0x1b8b49['name']]={'$like':'%'+_0x271768[_0x8213('0x35')][_0x8213('0x40')]+'%'};return _0x43a54c;}})});}_0x2524ea=_['merge']({},_0x2524ea,_0x271768[_0x8213('0x43')]);var _0xcfe219={'where':_0x2524ea['where']};return db[_0x8213('0x2f')][_0x8213('0x1c')](_0xcfe219)[_0x8213('0x24')](function(_0x1f83e7){_0x189448[_0x8213('0x1c')]=_0x1f83e7;if(_0x271768[_0x8213('0x35')]['includeAll']){_0x2524ea['include']=[{'all':!![]}];}return db[_0x8213('0x2f')]['findAll'](_0x2524ea);})[_0x8213('0x24')](function(_0x432f9a){_0x189448[_0x8213('0x44')]=_0x432f9a;return _0x189448;})[_0x8213('0x24')](respondWithFilteredResult(_0x2dc071,_0x2524ea))[_0x8213('0x45')](handleError(_0x2dc071,null));};exports[_0x8213('0x46')]=function(_0x2f8de3,_0x558bb6){var _0x27291c={'raw':!![],'where':{'id':_0x2f8de3['params']['id']}},_0x1a057c={};_0x1a057c[_0x8213('0x34')]=_['keys'](db[_0x8213('0x2f')]['rawAttributes']);_0x1a057c[_0x8213('0x35')]=_[_0x8213('0x47')](_0x2f8de3[_0x8213('0x35')]);_0x1a057c[_0x8213('0x36')]=_['intersection'](_0x1a057c[_0x8213('0x34')],_0x1a057c['query']);_0x27291c[_0x8213('0x37')]=_[_0x8213('0x48')](_0x1a057c[_0x8213('0x34')],qs[_0x8213('0x38')](_0x2f8de3[_0x8213('0x35')]['fields']));_0x27291c['attributes']=_0x27291c[_0x8213('0x37')][_0x8213('0x39')]?_0x27291c[_0x8213('0x37')]:_0x1a057c[_0x8213('0x34')];if(_0x2f8de3[_0x8213('0x35')][_0x8213('0x49')]){_0x27291c['include']=[{'all':!![]}];}_0x27291c=_[_0x8213('0x41')]({},_0x27291c,_0x2f8de3['options']);return db[_0x8213('0x2f')][_0x8213('0x4a')](_0x27291c)[_0x8213('0x24')](handleEntityNotFound(_0x558bb6,null))[_0x8213('0x24')](respondWithResult(_0x558bb6,null))[_0x8213('0x45')](handleError(_0x558bb6,null));};exports[_0x8213('0x4b')]=function(_0x2428d2,_0x27df78){return db['Interval']['create'](_0x2428d2['body'],{})[_0x8213('0x24')](function(_0x4acb84){var _0xc26f97=_0x2428d2[_0x8213('0x4c')][_0x8213('0x26')]({'plain':!![]});if(!_0xc26f97)throw new Error(_0x8213('0x4d'));if(_0xc26f97[_0x8213('0x4e')]===_0x8213('0x4c')){var _0x58f04f=_0x4acb84['get']({'plain':!![]});var _0x5f45c1=_0x8213('0x27');return db[_0x8213('0x4f')][_0x8213('0x4a')]({'where':{'name':_0x5f45c1,'userProfileId':_0xc26f97[_0x8213('0x50')]},'raw':!![]})['then'](function(_0x30cea2){if(_0x30cea2&&_0x30cea2['autoAssociation']===0x0){return db[_0x8213('0x28')][_0x8213('0x4b')]({'name':_0x58f04f[_0x8213('0x2b')],'resourceId':_0x58f04f['id'],'type':_0x30cea2[_0x8213('0x2b')],'sectionId':_0x30cea2['id']},{})[_0x8213('0x24')](function(){return _0x4acb84;});}else{return _0x4acb84;}})['catch'](function(_0x2f38c1){logger[_0x8213('0x29')](_0x8213('0x51'),_0x2f38c1);throw _0x2f38c1;});}return _0x4acb84;})[_0x8213('0x24')](respondWithResult(_0x27df78,0xc9))[_0x8213('0x45')](handleError(_0x27df78,null));};exports[_0x8213('0x23')]=function(_0x38ad14,_0x4e6f75){if(_0x38ad14[_0x8213('0x52')]['id']){delete _0x38ad14['body']['id'];}return db['Interval'][_0x8213('0x4a')]({'where':{'id':_0x38ad14[_0x8213('0x53')]['id']}})[_0x8213('0x24')](handleEntityNotFound(_0x4e6f75,null))[_0x8213('0x24')](saveUpdates(_0x38ad14[_0x8213('0x52')],null))[_0x8213('0x24')](respondWithResult(_0x4e6f75,null))[_0x8213('0x45')](handleError(_0x4e6f75,null));};exports[_0x8213('0x25')]=function(_0x46b430,_0x3b4485){return db[_0x8213('0x2f')][_0x8213('0x4a')]({'where':{'id':_0x46b430[_0x8213('0x53')]['id']}})['then'](handleEntityNotFound(_0x3b4485,null))[_0x8213('0x24')](removeEntity(_0x3b4485,null))['catch'](handleError(_0x3b4485,null));};exports[_0x8213('0x54')]=function(_0x52327d,_0x5460b7,_0x111cb0){if(_0x52327d[_0x8213('0x52')]['id']){delete _0x52327d['body']['id'];}return db['Interval'][_0x8213('0x4a')]({'where':{'id':_0x52327d['params']['id']}})['then'](handleEntityNotFound(_0x5460b7,null))['then'](function(_0x3812a8){if(_0x3812a8){_0x52327d[_0x8213('0x52')]['IntervalId']=_0x3812a8['id'];return db['Interval'][_0x8213('0x4b')](_0x52327d[_0x8213('0x52')]);}})[_0x8213('0x24')](respondWithResult(_0x5460b7,null))[_0x8213('0x45')](handleError(_0x5460b7,null));};exports[_0x8213('0x55')]=function(_0x2dc26c,_0x2df129,_0x1ba66c){var _0x4b2d79={};var _0xc58595={};var _0x515628;var _0x69c11d;return db[_0x8213('0x2f')][_0x8213('0x56')]({'where':{'id':_0x2dc26c['params']['id']}})[_0x8213('0x24')](handleEntityNotFound(_0x2df129,null))[_0x8213('0x24')](function(_0x245e40){if(_0x245e40){_0x515628=_0x245e40;_0xc58595['model']=_[_0x8213('0x47')](db[_0x8213('0x2f')][_0x8213('0x30')]);_0xc58595[_0x8213('0x35')]=_[_0x8213('0x47')](_0x2dc26c[_0x8213('0x35')]);_0xc58595[_0x8213('0x36')]=_[_0x8213('0x48')](_0xc58595['model'],_0xc58595[_0x8213('0x35')]);_0x4b2d79[_0x8213('0x37')]=_['intersection'](_0xc58595['model'],qs[_0x8213('0x38')](_0x2dc26c[_0x8213('0x35')][_0x8213('0x38')]));_0x4b2d79[_0x8213('0x37')]=_0x4b2d79[_0x8213('0x37')][_0x8213('0x39')]?_0x4b2d79[_0x8213('0x37')]:_0xc58595[_0x8213('0x34')];_0x4b2d79[_0x8213('0x57')]=qs['sort'](_0x2dc26c[_0x8213('0x35')][_0x8213('0x3d')]);_0x4b2d79['where']=qs[_0x8213('0x36')](_[_0x8213('0x3f')](_0x2dc26c[_0x8213('0x35')],_0xc58595[_0x8213('0x36')]));if(_0x2dc26c['query']['filter']){_0x4b2d79[_0x8213('0x3e')]=_[_0x8213('0x41')](_0x4b2d79['where'],{'$or':_[_0x8213('0x2e')](_0x4b2d79[_0x8213('0x37')],function(_0x4d1f16){var _0x39d0f4={};_0x39d0f4[_0x4d1f16]={'$like':'%'+_0x2dc26c[_0x8213('0x35')]['filter']+'%'};return _0x39d0f4;})});}_0x4b2d79=_[_0x8213('0x41')]({},_0x4b2d79,_0x2dc26c[_0x8213('0x43')]);return _0x515628[_0x8213('0x55')](_0x4b2d79);}})[_0x8213('0x24')](function(_0x2fe552){if(_0x2fe552){_0x69c11d=_0x2fe552[_0x8213('0x39')];if(!_0x2dc26c[_0x8213('0x35')]['hasOwnProperty'](_0x8213('0x3b'))){_0x4b2d79[_0x8213('0x3c')]=qs[_0x8213('0x3c')](_0x2dc26c['query'][_0x8213('0x3c')]);_0x4b2d79[_0x8213('0x1d')]=qs[_0x8213('0x1d')](_0x2dc26c['query'][_0x8213('0x1d')]);}return _0x515628[_0x8213('0x55')](_0x4b2d79);}})[_0x8213('0x24')](function(_0x159e40){if(_0x159e40){return _0x159e40?{'count':_0x69c11d,'rows':_0x159e40}:null;}})[_0x8213('0x24')](respondWithResult(_0x2df129,null))[_0x8213('0x45')](handleError(_0x2df129,null));};exports[_0x8213('0x58')]=function(_0x1822ac,_0x94980e,_0x5ea215){return db[_0x8213('0x2f')][_0x8213('0x56')]({'where':{'id':_0x1822ac[_0x8213('0x53')]['id']}})['then'](handleEntityNotFound(_0x94980e,null))[_0x8213('0x24')](function(_0x234ab2){if(_0x234ab2){return db[_0x8213('0x59')]['transaction'](function(_0x212f01){return db[_0x8213('0x2f')][_0x8213('0x25')]({'where':{'IntervalId':_0x1822ac[_0x8213('0x53')]['id']},'transaction':_0x212f01})[_0x8213('0x24')](function(_0x4445e4){var _0x4f3b1f=_[_0x8213('0x2e')](_0x1822ac[_0x8213('0x52')],function(_0x28cb50){delete _0x28cb50['id'];_0x28cb50[_0x8213('0x5a')]=_0x1822ac[_0x8213('0x53')]['id'];return _0x28cb50;});return db[_0x8213('0x2f')][_0x8213('0x5b')](_0x4f3b1f,{'transaction':_0x212f01});});})[_0x8213('0x24')](function(){return db['Interval'][_0x8213('0x5c')]({'where':{'IntervalId':_0x1822ac[_0x8213('0x53')]['id']}});});}})[_0x8213('0x24')](respondWithResult(_0x94980e,null))[_0x8213('0x45')](handleError(_0x94980e,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 128bf1c..41a7ec2 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 _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 +var _0x9c54=['request-promise','rimraf','../../config/environment','./interval.attributes','define','Interval','tools_intervals','rewrite','lodash','bluebird'];(function(_0x4647df,_0x135de1){var _0x5c1e9d=function(_0x1b3a09){while(--_0x1b3a09){_0x4647df['push'](_0x4647df['shift']());}};_0x5c1e9d(++_0x135de1);}(_0x9c54,0x120));var _0x49c5=function(_0x25dfdd,_0x26dac7){_0x25dfdd=_0x25dfdd-0x0;var _0x474fba=_0x9c54[_0x25dfdd];return _0x474fba;};'use strict';var _=require(_0x49c5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x49c5('0x1'));var rp=require(_0x49c5('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x49c5('0x3'));var config=require(_0x49c5('0x4'));var attributes=require(_0x49c5('0x5'));var extensions=require('../../components/extensions/rewrite');module['exports']=function(_0x30798b,_0x12795e){return _0x30798b[_0x49c5('0x6')](_0x49c5('0x7'),attributes,{'tableName':_0x49c5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f24e2,_0x4eb7fc){extensions[_0x49c5('0x9')](_0x30798b,_0x2f24e2);},'afterBulkCreate':function(_0x301dae,_0x41c99c,_0x494ff0){_0x494ff0();extensions['rewrite'](_0x30798b,_0x301dae[0x0]);},'afterUpdate':function(_0x2dcce5,_0x49d5c7){extensions[_0x49c5('0x9')](_0x30798b,_0x2dcce5);},'afterDestroy':function(_0x39584f,_0x1ac9af){extensions[_0x49c5('0x9')](_0x30798b,_0x39584f);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 76fda10..1ec0e99 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 _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 +var _0x78ce=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetInterval','Interval','options','raw','where','attributes','include','map','model','debug','stringify','ShowInterval','find','lodash','moment','randomstring'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x78ce,0x1cb));var _0xe78c=function(_0x4c0ebb,_0x1e7eae){_0x4c0ebb=_0x4c0ebb-0x0;var _0xfc4dc1=_0x78ce[_0x4c0ebb];return _0xfc4dc1;};'use strict';var _=require(_0xe78c('0x0'));var util=require('util');var moment=require(_0xe78c('0x1'));var BPromise=require('bluebird');var rs=require(_0xe78c('0x2'));var fs=require('fs');var Redis=require(_0xe78c('0x3'));var db=require(_0xe78c('0x4'))['db'];var utils=require(_0xe78c('0x5'));var logger=require('../../config/logger')(_0xe78c('0x6'));var config=require(_0xe78c('0x7'));var jayson=require(_0xe78c('0x8'));var client=jayson['client'][_0xe78c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x271d53,_0x89d66e,_0x34d6fc){return new BPromise(function(_0x496285,_0x4cfd41){return client[_0xe78c('0xa')](_0x271d53,_0x34d6fc)[_0xe78c('0xb')](function(_0x3efc85){logger[_0xe78c('0xc')](_0xe78c('0xd'),_0x89d66e,_0xe78c('0xe'));logger['debug'](_0xe78c('0xf'),_0x89d66e,_0xe78c('0xe'),JSON['stringify'](_0x3efc85));if(_0x3efc85[_0xe78c('0x10')]){if(_0x3efc85[_0xe78c('0x10')][_0xe78c('0x11')]===0x1f4){logger['error']('Interval,\x20%s,\x20%s',_0x89d66e,_0x3efc85[_0xe78c('0x10')]['message']);return _0x4cfd41(_0x3efc85[_0xe78c('0x10')][_0xe78c('0x12')]);}logger['error'](_0xe78c('0xd'),_0x89d66e,_0x3efc85[_0xe78c('0x10')][_0xe78c('0x12')]);return _0x496285(_0x3efc85[_0xe78c('0x10')]['message']);}else{logger[_0xe78c('0xc')]('Interval,\x20%s,\x20%s',_0x89d66e,'request\x20sent');_0x496285(_0x3efc85['result']['message']);}})[_0xe78c('0x13')](function(_0x493594){logger[_0xe78c('0x10')](_0xe78c('0xd'),_0x89d66e,_0x493594);_0x4cfd41(_0x493594);});});}exports[_0xe78c('0x14')]=function(_0x2993fc){var _0x42f07f=this;return new Promise(function(_0x35915d,_0x1a3a6a){return db[_0xe78c('0x15')]['findAll']({'raw':_0x2993fc['options']?_0x2993fc[_0xe78c('0x16')][_0xe78c('0x17')]===undefined?!![]:![]:!![],'where':_0x2993fc['options']?_0x2993fc[_0xe78c('0x16')][_0xe78c('0x18')]||null:null,'attributes':_0x2993fc[_0xe78c('0x16')]?_0x2993fc[_0xe78c('0x16')][_0xe78c('0x19')]||null:null,'limit':_0x2993fc[_0xe78c('0x16')]?_0x2993fc[_0xe78c('0x16')]['limit']||null:null,'include':_0x2993fc[_0xe78c('0x16')]?_0x2993fc['options'][_0xe78c('0x1a')]?_[_0xe78c('0x1b')](_0x2993fc[_0xe78c('0x16')][_0xe78c('0x1a')],function(_0x378b26){return{'model':db[_0x378b26[_0xe78c('0x1c')]],'as':_0x378b26['as'],'attributes':_0x378b26[_0xe78c('0x19')],'include':_0x378b26[_0xe78c('0x1a')]?_[_0xe78c('0x1b')](_0x378b26['include'],function(_0x36d8ee){return{'model':db[_0x36d8ee[_0xe78c('0x1c')]],'as':_0x36d8ee['as'],'attributes':_0x36d8ee['attributes'],'include':_0x36d8ee[_0xe78c('0x1a')]?_[_0xe78c('0x1b')](_0x36d8ee[_0xe78c('0x1a')],function(_0xa80f08){return{'model':db[_0xa80f08[_0xe78c('0x1c')]],'as':_0xa80f08['as'],'attributes':_0xa80f08[_0xe78c('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe78c('0xb')](function(_0x5b7ff7){logger['info'](_0xe78c('0x14'),_0x2993fc);logger[_0xe78c('0x1d')](_0xe78c('0x14'),_0x2993fc,JSON[_0xe78c('0x1e')](_0x5b7ff7));_0x35915d(_0x5b7ff7);})[_0xe78c('0x13')](function(_0x2e6994){logger[_0xe78c('0x10')]('GetInterval',_0x2e6994[_0xe78c('0x12')],_0x2993fc);_0x1a3a6a(_0x42f07f[_0xe78c('0x10')](0x1f4,_0x2e6994['message']));});});};exports[_0xe78c('0x1f')]=function(_0x5133df){var _0x4ad5de=this;return new Promise(function(_0x31a19d,_0x4f912a){return db[_0xe78c('0x15')][_0xe78c('0x20')]({'raw':_0x5133df['options']?_0x5133df[_0xe78c('0x16')][_0xe78c('0x17')]===undefined?!![]:![]:!![],'where':_0x5133df[_0xe78c('0x16')]?_0x5133df[_0xe78c('0x16')][_0xe78c('0x18')]||null:null,'attributes':_0x5133df[_0xe78c('0x16')]?_0x5133df['options']['attributes']||null:null,'include':_0x5133df['options']?_0x5133df[_0xe78c('0x16')][_0xe78c('0x1a')]?_['map'](_0x5133df[_0xe78c('0x16')][_0xe78c('0x1a')],function(_0x3deb17){return{'model':db[_0x3deb17[_0xe78c('0x1c')]],'as':_0x3deb17['as'],'attributes':_0x3deb17[_0xe78c('0x19')],'include':_0x3deb17['include']?_[_0xe78c('0x1b')](_0x3deb17[_0xe78c('0x1a')],function(_0x3ecd3e){return{'model':db[_0x3ecd3e[_0xe78c('0x1c')]],'as':_0x3ecd3e['as'],'attributes':_0x3ecd3e[_0xe78c('0x19')],'include':_0x3ecd3e['include']?_['map'](_0x3ecd3e[_0xe78c('0x1a')],function(_0x1a3532){return{'model':db[_0x1a3532[_0xe78c('0x1c')]],'as':_0x1a3532['as'],'attributes':_0x1a3532['attributes']};}):[]};}):[]};}):[]:[]})[_0xe78c('0xb')](function(_0x5e5e16){logger[_0xe78c('0xc')]('ShowInterval',_0x5133df);logger[_0xe78c('0x1d')](_0xe78c('0x1f'),_0x5133df,JSON[_0xe78c('0x1e')](_0x5e5e16));_0x31a19d(_0x5e5e16);})['catch'](function(_0x3e5145){logger[_0xe78c('0x10')](_0xe78c('0x1f'),_0x3e5145[_0xe78c('0x12')],_0x5133df);_0x4f912a(_0x4ad5de['error'](0x1f4,_0x3e5145[_0xe78c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 3a2f93d..f2a99bb 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 _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 +var _0x6c14=['../../components/auth/service','./jira.controller','post','send','Router'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x6c14,0x1ad));var _0x46c1=function(_0x1d6b5e,_0x28203d){_0x1d6b5e=_0x1d6b5e-0x0;var _0x29adbc=_0x6c14[_0x1d6b5e];return _0x29adbc;};'use strict';var express=require('express');var router=express[_0x46c1('0x0')]();var auth=require(_0x46c1('0x1'));var controller=require(_0x46c1('0x2'));router[_0x46c1('0x3')]('/',auth['isAuthenticated'](),controller[_0x46c1('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 7326ebd..5a39afd 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 _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 +var _0x43c2=['write','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','support','3eAmWpBVP0','key','summary','Report','stringify','issuetype','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira'];(function(_0x5011f5,_0x92181b){var _0x2b0e3f=function(_0x47393c){while(--_0x47393c){_0x5011f5['push'](_0x5011f5['shift']());}};_0x2b0e3f(++_0x92181b);}(_0x43c2,0x65));var _0x243c=function(_0x325484,_0x4efa87){_0x325484=_0x325484-0x0;var _0x34b37a=_0x43c2[_0x325484];return _0x34b37a;};'use strict';var BPromise=require(_0x243c('0x0'));var https=require(_0x243c('0x1'));var logger=require('../../config/logger')('api');var USERNAME=_0x243c('0x2');var PASSWORD=_0x243c('0x3');function openIssue(_0x274bb6,_0x2d538a){var _0xce71eb={'fields':{'project':{'key':_0x274bb6[_0x243c('0x4')]||'MOTGUI'},'summary':(_0x274bb6[_0x243c('0x5')]||_0x243c('0x6'))+'\x20from\x20'+_0x274bb6['ip'],'description':_0x274bb6['description']||JSON[_0x243c('0x7')](_0x274bb6),'issuetype':{'name':_0x274bb6[_0x243c('0x8')]||'Bug'}}};_0xce71eb[_0x243c('0x9')][_0x243c('0xa')]=_0x274bb6[_0x243c('0xb')];_0xce71eb['fields'][_0x243c('0xc')]=_0x274bb6[_0x243c('0xd')];_0xce71eb[_0x243c('0x9')][_0x243c('0xe')]=_0x274bb6[_0x243c('0xf')];_0xce71eb[_0x243c('0x9')][_0x243c('0x10')]=_0x274bb6['name'];_0xce71eb[_0x243c('0x9')][_0x243c('0x11')]=_0x274bb6[_0x243c('0x12')];_0xce71eb[_0x243c('0x9')][_0x243c('0x13')]=_0x274bb6['ip'];var _0x2dc3cb={'host':_0x243c('0x14'),'port':0x1bb,'path':_0x243c('0x15'),'method':_0x243c('0x16'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x243c('0x17')](_0x243c('0x18'))}};var _0x28ccdf=JSON[_0x243c('0x7')](_0xce71eb);var _0x2e8e00=https[_0x243c('0x19')](_0x2dc3cb,function(_0x47cf5c){_0x47cf5c[_0x243c('0x1a')](_0x243c('0x1b'));var _0x55230b='';_0x47cf5c['on'](_0x243c('0x1c'),function(_0x22aa59){_0x55230b+=_0x22aa59;});_0x47cf5c['on'](_0x243c('0x1d'),function(){if(_0x2d538a){return _0x2d538a[_0x243c('0x1e')](_0x47cf5c[_0x243c('0x1f')])[_0x243c('0x20')](JSON[_0x243c('0x21')](_0x55230b));}});});_0x2e8e00['on'](_0x243c('0x22'),function(_0x26a505){if(_0x2d538a){return _0x2d538a[_0x243c('0x1e')](0x1f4)[_0x243c('0x20')]({'errors':[{'message':_0x243c('0x23'),'type':_0x243c('0x24')}]});}});_0x2e8e00[_0x243c('0x25')](_0x28ccdf);_0x2e8e00[_0x243c('0x1d')]();}exports[_0x243c('0x26')]=openIssue;exports[_0x243c('0x27')]=function(_0x5d7dfc,_0x51ada1){_0x5d7dfc[_0x243c('0x28')]['ip']=_0x5d7dfc[_0x243c('0x29')][_0x243c('0x2a')]||_0x5d7dfc[_0x243c('0x2b')]['remoteAddress']||_0x5d7dfc[_0x243c('0x2c')]['remoteAddress']||_0x5d7dfc[_0x243c('0x2b')][_0x243c('0x2c')][_0x243c('0x2d')];return openIssue(_0x5d7dfc[_0x243c('0x28')],_0x51ada1);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index b5c22af..58d8b56 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 _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 +var _0x2393=['get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2393,0x116));var _0x3239=function(_0x4489f2,_0x1f9128){_0x4489f2=_0x4489f2-0x0;var _0x5cc527=_0x2393[_0x4489f2];return _0x5cc527;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3239('0x0'));var timeout=require(_0x3239('0x1'));var express=require(_0x3239('0x2'));var router=express['Router']();var auth=require(_0x3239('0x3'));var interaction=require(_0x3239('0x4'));var config=require(_0x3239('0x5'));var controller=require(_0x3239('0x6'));router[_0x3239('0x7')]('/',auth[_0x3239('0x8')](),controller[_0x3239('0x9')]);router[_0x3239('0x7')](_0x3239('0xa'),auth[_0x3239('0x8')](),controller[_0x3239('0xb')]);router[_0x3239('0x7')](_0x3239('0xc'),auth['isAuthenticated'](),controller[_0x3239('0xd')]);router[_0x3239('0xe')]('/',auth[_0x3239('0x8')](),controller['create']);router[_0x3239('0xf')](_0x3239('0xc'),auth[_0x3239('0x8')](),controller[_0x3239('0x10')]);router[_0x3239('0x11')](_0x3239('0xc'),auth[_0x3239('0x8')](),controller[_0x3239('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 29fd7cd..ba346d4 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 _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 +var _0x1ba2=['sequelize','TEXT','long','STRING'];(function(_0x53b9ef,_0x296c4c){var _0x2114c0=function(_0x54de6b){while(--_0x54de6b){_0x53b9ef['push'](_0x53b9ef['shift']());}};_0x2114c0(++_0x296c4c);}(_0x1ba2,0xb4));var _0x21ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ba2[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x21ba('0x0'));module['exports']={'question':{'type':Sequelize[_0x21ba('0x1')]},'answer':{'type':Sequelize['TEXT'](_0x21ba('0x2'))},'membername':{'type':Sequelize[_0x21ba('0x3')]},'projectname':{'type':Sequelize[_0x21ba('0x3')]},'queue':{'type':Sequelize[_0x21ba('0x3')]},'uniqueid':{'type':Sequelize[_0x21ba('0x3')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x21ba('0x3')]},'questionId':{'type':Sequelize[_0x21ba('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 1229b9e..05b975a 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 _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 +var _0x2c73=['include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','mustache','sox','ejs','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll'];(function(_0x232448,_0x345d3c){var _0xd3fe66=function(_0x3cc930){while(--_0x3cc930){_0x232448['push'](_0x232448['shift']());}};_0xd3fe66(++_0x345d3c);}(_0x2c73,0xdf));var _0x32c7=function(_0x104f61,_0x407853){_0x104f61=_0x104f61-0x0;var _0x3fad72=_0x2c73[_0x104f61];return _0x3fad72;};'use strict';var pdf=require(_0x32c7('0x0'));var emlformat=require(_0x32c7('0x1'));var rimraf=require(_0x32c7('0x2'));var zipdir=require(_0x32c7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x32c7('0x4'));var util=require('util');var path=require('path');var sox=require(_0x32c7('0x5'));var csv=require('to-csv');var ejs=require(_0x32c7('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x32c7('0x7'));var crypto=require(_0x32c7('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x32c7('0x9'));var toCsv=require(_0x32c7('0xa'));var querystring=require(_0x32c7('0xb'));var Papa=require('papaparse');var Redis=require(_0x32c7('0xc'));var authService=require(_0x32c7('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32c7('0xe'));var logger=require(_0x32c7('0xf'))(_0x32c7('0x10'));var utils=require(_0x32c7('0x11'));var config=require(_0x32c7('0x12'));var licenseUtil=require(_0x32c7('0x13'));var db=require(_0x32c7('0x14'))['db'];function respondWithStatusCode(_0x33d1ae,_0x149715){_0x149715=_0x149715||0xcc;return function(_0x2cf160){if(_0x2cf160){return _0x33d1ae['sendStatus'](_0x149715);}return _0x33d1ae[_0x32c7('0x15')](_0x149715)[_0x32c7('0x16')]();};}function respondWithResult(_0x4c2f18,_0x1e8453){_0x1e8453=_0x1e8453||0xc8;return function(_0x706b60){if(_0x706b60){return _0x4c2f18[_0x32c7('0x15')](_0x1e8453)['json'](_0x706b60);}};}function respondWithFilteredResult(_0x1d1cc7,_0xa160a1){return function(_0x20e898){if(_0x20e898){var _0x3a4737=_0x20e898['count'],_0x18556c=_0xa160a1[_0x32c7('0x17')],_0x1ccf23=_0xa160a1[_0x32c7('0x17')]+_0xa160a1[_0x32c7('0x18')],_0x10a0a3;if(_0x1ccf23>=_0x3a4737){_0x1ccf23=_0x3a4737;_0x10a0a3=0xc8;}else{_0x10a0a3=0xce;}_0x1d1cc7[_0x32c7('0x15')](_0x10a0a3);return _0x1d1cc7[_0x32c7('0x19')](_0x32c7('0x1a'),_0x18556c+'-'+_0x1ccf23+'/'+_0x3a4737)[_0x32c7('0x1b')](_0x20e898);}return null;};}function patchUpdates(_0x366ce0){return function(_0x51f5d9){try{jsonpatch[_0x32c7('0x1c')](_0x51f5d9,_0x366ce0,!![]);}catch(_0x46fcf5){return BPromise[_0x32c7('0x1d')](_0x46fcf5);}return _0x51f5d9['save']();};}function saveUpdates(_0x49a819,_0x2602fa){return function(_0x574ee9){if(_0x574ee9){return _0x574ee9[_0x32c7('0x1e')](_0x49a819)[_0x32c7('0x1f')](function(_0x1a6ebe){return _0x1a6ebe;});}return null;};}function removeEntity(_0x412edf,_0x1b00d0){return function(_0x3ec545){if(_0x3ec545){return _0x3ec545['destroy']()['then'](function(){_0x412edf[_0x32c7('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44248d,_0x2d2acf){return function(_0x5d64c9){if(!_0x5d64c9){_0x44248d['sendStatus'](0x194);}return _0x5d64c9;};}function handleError(_0x532cad,_0x2077e0){_0x2077e0=_0x2077e0||0x1f4;return function(_0x37880d){logger[_0x32c7('0x20')](_0x37880d[_0x32c7('0x21')]);if(_0x37880d[_0x32c7('0x22')]){delete _0x37880d['name'];}_0x532cad[_0x32c7('0x15')](_0x2077e0)[_0x32c7('0x23')](_0x37880d);};}exports[_0x32c7('0x24')]=function(_0x5c5a2a,_0x334eec){var _0xc39fe2={},_0x5eefe7={},_0x2a4b1f={'count':0x0,'rows':[]};var _0xe2e0e6=_[_0x32c7('0x25')](db[_0x32c7('0x26')][_0x32c7('0x27')],function(_0x23423b){return{'name':_0x23423b[_0x32c7('0x28')],'type':_0x23423b[_0x32c7('0x29')][_0x32c7('0x2a')]};});_0x5eefe7[_0x32c7('0x2b')]=_['map'](_0xe2e0e6,'name');_0x5eefe7[_0x32c7('0x2c')]=_[_0x32c7('0x2d')](_0x5c5a2a[_0x32c7('0x2c')]);_0x5eefe7[_0x32c7('0x2e')]=_[_0x32c7('0x2f')](_0x5eefe7[_0x32c7('0x2b')],_0x5eefe7[_0x32c7('0x2c')]);_0xc39fe2['attributes']=_[_0x32c7('0x2f')](_0x5eefe7['model'],qs[_0x32c7('0x30')](_0x5c5a2a[_0x32c7('0x2c')][_0x32c7('0x30')]));_0xc39fe2[_0x32c7('0x31')]=_0xc39fe2[_0x32c7('0x31')][_0x32c7('0x32')]?_0xc39fe2[_0x32c7('0x31')]:_0x5eefe7[_0x32c7('0x2b')];if(!_0x5c5a2a['query']['hasOwnProperty'](_0x32c7('0x33'))){_0xc39fe2[_0x32c7('0x18')]=qs[_0x32c7('0x18')](_0x5c5a2a['query'][_0x32c7('0x18')]);_0xc39fe2[_0x32c7('0x17')]=qs['offset'](_0x5c5a2a[_0x32c7('0x2c')][_0x32c7('0x17')]);}_0xc39fe2[_0x32c7('0x34')]=qs['sort'](_0x5c5a2a[_0x32c7('0x2c')][_0x32c7('0x35')]);_0xc39fe2[_0x32c7('0x36')]=qs[_0x32c7('0x2e')](_['pick'](_0x5c5a2a[_0x32c7('0x2c')],_0x5eefe7[_0x32c7('0x2e')]),_0xe2e0e6);if(_0x5c5a2a[_0x32c7('0x2c')][_0x32c7('0x37')]){_0xc39fe2[_0x32c7('0x36')]=_[_0x32c7('0x38')](_0xc39fe2[_0x32c7('0x36')],{'$or':_[_0x32c7('0x25')](_0xe2e0e6,function(_0x184b69){if(_0x184b69[_0x32c7('0x29')]!==_0x32c7('0x39')){var _0x337e65={};_0x337e65[_0x184b69['name']]={'$like':'%'+_0x5c5a2a[_0x32c7('0x2c')][_0x32c7('0x37')]+'%'};return _0x337e65;}})});}_0xc39fe2=_[_0x32c7('0x38')]({},_0xc39fe2,_0x5c5a2a[_0x32c7('0x3a')]);var _0x203248={'where':_0xc39fe2[_0x32c7('0x36')]};return db['JscriptyAnswerReport'][_0x32c7('0x3b')](_0x203248)['then'](function(_0x256b36){_0x2a4b1f[_0x32c7('0x3b')]=_0x256b36;if(_0x5c5a2a['query'][_0x32c7('0x3c')]){_0xc39fe2[_0x32c7('0x3d')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x32c7('0x3e')](_0xc39fe2);})['then'](function(_0x5c1447){_0x2a4b1f[_0x32c7('0x3f')]=_0x5c1447;return _0x2a4b1f;})[_0x32c7('0x1f')](respondWithFilteredResult(_0x334eec,_0xc39fe2))[_0x32c7('0x40')](handleError(_0x334eec,null));};exports[_0x32c7('0x41')]=function(_0x466a8a,_0x484d05){var _0x3b3cd5={'raw':!![],'where':{'id':_0x466a8a[_0x32c7('0x42')]['id']}},_0x1deef4={};_0x1deef4[_0x32c7('0x2b')]=_[_0x32c7('0x2d')](db[_0x32c7('0x26')]['rawAttributes']);_0x1deef4[_0x32c7('0x2c')]=_[_0x32c7('0x2d')](_0x466a8a[_0x32c7('0x2c')]);_0x1deef4[_0x32c7('0x2e')]=_[_0x32c7('0x2f')](_0x1deef4[_0x32c7('0x2b')],_0x1deef4[_0x32c7('0x2c')]);_0x3b3cd5[_0x32c7('0x31')]=_[_0x32c7('0x2f')](_0x1deef4['model'],qs[_0x32c7('0x30')](_0x466a8a[_0x32c7('0x2c')][_0x32c7('0x30')]));_0x3b3cd5[_0x32c7('0x31')]=_0x3b3cd5['attributes']['length']?_0x3b3cd5[_0x32c7('0x31')]:_0x1deef4[_0x32c7('0x2b')];if(_0x466a8a[_0x32c7('0x2c')][_0x32c7('0x3c')]){_0x3b3cd5[_0x32c7('0x3d')]=[{'all':!![]}];}_0x3b3cd5=_[_0x32c7('0x38')]({},_0x3b3cd5,_0x466a8a[_0x32c7('0x3a')]);return db[_0x32c7('0x26')][_0x32c7('0x43')](_0x3b3cd5)['then'](handleEntityNotFound(_0x484d05,null))['then'](respondWithResult(_0x484d05,null))[_0x32c7('0x40')](handleError(_0x484d05,null));};exports['create']=function(_0x13e952,_0x5d720d){return db[_0x32c7('0x26')][_0x32c7('0x44')](_0x13e952[_0x32c7('0x45')],{})['then'](respondWithResult(_0x5d720d,0xc9))[_0x32c7('0x40')](handleError(_0x5d720d,null));};exports[_0x32c7('0x1e')]=function(_0x4c8cc3,_0x4803bf){if(_0x4c8cc3[_0x32c7('0x45')]['id']){delete _0x4c8cc3['body']['id'];}return db[_0x32c7('0x26')]['find']({'where':{'id':_0x4c8cc3[_0x32c7('0x42')]['id']}})[_0x32c7('0x1f')](handleEntityNotFound(_0x4803bf,null))[_0x32c7('0x1f')](saveUpdates(_0x4c8cc3[_0x32c7('0x45')],null))[_0x32c7('0x1f')](respondWithResult(_0x4803bf,null))[_0x32c7('0x40')](handleError(_0x4803bf,null));};exports['destroy']=function(_0x2bde82,_0x3008d3){return db[_0x32c7('0x26')][_0x32c7('0x43')]({'where':{'id':_0x2bde82[_0x32c7('0x42')]['id']}})[_0x32c7('0x1f')](handleEntityNotFound(_0x3008d3,null))[_0x32c7('0x1f')](removeEntity(_0x3008d3,null))[_0x32c7('0x40')](handleError(_0x3008d3,null));};exports[_0x32c7('0x46')]=function(_0x49f03d,_0xac8557){return db[_0x32c7('0x26')][_0x32c7('0x46')]()[_0x32c7('0x1f')](respondWithResult(_0xac8557,null))[_0x32c7('0x40')](handleError(_0xac8557,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 6896d42..0bcb127 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 _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 +var _0xab7c=['bluebird','request-promise','path','rimraf','../../config/environment','define','JscriptyAnswerReport','util','api'];(function(_0x1a8ff0,_0x20788d){var _0x3588bf=function(_0x3b5499){while(--_0x3b5499){_0x1a8ff0['push'](_0x1a8ff0['shift']());}};_0x3588bf(++_0x20788d);}(_0xab7c,0x193));var _0xcab7=function(_0x4ecf53,_0xe1399b){_0x4ecf53=_0x4ecf53-0x0;var _0x49e3be=_0xab7c[_0x4ecf53];return _0x49e3be;};'use strict';var _=require('lodash');var util=require(_0xcab7('0x0'));var logger=require('../../config/logger')(_0xcab7('0x1'));var moment=require('moment');var BPromise=require(_0xcab7('0x2'));var rp=require(_0xcab7('0x3'));var fs=require('fs');var path=require(_0xcab7('0x4'));var rimraf=require(_0xcab7('0x5'));var config=require(_0xcab7('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x4689f1,_0xd1ece9){return _0x4689f1[_0xcab7('0x7')](_0xcab7('0x8'),attributes,{'tableName':'report_jscripty_answers','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 171c296..c2813db 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 _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 +var _0xab73=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','info','result','catch'];(function(_0x37775c,_0x28d5d0){var _0x2d5ef0=function(_0x18b746){while(--_0x18b746){_0x37775c['push'](_0x37775c['shift']());}};_0x2d5ef0(++_0x28d5d0);}(_0xab73,0x114));var _0x3ab7=function(_0x41ee16,_0x555af5){_0x41ee16=_0x41ee16-0x0;var _0x1d1eb8=_0xab73[_0x41ee16];return _0x1d1eb8;};'use strict';var _=require(_0x3ab7('0x0'));var util=require('util');var moment=require(_0x3ab7('0x1'));var BPromise=require(_0x3ab7('0x2'));var rs=require(_0x3ab7('0x3'));var fs=require('fs');var Redis=require(_0x3ab7('0x4'));var db=require(_0x3ab7('0x5'))['db'];var utils=require(_0x3ab7('0x6'));var logger=require(_0x3ab7('0x7'))(_0x3ab7('0x8'));var config=require(_0x3ab7('0x9'));var jayson=require(_0x3ab7('0xa'));var client=jayson[_0x3ab7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ab93b,_0x2cf926,_0x118389){return new BPromise(function(_0x3a3f06,_0x2145bb){return client[_0x3ab7('0xc')](_0x3ab93b,_0x118389)[_0x3ab7('0xd')](function(_0x532b4e){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x2cf926,_0x3ab7('0xe'));logger['debug'](_0x3ab7('0xf'),_0x2cf926,_0x3ab7('0xe'),JSON['stringify'](_0x532b4e));if(_0x532b4e['error']){if(_0x532b4e[_0x3ab7('0x10')][_0x3ab7('0x11')]===0x1f4){logger[_0x3ab7('0x10')](_0x3ab7('0x12'),_0x2cf926,_0x532b4e[_0x3ab7('0x10')]['message']);return _0x2145bb(_0x532b4e[_0x3ab7('0x10')][_0x3ab7('0x13')]);}logger['error'](_0x3ab7('0x12'),_0x2cf926,_0x532b4e[_0x3ab7('0x10')][_0x3ab7('0x13')]);return _0x3a3f06(_0x532b4e[_0x3ab7('0x10')][_0x3ab7('0x13')]);}else{logger[_0x3ab7('0x14')](_0x3ab7('0x12'),_0x2cf926,_0x3ab7('0xe'));_0x3a3f06(_0x532b4e[_0x3ab7('0x15')][_0x3ab7('0x13')]);}})[_0x3ab7('0x16')](function(_0x5d343d){logger[_0x3ab7('0x10')](_0x3ab7('0x12'),_0x2cf926,_0x5d343d);_0x2145bb(_0x5d343d);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index f8698dd..39c39a6 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 _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 +var _0x908e=['../../components/interaction/service','./jscriptyProject.controller','index','get','/:id','isAuthenticated','show','/:id/answers','/:id/summary','30s','getSummary','post','create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x154ae4,_0x112230){var _0x1c30d0=function(_0x110a97){while(--_0x110a97){_0x154ae4['push'](_0x154ae4['shift']());}};_0x1c30d0(++_0x112230);}(_0x908e,0x182));var _0xe908=function(_0x41868e,_0x30f9a6){_0x41868e=_0x41868e-0x0;var _0x27b68e=_0x908e[_0x41868e];return _0x27b68e;};'use strict';var multer=require(_0xe908('0x0'));var util=require(_0xe908('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe908('0x2'));var router=express[_0xe908('0x3')]();var auth=require(_0xe908('0x4'));var interaction=require(_0xe908('0x5'));var config=require('../../config/environment');var controller=require(_0xe908('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xe908('0x7')]);router[_0xe908('0x8')](_0xe908('0x9'),auth[_0xe908('0xa')](),controller[_0xe908('0xb')]);router[_0xe908('0x8')]('/:id/sessions',auth[_0xe908('0xa')](),controller['getSessions']);router[_0xe908('0x8')](_0xe908('0xc'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xe908('0x8')](_0xe908('0xd'),auth[_0xe908('0xa')](),timeout(_0xe908('0xe')),controller[_0xe908('0xf')]);router[_0xe908('0x10')]('/',auth[_0xe908('0xa')](),controller[_0xe908('0x11')]);router['post']('/:id/clone',auth[_0xe908('0xa')](),controller['clone']);router[_0xe908('0x12')](_0xe908('0x9'),auth[_0xe908('0xa')](),controller[_0xe908('0x13')]);router[_0xe908('0x14')]('/:id',auth[_0xe908('0xa')](),controller[_0xe908('0x15')]);module[_0xe908('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index b0458a1..6385539 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 _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 +var _0xd4db=['description','BOOLEAN','lodash','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x17f145,_0x3422bb){var _0x2d5420=function(_0x3eb38b){while(--_0x3eb38b){_0x17f145['push'](_0x17f145['shift']());}};_0x2d5420(++_0x3422bb);}(_0xd4db,0x11a));var _0xbd4d=function(_0x367239,_0x3e1ab0){_0x367239=_0x367239-0x0;var _0x27c83d=_0xd4db[_0x367239];return _0x27c83d;};'use strict';var Sequelize=require('sequelize');var _=require(_0xbd4d('0x0'));var util=require('util');module['exports']={'name':{'type':Sequelize[_0xbd4d('0x1')],'unique':_0xbd4d('0x2')},'description':{'type':Sequelize[_0xbd4d('0x1')]},'formData':{'type':Sequelize[_0xbd4d('0x3')](_0xbd4d('0x4')),'set':function(_0x2b445c){if(_[_0xbd4d('0x5')](_0x2b445c)){this[_0xbd4d('0x6')](_0xbd4d('0x7'),JSON['stringify'](_0x2b445c));}else if(_[_0xbd4d('0x8')](_0x2b445c)){this[_0xbd4d('0x6')](_0xbd4d('0x7'),_0x2b445c);}else{this[_0xbd4d('0x6')]('formData',util[_0xbd4d('0x9')](_0xbd4d('0xa'),this[_0xbd4d('0xb')](_0xbd4d('0x2'))||'',this['getDataValue'](_0xbd4d('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xbd4d('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 96f62b0..7add17c 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 _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 +var _0x9bc9=['count','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','Projects','autoAssociation','update','findOne','JscriptySessionReport','JscriptyAnswerReport','ProjectId','number','toString','indexOf','replace','getSummary','startTime','starttime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','text/csv','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','limit','reject','destroy','get','UserProfileResource','then','end','sendStatus','error','name','send','JscriptyProject','rawAttributes','fieldName','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options'];(function(_0x3e1226,_0x4199d6){var _0x1ff634=function(_0x4dbed0){while(--_0x4dbed0){_0x3e1226['push'](_0x3e1226['shift']());}};_0x1ff634(++_0x4199d6);}(_0x9bc9,0x183));var _0x99bc=function(_0x5e5424,_0x1c70b7){_0x5e5424=_0x5e5424-0x0;var _0x356d76=_0x9bc9[_0x5e5424];return _0x356d76;};'use strict';var pdf=require(_0x99bc('0x0'));var emlformat=require(_0x99bc('0x1'));var rimraf=require(_0x99bc('0x2'));var zipdir=require(_0x99bc('0x3'));var jsonpatch=require(_0x99bc('0x4'));var rp=require(_0x99bc('0x5'));var moment=require('moment');var BPromise=require(_0x99bc('0x6'));var Mustache=require(_0x99bc('0x7'));var util=require(_0x99bc('0x8'));var path=require(_0x99bc('0x9'));var sox=require(_0x99bc('0xa'));var csv=require('to-csv');var ejs=require(_0x99bc('0xb'));var fs=require('fs');var _=require(_0x99bc('0xc'));var squel=require(_0x99bc('0xd'));var crypto=require('crypto');var jsforce=require(_0x99bc('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x99bc('0xf'));var Papa=require(_0x99bc('0x10'));var Redis=require(_0x99bc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x99bc('0x12'));var as=require(_0x99bc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99bc('0x14'))(_0x99bc('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x99bc('0x16'));var db=require(_0x99bc('0x17'))['db'];function respondWithStatusCode(_0x47c68a,_0x373ab4){_0x373ab4=_0x373ab4||0xcc;return function(_0x4d8c76){if(_0x4d8c76){return _0x47c68a['sendStatus'](_0x373ab4);}return _0x47c68a[_0x99bc('0x18')](_0x373ab4)['end']();};}function respondWithResult(_0x9b5ca4,_0x2bf50b){_0x2bf50b=_0x2bf50b||0xc8;return function(_0xe6b005){if(_0xe6b005){return _0x9b5ca4[_0x99bc('0x18')](_0x2bf50b)[_0x99bc('0x19')](_0xe6b005);}};}function respondWithFilteredResult(_0x1275d9,_0x1cb8c1){return function(_0x2773cd){if(_0x2773cd){var _0xa8b23d=_0x2773cd['count'],_0x30ee7a=_0x1cb8c1['offset'],_0x63765e=_0x1cb8c1[_0x99bc('0x1a')]+_0x1cb8c1[_0x99bc('0x1b')],_0x2ff21a;if(_0x63765e>=_0xa8b23d){_0x63765e=_0xa8b23d;_0x2ff21a=0xc8;}else{_0x2ff21a=0xce;}_0x1275d9[_0x99bc('0x18')](_0x2ff21a);return _0x1275d9['set']('Content-Range',_0x30ee7a+'-'+_0x63765e+'/'+_0xa8b23d)[_0x99bc('0x19')](_0x2773cd);}return null;};}function patchUpdates(_0x1c7a14){return function(_0x54f6b6){try{jsonpatch['apply'](_0x54f6b6,_0x1c7a14,!![]);}catch(_0x53a640){return BPromise[_0x99bc('0x1c')](_0x53a640);}return _0x54f6b6['save']();};}function saveUpdates(_0x53dfff,_0x18298f){return function(_0x4b1ad4){if(_0x4b1ad4){return _0x4b1ad4['update'](_0x53dfff)['then'](function(_0x470813){return _0x470813;});}return null;};}function removeEntity(_0x281b55,_0x368fd0){return function(_0x3fa73b){if(_0x3fa73b){return _0x3fa73b[_0x99bc('0x1d')]()['then'](function(){var _0x368662=_0x3fa73b[_0x99bc('0x1e')]({'plain':!![]});var _0x15549e='Projects';return db[_0x99bc('0x1f')]['destroy']({'where':{'type':_0x15549e,'resourceId':_0x368662['id']}})['then'](function(){return _0x3fa73b;});})[_0x99bc('0x20')](function(){_0x281b55[_0x99bc('0x18')](0xcc)[_0x99bc('0x21')]();});}};}function handleEntityNotFound(_0x3ea103,_0x52f0d7){return function(_0x2a556d){if(!_0x2a556d){_0x3ea103[_0x99bc('0x22')](0x194);}return _0x2a556d;};}function handleError(_0x1a2bf0,_0x24b46c){_0x24b46c=_0x24b46c||0x1f4;return function(_0x46d392){logger[_0x99bc('0x23')](_0x46d392['stack']);if(_0x46d392['name']){delete _0x46d392[_0x99bc('0x24')];}_0x1a2bf0[_0x99bc('0x18')](_0x24b46c)[_0x99bc('0x25')](_0x46d392);};}exports['index']=function(_0x3fa75d,_0x8b9eb5){var _0x3942d5={},_0x350003={},_0xfcaa9d={'count':0x0,'rows':[]};var _0x3b2a63=_['map'](db[_0x99bc('0x26')][_0x99bc('0x27')],function(_0x36b591){return{'name':_0x36b591[_0x99bc('0x28')],'type':_0x36b591['type']['key']};});_0x350003['model']=_[_0x99bc('0x29')](_0x3b2a63,'name');_0x350003[_0x99bc('0x2a')]=_[_0x99bc('0x2b')](_0x3fa75d[_0x99bc('0x2a')]);_0x350003['filters']=_[_0x99bc('0x2c')](_0x350003[_0x99bc('0x2d')],_0x350003[_0x99bc('0x2a')]);_0x3942d5[_0x99bc('0x2e')]=_['intersection'](_0x350003[_0x99bc('0x2d')],qs[_0x99bc('0x2f')](_0x3fa75d['query']['fields']));_0x3942d5[_0x99bc('0x2e')]=_0x3942d5['attributes'][_0x99bc('0x30')]?_0x3942d5['attributes']:_0x350003[_0x99bc('0x2d')];if(!_0x3fa75d[_0x99bc('0x2a')][_0x99bc('0x31')](_0x99bc('0x32'))){_0x3942d5[_0x99bc('0x1b')]=qs[_0x99bc('0x1b')](_0x3fa75d[_0x99bc('0x2a')][_0x99bc('0x1b')]);_0x3942d5[_0x99bc('0x1a')]=qs[_0x99bc('0x1a')](_0x3fa75d[_0x99bc('0x2a')][_0x99bc('0x1a')]);}_0x3942d5[_0x99bc('0x33')]=qs[_0x99bc('0x34')](_0x3fa75d[_0x99bc('0x2a')][_0x99bc('0x34')]);_0x3942d5[_0x99bc('0x35')]=qs[_0x99bc('0x36')](_[_0x99bc('0x37')](_0x3fa75d[_0x99bc('0x2a')],_0x350003['filters']),_0x3b2a63);if(_0x3fa75d[_0x99bc('0x2a')][_0x99bc('0x38')]){_0x3942d5[_0x99bc('0x35')]=_[_0x99bc('0x39')](_0x3942d5[_0x99bc('0x35')],{'$or':_[_0x99bc('0x29')](_0x3b2a63,function(_0x2595d9){if(_0x2595d9[_0x99bc('0x3a')]!==_0x99bc('0x3b')){var _0x262347={};_0x262347[_0x2595d9[_0x99bc('0x24')]]={'$like':'%'+_0x3fa75d[_0x99bc('0x2a')][_0x99bc('0x38')]+'%'};return _0x262347;}})});}_0x3942d5=_[_0x99bc('0x39')]({},_0x3942d5,_0x3fa75d[_0x99bc('0x3c')]);var _0x441f70={'where':_0x3942d5[_0x99bc('0x35')]};return db['JscriptyProject'][_0x99bc('0x3d')](_0x441f70)['then'](function(_0x129d03){_0xfcaa9d['count']=_0x129d03;if(_0x3fa75d[_0x99bc('0x2a')][_0x99bc('0x3e')]){_0x3942d5[_0x99bc('0x3f')]=[{'all':!![]}];}return db['JscriptyProject'][_0x99bc('0x40')](_0x3942d5);})[_0x99bc('0x20')](function(_0x193250){_0xfcaa9d[_0x99bc('0x41')]=_0x193250;return _0xfcaa9d;})[_0x99bc('0x20')](respondWithFilteredResult(_0x8b9eb5,_0x3942d5))[_0x99bc('0x42')](handleError(_0x8b9eb5,null));};exports[_0x99bc('0x43')]=function(_0x334b2a,_0xecb54f){var _0x24b641={'raw':![],'where':{'id':_0x334b2a[_0x99bc('0x44')]['id']}},_0x2216d1={};_0x2216d1['model']=_[_0x99bc('0x2b')](db[_0x99bc('0x26')][_0x99bc('0x27')]);_0x2216d1['query']=_['keys'](_0x334b2a[_0x99bc('0x2a')]);_0x2216d1[_0x99bc('0x36')]=_[_0x99bc('0x2c')](_0x2216d1[_0x99bc('0x2d')],_0x2216d1[_0x99bc('0x2a')]);_0x24b641[_0x99bc('0x2e')]=_[_0x99bc('0x2c')](_0x2216d1['model'],qs[_0x99bc('0x2f')](_0x334b2a[_0x99bc('0x2a')][_0x99bc('0x2f')]));_0x24b641[_0x99bc('0x2e')]=_0x24b641['attributes'][_0x99bc('0x30')]?_0x24b641[_0x99bc('0x2e')]:_0x2216d1[_0x99bc('0x2d')];if(_0x334b2a[_0x99bc('0x2a')]['includeAll']){_0x24b641[_0x99bc('0x3f')]=[{'all':!![]}];}_0x24b641=_['merge']({},_0x24b641,_0x334b2a[_0x99bc('0x3c')]);return db['JscriptyProject'][_0x99bc('0x45')](_0x24b641)['then'](handleEntityNotFound(_0xecb54f,null))[_0x99bc('0x20')](respondWithResult(_0xecb54f,null))[_0x99bc('0x42')](handleError(_0xecb54f,null));};exports[_0x99bc('0x46')]=function(_0xdb2475,_0x47a9df){return db[_0x99bc('0x26')][_0x99bc('0x46')](_0xdb2475['body'],{})[_0x99bc('0x20')](function(_0x21f40a){var _0x1f961f=_0xdb2475[_0x99bc('0x47')][_0x99bc('0x1e')]({'plain':!![]});if(!_0x1f961f)throw new Error(_0x99bc('0x48'));if(_0x1f961f[_0x99bc('0x49')]==='user'){var _0x2630c1=_0x21f40a[_0x99bc('0x1e')]({'plain':!![]});var _0x2b25bc='Projects';return db[_0x99bc('0x4a')][_0x99bc('0x45')]({'where':{'name':_0x2b25bc,'userProfileId':_0x1f961f[_0x99bc('0x4b')]},'raw':!![]})[_0x99bc('0x20')](function(_0x1df898){if(_0x1df898&&_0x1df898['autoAssociation']===0x0){return db[_0x99bc('0x1f')]['create']({'name':_0x2630c1['name'],'resourceId':_0x2630c1['id'],'type':_0x1df898[_0x99bc('0x24')],'sectionId':_0x1df898['id']},{})['then'](function(){return _0x21f40a;});}else{return _0x21f40a;}})[_0x99bc('0x42')](function(_0x4b988a){logger[_0x99bc('0x23')](_0x99bc('0x4c'),_0x4b988a);throw _0x4b988a;});}return _0x21f40a;})[_0x99bc('0x20')](respondWithResult(_0x47a9df,0xc9))['catch'](handleError(_0x47a9df,null));};exports[_0x99bc('0x4d')]=function(_0x49bec1,_0x2b5179){var _0x139d33={'where':{'id':_0x49bec1[_0x99bc('0x44')]['id']}},_0x4d9c80={};_0x4d9c80[_0x99bc('0x2d')]=_[_0x99bc('0x2b')](db[_0x99bc('0x26')][_0x99bc('0x27')]);_0x139d33[_0x99bc('0x2e')]=_['intersection'](_0x4d9c80['model'],qs[_0x99bc('0x2f')](_0x49bec1['query'][_0x99bc('0x2f')]));_0x139d33['attributes']=_0x139d33[_0x99bc('0x2e')][_0x99bc('0x30')]?_0x139d33[_0x99bc('0x2e')]:_0x4d9c80[_0x99bc('0x2d')];if(_0x49bec1[_0x99bc('0x2a')][_0x99bc('0x3e')]){_0x139d33[_0x99bc('0x3f')]=[{'all':!![]}];}_0x139d33=_[_0x99bc('0x39')]({},_0x139d33,_0x49bec1[_0x99bc('0x3c')]);return db[_0x99bc('0x26')][_0x99bc('0x45')](_0x139d33)['then'](handleEntityNotFound(_0x2b5179,null))[_0x99bc('0x20')](function(_0xfa787d){if(_0xfa787d){var _0x23f135=_0xfa787d[_0x99bc('0x1e')]({'plain':!![]});_0x23f135=qs[_0x99bc('0x4e')](_0x23f135,['id',_0x99bc('0x4f'),_0x99bc('0x50')]);_0x49bec1[_0x99bc('0x51')]=_[_0x99bc('0x4e')](_0x49bec1[_0x99bc('0x51')],['id',_0x99bc('0x4f'),_0x99bc('0x50')]);return db[_0x99bc('0x26')][_0x99bc('0x46')](_[_0x99bc('0x39')](_0x23f135,_0x49bec1['body']),{'include':_0x49bec1[_0x99bc('0x2a')][_0x99bc('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x52278d){var _0x18ace8=_0x49bec1['user'][_0x99bc('0x1e')]({'plain':!![]});if(!_0x18ace8)throw new Error(_0x99bc('0x48'));if(_0x18ace8['role']==='user'){var _0x48ae72=_0x52278d[_0x99bc('0x1e')]({'plain':!![]});var _0x5673f0=_0x99bc('0x52');return db[_0x99bc('0x4a')][_0x99bc('0x45')]({'where':{'name':_0x5673f0,'userProfileId':_0x18ace8['userProfileId']},'raw':!![]})[_0x99bc('0x20')](function(_0x3bce89){if(_0x3bce89&&_0x3bce89[_0x99bc('0x53')]===0x0){return db[_0x99bc('0x1f')][_0x99bc('0x46')]({'name':_0x48ae72['name'],'resourceId':_0x48ae72['id'],'type':_0x3bce89[_0x99bc('0x24')],'sectionId':_0x3bce89['id']},{})[_0x99bc('0x20')](function(){return _0x52278d;});}else{return _0x52278d;}})[_0x99bc('0x42')](function(_0x5e39c8){logger[_0x99bc('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e39c8);throw _0x5e39c8;});}return _0x52278d;});}})['then'](respondWithResult(_0x2b5179,0xc9))[_0x99bc('0x42')](handleError(_0x2b5179,null));};exports[_0x99bc('0x54')]=function(_0x395aed,_0x13bf35){if(_0x395aed[_0x99bc('0x51')]['id']){delete _0x395aed[_0x99bc('0x51')]['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x395aed['params']['id']}})[_0x99bc('0x20')](handleEntityNotFound(_0x13bf35,null))['then'](saveUpdates(_0x395aed[_0x99bc('0x51')],null))['then'](respondWithResult(_0x13bf35,null))[_0x99bc('0x42')](handleError(_0x13bf35,null));};exports[_0x99bc('0x1d')]=function(_0x48b40a,_0x234808){return db[_0x99bc('0x26')][_0x99bc('0x45')]({'where':{'id':_0x48b40a[_0x99bc('0x44')]['id']}})[_0x99bc('0x20')](handleEntityNotFound(_0x234808,null))[_0x99bc('0x20')](removeEntity(_0x234808,null))[_0x99bc('0x42')](handleError(_0x234808,null));};exports['getSessions']=function(_0x3a739e,_0x3207be,_0x16f878){var _0x396709={'raw':!![],'where':{}};var _0x38f430={};var _0x4c6503={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x99bc('0x55')]({'where':{'id':_0x3a739e['params']['id']}})[_0x99bc('0x20')](handleEntityNotFound(_0x3207be,null))[_0x99bc('0x20')](function(_0x527870){if(_0x527870){_0x38f430[_0x99bc('0x2d')]=_[_0x99bc('0x2b')](db[_0x99bc('0x56')][_0x99bc('0x27')]);_0x38f430[_0x99bc('0x2a')]=_['keys'](_0x3a739e[_0x99bc('0x2a')]);_0x38f430[_0x99bc('0x36')]=_[_0x99bc('0x2c')](_0x38f430[_0x99bc('0x2d')],_0x38f430[_0x99bc('0x2a')]);_0x396709[_0x99bc('0x2e')]=_['intersection'](_0x38f430['model'],qs[_0x99bc('0x2f')](_0x3a739e[_0x99bc('0x2a')][_0x99bc('0x2f')]));_0x396709[_0x99bc('0x2e')]=_0x396709[_0x99bc('0x2e')][_0x99bc('0x30')]?_0x396709[_0x99bc('0x2e')]:_0x38f430[_0x99bc('0x2d')];if(!_0x3a739e['query']['hasOwnProperty'](_0x99bc('0x32'))){_0x396709[_0x99bc('0x1b')]=qs[_0x99bc('0x1b')](_0x3a739e[_0x99bc('0x2a')][_0x99bc('0x1b')]);_0x396709[_0x99bc('0x1a')]=qs['offset'](_0x3a739e['query'][_0x99bc('0x1a')]);}_0x396709['order']=qs[_0x99bc('0x34')](_0x3a739e[_0x99bc('0x2a')][_0x99bc('0x34')]);_0x396709[_0x99bc('0x35')]=qs[_0x99bc('0x36')](_['pick'](_0x3a739e[_0x99bc('0x2a')],_0x38f430[_0x99bc('0x36')]));_0x396709['where']['ProjectId']=_0x527870['id'];if(_0x3a739e[_0x99bc('0x2a')][_0x99bc('0x38')]){_0x396709[_0x99bc('0x35')]=_[_0x99bc('0x39')](_0x396709[_0x99bc('0x35')],{'$or':_[_0x99bc('0x29')](_0x396709['attributes'],function(_0x4890a0){var _0x1899cb={};_0x1899cb[_0x4890a0]={'$like':'%'+_0x3a739e[_0x99bc('0x2a')][_0x99bc('0x38')]+'%'};return _0x1899cb;})});}_0x396709=_[_0x99bc('0x39')]({},_0x396709,_0x3a739e[_0x99bc('0x3c')]);return db[_0x99bc('0x56')]['count']({'where':_0x396709[_0x99bc('0x35')]})['then'](function(_0x463572){_0x4c6503[_0x99bc('0x3d')]=_0x463572;if(_0x3a739e[_0x99bc('0x2a')][_0x99bc('0x3e')]){_0x396709[_0x99bc('0x3f')]=[{'all':!![]}];}return db[_0x99bc('0x56')][_0x99bc('0x40')](_0x396709);})[_0x99bc('0x20')](function(_0x4b4ee3){_0x4c6503[_0x99bc('0x41')]=_0x4b4ee3;return _0x4c6503;});}})[_0x99bc('0x20')](respondWithFilteredResult(_0x3207be,_0x396709))['catch'](handleError(_0x3207be,null));};exports['getAnswers']=function(_0xde4050,_0x2a4ffa,_0x362802){var _0x901af3={'raw':!![],'where':{}};var _0x46573f={};var _0x5db215={'count':0x0,'rows':[]};return db[_0x99bc('0x26')][_0x99bc('0x55')]({'where':{'id':_0xde4050[_0x99bc('0x44')]['id']}})[_0x99bc('0x20')](handleEntityNotFound(_0x2a4ffa,null))[_0x99bc('0x20')](function(_0x2593dd){if(_0x2593dd){_0x46573f[_0x99bc('0x2d')]=_[_0x99bc('0x2b')](db[_0x99bc('0x57')][_0x99bc('0x27')]);_0x46573f['query']=_['keys'](_0xde4050[_0x99bc('0x2a')]);_0x46573f[_0x99bc('0x36')]=_[_0x99bc('0x2c')](_0x46573f[_0x99bc('0x2d')],_0x46573f[_0x99bc('0x2a')]);_0x901af3[_0x99bc('0x2e')]=_['intersection'](_0x46573f[_0x99bc('0x2d')],qs['fields'](_0xde4050['query'][_0x99bc('0x2f')]));_0x901af3[_0x99bc('0x2e')]=_0x901af3[_0x99bc('0x2e')]['length']?_0x901af3[_0x99bc('0x2e')]:_0x46573f[_0x99bc('0x2d')];if(!_0xde4050['query']['hasOwnProperty'](_0x99bc('0x32'))){_0x901af3['limit']=qs[_0x99bc('0x1b')](_0xde4050[_0x99bc('0x2a')]['limit']);_0x901af3[_0x99bc('0x1a')]=qs[_0x99bc('0x1a')](_0xde4050['query'][_0x99bc('0x1a')]);}_0x901af3[_0x99bc('0x33')]=qs[_0x99bc('0x34')](_0xde4050[_0x99bc('0x2a')][_0x99bc('0x34')]);_0x901af3[_0x99bc('0x35')]=qs[_0x99bc('0x36')](_[_0x99bc('0x37')](_0xde4050[_0x99bc('0x2a')],_0x46573f[_0x99bc('0x36')]));_0x901af3['where'][_0x99bc('0x58')]=_0x2593dd['id'];if(_0xde4050['query']['filter']){_0x901af3[_0x99bc('0x35')]=_[_0x99bc('0x39')](_0x901af3[_0x99bc('0x35')],{'$or':_[_0x99bc('0x29')](_0x901af3[_0x99bc('0x2e')],function(_0x403ed2){var _0x1af129={};_0x1af129[_0x403ed2]={'$like':'%'+_0xde4050[_0x99bc('0x2a')][_0x99bc('0x38')]+'%'};return _0x1af129;})});}_0x901af3=_[_0x99bc('0x39')]({},_0x901af3,_0xde4050['options']);return db[_0x99bc('0x57')][_0x99bc('0x3d')]({'where':_0x901af3[_0x99bc('0x35')]})['then'](function(_0x23e34e){_0x5db215[_0x99bc('0x3d')]=_0x23e34e;if(_0xde4050[_0x99bc('0x2a')][_0x99bc('0x3e')]){_0x901af3[_0x99bc('0x3f')]=[{'all':!![]}];}return db[_0x99bc('0x57')][_0x99bc('0x40')](_0x901af3);})[_0x99bc('0x20')](function(_0x26cf96){_0x5db215[_0x99bc('0x41')]=_0x26cf96;return _0x5db215;});}})['then'](respondWithFilteredResult(_0x2a4ffa,_0x901af3))['catch'](handleError(_0x2a4ffa,null));};function char(_0x4e00da){return _0x99bc('0x59')===typeof _0x4e00da?String['fromCharCode']['apply'](null,arguments):_0x4e00da;}function needsEncapsulation(_0x57feb3){return!!_0x57feb3&&(_0x57feb3[_0x99bc('0x5a')]()[_0x99bc('0x5b')](char(0xd))>=0x0||_0x57feb3[_0x99bc('0x5a')]()[_0x99bc('0x5b')](char(0xa))>=0x0||_0x57feb3['toString']()['indexOf'](char(0x2c))>=0x0||_0x57feb3[_0x99bc('0x5a')]()[_0x99bc('0x5b')](char(0x22))>=0x0);}function encapsulate(_0x48fb82){var _0x4703d4=char(0x22),_0x42dc1c='\x5c'+char(0x22),_0x46c833=_0x48fb82[_0x99bc('0x5a')]()[_0x99bc('0x5c')](new RegExp(_0x4703d4,'g'),_0x42dc1c);return _0x4703d4+_0x46c833+_0x4703d4;}exports[_0x99bc('0x5d')]=function(_0x718d24,_0x122433,_0x2af53d){var _0x3c078e,_0x4ef2a4;var _0x8b69f6={'where':{'ProjectId':_0x718d24[_0x99bc('0x44')]['id']}};if(_0x718d24['query'][_0x99bc('0x5e')]){_0x8b69f6[_0x99bc('0x35')][_0x99bc('0x5f')]=JSON[_0x99bc('0x60')](_0x718d24[_0x99bc('0x2a')][_0x99bc('0x5e')]);}return db['JscriptySessionReport'][_0x99bc('0x40')](_0x8b69f6)[_0x99bc('0x20')](handleEntityNotFound(_0x122433,null))['then'](function(_0x369d36){if(_0x369d36){_0x3c078e=_0x369d36;return db['JscriptyQuestionReport'][_0x99bc('0x40')]({'where':{'SessionId':{'$in':_[_0x99bc('0x29')](_0x3c078e,'id')},'ProjectId':_0x718d24[_0x99bc('0x44')]['id']},'order':_0x99bc('0x61')});}})[_0x99bc('0x20')](handleEntityNotFound(_0x122433,null))['then'](function(_0x12684a){if(_0x12684a){_0x4ef2a4=_0x12684a;var _0x76c5a5={};for(var _0x535627=0x0,_0x16e337=_0x4ef2a4[_0x99bc('0x30')];_0x535627<_0x16e337;_0x535627++){if(!_0x76c5a5[_0x99bc('0x31')](_0x4ef2a4[_0x535627]['questionId'])){_0x76c5a5[_0x4ef2a4[_0x535627][_0x99bc('0x62')]]=needsEncapsulation(_0x4ef2a4[_0x535627][_0x99bc('0x63')])?encapsulate(_0x4ef2a4[_0x535627]['question']):_0x4ef2a4[_0x535627][_0x99bc('0x63')];}}var _0x3ced55=[],_0x4708b1={};for(var _0x48afcf=0x0,_0x17a7c7=_0x3c078e['length'];_0x48afcf<_0x17a7c7;_0x48afcf++){_0x4708b1={'ProjectId':_0x718d24[_0x99bc('0x44')]['id'],'SessionId':_0x3c078e[_0x48afcf]['id'],'StartTime':moment(_0x3c078e[_0x48afcf][_0x99bc('0x5f')])[_0x99bc('0x64')](_0x99bc('0x65'))};for(var _0x43d425=0x0,_0x3bbd9e=_0x4ef2a4[_0x99bc('0x30')];_0x43d425<_0x3bbd9e;_0x43d425++){if(_0x4ef2a4[_0x43d425][_0x99bc('0x66')]==_0x3c078e[_0x48afcf]['id']&&_0x76c5a5['hasOwnProperty'](_0x4ef2a4[_0x43d425][_0x99bc('0x62')])){_0x4708b1[_0x76c5a5[_0x4ef2a4[_0x43d425][_0x99bc('0x62')]]]=_0x4ef2a4[_0x43d425][_0x99bc('0x67')];}}for(var _0x1c91a4 in _0x76c5a5){if(!_0x4708b1[_0x99bc('0x31')](_0x76c5a5[_0x1c91a4])){_0x4708b1[_0x76c5a5[_0x1c91a4]]=null;}}_0x3ced55['push'](_0x4708b1);}return _0x3ced55;}})['then'](function(_0x3c5b44){if(!_[_0x99bc('0x68')](_0x3c5b44)){var _0xccab77=toCsv(_0x3c5b44);var _0x2ca21f=Date[_0x99bc('0x69')]();fs['writeFileSync'](util[_0x99bc('0x64')](_0x99bc('0x6a'),_0x718d24['params']['id'],_0x2ca21f),_0xccab77);_0x122433[_0x99bc('0x6b')](_0x99bc('0x6c'),_0x99bc('0x6d')+util[_0x99bc('0x64')]('Jscripty_Project_%d_Summary_%s.csv',_0x718d24[_0x99bc('0x44')]['id'],_0x2ca21f));_0x122433['setHeader']('Content-type',_0x99bc('0x6e'));return _0x122433[_0x99bc('0x6f')](util[_0x99bc('0x64')](_0x99bc('0x6a'),_0x718d24[_0x99bc('0x44')]['id'],_0x2ca21f));}else{return _0x122433['sendStatus'](0xcc);}})[_0x99bc('0x42')](handleError(_0x122433,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 840e0bd..bde98b6 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 _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 +var _0xaa1d=['./jscriptyProject.attributes','exports','define','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x53a773,_0x17d7c3){var _0x4aea09=function(_0x565201){while(--_0x565201){_0x53a773['push'](_0x53a773['shift']());}};_0x4aea09(++_0x17d7c3);}(_0xaa1d,0xb7));var _0xdaa1=function(_0x114f9b,_0x274bde){_0x114f9b=_0x114f9b-0x0;var _0x576eec=_0xaa1d[_0x114f9b];return _0x576eec;};'use strict';var _=require('lodash');var util=require(_0xdaa1('0x0'));var logger=require(_0xdaa1('0x1'))(_0xdaa1('0x2'));var moment=require(_0xdaa1('0x3'));var BPromise=require(_0xdaa1('0x4'));var rp=require(_0xdaa1('0x5'));var fs=require('fs');var path=require(_0xdaa1('0x6'));var rimraf=require(_0xdaa1('0x7'));var config=require(_0xdaa1('0x8'));var attributes=require(_0xdaa1('0x9'));module[_0xdaa1('0xa')]=function(_0x312321,_0x1386f3){return _0x312321[_0xdaa1('0xb')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 69bc655..6e0b41b 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 _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 +var _0x4ab7=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x551894,_0x4a49d4){var _0x2f4964=function(_0x15e0a5){while(--_0x15e0a5){_0x551894['push'](_0x551894['shift']());}};_0x2f4964(++_0x4a49d4);}(_0x4ab7,0x102));var _0x74ab=function(_0x4df78e,_0x56725b){_0x4df78e=_0x4df78e-0x0;var _0xc2ffc4=_0x4ab7[_0x4df78e];return _0xc2ffc4;};'use strict';var _=require(_0x74ab('0x0'));var util=require(_0x74ab('0x1'));var moment=require(_0x74ab('0x2'));var BPromise=require(_0x74ab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74ab('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x74ab('0x5'));var logger=require(_0x74ab('0x6'))(_0x74ab('0x7'));var config=require(_0x74ab('0x8'));var jayson=require(_0x74ab('0x9'));var client=jayson[_0x74ab('0xa')][_0x74ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100ca9,_0x4589dd,_0x41fa75){return new BPromise(function(_0x505a7f,_0x457eb5){return client[_0x74ab('0xc')](_0x100ca9,_0x41fa75)[_0x74ab('0xd')](function(_0x487743){logger[_0x74ab('0xe')](_0x74ab('0xf'),_0x4589dd,_0x74ab('0x10'));logger[_0x74ab('0x11')](_0x74ab('0x12'),_0x4589dd,_0x74ab('0x10'),JSON[_0x74ab('0x13')](_0x487743));if(_0x487743['error']){if(_0x487743[_0x74ab('0x14')][_0x74ab('0x15')]===0x1f4){logger[_0x74ab('0x14')](_0x74ab('0xf'),_0x4589dd,_0x487743[_0x74ab('0x14')]['message']);return _0x457eb5(_0x487743[_0x74ab('0x14')]['message']);}logger[_0x74ab('0x14')]('JscriptyProject,\x20%s,\x20%s',_0x4589dd,_0x487743[_0x74ab('0x14')]['message']);return _0x505a7f(_0x487743[_0x74ab('0x14')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x4589dd,_0x74ab('0x10'));_0x505a7f(_0x487743[_0x74ab('0x16')]['message']);}})[_0x74ab('0x17')](function(_0x4d3446){logger[_0x74ab('0x14')](_0x74ab('0xf'),_0x4589dd,_0x4d3446);_0x457eb5(_0x4d3446);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index ed6391a..7503a0d 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 _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 +var _0xac8e=['Router','../../components/interaction/service','./jscriptyQuestionReport.controller','index','get','/describe','describe','/:id','isAuthenticated','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xac8e,0x19f));var _0xeac8=function(_0x1c1ceb,_0x4a6344){_0x1c1ceb=_0x1c1ceb-0x0;var _0x3fd432=_0xac8e[_0x1c1ceb];return _0x3fd432;};'use strict';var multer=require(_0xeac8('0x0'));var util=require(_0xeac8('0x1'));var path=require(_0xeac8('0x2'));var timeout=require(_0xeac8('0x3'));var express=require(_0xeac8('0x4'));var router=express[_0xeac8('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xeac8('0x6'));var config=require('../../config/environment');var controller=require(_0xeac8('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xeac8('0x8')]);router[_0xeac8('0x9')](_0xeac8('0xa'),auth['isAuthenticated'](),controller[_0xeac8('0xb')]);router[_0xeac8('0x9')](_0xeac8('0xc'),auth[_0xeac8('0xd')](),controller[_0xeac8('0xe')]);router['post']('/',auth[_0xeac8('0xd')](),controller[_0xeac8('0xf')]);router['put'](_0xeac8('0xc'),auth[_0xeac8('0xd')](),controller[_0xeac8('0x10')]);router[_0xeac8('0x11')](_0xeac8('0xc'),auth[_0xeac8('0xd')](),controller[_0xeac8('0x12')]);module[_0xeac8('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index f0f3766..a30c1fd 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 _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 +var _0x9861=['long','STRING','sequelize','TEXT'];(function(_0x442a28,_0x66c817){var _0x4bb43c=function(_0x27697a){while(--_0x27697a){_0x442a28['push'](_0x442a28['shift']());}};_0x4bb43c(++_0x66c817);}(_0x9861,0x176));var _0x1986=function(_0x3c43e5,_0x1d9f36){_0x3c43e5=_0x3c43e5-0x0;var _0x42d7a2=_0x9861[_0x3c43e5];return _0x42d7a2;};'use strict';var Sequelize=require(_0x1986('0x0'));module['exports']={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize[_0x1986('0x1')](_0x1986('0x2'))},'membername':{'type':Sequelize[_0x1986('0x3')]},'projectname':{'type':Sequelize[_0x1986('0x3')]},'queue':{'type':Sequelize[_0x1986('0x3')]},'uniqueid':{'type':Sequelize[_0x1986('0x3')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1986('0x3')]},'questionId':{'type':Sequelize[_0x1986('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 59d1dfc..d3b8aa3 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 _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 +var _0xbd97=['body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','apply','reject','update','then','destroy','end','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','options','count','includeAll','include','rows','catch','show','params','find','create'];(function(_0x466e13,_0xd7cc8f){var _0x14ed92=function(_0x278893){while(--_0x278893){_0x466e13['push'](_0x466e13['shift']());}};_0x14ed92(++_0xd7cc8f);}(_0xbd97,0xec));var _0x7bd9=function(_0x28d0c2,_0x294d5c){_0x28d0c2=_0x28d0c2-0x0;var _0x237d06=_0xbd97[_0x28d0c2];return _0x237d06;};'use strict';var pdf=require(_0x7bd9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7bd9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7bd9('0x2'));var rp=require(_0x7bd9('0x3'));var moment=require(_0x7bd9('0x4'));var BPromise=require(_0x7bd9('0x5'));var Mustache=require(_0x7bd9('0x6'));var util=require(_0x7bd9('0x7'));var path=require(_0x7bd9('0x8'));var sox=require(_0x7bd9('0x9'));var csv=require(_0x7bd9('0xa'));var ejs=require(_0x7bd9('0xb'));var fs=require('fs');var _=require(_0x7bd9('0xc'));var squel=require(_0x7bd9('0xd'));var crypto=require(_0x7bd9('0xe'));var jsforce=require(_0x7bd9('0xf'));var deskjs=require(_0x7bd9('0x10'));var toCsv=require(_0x7bd9('0xa'));var querystring=require(_0x7bd9('0x11'));var Papa=require(_0x7bd9('0x12'));var Redis=require(_0x7bd9('0x13'));var authService=require(_0x7bd9('0x14'));var qs=require(_0x7bd9('0x15'));var as=require(_0x7bd9('0x16'));var hardwareService=require(_0x7bd9('0x17'));var logger=require(_0x7bd9('0x18'))(_0x7bd9('0x19'));var utils=require('../../config/utils');var config=require(_0x7bd9('0x1a'));var licenseUtil=require(_0x7bd9('0x1b'));var db=require(_0x7bd9('0x1c'))['db'];function respondWithStatusCode(_0x14d82f,_0x216320){_0x216320=_0x216320||0xcc;return function(_0x4a5ea1){if(_0x4a5ea1){return _0x14d82f[_0x7bd9('0x1d')](_0x216320);}return _0x14d82f[_0x7bd9('0x1e')](_0x216320)['end']();};}function respondWithResult(_0x3bf1c2,_0x314bd7){_0x314bd7=_0x314bd7||0xc8;return function(_0x19f514){if(_0x19f514){return _0x3bf1c2[_0x7bd9('0x1e')](_0x314bd7)[_0x7bd9('0x1f')](_0x19f514);}};}function respondWithFilteredResult(_0x1d6097,_0x14352e){return function(_0x327e2c){if(_0x327e2c){var _0x13202b=_0x327e2c['count'],_0x5839e9=_0x14352e[_0x7bd9('0x20')],_0x410c11=_0x14352e['offset']+_0x14352e[_0x7bd9('0x21')],_0x13c5e1;if(_0x410c11>=_0x13202b){_0x410c11=_0x13202b;_0x13c5e1=0xc8;}else{_0x13c5e1=0xce;}_0x1d6097['status'](_0x13c5e1);return _0x1d6097[_0x7bd9('0x22')]('Content-Range',_0x5839e9+'-'+_0x410c11+'/'+_0x13202b)['json'](_0x327e2c);}return null;};}function patchUpdates(_0x1b4810){return function(_0x28702b){try{jsonpatch[_0x7bd9('0x23')](_0x28702b,_0x1b4810,!![]);}catch(_0x3c9340){return BPromise[_0x7bd9('0x24')](_0x3c9340);}return _0x28702b['save']();};}function saveUpdates(_0x4140e7,_0x50ea94){return function(_0x18b554){if(_0x18b554){return _0x18b554[_0x7bd9('0x25')](_0x4140e7)[_0x7bd9('0x26')](function(_0x307cb5){return _0x307cb5;});}return null;};}function removeEntity(_0x577d24,_0x44d29a){return function(_0x1defc5){if(_0x1defc5){return _0x1defc5[_0x7bd9('0x27')]()[_0x7bd9('0x26')](function(){_0x577d24['status'](0xcc)[_0x7bd9('0x28')]();});}};}function handleEntityNotFound(_0x400107,_0xf168ea){return function(_0x15bcab){if(!_0x15bcab){_0x400107[_0x7bd9('0x1d')](0x194);}return _0x15bcab;};}function handleError(_0x4c5464,_0x213702){_0x213702=_0x213702||0x1f4;return function(_0x3f2fc3){logger[_0x7bd9('0x29')](_0x3f2fc3[_0x7bd9('0x2a')]);if(_0x3f2fc3['name']){delete _0x3f2fc3[_0x7bd9('0x2b')];}_0x4c5464[_0x7bd9('0x1e')](_0x213702)[_0x7bd9('0x2c')](_0x3f2fc3);};}exports[_0x7bd9('0x2d')]=function(_0x4dd40b,_0x5eb955){var _0x1d6c9f={},_0x461aac={},_0x3ec602={'count':0x0,'rows':[]};var _0x28bab6=_['map'](db[_0x7bd9('0x2e')][_0x7bd9('0x2f')],function(_0x3a54fa){return{'name':_0x3a54fa[_0x7bd9('0x30')],'type':_0x3a54fa[_0x7bd9('0x31')][_0x7bd9('0x32')]};});_0x461aac[_0x7bd9('0x33')]=_[_0x7bd9('0x34')](_0x28bab6,'name');_0x461aac[_0x7bd9('0x35')]=_[_0x7bd9('0x36')](_0x4dd40b[_0x7bd9('0x35')]);_0x461aac[_0x7bd9('0x37')]=_[_0x7bd9('0x38')](_0x461aac[_0x7bd9('0x33')],_0x461aac[_0x7bd9('0x35')]);_0x1d6c9f[_0x7bd9('0x39')]=_[_0x7bd9('0x38')](_0x461aac['model'],qs[_0x7bd9('0x3a')](_0x4dd40b[_0x7bd9('0x35')]['fields']));_0x1d6c9f[_0x7bd9('0x39')]=_0x1d6c9f[_0x7bd9('0x39')][_0x7bd9('0x3b')]?_0x1d6c9f[_0x7bd9('0x39')]:_0x461aac[_0x7bd9('0x33')];if(!_0x4dd40b[_0x7bd9('0x35')]['hasOwnProperty'](_0x7bd9('0x3c'))){_0x1d6c9f[_0x7bd9('0x21')]=qs[_0x7bd9('0x21')](_0x4dd40b[_0x7bd9('0x35')][_0x7bd9('0x21')]);_0x1d6c9f[_0x7bd9('0x20')]=qs[_0x7bd9('0x20')](_0x4dd40b['query'][_0x7bd9('0x20')]);}_0x1d6c9f[_0x7bd9('0x3d')]=qs[_0x7bd9('0x3e')](_0x4dd40b[_0x7bd9('0x35')][_0x7bd9('0x3e')]);_0x1d6c9f['where']=qs[_0x7bd9('0x37')](_[_0x7bd9('0x3f')](_0x4dd40b[_0x7bd9('0x35')],_0x461aac['filters']),_0x28bab6);if(_0x4dd40b[_0x7bd9('0x35')][_0x7bd9('0x40')]){_0x1d6c9f[_0x7bd9('0x41')]=_['merge'](_0x1d6c9f[_0x7bd9('0x41')],{'$or':_[_0x7bd9('0x34')](_0x28bab6,function(_0x50a1d9){if(_0x50a1d9[_0x7bd9('0x31')]!=='VIRTUAL'){var _0x98df5a={};_0x98df5a[_0x50a1d9[_0x7bd9('0x2b')]]={'$like':'%'+_0x4dd40b[_0x7bd9('0x35')][_0x7bd9('0x40')]+'%'};return _0x98df5a;}})});}_0x1d6c9f=_['merge']({},_0x1d6c9f,_0x4dd40b[_0x7bd9('0x42')]);var _0x300bc1={'where':_0x1d6c9f[_0x7bd9('0x41')]};return db[_0x7bd9('0x2e')][_0x7bd9('0x43')](_0x300bc1)[_0x7bd9('0x26')](function(_0x244770){_0x3ec602[_0x7bd9('0x43')]=_0x244770;if(_0x4dd40b['query'][_0x7bd9('0x44')]){_0x1d6c9f[_0x7bd9('0x45')]=[{'all':!![]}];}return db[_0x7bd9('0x2e')]['findAll'](_0x1d6c9f);})[_0x7bd9('0x26')](function(_0x3cdb15){_0x3ec602[_0x7bd9('0x46')]=_0x3cdb15;return _0x3ec602;})[_0x7bd9('0x26')](respondWithFilteredResult(_0x5eb955,_0x1d6c9f))[_0x7bd9('0x47')](handleError(_0x5eb955,null));};exports[_0x7bd9('0x48')]=function(_0xbf43f3,_0x226ba0){var _0x14a2f3={'raw':!![],'where':{'id':_0xbf43f3[_0x7bd9('0x49')]['id']}},_0x43dabe={};_0x43dabe['model']=_[_0x7bd9('0x36')](db['JscriptyQuestionReport']['rawAttributes']);_0x43dabe[_0x7bd9('0x35')]=_[_0x7bd9('0x36')](_0xbf43f3['query']);_0x43dabe[_0x7bd9('0x37')]=_[_0x7bd9('0x38')](_0x43dabe[_0x7bd9('0x33')],_0x43dabe[_0x7bd9('0x35')]);_0x14a2f3[_0x7bd9('0x39')]=_['intersection'](_0x43dabe['model'],qs[_0x7bd9('0x3a')](_0xbf43f3['query']['fields']));_0x14a2f3[_0x7bd9('0x39')]=_0x14a2f3['attributes'][_0x7bd9('0x3b')]?_0x14a2f3['attributes']:_0x43dabe[_0x7bd9('0x33')];if(_0xbf43f3[_0x7bd9('0x35')]['includeAll']){_0x14a2f3[_0x7bd9('0x45')]=[{'all':!![]}];}_0x14a2f3=_['merge']({},_0x14a2f3,_0xbf43f3['options']);return db[_0x7bd9('0x2e')][_0x7bd9('0x4a')](_0x14a2f3)[_0x7bd9('0x26')](handleEntityNotFound(_0x226ba0,null))[_0x7bd9('0x26')](respondWithResult(_0x226ba0,null))['catch'](handleError(_0x226ba0,null));};exports[_0x7bd9('0x4b')]=function(_0x1ee2fe,_0x302efa){return db[_0x7bd9('0x2e')][_0x7bd9('0x4b')](_0x1ee2fe[_0x7bd9('0x4c')],{})[_0x7bd9('0x26')](respondWithResult(_0x302efa,0xc9))[_0x7bd9('0x47')](handleError(_0x302efa,null));};exports['update']=function(_0x306ccf,_0x4bf4b3){if(_0x306ccf['body']['id']){delete _0x306ccf['body']['id'];}return db['JscriptyQuestionReport'][_0x7bd9('0x4a')]({'where':{'id':_0x306ccf[_0x7bd9('0x49')]['id']}})[_0x7bd9('0x26')](handleEntityNotFound(_0x4bf4b3,null))['then'](saveUpdates(_0x306ccf[_0x7bd9('0x4c')],null))['then'](respondWithResult(_0x4bf4b3,null))[_0x7bd9('0x47')](handleError(_0x4bf4b3,null));};exports[_0x7bd9('0x27')]=function(_0x4d9ef2,_0x38aac1){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x4d9ef2[_0x7bd9('0x49')]['id']}})[_0x7bd9('0x26')](handleEntityNotFound(_0x38aac1,null))[_0x7bd9('0x26')](removeEntity(_0x38aac1,null))[_0x7bd9('0x47')](handleError(_0x38aac1,null));};exports[_0x7bd9('0x4d')]=function(_0xe8452a,_0x48c600){return db['JscriptyQuestionReport'][_0x7bd9('0x4d')]()[_0x7bd9('0x26')](respondWithResult(_0x48c600,null))[_0x7bd9('0x47')](handleError(_0x48c600,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 546af30..ea28ad5 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 _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 +var _0x3b5f=['JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define'];(function(_0x461c41,_0x2e6d1c){var _0x509e12=function(_0x245f5d){while(--_0x245f5d){_0x461c41['push'](_0x461c41['shift']());}};_0x509e12(++_0x2e6d1c);}(_0x3b5f,0x10a));var _0xf3b5=function(_0x2eeab1,_0xc54541){_0x2eeab1=_0x2eeab1-0x0;var _0x21bf94=_0x3b5f[_0x2eeab1];return _0x21bf94;};'use strict';var _=require(_0xf3b5('0x0'));var util=require(_0xf3b5('0x1'));var logger=require(_0xf3b5('0x2'))(_0xf3b5('0x3'));var moment=require(_0xf3b5('0x4'));var BPromise=require(_0xf3b5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf3b5('0x6'));var config=require(_0xf3b5('0x7'));var attributes=require(_0xf3b5('0x8'));module['exports']=function(_0x502aaf,_0x4d1429){return _0x502aaf[_0xf3b5('0x9')](_0xf3b5('0xa'),attributes,{'tableName':_0xf3b5('0xb'),'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 e63b819..41e8a33 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 _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 +var _0xd554=['info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x48edc3,_0x3776e4){var _0xfd73d1=function(_0x440552){while(--_0x440552){_0x48edc3['push'](_0x48edc3['shift']());}};_0xfd73d1(++_0x3776e4);}(_0xd554,0x105));var _0x4d55=function(_0xdf161e,_0x3884be){_0xdf161e=_0xdf161e-0x0;var _0x1373cc=_0xd554[_0xdf161e];return _0x1373cc;};'use strict';var _=require(_0x4d55('0x0'));var util=require(_0x4d55('0x1'));var moment=require(_0x4d55('0x2'));var BPromise=require('bluebird');var rs=require(_0x4d55('0x3'));var fs=require('fs');var Redis=require(_0x4d55('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4d55('0x5'));var logger=require('../../config/logger')(_0x4d55('0x6'));var config=require(_0x4d55('0x7'));var jayson=require(_0x4d55('0x8'));var client=jayson[_0x4d55('0x9')][_0x4d55('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14bcbc,_0x45674f,_0x453618){return new BPromise(function(_0x133184,_0x2af58f){return client['request'](_0x14bcbc,_0x453618)[_0x4d55('0xb')](function(_0x50327c){logger[_0x4d55('0xc')](_0x4d55('0xd'),_0x45674f,_0x4d55('0xe'));logger[_0x4d55('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x45674f,_0x4d55('0xe'),JSON[_0x4d55('0x10')](_0x50327c));if(_0x50327c['error']){if(_0x50327c[_0x4d55('0x11')][_0x4d55('0x12')]===0x1f4){logger[_0x4d55('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x45674f,_0x50327c[_0x4d55('0x11')]['message']);return _0x2af58f(_0x50327c['error'][_0x4d55('0x13')]);}logger[_0x4d55('0x11')](_0x4d55('0xd'),_0x45674f,_0x50327c['error'][_0x4d55('0x13')]);return _0x133184(_0x50327c[_0x4d55('0x11')][_0x4d55('0x13')]);}else{logger['info'](_0x4d55('0xd'),_0x45674f,_0x4d55('0xe'));_0x133184(_0x50327c[_0x4d55('0x14')][_0x4d55('0x13')]);}})['catch'](function(_0x44dd7d){logger[_0x4d55('0x11')](_0x4d55('0xd'),_0x45674f,_0x44dd7d);_0x2af58f(_0x44dd7d);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index e6ec365..883896f 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 _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 +var _0x818f=['isAuthenticated','index','/describe','/:id','/:id/questions','getQuestions','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get'];(function(_0x687549,_0x2a09eb){var _0x44e4a0=function(_0xef9ff1){while(--_0xef9ff1){_0x687549['push'](_0x687549['shift']());}};_0x44e4a0(++_0x2a09eb);}(_0x818f,0x1da));var _0xf818=function(_0x3ed926,_0x4b2a9e){_0x3ed926=_0x3ed926-0x0;var _0x42b648=_0x818f[_0x3ed926];return _0x42b648;};'use strict';var multer=require(_0xf818('0x0'));var util=require(_0xf818('0x1'));var path=require(_0xf818('0x2'));var timeout=require(_0xf818('0x3'));var express=require(_0xf818('0x4'));var router=express[_0xf818('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf818('0x6'));var config=require(_0xf818('0x7'));var controller=require(_0xf818('0x8'));router[_0xf818('0x9')]('/',auth[_0xf818('0xa')](),controller[_0xf818('0xb')]);router[_0xf818('0x9')](_0xf818('0xc'),auth[_0xf818('0xa')](),controller['describe']);router[_0xf818('0x9')](_0xf818('0xd'),auth[_0xf818('0xa')](),controller['show']);router['get'](_0xf818('0xe'),auth[_0xf818('0xa')](),controller[_0xf818('0xf')]);router[_0xf818('0x10')]('/',auth[_0xf818('0xa')](),controller['create']);router[_0xf818('0x11')](_0xf818('0xd'),auth[_0xf818('0xa')](),controller[_0xf818('0x12')]);router[_0xf818('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xf818('0x14')]);module[_0xf818('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index cb12358..d7016c2 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 _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 +var _0xb0d5=['setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','exports','DATE'];(function(_0x2e4a0f,_0x3a9bb6){var _0x25a3cd=function(_0x1c614f){while(--_0x1c614f){_0x2e4a0f['push'](_0x2e4a0f['shift']());}};_0x25a3cd(++_0x3a9bb6);}(_0xb0d5,0x125));var _0x5b0d=function(_0x2ea08a,_0x240f73){_0x2ea08a=_0x2ea08a-0x0;var _0x5401ad=_0xb0d5[_0x2ea08a];return _0x5401ad;};'use strict';var moment=require(_0x5b0d('0x0'));var Sequelize=require(_0x5b0d('0x1'));module[_0x5b0d('0x2')]={'starttime':{'type':Sequelize[_0x5b0d('0x3')],'set':function(_0x5cf7c0){this[_0x5b0d('0x4')]('starttime',_0x5cf7c0);this[_0x5b0d('0x4')](_0x5b0d('0x5'),moment()[_0x5b0d('0x6')](_0x5b0d('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x5b0d('0x8')]},'queue':{'type':Sequelize[_0x5b0d('0x8')]},'uniqueid':{'type':Sequelize[_0x5b0d('0x8')]},'calleridname':{'type':Sequelize[_0x5b0d('0x8')]},'calleridnum':{'type':Sequelize[_0x5b0d('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 1550b75..adfda84 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 _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 +var _0xdd12=['Content-Range','json','reject','then','stack','name','index','map','JscriptySessionReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','find','create','body','update','destroy','describe','getQuestions','JscriptyQuestionReport','sort','SessionId','include','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set'];(function(_0x354bef,_0x401af7){var _0x5465fc=function(_0x26e4f3){while(--_0x26e4f3){_0x354bef['push'](_0x354bef['shift']());}};_0x5465fc(++_0x401af7);}(_0xdd12,0x1af));var _0x2dd1=function(_0x2467ae,_0x18ab53){_0x2467ae=_0x2467ae-0x0;var _0x4689fe=_0xdd12[_0x2467ae];return _0x4689fe;};'use strict';var pdf=require(_0x2dd1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2dd1('0x1'));var zipdir=require(_0x2dd1('0x2'));var jsonpatch=require(_0x2dd1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2dd1('0x4'));var Mustache=require(_0x2dd1('0x5'));var util=require(_0x2dd1('0x6'));var path=require(_0x2dd1('0x7'));var sox=require(_0x2dd1('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2dd1('0x9'));var crypto=require(_0x2dd1('0xa'));var jsforce=require(_0x2dd1('0xb'));var deskjs=require(_0x2dd1('0xc'));var toCsv=require(_0x2dd1('0xd'));var querystring=require(_0x2dd1('0xe'));var Papa=require(_0x2dd1('0xf'));var Redis=require('ioredis');var authService=require(_0x2dd1('0x10'));var qs=require(_0x2dd1('0x11'));var as=require(_0x2dd1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2dd1('0x13'))(_0x2dd1('0x14'));var utils=require('../../config/utils');var config=require(_0x2dd1('0x15'));var licenseUtil=require(_0x2dd1('0x16'));var db=require(_0x2dd1('0x17'))['db'];function respondWithStatusCode(_0x35679f,_0x2d3cd6){_0x2d3cd6=_0x2d3cd6||0xcc;return function(_0x530fbf){if(_0x530fbf){return _0x35679f[_0x2dd1('0x18')](_0x2d3cd6);}return _0x35679f[_0x2dd1('0x19')](_0x2d3cd6)[_0x2dd1('0x1a')]();};}function respondWithResult(_0x571220,_0x4d08db){_0x4d08db=_0x4d08db||0xc8;return function(_0x2d348a){if(_0x2d348a){return _0x571220[_0x2dd1('0x19')](_0x4d08db)['json'](_0x2d348a);}};}function respondWithFilteredResult(_0x109f25,_0x29467d){return function(_0x4d99d4){if(_0x4d99d4){var _0x157692=_0x4d99d4[_0x2dd1('0x1b')],_0x1d5eda=_0x29467d[_0x2dd1('0x1c')],_0x2f1f39=_0x29467d[_0x2dd1('0x1c')]+_0x29467d[_0x2dd1('0x1d')],_0xacab0;if(_0x2f1f39>=_0x157692){_0x2f1f39=_0x157692;_0xacab0=0xc8;}else{_0xacab0=0xce;}_0x109f25['status'](_0xacab0);return _0x109f25[_0x2dd1('0x1e')](_0x2dd1('0x1f'),_0x1d5eda+'-'+_0x2f1f39+'/'+_0x157692)[_0x2dd1('0x20')](_0x4d99d4);}return null;};}function patchUpdates(_0xca19e3){return function(_0x59538c){try{jsonpatch['apply'](_0x59538c,_0xca19e3,!![]);}catch(_0x49a3c6){return BPromise[_0x2dd1('0x21')](_0x49a3c6);}return _0x59538c['save']();};}function saveUpdates(_0x4ae163,_0xae6933){return function(_0x47f512){if(_0x47f512){return _0x47f512['update'](_0x4ae163)[_0x2dd1('0x22')](function(_0x49c705){return _0x49c705;});}return null;};}function removeEntity(_0x31e086,_0x3196f5){return function(_0x26a3ef){if(_0x26a3ef){return _0x26a3ef['destroy']()['then'](function(){_0x31e086[_0x2dd1('0x19')](0xcc)[_0x2dd1('0x1a')]();});}};}function handleEntityNotFound(_0x5752d2,_0x372fd0){return function(_0x3074d2){if(!_0x3074d2){_0x5752d2['sendStatus'](0x194);}return _0x3074d2;};}function handleError(_0x26f2af,_0x2d9283){_0x2d9283=_0x2d9283||0x1f4;return function(_0x7d4a76){logger['error'](_0x7d4a76[_0x2dd1('0x23')]);if(_0x7d4a76[_0x2dd1('0x24')]){delete _0x7d4a76['name'];}_0x26f2af[_0x2dd1('0x19')](_0x2d9283)['send'](_0x7d4a76);};}exports[_0x2dd1('0x25')]=function(_0x9a1328,_0x25eb61){var _0x247bbc={},_0x2f7144={},_0x4402d1={'count':0x0,'rows':[]};var _0xe54af6=_[_0x2dd1('0x26')](db[_0x2dd1('0x27')][_0x2dd1('0x28')],function(_0x332acc){return{'name':_0x332acc['fieldName'],'type':_0x332acc[_0x2dd1('0x29')][_0x2dd1('0x2a')]};});_0x2f7144[_0x2dd1('0x2b')]=_[_0x2dd1('0x26')](_0xe54af6,_0x2dd1('0x24'));_0x2f7144[_0x2dd1('0x2c')]=_[_0x2dd1('0x2d')](_0x9a1328['query']);_0x2f7144[_0x2dd1('0x2e')]=_[_0x2dd1('0x2f')](_0x2f7144[_0x2dd1('0x2b')],_0x2f7144[_0x2dd1('0x2c')]);_0x247bbc['attributes']=_['intersection'](_0x2f7144[_0x2dd1('0x2b')],qs[_0x2dd1('0x30')](_0x9a1328[_0x2dd1('0x2c')][_0x2dd1('0x30')]));_0x247bbc[_0x2dd1('0x31')]=_0x247bbc['attributes']['length']?_0x247bbc['attributes']:_0x2f7144[_0x2dd1('0x2b')];if(!_0x9a1328[_0x2dd1('0x2c')][_0x2dd1('0x32')](_0x2dd1('0x33'))){_0x247bbc[_0x2dd1('0x1d')]=qs['limit'](_0x9a1328[_0x2dd1('0x2c')]['limit']);_0x247bbc[_0x2dd1('0x1c')]=qs['offset'](_0x9a1328[_0x2dd1('0x2c')][_0x2dd1('0x1c')]);}_0x247bbc[_0x2dd1('0x34')]=qs['sort'](_0x9a1328[_0x2dd1('0x2c')]['sort']);_0x247bbc[_0x2dd1('0x35')]=qs[_0x2dd1('0x2e')](_[_0x2dd1('0x36')](_0x9a1328['query'],_0x2f7144[_0x2dd1('0x2e')]),_0xe54af6);if(_0x9a1328[_0x2dd1('0x2c')][_0x2dd1('0x37')]){_0x247bbc['where']=_[_0x2dd1('0x38')](_0x247bbc[_0x2dd1('0x35')],{'$or':_[_0x2dd1('0x26')](_0xe54af6,function(_0x5bc5fc){if(_0x5bc5fc[_0x2dd1('0x29')]!==_0x2dd1('0x39')){var _0x4a7c13={};_0x4a7c13[_0x5bc5fc[_0x2dd1('0x24')]]={'$like':'%'+_0x9a1328[_0x2dd1('0x2c')][_0x2dd1('0x37')]+'%'};return _0x4a7c13;}})});}_0x247bbc=_[_0x2dd1('0x38')]({},_0x247bbc,_0x9a1328[_0x2dd1('0x3a')]);var _0x2bec89={'where':_0x247bbc[_0x2dd1('0x35')]};return db[_0x2dd1('0x27')][_0x2dd1('0x1b')](_0x2bec89)[_0x2dd1('0x22')](function(_0x299f5c){_0x4402d1[_0x2dd1('0x1b')]=_0x299f5c;if(_0x9a1328[_0x2dd1('0x2c')][_0x2dd1('0x3b')]){_0x247bbc['include']=[{'all':!![]}];}return db[_0x2dd1('0x27')][_0x2dd1('0x3c')](_0x247bbc);})[_0x2dd1('0x22')](function(_0x3ca29c){_0x4402d1[_0x2dd1('0x3d')]=_0x3ca29c;return _0x4402d1;})[_0x2dd1('0x22')](respondWithFilteredResult(_0x25eb61,_0x247bbc))[_0x2dd1('0x3e')](handleError(_0x25eb61,null));};exports[_0x2dd1('0x3f')]=function(_0x1e3877,_0x2156d1){var _0x257e84={'raw':!![],'where':{'id':_0x1e3877[_0x2dd1('0x40')]['id']}},_0x4d7edf={};_0x4d7edf[_0x2dd1('0x2b')]=_['keys'](db[_0x2dd1('0x27')][_0x2dd1('0x28')]);_0x4d7edf[_0x2dd1('0x2c')]=_['keys'](_0x1e3877[_0x2dd1('0x2c')]);_0x4d7edf['filters']=_[_0x2dd1('0x2f')](_0x4d7edf[_0x2dd1('0x2b')],_0x4d7edf[_0x2dd1('0x2c')]);_0x257e84[_0x2dd1('0x31')]=_[_0x2dd1('0x2f')](_0x4d7edf[_0x2dd1('0x2b')],qs[_0x2dd1('0x30')](_0x1e3877[_0x2dd1('0x2c')][_0x2dd1('0x30')]));_0x257e84[_0x2dd1('0x31')]=_0x257e84[_0x2dd1('0x31')][_0x2dd1('0x41')]?_0x257e84['attributes']:_0x4d7edf[_0x2dd1('0x2b')];if(_0x1e3877[_0x2dd1('0x2c')][_0x2dd1('0x3b')]){_0x257e84['include']=[{'all':!![]}];}_0x257e84=_['merge']({},_0x257e84,_0x1e3877['options']);return db['JscriptySessionReport'][_0x2dd1('0x42')](_0x257e84)[_0x2dd1('0x22')](handleEntityNotFound(_0x2156d1,null))[_0x2dd1('0x22')](respondWithResult(_0x2156d1,null))['catch'](handleError(_0x2156d1,null));};exports[_0x2dd1('0x43')]=function(_0x74b5c3,_0x70bd27){return db['JscriptySessionReport'][_0x2dd1('0x43')](_0x74b5c3[_0x2dd1('0x44')],{})[_0x2dd1('0x22')](respondWithResult(_0x70bd27,0xc9))[_0x2dd1('0x3e')](handleError(_0x70bd27,null));};exports[_0x2dd1('0x45')]=function(_0xc96bda,_0x3e39e8){if(_0xc96bda[_0x2dd1('0x44')]['id']){delete _0xc96bda[_0x2dd1('0x44')]['id'];}return db[_0x2dd1('0x27')][_0x2dd1('0x42')]({'where':{'id':_0xc96bda['params']['id']}})[_0x2dd1('0x22')](handleEntityNotFound(_0x3e39e8,null))['then'](saveUpdates(_0xc96bda['body'],null))[_0x2dd1('0x22')](respondWithResult(_0x3e39e8,null))[_0x2dd1('0x3e')](handleError(_0x3e39e8,null));};exports[_0x2dd1('0x46')]=function(_0x41c824,_0x4861b5){return db[_0x2dd1('0x27')][_0x2dd1('0x42')]({'where':{'id':_0x41c824['params']['id']}})[_0x2dd1('0x22')](handleEntityNotFound(_0x4861b5,null))[_0x2dd1('0x22')](removeEntity(_0x4861b5,null))[_0x2dd1('0x3e')](handleError(_0x4861b5,null));};exports[_0x2dd1('0x47')]=function(_0x57ec99,_0xcf20de){return db[_0x2dd1('0x27')]['describe']()[_0x2dd1('0x22')](respondWithResult(_0xcf20de,null))[_0x2dd1('0x3e')](handleError(_0xcf20de,null));};exports[_0x2dd1('0x48')]=function(_0x3f5702,_0x1746e3,_0x50b2fb){var _0x299c2f={'raw':!![],'where':{}};var _0x5e4bed={};var _0x1d63f4={'count':0x0,'rows':[]};return db[_0x2dd1('0x27')]['findOne']({'where':{'id':_0x3f5702[_0x2dd1('0x40')]['id']}})['then'](handleEntityNotFound(_0x1746e3,null))[_0x2dd1('0x22')](function(_0x5a1354){if(_0x5a1354){_0x5e4bed['model']=_['keys'](db[_0x2dd1('0x49')][_0x2dd1('0x28')]);_0x5e4bed[_0x2dd1('0x2c')]=_[_0x2dd1('0x2d')](_0x3f5702[_0x2dd1('0x2c')]);_0x5e4bed['filters']=_[_0x2dd1('0x2f')](_0x5e4bed[_0x2dd1('0x2b')],_0x5e4bed[_0x2dd1('0x2c')]);_0x299c2f[_0x2dd1('0x31')]=_[_0x2dd1('0x2f')](_0x5e4bed[_0x2dd1('0x2b')],qs[_0x2dd1('0x30')](_0x3f5702[_0x2dd1('0x2c')][_0x2dd1('0x30')]));_0x299c2f[_0x2dd1('0x31')]=_0x299c2f['attributes'][_0x2dd1('0x41')]?_0x299c2f[_0x2dd1('0x31')]:_0x5e4bed[_0x2dd1('0x2b')];if(!_0x3f5702['query']['hasOwnProperty'](_0x2dd1('0x33'))){_0x299c2f[_0x2dd1('0x1d')]=qs[_0x2dd1('0x1d')](_0x3f5702[_0x2dd1('0x2c')][_0x2dd1('0x1d')]);_0x299c2f[_0x2dd1('0x1c')]=qs['offset'](_0x3f5702[_0x2dd1('0x2c')][_0x2dd1('0x1c')]);}_0x299c2f[_0x2dd1('0x34')]=qs['sort'](_0x3f5702[_0x2dd1('0x2c')][_0x2dd1('0x4a')]);_0x299c2f[_0x2dd1('0x35')]=qs[_0x2dd1('0x2e')](_[_0x2dd1('0x36')](_0x3f5702['query'],_0x5e4bed['filters']));_0x299c2f['where'][_0x2dd1('0x4b')]=_0x5a1354['id'];if(_0x3f5702['query'][_0x2dd1('0x37')]){_0x299c2f[_0x2dd1('0x35')]=_['merge'](_0x299c2f[_0x2dd1('0x35')],{'$or':_[_0x2dd1('0x26')](_0x299c2f[_0x2dd1('0x31')],function(_0x51f66b){var _0x126f16={};_0x126f16[_0x51f66b]={'$like':'%'+_0x3f5702['query']['filter']+'%'};return _0x126f16;})});}_0x299c2f=_['merge']({},_0x299c2f,_0x3f5702[_0x2dd1('0x3a')]);return db[_0x2dd1('0x49')]['count']({'where':_0x299c2f['where']})[_0x2dd1('0x22')](function(_0x33c656){_0x1d63f4[_0x2dd1('0x1b')]=_0x33c656;if(_0x3f5702[_0x2dd1('0x2c')]['includeAll']){_0x299c2f[_0x2dd1('0x4c')]=[{'all':!![]}];}return db[_0x2dd1('0x49')][_0x2dd1('0x3c')](_0x299c2f);})[_0x2dd1('0x22')](function(_0x203b39){_0x1d63f4[_0x2dd1('0x3d')]=_0x203b39;return _0x1d63f4;});}})[_0x2dd1('0x22')](respondWithFilteredResult(_0x1746e3,_0x299c2f))[_0x2dd1('0x3e')](handleError(_0x1746e3,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 4af6747..e040ada 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 _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 +var _0x7b53=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash'];(function(_0x486d7c,_0x25f99d){var _0x2bc318=function(_0x494474){while(--_0x494474){_0x486d7c['push'](_0x486d7c['shift']());}};_0x2bc318(++_0x25f99d);}(_0x7b53,0x1d3));var _0x37b5=function(_0x18a612,_0x3d59a3){_0x18a612=_0x18a612-0x0;var _0x3aa221=_0x7b53[_0x18a612];return _0x3aa221;};'use strict';var _=require(_0x37b5('0x0'));var util=require(_0x37b5('0x1'));var logger=require(_0x37b5('0x2'))('api');var moment=require(_0x37b5('0x3'));var BPromise=require(_0x37b5('0x4'));var rp=require(_0x37b5('0x5'));var fs=require('fs');var path=require(_0x37b5('0x6'));var rimraf=require('rimraf');var config=require(_0x37b5('0x7'));var attributes=require(_0x37b5('0x8'));module[_0x37b5('0x9')]=function(_0x11ceb4,_0x22c3b0){return _0x11ceb4[_0x37b5('0xa')](_0x37b5('0xb'),attributes,{'tableName':_0x37b5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 9d0a849..ddfc004 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 _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 +var _0xe0d7=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptySessionReport,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring'];(function(_0x501ff0,_0xb0d7b2){var _0x573765=function(_0xb1cce6){while(--_0xb1cce6){_0x501ff0['push'](_0x501ff0['shift']());}};_0x573765(++_0xb0d7b2);}(_0xe0d7,0xba));var _0x7e0d=function(_0x150fb8,_0x2e80b9){_0x150fb8=_0x150fb8-0x0;var _0x4cf4fe=_0xe0d7[_0x150fb8];return _0x4cf4fe;};'use strict';var _=require(_0x7e0d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7e0d('0x1'));var rs=require(_0x7e0d('0x2'));var fs=require('fs');var Redis=require(_0x7e0d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e0d('0x4'));var logger=require(_0x7e0d('0x5'))(_0x7e0d('0x6'));var config=require(_0x7e0d('0x7'));var jayson=require(_0x7e0d('0x8'));var client=jayson[_0x7e0d('0x9')][_0x7e0d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a20a3,_0x2a6aa0,_0x174be9){return new BPromise(function(_0x48617b,_0x488796){return client['request'](_0x3a20a3,_0x174be9)[_0x7e0d('0xb')](function(_0x22cfbb){logger[_0x7e0d('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x2a6aa0,_0x7e0d('0xd'));logger[_0x7e0d('0xe')](_0x7e0d('0xf'),_0x2a6aa0,'request\x20sent',JSON['stringify'](_0x22cfbb));if(_0x22cfbb[_0x7e0d('0x10')]){if(_0x22cfbb[_0x7e0d('0x10')][_0x7e0d('0x11')]===0x1f4){logger[_0x7e0d('0x10')](_0x7e0d('0x12'),_0x2a6aa0,_0x22cfbb[_0x7e0d('0x10')]['message']);return _0x488796(_0x22cfbb[_0x7e0d('0x10')]['message']);}logger[_0x7e0d('0x10')](_0x7e0d('0x12'),_0x2a6aa0,_0x22cfbb['error'][_0x7e0d('0x13')]);return _0x48617b(_0x22cfbb[_0x7e0d('0x10')][_0x7e0d('0x13')]);}else{logger[_0x7e0d('0xc')](_0x7e0d('0x12'),_0x2a6aa0,'request\x20sent');_0x48617b(_0x22cfbb['result'][_0x7e0d('0x13')]);}})[_0x7e0d('0x14')](function(_0x16d4e3){logger[_0x7e0d('0x10')](_0x7e0d('0x12'),_0x2a6aa0,_0x16d4e3);_0x488796(_0x16d4e3);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index e781859..b6ce2bf 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 _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 +var _0xd9df=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','index','put','isAuthenticated','update','multer','util','path','connect-timeout'];(function(_0x2357f4,_0x233d9c){var _0x3fa9f0=function(_0x2178ed){while(--_0x2178ed){_0x2357f4['push'](_0x2357f4['shift']());}};_0x3fa9f0(++_0x233d9c);}(_0xd9df,0x1b6));var _0xfd9d=function(_0x433828,_0x11f959){_0x433828=_0x433828-0x0;var _0x3ee135=_0xd9df[_0x433828];return _0x3ee135;};'use strict';var multer=require(_0xfd9d('0x0'));var util=require(_0xfd9d('0x1'));var path=require(_0xfd9d('0x2'));var timeout=require(_0xfd9d('0x3'));var express=require(_0xfd9d('0x4'));var router=express['Router']();var auth=require(_0xfd9d('0x5'));var interaction=require(_0xfd9d('0x6'));var config=require(_0xfd9d('0x7'));var controller=require(_0xfd9d('0x8'));router['get']('/',controller[_0xfd9d('0x9')]);router[_0xfd9d('0xa')]('/:id',auth[_0xfd9d('0xb')](),controller[_0xfd9d('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 9b2fed8..a64b4ed 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 _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 +var _0x46ed=['sequelize','exports','STRING','INTEGER'];(function(_0x4e0026,_0x2b52b6){var _0x3f8ee7=function(_0x31d891){while(--_0x31d891){_0x4e0026['push'](_0x4e0026['shift']());}};_0x3f8ee7(++_0x2b52b6);}(_0x46ed,0x168));var _0xd46e=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x46ed[_0x1928c9];return _0x51b5fb;};'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 diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 6840f3a..6276ff9 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 _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 +var _0x304b=['body','find','params','get','checkLicense','key','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','limit','set','Content-Range','reject','update','then','destroy','sendStatus','error','name','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','fields','attributes','merge','options','getLicense','catch'];(function(_0x34533,_0x531aeb){var _0x5810ff=function(_0x478ff1){while(--_0x478ff1){_0x34533['push'](_0x34533['shift']());}};_0x5810ff(++_0x531aeb);}(_0x304b,0xfb));var _0xb304=function(_0x39d679,_0x480358){_0x39d679=_0x39d679-0x0;var _0x2e1439=_0x304b[_0x39d679];return _0x2e1439;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb304('0x0'));var rimraf=require(_0xb304('0x1'));var zipdir=require(_0xb304('0x2'));var jsonpatch=require(_0xb304('0x3'));var rp=require(_0xb304('0x4'));var moment=require(_0xb304('0x5'));var BPromise=require(_0xb304('0x6'));var Mustache=require(_0xb304('0x7'));var util=require('util');var path=require('path');var sox=require(_0xb304('0x8'));var csv=require(_0xb304('0x9'));var ejs=require(_0xb304('0xa'));var fs=require('fs');var _=require(_0xb304('0xb'));var squel=require(_0xb304('0xc'));var crypto=require(_0xb304('0xd'));var jsforce=require(_0xb304('0xe'));var deskjs=require(_0xb304('0xf'));var toCsv=require(_0xb304('0x9'));var querystring=require('querystring');var Papa=require(_0xb304('0x10'));var Redis=require(_0xb304('0x11'));var authService=require(_0xb304('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb304('0x13'));var hardwareService=require(_0xb304('0x14'));var logger=require(_0xb304('0x15'))(_0xb304('0x16'));var utils=require(_0xb304('0x17'));var config=require(_0xb304('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb304('0x19'))['db'];function respondWithStatusCode(_0x1f4ddb,_0x2f8cae){_0x2f8cae=_0x2f8cae||0xcc;return function(_0x743f7d){if(_0x743f7d){return _0x1f4ddb['sendStatus'](_0x2f8cae);}return _0x1f4ddb[_0xb304('0x1a')](_0x2f8cae)[_0xb304('0x1b')]();};}function respondWithResult(_0x733030,_0x44b7a7){_0x44b7a7=_0x44b7a7||0xc8;return function(_0x1ba608){if(_0x1ba608){return _0x733030[_0xb304('0x1a')](_0x44b7a7)[_0xb304('0x1c')](_0x1ba608);}};}function respondWithFilteredResult(_0x1a15c9,_0x218d92){return function(_0x22ac4b){if(_0x22ac4b){var _0x3d20b5=_0x22ac4b[_0xb304('0x1d')],_0x3be8cb=_0x218d92['offset'],_0x1252cb=_0x218d92['offset']+_0x218d92[_0xb304('0x1e')],_0x5867c0;if(_0x1252cb>=_0x3d20b5){_0x1252cb=_0x3d20b5;_0x5867c0=0xc8;}else{_0x5867c0=0xce;}_0x1a15c9[_0xb304('0x1a')](_0x5867c0);return _0x1a15c9[_0xb304('0x1f')](_0xb304('0x20'),_0x3be8cb+'-'+_0x1252cb+'/'+_0x3d20b5)[_0xb304('0x1c')](_0x22ac4b);}return null;};}function patchUpdates(_0x57fe0e){return function(_0x272b37){try{jsonpatch['apply'](_0x272b37,_0x57fe0e,!![]);}catch(_0x4318b3){return BPromise[_0xb304('0x21')](_0x4318b3);}return _0x272b37['save']();};}function saveUpdates(_0x49d49e,_0x586394){return function(_0x30c5ec){if(_0x30c5ec){return _0x30c5ec[_0xb304('0x22')](_0x49d49e)[_0xb304('0x23')](function(_0x3eb360){return _0x3eb360;});}return null;};}function removeEntity(_0x5cf81a,_0x218b9d){return function(_0x3694c4){if(_0x3694c4){return _0x3694c4[_0xb304('0x24')]()[_0xb304('0x23')](function(){_0x5cf81a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ab7ed,_0x2fd41b){return function(_0x4a16eb){if(!_0x4a16eb){_0x4ab7ed[_0xb304('0x25')](0x194);}return _0x4a16eb;};}function handleError(_0x5e2e5b,_0x19347f){_0x19347f=_0x19347f||0x1f4;return function(_0x148f48){logger[_0xb304('0x26')](_0x148f48['stack']);if(_0x148f48[_0xb304('0x27')]){delete _0x148f48['name'];}_0x5e2e5b[_0xb304('0x1a')](_0x19347f)['send'](_0x148f48);};}var utilLicense=require(_0xb304('0x28'));exports[_0xb304('0x29')]=function(_0x58971a,_0x57d706){var _0x368a0d={'raw':!![],'where':{'id':0x1}},_0x25e77b={};_0x25e77b[_0xb304('0x2a')]=_[_0xb304('0x2b')](db[_0xb304('0x2c')][_0xb304('0x2d')]);_0x25e77b[_0xb304('0x2e')]=_[_0xb304('0x2b')](_0x58971a[_0xb304('0x2e')]);_0x25e77b[_0xb304('0x2f')]=_['intersection'](_0x25e77b[_0xb304('0x2a')],_0x25e77b[_0xb304('0x2e')]);_0x368a0d['attributes']=_['intersection'](_0x25e77b[_0xb304('0x2a')],qs[_0xb304('0x30')](_0x58971a[_0xb304('0x2e')]['fields']));_0x368a0d[_0xb304('0x31')]=_0x368a0d[_0xb304('0x31')]['length']?_0x368a0d[_0xb304('0x31')]:_0x25e77b[_0xb304('0x2a')];_0x368a0d=_[_0xb304('0x32')]({},_0x368a0d,_0x58971a[_0xb304('0x33')]);return utilLicense[_0xb304('0x34')](_0x368a0d)['then'](respondWithResult(_0x57d706,null))[_0xb304('0x35')](handleError(_0x57d706,null));};exports[_0xb304('0x22')]=function(_0x457396,_0x2d3c8a){if(_0x457396[_0xb304('0x36')]['id']){delete _0x457396[_0xb304('0x36')]['id'];}return db[_0xb304('0x2c')][_0xb304('0x37')]({'where':{'id':_0x457396[_0xb304('0x38')]['id']}})[_0xb304('0x23')](handleEntityNotFound(_0x2d3c8a,null))[_0xb304('0x23')](function(_0x224285){var _0x8652ac=_0x224285[_0xb304('0x39')]({'plain':!![]});return utilLicense[_0xb304('0x3a')](_0x8652ac,_0x457396[_0xb304('0x36')][_0xb304('0x3b')]);})[_0xb304('0x23')](function(_0x5eec08){if(!_0x5eec08[_0xb304('0x3c')]){return saveUpdates(_0x457396[_0xb304('0x36')],null);}return _0x5eec08;})['then'](respondWithResult(_0x2d3c8a,null))[_0xb304('0x35')](handleError(_0x2d3c8a,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 168618d..ae7df29 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 _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 +var _0xcfe5=['license','lodash','util','request-promise','rimraf','../../config/environment','./license.attributes','define'];(function(_0x59f1f5,_0x439d77){var _0x448ea4=function(_0x241715){while(--_0x241715){_0x59f1f5['push'](_0x59f1f5['shift']());}};_0x448ea4(++_0x439d77);}(_0xcfe5,0x1c9));var _0x5cfe=function(_0x345ac8,_0x2daa49){_0x345ac8=_0x345ac8-0x0;var _0x552f86=_0xcfe5[_0x345ac8];return _0x552f86;};'use strict';var _=require(_0x5cfe('0x0'));var util=require(_0x5cfe('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5cfe('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5cfe('0x3'));var config=require(_0x5cfe('0x4'));var attributes=require(_0x5cfe('0x5'));module['exports']=function(_0x26bdda,_0x4a33f0){return _0x26bdda[_0x5cfe('0x6')]('License',attributes,{'tableName':_0x5cfe('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 d532502..2b324b1 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 _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 +var _0xfd6f=['../../config/logger','rpc','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x5d3056,_0x33058e){var _0x3e599a=function(_0x4e3f9c){while(--_0x4e3f9c){_0x5d3056['push'](_0x5d3056['shift']());}};_0x3e599a(++_0x33058e);}(_0xfd6f,0x19d));var _0xffd6=function(_0x1a3a77,_0x39137e){_0x1a3a77=_0x1a3a77-0x0;var _0x5bac4e=_0xfd6f[_0x1a3a77];return _0x5bac4e;};'use strict';var _=require(_0xffd6('0x0'));var util=require(_0xffd6('0x1'));var moment=require(_0xffd6('0x2'));var BPromise=require(_0xffd6('0x3'));var rs=require(_0xffd6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffd6('0x5'))['db'];var utils=require(_0xffd6('0x6'));var logger=require(_0xffd6('0x7'))(_0xffd6('0x8'));var config=require('../../config/environment');var jayson=require(_0xffd6('0x9'));var client=jayson[_0xffd6('0xa')][_0xffd6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10b335,_0x5c19ee,_0x3f9538){return new BPromise(function(_0x534a1b,_0x54d793){return client['request'](_0x10b335,_0x3f9538)[_0xffd6('0xc')](function(_0x4267fc){logger[_0xffd6('0xd')](_0xffd6('0xe'),_0x5c19ee,'request\x20sent');logger[_0xffd6('0xf')]('License,\x20%s,\x20%s,\x20%s',_0x5c19ee,'request\x20sent',JSON[_0xffd6('0x10')](_0x4267fc));if(_0x4267fc[_0xffd6('0x11')]){if(_0x4267fc[_0xffd6('0x11')]['code']===0x1f4){logger[_0xffd6('0x11')](_0xffd6('0xe'),_0x5c19ee,_0x4267fc['error'][_0xffd6('0x12')]);return _0x54d793(_0x4267fc[_0xffd6('0x11')][_0xffd6('0x12')]);}logger[_0xffd6('0x11')]('License,\x20%s,\x20%s',_0x5c19ee,_0x4267fc['error'][_0xffd6('0x12')]);return _0x534a1b(_0x4267fc[_0xffd6('0x11')][_0xffd6('0x12')]);}else{logger['info'](_0xffd6('0xe'),_0x5c19ee,_0xffd6('0x13'));_0x534a1b(_0x4267fc['result'][_0xffd6('0x12')]);}})['catch'](function(_0x1881a1){logger[_0xffd6('0x11')](_0xffd6('0xe'),_0x5c19ee,_0x1881a1);_0x54d793(_0x1881a1);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 38bb306..8de14bc 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 _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 +var _0x0a1c=['getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','/:id/applications','addApplications','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','removeAgents','exports','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0a1c,0xd2));var _0xc0a1=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0x0a1c[_0x34bc6c];return _0x168820;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc0a1('0x0'));var timeout=require(_0xc0a1('0x1'));var express=require(_0xc0a1('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc0a1('0x3'));var config=require(_0xc0a1('0x4'));var controller=require(_0xc0a1('0x5'));router[_0xc0a1('0x6')]('/',auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x8')]);router[_0xc0a1('0x6')](_0xc0a1('0x9'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0xa')]);router[_0xc0a1('0x6')](_0xc0a1('0xb'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0xc')]);router[_0xc0a1('0x6')](_0xc0a1('0xd'),auth[_0xc0a1('0x7')](),controller['getDispositions']);router[_0xc0a1('0x6')](_0xc0a1('0xe'),auth[_0xc0a1('0x7')](),controller['getAnswers']);router[_0xc0a1('0x6')](_0xc0a1('0xf'),auth[_0xc0a1('0x7')](),controller['getImap']);router[_0xc0a1('0x6')](_0xc0a1('0x10'),auth['isAuthenticated'](),controller[_0xc0a1('0x11')]);router[_0xc0a1('0x6')](_0xc0a1('0x12'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x13')]);router['get']('/:id/applications',auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x14')]);router['get']('/:id/messages',auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x15')]);router['get'](_0xc0a1('0x16'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x17')]);router[_0xc0a1('0x6')](_0xc0a1('0x18'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x19')]);router[_0xc0a1('0x1a')](_0xc0a1('0xd'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x1b')]);router[_0xc0a1('0x1a')](_0xc0a1('0xe'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x1c')]);router[_0xc0a1('0x1a')]('/',auth['isAuthenticated'](),controller[_0xc0a1('0x1d')]);router['post'](_0xc0a1('0xf'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x1e')]);router[_0xc0a1('0x1a')](_0xc0a1('0x10'),auth['isAuthenticated'](),controller[_0xc0a1('0x1f')]);router[_0xc0a1('0x1a')](_0xc0a1('0x12'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x20')]);router[_0xc0a1('0x1a')](_0xc0a1('0x21'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x22')]);router[_0xc0a1('0x1a')]('/:id/send',auth['isAuthenticated'](),controller[_0xc0a1('0x23')]);router[_0xc0a1('0x1a')]('/:id/users',auth['isAuthenticated'](),controller[_0xc0a1('0x24')]);router[_0xc0a1('0x25')]('/:id',auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x26')]);router[_0xc0a1('0x27')](_0xc0a1('0xd'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x28')]);router[_0xc0a1('0x27')](_0xc0a1('0xe'),auth['isAuthenticated'](),controller[_0xc0a1('0x29')]);router[_0xc0a1('0x27')](_0xc0a1('0xf'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x2a')]);router[_0xc0a1('0x27')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xc0a1('0x2b')]);router[_0xc0a1('0x27')]('/:id',auth[_0xc0a1('0x7')](),controller['destroy']);router[_0xc0a1('0x27')]('/:id/users',auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x2c')]);module[_0xc0a1('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 0a9deb1..bc9d395 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 _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 +var _0xbad2=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x292f93,_0x2c6e8e){var _0x5a94b1=function(_0x25735e){while(--_0x25735e){_0x292f93['push'](_0x292f93['shift']());}};_0x5a94b1(++_0x2c6e8e);}(_0xbad2,0x12e));var _0x2bad=function(_0x55d5fd,_0x2b1d70){_0x55d5fd=_0x55d5fd-0x0;var _0x429289=_0xbad2[_0x55d5fd];return _0x429289;};'use strict';var Sequelize=require(_0x2bad('0x0'));module[_0x2bad('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x2bad('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x2bad('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x2bad('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x2bad('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x2bad('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x2bad('0x2')],'allowNull':![],'defaultValue':_0x2bad('0x4')},'fontSize':{'type':Sequelize[_0x2bad('0x5')](0x2)[_0x2bad('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x2bad('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2bad('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2bad('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2bad('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2bad('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2bad('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2bad('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x2bad('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x2bad('0x3')],'defaultValue':![],'comment':_0x2bad('0x9'),'set':function(_0x1dc1a4){if(!_0x1dc1a4)this[_0x2bad('0xa')](_0x2bad('0xb'),null);this[_0x2bad('0xa')](_0x2bad('0xc'),_0x1dc1a4);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index d7dba64..ce62313 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 _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 +var _0x55a2=['request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','limit','Content-Range','json','apply','reject','update','get','UserProfileResource','stack','name','send','index','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filter','merge','options','includeAll','findAll','params','MailServerIn','include','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','order','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','key','email','ListId','isNil','cauthentication','user','cuser','password','pass','authentication','host','port','service','cservice','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailAccounts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','MailInteraction','CmContact','Contact','Owner','fullname','internal','Tag','color','tag','addApplications','transaction','destroy','MailApplication','bulkCreate','findAndCountAll','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','updatedAt','DESC','from','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List','Contacts','List\x20not\x20found','messageId','subject','out','Messages','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','User','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','defaults','redis','localhost','./mailAccount.socket','client','http'];(function(_0x2d873a,_0x4656a0){var _0x4e45b9=function(_0x4b331a){while(--_0x4b331a){_0x2d873a['push'](_0x2d873a['shift']());}};_0x4e45b9(++_0x4656a0);}(_0x55a2,0x161));var _0x255a=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x55a2[_0x1a8f86];return _0x20d876;};'use strict';var pdf=require(_0x255a('0x0'));var emlformat=require(_0x255a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x255a('0x2'));var rp=require(_0x255a('0x3'));var moment=require(_0x255a('0x4'));var BPromise=require(_0x255a('0x5'));var Mustache=require(_0x255a('0x6'));var util=require(_0x255a('0x7'));var path=require(_0x255a('0x8'));var sox=require(_0x255a('0x9'));var csv=require(_0x255a('0xa'));var ejs=require(_0x255a('0xb'));var fs=require('fs');var _=require(_0x255a('0xc'));var squel=require(_0x255a('0xd'));var crypto=require(_0x255a('0xe'));var jsforce=require(_0x255a('0xf'));var deskjs=require(_0x255a('0x10'));var toCsv=require(_0x255a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var htmlToText=require(_0x255a('0x11'));var juice=require('juice');var Redis=require(_0x255a('0x12'));var authService=require(_0x255a('0x13'));var qs=require(_0x255a('0x14'));var as=require(_0x255a('0x15'));var hardwareService=require(_0x255a('0x16'));var logger=require(_0x255a('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x255a('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x255a('0x19')](config[_0x255a('0x1a')],{'host':_0x255a('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x255a('0x1a')]));require(_0x255a('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x255a('0x1d')][_0x255a('0x1e')]({'port':0x232b});function respondWithRpcPromise(_0x34e74b,_0x1d073a,_0x486dd1,_0x3e37db){return new BPromise(function(_0x137b46,_0x2cad48){var _0x24228d=_0x3e37db||client;return _0x24228d[_0x255a('0x1f')](_0x34e74b,_0x486dd1)[_0x255a('0x20')](function(_0x4ee6e9){logger[_0x255a('0x21')](_0x255a('0x22'),_0x1d073a,_0x255a('0x23'));logger[_0x255a('0x24')](_0x255a('0x25'),_0x1d073a,'request\x20sent',JSON[_0x255a('0x26')](_0x4ee6e9));if(_0x4ee6e9[_0x255a('0x27')]){if(_0x4ee6e9[_0x255a('0x27')][_0x255a('0x28')]===0x1f4){logger[_0x255a('0x27')](_0x255a('0x22'),_0x1d073a,_0x4ee6e9[_0x255a('0x27')][_0x255a('0x29')]);return _0x2cad48(_0x4ee6e9['error'][_0x255a('0x29')]);}logger[_0x255a('0x27')](_0x255a('0x22'),_0x1d073a,_0x4ee6e9[_0x255a('0x27')][_0x255a('0x29')]);return _0x137b46(_0x4ee6e9[_0x255a('0x27')]['message']);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x1d073a,_0x255a('0x23'));_0x137b46(_0x4ee6e9[_0x255a('0x2a')][_0x255a('0x29')]);}})[_0x255a('0x2b')](function(_0x5a1c12){logger[_0x255a('0x27')](_0x255a('0x22'),_0x1d073a,_0x5a1c12);_0x2cad48(_0x5a1c12);});});}function respondWithStatusCode(_0x17869b,_0x464e98){_0x464e98=_0x464e98||0xcc;return function(_0x53b409){if(_0x53b409){return _0x17869b[_0x255a('0x2c')](_0x464e98);}return _0x17869b[_0x255a('0x2d')](_0x464e98)[_0x255a('0x2e')]();};}function respondWithResult(_0x345c06,_0x15b13b){_0x15b13b=_0x15b13b||0xc8;return function(_0x30ed91){if(_0x30ed91){return _0x345c06[_0x255a('0x2d')](_0x15b13b)['json'](_0x30ed91);}};}function respondWithFilteredResult(_0x5b6daa,_0xa2589d){return function(_0x26396e){if(_0x26396e){var _0x3e92a9=_0x26396e[_0x255a('0x2f')],_0x1dc6c3=_0xa2589d['offset'],_0x26c60e=_0xa2589d['offset']+_0xa2589d[_0x255a('0x30')],_0x21d2d4;if(_0x26c60e>=_0x3e92a9){_0x26c60e=_0x3e92a9;_0x21d2d4=0xc8;}else{_0x21d2d4=0xce;}_0x5b6daa[_0x255a('0x2d')](_0x21d2d4);return _0x5b6daa['set'](_0x255a('0x31'),_0x1dc6c3+'-'+_0x26c60e+'/'+_0x3e92a9)[_0x255a('0x32')](_0x26396e);}return null;};}function patchUpdates(_0x168924){return function(_0x185b33){try{jsonpatch[_0x255a('0x33')](_0x185b33,_0x168924,!![]);}catch(_0x343d10){return BPromise[_0x255a('0x34')](_0x343d10);}return _0x185b33['save']();};}function saveUpdates(_0x17abf6,_0x4cf8dd){return function(_0x3f8f89){if(_0x3f8f89){return _0x3f8f89[_0x255a('0x35')](_0x17abf6)[_0x255a('0x20')](function(_0x39d78c){return _0x39d78c;});}return null;};}function removeEntity(_0x1e9c2a,_0x41d9b7){return function(_0x157454){if(_0x157454){return _0x157454['destroy']()[_0x255a('0x20')](function(){var _0x56123b=_0x157454[_0x255a('0x36')]({'plain':!![]});var _0x29150b='MailAccounts';return db[_0x255a('0x37')]['destroy']({'where':{'type':_0x29150b,'resourceId':_0x56123b['id']}})['then'](function(){return _0x157454;});})[_0x255a('0x20')](function(){_0x1e9c2a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x585a34,_0x3ae46f){return function(_0x4bfc43){if(!_0x4bfc43){_0x585a34[_0x255a('0x2c')](0x194);}return _0x4bfc43;};}function handleError(_0x13cf8c,_0x1c4256){_0x1c4256=_0x1c4256||0x1f4;return function(_0x889fb9){logger[_0x255a('0x27')](_0x889fb9[_0x255a('0x38')]);if(_0x889fb9[_0x255a('0x39')]){delete _0x889fb9['name'];}_0x13cf8c[_0x255a('0x2d')](_0x1c4256)[_0x255a('0x3a')](_0x889fb9);};}exports[_0x255a('0x3b')]=function(_0x20751c,_0x2bccc3){var _0x2808f0={'include':[{'model':db['MailServerIn'],'as':_0x255a('0x3c')},{'model':db[_0x255a('0x3d')],'as':_0x255a('0x3e')},{'model':db[_0x255a('0x3f')],'as':_0x255a('0x40')}]},_0x4d4945={},_0x2dfea8={'count':0x0,'rows':[]};var _0xa2849d=_[_0x255a('0x41')](db[_0x255a('0x42')][_0x255a('0x43')],function(_0x5aa290){return{'name':_0x5aa290[_0x255a('0x44')],'type':_0x5aa290[_0x255a('0x45')]['key']};});_0x4d4945[_0x255a('0x46')]=_['map'](_0xa2849d,_0x255a('0x39'));_0x4d4945[_0x255a('0x47')]=_[_0x255a('0x48')](_0x20751c['query']);_0x4d4945[_0x255a('0x49')]=_[_0x255a('0x4a')](_0x4d4945[_0x255a('0x46')],_0x4d4945[_0x255a('0x47')]);_0x2808f0[_0x255a('0x4b')]=_[_0x255a('0x4a')](_0x4d4945['model'],qs[_0x255a('0x4c')](_0x20751c['query']['fields']));_0x2808f0[_0x255a('0x4b')]=_0x2808f0[_0x255a('0x4b')][_0x255a('0x4d')]?_0x2808f0[_0x255a('0x4b')]:_0x4d4945['model'];if(!_0x20751c[_0x255a('0x47')][_0x255a('0x4e')](_0x255a('0x4f'))){_0x2808f0['limit']=qs[_0x255a('0x30')](_0x20751c['query'][_0x255a('0x30')]);_0x2808f0['offset']=qs[_0x255a('0x50')](_0x20751c[_0x255a('0x47')][_0x255a('0x50')]);}_0x2808f0['order']=qs[_0x255a('0x51')](_0x20751c['query']['sort']);_0x2808f0[_0x255a('0x52')]=qs['filters'](_['pick'](_0x20751c[_0x255a('0x47')],_0x4d4945[_0x255a('0x49')]),_0xa2849d);if(_0x20751c['query'][_0x255a('0x53')]){_0x2808f0[_0x255a('0x52')]=_[_0x255a('0x54')](_0x2808f0[_0x255a('0x52')],{'$or':_[_0x255a('0x41')](_0xa2849d,function(_0x4fed38){if(_0x4fed38['type']!=='VIRTUAL'){var _0x5d2d14={};_0x5d2d14[_0x4fed38['name']]={'$like':'%'+_0x20751c['query'][_0x255a('0x53')]+'%'};return _0x5d2d14;}})});}_0x2808f0=_[_0x255a('0x54')]({},_0x2808f0,_0x20751c[_0x255a('0x55')]);var _0xa2fd53={'where':_0x2808f0['where']};return db['MailAccount'][_0x255a('0x2f')](_0xa2fd53)['then'](function(_0x12dba5){_0x2dfea8['count']=_0x12dba5;if(_0x20751c['query'][_0x255a('0x56')]){_0x2808f0['include']=[{'all':!![]}];}return db[_0x255a('0x42')][_0x255a('0x57')](_0x2808f0);})[_0x255a('0x20')](function(_0x184a60){_0x2dfea8['rows']=_0x184a60;return _0x2dfea8;})[_0x255a('0x20')](respondWithFilteredResult(_0x2bccc3,_0x2808f0))[_0x255a('0x2b')](handleError(_0x2bccc3,null));};exports['show']=function(_0x17914c,_0x32a2c0){var _0x51bfb5={'raw':![],'where':{'id':_0x17914c[_0x255a('0x58')]['id']},'include':[{'model':db[_0x255a('0x59')],'as':_0x255a('0x3c')},{'model':db['MailServerOut'],'as':_0x255a('0x3e')},{'model':db[_0x255a('0x3f')],'as':_0x255a('0x40')}]},_0x293f25={};_0x293f25[_0x255a('0x46')]=_[_0x255a('0x48')](db[_0x255a('0x42')]['rawAttributes']);_0x293f25[_0x255a('0x47')]=_[_0x255a('0x48')](_0x17914c[_0x255a('0x47')]);_0x293f25[_0x255a('0x49')]=_['intersection'](_0x293f25['model'],_0x293f25[_0x255a('0x47')]);_0x51bfb5[_0x255a('0x4b')]=_[_0x255a('0x4a')](_0x293f25[_0x255a('0x46')],qs['fields'](_0x17914c['query']['fields']));_0x51bfb5['attributes']=_0x51bfb5[_0x255a('0x4b')][_0x255a('0x4d')]?_0x51bfb5[_0x255a('0x4b')]:_0x293f25[_0x255a('0x46')];if(_0x17914c['query'][_0x255a('0x56')]){_0x51bfb5[_0x255a('0x5a')]=[{'all':!![]}];}_0x51bfb5=_['merge']({},_0x51bfb5,_0x17914c[_0x255a('0x55')]);return db[_0x255a('0x42')][_0x255a('0x5b')](_0x51bfb5)[_0x255a('0x20')](handleEntityNotFound(_0x32a2c0,null))['then'](respondWithResult(_0x32a2c0,null))['catch'](handleError(_0x32a2c0,null));};exports[_0x255a('0x35')]=function(_0x21471d,_0x1eab07){if(_0x21471d[_0x255a('0x5c')]['id']){delete _0x21471d[_0x255a('0x5c')]['id'];}return db[_0x255a('0x42')]['find']({'where':{'id':_0x21471d[_0x255a('0x58')]['id']},'include':[{'model':db[_0x255a('0x59')],'as':'Imap'},{'model':db[_0x255a('0x3d')],'as':'Smtp'},{'model':db[_0x255a('0x3f')],'as':_0x255a('0x40')}]})[_0x255a('0x20')](handleEntityNotFound(_0x1eab07,null))[_0x255a('0x20')](saveUpdates(_0x21471d[_0x255a('0x5c')],null))[_0x255a('0x20')](function(_0x36794a){if(_0x36794a&&_0x21471d[_0x255a('0x5c')][_0x255a('0x3c')]){return db[_0x255a('0x59')][_0x255a('0x35')](_0x21471d[_0x255a('0x5c')][_0x255a('0x3c')],{'where':{'MailAccountId':_0x36794a['id']}})['then'](function(){return _0x36794a;});}return _0x36794a;})[_0x255a('0x20')](function(_0x4e7778){if(_0x4e7778&&_0x21471d['body'][_0x255a('0x3e')]){return db['MailServerOut'][_0x255a('0x35')](_0x21471d[_0x255a('0x5c')][_0x255a('0x3e')],{'where':{'MailAccountId':_0x4e7778['id']}})[_0x255a('0x20')](function(){return _0x4e7778;});}return _0x4e7778;})[_0x255a('0x20')](respondWithResult(_0x1eab07,null))[_0x255a('0x2b')](handleError(_0x1eab07,null));};exports['describe']=function(_0xa76311,_0xc0ac9){return db[_0x255a('0x42')][_0x255a('0x5d')]()[_0x255a('0x20')](respondWithResult(_0xc0ac9,null))['catch'](handleError(_0xc0ac9,null));};exports[_0x255a('0x5e')]=function(_0x282a7d,_0x22d824,_0x1f9793){if(_0x282a7d['body']['id']){delete _0x282a7d['body']['id'];}return db[_0x255a('0x42')][_0x255a('0x5b')]({'where':{'id':_0x282a7d[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x22d824,null))[_0x255a('0x20')](function(_0x2316cf){if(_0x2316cf){_0x282a7d[_0x255a('0x5c')][_0x255a('0x5f')]=_0x2316cf['id'];return db[_0x255a('0x60')][_0x255a('0x61')](_0x282a7d['body']);}})['then'](respondWithResult(_0x22d824,null))[_0x255a('0x2b')](handleError(_0x22d824,null));};exports[_0x255a('0x62')]=function(_0x23a9c9,_0x31b540,_0x23f70b){var _0x38cd1a={'raw':![],'where':{}};var _0x2fd28c={};var _0x2d6726={'count':0x0,'rows':[]};return db[_0x255a('0x42')][_0x255a('0x63')]({'where':{'id':_0x23a9c9['params']['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x31b540,null))[_0x255a('0x20')](function(_0x2f43d0){if(_0x2f43d0){_0x2fd28c[_0x255a('0x46')]=_['keys'](db['Disposition']['rawAttributes']);_0x2fd28c['query']=_['keys'](_0x23a9c9[_0x255a('0x47')]);_0x2fd28c[_0x255a('0x49')]=_[_0x255a('0x4a')](_0x2fd28c[_0x255a('0x46')],_0x2fd28c[_0x255a('0x47')]);_0x38cd1a[_0x255a('0x4b')]=_[_0x255a('0x4a')](_0x2fd28c[_0x255a('0x46')],qs[_0x255a('0x4c')](_0x23a9c9['query'][_0x255a('0x4c')]));_0x38cd1a['attributes']=_0x38cd1a['attributes'][_0x255a('0x4d')]?_0x38cd1a['attributes']:_0x2fd28c[_0x255a('0x46')];if(!_0x23a9c9['query'][_0x255a('0x4e')](_0x255a('0x4f'))){_0x38cd1a[_0x255a('0x30')]=qs[_0x255a('0x30')](_0x23a9c9['query'][_0x255a('0x30')]);_0x38cd1a[_0x255a('0x50')]=qs[_0x255a('0x50')](_0x23a9c9[_0x255a('0x47')][_0x255a('0x50')]);}_0x38cd1a[_0x255a('0x64')]=qs['sort'](_0x23a9c9[_0x255a('0x47')][_0x255a('0x51')]);_0x38cd1a[_0x255a('0x52')]=qs[_0x255a('0x49')](_[_0x255a('0x65')](_0x23a9c9[_0x255a('0x47')],_0x2fd28c[_0x255a('0x49')]));_0x38cd1a[_0x255a('0x52')][_0x255a('0x5f')]=_0x2f43d0['id'];if(_0x23a9c9[_0x255a('0x47')][_0x255a('0x53')]){_0x38cd1a[_0x255a('0x52')]=_[_0x255a('0x54')](_0x38cd1a['where'],{'$or':_[_0x255a('0x41')](_0x38cd1a[_0x255a('0x4b')],function(_0x581724){var _0x195ea6={};_0x195ea6[_0x581724]={'$like':'%'+_0x23a9c9[_0x255a('0x47')][_0x255a('0x53')]+'%'};return _0x195ea6;})});}_0x38cd1a=_[_0x255a('0x54')]({},_0x38cd1a,_0x23a9c9['options']);return db[_0x255a('0x60')][_0x255a('0x2f')]({'where':_0x38cd1a[_0x255a('0x52')]})['then'](function(_0x3ad0d8){_0x2d6726[_0x255a('0x2f')]=_0x3ad0d8;if(_0x23a9c9[_0x255a('0x47')]['includeAll']){_0x38cd1a[_0x255a('0x5a')]=[{'all':!![]}];}return db[_0x255a('0x60')][_0x255a('0x57')](_0x38cd1a);})[_0x255a('0x20')](function(_0x5d17bc){_0x2d6726[_0x255a('0x66')]=_0x5d17bc;return _0x2d6726;});}})[_0x255a('0x20')](respondWithFilteredResult(_0x31b540,_0x38cd1a))[_0x255a('0x2b')](handleError(_0x31b540,null));};exports[_0x255a('0x67')]=function(_0x445baa,_0xd2308b,_0x207c29){return db[_0x255a('0x42')][_0x255a('0x5b')]({'where':{'id':_0x445baa['params']['id']}})[_0x255a('0x20')](handleEntityNotFound(_0xd2308b,null))[_0x255a('0x20')](function(_0x35f7d5){if(_0x35f7d5){return _0x35f7d5['removeDispositions'](_0x445baa[_0x255a('0x47')][_0x255a('0x68')]);}})[_0x255a('0x20')](respondWithStatusCode(_0xd2308b,null))[_0x255a('0x2b')](handleError(_0xd2308b,null));};exports[_0x255a('0x69')]=function(_0x8fe1c2,_0x2844be,_0x5c8755){if(_0x8fe1c2[_0x255a('0x5c')]['id']){delete _0x8fe1c2[_0x255a('0x5c')]['id'];}return db[_0x255a('0x42')]['find']({'where':{'id':_0x8fe1c2[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x2844be,null))[_0x255a('0x20')](function(_0x9f086c){if(_0x9f086c){_0x8fe1c2[_0x255a('0x5c')]['MailAccountId']=_0x9f086c['id'];return db[_0x255a('0x6a')][_0x255a('0x61')](_0x8fe1c2[_0x255a('0x5c')]);}})[_0x255a('0x20')](respondWithResult(_0x2844be,null))[_0x255a('0x2b')](handleError(_0x2844be,null));};exports['getAnswers']=function(_0x571d0e,_0x2469fe,_0x1a947b){var _0x4097c5={'raw':![],'where':{}};var _0x1b58a1={};var _0x5ab5b2={'count':0x0,'rows':[]};return db[_0x255a('0x42')][_0x255a('0x63')]({'where':{'id':_0x571d0e['params']['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x2469fe,null))[_0x255a('0x20')](function(_0x24d746){if(_0x24d746){_0x1b58a1[_0x255a('0x46')]=_[_0x255a('0x48')](db[_0x255a('0x6a')]['rawAttributes']);_0x1b58a1[_0x255a('0x47')]=_['keys'](_0x571d0e['query']);_0x1b58a1[_0x255a('0x49')]=_[_0x255a('0x4a')](_0x1b58a1[_0x255a('0x46')],_0x1b58a1[_0x255a('0x47')]);_0x4097c5[_0x255a('0x4b')]=_[_0x255a('0x4a')](_0x1b58a1[_0x255a('0x46')],qs[_0x255a('0x4c')](_0x571d0e[_0x255a('0x47')]['fields']));_0x4097c5[_0x255a('0x4b')]=_0x4097c5[_0x255a('0x4b')][_0x255a('0x4d')]?_0x4097c5[_0x255a('0x4b')]:_0x1b58a1[_0x255a('0x46')];if(!_0x571d0e[_0x255a('0x47')]['hasOwnProperty']('nolimit')){_0x4097c5[_0x255a('0x30')]=qs[_0x255a('0x30')](_0x571d0e[_0x255a('0x47')][_0x255a('0x30')]);_0x4097c5['offset']=qs[_0x255a('0x50')](_0x571d0e[_0x255a('0x47')][_0x255a('0x50')]);}_0x4097c5[_0x255a('0x64')]=qs[_0x255a('0x51')](_0x571d0e[_0x255a('0x47')][_0x255a('0x51')]);_0x4097c5[_0x255a('0x52')]=qs[_0x255a('0x49')](_['pick'](_0x571d0e[_0x255a('0x47')],_0x1b58a1['filters']));_0x4097c5['where'][_0x255a('0x5f')]=_0x24d746['id'];if(_0x571d0e[_0x255a('0x47')][_0x255a('0x53')]){_0x4097c5['where']=_[_0x255a('0x54')](_0x4097c5['where'],{'$or':_[_0x255a('0x41')](_0x4097c5[_0x255a('0x4b')],function(_0x28c016){var _0x3f6a1a={};_0x3f6a1a[_0x28c016]={'$like':'%'+_0x571d0e[_0x255a('0x47')]['filter']+'%'};return _0x3f6a1a;})});}_0x4097c5=_[_0x255a('0x54')]({},_0x4097c5,_0x571d0e[_0x255a('0x55')]);return db['CannedAnswer']['count']({'where':_0x4097c5[_0x255a('0x52')]})[_0x255a('0x20')](function(_0x52e13e){_0x5ab5b2[_0x255a('0x2f')]=_0x52e13e;if(_0x571d0e['query'][_0x255a('0x56')]){_0x4097c5[_0x255a('0x5a')]=[{'all':!![]}];}return db[_0x255a('0x6a')]['findAll'](_0x4097c5);})[_0x255a('0x20')](function(_0x1a4431){_0x5ab5b2['rows']=_0x1a4431;return _0x5ab5b2;});}})['then'](respondWithFilteredResult(_0x2469fe,_0x4097c5))[_0x255a('0x2b')](handleError(_0x2469fe,null));};exports[_0x255a('0x6b')]=function(_0x526e60,_0x462d32,_0x27794a){return db[_0x255a('0x42')][_0x255a('0x5b')]({'where':{'id':_0x526e60[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x462d32,null))[_0x255a('0x20')](function(_0xacd750){if(_0xacd750){return _0xacd750[_0x255a('0x6b')](_0x526e60['query'][_0x255a('0x68')]);}})[_0x255a('0x20')](respondWithStatusCode(_0x462d32,null))[_0x255a('0x2b')](handleError(_0x462d32,null));};exports[_0x255a('0x61')]=function(_0x2e4297,_0x4c9a4b){var _0x8c2ccf={'name':_0x2e4297[_0x255a('0x5c')]['name'],'key':_0x2e4297['body'][_0x255a('0x6c')],'email':_0x2e4297[_0x255a('0x5c')][_0x255a('0x6d')],'ListId':_0x2e4297[_0x255a('0x5c')][_0x255a('0x6e')],'active':!_[_0x255a('0x6f')](_0x2e4297[_0x255a('0x5c')]['active'])?_0x2e4297[_0x255a('0x5c')]['active']:!![],'description':_0x2e4297[_0x255a('0x5c')]['description']||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x2e4297[_0x255a('0x5c')]['cservice'])){if(_0x2e4297[_0x255a('0x5c')][_0x255a('0x70')]){_0x8c2ccf['Imap'][_0x255a('0x71')]=_0x8c2ccf['Smtp'][_0x255a('0x71')]=_0x2e4297[_0x255a('0x5c')][_0x255a('0x72')];_0x8c2ccf[_0x255a('0x3c')][_0x255a('0x73')]=_0x8c2ccf['Smtp'][_0x255a('0x74')]=_0x2e4297[_0x255a('0x5c')]['cpassword'];}else{_0x8c2ccf[_0x255a('0x3c')]['authentication']=_0x8c2ccf[_0x255a('0x3e')][_0x255a('0x75')]=![];}_0x8c2ccf['Imap'][_0x255a('0x76')]=_0x2e4297[_0x255a('0x5c')][_0x255a('0x3c')][_0x255a('0x76')];_0x8c2ccf['Imap'][_0x255a('0x77')]=_0x2e4297[_0x255a('0x5c')][_0x255a('0x3c')]['port'];_0x8c2ccf[_0x255a('0x3e')][_0x255a('0x76')]=_0x2e4297[_0x255a('0x5c')][_0x255a('0x3e')][_0x255a('0x76')];_0x8c2ccf[_0x255a('0x3e')][_0x255a('0x77')]=_0x2e4297['body'][_0x255a('0x3e')][_0x255a('0x77')];}else{_0x8c2ccf['Imap'][_0x255a('0x78')]=_0x8c2ccf['Smtp'][_0x255a('0x78')]=_0x2e4297[_0x255a('0x5c')][_0x255a('0x79')];_0x8c2ccf[_0x255a('0x3c')]['user']=_0x8c2ccf[_0x255a('0x3e')][_0x255a('0x71')]=_0x2e4297[_0x255a('0x5c')]['cuser'];_0x8c2ccf[_0x255a('0x3c')]['password']=_0x8c2ccf[_0x255a('0x3e')][_0x255a('0x74')]=_0x2e4297[_0x255a('0x5c')][_0x255a('0x7a')];}return db['MailAccount'][_0x255a('0x61')](_0x8c2ccf,{'include':[{'model':db[_0x255a('0x3d')],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0x255a('0x3c')}]})[_0x255a('0x20')](function(_0x520392){var _0x3b286d=_0x2e4297['user'][_0x255a('0x36')]({'plain':!![]});if(!_0x3b286d)throw new Error(_0x255a('0x7b'));if(_0x3b286d[_0x255a('0x7c')]===_0x255a('0x71')){var _0x3a9e4d=_0x520392[_0x255a('0x36')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x255a('0x7d'),'userProfileId':_0x3b286d[_0x255a('0x7e')]},'raw':!![]})[_0x255a('0x20')](function(_0x3b57e7){if(_0x3b57e7&&_0x3b57e7['autoAssociation']===0x0){return db[_0x255a('0x37')][_0x255a('0x61')]({'name':_0x3a9e4d[_0x255a('0x39')],'resourceId':_0x3a9e4d['id'],'type':_0x3b57e7[_0x255a('0x39')],'sectionId':_0x3b57e7['id']},{})[_0x255a('0x20')](function(){return _0x520392;});}else{return _0x520392;}})['catch'](function(_0x2e423f){logger[_0x255a('0x27')](_0x255a('0x7f'),_0x2e423f);throw _0x2e423f;});}return _0x520392;})[_0x255a('0x20')](respondWithResult(_0x4c9a4b,0xc9))[_0x255a('0x2b')](handleError(_0x4c9a4b,null));};exports[_0x255a('0x80')]=function(_0x2439ba,_0x234460,_0x273e73){return db[_0x255a('0x42')]['findOne']({'where':{'id':_0x2439ba[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x234460,null))[_0x255a('0x20')](function(_0x2b3641){if(_0x2b3641){return _0x2b3641[_0x255a('0x80')]();}return null;})['then'](respondWithResult(_0x234460,null))[_0x255a('0x2b')](handleError(_0x234460,null));};exports[_0x255a('0x81')]=function(_0x427764,_0x796f1b,_0x5bbce9){if(_0x427764['body']['id']){delete _0x427764['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x427764[_0x255a('0x58')]['id']}})['then'](handleEntityNotFound(_0x796f1b,null))[_0x255a('0x20')](function(_0x400c9b){if(_0x400c9b){_0x427764[_0x255a('0x5c')][_0x255a('0x5f')]=_0x400c9b['id'];return db[_0x255a('0x59')][_0x255a('0x61')](_0x427764[_0x255a('0x5c')]);}})[_0x255a('0x20')](respondWithResult(_0x796f1b,null))[_0x255a('0x2b')](handleError(_0x796f1b,null));};exports[_0x255a('0x82')]=function(_0x54a69a,_0x42a1da,_0x495327){return db['MailAccount'][_0x255a('0x63')]({'where':{'id':_0x54a69a[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x42a1da,null))['then'](function(_0x5371a5){if(_0x5371a5){return _0x5371a5[_0x255a('0x83')](null);}return null;})['then'](respondWithStatusCode(_0x42a1da,null))[_0x255a('0x2b')](handleError(_0x42a1da,null));};exports[_0x255a('0x84')]=function(_0xf27c9a,_0x2957cd,_0xa6f104){return db['MailAccount'][_0x255a('0x63')]({'where':{'id':_0xf27c9a[_0x255a('0x58')]['id']}})['then'](handleEntityNotFound(_0x2957cd,null))[_0x255a('0x20')](function(_0x332a26){if(_0x332a26){return _0x332a26[_0x255a('0x84')]();}return null;})[_0x255a('0x20')](respondWithResult(_0x2957cd,null))[_0x255a('0x2b')](handleError(_0x2957cd,null));};exports[_0x255a('0x85')]=function(_0x5c3dc4,_0x278a9c,_0x504837){if(_0x5c3dc4[_0x255a('0x5c')]['id']){delete _0x5c3dc4[_0x255a('0x5c')]['id'];}return db[_0x255a('0x42')][_0x255a('0x5b')]({'where':{'id':_0x5c3dc4['params']['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x278a9c,null))[_0x255a('0x20')](function(_0x28c255){if(_0x28c255){_0x5c3dc4[_0x255a('0x5c')][_0x255a('0x5f')]=_0x28c255['id'];return db[_0x255a('0x3d')][_0x255a('0x61')](_0x5c3dc4[_0x255a('0x5c')]);}})['then'](respondWithResult(_0x278a9c,null))[_0x255a('0x2b')](handleError(_0x278a9c,null));};exports[_0x255a('0x86')]=function(_0x2b7e20,_0xe07a92,_0x453f90){return db[_0x255a('0x42')]['findOne']({'where':{'id':_0x2b7e20['params']['id']}})[_0x255a('0x20')](handleEntityNotFound(_0xe07a92,null))[_0x255a('0x20')](function(_0x2aa7e1){if(_0x2aa7e1){return _0x2aa7e1[_0x255a('0x87')](null);}return null;})['then'](respondWithStatusCode(_0xe07a92,null))[_0x255a('0x2b')](handleError(_0xe07a92,null));};exports[_0x255a('0x88')]=function(_0xc46448,_0x32bf06,_0xa0c897){return db['MailInteraction'][_0x255a('0x5b')]({'where':{'id':_0xc46448[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x32bf06,null))[_0x255a('0x20')](function(_0x44552b){if(_0x44552b){return _0x44552b[_0x255a('0x88')](_0xc46448[_0x255a('0x5c')][_0x255a('0x68')],_[_0x255a('0x89')](_0xc46448[_0x255a('0x5c')],[_0x255a('0x68'),'id'])||{});}})[_0x255a('0x20')](respondWithResult(_0x32bf06,null))['catch'](handleError(_0x32bf06,null));};exports['getInteractions']=function(_0x544d07,_0x291edd,_0x2585b1){var _0xa15448={'raw':![],'where':{}};var _0x1ff1bf={};var _0x950c50={'count':0x0,'rows':[]};return db[_0x255a('0x42')][_0x255a('0x63')]({'where':{'id':_0x544d07[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x291edd,null))['then'](function(_0x4a96ba){if(_0x4a96ba){_0x1ff1bf[_0x255a('0x46')]=_['keys'](db[_0x255a('0x8a')]['rawAttributes']);_0x1ff1bf['query']=_['keys'](_0x544d07[_0x255a('0x47')]);_0x1ff1bf['filters']=_['intersection'](_0x1ff1bf[_0x255a('0x46')],_0x1ff1bf[_0x255a('0x47')]);_0xa15448['attributes']=_[_0x255a('0x4a')](_0x1ff1bf['model'],qs[_0x255a('0x4c')](_0x544d07['query'][_0x255a('0x4c')]));_0xa15448[_0x255a('0x4b')]=_0xa15448[_0x255a('0x4b')][_0x255a('0x4d')]?_0xa15448[_0x255a('0x4b')]:_0x1ff1bf[_0x255a('0x46')];if(!_0x544d07[_0x255a('0x47')][_0x255a('0x4e')](_0x255a('0x4f'))){_0xa15448['limit']=qs['limit'](_0x544d07['query'][_0x255a('0x30')]);_0xa15448[_0x255a('0x50')]=qs[_0x255a('0x50')](_0x544d07['query']['offset']);}_0xa15448[_0x255a('0x64')]=qs[_0x255a('0x51')](_0x544d07[_0x255a('0x47')][_0x255a('0x51')]);_0xa15448[_0x255a('0x52')]=qs[_0x255a('0x49')](_[_0x255a('0x65')](_0x544d07['query'],_0x1ff1bf[_0x255a('0x49')]));_0xa15448[_0x255a('0x52')][_0x255a('0x5f')]=_0x4a96ba['id'];if(_0x544d07['query'][_0x255a('0x53')]){_0xa15448['where']=_[_0x255a('0x54')](_0xa15448[_0x255a('0x52')],{'$or':_['map'](_0xa15448['attributes'],function(_0x107d81){var _0x1f60dd={};_0x1f60dd[_0x107d81]={'$like':'%'+_0x544d07[_0x255a('0x47')]['filter']+'%'};return _0x1f60dd;})});}_0xa15448=_[_0x255a('0x54')]({},_0xa15448,_0x544d07[_0x255a('0x55')]);return db[_0x255a('0x8a')][_0x255a('0x2f')]({'where':_0xa15448[_0x255a('0x52')]})[_0x255a('0x20')](function(_0x40924d){_0x950c50[_0x255a('0x2f')]=_0x40924d;if(_0x544d07['query'][_0x255a('0x56')]){_0xa15448[_0x255a('0x5a')]=[{'model':db[_0x255a('0x8b')],'as':_0x255a('0x8c'),'required':![]},{'model':db['User'],'as':_0x255a('0x8d'),'attributes':['name',_0x255a('0x8e'),_0x255a('0x8f')],'required':![]},{'model':db[_0x255a('0x90')],'as':'Tags','attributes':['id',_0x255a('0x39'),_0x255a('0x91')],'where':_0x544d07[_0x255a('0x47')]['tag']?{'id':_0x544d07[_0x255a('0x47')][_0x255a('0x92')]}:undefined,'required':_0x544d07[_0x255a('0x47')][_0x255a('0x92')]?!![]:![]}];}return db[_0x255a('0x8a')]['findAll'](_0xa15448);})[_0x255a('0x20')](function(_0x5271c5){_0x950c50['rows']=_0x5271c5;return _0x950c50;});}})[_0x255a('0x20')](respondWithFilteredResult(_0x291edd,_0xa15448))['catch'](handleError(_0x291edd,null));};exports[_0x255a('0x93')]=function(_0x5aa71b,_0x361f60,_0x2cfdec){return db['MailAccount'][_0x255a('0x63')]({'where':{'id':_0x5aa71b[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x361f60,null))['then'](function(_0x273fb4){if(_0x273fb4){return db['sequelize'][_0x255a('0x94')](function(_0x4df8d8){return db['MailApplication'][_0x255a('0x95')]({'where':{'MailAccountId':_0x5aa71b[_0x255a('0x58')]['id']},'transaction':_0x4df8d8})[_0x255a('0x20')](function(_0x36b630){var _0x3ee79d=_[_0x255a('0x41')](_0x5aa71b[_0x255a('0x5c')],function(_0x505311){_0x505311[_0x255a('0x5f')]=_0x5aa71b[_0x255a('0x58')]['id'];return _0x505311;});return db[_0x255a('0x96')][_0x255a('0x97')](_0x3ee79d,{'transaction':_0x4df8d8});});})[_0x255a('0x20')](function(){return db[_0x255a('0x96')][_0x255a('0x98')]({'where':{'MailAccountId':_0x5aa71b[_0x255a('0x58')]['id']},'order':'priority'});});}})[_0x255a('0x20')](respondWithResult(_0x361f60,null))['catch'](handleError(_0x361f60,null));};exports[_0x255a('0x99')]=function(_0x318b07,_0x3cbcdf,_0x3f22fb){var _0x5c8520={};var _0x540b20={};var _0x378555;var _0x26e551;return db[_0x255a('0x42')][_0x255a('0x63')]({'where':{'id':_0x318b07[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x3cbcdf,null))['then'](function(_0x33a5a7){if(_0x33a5a7){_0x378555=_0x33a5a7;_0x540b20[_0x255a('0x46')]=_[_0x255a('0x48')](db[_0x255a('0x96')][_0x255a('0x43')]);_0x540b20[_0x255a('0x47')]=_[_0x255a('0x48')](_0x318b07[_0x255a('0x47')]);_0x540b20[_0x255a('0x49')]=_[_0x255a('0x4a')](_0x540b20[_0x255a('0x46')],_0x540b20['query']);_0x5c8520[_0x255a('0x4b')]=_['intersection'](_0x540b20[_0x255a('0x46')],qs[_0x255a('0x4c')](_0x318b07[_0x255a('0x47')][_0x255a('0x4c')]));_0x5c8520[_0x255a('0x4b')]=_0x5c8520[_0x255a('0x4b')]['length']?_0x5c8520['attributes']:_0x540b20['model'];_0x5c8520[_0x255a('0x64')]=qs['sort'](_0x318b07[_0x255a('0x47')][_0x255a('0x51')]);_0x5c8520[_0x255a('0x52')]=qs[_0x255a('0x49')](_['pick'](_0x318b07[_0x255a('0x47')],_0x540b20['filters']));if(_0x318b07['query'][_0x255a('0x53')]){_0x5c8520[_0x255a('0x52')]=_[_0x255a('0x54')](_0x5c8520[_0x255a('0x52')],{'$or':_['map'](_0x5c8520[_0x255a('0x4b')],function(_0xad78a4){var _0x37bafa={};_0x37bafa[_0xad78a4]={'$like':'%'+_0x318b07[_0x255a('0x47')][_0x255a('0x53')]+'%'};return _0x37bafa;})});}_0x5c8520=_[_0x255a('0x54')]({},_0x5c8520,_0x318b07[_0x255a('0x55')]);return _0x378555[_0x255a('0x99')](_0x5c8520);}})[_0x255a('0x20')](function(_0x57072e){if(_0x57072e){_0x26e551=_0x57072e[_0x255a('0x4d')];if(!_0x318b07[_0x255a('0x47')][_0x255a('0x4e')]('nolimit')){_0x5c8520[_0x255a('0x30')]=qs[_0x255a('0x30')](_0x318b07[_0x255a('0x47')][_0x255a('0x30')]);_0x5c8520[_0x255a('0x50')]=qs[_0x255a('0x50')](_0x318b07[_0x255a('0x47')]['offset']);}return _0x378555['getApplications'](_0x5c8520);}})[_0x255a('0x20')](function(_0x3e267b){if(_0x3e267b){return _0x3e267b?{'count':_0x26e551,'rows':_0x3e267b}:null;}})[_0x255a('0x20')](respondWithResult(_0x3cbcdf,null))[_0x255a('0x2b')](handleError(_0x3cbcdf,null));};exports[_0x255a('0x9a')]=function(_0xf023b7,_0x2adf9a,_0x46992c){var _0x4b425e={'raw':!![],'where':{}};var _0x30ec60={};var _0xe4118d={'count':0x0,'rows':[]};return db[_0x255a('0x42')][_0x255a('0x63')]({'where':{'id':_0xf023b7[_0x255a('0x58')]['id']}})['then'](handleEntityNotFound(_0x2adf9a,null))[_0x255a('0x20')](function(_0x13c73c){if(_0x13c73c){_0x30ec60[_0x255a('0x46')]=_['keys'](db[_0x255a('0x9b')]['rawAttributes']);_0x30ec60[_0x255a('0x47')]=_[_0x255a('0x48')](_0xf023b7['query']);_0x30ec60[_0x255a('0x49')]=_[_0x255a('0x4a')](_0x30ec60[_0x255a('0x46')],_0x30ec60[_0x255a('0x47')]);_0x4b425e['attributes']=_[_0x255a('0x4a')](_0x30ec60[_0x255a('0x46')],qs[_0x255a('0x4c')](_0xf023b7[_0x255a('0x47')][_0x255a('0x4c')]));_0x4b425e['attributes']=_0x4b425e['attributes'][_0x255a('0x4d')]?_0x4b425e[_0x255a('0x4b')]:_0x30ec60[_0x255a('0x46')];if(!_0xf023b7[_0x255a('0x47')][_0x255a('0x4e')](_0x255a('0x4f'))){_0x4b425e['limit']=qs[_0x255a('0x30')](_0xf023b7[_0x255a('0x47')][_0x255a('0x30')]);_0x4b425e[_0x255a('0x50')]=qs['offset'](_0xf023b7[_0x255a('0x47')][_0x255a('0x50')]);}_0x4b425e[_0x255a('0x64')]=qs[_0x255a('0x51')](_0xf023b7[_0x255a('0x47')]['sort']);_0x4b425e[_0x255a('0x52')]=qs[_0x255a('0x49')](_[_0x255a('0x65')](_0xf023b7[_0x255a('0x47')],_0x30ec60[_0x255a('0x49')]));_0x4b425e[_0x255a('0x52')][_0x255a('0x5f')]=_0x13c73c['id'];if(_0xf023b7[_0x255a('0x47')][_0x255a('0x53')]){_0x4b425e[_0x255a('0x52')]=_[_0x255a('0x54')](_0x4b425e[_0x255a('0x52')],{'$or':_[_0x255a('0x41')](_0x4b425e[_0x255a('0x4b')],function(_0x183f8d){var _0x297564={};_0x297564[_0x183f8d]={'$like':'%'+_0xf023b7['query'][_0x255a('0x53')]+'%'};return _0x297564;})});}if(_0xf023b7[_0x255a('0x47')][_0x255a('0x9c')]){var _0x1e150e=_0xf023b7[_0x255a('0x47')]['$gte'][_0x255a('0x9d')](',');var _0x4d263e={};_0x4d263e[_0x1e150e[0x0]]={'$gte':moment(_0x1e150e[0x1])[_0x255a('0x9e')](_0x255a('0x9f'))};_0x4b425e[_0x255a('0x52')]=_[_0x255a('0x54')](_0x4b425e[_0x255a('0x52')],_0x4d263e);}_0x4b425e=_[_0x255a('0x54')]({},_0x4b425e,_0xf023b7[_0x255a('0x55')]);return db[_0x255a('0x9b')][_0x255a('0x2f')]({'where':_0x4b425e[_0x255a('0x52')]})[_0x255a('0x20')](function(_0x16f18e){_0xe4118d[_0x255a('0x2f')]=_0x16f18e;if(_0xf023b7[_0x255a('0x47')][_0x255a('0x56')]){_0x4b425e[_0x255a('0x5a')]=[{'all':!![]}];}return db['MailMessage'][_0x255a('0x57')](_0x4b425e);})['then'](function(_0x24185f){if(_0xf023b7[_0x255a('0x47')][_0x255a('0xa0')]===_0x255a('0xa1')){for(var _0x40d5a0=0x0;_0x40d5a0<_0x24185f[_0x255a('0x4d')];_0x40d5a0++){_0x24185f[_0x40d5a0][_0x255a('0x5c')]=juice(_0x24185f[_0x40d5a0][_0x255a('0x5c')]);}}_0xe4118d['rows']=_0x24185f;return _0xe4118d;});}})[_0x255a('0x20')](respondWithFilteredResult(_0x2adf9a,_0x4b425e))[_0x255a('0x2b')](handleError(_0x2adf9a,null));};exports[_0x255a('0x3a')]=function(_0x2fdb0b,_0x3ee46e,_0x5347ac){var _0x125b03,_0x193094={},_0x2506cb;if(_0x2fdb0b['body']['to']){_0x2506cb=_0x2fdb0b[_0x255a('0x5c')]['to'][_0x255a('0x9d')](',')[0x0];}return db[_0x255a('0x42')][_0x255a('0x5b')]({'where':{'id':_0x2fdb0b[_0x255a('0x58')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x255a('0x8b')],'as':'Contacts','where':{'email':_0x2506cb},'limit':0x1,'order':[[_0x255a('0xa2'),_0x255a('0xa3')]]}]},{'model':db[_0x255a('0x3d')],'as':_0x255a('0x3e'),'raw':!![]}]})[_0x255a('0x20')](handleEntityNotFound(_0x3ee46e,null))[_0x255a('0x20')](function(_0x10b015){if(_0x10b015){_0x125b03=_0x10b015;if(_0x10b015[_0x255a('0x3e')]){if(_[_0x255a('0x6f')](_0x2fdb0b[_0x255a('0x5c')]['from'])){_0x2fdb0b[_0x255a('0x5c')][_0x255a('0xa4')]=util[_0x255a('0x9e')]('%s\x20<%s>',_0x10b015[_0x255a('0x39')],_0x10b015[_0x255a('0x6d')]||_0x10b015[_0x255a('0x3e')][_0x255a('0x71')]);}if(_0x2fdb0b[_0x255a('0x5c')][_0x255a('0xa5')]&&_0x2fdb0b['body'][_0x255a('0xa5')][_0x255a('0x4d')]){for(var _0x1250b=0x0;_0x1250b<_0x2fdb0b[_0x255a('0x5c')][_0x255a('0xa5')][_0x255a('0x4d')];_0x1250b+=0x1){_0x2fdb0b['body'][_0x255a('0xa5')][_0x1250b]={'filename':_0x2fdb0b['body'][_0x255a('0xa5')][_0x1250b][_0x255a('0x39')],'path':path[_0x255a('0xa6')](config[_0x255a('0xa7')],_0x255a('0xa8'),_0x2fdb0b[_0x255a('0x5c')][_0x255a('0xa5')][_0x1250b][_0x255a('0xa9')])};}}var _0x23cbc3={'tls':{'rejectUnauthorized':![]}};if(_[_0x255a('0x6f')](_0x10b015['Smtp'][_0x255a('0x78')])){if(_0x10b015[_0x255a('0x3e')][_0x255a('0x75')]){_0x23cbc3[_0x255a('0xaa')]={'user':_0x10b015[_0x255a('0x3e')][_0x255a('0x71')],'pass':_0x10b015['Smtp']['pass']};}_0x23cbc3[_0x255a('0x76')]=_0x10b015[_0x255a('0x3e')]['host'];_0x23cbc3['port']=_0x10b015['Smtp']['port'];_0x23cbc3['secure']=_0x10b015[_0x255a('0x3e')][_0x255a('0xab')];}else{_0x23cbc3[_0x255a('0x78')]=_0x10b015['Smtp'][_0x255a('0x78')];_0x23cbc3[_0x255a('0xaa')]={'user':_0x10b015['Smtp'][_0x255a('0x71')],'pass':_0x10b015[_0x255a('0x3e')][_0x255a('0x74')]};}return respondWithRpcPromise(_0x255a('0xac'),_0x255a('0xad'),{'account':_0x23cbc3,'message':_0x2fdb0b['body']});}else{throw new Error('List\x20not\x20found');}}})[_0x255a('0x20')](function(_0x37f2e4){if(_0x37f2e4){_0x193094=_0x37f2e4;if(_0x125b03['List']){if(_0x125b03[_0x255a('0xae')][_0x255a('0xaf')][_0x255a('0x4d')]){return _0x125b03['List'][_0x255a('0xaf')][0x0];}else{return db[_0x255a('0x8b')][_0x255a('0x61')](_[_0x255a('0x19')](_0x2fdb0b[_0x255a('0x5c')],{'firstName':_0x2fdb0b[_0x255a('0x5c')]['to'],'email':_0x2fdb0b[_0x255a('0x5c')]['to'],'phone':_0x2fdb0b[_0x255a('0x5c')]['to'],'ListId':_0x125b03[_0x255a('0x6e')]}));}}else{throw new Error(_0x255a('0xb0'));}}})[_0x255a('0x20')](function(_0x2a2ba9){if(_0x2a2ba9){var _0xb760b8={'UserId':_0x2fdb0b['user']['id'],'ContactId':_0x2a2ba9['id'],'MailAccountId':_0x125b03['id'],'inReplyTo':_0x193094[_0x255a('0xb1')],'to':_0x2fdb0b[_0x255a('0x5c')][_0x255a('0xa4')],'cc':_0x2fdb0b[_0x255a('0x5c')]['cc'],'subject':_0x2fdb0b[_0x255a('0x5c')][_0x255a('0xb2')],'attach':_0x2fdb0b[_0x255a('0x5c')]['attach'],'firstMsgDirection':_0x255a('0xb3'),'lastMsgAt':moment()[_0x255a('0x9e')](_0x255a('0x9f')),'lastMsgDirection':_0x255a('0xb3'),'lastMsgBody':_0x2fdb0b[_0x255a('0x5c')][_0x255a('0x5c')],'Messages':[_[_0x255a('0x54')](_0x2fdb0b[_0x255a('0x5c')],{'messageId':_0x193094[_0x255a('0xb1')],'sentAt':moment()[_0x255a('0x9e')](_0x255a('0x9f')),'read':!![],'MailAccountId':_0x125b03['id'],'UserId':_0x2fdb0b['user']['id'],'ContactId':_0x2a2ba9['id']})]};if(_0x2fdb0b[_0x255a('0x5c')]['Interaction']){_0xb760b8=_['merge'](_0xb760b8,_0x2fdb0b[_0x255a('0x5c')]['Interaction']);}return db[_0x255a('0x8a')]['create'](_0xb760b8,{'include':[{'model':db[_0x255a('0x9b')],'as':_0x255a('0xb4')}]});}})[_0x255a('0x20')](respondWithResult(_0x3ee46e,null))[_0x255a('0x2b')](handleError(_0x3ee46e,null));};exports[_0x255a('0xb5')]=function(_0x2f165e,_0x3b4a6d,_0x453aef){return db[_0x255a('0x42')][_0x255a('0x5b')]({'where':{'id':_0x2f165e[_0x255a('0x58')]['id']},'include':[{'model':db[_0x255a('0x3d')],'as':_0x255a('0x3e'),'raw':!![]}]})[_0x255a('0x20')](handleEntityNotFound(_0x3b4a6d,null))['then'](function(_0x41b7be){if(_0x41b7be&&_0x41b7be[_0x255a('0x3e')]){var _0x28d354={'id':_0x41b7be['id'],'tls':{'rejectUnauthorized':![]}};if(_0x41b7be['Smtp'][_0x255a('0x78')]){_0x28d354['service']=_0x41b7be['Smtp']['service'];}else{_0x28d354[_0x255a('0x76')]=_0x41b7be[_0x255a('0x3e')][_0x255a('0x76')];_0x28d354[_0x255a('0x77')]=_0x41b7be[_0x255a('0x3e')]['port'];_0x28d354['secure']=_0x41b7be[_0x255a('0x3e')][_0x255a('0xab')];}if(_0x41b7be[_0x255a('0x3e')][_0x255a('0x75')]){_0x28d354[_0x255a('0xaa')]={'user':_0x41b7be['Smtp'][_0x255a('0x71')],'pass':_0x41b7be[_0x255a('0x3e')][_0x255a('0x74')]};}return respondWithRpcPromise('VerifySmtp',_0x255a('0xb5'),{'account':_0x28d354});}})[_0x255a('0x20')](respondWithResult(_0x3b4a6d,null))[_0x255a('0x2b')](handleError(_0x3b4a6d,null));};exports['destroy']=function(_0x70d38,_0x9e8664){return db[_0x255a('0x42')]['find']({'where':{'id':_0x70d38[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x9e8664,null))[_0x255a('0x20')](function(_0x279f48){if(_0x279f48&&_0x279f48[_0x255a('0x78')]){throw new db['Sequelize'][(_0x255a('0xb6'))](_0x255a('0xb7'));}return _0x279f48;})[_0x255a('0x20')](removeEntity(_0x9e8664,null))[_0x255a('0x2b')](handleError(_0x9e8664,null));};exports[_0x255a('0xb8')]=function(_0x27ada3,_0x58380c,_0x35af8b){return db['MailAccount']['find']({'where':{'id':_0x27ada3[_0x255a('0x58')]['id']}})['then'](handleEntityNotFound(_0x58380c,null))[_0x255a('0x20')](function(_0x579d27){if(_0x579d27){return _0x579d27[_0x255a('0xb8')](_0x27ada3[_0x255a('0x5c')][_0x255a('0x68')],_['omit'](_0x27ada3[_0x255a('0x5c')],[_0x255a('0x68'),'id'])||{})['spread'](function(_0x888e8e){for(var _0x161814=0x0;_0x161814<_0x27ada3[_0x255a('0x5c')][_0x255a('0x68')]['length'];_0x161814+=0x1){socket['emit'](_0x255a('0xb9'),{'UserId':_0x27ada3[_0x255a('0x5c')]['ids'][_0x161814],'MailAccountId':_0x27ada3[_0x255a('0x58')]['id']});}return _0x888e8e;});}})[_0x255a('0x20')](respondWithResult(_0x58380c,null))[_0x255a('0x2b')](handleError(_0x58380c,null));};exports[_0x255a('0xba')]=function(_0x1035e2,_0x4ab6c1,_0x37377b){return db[_0x255a('0x42')]['find']({'where':{'id':_0x1035e2['params']['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x4ab6c1,null))[_0x255a('0x20')](function(_0x12225b){if(_0x12225b){return _0x12225b[_0x255a('0xba')](_0x1035e2[_0x255a('0x47')][_0x255a('0x68')])['then'](function(){if(_[_0x255a('0xbb')](_0x1035e2[_0x255a('0x47')][_0x255a('0x68')])){for(var _0xf7f9b6=0x0;_0xf7f9b6<_0x1035e2[_0x255a('0x47')]['ids'][_0x255a('0x4d')];_0xf7f9b6+=0x1){socket[_0x255a('0xbc')](_0x255a('0xbd'),{'UserId':Number(_0x1035e2[_0x255a('0x47')][_0x255a('0x68')][_0xf7f9b6]),'MailAccountId':Number(_0x1035e2[_0x255a('0x58')]['id'])});}}else{socket[_0x255a('0xbc')](_0x255a('0xbd'),{'UserId':Number(_0x1035e2[_0x255a('0x47')][_0x255a('0x68')]),'MailAccountId':Number(_0x1035e2[_0x255a('0x58')]['id'])});}});}})[_0x255a('0x20')](respondWithStatusCode(_0x4ab6c1,null))[_0x255a('0x2b')](handleError(_0x4ab6c1,null));};exports[_0x255a('0xbe')]=function(_0x396b59,_0x2a3cc3,_0x585c29){var _0x31339b={};var _0x2c8d99={};var _0x1107d9;var _0x7d4b3b;return db[_0x255a('0x42')][_0x255a('0x63')]({'where':{'id':_0x396b59[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x2a3cc3,null))[_0x255a('0x20')](function(_0x52ca88){if(_0x52ca88){_0x1107d9=_0x52ca88;_0x2c8d99[_0x255a('0x46')]=_['keys'](db[_0x255a('0xbf')][_0x255a('0x43')]);_0x2c8d99[_0x255a('0x47')]=_[_0x255a('0x48')](_0x396b59[_0x255a('0x47')]);_0x2c8d99[_0x255a('0x49')]=_[_0x255a('0x4a')](_0x2c8d99[_0x255a('0x46')],_0x2c8d99[_0x255a('0x47')]);_0x31339b[_0x255a('0x4b')]=_[_0x255a('0x4a')](_0x2c8d99[_0x255a('0x46')],qs[_0x255a('0x4c')](_0x396b59[_0x255a('0x47')][_0x255a('0x4c')]));_0x31339b[_0x255a('0x4b')]=_0x31339b['attributes']['length']?_0x31339b[_0x255a('0x4b')]:_0x2c8d99['model'];_0x31339b['order']=qs['sort'](_0x396b59[_0x255a('0x47')][_0x255a('0x51')]);_0x31339b[_0x255a('0x52')]=qs['filters'](_[_0x255a('0x65')](_0x396b59['query'],_0x2c8d99[_0x255a('0x49')]));if(_0x396b59[_0x255a('0x47')]['filter']){_0x31339b[_0x255a('0x52')]=_['merge'](_0x31339b[_0x255a('0x52')],{'$or':_[_0x255a('0x41')](_0x31339b[_0x255a('0x4b')],function(_0x214418){var _0x3482d0={};_0x3482d0[_0x214418]={'$like':'%'+_0x396b59[_0x255a('0x47')][_0x255a('0x53')]+'%'};return _0x3482d0;})});}_0x31339b=_[_0x255a('0x54')]({},_0x31339b,_0x396b59[_0x255a('0x55')]);return _0x1107d9[_0x255a('0xbe')](_0x31339b);}})['then'](function(_0x444372){if(_0x444372){_0x7d4b3b=_0x444372['length'];if(!_0x396b59['query'][_0x255a('0x4e')](_0x255a('0x4f'))){_0x31339b[_0x255a('0x30')]=qs[_0x255a('0x30')](_0x396b59[_0x255a('0x47')][_0x255a('0x30')]);_0x31339b[_0x255a('0x50')]=qs[_0x255a('0x50')](_0x396b59[_0x255a('0x47')][_0x255a('0x50')]);}return _0x1107d9['getAgents'](_0x31339b);}})[_0x255a('0x20')](function(_0x35c9bd){if(_0x35c9bd){return _0x35c9bd?{'count':_0x7d4b3b,'rows':_0x35c9bd}:null;}})['then'](respondWithResult(_0x2a3cc3,null))[_0x255a('0x2b')](handleError(_0x2a3cc3,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index ffb0487..52e3ce2 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 _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 +var _0x4744=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x47d33a,_0x392080){var _0x5f22a8=function(_0x42ed8c){while(--_0x42ed8c){_0x47d33a['push'](_0x47d33a['shift']());}};_0x5f22a8(++_0x392080);}(_0x4744,0x107));var _0x4474=function(_0x1088df,_0x5851a6){_0x1088df=_0x1088df-0x0;var _0x4c4859=_0x4744[_0x1088df];return _0x4c4859;};'use strict';var EventEmitter=require(_0x4474('0x0'));var MailAccount=require(_0x4474('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4474('0x2')](0x0);var events={'afterCreate':_0x4474('0x3'),'afterUpdate':_0x4474('0x4'),'afterDestroy':_0x4474('0x5')};function emitEvent(_0xbb4a32){return function(_0x3337f4,_0x395f6d,_0x37c996){MailAccountEvents['emit'](_0xbb4a32+':'+_0x3337f4['id'],_0x3337f4);MailAccountEvents['emit'](_0xbb4a32,_0x3337f4);_0x37c996(null);};}for(var e in events){if(events[_0x4474('0x6')](e)){var event=events[e];MailAccount[_0x4474('0x7')](e,emitEvent(event));}}module[_0x4474('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 4038f40..13b8ca4 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 _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 +var _0xcb6a=['MailAccount','mail_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailAccount.attributes','define'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0xcb6a,0x16a));var _0xacb6=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xcb6a[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0xacb6('0x0'));var util=require(_0xacb6('0x1'));var logger=require(_0xacb6('0x2'))(_0xacb6('0x3'));var moment=require('moment');var BPromise=require(_0xacb6('0x4'));var rp=require(_0xacb6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xacb6('0x6'));var config=require(_0xacb6('0x7'));var attributes=require(_0xacb6('0x8'));module['exports']=function(_0x20bbf6,_0x4e2ad5){return _0x20bbf6[_0xacb6('0x9')](_0xacb6('0xa'),attributes,{'tableName':_0xacb6('0xb'),'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 34012d1..d1be18b 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 _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 +var _0x4f6f=['priority','asc','autoclose','push','length','close','Contacts','defaults','ListId','contact','messageId','generate','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','create','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','created','originTo','originCc','bcc','Attachment','Attachments','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','include','model','map','attributes','stringify','ShowMailAccount','find','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','DESC','Applications','MailServerOut','Smtp','List','get','omit','applications','orderBy'];(function(_0x19138c,_0x5b4831){var _0x30e93c=function(_0x340e05){while(--_0x340e05){_0x19138c['push'](_0x19138c['shift']());}};_0x30e93c(++_0x5b4831);}(_0x4f6f,0x157));var _0xf4f6=function(_0xfb0cfd,_0x500179){_0xfb0cfd=_0xfb0cfd-0x0;var _0x2fd8aa=_0x4f6f[_0xfb0cfd];return _0x2fd8aa;};'use strict';var _=require(_0xf4f6('0x0'));var util=require(_0xf4f6('0x1'));var moment=require(_0xf4f6('0x2'));var BPromise=require('bluebird');var rs=require(_0xf4f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4f6('0x4'))['db'];var utils=require(_0xf4f6('0x5'));var logger=require('../../config/logger')(_0xf4f6('0x6'));var config=require(_0xf4f6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf4f6('0x8')][_0xf4f6('0x9')]({'port':0x232c});config[_0xf4f6('0xa')]=_['defaults'](config[_0xf4f6('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf4f6('0xa')]));require(_0xf4f6('0xb'))[_0xf4f6('0xc')](socket);function respondWithRpcPromise(_0x51df26,_0x28608e,_0x37d0ee){return new BPromise(function(_0x5ee85d,_0x40e26e){return client[_0xf4f6('0xd')](_0x51df26,_0x37d0ee)[_0xf4f6('0xe')](function(_0x340e93){logger[_0xf4f6('0xf')](_0xf4f6('0x10'),_0x28608e,'request\x20sent');logger[_0xf4f6('0x11')](_0xf4f6('0x12'),_0x28608e,'request\x20sent',JSON['stringify'](_0x340e93));if(_0x340e93[_0xf4f6('0x13')]){if(_0x340e93[_0xf4f6('0x13')][_0xf4f6('0x14')]===0x1f4){logger['error'](_0xf4f6('0x10'),_0x28608e,_0x340e93[_0xf4f6('0x13')][_0xf4f6('0x15')]);return _0x40e26e(_0x340e93['error'][_0xf4f6('0x15')]);}logger['error'](_0xf4f6('0x10'),_0x28608e,_0x340e93[_0xf4f6('0x13')][_0xf4f6('0x15')]);return _0x5ee85d(_0x340e93['error'][_0xf4f6('0x15')]);}else{logger[_0xf4f6('0xf')](_0xf4f6('0x10'),_0x28608e,'request\x20sent');_0x5ee85d(_0x340e93[_0xf4f6('0x16')]['message']);}})[_0xf4f6('0x17')](function(_0xb7adff){logger[_0xf4f6('0x13')]('MailAccount,\x20%s,\x20%s',_0x28608e,_0xb7adff);_0x40e26e(_0xb7adff);});});}exports[_0xf4f6('0x18')]=function(_0x8f6ada){var _0x1dacff=this;return new Promise(function(_0x391e03,_0x112918){return db[_0xf4f6('0x19')][_0xf4f6('0x1a')]({'raw':_0x8f6ada[_0xf4f6('0x1b')]?_0x8f6ada[_0xf4f6('0x1b')][_0xf4f6('0x1c')]===undefined?!![]:![]:!![],'where':_0x8f6ada[_0xf4f6('0x1b')]?_0x8f6ada['options'][_0xf4f6('0x1d')]||null:null,'attributes':_0x8f6ada[_0xf4f6('0x1b')]?_0x8f6ada[_0xf4f6('0x1b')]['attributes']||null:null,'limit':_0x8f6ada[_0xf4f6('0x1b')]?_0x8f6ada[_0xf4f6('0x1b')]['limit']||null:null,'include':_0x8f6ada[_0xf4f6('0x1b')]?_0x8f6ada[_0xf4f6('0x1b')][_0xf4f6('0x1e')]?_['map'](_0x8f6ada[_0xf4f6('0x1b')][_0xf4f6('0x1e')],function(_0x464be1){return{'model':db[_0x464be1[_0xf4f6('0x1f')]],'as':_0x464be1['as'],'attributes':_0x464be1['attributes'],'include':_0x464be1[_0xf4f6('0x1e')]?_[_0xf4f6('0x20')](_0x464be1[_0xf4f6('0x1e')],function(_0x2344fb){return{'model':db[_0x2344fb[_0xf4f6('0x1f')]],'as':_0x2344fb['as'],'attributes':_0x2344fb[_0xf4f6('0x21')],'include':_0x2344fb[_0xf4f6('0x1e')]?_[_0xf4f6('0x20')](_0x2344fb['include'],function(_0x43604d){return{'model':db[_0x43604d[_0xf4f6('0x1f')]],'as':_0x43604d['as'],'attributes':_0x43604d[_0xf4f6('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3269ac){logger[_0xf4f6('0xf')](_0xf4f6('0x18'),_0x8f6ada);logger[_0xf4f6('0x11')](_0xf4f6('0x18'),_0x8f6ada,JSON[_0xf4f6('0x22')](_0x3269ac));_0x391e03(_0x3269ac);})[_0xf4f6('0x17')](function(_0x162781){logger[_0xf4f6('0x13')]('GetMailAccount',_0x162781['message'],_0x8f6ada);_0x112918(_0x1dacff[_0xf4f6('0x13')](0x1f4,_0x162781[_0xf4f6('0x15')]));});});};exports[_0xf4f6('0x23')]=function(_0x31d99a){var _0x26e89a=this;return new Promise(function(_0x2f3f27,_0xa92c98){return db[_0xf4f6('0x19')][_0xf4f6('0x24')]({'raw':_0x31d99a['options']?_0x31d99a[_0xf4f6('0x1b')][_0xf4f6('0x1c')]===undefined?!![]:![]:!![],'where':_0x31d99a[_0xf4f6('0x1b')]?_0x31d99a['options'][_0xf4f6('0x1d')]||null:null,'attributes':_0x31d99a[_0xf4f6('0x1b')]?_0x31d99a[_0xf4f6('0x1b')][_0xf4f6('0x21')]||null:null,'include':_0x31d99a[_0xf4f6('0x1b')]?_0x31d99a['options'][_0xf4f6('0x1e')]?_[_0xf4f6('0x20')](_0x31d99a['options'][_0xf4f6('0x1e')],function(_0x384436){return{'model':db[_0x384436[_0xf4f6('0x1f')]],'as':_0x384436['as'],'attributes':_0x384436[_0xf4f6('0x21')],'include':_0x384436['include']?_[_0xf4f6('0x20')](_0x384436['include'],function(_0xd944cc){return{'model':db[_0xd944cc[_0xf4f6('0x1f')]],'as':_0xd944cc['as'],'attributes':_0xd944cc[_0xf4f6('0x21')],'include':_0xd944cc['include']?_[_0xf4f6('0x20')](_0xd944cc[_0xf4f6('0x1e')],function(_0x46f9b9){return{'model':db[_0x46f9b9[_0xf4f6('0x1f')]],'as':_0x46f9b9['as'],'attributes':_0x46f9b9['attributes']};}):[]};}):[]};}):[]:[]})[_0xf4f6('0xe')](function(_0x1df876){logger[_0xf4f6('0xf')]('ShowMailAccount',_0x31d99a);logger[_0xf4f6('0x11')]('ShowMailAccount',_0x31d99a,JSON[_0xf4f6('0x22')](_0x1df876));_0x2f3f27(_0x1df876);})[_0xf4f6('0x17')](function(_0x290c27){logger['error'](_0xf4f6('0x23'),_0x290c27[_0xf4f6('0x15')],_0x31d99a);_0xa92c98(_0x26e89a['error'](0x1f4,_0x290c27['message']));});});};exports[_0xf4f6('0x25')]=function(_0x205fcb){var _0x10c1bc=this;return new Promise(function(_0xa7f347,_0x418eae){var _0x1ba592={'body':_0x205fcb[_0xf4f6('0x26')],'channel':_0xf4f6('0x27')};var _0x5b8cb5=_[_0xf4f6('0x28')](_[_0xf4f6('0x29')](db[_0xf4f6('0x2a')]['rawAttributes']),[_0xf4f6('0x2b'),_0xf4f6('0x2c'),_0xf4f6('0x2d'),'ListId']);var _0x44fbc0=![];if(_0x205fcb[_0xf4f6('0x26')]['id']){delete _0x205fcb['body']['id'];}if(_[_0xf4f6('0x2e')](_0x205fcb['body'][_0xf4f6('0x2f')])){return _0x418eae(_0x10c1bc['error'](0x1f4,_0xf4f6('0x30')));}if(_[_0xf4f6('0x2e')](_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x26')])||_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x26')]===''){return _0x418eae(_0x10c1bc[_0xf4f6('0x13')](0x1f4,_0xf4f6('0x31')));}if(_[_0xf4f6('0x2e')](_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x32')])){return _0x418eae(_0x10c1bc[_0xf4f6('0x13')](0x1f4,_0xf4f6('0x33')+_0x5b8cb5));}if(!_[_0xf4f6('0x34')](_0x5b8cb5,_0x205fcb['body']['mapKey'])){return _0x418eae(_0x10c1bc['error'](0x1f4,_0xf4f6('0x35')+_0x5b8cb5));}var _0x3eac72={};_0x3eac72[_0x205fcb['body'][_0xf4f6('0x32')]]=_0x205fcb['body'][_0xf4f6('0x2f')];return db[_0xf4f6('0x19')][_0xf4f6('0x24')]({'where':{'id':_0x205fcb[_0xf4f6('0x36')]['id']},'include':[{'model':db[_0xf4f6('0x37')],'as':'List','include':[{'model':db[_0xf4f6('0x2a')],'as':'Contacts','where':_0x3eac72,'limit':0x1,'order':[[_0xf4f6('0x2c'),_0xf4f6('0x38')]]}]},{'model':db['MailApplication'],'as':_0xf4f6('0x39')},{'model':db[_0xf4f6('0x3a')],'as':_0xf4f6('0x3b')}]})[_0xf4f6('0xe')](function(_0x5a582a){if(_0x5a582a&&_0x5a582a[_0xf4f6('0x3c')]){var _0x5af319=_0x5a582a[_0xf4f6('0x3d')]({'plain':!![]});_0x1ba592[_0xf4f6('0x36')]=_[_0xf4f6('0x3e')](_0x5af319,['Applications','List']);_0x1ba592[_0xf4f6('0x3f')]=_0x5af319[_0xf4f6('0x39')];_0x1ba592['list']=_0x5af319[_0xf4f6('0x3c')];_0x1ba592['applications']=_[_0xf4f6('0x40')](_0x1ba592[_0xf4f6('0x3f')],[_0xf4f6('0x41')],[_0xf4f6('0x42')]);if(_0x1ba592[_0xf4f6('0x36')]&&_0x1ba592[_0xf4f6('0x36')][_0xf4f6('0x43')]){_0x1ba592[_0xf4f6('0x3f')][_0xf4f6('0x44')]({'id':0x0,'priority':_0x1ba592['applications'][_0xf4f6('0x45')]+0x1,'app':_0xf4f6('0x46'),'appdata':'autoclose','interval':'*,*,*,*'});}if(_0x1ba592[_0xf4f6('0x36')][_0xf4f6('0x39')]){delete _0x1ba592['account']['Applications'];}if(_0x1ba592['account'][_0xf4f6('0x3c')]){delete _0x1ba592[_0xf4f6('0x36')]['List'];}if(_0x5af319['List'][_0xf4f6('0x47')][_0xf4f6('0x45')]){return _0x5af319[_0xf4f6('0x3c')]['Contacts'][0x0];}var _0x59b89d=_[_0xf4f6('0x48')](_0x205fcb[_0xf4f6('0x26')],{'firstName':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x2f')],'ListId':_0x5af319[_0xf4f6('0x49')]});_0x59b89d[_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x32')]]=_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x2f')];return db[_0xf4f6('0x2a')]['create'](_0x59b89d);}else{throw new Error('List\x20not\x20found');}})[_0xf4f6('0xe')](function(_0xd51621){_0x1ba592[_0xf4f6('0x4a')]=_0xd51621;if(_0xd51621){if(!_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')]['messageId']){_0x205fcb[_0xf4f6('0x26')]['message'][_0xf4f6('0x4b')]=rs[_0xf4f6('0x4c')]()+'\x20'+_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')][_0xf4f6('0x2f')];}var _0x1f5e62={'ContactId':_0xd51621['id'],'MailAccountId':_0x205fcb[_0xf4f6('0x36')]['id'],'inReplyTo':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')][_0xf4f6('0x4b')],'to':_0x205fcb['body'][_0xf4f6('0x15')][_0xf4f6('0x2f')],'cc':_0x205fcb[_0xf4f6('0x26')]['message']['cc'],'subject':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')][_0xf4f6('0x4d')],'attach':_0x205fcb[_0xf4f6('0x26')]['message'][_0xf4f6('0x4e')],'lastMsgAt':moment()[_0xf4f6('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x205fcb[_0xf4f6('0x26')]['body']};return db[_0xf4f6('0x50')][_0xf4f6('0x24')]({'where':{'closed':![],'MailAccountId':_0x205fcb[_0xf4f6('0x36')]['id']},'include':[{'model':db[_0xf4f6('0x51')],'as':_0xf4f6('0x52'),'attributes':[_0xf4f6('0x4b')],'where':{'messageId':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')][_0xf4f6('0x53')]}}]})['then'](function(_0x5b319c){if(_0x5b319c){return[_0x5b319c,![]];}return db[_0xf4f6('0x50')][_0xf4f6('0x54')](_0x1f5e62)[_0xf4f6('0xe')](function(_0x1a64eb){return[_0x1a64eb,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xf4f6('0x55')](function(_0x16f31a,_0xc2b2af){if(_0x16f31a){_0x44fbc0=_0xc2b2af;if(!_0xc2b2af){return _0x16f31a[_0xf4f6('0x56')]({'inReplyTo':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')][_0xf4f6('0x4b')],'to':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')][_0xf4f6('0x2f')],'cc':_0x205fcb['body'][_0xf4f6('0x15')]['cc'],'subject':_0x205fcb['body'][_0xf4f6('0x15')][_0xf4f6('0x4d')],'attach':_0x16f31a[_0xf4f6('0x4e')]?_0x16f31a[_0xf4f6('0x4e')]:_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')][_0xf4f6('0x4e')],'substatus':null,'substatusAt':moment()[_0xf4f6('0x4f')](_0xf4f6('0x57')),'lastMsgAt':moment()[_0xf4f6('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x205fcb[_0xf4f6('0x26')]['body']});}else{return _0x16f31a;}}})[_0xf4f6('0xe')](function(_0x1156cc){_0x1ba592['interaction']=_0x1156cc[_0xf4f6('0x3d')]({'plain':!![]});_0x1ba592[_0xf4f6('0x58')][_0xf4f6('0x59')]=_0x44fbc0;return db[_0xf4f6('0x51')][_0xf4f6('0x54')]({'body':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x26')],'MailAccountId':_0x205fcb['account']['id'],'MailInteractionId':_0x1156cc['id'],'direction':'in','ContactId':_0x1ba592['contact']['id'],'messageId':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')][_0xf4f6('0x4b')],'from':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')][_0xf4f6('0x2f')],'to':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')]['to'],'cc':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')]['cc'],'subject':_0x205fcb[_0xf4f6('0x26')]['message'][_0xf4f6('0x4d')],'attach':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')][_0xf4f6('0x4e')],'Attachments':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')]['attachments'],'originTo':_0x205fcb['body'][_0xf4f6('0x15')][_0xf4f6('0x5a')],'originCc':_0x205fcb['body'][_0xf4f6('0x15')][_0xf4f6('0x5b')],'bcc':_0x205fcb['body'][_0xf4f6('0x15')][_0xf4f6('0x5c')]},{'include':[{'model':db[_0xf4f6('0x5d')],'as':_0xf4f6('0x5e')}]});})[_0xf4f6('0xe')](function(_0x394a90){_0x1ba592[_0xf4f6('0x15')]=_0x394a90;if(_0x1ba592[_0xf4f6('0x58')][_0xf4f6('0x5f')]){return db[_0xf4f6('0x60')][_0xf4f6('0x24')]({'attributes':['id','name'],'where':{'id':_0x1ba592[_0xf4f6('0x58')]['UserId']}})['then'](function(_0x127ba6){if(_0x127ba6){_0x1ba592['applications'][_0xf4f6('0x61')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x127ba6['name']+','+(_0x1ba592[_0xf4f6('0x36')][_0xf4f6('0x62')]||0xa),'interval':_0xf4f6('0x63')});}return respondWithRpcPromise(_0xf4f6('0x64'),_0xf4f6('0x65'),_0x1ba592);});}return respondWithRpcPromise(_0xf4f6('0x64'),_0xf4f6('0x65'),_0x1ba592);})[_0xf4f6('0xe')](function(_0x3a51e9){_0xa7f347(_0x3a51e9);})[_0xf4f6('0x17')](function(_0x3d1e37){_0x418eae(_0x10c1bc[_0xf4f6('0x13')](0x1f4,_0x3d1e37[_0xf4f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 325161a..5b3311e 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 _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 +var _0xdbbe=['update','removeListener','register','save','remove'];(function(_0x1fd6b0,_0x5a40a0){var _0x202a08=function(_0x3a0674){while(--_0x3a0674){_0x1fd6b0['push'](_0x1fd6b0['shift']());}};_0x202a08(++_0x5a40a0);}(_0xdbbe,0x148));var _0xedbb=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0xdbbe[_0x484c03];return _0x294127;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xedbb('0x0'),_0xedbb('0x1'),_0xedbb('0x2')];function createListener(_0x348cfa,_0xaeb19a){return function(_0x13d00d){_0xaeb19a['emit'](_0x348cfa,_0x13d00d);};}function removeListener(_0x282712,_0x9c1af2){return function(){MailAccountEvents[_0xedbb('0x3')](_0x282712,_0x9c1af2);};}exports[_0xedbb('0x4')]=function(_0x8022ef){for(var _0x87ee1e=0x0,_0x2bb3dd=events['length'];_0x87ee1e<_0x2bb3dd;_0x87ee1e++){var _0xd9cf8c=events[_0x87ee1e];var _0x1ba82a=createListener('mailAccount:'+_0xd9cf8c,_0x8022ef);MailAccountEvents['on'](_0xd9cf8c,_0x1ba82a);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 799889c..670175f 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 _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 +var _0xd87e=['util','connect-timeout','express','Router','../../components/interaction/service','./mailApplication.controller','get','isAuthenticated','/:id','update','delete','destroy','exports','multer'];(function(_0x578ddc,_0x304458){var _0x1cd053=function(_0x541982){while(--_0x541982){_0x578ddc['push'](_0x578ddc['shift']());}};_0x1cd053(++_0x304458);}(_0xd87e,0x1bf));var _0xed87=function(_0x59591b,_0x354045){_0x59591b=_0x59591b-0x0;var _0x576642=_0xd87e[_0x59591b];return _0x576642;};'use strict';var multer=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var path=require('path');var timeout=require(_0xed87('0x2'));var express=require(_0xed87('0x3'));var router=express[_0xed87('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xed87('0x5'));var config=require('../../config/environment');var controller=require(_0xed87('0x6'));router[_0xed87('0x7')]('/:id',auth[_0xed87('0x8')](),controller['show']);router['put'](_0xed87('0x9'),auth[_0xed87('0x8')](),controller[_0xed87('0xa')]);router[_0xed87('0xb')]('/:id',auth[_0xed87('0x8')](),controller[_0xed87('0xc')]);module[_0xed87('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 92bee5b..d533763 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 _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 +var _0x33f0=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x3b128e,_0x26ec45){var _0x27d4fc=function(_0x4aa020){while(--_0x4aa020){_0x3b128e['push'](_0x3b128e['shift']());}};_0x27d4fc(++_0x26ec45);}(_0x33f0,0x108));var _0x033f=function(_0x3c4822,_0x599ad8){_0x3c4822=_0x3c4822-0x0;var _0x2e16f6=_0x33f0[_0x3c4822];return _0x2e16f6;};'use strict';var Sequelize=require(_0x033f('0x0'));module[_0x033f('0x1')]={'priority':{'type':Sequelize[_0x033f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x033f('0x3')],'allowNull':![],'defaultValue':_0x033f('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x033f('0x3')]},'interval':{'type':Sequelize[_0x033f('0x3')],'defaultValue':_0x033f('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 6cb9596..01086e5 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 _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 +var _0xeba1=['sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','status','end','json','offset','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','body','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x2dbab4,_0x1f6a5e){var _0x83c54f=function(_0x2fb793){while(--_0x2fb793){_0x2dbab4['push'](_0x2dbab4['shift']());}};_0x83c54f(++_0x1f6a5e);}(_0xeba1,0x98));var _0x1eba=function(_0x256827,_0xc5c033){_0x256827=_0x256827-0x0;var _0x41efa8=_0xeba1[_0x256827];return _0x41efa8;};'use strict';var pdf=require(_0x1eba('0x0'));var emlformat=require(_0x1eba('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1eba('0x2'));var rp=require(_0x1eba('0x3'));var moment=require('moment');var BPromise=require(_0x1eba('0x4'));var Mustache=require(_0x1eba('0x5'));var util=require(_0x1eba('0x6'));var path=require('path');var sox=require(_0x1eba('0x7'));var csv=require(_0x1eba('0x8'));var ejs=require(_0x1eba('0x9'));var fs=require('fs');var _=require(_0x1eba('0xa'));var squel=require(_0x1eba('0xb'));var crypto=require(_0x1eba('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1eba('0xd'));var toCsv=require(_0x1eba('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1eba('0xe'));var authService=require(_0x1eba('0xf'));var qs=require(_0x1eba('0x10'));var as=require(_0x1eba('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1eba('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1eba('0x13'))['db'];function respondWithStatusCode(_0x50b8eb,_0x24ec4e){_0x24ec4e=_0x24ec4e||0xcc;return function(_0x3982ca){if(_0x3982ca){return _0x50b8eb['sendStatus'](_0x24ec4e);}return _0x50b8eb[_0x1eba('0x14')](_0x24ec4e)[_0x1eba('0x15')]();};}function respondWithResult(_0x7a469,_0x4105d5){_0x4105d5=_0x4105d5||0xc8;return function(_0x3292cb){if(_0x3292cb){return _0x7a469[_0x1eba('0x14')](_0x4105d5)[_0x1eba('0x16')](_0x3292cb);}};}function respondWithFilteredResult(_0x4c3937,_0xe4c992){return function(_0xc5d14e){if(_0xc5d14e){var _0x12026a=_0xc5d14e['count'],_0x35e9c6=_0xe4c992[_0x1eba('0x17')],_0x443cab=_0xe4c992[_0x1eba('0x17')]+_0xe4c992['limit'],_0x15e402;if(_0x443cab>=_0x12026a){_0x443cab=_0x12026a;_0x15e402=0xc8;}else{_0x15e402=0xce;}_0x4c3937[_0x1eba('0x14')](_0x15e402);return _0x4c3937['set'](_0x1eba('0x18'),_0x35e9c6+'-'+_0x443cab+'/'+_0x12026a)[_0x1eba('0x16')](_0xc5d14e);}return null;};}function patchUpdates(_0x2b59a8){return function(_0x121154){try{jsonpatch[_0x1eba('0x19')](_0x121154,_0x2b59a8,!![]);}catch(_0x1afd70){return BPromise['reject'](_0x1afd70);}return _0x121154[_0x1eba('0x1a')]();};}function saveUpdates(_0x4ce2eb,_0x51d971){return function(_0x3bd6c4){if(_0x3bd6c4){return _0x3bd6c4[_0x1eba('0x1b')](_0x4ce2eb)[_0x1eba('0x1c')](function(_0x214e4f){return _0x214e4f;});}return null;};}function removeEntity(_0x5ee4e8,_0x3fc7d7){return function(_0x3c5b63){if(_0x3c5b63){return _0x3c5b63[_0x1eba('0x1d')]()['then'](function(){_0x5ee4e8['status'](0xcc)[_0x1eba('0x15')]();});}};}function handleEntityNotFound(_0x165aa1,_0x49e415){return function(_0x8f6221){if(!_0x8f6221){_0x165aa1[_0x1eba('0x1e')](0x194);}return _0x8f6221;};}function handleError(_0x2000e2,_0x4148b7){_0x4148b7=_0x4148b7||0x1f4;return function(_0x33f188){logger[_0x1eba('0x1f')](_0x33f188[_0x1eba('0x20')]);if(_0x33f188['name']){delete _0x33f188['name'];}_0x2000e2[_0x1eba('0x14')](_0x4148b7)[_0x1eba('0x21')](_0x33f188);};}exports[_0x1eba('0x22')]=function(_0x28d3af,_0x2421ac){var _0x15b210={'raw':!![],'where':{'id':_0x28d3af[_0x1eba('0x23')]['id']}},_0xc5179f={};_0xc5179f[_0x1eba('0x24')]=_[_0x1eba('0x25')](db[_0x1eba('0x26')][_0x1eba('0x27')]);_0xc5179f[_0x1eba('0x28')]=_[_0x1eba('0x25')](_0x28d3af['query']);_0xc5179f[_0x1eba('0x29')]=_[_0x1eba('0x2a')](_0xc5179f[_0x1eba('0x24')],_0xc5179f[_0x1eba('0x28')]);_0x15b210[_0x1eba('0x2b')]=_[_0x1eba('0x2a')](_0xc5179f[_0x1eba('0x24')],qs['fields'](_0x28d3af[_0x1eba('0x28')][_0x1eba('0x2c')]));_0x15b210[_0x1eba('0x2b')]=_0x15b210[_0x1eba('0x2b')][_0x1eba('0x2d')]?_0x15b210[_0x1eba('0x2b')]:_0xc5179f[_0x1eba('0x24')];if(_0x28d3af['query'][_0x1eba('0x2e')]){_0x15b210[_0x1eba('0x2f')]=[{'all':!![]}];}_0x15b210=_[_0x1eba('0x30')]({},_0x15b210,_0x28d3af[_0x1eba('0x31')]);return db[_0x1eba('0x26')][_0x1eba('0x32')](_0x15b210)[_0x1eba('0x1c')](handleEntityNotFound(_0x2421ac,null))[_0x1eba('0x1c')](respondWithResult(_0x2421ac,null))[_0x1eba('0x33')](handleError(_0x2421ac,null));};exports[_0x1eba('0x1b')]=function(_0x3b2b2e,_0x2cb0c8){if(_0x3b2b2e[_0x1eba('0x34')]['id']){delete _0x3b2b2e['body']['id'];}return db[_0x1eba('0x26')]['find']({'where':{'id':_0x3b2b2e[_0x1eba('0x23')]['id']}})[_0x1eba('0x1c')](handleEntityNotFound(_0x2cb0c8,null))['then'](saveUpdates(_0x3b2b2e[_0x1eba('0x34')],null))[_0x1eba('0x1c')](respondWithResult(_0x2cb0c8,null))[_0x1eba('0x33')](handleError(_0x2cb0c8,null));};exports[_0x1eba('0x1d')]=function(_0x307679,_0x4ac942){return db['MailApplication'][_0x1eba('0x32')]({'where':{'id':_0x307679[_0x1eba('0x23')]['id']}})[_0x1eba('0x1c')](handleEntityNotFound(_0x4ac942,null))[_0x1eba('0x1c')](removeEntity(_0x4ac942,null))[_0x1eba('0x33')](handleError(_0x4ac942,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index c07f602..7a3e805 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 _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 +var _0xd08d=['bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4_unicode_ci','util','../../config/logger','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd08d,0x81));var _0xdd08=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0xd08d[_0x3afe18];return _0x19ed1f;};'use strict';var _=require('lodash');var util=require(_0xdd08('0x0'));var logger=require(_0xdd08('0x1'))('api');var moment=require(_0xdd08('0x2'));var BPromise=require(_0xdd08('0x3'));var rp=require(_0xdd08('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd08('0x5'));var config=require(_0xdd08('0x6'));var attributes=require(_0xdd08('0x7'));module['exports']=function(_0x37c67a,_0x1587df){return _0x37c67a[_0xdd08('0x8')](_0xdd08('0x9'),attributes,{'tableName':_0xdd08('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xdd08('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index fd37747..ac949e6 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 _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 +var _0xb7ae=['http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','body','options','raw','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x17f630,_0x282ece){var _0x575c81=function(_0x3fc382){while(--_0x3fc382){_0x17f630['push'](_0x17f630['shift']());}};_0x575c81(++_0x282ece);}(_0xb7ae,0x19a));var _0xeb7a=function(_0xe4f0a0,_0x1e51ea){_0xe4f0a0=_0xe4f0a0-0x0;var _0x390425=_0xb7ae[_0xe4f0a0];return _0x390425;};'use strict';var _=require(_0xeb7a('0x0'));var util=require(_0xeb7a('0x1'));var moment=require(_0xeb7a('0x2'));var BPromise=require(_0xeb7a('0x3'));var rs=require(_0xeb7a('0x4'));var fs=require('fs');var Redis=require(_0xeb7a('0x5'));var db=require(_0xeb7a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb7a('0x7'))(_0xeb7a('0x8'));var config=require('../../config/environment');var jayson=require(_0xeb7a('0x9'));var client=jayson['client'][_0xeb7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x226cf2,_0xe90b4c,_0x524700){return new BPromise(function(_0x5aeff1,_0x330493){return client[_0xeb7a('0xb')](_0x226cf2,_0x524700)[_0xeb7a('0xc')](function(_0x44abf8){logger[_0xeb7a('0xd')](_0xeb7a('0xe'),_0xe90b4c,_0xeb7a('0xf'));logger[_0xeb7a('0x10')](_0xeb7a('0x11'),_0xe90b4c,_0xeb7a('0xf'),JSON[_0xeb7a('0x12')](_0x44abf8));if(_0x44abf8[_0xeb7a('0x13')]){if(_0x44abf8[_0xeb7a('0x13')][_0xeb7a('0x14')]===0x1f4){logger[_0xeb7a('0x13')](_0xeb7a('0xe'),_0xe90b4c,_0x44abf8[_0xeb7a('0x13')][_0xeb7a('0x15')]);return _0x330493(_0x44abf8[_0xeb7a('0x13')]['message']);}logger[_0xeb7a('0x13')]('MailApplication,\x20%s,\x20%s',_0xe90b4c,_0x44abf8['error']['message']);return _0x5aeff1(_0x44abf8[_0xeb7a('0x13')][_0xeb7a('0x15')]);}else{logger[_0xeb7a('0xd')](_0xeb7a('0xe'),_0xe90b4c,_0xeb7a('0xf'));_0x5aeff1(_0x44abf8[_0xeb7a('0x16')][_0xeb7a('0x15')]);}})[_0xeb7a('0x17')](function(_0x775cdc){logger[_0xeb7a('0x13')]('MailApplication,\x20%s,\x20%s',_0xe90b4c,_0x775cdc);_0x330493(_0x775cdc);});});}exports[_0xeb7a('0x18')]=function(_0xa11b69){var _0x4e447f=this;return new Promise(function(_0x190389,_0x2f4b62){return db[_0xeb7a('0x19')]['update'](_0xa11b69[_0xeb7a('0x1a')],{'raw':_0xa11b69[_0xeb7a('0x1b')]?_0xa11b69[_0xeb7a('0x1b')][_0xeb7a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa11b69['options']?_0xa11b69['options']['where']||null:null,'attributes':_0xa11b69['options']?_0xa11b69[_0xeb7a('0x1b')][_0xeb7a('0x1d')]||null:null,'limit':_0xa11b69[_0xeb7a('0x1b')]?_0xa11b69[_0xeb7a('0x1b')]['limit']||null:null})[_0xeb7a('0xc')](function(_0x12d9bb){logger[_0xeb7a('0xd')](_0xeb7a('0x18'),_0xa11b69);logger[_0xeb7a('0x10')]('UpdateMailApplication',_0xa11b69,JSON[_0xeb7a('0x12')](_0x12d9bb));_0x190389(_0x12d9bb);})['catch'](function(_0x514e10){logger[_0xeb7a('0x13')](_0xeb7a('0x18'),_0x514e10[_0xeb7a('0x15')],_0xa11b69);_0x2f4b62(_0x4e447f[_0xeb7a('0x13')](0x1f4,_0x514e10[_0xeb7a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 25da9d8..284d16a 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 _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 +var _0x1738=['../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','/:id/download','download','post','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','tracked','update','delete','mailinteraction:destroy','destroy','removeTags','exports','multer','util','express','Router'];(function(_0x40e288,_0x142b91){var _0x67e58e=function(_0x3a014e){while(--_0x3a014e){_0x40e288['push'](_0x40e288['shift']());}};_0x67e58e(++_0x142b91);}(_0x1738,0x1bc));var _0x8173=function(_0x309c03,_0x52e73d){_0x309c03=_0x309c03-0x0;var _0xbe032f=_0x1738[_0x309c03];return _0xbe032f;};'use strict';var multer=require(_0x8173('0x0'));var util=require(_0x8173('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8173('0x2'));var router=express[_0x8173('0x3')]();var auth=require(_0x8173('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8173('0x5'));router[_0x8173('0x6')]('/',auth[_0x8173('0x7')](),controller[_0x8173('0x8')]);router[_0x8173('0x6')](_0x8173('0x9'),auth[_0x8173('0x7')](),controller[_0x8173('0xa')]);router[_0x8173('0x6')](_0x8173('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x8173('0x6')](_0x8173('0xc'),auth[_0x8173('0x7')](),controller['getMessages']);router['get'](_0x8173('0xd'),auth[_0x8173('0x7')](),controller[_0x8173('0xe')]);router[_0x8173('0xf')]('/',auth[_0x8173('0x7')](),controller['create']);router[_0x8173('0xf')]('/:id/messages',auth[_0x8173('0x7')](),controller[_0x8173('0x10')]);router[_0x8173('0xf')](_0x8173('0x11'),auth[_0x8173('0x7')](),interaction['tracked'](_0x8173('0x12'),_0x8173('0x13')),controller[_0x8173('0x14')]);router['put']('/:id',auth[_0x8173('0x7')](),interaction[_0x8173('0x15')](_0x8173('0x12'),'mailinteraction:update'),controller[_0x8173('0x16')]);router[_0x8173('0x17')]('/:id',auth[_0x8173('0x7')](),interaction[_0x8173('0x15')](_0x8173('0x12'),_0x8173('0x18')),controller[_0x8173('0x19')]);router['delete'](_0x8173('0x11'),auth[_0x8173('0x7')](),controller[_0x8173('0x1a')]);module[_0x8173('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 98b4ba7..7fa81d4 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 _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 +var _0xe24c=['iconv','DATE','STRING','TEXT','BOOLEAN','out','long','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe24c,0x107));var _0xce24=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe24c[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0xce24('0x0'));var iconv=require(_0xce24('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xce24('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xce24('0x3')]},'thirdDisposition':{'type':Sequelize[_0xce24('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xce24('0x3')](0x1fe)},'to':{'type':Sequelize[_0xce24('0x3')]},'cc':{'type':Sequelize[_0xce24('0x4')]('long')},'subject':{'type':Sequelize[_0xce24('0x4')]()},'attach':{'type':Sequelize[_0xce24('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xce24('0x2')]},'substatus':{'type':Sequelize[_0xce24('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xce24('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xce24('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xce24('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0xce24('0x7'))},'lastMsgText':{'type':Sequelize[_0xce24('0x4')](_0xce24('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 6cc20f2..b5a69b3 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 _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 +var _0x6b20=['./mailInteraction.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','then','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgBody','lastMsgText','trimStart','fromString','catch','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','expr','parseSearch','conditions','find','value','having','`\x20=\x200','`\x20>\x200','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','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','some','MailAccountId','i.MailAccountId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','`unreadMessages`\x20>\x200','isArray','tag','replace','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','isEmpty','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','role','agent','sequelize','toString','keyBy','merge','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.createdAt','i.closed','i.closedAt','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','MailInteractionId','enableEmailPreview','push','rows','show','params','include','options','create','body','describe','addMessage','ids','omit','getMessages','MailMessage','filter','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','inlineCss','true','addTags','setTags','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','tmp','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','bcc','subject','createdAt','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','message%d.eml','log','err','unlinkSync','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','juice','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x3a26dc,_0x1505b6){var _0x3bcc9f=function(_0x33f8c5){while(--_0x33f8c5){_0x3a26dc['push'](_0x3a26dc['shift']());}};_0x3bcc9f(++_0x1505b6);}(_0x6b20,0xd1));var _0x06b2=function(_0x79526c,_0x4e1037){_0x79526c=_0x79526c-0x0;var _0x25bf2c=_0x6b20[_0x79526c];return _0x25bf2c;};'use strict';var pdf=require(_0x06b2('0x0'));var emlformat=require(_0x06b2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x06b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x06b2('0x3'));var moment=require(_0x06b2('0x4'));var BPromise=require(_0x06b2('0x5'));var Mustache=require('mustache');var util=require(_0x06b2('0x6'));var path=require(_0x06b2('0x7'));var sox=require(_0x06b2('0x8'));var csv=require(_0x06b2('0x9'));var ejs=require(_0x06b2('0xa'));var fs=require('fs');var _=require(_0x06b2('0xb'));var squel=require(_0x06b2('0xc'));var crypto=require('crypto');var jsforce=require(_0x06b2('0xd'));var deskjs=require(_0x06b2('0xe'));var toCsv=require(_0x06b2('0x9'));var querystring=require('querystring');var Papa=require(_0x06b2('0xf'));var htmlToText=require('html-to-text');var juice=require(_0x06b2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x06b2('0x11'));var as=require(_0x06b2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x06b2('0x13'))(_0x06b2('0x14'));var utils=require(_0x06b2('0x15'));var config=require(_0x06b2('0x16'));var licenseUtil=require(_0x06b2('0x17'));var db=require(_0x06b2('0x18'))['db'];config[_0x06b2('0x19')]=_[_0x06b2('0x1a')](config[_0x06b2('0x19')],{'host':_0x06b2('0x1b'),'port':0x18eb});var socket=require(_0x06b2('0x1c'))(new Redis(config[_0x06b2('0x19')]));require(_0x06b2('0x1d'))['register'](socket);function respondWithStatusCode(_0x325cde,_0xaee98c){_0xaee98c=_0xaee98c||0xcc;return function(_0x47496c){if(_0x47496c){return _0x325cde[_0x06b2('0x1e')](_0xaee98c);}return _0x325cde[_0x06b2('0x1f')](_0xaee98c)[_0x06b2('0x20')]();};}function respondWithResult(_0x4b148c,_0x17e69b){_0x17e69b=_0x17e69b||0xc8;return function(_0x3f2a53){if(_0x3f2a53){return _0x4b148c['status'](_0x17e69b)[_0x06b2('0x21')](_0x3f2a53);}};}function respondWithFilteredResult(_0x594b48,_0x4c9cae){return function(_0x192270){if(_0x192270){var _0x1b4ab0=_0x192270[_0x06b2('0x22')],_0x27852e=_0x4c9cae[_0x06b2('0x23')],_0x2182f3=_0x4c9cae[_0x06b2('0x23')]+_0x4c9cae[_0x06b2('0x24')],_0x4c4e21;if(_0x2182f3>=_0x1b4ab0){_0x2182f3=_0x1b4ab0;_0x4c4e21=0xc8;}else{_0x4c4e21=0xce;}_0x594b48[_0x06b2('0x1f')](_0x4c4e21);return _0x594b48[_0x06b2('0x25')](_0x06b2('0x26'),_0x27852e+'-'+_0x2182f3+'/'+_0x1b4ab0)['json'](_0x192270);}return null;};}function patchUpdates(_0x18c9a9){return function(_0x290840){try{jsonpatch[_0x06b2('0x27')](_0x290840,_0x18c9a9,!![]);}catch(_0x208384){return BPromise['reject'](_0x208384);}return _0x290840['save']();};}function saveUpdates(_0x33b760,_0xb5231e){return function(_0x4fc95f){if(_0x4fc95f){return _0x4fc95f[_0x06b2('0x28')](_0x33b760)['then'](function(_0x3d58c6){return _0x3d58c6;});}return null;};}function removeEntity(_0x38987b,_0x2a0645){return function(_0x593d3a){if(_0x593d3a){return _0x593d3a[_0x06b2('0x29')]()[_0x06b2('0x2a')](function(){_0x38987b[_0x06b2('0x1f')](0xcc)[_0x06b2('0x20')]();});}};}function handleEntityNotFound(_0x1173fc,_0x4f5e90){return function(_0xbb00ea){if(!_0xbb00ea){_0x1173fc[_0x06b2('0x1e')](0x194);}return _0xbb00ea;};}function handleError(_0x40a73f,_0x1a99c1){_0x1a99c1=_0x1a99c1||0x1f4;return function(_0x1976ac){logger[_0x06b2('0x2b')](_0x1976ac['stack']);if(_0x1976ac[_0x06b2('0x2c')]){delete _0x1976ac[_0x06b2('0x2c')];}_0x40a73f[_0x06b2('0x1f')](_0x1a99c1)[_0x06b2('0x2d')](_0x1976ac);};}function getInteractionUsers(_0x1f02d8,_0x1bfaa9){return new BPromise(function(_0x3668bb,_0x51698b){try{if(_0x1bfaa9[_0x1f02d8['id']]){_0x1f02d8[_0x06b2('0x2e')]=_[_0x06b2('0x2f')](_0x1bfaa9[_0x1f02d8['id']],function(_0x1637c2){return{'id':_0x1637c2['id'],'fullname':_0x1637c2[_0x06b2('0x30')]};});}}catch(_0x1cc725){_0x51698b(_0x1cc725);}_0x3668bb(_0x1f02d8);});}function getInteractionTags(_0x37d391,_0x401551){return new BPromise(function(_0x2c03e4,_0x56d03e){try{if(_0x37d391[_0x06b2('0x31')]){_0x37d391[_0x06b2('0x32')]=[];_0x37d391[_0x06b2('0x31')][_0x06b2('0x33')](',')[_0x06b2('0x34')](function(_0x422393){_0x37d391[_0x06b2('0x32')]['push'](_0x401551[_0x422393]);});}delete _0x37d391['TagIds'];}catch(_0x9fd6ef){_0x56d03e(_0x9fd6ef);}_0x2c03e4(_0x37d391);});}function getLastMessageText(_0x349d29){return new BPromise(function(_0x491248,_0x47c930){return db[_0x06b2('0x35')][_0x06b2('0x36')]({'where':{'id':_0x349d29['id']},'attributes':[_0x06b2('0x37'),_0x06b2('0x38')],'raw':!![]})[_0x06b2('0x2a')](function(_0x27f172){if(!_0x27f172['lastMsgText']){_0x349d29[_0x06b2('0x38')]=_[_0x06b2('0x39')](htmlToText[_0x06b2('0x3a')](_0x27f172['lastMsgBody'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x349d29[_0x06b2('0x38')]=_0x27f172[_0x06b2('0x38')];}_0x491248(_0x349d29);})['catch'](function(_0x45ea67){_0x47c930(_0x45ea67);});});}function updateMailInteraction(_0x1ab3e6,_0x8d3648,_0xdb75cb,_0x2e49df){return new BPromise(function(_0x3e245e,_0x37b53c){return getInteractionUsers(_0x1ab3e6,_0xdb75cb)[_0x06b2('0x2a')](function(_0x22e77a){return getInteractionTags(_0x22e77a,_0x8d3648);})[_0x06b2('0x2a')](function(_0x21d048){if(_0x2e49df){_0x3e245e(getLastMessageText(_0x21d048));}else{_0x3e245e(_0x21d048);}})[_0x06b2('0x3b')](function(_0x5ec05d){_0x37b53c(_0x5ec05d);});});}exports[_0x06b2('0x3c')]=function(_0x5d451e,_0x4a4146){var _0x44b967={},_0x4e92e0={},_0x26ab14={'count':0x0,'rows':[]};var _0x5313a5=_[_0x06b2('0x2f')](db[_0x06b2('0x35')][_0x06b2('0x3d')],function(_0x3ff3e1){return{'name':_0x3ff3e1[_0x06b2('0x3e')],'type':_0x3ff3e1['type'][_0x06b2('0x3f')]};});_0x4e92e0[_0x06b2('0x40')]=_[_0x06b2('0x2f')](_0x5313a5,_0x06b2('0x2c'));_0x4e92e0[_0x06b2('0x41')]=_[_0x06b2('0x42')](_0x5d451e['query']);_0x4e92e0[_0x06b2('0x43')]=_[_0x06b2('0x44')](_0x4e92e0['model'],_0x4e92e0['query']);_0x44b967[_0x06b2('0x45')]=_[_0x06b2('0x44')](_0x4e92e0[_0x06b2('0x40')],qs[_0x06b2('0x46')](_0x5d451e[_0x06b2('0x41')][_0x06b2('0x46')]));_0x44b967[_0x06b2('0x45')]=_0x44b967[_0x06b2('0x45')][_0x06b2('0x47')]?_0x44b967[_0x06b2('0x45')]:_0x4e92e0[_0x06b2('0x40')];if(!_0x5d451e[_0x06b2('0x41')][_0x06b2('0x48')](_0x06b2('0x49'))){_0x44b967[_0x06b2('0x24')]=qs[_0x06b2('0x24')](_0x5d451e[_0x06b2('0x41')][_0x06b2('0x24')]);_0x44b967[_0x06b2('0x23')]=qs['offset'](_0x5d451e[_0x06b2('0x41')][_0x06b2('0x23')]);}_0x44b967[_0x06b2('0x4a')]=qs[_0x06b2('0x4b')](_0x5d451e['query'][_0x06b2('0x4b')]);_0x44b967[_0x06b2('0x4c')]=qs['filters'](_[_0x06b2('0x4d')](_0x5d451e[_0x06b2('0x41')],_0x4e92e0['filters']),_0x5313a5);var _0x3ad4ff=[];var _0xf342f9=squel['select']()['field']('id')['field'](_0x06b2('0x2c'))[_0x06b2('0x4e')](_0x06b2('0x4f'))[_0x06b2('0x50')](_0x06b2('0x51'));var _0x559c5a=squel['select']()[_0x06b2('0x4e')](_0x06b2('0x52'))[_0x06b2('0x4e')](_0x06b2('0x53'))[_0x06b2('0x4e')](_0x06b2('0x54'))['from'](_0x06b2('0x55'),'ui')[_0x06b2('0x56')](_0x06b2('0x57'),'u',_0x06b2('0x58'));var _0x146c5c=squel[_0x06b2('0x59')]()['from'](_0x06b2('0x5a'),'i')[_0x06b2('0x56')](_0x06b2('0x5b'),'c',_0x06b2('0x5c'))['left_join'](_0x06b2('0x57'),'o',_0x06b2('0x5d'))[_0x06b2('0x56')](_0x06b2('0x5e'),'a','a.id\x20=\x20i.MailAccountId')[_0x06b2('0x56')](_0x06b2('0x5f'),'me',_0x06b2('0x60'))[_0x06b2('0x56')](_0x06b2('0x61'),'it',_0x06b2('0x62'))[_0x06b2('0x56')](_0x06b2('0x51'),'t','t.id\x20=\x20it.TagId');var _0x33bc8e=squel[_0x06b2('0x63')]();var _0x318a3b=[];var _0x5c328c=squel[_0x06b2('0x63')]();var _0x2f75a0;if(_0x5d451e['query']['search']){_0x2f75a0=as[_0x06b2('0x64')](_0x5d451e['query']['search']);var _0x2daf62=_0x2f75a0['sqlOperator'];for(var _0x2dac1c=0x0;_0x2dac1c<_0x2f75a0[_0x06b2('0x65')][_0x06b2('0x47')];_0x2dac1c++){var _0x334848=_0x2f75a0[_0x06b2('0x65')][_0x2dac1c];var _0xc834e3='i';var _0x4664c2=_[_0x06b2('0x66')](_0x5313a5,[_0x06b2('0x2c'),_0x334848[_0x06b2('0x4e')]]);if(!_0x4664c2){switch(_0x334848['field']){case'unreadMessages':if(_0x334848[_0x06b2('0x67')]==0x1){_0x146c5c[_0x06b2('0x68')]('`'+_0x334848['field']+_0x06b2('0x69'));}else{_0x146c5c[_0x06b2('0x68')]('`'+_0x334848[_0x06b2('0x4e')]+_0x06b2('0x6a'));}break;case'Contact':if(_0x334848['operator']==='$substring'){if(_0x334848[_0x06b2('0x67')]['split']('\x20')['length']>0x1){_0x33bc8e[_0x2daf62](_0x06b2('0x6b'),qs[_0x06b2('0x6c')](_0x334848[_0x06b2('0x67')]),null);}else{var _0x13aae1='%'+_0x334848[_0x06b2('0x67')]+'%';_0x33bc8e[_0x2daf62](_0x06b2('0x6d'),_0x13aae1,_0x13aae1,_0x13aae1);}}else{_0x4664c2=_['find'](_0x5313a5,[_0x06b2('0x2c'),_0x06b2('0x6e')]);_0x334848['field']=_0x06b2('0x6e');_0x19d3c4=as[_0x06b2('0x6f')](_0xc834e3,_0x4664c2[_0x06b2('0x70')],_0x334848);_0x33bc8e[_0x2daf62](_0x19d3c4[_0x06b2('0x71')],_0x19d3c4[_0x06b2('0x67')][_0x06b2('0x72')],_0x19d3c4[_0x06b2('0x67')][_0x06b2('0x20')]);}break;case _0x06b2('0x73'):var _0x33dd97=_0x334848[_0x06b2('0x67')][_0x06b2('0x33')](',')['map'](function(_0x3bde5d){return Number(_0x3bde5d);});_0x33dd97[_0x06b2('0x34')](function(_0x514472){_0x5c328c['or'](_0x06b2('0x74'),'%,'+_0x514472+',%');});_0x318a3b=_[_0x06b2('0x75')](_0x318a3b,_0x33dd97);break;case _0x06b2('0x76'):if(_0x334848[_0x06b2('0x77')]==='$substring'){_0x33bc8e[_0x2daf62](_0x06b2('0x78'),'%'+_0x334848[_0x06b2('0x67')]+'%',null);}else{_0x4664c2=_[_0x06b2('0x66')](_0x5313a5,['name',_0x06b2('0x79')]);_0x334848[_0x06b2('0x4e')]=_0x06b2('0x79');_0x19d3c4=as[_0x06b2('0x6f')](_0xc834e3,_0x4664c2[_0x06b2('0x70')],_0x334848);_0x33bc8e[_0x2daf62](_0x19d3c4[_0x06b2('0x71')],_0x19d3c4[_0x06b2('0x67')][_0x06b2('0x72')],_0x19d3c4[_0x06b2('0x67')]['end']);}break;case'plainBody':_0x19d3c4=as['buildExpression']('me',null,_0x334848);_0x33bc8e[_0x2daf62](_0x19d3c4['text'],_0x19d3c4[_0x06b2('0x67')]['start'],_0x19d3c4[_0x06b2('0x67')][_0x06b2('0x20')]);break;}}else{var _0x19d3c4=as[_0x06b2('0x6f')](_0xc834e3,_0x4664c2[_0x06b2('0x70')],_0x334848);_0x33bc8e[_0x2daf62](_0x19d3c4[_0x06b2('0x71')],_0x19d3c4['value']['start'],_0x19d3c4[_0x06b2('0x67')][_0x06b2('0x20')]);}}}else{var _0x4b908d=_(_0x5d451e[_0x06b2('0x41')])[_0x06b2('0x42')]()[_0x06b2('0x2f')](function(_0x353dd6){return _[_0x06b2('0x7a')](_0x5313a5,[_0x06b2('0x2c'),_0x353dd6])?_0x353dd6:undefined;})['compact']()[_0x06b2('0x67')]();if(!_['isEmpty'](_0x4b908d)){_0x4b908d[_0x06b2('0x34')](function(_0x3874da){if(_0x3874da===_0x06b2('0x7b')){_0x146c5c['where'](_0x06b2('0x7c'),[][_0x06b2('0x7d')](_0x5d451e[_0x06b2('0x41')][_0x3874da]));}else if(_0x3874da==='createdAt'){var _0xc1010=JSON['parse'](_0x5d451e[_0x06b2('0x41')][_0x3874da])[_0x06b2('0x7e')];var _0x215b25=JSON[_0x06b2('0x7f')](_0x5d451e[_0x06b2('0x41')][_0x3874da])[_0x06b2('0x80')];_0x146c5c['where'](_0x06b2('0x81'),_0xc1010,_0x215b25);}else{if(_0x5d451e[_0x06b2('0x41')][_0x3874da]===_0x06b2('0x82')){_0x146c5c[_0x06b2('0x4c')]('i.'+_0x3874da+'\x20IS\x20NULL');}else{_0x146c5c[_0x06b2('0x4c')]('i.'+_0x3874da+_0x06b2('0x83'),_0x5d451e[_0x06b2('0x41')][_0x3874da]);}}});}if(_0x5d451e['query']['read']){if(_0x5d451e[_0x06b2('0x41')]['read']==0x1){_0x146c5c[_0x06b2('0x68')]('`unreadMessages`\x20=\x200');}else{_0x146c5c['having'](_0x06b2('0x84'));}}if(_0x5d451e[_0x06b2('0x41')]['tag']){_0x318a3b=_[_0x06b2('0x85')](_0x5d451e[_0x06b2('0x41')][_0x06b2('0x86')])?_0x5d451e[_0x06b2('0x41')][_0x06b2('0x86')]:new Array(_0x5d451e[_0x06b2('0x41')][_0x06b2('0x86')]);_0x318a3b[_0x06b2('0x34')](function(_0x3018c7){_0x5c328c['or'](_0x06b2('0x74'),'%,'+_0x3018c7+',%');});}if(_0x5d451e[_0x06b2('0x41')]['filter']){var _0x8fdc8f=_0x5d451e['query']['filter'][_0x06b2('0x87')]('\x5c','\x5c\x5c')[_0x06b2('0x87')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x8fdc8f)){_0x33bc8e['or'](_0x06b2('0x88'),_0x8fdc8f+'%');}else if(qs[_0x06b2('0x89')](_0x8fdc8f)){_0x33bc8e['or'](_0x06b2('0x8a'),_0x8fdc8f+'%');}else{_0x33bc8e['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x06b2('0x6c')](_0x8fdc8f))['or'](_0x06b2('0x8b'),qs['getFullTextValue'](_0x8fdc8f));}}}_0x146c5c['where'](_0x33bc8e);_0x146c5c['group']('i.id');var _0xe5b5c5={'type':db['Sequelize'][_0x06b2('0x8c')][_0x06b2('0x8d')],'raw':!![]};var _0x1b1e6c=_0x146c5c[_0x06b2('0x8e')]();_0x1b1e6c[_0x06b2('0x4e')](_0x06b2('0x8f'));_0x1b1e6c[_0x06b2('0x4e')](_0x06b2('0x90'),_0x06b2('0x91'));if(_0x44b967[_0x06b2('0x4a')]){_0x44b967[_0x06b2('0x4a')][_0x06b2('0x34')](function(_0x2c2552){var _0x4c177f=_0x2c2552[0x0]==='contactName'?_0x2c2552[0x0]:'i.'+_0x2c2552[0x0];_0x146c5c[_0x06b2('0x4a')](_0x4c177f,_0x2c2552[0x1]===_0x06b2('0x92')?![]:!![]);});}if(!_[_0x06b2('0x93')](_0x318a3b)){_0x146c5c[_0x06b2('0x68')](_0x5c328c);_0x1b1e6c[_0x06b2('0x4c')](_0x06b2('0x94'),_0x318a3b);}BPromise['resolve']()['then'](function(){if(!_0x2f75a0){if(_0x5d451e[_0x06b2('0x41')][_0x06b2('0x7b')])return;_0x1b1e6c[_0x06b2('0x4c')](_0x06b2('0x95'));_0x146c5c[_0x06b2('0x4c')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5d451e[_0x06b2('0x96')]['role']!=='agent')return;return _0x5d451e[_0x06b2('0x96')][_0x06b2('0x97')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5a047c){if(_[_0x06b2('0x93')](_0x5a047c)){_0x1b1e6c[_0x06b2('0x4c')]('i.MailAccountId\x20IS\x20NULL');_0x146c5c['where']('i.MailAccountId\x20IS\x20NULL');}else{_0x1b1e6c['where'](_0x06b2('0x7c'),_[_0x06b2('0x2f')](_0x5a047c,'id'));_0x146c5c[_0x06b2('0x4c')](_0x06b2('0x7c'),_[_0x06b2('0x2f')](_0x5a047c,'id'));}});})[_0x06b2('0x2a')](function(){if(_0x5d451e[_0x06b2('0x96')][_0x06b2('0x98')]===_0x06b2('0x99')&&!_0x2f75a0&&!_0x5d451e[_0x06b2('0x41')][_0x06b2('0x7b')])return[];return db[_0x06b2('0x9a')][_0x06b2('0x41')](_0x1b1e6c[_0x06b2('0x9b')](),_0xe5b5c5);})[_0x06b2('0x2a')](function(_0x37a397){_0x26ab14[_0x06b2('0x22')]=_0x37a397[_0x06b2('0x47')];if(_0x26ab14[_0x06b2('0x22')]===0x0)return[];return db[_0x06b2('0x9a')][_0x06b2('0x41')](_0xf342f9[_0x06b2('0x9b')](),_0xe5b5c5)['then'](function(_0x21a405){_0x3ad4ff=_[_0x06b2('0x9c')](_0x21a405,'id');_0xe5b5c5=_[_0x06b2('0x9d')](_0xe5b5c5,{'model':db[_0x06b2('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5d451e[_0x06b2('0x41')][_0x06b2('0x46')]){_0x44b967['attributes'][_0x06b2('0x34')](function(_0x2417dd){_0x146c5c[_0x06b2('0x4e')]('i.'+_0x2417dd);});}else{_0x146c5c[_0x06b2('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x06b2('0x91'));_0x146c5c[_0x06b2('0x4e')]('a.key','Account.key');_0x146c5c[_0x06b2('0x4e')](_0x06b2('0x9e'),_0x06b2('0x9f'));_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xa0'),_0x06b2('0xa1'));_0x146c5c[_0x06b2('0x4e')]('i.id');_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xa2'));_0x146c5c[_0x06b2('0x4e')]('i.updatedAt');_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xa3'));_0x146c5c['field'](_0x06b2('0xa4'));_0x146c5c[_0x06b2('0x4e')]('i.attach');_0x146c5c[_0x06b2('0x4e')]('i.lastMsgAt');_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xa5'));_0x146c5c['field'](_0x06b2('0xa6'));_0x146c5c['field'](_0x06b2('0xa7'));_0x146c5c[_0x06b2('0x4e')]('i.secondDisposition');_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xa8'));_0x146c5c['field'](_0x06b2('0xa9'));_0x146c5c['field'](_0x06b2('0xaa'));_0x146c5c[_0x06b2('0x4e')]('i.ContactId');_0x146c5c['field'](_0x06b2('0xab'));_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xac'));_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xad'),_0x06b2('0xae'));_0x146c5c[_0x06b2('0x4e')]('c.lastName','Contact.lastName');_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xaf'),_0x06b2('0xb0'));_0x146c5c['field']('c.phone',_0x06b2('0xb1'));_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xb2'),_0x06b2('0xb3'));_0x146c5c['field']('c.fax',_0x06b2('0xb4'));_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xb5'),_0x06b2('0xb6'));_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xb7'),'Owner.internal');_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xb8'),_0x06b2('0x31'));}if(_0x44b967['limit'])_0x146c5c[_0x06b2('0x24')](_0x44b967[_0x06b2('0x24')]);if(_0x44b967['offset'])_0x146c5c[_0x06b2('0x23')](_0x44b967['offset']);return db[_0x06b2('0x9a')]['query'](_0x146c5c[_0x06b2('0x9b')](),_0xe5b5c5);})[_0x06b2('0x2a')](function(_0x58f090){_0x559c5a[_0x06b2('0x4c')]('ui.MailInteractionId\x20IN\x20?',_[_0x06b2('0x2f')](_0x58f090,'id'));return db['sequelize'][_0x06b2('0x41')](_0x559c5a[_0x06b2('0x9b')](),_0xe5b5c5)[_0x06b2('0x2a')](function(_0x2c52fa){var _0x20b1f3=_[_0x06b2('0xb9')](_0x2c52fa,_0x06b2('0xba'));var _0x31c855=[];return db['Setting']['findOne']({'attributes':[_0x06b2('0xbb')],'raw':!![]})[_0x06b2('0x2a')](function(_0xef0528){var _0x52a892=_0xef0528[_0x06b2('0xbb')];_0x58f090[_0x06b2('0x34')](function(_0x37e24c){_0x31c855[_0x06b2('0xbc')](updateMailInteraction(_0x37e24c,_0x3ad4ff,_0x20b1f3,_0x52a892));});return BPromise['all'](_0x31c855);});});});})['then'](function(_0xc94900){_0x26ab14[_0x06b2('0xbd')]=_0xc94900;return _0x26ab14;})['then'](respondWithFilteredResult(_0x4a4146,_0x44b967))['catch'](handleError(_0x4a4146,null));};exports[_0x06b2('0xbe')]=function(_0x292cc7,_0x3cfa36){var _0x2cfb3a={'raw':![],'where':{'id':_0x292cc7[_0x06b2('0xbf')]['id']}},_0x2c1d2d={};_0x2c1d2d[_0x06b2('0x40')]=_['keys'](db[_0x06b2('0x35')]['rawAttributes']);_0x2c1d2d[_0x06b2('0x41')]=_[_0x06b2('0x42')](_0x292cc7[_0x06b2('0x41')]);_0x2c1d2d[_0x06b2('0x43')]=_['intersection'](_0x2c1d2d[_0x06b2('0x40')],_0x2c1d2d['query']);_0x2cfb3a[_0x06b2('0x45')]=_[_0x06b2('0x44')](_0x2c1d2d[_0x06b2('0x40')],qs[_0x06b2('0x46')](_0x292cc7[_0x06b2('0x41')][_0x06b2('0x46')]));_0x2cfb3a[_0x06b2('0x45')]=_0x2cfb3a['attributes']['length']?_0x2cfb3a['attributes']:_0x2c1d2d['model'];if(_0x292cc7[_0x06b2('0x41')]['includeAll']){_0x2cfb3a[_0x06b2('0xc0')]=[{'all':!![]}];}_0x2cfb3a=_[_0x06b2('0x9d')]({},_0x2cfb3a,_0x292cc7[_0x06b2('0xc1')]);return db[_0x06b2('0x35')]['find'](_0x2cfb3a)[_0x06b2('0x2a')](handleEntityNotFound(_0x3cfa36,null))[_0x06b2('0x2a')](respondWithResult(_0x3cfa36,null))[_0x06b2('0x3b')](handleError(_0x3cfa36,null));};exports[_0x06b2('0xc2')]=function(_0x563397,_0x5c3517){return db[_0x06b2('0x35')][_0x06b2('0xc2')](_0x563397['body'],{})[_0x06b2('0x2a')](respondWithResult(_0x5c3517,0xc9))[_0x06b2('0x3b')](handleError(_0x5c3517,null));};exports[_0x06b2('0x28')]=function(_0x4178e6,_0x3f867f){if(_0x4178e6[_0x06b2('0xc3')]['id']){delete _0x4178e6[_0x06b2('0xc3')]['id'];}return db[_0x06b2('0x35')][_0x06b2('0x66')]({'where':{'id':_0x4178e6[_0x06b2('0xbf')]['id']}})['then'](handleEntityNotFound(_0x3f867f,null))[_0x06b2('0x2a')](saveUpdates(_0x4178e6[_0x06b2('0xc3')],null))['then'](respondWithResult(_0x3f867f,null))[_0x06b2('0x3b')](handleError(_0x3f867f,null));};exports[_0x06b2('0x29')]=function(_0x19e3de,_0x7014f3){return db[_0x06b2('0x35')][_0x06b2('0x66')]({'where':{'id':_0x19e3de['params']['id']}})[_0x06b2('0x2a')](handleEntityNotFound(_0x7014f3,null))['then'](removeEntity(_0x7014f3,null))[_0x06b2('0x3b')](handleError(_0x7014f3,null));};exports[_0x06b2('0xc4')]=function(_0x50953d,_0x19f03f){return db['MailInteraction'][_0x06b2('0xc4')]()[_0x06b2('0x2a')](respondWithResult(_0x19f03f,null))[_0x06b2('0x3b')](handleError(_0x19f03f,null));};exports['addMessage']=function(_0x28cb19,_0x4d6280,_0xa0a0a6){return db['MailMessage'][_0x06b2('0x66')]({'where':{'id':_0x28cb19['params']['id']}})[_0x06b2('0x2a')](handleEntityNotFound(_0x4d6280,null))['then'](function(_0x184dcd){if(_0x184dcd){return _0x184dcd[_0x06b2('0xc5')](_0x28cb19['body'][_0x06b2('0xc6')],_[_0x06b2('0xc7')](_0x28cb19[_0x06b2('0xc3')],[_0x06b2('0xc6'),'id'])||{});}})['then'](respondWithResult(_0x4d6280,null))[_0x06b2('0x3b')](handleError(_0x4d6280,null));};exports[_0x06b2('0xc8')]=function(_0x1e1b20,_0x441f5a,_0x489cd0){var _0x341866={'raw':![],'where':{}};var _0x5bc098={};var _0x41c49f={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x1e1b20[_0x06b2('0xbf')]['id']}})[_0x06b2('0x2a')](handleEntityNotFound(_0x441f5a,null))[_0x06b2('0x2a')](function(_0x43a7e9){if(_0x43a7e9){_0x5bc098['model']=_[_0x06b2('0x42')](db[_0x06b2('0xc9')][_0x06b2('0x3d')]);_0x5bc098[_0x06b2('0x41')]=_[_0x06b2('0x42')](_0x1e1b20[_0x06b2('0x41')]);_0x5bc098[_0x06b2('0x43')]=_[_0x06b2('0x44')](_0x5bc098[_0x06b2('0x40')],_0x5bc098[_0x06b2('0x41')]);_0x341866[_0x06b2('0x45')]=_[_0x06b2('0x44')](_0x5bc098[_0x06b2('0x40')],qs[_0x06b2('0x46')](_0x1e1b20[_0x06b2('0x41')][_0x06b2('0x46')]));_0x341866[_0x06b2('0x45')]=_0x341866[_0x06b2('0x45')][_0x06b2('0x47')]?_0x341866[_0x06b2('0x45')]:_0x5bc098[_0x06b2('0x40')];if(!_0x1e1b20[_0x06b2('0x41')]['hasOwnProperty'](_0x06b2('0x49'))){_0x341866[_0x06b2('0x24')]=qs[_0x06b2('0x24')](_0x1e1b20[_0x06b2('0x41')][_0x06b2('0x24')]);_0x341866[_0x06b2('0x23')]=qs['offset'](_0x1e1b20[_0x06b2('0x41')][_0x06b2('0x23')]);}_0x341866[_0x06b2('0x4a')]=qs[_0x06b2('0x4b')](_0x1e1b20[_0x06b2('0x41')][_0x06b2('0x4b')]);_0x341866[_0x06b2('0x4c')]=qs[_0x06b2('0x43')](_[_0x06b2('0x4d')](_0x1e1b20['query'],_0x5bc098[_0x06b2('0x43')]));_0x341866[_0x06b2('0x4c')]['MailInteractionId']=_0x43a7e9['id'];if(_0x1e1b20['query']['filter']){_0x341866[_0x06b2('0x4c')]=_[_0x06b2('0x9d')](_0x341866[_0x06b2('0x4c')],{'$or':_['map'](_0x341866[_0x06b2('0x45')],function(_0xa40d3b){var _0x59240f={};_0x59240f[_0xa40d3b]={'$like':'%'+_0x1e1b20[_0x06b2('0x41')][_0x06b2('0xca')]+'%'};return _0x59240f;})});}if(_0x1e1b20['query'][_0x06b2('0x7e')]){var _0x32bae7=_0x1e1b20[_0x06b2('0x41')][_0x06b2('0x7e')][_0x06b2('0x33')](',');var _0xc00638={};_0xc00638[_0x32bae7[0x0]]={'$gte':moment(_0x32bae7[0x1])[_0x06b2('0xcb')](_0x06b2('0xcc'))};_0x341866[_0x06b2('0x4c')]=_[_0x06b2('0x9d')](_0x341866[_0x06b2('0x4c')],_0xc00638);}_0x341866=_[_0x06b2('0x9d')]({},_0x341866,_0x1e1b20[_0x06b2('0xc1')]);return db['MailMessage'][_0x06b2('0x22')]({'where':_0x341866[_0x06b2('0x4c')]})['then'](function(_0x130fa7){_0x41c49f[_0x06b2('0x22')]=_0x130fa7;if(_0x1e1b20[_0x06b2('0x41')][_0x06b2('0xcd')]){_0x341866[_0x06b2('0xc0')]=[{'all':!![]}];}return db[_0x06b2('0xc9')][_0x06b2('0xce')](_0x341866);})[_0x06b2('0x2a')](function(_0x5e7572){if(_0x1e1b20[_0x06b2('0x41')][_0x06b2('0xcf')]===_0x06b2('0xd0')){for(var _0x36d05b=0x0;_0x36d05b<_0x5e7572[_0x06b2('0x47')];_0x36d05b++){_0x5e7572[_0x36d05b][_0x06b2('0xc3')]=juice(_0x5e7572[_0x36d05b]['body']);}}_0x41c49f[_0x06b2('0xbd')]=_0x5e7572;return _0x41c49f;});}})['then'](respondWithFilteredResult(_0x441f5a,_0x341866))[_0x06b2('0x3b')](handleError(_0x441f5a,null));};exports[_0x06b2('0xd1')]=function(_0x5337d9,_0xaeccb2,_0x74af68){return db[_0x06b2('0x35')][_0x06b2('0x66')]({'where':{'id':_0x5337d9[_0x06b2('0xbf')]['id']}})['then'](handleEntityNotFound(_0xaeccb2,null))[_0x06b2('0x2a')](function(_0x629e7){if(_0x629e7){return _0x629e7[_0x06b2('0xd2')](_0x5337d9['body'][_0x06b2('0xc6')],_[_0x06b2('0xc7')](_0x5337d9[_0x06b2('0xc3')],[_0x06b2('0xc6'),'id'])||{})['spread'](function(){return db['Tag'][_0x06b2('0xce')]({'attributes':['id','name',_0x06b2('0x4f')],'where':{'id':_0x5337d9[_0x06b2('0xc3')][_0x06b2('0xc6')]}});})[_0x06b2('0x2a')](function(_0x28d3c0){socket[_0x06b2('0xd3')](_0x06b2('0xd4'),{'id':Number(_0x5337d9[_0x06b2('0xbf')]['id']),'tags':_0x28d3c0||[]});return{'id':Number(_0x5337d9[_0x06b2('0xbf')]['id']),'tags':_0x28d3c0||[]};});}})['then'](respondWithResult(_0xaeccb2,null))[_0x06b2('0x3b')](handleError(_0xaeccb2,null));};exports[_0x06b2('0xd5')]=function(_0x34cd98,_0x42e046,_0x5d846f){return db[_0x06b2('0x35')][_0x06b2('0x66')]({'where':{'id':_0x34cd98['params']['id']}})[_0x06b2('0x2a')](handleEntityNotFound(_0x42e046,null))[_0x06b2('0x2a')](function(_0x167676){if(_0x167676){return _0x167676[_0x06b2('0xd5')](_0x34cd98[_0x06b2('0x41')][_0x06b2('0xc6')]);}})[_0x06b2('0x2a')](respondWithStatusCode(_0x42e046,null))[_0x06b2('0x3b')](handleError(_0x42e046,null));};exports[_0x06b2('0xd6')]=function(_0x102fae,_0x4f55a5){var _0x229b88=moment()[_0x06b2('0xd7')]()[_0x06b2('0x9b')]();var _0x2cf5ca=path[_0x06b2('0xd8')](config[_0x06b2('0xd9')],_0x06b2('0xda'),'files',_0x06b2('0xdb'));var _0x1f5bfb=path[_0x06b2('0xd8')](config[_0x06b2('0xd9')],_0x06b2('0xda'),'files','attachments');var _0x3724f5=path['join'](_0x2cf5ca,_0x229b88);var _0x17da5b=util[_0x06b2('0xcb')](_0x06b2('0xdc'),_0x102fae[_0x06b2('0xbf')]['id'],_0x229b88);var _0x137313=path[_0x06b2('0xd8')](_0x2cf5ca,_0x17da5b);var _0x73631d=[];if(_0x102fae[_0x06b2('0x41')][_0x06b2('0xdd')]){_0x73631d[_0x06b2('0xbc')]({'model':db[_0x06b2('0xde')],'as':_0x06b2('0xdf'),'raw':!![]});}var _0x2c760a=[{'model':db['MailMessage'],'as':_0x06b2('0xe0'),'attributes':['id',_0x06b2('0xc3'),'from','to','cc',_0x06b2('0xe1'),_0x06b2('0xe2'),_0x06b2('0xe3')],'where':{'secret':![]},'order':qs[_0x06b2('0x4b')]('id'),'include':_0x73631d}];return db[_0x06b2('0x35')][_0x06b2('0x66')]({'where':{'id':_0x102fae[_0x06b2('0xbf')]['id']},'include':_0x2c760a})[_0x06b2('0x2a')](handleEntityNotFound(_0x4f55a5,null))[_0x06b2('0x2a')](function(_0x1c5fc7){if(_0x1c5fc7&&_0x1c5fc7[_0x06b2('0xe0')]){var _0x1e9451=_0x1c5fc7['get']({'plain':!![]});fs[_0x06b2('0xe4')](_0x3724f5);return BPromise[_0x06b2('0xe5')](_0x1e9451[_0x06b2('0xe0')],function(_0x38d82d,_0x4e0d56){var _0x2ef92f={'from':_0x38d82d['from'],'to':_0x38d82d['to'],'subject':_0x38d82d[_0x06b2('0xe2')],'html':_0x38d82d['body'],'headers':{'Date':moment(_0x38d82d['createdAt'])['format'](_0x06b2('0xe6'))},'attachments':[]};if(_0x38d82d['cc']){_0x2ef92f[_0x06b2('0xe7')]['Cc']=_0x38d82d['cc'];}if(_0x38d82d[_0x06b2('0xe1')]){_0x2ef92f[_0x06b2('0xe7')][_0x06b2('0xe8')]=_0x38d82d[_0x06b2('0xe1')];}return new BPromise(function(_0x2f5ce4,_0x2565c6){if(_0x38d82d['Attachments']){for(var _0x2eb954=0x0;_0x2eb954<_0x38d82d['Attachments']['length'];_0x2eb954++){var _0x304e58=_0x38d82d['Attachments'][_0x2eb954];var _0x5334a0=path[_0x06b2('0xd8')](_0x1f5bfb,_0x304e58['basename']);if(fs[_0x06b2('0xe9')](_0x5334a0)){_0x2ef92f[_0x06b2('0xdd')][_0x06b2('0xbc')]({'name':_0x304e58[_0x06b2('0x2c')],'contentType':_0x304e58[_0x06b2('0x70')],'data':fs['readFileSync'](_0x5334a0)});}}}emlformat['build'](_0x2ef92f,function(_0x91f6e9,_0x50d559){if(_0x91f6e9)return _0x2565c6(_0x91f6e9);fs['writeFileSync'](path['join'](_0x3724f5,util[_0x06b2('0xcb')](_0x06b2('0xea'),_0x4e0d56)),_0x50d559);return _0x2f5ce4(_0x50d559);});});})['then'](function(){return new BPromise(function(_0x18edc3,_0x4b0184){zipdir(_0x3724f5,{'saveTo':_0x137313},function(_0x5ae99c,_0x2ba6ab){if(_0x5ae99c)return _0x4b0184(_0x5ae99c);return _0x18edc3(_0x2ba6ab);});})[_0x06b2('0x2a')](function(){return new BPromise(function(_0x420253,_0x2eec7c){rimraf(_0x3724f5,function(_0x1690d3){if(_0x1690d3)_0x2eec7c(_0x1690d3);return _0x420253();});});})['then'](function(){return _0x4f55a5[_0x06b2('0xd6')](_0x137313,_0x17da5b,function(_0x11cab1){if(_0x11cab1){console[_0x06b2('0xeb')](_0x06b2('0xec'),_0x11cab1);}else{fs[_0x06b2('0xed')](_0x137313);}});});});}else{return _0x4f55a5[_0x06b2('0x1e')](0xc8);}})[_0x06b2('0x3b')](handleError(_0x4f55a5,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 7933fbc..cc97b39 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 _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 +var _0x5676=['../../mysqldb','MailMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','exports','events'];(function(_0x171cd9,_0x2c717a){var _0x562362=function(_0x1f11d0){while(--_0x1f11d0){_0x171cd9['push'](_0x171cd9['shift']());}};_0x562362(++_0x2c717a);}(_0x5676,0x19f));var _0x6567=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5676[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x6567('0x0'));var MailInteraction=require(_0x6567('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x6567('0x1'))['db'][_0x6567('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6567('0x3')](0x0);var events={'afterCreate':_0x6567('0x4'),'afterUpdate':'update','afterDestroy':_0x6567('0x5')};function emitEvent(_0x2ff092){return function(_0x257527,_0xf110c0,_0x3c551a){_0x257527[_0x6567('0x6')]({'attributes':['id'],'raw':!![]})[_0x6567('0x7')](function(_0x566910){_0x257527[_0x6567('0x8')]('Users',_0x566910[_0x6567('0x9')](function(_0x262f50){return{'id':_0x262f50['id']};}));return MailMessage[_0x6567('0xa')]({'where':{'MailInteractionId':_0x257527['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6567('0x7')](function(_0x31e34e){_0x257527[_0x6567('0x8')](_0x6567('0xb'),_0x31e34e[_0x6567('0xc')]);MailInteractionEvents[_0x6567('0xd')](_0x2ff092+':'+_0x257527['id'],_0x257527);MailInteractionEvents[_0x6567('0xd')](_0x2ff092,_0x257527);_0x3c551a(null);})[_0x6567('0xe')](_0x3c551a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x6567('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index ba565f2..49ccb62 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 _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 +var _0x1ba2=['update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','MailMessage'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x1ba2,0xb4));var _0x21ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ba2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x21ba('0x0'));var util=require('util');var logger=require(_0x21ba('0x1'))('api');var moment=require(_0x21ba('0x2'));var BPromise=require(_0x21ba('0x3'));var rp=require(_0x21ba('0x4'));var fs=require('fs');var path=require(_0x21ba('0x5'));var rimraf=require(_0x21ba('0x6'));var config=require('../../config/environment');var attributes=require(_0x21ba('0x7'));module[_0x21ba('0x8')]=function(_0x4a07e8,_0x10dae1){return _0x4a07e8['define'](_0x21ba('0x9'),attributes,{'tableName':_0x21ba('0xa'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x21ba('0xb'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x7cf5aa,_0x261a15,_0x48ddf3){if(_0x7cf5aa[_0x21ba('0xc')]){_0x7cf5aa[_0x21ba('0xd')]=moment()[_0x21ba('0xe')](_0x21ba('0xf'));}if(_0x7cf5aa[_0x21ba('0x10')]){_0x7cf5aa[_0x21ba('0x11')]=moment()[_0x21ba('0xe')](_0x21ba('0xf'));}_0x48ddf3(null,_0x261a15);},'beforeUpdate':function(_0x598045,_0xbe3b90,_0x10fae1){if(_0x598045[_0x21ba('0x12')]('substatus')){_0x598045['substatusAt']=_0x598045[_0x21ba('0xc')]?moment()[_0x21ba('0xe')](_0x21ba('0xf')):null;}if(_0x598045['changed']('closed')){_0x598045[_0x21ba('0x11')]=moment()['format'](_0x21ba('0xf'));_0x598045['substatus']=null;_0x598045[_0x21ba('0xd')]=null;}_0x10fae1(null,_0x598045);},'afterUpdate':function(_0x2e7b03,_0x17df0e,_0x1c2bac){var _0x10b9e6=_0x4a07e8['models'];var _0x1ab5ed=_0x2e7b03['get']({'plain':!![]});if(_0x1ab5ed[_0x21ba('0x10')]){return _0x10b9e6[_0x21ba('0x13')][_0x21ba('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x1ab5ed['id']}})[_0x21ba('0x15')](function(){_0x1c2bac();})[_0x21ba('0x16')](function(_0x260c98){_0x1c2bac(_0x260c98);});}else{_0x1c2bac();}}},'charset':_0x21ba('0x17'),'collate':_0x21ba('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index f60a7e6..58de93d 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 _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 +var _0x6ce9=['client','http','redis','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','limit','stringify','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3ac7f8,_0x45a76c){var _0x125286=function(_0x4f9268){while(--_0x4f9268){_0x3ac7f8['push'](_0x3ac7f8['shift']());}};_0x125286(++_0x45a76c);}(_0x6ce9,0x76));var _0x96ce=function(_0x422bfe,_0xc4b852){_0x422bfe=_0x422bfe-0x0;var _0x5d2a7b=_0x6ce9[_0x422bfe];return _0x5d2a7b;};'use strict';var _=require(_0x96ce('0x0'));var util=require(_0x96ce('0x1'));var moment=require(_0x96ce('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96ce('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x96ce('0x4'));var logger=require(_0x96ce('0x5'))(_0x96ce('0x6'));var config=require(_0x96ce('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x96ce('0x8')][_0x96ce('0x9')]({'port':0x232a});config[_0x96ce('0xa')]=_['defaults'](config[_0x96ce('0xa')],{'host':_0x96ce('0xb'),'port':0x18eb});var socket=require(_0x96ce('0xc'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x96ce('0xd')](socket);function respondWithRpcPromise(_0x33a4d0,_0x19d1c2,_0x296e57){return new BPromise(function(_0x150f93,_0x3ebcca){return client[_0x96ce('0xe')](_0x33a4d0,_0x296e57)[_0x96ce('0xf')](function(_0x1e3c4a){logger[_0x96ce('0x10')](_0x96ce('0x11'),_0x19d1c2,'request\x20sent');logger[_0x96ce('0x12')](_0x96ce('0x13'),_0x19d1c2,_0x96ce('0x14'),JSON['stringify'](_0x1e3c4a));if(_0x1e3c4a[_0x96ce('0x15')]){if(_0x1e3c4a[_0x96ce('0x15')][_0x96ce('0x16')]===0x1f4){logger[_0x96ce('0x15')](_0x96ce('0x11'),_0x19d1c2,_0x1e3c4a[_0x96ce('0x15')][_0x96ce('0x17')]);return _0x3ebcca(_0x1e3c4a[_0x96ce('0x15')][_0x96ce('0x17')]);}logger[_0x96ce('0x15')](_0x96ce('0x11'),_0x19d1c2,_0x1e3c4a[_0x96ce('0x15')][_0x96ce('0x17')]);return _0x150f93(_0x1e3c4a[_0x96ce('0x15')][_0x96ce('0x17')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x19d1c2,_0x96ce('0x14'));_0x150f93(_0x1e3c4a[_0x96ce('0x18')][_0x96ce('0x17')]);}})[_0x96ce('0x19')](function(_0x89baa5){logger[_0x96ce('0x15')](_0x96ce('0x11'),_0x19d1c2,_0x89baa5);_0x3ebcca(_0x89baa5);});});}exports[_0x96ce('0x1a')]=function(_0x1b2cbf){var _0x2730ec=this;return new Promise(function(_0x566000,_0x8ad008){return db[_0x96ce('0x1b')][_0x96ce('0x1c')](_0x1b2cbf[_0x96ce('0x1d')],{'raw':_0x1b2cbf[_0x96ce('0x1e')]?_0x1b2cbf[_0x96ce('0x1e')][_0x96ce('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b2cbf['options']?_0x1b2cbf[_0x96ce('0x1e')][_0x96ce('0x20')]||null:null,'attributes':_0x1b2cbf[_0x96ce('0x1e')]?_0x1b2cbf['options']['attributes']||null:null,'limit':_0x1b2cbf[_0x96ce('0x1e')]?_0x1b2cbf['options'][_0x96ce('0x21')]||null:null})[_0x96ce('0xf')](function(_0xa703d){logger[_0x96ce('0x10')]('UpdateMailInteraction',_0x1b2cbf);logger[_0x96ce('0x12')](_0x96ce('0x1a'),_0x1b2cbf,JSON[_0x96ce('0x22')](_0xa703d));_0x566000(_0xa703d);})['catch'](function(_0x45d90e){logger[_0x96ce('0x15')](_0x96ce('0x1a'),_0x45d90e[_0x96ce('0x17')],_0x1b2cbf);_0x8ad008(_0x2730ec[_0x96ce('0x15')](0x1f4,_0x45d90e['message']));});});};exports[_0x96ce('0x23')]=function(_0x4276e0){return new Promise(function(_0x174c2e,_0x131073){return db['MailInteraction'][_0x96ce('0x24')]({'where':_0x4276e0[_0x96ce('0x1e')]?_0x4276e0[_0x96ce('0x1e')]['where']||null:null})[_0x96ce('0xf')](function(_0x31edcc){if(_0x31edcc){return _0x31edcc[_0x96ce('0x25')](_0x4276e0[_0x96ce('0x1d')][_0x96ce('0x26')],_[_0x96ce('0x27')](_0x4276e0[_0x96ce('0x1d')],[_0x96ce('0x26'),'id'])||{});}})[_0x96ce('0x28')](function(_0x4a1e3e){logger[_0x96ce('0x10')](_0x96ce('0x29'),_0x4276e0);logger[_0x96ce('0x12')](_0x96ce('0x29'),_0x4276e0,JSON[_0x96ce('0x22')](_0x4a1e3e));_0x174c2e(_0x4a1e3e);})[_0x96ce('0x19')](function(_0xd6ef1){logger['error'](_0x96ce('0x29'),_0xd6ef1[_0x96ce('0x17')],_0x4276e0);_0x131073(_this[_0x96ce('0x15')](0x1f4,_0xd6ef1[_0x96ce('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 96d5be0..7db9993 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 _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 +var _0x0694=['./mailInteraction.events','remove','update','emit','removeListener','register','length','mailInteraction:'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0x0694,0xa0));var _0x4069=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x0694[_0x5c351c];return _0x26f3b3;};'use strict';var MailInteractionEvents=require(_0x4069('0x0'));var events=['save',_0x4069('0x1'),_0x4069('0x2')];function createListener(_0x4e1557,_0x9b184){return function(_0x50588a){_0x9b184[_0x4069('0x3')](_0x4e1557,_0x50588a);};}function removeListener(_0x33b97e,_0x363992){return function(){MailInteractionEvents[_0x4069('0x4')](_0x33b97e,_0x363992);};}exports[_0x4069('0x5')]=function(_0x368149){for(var _0x3f4147=0x0,_0x2ac098=events[_0x4069('0x6')];_0x3f4147<_0x2ac098;_0x3f4147++){var _0x360b87=events[_0x3f4147];var _0x471c35=createListener(_0x4069('0x7')+_0x360b87,_0x368149);MailInteractionEvents['on'](_0x360b87,_0x471c35);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 512e985..7cb47c5 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 _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 +var _0x425d=['show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id'];(function(_0x537c81,_0x163d8c){var _0x25c839=function(_0x2b96a2){while(--_0x2b96a2){_0x537c81['push'](_0x537c81['shift']());}};_0x25c839(++_0x163d8c);}(_0x425d,0x1e0));var _0xd425=function(_0x3f578f,_0x51f172){_0x3f578f=_0x3f578f-0x0;var _0x32c754=_0x425d[_0x3f578f];return _0x32c754;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var auth=require(_0xd425('0x5'));var interaction=require(_0xd425('0x6'));var config=require(_0xd425('0x7'));var controller=require('./mailMessage.controller');router[_0xd425('0x8')]('/',auth[_0xd425('0x9')](),controller[_0xd425('0xa')]);router[_0xd425('0x8')](_0xd425('0xb'),auth[_0xd425('0x9')](),controller['describe']);router[_0xd425('0x8')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0xd')]);router[_0xd425('0x8')](_0xd425('0xe'),auth[_0xd425('0x9')](),controller[_0xd425('0xf')]);router[_0xd425('0x10')]('/',auth[_0xd425('0x9')](),interaction[_0xd425('0x11')](_0xd425('0x12'),_0xd425('0x13')),controller[_0xd425('0x14')]);router[_0xd425('0x15')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0x16')]);router[_0xd425('0x15')](_0xd425('0x17'),auth['isAuthenticated'](),controller[_0xd425('0x18')]);router[_0xd425('0x15')](_0xd425('0x19'),auth['isAuthenticated'](),controller[_0xd425('0x1a')]);router[_0xd425('0x1b')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 7c2e301..d59c9a3 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 _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 +var _0xbd9e=['out','STRING','DATE','INTEGER','exports','long','TEXT','medium','BOOLEAN','ENUM'];(function(_0x15951f,_0x4019b3){var _0x40a1fa=function(_0x3810e8){while(--_0x3810e8){_0x15951f['push'](_0x15951f['shift']());}};_0x40a1fa(++_0x4019b3);}(_0xbd9e,0x108));var _0xebd9=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xbd9e[_0x42245d];return _0x4b211a;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xebd9('0x0')]={'body':{'type':Sequelize['TEXT'](_0xebd9('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xebd9('0x2')](_0xebd9('0x3'))},'read':{'type':Sequelize[_0xebd9('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xebd9('0x5')]('in','out'),'defaultValue':_0xebd9('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xebd9('0x7')]},'to':{'type':Sequelize[_0xebd9('0x2')](_0xebd9('0x1'))},'cc':{'type':Sequelize[_0xebd9('0x2')](_0xebd9('0x1'))},'bcc':{'type':Sequelize[_0xebd9('0x2')]('long')},'subject':{'type':Sequelize[_0xebd9('0x2')]},'sentAt':{'type':Sequelize[_0xebd9('0x8')]},'attach':{'type':Sequelize[_0xebd9('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xebd9('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xebd9('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0xebd9('0x1'))},'originCc':{'type':Sequelize['TEXT'](_0xebd9('0x1'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index b36b9dc..80cabb7 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(_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 +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(_0x37b78d,_0xc30ab){var _0x72e474=function(_0x405a04){while(--_0x405a04){_0x37b78d['push'](_0x37b78d['shift']());}};_0x72e474(++_0xc30ab);}(_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);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 f71d7c4..6a5d757 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 _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 +var _0x8bc3=['save','remove','emit','hook','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0x8bc3,0x89));var _0x38bc=function(_0x36ca7f,_0x337025){_0x36ca7f=_0x36ca7f-0x0;var _0x1dedcd=_0x8bc3[_0x36ca7f];return _0x1dedcd;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x38bc('0x0'))['db'][_0x38bc('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x38bc('0x2')](0x0);var events={'afterCreate':_0x38bc('0x3'),'afterUpdate':'update','afterDestroy':_0x38bc('0x4')};function emitEvent(_0x422ca3){return function(_0x499505,_0x31988a,_0x452215){MailMessageEvents[_0x38bc('0x5')](_0x422ca3+':'+_0x499505['id'],_0x499505);MailMessageEvents[_0x38bc('0x5')](_0x422ca3,_0x499505);_0x452215(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x38bc('0x6')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 9e4e137..2989f06 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 _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 +var _0xd33d=['fti_mail_messages','plainBody','subject','FULLTEXT','body','get','direction','toLowerCase','secret','UserId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','moment','bluebird','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId'];(function(_0x2d25e5,_0x5d1e52){var _0x8385c8=function(_0x2dd203){while(--_0x2dd203){_0x2d25e5['push'](_0x2d25e5['shift']());}};_0x8385c8(++_0x5d1e52);}(_0xd33d,0x144));var _0xdd33=function(_0x6e2ff8,_0x290cd1){_0x6e2ff8=_0x6e2ff8-0x0;var _0x1988bb=_0xd33d[_0x6e2ff8];return _0x1988bb;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdd33('0x0'));var BPromise=require(_0xdd33('0x1'));var rp=require(_0xdd33('0x2'));var htmlToText=require(_0xdd33('0x3'));var fs=require('fs');var path=require(_0xdd33('0x4'));var rimraf=require('rimraf');var config=require(_0xdd33('0x5'));var attributes=require(_0xdd33('0x6'));module[_0xdd33('0x7')]=function(_0x1dfd70,_0x1742f7){return _0x1dfd70[_0xdd33('0x8')](_0xdd33('0x9'),attributes,{'tableName':_0xdd33('0xa'),'paranoid':![],'indexes':[{'name':_0xdd33('0xb'),'fields':[_0xdd33('0xb')]},{'name':_0xdd33('0xc'),'fields':[_0xdd33('0xd'),_0xdd33('0xe')],'type':_0xdd33('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xb31e80,_0x4aa432,_0x4b8eaa){if(_0xb31e80[_0xdd33('0x10')]){_0xb31e80[_0xdd33('0xd')]=htmlToText['fromString'](_0xb31e80[_0xdd33('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4b8eaa(null,_0x4aa432);},'afterCreate':function(_0x45d540,_0x5b5d7f,_0x26b3dc){var _0x158e32=_0x1dfd70['models'];var _0x478974=_0x45d540[_0xdd33('0x11')]({'plain':!![]});if(_0x478974[_0xdd33('0x12')][_0xdd33('0x13')]()==='in'||_0x478974[_0xdd33('0x12')][_0xdd33('0x13')]()==='out'&&!_0x478974[_0xdd33('0x14')]&&!_['isNil'](_0x478974[_0xdd33('0x15')])){_0x158e32['MailInteraction']['findOne']({'where':{'id':_0x478974['MailInteractionId']}})['then'](function(_0x68c276){if(_0x68c276){_0x68c276[_0xdd33('0x16')]({'lastMsgAt':_0x478974[_0xdd33('0x17')],'lastMsgDirection':_0x478974['direction']['toLowerCase'](),'lastMsgBody':_0x478974['body']});}})[_0xdd33('0x18')](function(_0x5dd826){console[_0xdd33('0x19')](_0x5dd826);});}_0x26b3dc();}},'charset':_0xdd33('0x1a'),'collate':_0xdd33('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 1829224..6b6c63d 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 _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 +var _0xc770=['stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./mailMessage.socket','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateMailMessage','body','options','raw','info'];(function(_0x5d5ff8,_0x5a4489){var _0x53b4b6=function(_0x5dca03){while(--_0x5dca03){_0x5d5ff8['push'](_0x5d5ff8['shift']());}};_0x53b4b6(++_0x5a4489);}(_0xc770,0xd3));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0c77('0x0'));var util=require(_0x0c77('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0c77('0x2'));var fs=require('fs');var Redis=require(_0x0c77('0x3'));var db=require(_0x0c77('0x4'))['db'];var utils=require(_0x0c77('0x5'));var logger=require(_0x0c77('0x6'))(_0x0c77('0x7'));var config=require(_0x0c77('0x8'));var jayson=require(_0x0c77('0x9'));var client=jayson['client'][_0x0c77('0xa')]({'port':0x232a});config[_0x0c77('0xb')]=_['defaults'](config[_0x0c77('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0c77('0xc'))(new Redis(config[_0x0c77('0xb')]));require(_0x0c77('0xd'))['register'](socket);function respondWithRpcPromise(_0xdb6e5d,_0x194f36,_0x4b47f0){return new BPromise(function(_0x58c6d5,_0x2784dd){return client['request'](_0xdb6e5d,_0x4b47f0)[_0x0c77('0xe')](function(_0x831896){logger['info'](_0x0c77('0xf'),_0x194f36,_0x0c77('0x10'));logger[_0x0c77('0x11')](_0x0c77('0x12'),_0x194f36,'request\x20sent',JSON['stringify'](_0x831896));if(_0x831896['error']){if(_0x831896[_0x0c77('0x13')][_0x0c77('0x14')]===0x1f4){logger[_0x0c77('0x13')](_0x0c77('0xf'),_0x194f36,_0x831896['error'][_0x0c77('0x15')]);return _0x2784dd(_0x831896[_0x0c77('0x13')]['message']);}logger[_0x0c77('0x13')](_0x0c77('0xf'),_0x194f36,_0x831896['error']['message']);return _0x58c6d5(_0x831896[_0x0c77('0x13')][_0x0c77('0x15')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x194f36,_0x0c77('0x10'));_0x58c6d5(_0x831896[_0x0c77('0x16')][_0x0c77('0x15')]);}})[_0x0c77('0x17')](function(_0x4c5d2a){logger[_0x0c77('0x13')](_0x0c77('0xf'),_0x194f36,_0x4c5d2a);_0x2784dd(_0x4c5d2a);});});}exports[_0x0c77('0x18')]=function(_0x4b8520){var _0x226c37=this;return new Promise(function(_0x2519d3,_0x4c7e25){return db['MailMessage']['create'](_0x4b8520[_0x0c77('0x19')],{'raw':_0x4b8520[_0x0c77('0x1a')]?_0x4b8520[_0x0c77('0x1a')][_0x0c77('0x1b')]===undefined?!![]:![]:!![]})[_0x0c77('0xe')](function(_0x147ff1){logger[_0x0c77('0x1c')]('CreateMailMessage',_0x4b8520);logger[_0x0c77('0x11')]('CreateMailMessage',_0x4b8520,JSON[_0x0c77('0x1d')](_0x147ff1));_0x2519d3(_0x147ff1);})[_0x0c77('0x17')](function(_0x1278dc){logger[_0x0c77('0x13')](_0x0c77('0x18'),_0x1278dc[_0x0c77('0x15')],_0x4b8520);_0x4c7e25(_0x226c37[_0x0c77('0x13')](0x1f4,_0x1278dc['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index aface05..c7299ba 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 _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 +var _0x2e85=['register','length','mailMessage:','./mailMessage.events','save','remove'];(function(_0x128a51,_0x52e0c7){var _0x4d7ebe=function(_0x155216){while(--_0x155216){_0x128a51['push'](_0x128a51['shift']());}};_0x4d7ebe(++_0x52e0c7);}(_0x2e85,0x165));var _0x52e8=function(_0x27c662,_0x2123f5){_0x27c662=_0x27c662-0x0;var _0x41271f=_0x2e85[_0x27c662];return _0x41271f;};'use strict';var MailMessageEvents=require(_0x52e8('0x0'));var events=[_0x52e8('0x1'),_0x52e8('0x2'),'update'];function createListener(_0x4caf72,_0x5253b4){return function(_0x468d68){_0x5253b4['emit'](_0x4caf72,_0x468d68);};}function removeListener(_0x109dcc,_0x4a2a20){return function(){MailMessageEvents['removeListener'](_0x109dcc,_0x4a2a20);};}exports[_0x52e8('0x3')]=function(_0x1713eb){for(var _0x324709=0x0,_0x366d87=events[_0x52e8('0x4')];_0x324709<_0x366d87;_0x324709++){var _0x1c9e1a=events[_0x324709];var _0x3a25d5=createListener(_0x52e8('0x5')+_0x1c9e1a,_0x1713eb);MailMessageEvents['on'](_0x1c9e1a,_0x3a25d5);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index b028882..22911e8 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 _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 +var _0x4b5d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','post','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x675817,_0x250b83){var _0x332c9e=function(_0x28f649){while(--_0x28f649){_0x675817['push'](_0x675817['shift']());}};_0x332c9e(++_0x250b83);}(_0x4b5d,0x180));var _0xd4b5=function(_0x206338,_0x2d800b){_0x206338=_0x206338-0x0;var _0x2b87f2=_0x4b5d[_0x206338];return _0x2b87f2;};'use strict';var multer=require(_0xd4b5('0x0'));var util=require(_0xd4b5('0x1'));var path=require(_0xd4b5('0x2'));var timeout=require(_0xd4b5('0x3'));var express=require(_0xd4b5('0x4'));var router=express[_0xd4b5('0x5')]();var auth=require(_0xd4b5('0x6'));var interaction=require(_0xd4b5('0x7'));var config=require(_0xd4b5('0x8'));var controller=require(_0xd4b5('0x9'));router[_0xd4b5('0xa')]('/',auth[_0xd4b5('0xb')](),controller[_0xd4b5('0xc')]);router[_0xd4b5('0xa')](_0xd4b5('0xd'),auth[_0xd4b5('0xb')](),controller[_0xd4b5('0xe')]);router['get'](_0xd4b5('0xf'),auth[_0xd4b5('0xb')](),controller[_0xd4b5('0x10')]);router[_0xd4b5('0xa')]('/:id/members',auth['isAuthenticated'](),controller[_0xd4b5('0x11')]);router[_0xd4b5('0xa')](_0xd4b5('0x12'),auth[_0xd4b5('0xb')](),controller['getTeams']);router['get'](_0xd4b5('0x13'),auth[_0xd4b5('0xb')](),controller[_0xd4b5('0x14')]);router[_0xd4b5('0x15')]('/',auth[_0xd4b5('0xb')](),controller['create']);router[_0xd4b5('0x15')](_0xd4b5('0x12'),auth['isAuthenticated'](),controller['addTeams']);router[_0xd4b5('0x15')]('/:id/users',auth[_0xd4b5('0xb')](),controller[_0xd4b5('0x16')]);router[_0xd4b5('0x17')](_0xd4b5('0xf'),auth[_0xd4b5('0xb')](),controller[_0xd4b5('0x18')]);router[_0xd4b5('0x19')](_0xd4b5('0xf'),auth[_0xd4b5('0xb')](),controller[_0xd4b5('0x1a')]);router[_0xd4b5('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd4b5('0x1b')]);router[_0xd4b5('0x19')](_0xd4b5('0x13'),auth['isAuthenticated'](),controller[_0xd4b5('0x1c')]);module[_0xd4b5('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index cae85aa..33392cb 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 _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 +var _0x9df5=['rrmemory','beepall','exports','STRING','INTEGER'];(function(_0x3ef5bb,_0x27e3ac){var _0x59d620=function(_0x46cd45){while(--_0x46cd45){_0x3ef5bb['push'](_0x3ef5bb['shift']());}};_0x59d620(++_0x27e3ac);}(_0x9df5,0x165));var _0x59df=function(_0x18292d,_0x551c5a){_0x18292d=_0x18292d-0x0;var _0x329b69=_0x9df5[_0x18292d];return _0x329b69;};'use strict';var Sequelize=require('sequelize');module[_0x59df('0x0')]={'name':{'type':Sequelize[_0x59df('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x59df('0x1')]},'timeout':{'type':Sequelize[_0x59df('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x59df('0x3'),_0x59df('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 179f682..53442e9 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 _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 +var _0x39d0=['%s/%s','createdAt','getTeams','Team','hasOwnProperty','addTeams','online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','field','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','union','compact','value','isEmpty','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','get','MailQueues','UserProfileResource','destroy','error','stack','name','send','index','MailQueue','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','limit','sort','where','pick','merge','options','findAll','rows','catch','show','keys','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','update','params','describe','findOne','UserMailQueue','rawAttributes','order','MailQueueId','filter','findAndCountAll','UserId','agent','mailPause','updatedAt'];(function(_0x426d68,_0x2ceedf){var _0x3ca28b=function(_0x1a9083){while(--_0x1a9083){_0x426d68['push'](_0x426d68['shift']());}};_0x3ca28b(++_0x2ceedf);}(_0x39d0,0x144));var _0x039d=function(_0x415382,_0x2ffb0c){_0x415382=_0x415382-0x0;var _0x13050d=_0x39d0[_0x415382];return _0x13050d;};'use strict';var pdf=require(_0x039d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x039d('0x1'));var jsonpatch=require(_0x039d('0x2'));var rp=require(_0x039d('0x3'));var moment=require(_0x039d('0x4'));var BPromise=require(_0x039d('0x5'));var Mustache=require('mustache');var util=require(_0x039d('0x6'));var path=require(_0x039d('0x7'));var sox=require(_0x039d('0x8'));var csv=require(_0x039d('0x9'));var ejs=require(_0x039d('0xa'));var fs=require('fs');var _=require(_0x039d('0xb'));var squel=require(_0x039d('0xc'));var crypto=require(_0x039d('0xd'));var jsforce=require(_0x039d('0xe'));var deskjs=require(_0x039d('0xf'));var toCsv=require(_0x039d('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x039d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x039d('0x11'));var as=require(_0x039d('0x12'));var hardwareService=require(_0x039d('0x13'));var logger=require(_0x039d('0x14'))('api');var utils=require(_0x039d('0x15'));var config=require(_0x039d('0x16'));var licenseUtil=require(_0x039d('0x17'));var db=require('../../mysqldb')['db'];config[_0x039d('0x18')]=_[_0x039d('0x19')](config[_0x039d('0x18')],{'host':_0x039d('0x1a'),'port':0x18eb});var socket=require(_0x039d('0x1b'))(new Redis(config[_0x039d('0x18')]));require(_0x039d('0x1c'))['register'](socket);function respondWithStatusCode(_0x4dc3a4,_0x2fb61c){_0x2fb61c=_0x2fb61c||0xcc;return function(_0x375c60){if(_0x375c60){return _0x4dc3a4[_0x039d('0x1d')](_0x2fb61c);}return _0x4dc3a4[_0x039d('0x1e')](_0x2fb61c)[_0x039d('0x1f')]();};}function respondWithResult(_0x330966,_0x525c0f){_0x525c0f=_0x525c0f||0xc8;return function(_0x1dc31d){if(_0x1dc31d){return _0x330966[_0x039d('0x1e')](_0x525c0f)[_0x039d('0x20')](_0x1dc31d);}};}function respondWithFilteredResult(_0x4dfc0c,_0x5c0506){return function(_0xaedb24){if(_0xaedb24){var _0xb01eb1=_0xaedb24[_0x039d('0x21')],_0x360233=_0x5c0506[_0x039d('0x22')],_0x4fad10=_0x5c0506['offset']+_0x5c0506['limit'],_0x4ae129;if(_0x4fad10>=_0xb01eb1){_0x4fad10=_0xb01eb1;_0x4ae129=0xc8;}else{_0x4ae129=0xce;}_0x4dfc0c[_0x039d('0x1e')](_0x4ae129);return _0x4dfc0c['set'](_0x039d('0x23'),_0x360233+'-'+_0x4fad10+'/'+_0xb01eb1)[_0x039d('0x20')](_0xaedb24);}return null;};}function patchUpdates(_0x54742c){return function(_0x2e33e1){try{jsonpatch[_0x039d('0x24')](_0x2e33e1,_0x54742c,!![]);}catch(_0x482be8){return BPromise[_0x039d('0x25')](_0x482be8);}return _0x2e33e1[_0x039d('0x26')]();};}function saveUpdates(_0xd5c776,_0x460f4b){return function(_0x2d4221){if(_0x2d4221){return _0x2d4221['update'](_0xd5c776)[_0x039d('0x27')](function(_0x7e230f){return _0x7e230f;});}return null;};}function removeEntity(_0x15b103,_0x4d3983){return function(_0x7fc307){if(_0x7fc307){return _0x7fc307['destroy']()[_0x039d('0x27')](function(){var _0x109b2b=_0x7fc307[_0x039d('0x28')]({'plain':!![]});var _0x4fe5dd=_0x039d('0x29');return db[_0x039d('0x2a')][_0x039d('0x2b')]({'where':{'type':_0x4fe5dd,'resourceId':_0x109b2b['id']}})[_0x039d('0x27')](function(){return _0x7fc307;});})[_0x039d('0x27')](function(){_0x15b103[_0x039d('0x1e')](0xcc)[_0x039d('0x1f')]();});}};}function handleEntityNotFound(_0x170e34,_0xc6b469){return function(_0x9da588){if(!_0x9da588){_0x170e34[_0x039d('0x1d')](0x194);}return _0x9da588;};}function handleError(_0x38ff1e,_0x3d3a40){_0x3d3a40=_0x3d3a40||0x1f4;return function(_0x28b594){logger[_0x039d('0x2c')](_0x28b594[_0x039d('0x2d')]);if(_0x28b594[_0x039d('0x2e')]){delete _0x28b594[_0x039d('0x2e')];}_0x38ff1e[_0x039d('0x1e')](_0x3d3a40)[_0x039d('0x2f')](_0x28b594);};}exports[_0x039d('0x30')]=function(_0xf074d8,_0xf32a01){var _0x2eef2b={},_0x1babe4={},_0x15e999={'count':0x0,'rows':[]};var _0x4e293d=_['map'](db[_0x039d('0x31')]['rawAttributes'],function(_0x54fdf1){return{'name':_0x54fdf1[_0x039d('0x32')],'type':_0x54fdf1[_0x039d('0x33')][_0x039d('0x34')]};});_0x1babe4[_0x039d('0x35')]=_[_0x039d('0x36')](_0x4e293d,_0x039d('0x2e'));_0x1babe4['query']=_['keys'](_0xf074d8[_0x039d('0x37')]);_0x1babe4[_0x039d('0x38')]=_['intersection'](_0x1babe4[_0x039d('0x35')],_0x1babe4[_0x039d('0x37')]);_0x2eef2b['attributes']=_[_0x039d('0x39')](_0x1babe4[_0x039d('0x35')],qs[_0x039d('0x3a')](_0xf074d8[_0x039d('0x37')]['fields']));_0x2eef2b['attributes']=_0x2eef2b[_0x039d('0x3b')][_0x039d('0x3c')]?_0x2eef2b[_0x039d('0x3b')]:_0x1babe4[_0x039d('0x35')];if(!_0xf074d8[_0x039d('0x37')]['hasOwnProperty'](_0x039d('0x3d'))){_0x2eef2b[_0x039d('0x3e')]=qs[_0x039d('0x3e')](_0xf074d8[_0x039d('0x37')][_0x039d('0x3e')]);_0x2eef2b['offset']=qs[_0x039d('0x22')](_0xf074d8[_0x039d('0x37')][_0x039d('0x22')]);}_0x2eef2b['order']=qs[_0x039d('0x3f')](_0xf074d8[_0x039d('0x37')][_0x039d('0x3f')]);_0x2eef2b[_0x039d('0x40')]=qs['filters'](_[_0x039d('0x41')](_0xf074d8[_0x039d('0x37')],_0x1babe4[_0x039d('0x38')]),_0x4e293d);if(_0xf074d8[_0x039d('0x37')]['filter']){_0x2eef2b['where']=_[_0x039d('0x42')](_0x2eef2b[_0x039d('0x40')],{'$or':_[_0x039d('0x36')](_0x4e293d,function(_0x971481){if(_0x971481[_0x039d('0x33')]!=='VIRTUAL'){var _0x3a4d6c={};_0x3a4d6c[_0x971481['name']]={'$like':'%'+_0xf074d8[_0x039d('0x37')]['filter']+'%'};return _0x3a4d6c;}})});}_0x2eef2b=_[_0x039d('0x42')]({},_0x2eef2b,_0xf074d8[_0x039d('0x43')]);var _0x269072={'where':_0x2eef2b[_0x039d('0x40')]};return db['MailQueue'][_0x039d('0x21')](_0x269072)[_0x039d('0x27')](function(_0x48954a){_0x15e999[_0x039d('0x21')]=_0x48954a;if(_0xf074d8[_0x039d('0x37')]['includeAll']){_0x2eef2b['include']=[{'all':!![]}];}return db[_0x039d('0x31')][_0x039d('0x44')](_0x2eef2b);})['then'](function(_0xdba4df){_0x15e999[_0x039d('0x45')]=_0xdba4df;return _0x15e999;})[_0x039d('0x27')](respondWithFilteredResult(_0xf32a01,_0x2eef2b))[_0x039d('0x46')](handleError(_0xf32a01,null));};exports[_0x039d('0x47')]=function(_0x35da4d,_0x18f09e){var _0x470b7c={'raw':!![],'where':{'id':_0x35da4d['params']['id']}},_0x56bd16={};_0x56bd16['model']=_[_0x039d('0x48')](db[_0x039d('0x31')]['rawAttributes']);_0x56bd16[_0x039d('0x37')]=_[_0x039d('0x48')](_0x35da4d[_0x039d('0x37')]);_0x56bd16[_0x039d('0x38')]=_[_0x039d('0x39')](_0x56bd16['model'],_0x56bd16[_0x039d('0x37')]);_0x470b7c[_0x039d('0x3b')]=_[_0x039d('0x39')](_0x56bd16[_0x039d('0x35')],qs['fields'](_0x35da4d[_0x039d('0x37')][_0x039d('0x3a')]));_0x470b7c['attributes']=_0x470b7c['attributes']['length']?_0x470b7c[_0x039d('0x3b')]:_0x56bd16['model'];if(_0x35da4d[_0x039d('0x37')][_0x039d('0x49')]){_0x470b7c[_0x039d('0x4a')]=[{'all':!![]}];}_0x470b7c=_[_0x039d('0x42')]({},_0x470b7c,_0x35da4d['options']);return db[_0x039d('0x31')][_0x039d('0x4b')](_0x470b7c)[_0x039d('0x27')](handleEntityNotFound(_0x18f09e,null))['then'](respondWithResult(_0x18f09e,null))[_0x039d('0x46')](handleError(_0x18f09e,null));};exports[_0x039d('0x4c')]=function(_0xcfb6bc,_0x32e9fa){return db[_0x039d('0x31')][_0x039d('0x4c')](_0xcfb6bc[_0x039d('0x4d')],{})[_0x039d('0x27')](function(_0x2dfb00){var _0x5cdc60=_0xcfb6bc[_0x039d('0x4e')][_0x039d('0x28')]({'plain':!![]});if(!_0x5cdc60)throw new Error(_0x039d('0x4f'));if(_0x5cdc60[_0x039d('0x50')]===_0x039d('0x4e')){var _0x43c3f5=_0x2dfb00[_0x039d('0x28')]({'plain':!![]});var _0x2eab5d=_0x039d('0x29');return db['UserProfileSection'][_0x039d('0x4b')]({'where':{'name':_0x2eab5d,'userProfileId':_0x5cdc60['userProfileId']},'raw':!![]})[_0x039d('0x27')](function(_0x4b41c6){if(_0x4b41c6&&_0x4b41c6[_0x039d('0x51')]===0x0){return db[_0x039d('0x2a')]['create']({'name':_0x43c3f5['name'],'resourceId':_0x43c3f5['id'],'type':_0x4b41c6[_0x039d('0x2e')],'sectionId':_0x4b41c6['id']},{})[_0x039d('0x27')](function(){return _0x2dfb00;});}else{return _0x2dfb00;}})[_0x039d('0x46')](function(_0x74f510){logger[_0x039d('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x74f510);throw _0x74f510;});}return _0x2dfb00;})['then'](respondWithResult(_0x32e9fa,0xc9))['catch'](handleError(_0x32e9fa,null));};exports[_0x039d('0x52')]=function(_0x56834c,_0x45cd5b){if(_0x56834c['body']['id']){delete _0x56834c[_0x039d('0x4d')]['id'];}return db[_0x039d('0x31')]['find']({'where':{'id':_0x56834c[_0x039d('0x53')]['id']}})[_0x039d('0x27')](handleEntityNotFound(_0x45cd5b,null))['then'](saveUpdates(_0x56834c[_0x039d('0x4d')],null))[_0x039d('0x27')](respondWithResult(_0x45cd5b,null))[_0x039d('0x46')](handleError(_0x45cd5b,null));};exports[_0x039d('0x2b')]=function(_0x21eaea,_0x34db4d){return db[_0x039d('0x31')][_0x039d('0x4b')]({'where':{'id':_0x21eaea[_0x039d('0x53')]['id']}})[_0x039d('0x27')](handleEntityNotFound(_0x34db4d,null))[_0x039d('0x27')](removeEntity(_0x34db4d,null))[_0x039d('0x46')](handleError(_0x34db4d,null));};exports['describe']=function(_0x2998c9,_0x34f6c7){return db[_0x039d('0x31')][_0x039d('0x54')]()[_0x039d('0x27')](respondWithResult(_0x34f6c7,null))['catch'](handleError(_0x34f6c7,null));};exports['getMembers']=function(_0x4774e9,_0x552bd1,_0x4f4430){var _0x42bbf6={'raw':!![],'where':{}},_0x2d49c4={},_0x5a9223;return db[_0x039d('0x31')][_0x039d('0x55')]({'where':{'id':_0x4774e9['params']['id']}})[_0x039d('0x27')](handleEntityNotFound(_0x552bd1,null))[_0x039d('0x27')](function(_0x4139d5){if(_0x4139d5){_0x5a9223=_0x4139d5['get']({'plain':!![]});_0x2d49c4[_0x039d('0x35')]=_[_0x039d('0x48')](db[_0x039d('0x56')][_0x039d('0x57')]);_0x2d49c4['query']=_['keys'](_0x4774e9[_0x039d('0x37')]);_0x2d49c4[_0x039d('0x38')]=_[_0x039d('0x39')](_0x2d49c4[_0x039d('0x35')],_0x2d49c4[_0x039d('0x37')]);_0x42bbf6[_0x039d('0x3b')]=_['intersection'](_0x2d49c4[_0x039d('0x35')],qs[_0x039d('0x3a')](_0x4774e9[_0x039d('0x37')]['fields']));_0x42bbf6[_0x039d('0x3b')]=_0x42bbf6[_0x039d('0x3b')][_0x039d('0x3c')]?_0x42bbf6[_0x039d('0x3b')]:_0x2d49c4[_0x039d('0x35')];if(!_0x4774e9[_0x039d('0x37')]['hasOwnProperty'](_0x039d('0x3d'))){_0x42bbf6['limit']=qs['limit'](_0x4774e9[_0x039d('0x37')]['limit']);_0x42bbf6[_0x039d('0x22')]=qs[_0x039d('0x22')](_0x4774e9['query'][_0x039d('0x22')]);}_0x42bbf6[_0x039d('0x58')]=qs['sort'](_0x4774e9[_0x039d('0x37')]['sort']);_0x42bbf6[_0x039d('0x40')]=qs[_0x039d('0x38')](_[_0x039d('0x41')](_0x4774e9[_0x039d('0x37')],_0x2d49c4[_0x039d('0x38')]));_0x42bbf6[_0x039d('0x40')][_0x039d('0x59')]=_0x4139d5['id'];if(_0x4774e9[_0x039d('0x37')][_0x039d('0x5a')]){_0x42bbf6[_0x039d('0x40')]=_['merge'](_0x42bbf6[_0x039d('0x40')],{'$or':_[_0x039d('0x36')](_0x42bbf6['attributes'],function(_0x726115){var _0x159c8b={};_0x159c8b[_0x726115]={'$like':'%'+_0x4774e9[_0x039d('0x37')][_0x039d('0x5a')]+'%'};return _0x159c8b;})});}_0x42bbf6=_[_0x039d('0x42')]({},_0x42bbf6,_0x4774e9[_0x039d('0x43')]);return db[_0x039d('0x56')][_0x039d('0x44')](_0x42bbf6);}})[_0x039d('0x27')](function(_0x44b76c){if(_0x44b76c){return db['User'][_0x039d('0x5b')]({'where':{'id':_[_0x039d('0x36')](_0x44b76c,_0x039d('0x5c')),'role':_0x039d('0x5d')},'attributes':['id',_0x039d('0x2e'),_0x039d('0x5e'),_0x039d('0x5f'),'createdAt']});}})[_0x039d('0x27')](function(_0x54895e){if(_0x54895e){return{'count':_0x54895e[_0x039d('0x21')],'rows':_['map'](_0x54895e['rows'],function(_0x46c92e){return{'membername':_0x46c92e[_0x039d('0x2e')],'UserId':_0x46c92e['id'],'queue_name':_0x5a9223[_0x039d('0x2e')],'MailQueueId':_0x5a9223['id'],'interface':util['format'](_0x039d('0x60'),'SIP',_0x46c92e['name']),'penalty':0x0,'paused':_0x46c92e[_0x039d('0x5e')],'createdAt':_0x46c92e[_0x039d('0x61')],'updatedAt':_0x46c92e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x039d('0x27')](respondWithFilteredResult(_0x552bd1,_0x42bbf6))['catch'](handleError(_0x552bd1,null));};exports[_0x039d('0x62')]=function(_0xcb22dc,_0x5e24ec,_0x2929ad){var _0x7ca845={};var _0x4a7718={};var _0x357202;var _0x20fad2;return db['MailQueue'][_0x039d('0x55')]({'where':{'id':_0xcb22dc[_0x039d('0x53')]['id']}})[_0x039d('0x27')](handleEntityNotFound(_0x5e24ec,null))['then'](function(_0x5a462e){if(_0x5a462e){_0x357202=_0x5a462e;_0x4a7718[_0x039d('0x35')]=_[_0x039d('0x48')](db[_0x039d('0x63')][_0x039d('0x57')]);_0x4a7718[_0x039d('0x37')]=_[_0x039d('0x48')](_0xcb22dc[_0x039d('0x37')]);_0x4a7718[_0x039d('0x38')]=_[_0x039d('0x39')](_0x4a7718[_0x039d('0x35')],_0x4a7718['query']);_0x7ca845[_0x039d('0x3b')]=_[_0x039d('0x39')](_0x4a7718['model'],qs['fields'](_0xcb22dc[_0x039d('0x37')][_0x039d('0x3a')]));_0x7ca845[_0x039d('0x3b')]=_0x7ca845[_0x039d('0x3b')][_0x039d('0x3c')]?_0x7ca845[_0x039d('0x3b')]:_0x4a7718[_0x039d('0x35')];_0x7ca845[_0x039d('0x58')]=qs[_0x039d('0x3f')](_0xcb22dc[_0x039d('0x37')][_0x039d('0x3f')]);_0x7ca845[_0x039d('0x40')]=qs[_0x039d('0x38')](_['pick'](_0xcb22dc['query'],_0x4a7718[_0x039d('0x38')]));if(_0xcb22dc[_0x039d('0x37')]['filter']){_0x7ca845[_0x039d('0x40')]=_['merge'](_0x7ca845[_0x039d('0x40')],{'$or':_[_0x039d('0x36')](_0x7ca845[_0x039d('0x3b')],function(_0x5b52a2){var _0x4bbefe={};_0x4bbefe[_0x5b52a2]={'$like':'%'+_0xcb22dc[_0x039d('0x37')]['filter']+'%'};return _0x4bbefe;})});}_0x7ca845=_[_0x039d('0x42')]({},_0x7ca845,_0xcb22dc['options']);return _0x357202[_0x039d('0x62')](_0x7ca845);}})[_0x039d('0x27')](function(_0x4a7bc2){if(_0x4a7bc2){_0x20fad2=_0x4a7bc2[_0x039d('0x3c')];if(!_0xcb22dc[_0x039d('0x37')][_0x039d('0x64')](_0x039d('0x3d'))){_0x7ca845['limit']=qs[_0x039d('0x3e')](_0xcb22dc[_0x039d('0x37')][_0x039d('0x3e')]);_0x7ca845[_0x039d('0x22')]=qs[_0x039d('0x22')](_0xcb22dc[_0x039d('0x37')][_0x039d('0x22')]);}return _0x357202[_0x039d('0x62')](_0x7ca845);}})[_0x039d('0x27')](function(_0x25fb12){if(_0x25fb12){return _0x25fb12?{'count':_0x20fad2,'rows':_0x25fb12}:null;}})[_0x039d('0x27')](respondWithResult(_0x5e24ec,null))['catch'](handleError(_0x5e24ec,null));};exports[_0x039d('0x65')]=function(_0x468b8b,_0x6dbf3a,_0x288c52){var _0x8e2a96=_0x468b8b[_0x039d('0x4d')]['ids'];return db[_0x039d('0x63')]['findAll']({'where':{'id':_0x8e2a96},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x039d('0x2e'),_0x039d('0x66'),_0x039d('0x67'),_0x039d('0x68')],'raw':!![]}]})[_0x039d('0x27')](function(_0x2aed6e){if(_0x2aed6e){var _0x45c55f=_['flatMap'](_0x2aed6e,function(_0x1b7f3a){var _0x1f97ba=_0x1b7f3a['get']({'plain':!![]});return _0x1f97ba[_0x039d('0x69')];});return db[_0x039d('0x31')][_0x039d('0x4b')]({'where':{'id':_0x468b8b['params']['id']}})['then'](function(_0x152a91){return db[_0x039d('0x6a')][_0x039d('0x6b')](function(_0x513f9b){return _0x152a91[_0x039d('0x65')](_0x8e2a96,{'transaction':_0x513f9b})[_0x039d('0x27')](function(){return BPromise[_0x039d('0x6c')](_0x45c55f,function(_0x4e0f4d){return db[_0x039d('0x56')][_0x039d('0x6d')]({'where':{'UserId':_0x4e0f4d['id'],'MailQueueId':_0x468b8b[_0x039d('0x53')]['id']},'transaction':_0x513f9b});});})[_0x039d('0x27')](function(){_0x45c55f[_0x039d('0x6e')](function(_0x300f62){socket[_0x039d('0x6f')](_0x039d('0x70'),{'UserId':_0x300f62['id'],'MailQueueId':_0x152a91['id']});});});});});}})[_0x039d('0x27')](respondWithStatusCode(_0x6dbf3a,null))[_0x039d('0x46')](handleError(_0x6dbf3a,null));};exports[_0x039d('0x71')]=function(_0x43e742,_0x38d067,_0x2d7e97){return db[_0x039d('0x63')][_0x039d('0x44')]({'where':{'id':_0x43e742[_0x039d('0x37')][_0x039d('0x72')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x039d('0x69'),'attributes':['id'],'raw':!![]}]})[_0x039d('0x27')](handleEntityNotFound(_0x38d067,null))[_0x039d('0x27')](function(_0x56939f){var _0x21c508=_[_0x039d('0x36')](_0x56939f,'id');var _0xcfcf5b=[];var _0x52666f=[];var _0x107679=squel[_0x039d('0x73')]();_0x107679[_0x039d('0x74')]('tq.TeamId')[_0x039d('0x75')](_0x039d('0x76'),'tq')['join'](_0x039d('0x77'),'ut',_0x039d('0x78'))[_0x039d('0x40')](_0x039d('0x79'),_0x43e742[_0x039d('0x53')]['id']);for(var _0xa3095b=0x0;_0xa3095b<_0x56939f[_0x039d('0x3c')];_0xa3095b+=0x1){let _0x55f43d=_0x56939f[_0xa3095b];for(var _0x22d415=0x0;_0x22d415<_0x55f43d['Agents'][_0x039d('0x3c')];_0x22d415+=0x1){let _0x330ea2=_0x55f43d['Agents'][_0x22d415];var _0xb7f1c2=_0x107679['clone']();_0xb7f1c2[_0x039d('0x40')](_0x039d('0x7a'),_0x330ea2['id']);_0x52666f[_0x039d('0x7b')](db['sequelize'][_0x039d('0x37')](_0xb7f1c2[_0x039d('0x7c')](),{'type':db['sequelize'][_0x039d('0x7d')]['SELECT']})[_0x039d('0x27')](function(_0x280477){if(_0x280477[_0x039d('0x3c')]===0x1){return _0x330ea2['id'];}else{var _0xedb59a=_['every'](_[_0x039d('0x36')](_0x280477,_0x039d('0x7e')),function(_0xcfc98){return _[_0x039d('0x7f')](_0x21c508,_0xcfc98);});if(_0xedb59a){return _0x330ea2['id'];}}}));}}return BPromise[_0x039d('0x80')](_0x52666f)[_0x039d('0x27')](function(_0x4e7544){_0xcfcf5b=_(_0xcfcf5b)[_0x039d('0x81')](_0x4e7544)[_0x039d('0x82')]()[_0x039d('0x83')]();return db[_0x039d('0x31')][_0x039d('0x4b')]({'where':{'id':_0x43e742[_0x039d('0x53')]['id']}})[_0x039d('0x27')](function(_0x82281e){return db[_0x039d('0x6a')][_0x039d('0x6b')](function(_0x183d13){return _0x82281e[_0x039d('0x71')](_0x43e742[_0x039d('0x37')][_0x039d('0x72')],{'transaction':_0x183d13})[_0x039d('0x27')](function(){if(!_[_0x039d('0x84')](_0xcfcf5b)){return _0x82281e['removeAgents'](_0xcfcf5b,{'transaction':_0x183d13});}})[_0x039d('0x27')](function(){_0xcfcf5b['forEach'](function(_0x1e4942){socket[_0x039d('0x6f')](_0x039d('0x85'),{'UserId':_0x1e4942,'MailQueueId':_0x82281e['id']});});});});});});})[_0x039d('0x27')](respondWithStatusCode(_0x38d067,null))[_0x039d('0x46')](handleError(_0x38d067,null));};exports[_0x039d('0x86')]=function(_0x5f2c68,_0x1debc3,_0x3208ad){return db[_0x039d('0x31')][_0x039d('0x4b')]({'where':{'id':_0x5f2c68[_0x039d('0x53')]['id']}})[_0x039d('0x27')](handleEntityNotFound(_0x1debc3,null))[_0x039d('0x27')](function(_0x1afcb9){if(_0x1afcb9){return _0x1afcb9[_0x039d('0x86')](_0x5f2c68[_0x039d('0x4d')][_0x039d('0x72')],_[_0x039d('0x87')](_0x5f2c68['body'],[_0x039d('0x72'),'id'])||{})[_0x039d('0x88')](function(_0x527b91){for(var _0x3f8cc3=0x0;_0x3f8cc3<_0x5f2c68['body']['ids'][_0x039d('0x3c')];_0x3f8cc3+=0x1){socket[_0x039d('0x6f')](_0x039d('0x70'),{'UserId':_0x5f2c68[_0x039d('0x4d')][_0x039d('0x72')][_0x3f8cc3],'MailQueueId':_0x5f2c68[_0x039d('0x53')]['id']});}return _0x527b91;});}})[_0x039d('0x27')](respondWithResult(_0x1debc3,null))[_0x039d('0x46')](handleError(_0x1debc3,null));};exports[_0x039d('0x89')]=function(_0x11c6ff,_0x4888a2,_0x3dc2d5){return db[_0x039d('0x31')][_0x039d('0x4b')]({'where':{'id':_0x11c6ff[_0x039d('0x53')]['id']}})[_0x039d('0x27')](handleEntityNotFound(_0x4888a2,null))[_0x039d('0x27')](function(_0x401b43){if(_0x401b43){return _0x401b43[_0x039d('0x89')](_0x11c6ff[_0x039d('0x37')][_0x039d('0x72')])[_0x039d('0x27')](function(){if(_[_0x039d('0x8a')](_0x11c6ff[_0x039d('0x37')][_0x039d('0x72')])){for(var _0x1adebe=0x0;_0x1adebe<_0x11c6ff[_0x039d('0x37')]['ids']['length'];_0x1adebe+=0x1){socket[_0x039d('0x6f')](_0x039d('0x85'),{'UserId':Number(_0x11c6ff[_0x039d('0x37')][_0x039d('0x72')][_0x1adebe]),'MailQueueId':Number(_0x11c6ff[_0x039d('0x53')]['id'])});}}else{socket[_0x039d('0x6f')](_0x039d('0x85'),{'UserId':Number(_0x11c6ff[_0x039d('0x37')][_0x039d('0x72')]),'MailQueueId':Number(_0x11c6ff[_0x039d('0x53')]['id'])});}});}})[_0x039d('0x27')](respondWithStatusCode(_0x4888a2,null))[_0x039d('0x46')](handleError(_0x4888a2,null));};exports[_0x039d('0x8b')]=function(_0x1f2266,_0x225506,_0xd379b7){var _0x7aa0a9={};var _0x270846={};var _0x500891;var _0xa95456;return db[_0x039d('0x31')]['findOne']({'where':{'id':_0x1f2266[_0x039d('0x53')]['id']}})['then'](handleEntityNotFound(_0x225506,null))[_0x039d('0x27')](function(_0x43a8a0){if(_0x43a8a0){_0x500891=_0x43a8a0;_0x270846[_0x039d('0x35')]=_[_0x039d('0x48')](db['User']['rawAttributes']);_0x270846[_0x039d('0x37')]=_[_0x039d('0x48')](_0x1f2266['query']);_0x270846[_0x039d('0x38')]=_[_0x039d('0x39')](_0x270846[_0x039d('0x35')],_0x270846[_0x039d('0x37')]);_0x7aa0a9[_0x039d('0x3b')]=_[_0x039d('0x39')](_0x270846['model'],qs[_0x039d('0x3a')](_0x1f2266[_0x039d('0x37')][_0x039d('0x3a')]));_0x7aa0a9[_0x039d('0x3b')]=_0x7aa0a9[_0x039d('0x3b')][_0x039d('0x3c')]?_0x7aa0a9[_0x039d('0x3b')]:_0x270846['model'];_0x7aa0a9['order']=qs[_0x039d('0x3f')](_0x1f2266[_0x039d('0x37')][_0x039d('0x3f')]);_0x7aa0a9['where']=qs[_0x039d('0x38')](_[_0x039d('0x41')](_0x1f2266[_0x039d('0x37')],_0x270846[_0x039d('0x38')]));if(_0x1f2266[_0x039d('0x37')][_0x039d('0x5a')]){_0x7aa0a9['where']=_[_0x039d('0x42')](_0x7aa0a9['where'],{'$or':_['map'](_0x7aa0a9['attributes'],function(_0x13fed4){var _0x3ce269={};_0x3ce269[_0x13fed4]={'$like':'%'+_0x1f2266[_0x039d('0x37')]['filter']+'%'};return _0x3ce269;})});}_0x7aa0a9=_[_0x039d('0x42')]({},_0x7aa0a9,_0x1f2266[_0x039d('0x43')]);return _0x500891[_0x039d('0x8b')](_0x7aa0a9);}})['then'](function(_0x5321ec){if(_0x5321ec){_0xa95456=_0x5321ec[_0x039d('0x3c')];if(!_0x1f2266[_0x039d('0x37')][_0x039d('0x64')](_0x039d('0x3d'))){_0x7aa0a9[_0x039d('0x3e')]=qs[_0x039d('0x3e')](_0x1f2266[_0x039d('0x37')][_0x039d('0x3e')]);_0x7aa0a9[_0x039d('0x22')]=qs[_0x039d('0x22')](_0x1f2266[_0x039d('0x37')][_0x039d('0x22')]);}return _0x500891['getAgents'](_0x7aa0a9);}})[_0x039d('0x27')](function(_0x5510a6){if(_0x5510a6){return _0x5510a6?{'count':_0xa95456,'rows':_0x5510a6}:null;}})[_0x039d('0x27')](respondWithResult(_0x225506,null))['catch'](handleError(_0x225506,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 957849c..e6a622c 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 _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 +var _0xcce4=['hook','exports','events','MailQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x58319a,_0x145060){var _0x4cf654=function(_0x314238){while(--_0x314238){_0x58319a['push'](_0x58319a['shift']());}};_0x4cf654(++_0x145060);}(_0xcce4,0x65));var _0x4cce=function(_0x561771,_0x554760){_0x561771=_0x561771-0x0;var _0x54d16e=_0xcce4[_0x561771];return _0x54d16e;};'use strict';var EventEmitter=require(_0x4cce('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x4cce('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x4cce('0x2')](0x0);var events={'afterCreate':_0x4cce('0x3'),'afterUpdate':_0x4cce('0x4'),'afterDestroy':'remove'};function emitEvent(_0x21724f){return function(_0x3f8e2a,_0x49d99c,_0x4b1de3){MailQueueEvents[_0x4cce('0x5')](_0x21724f+':'+_0x3f8e2a['id'],_0x3f8e2a);MailQueueEvents[_0x4cce('0x5')](_0x21724f,_0x3f8e2a);_0x4b1de3(null);};}for(var e in events){if(events[_0x4cce('0x6')](e)){var event=events[e];MailQueue[_0x4cce('0x7')](e,emitEvent(event));}}module[_0x4cce('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index f397d6e..f06d3b4 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 _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 +var _0xe2da=['util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','mail_queues','lodash'];(function(_0x4354b9,_0xc27dd7){var _0x2a63a6=function(_0x55ba89){while(--_0x55ba89){_0x4354b9['push'](_0x4354b9['shift']());}};_0x2a63a6(++_0xc27dd7);}(_0xe2da,0x196));var _0xae2d=function(_0x5be0e1,_0x45ba15){_0x5be0e1=_0x5be0e1-0x0;var _0x1dabb6=_0xe2da[_0x5be0e1];return _0x1dabb6;};'use strict';var _=require(_0xae2d('0x0'));var util=require(_0xae2d('0x1'));var logger=require('../../config/logger')(_0xae2d('0x2'));var moment=require(_0xae2d('0x3'));var BPromise=require('bluebird');var rp=require(_0xae2d('0x4'));var fs=require('fs');var path=require(_0xae2d('0x5'));var rimraf=require(_0xae2d('0x6'));var config=require(_0xae2d('0x7'));var attributes=require('./mailQueue.attributes');module[_0xae2d('0x8')]=function(_0x14b534,_0x453c08){return _0x14b534[_0xae2d('0x9')]('MailQueue',attributes,{'tableName':_0xae2d('0xa'),'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 e2706dd..8581df2 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 _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 +var _0x647d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','MailQueue','findAll','options','where','limit','include','map','model','attributes','stringify','find','raw','ShowMailQueue','lodash','util','moment','randomstring'];(function(_0x45685b,_0x367382){var _0x4c7b06=function(_0x3d4231){while(--_0x3d4231){_0x45685b['push'](_0x45685b['shift']());}};_0x4c7b06(++_0x367382);}(_0x647d,0xec));var _0xd647=function(_0x204ebb,_0x1d696a){_0x204ebb=_0x204ebb-0x0;var _0x2c2221=_0x647d[_0x204ebb];return _0x2c2221;};'use strict';var _=require(_0xd647('0x0'));var util=require(_0xd647('0x1'));var moment=require(_0xd647('0x2'));var BPromise=require('bluebird');var rs=require(_0xd647('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd647('0x4'))['db'];var utils=require(_0xd647('0x5'));var logger=require(_0xd647('0x6'))(_0xd647('0x7'));var config=require(_0xd647('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xd647('0x9')]=_[_0xd647('0xa')](config[_0xd647('0x9')],{'host':_0xd647('0xb'),'port':0x18eb});var socket=require(_0xd647('0xc'))(new Redis(config[_0xd647('0x9')]));require('./mailQueue.socket')[_0xd647('0xd')](socket);function respondWithRpcPromise(_0x30b388,_0xc9ee9e,_0xc486e8){return new BPromise(function(_0x186a6c,_0x241b6e){return client[_0xd647('0xe')](_0x30b388,_0xc486e8)[_0xd647('0xf')](function(_0xc1b142){logger[_0xd647('0x10')]('MailQueue,\x20%s,\x20%s',_0xc9ee9e,_0xd647('0x11'));logger[_0xd647('0x12')](_0xd647('0x13'),_0xc9ee9e,_0xd647('0x11'),JSON['stringify'](_0xc1b142));if(_0xc1b142[_0xd647('0x14')]){if(_0xc1b142['error'][_0xd647('0x15')]===0x1f4){logger[_0xd647('0x14')](_0xd647('0x16'),_0xc9ee9e,_0xc1b142['error'][_0xd647('0x17')]);return _0x241b6e(_0xc1b142[_0xd647('0x14')][_0xd647('0x17')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0xc9ee9e,_0xc1b142[_0xd647('0x14')][_0xd647('0x17')]);return _0x186a6c(_0xc1b142[_0xd647('0x14')]['message']);}else{logger[_0xd647('0x10')](_0xd647('0x16'),_0xc9ee9e,_0xd647('0x11'));_0x186a6c(_0xc1b142[_0xd647('0x18')]['message']);}})[_0xd647('0x19')](function(_0xd1b6b4){logger['error'](_0xd647('0x16'),_0xc9ee9e,_0xd1b6b4);_0x241b6e(_0xd1b6b4);});});}exports[_0xd647('0x1a')]=function(_0x1c8d3d){var _0x3d4be5=this;return new Promise(function(_0x32b473,_0x3e2773){return db[_0xd647('0x1b')][_0xd647('0x1c')]({'raw':_0x1c8d3d['options']?_0x1c8d3d[_0xd647('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1c8d3d[_0xd647('0x1d')]?_0x1c8d3d[_0xd647('0x1d')][_0xd647('0x1e')]||null:null,'attributes':_0x1c8d3d[_0xd647('0x1d')]?_0x1c8d3d[_0xd647('0x1d')]['attributes']||null:null,'limit':_0x1c8d3d[_0xd647('0x1d')]?_0x1c8d3d['options'][_0xd647('0x1f')]||null:null,'include':_0x1c8d3d[_0xd647('0x1d')]?_0x1c8d3d[_0xd647('0x1d')][_0xd647('0x20')]?_[_0xd647('0x21')](_0x1c8d3d[_0xd647('0x1d')][_0xd647('0x20')],function(_0x4e2527){return{'model':db[_0x4e2527[_0xd647('0x22')]],'as':_0x4e2527['as'],'attributes':_0x4e2527[_0xd647('0x23')],'include':_0x4e2527['include']?_['map'](_0x4e2527[_0xd647('0x20')],function(_0x4f45fe){return{'model':db[_0x4f45fe['model']],'as':_0x4f45fe['as'],'attributes':_0x4f45fe[_0xd647('0x23')],'include':_0x4f45fe[_0xd647('0x20')]?_[_0xd647('0x21')](_0x4f45fe['include'],function(_0x1dbe1d){return{'model':db[_0x1dbe1d[_0xd647('0x22')]],'as':_0x1dbe1d['as'],'attributes':_0x1dbe1d[_0xd647('0x23')]};}):[]};}):[]};}):[]:[]})[_0xd647('0xf')](function(_0x55c713){logger['info'](_0xd647('0x1a'),_0x1c8d3d);logger[_0xd647('0x12')](_0xd647('0x1a'),_0x1c8d3d,JSON[_0xd647('0x24')](_0x55c713));_0x32b473(_0x55c713);})['catch'](function(_0x2ad9f2){logger[_0xd647('0x14')](_0xd647('0x1a'),_0x2ad9f2[_0xd647('0x17')],_0x1c8d3d);_0x3e2773(_0x3d4be5[_0xd647('0x14')](0x1f4,_0x2ad9f2['message']));});});};exports['ShowMailQueue']=function(_0x1dfd0f){var _0x316a1e=this;return new Promise(function(_0xa84dc0,_0x34bbd9){return db['MailQueue'][_0xd647('0x25')]({'raw':_0x1dfd0f[_0xd647('0x1d')]?_0x1dfd0f[_0xd647('0x1d')][_0xd647('0x26')]===undefined?!![]:![]:!![],'where':_0x1dfd0f[_0xd647('0x1d')]?_0x1dfd0f['options']['where']||null:null,'attributes':_0x1dfd0f['options']?_0x1dfd0f['options'][_0xd647('0x23')]||null:null,'include':_0x1dfd0f[_0xd647('0x1d')]?_0x1dfd0f['options'][_0xd647('0x20')]?_[_0xd647('0x21')](_0x1dfd0f[_0xd647('0x1d')][_0xd647('0x20')],function(_0x5a5a47){return{'model':db[_0x5a5a47['model']],'as':_0x5a5a47['as'],'attributes':_0x5a5a47[_0xd647('0x23')],'include':_0x5a5a47[_0xd647('0x20')]?_[_0xd647('0x21')](_0x5a5a47['include'],function(_0x15aac9){return{'model':db[_0x15aac9[_0xd647('0x22')]],'as':_0x15aac9['as'],'attributes':_0x15aac9[_0xd647('0x23')],'include':_0x15aac9[_0xd647('0x20')]?_[_0xd647('0x21')](_0x15aac9[_0xd647('0x20')],function(_0x1a0f54){return{'model':db[_0x1a0f54[_0xd647('0x22')]],'as':_0x1a0f54['as'],'attributes':_0x1a0f54[_0xd647('0x23')]};}):[]};}):[]};}):[]:[]})[_0xd647('0xf')](function(_0x4fa4c2){logger[_0xd647('0x10')](_0xd647('0x27'),_0x1dfd0f);logger[_0xd647('0x12')](_0xd647('0x27'),_0x1dfd0f,JSON[_0xd647('0x24')](_0x4fa4c2));_0xa84dc0(_0x4fa4c2);})[_0xd647('0x19')](function(_0xba0df7){logger[_0xd647('0x14')](_0xd647('0x27'),_0xba0df7[_0xd647('0x17')],_0x1dfd0f);_0x34bbd9(_0x316a1e['error'](0x1f4,_0xba0df7[_0xd647('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index df43b5d..a75f323 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 _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 +var _0xdcf8=['./mailQueue.events','save','remove','emit','removeListener','register','length','mailQueue:'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xdcf8,0x1c8));var _0x8dcf=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xdcf8[_0x502c7d];return _0x30b7ed;};'use strict';var MailQueueEvents=require(_0x8dcf('0x0'));var events=[_0x8dcf('0x1'),_0x8dcf('0x2'),'update'];function createListener(_0x355b75,_0x5297ef){return function(_0x1f86a7){_0x5297ef[_0x8dcf('0x3')](_0x355b75,_0x1f86a7);};}function removeListener(_0x4d7edd,_0x42f86a){return function(){MailQueueEvents[_0x8dcf('0x4')](_0x4d7edd,_0x42f86a);};}exports[_0x8dcf('0x5')]=function(_0x211535){for(var _0x41e5a3=0x0,_0x267932=events[_0x8dcf('0x6')];_0x41e5a3<_0x267932;_0x41e5a3++){var _0x153eed=events[_0x41e5a3];var _0x1a207e=createListener(_0x8dcf('0x7')+_0x153eed,_0x211535);MailQueueEvents['on'](_0x153eed,_0x1a207e);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index f78d55e..d06f090 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 _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 +var _0x4f79=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','put'];(function(_0x4ac61e,_0x54e95a){var _0xe926a5=function(_0x310bb){while(--_0x310bb){_0x4ac61e['push'](_0x4ac61e['shift']());}};_0xe926a5(++_0x54e95a);}(_0x4f79,0x156));var _0x94f7=function(_0x264711,_0x131665){_0x264711=_0x264711-0x0;var _0x56ffb9=_0x4f79[_0x264711];return _0x56ffb9;};'use strict';var multer=require(_0x94f7('0x0'));var util=require(_0x94f7('0x1'));var path=require(_0x94f7('0x2'));var timeout=require(_0x94f7('0x3'));var express=require(_0x94f7('0x4'));var router=express[_0x94f7('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x94f7('0x6'));var config=require(_0x94f7('0x7'));var controller=require(_0x94f7('0x8'));router['get']('/',auth[_0x94f7('0x9')](),controller['index']);router[_0x94f7('0xa')](_0x94f7('0xb'),auth[_0x94f7('0x9')](),controller[_0x94f7('0xc')]);router['get'](_0x94f7('0xd'),auth[_0x94f7('0x9')](),controller['show']);router['post']('/',auth[_0x94f7('0x9')](),controller['create']);router[_0x94f7('0xe')]('/:id',auth[_0x94f7('0x9')](),controller['update']);router['delete'](_0x94f7('0xd'),auth[_0x94f7('0x9')](),controller[_0x94f7('0xf')]);module[_0x94f7('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index c8be151..06b5a03 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 _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 +var _0x8a5e=['STRING','DATE','exports'];(function(_0x28d225,_0x43be18){var _0x1f79e1=function(_0x362c23){while(--_0x362c23){_0x28d225['push'](_0x28d225['shift']());}};_0x1f79e1(++_0x43be18);}(_0x8a5e,0x74));var _0xe8a5=function(_0x56ff5e,_0x1189d7){_0x56ff5e=_0x56ff5e-0x0;var _0x373fa9=_0x8a5e[_0x56ff5e];return _0x373fa9;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xe8a5('0x0')]={'uniqueid':{'type':Sequelize[_0xe8a5('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xe8a5('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xe8a5('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe8a5('0x2')]},'reason':{'type':Sequelize[_0xe8a5('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index fb5ebba..a29c167 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 _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 +var _0x9a05=['query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','catch','describe','html-pdf','eml-format','zip-dir','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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','key','model','map','filters','intersection'];(function(_0x4bbe00,_0x1d2f14){var _0x3999d2=function(_0x4390fa){while(--_0x4390fa){_0x4bbe00['push'](_0x4bbe00['shift']());}};_0x3999d2(++_0x1d2f14);}(_0x9a05,0x1a3));var _0x59a0=function(_0xc04716,_0x30cfd6){_0xc04716=_0xc04716-0x0;var _0x7ee9da=_0x9a05[_0xc04716];return _0x7ee9da;};'use strict';var pdf=require(_0x59a0('0x0'));var emlformat=require(_0x59a0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x59a0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x59a0('0x3'));var moment=require(_0x59a0('0x4'));var BPromise=require(_0x59a0('0x5'));var Mustache=require(_0x59a0('0x6'));var util=require(_0x59a0('0x7'));var path=require('path');var sox=require(_0x59a0('0x8'));var csv=require(_0x59a0('0x9'));var ejs=require(_0x59a0('0xa'));var fs=require('fs');var _=require(_0x59a0('0xb'));var squel=require(_0x59a0('0xc'));var crypto=require(_0x59a0('0xd'));var jsforce=require(_0x59a0('0xe'));var deskjs=require(_0x59a0('0xf'));var toCsv=require(_0x59a0('0x9'));var querystring=require(_0x59a0('0x10'));var Papa=require(_0x59a0('0x11'));var Redis=require(_0x59a0('0x12'));var authService=require(_0x59a0('0x13'));var qs=require(_0x59a0('0x14'));var as=require(_0x59a0('0x15'));var hardwareService=require(_0x59a0('0x16'));var logger=require(_0x59a0('0x17'))(_0x59a0('0x18'));var utils=require('../../config/utils');var config=require(_0x59a0('0x19'));var licenseUtil=require(_0x59a0('0x1a'));var db=require(_0x59a0('0x1b'))['db'];function respondWithStatusCode(_0x258b10,_0x319b90){_0x319b90=_0x319b90||0xcc;return function(_0xfc8a17){if(_0xfc8a17){return _0x258b10[_0x59a0('0x1c')](_0x319b90);}return _0x258b10[_0x59a0('0x1d')](_0x319b90)[_0x59a0('0x1e')]();};}function respondWithResult(_0x11d28f,_0x136155){_0x136155=_0x136155||0xc8;return function(_0x4d35ce){if(_0x4d35ce){return _0x11d28f[_0x59a0('0x1d')](_0x136155)['json'](_0x4d35ce);}};}function respondWithFilteredResult(_0x144333,_0x5e36ab){return function(_0x21d384){if(_0x21d384){var _0x45fa78=_0x21d384[_0x59a0('0x1f')],_0x498a6b=_0x5e36ab[_0x59a0('0x20')],_0x58125f=_0x5e36ab[_0x59a0('0x20')]+_0x5e36ab[_0x59a0('0x21')],_0x8a1f87;if(_0x58125f>=_0x45fa78){_0x58125f=_0x45fa78;_0x8a1f87=0xc8;}else{_0x8a1f87=0xce;}_0x144333[_0x59a0('0x1d')](_0x8a1f87);return _0x144333['set'](_0x59a0('0x22'),_0x498a6b+'-'+_0x58125f+'/'+_0x45fa78)[_0x59a0('0x23')](_0x21d384);}return null;};}function patchUpdates(_0x26a763){return function(_0x47b6b6){try{jsonpatch['apply'](_0x47b6b6,_0x26a763,!![]);}catch(_0x56b6ea){return BPromise[_0x59a0('0x24')](_0x56b6ea);}return _0x47b6b6[_0x59a0('0x25')]();};}function saveUpdates(_0x35f611,_0x33a7e7){return function(_0xa8769c){if(_0xa8769c){return _0xa8769c[_0x59a0('0x26')](_0x35f611)[_0x59a0('0x27')](function(_0x3a2616){return _0x3a2616;});}return null;};}function removeEntity(_0x3d74ab,_0x45461c){return function(_0x3becdd){if(_0x3becdd){return _0x3becdd[_0x59a0('0x28')]()[_0x59a0('0x27')](function(){_0x3d74ab['status'](0xcc)[_0x59a0('0x1e')]();});}};}function handleEntityNotFound(_0x3b6bac,_0xd7d2cc){return function(_0x3034d0){if(!_0x3034d0){_0x3b6bac[_0x59a0('0x1c')](0x194);}return _0x3034d0;};}function handleError(_0x435401,_0x220153){_0x220153=_0x220153||0x1f4;return function(_0x5da300){logger[_0x59a0('0x29')](_0x5da300[_0x59a0('0x2a')]);if(_0x5da300[_0x59a0('0x2b')]){delete _0x5da300[_0x59a0('0x2b')];}_0x435401['status'](_0x220153)[_0x59a0('0x2c')](_0x5da300);};}exports[_0x59a0('0x2d')]=function(_0x35dea0,_0x42e44a){var _0x183731={},_0x12ffc6={},_0x29cdcb={'count':0x0,'rows':[]};var _0x2f7356=_['map'](db[_0x59a0('0x2e')][_0x59a0('0x2f')],function(_0xa564ef){return{'name':_0xa564ef[_0x59a0('0x30')],'type':_0xa564ef[_0x59a0('0x31')][_0x59a0('0x32')]};});_0x12ffc6[_0x59a0('0x33')]=_[_0x59a0('0x34')](_0x2f7356,_0x59a0('0x2b'));_0x12ffc6['query']=_['keys'](_0x35dea0['query']);_0x12ffc6[_0x59a0('0x35')]=_[_0x59a0('0x36')](_0x12ffc6[_0x59a0('0x33')],_0x12ffc6[_0x59a0('0x37')]);_0x183731['attributes']=_[_0x59a0('0x36')](_0x12ffc6['model'],qs[_0x59a0('0x38')](_0x35dea0[_0x59a0('0x37')]['fields']));_0x183731[_0x59a0('0x39')]=_0x183731[_0x59a0('0x39')][_0x59a0('0x3a')]?_0x183731['attributes']:_0x12ffc6[_0x59a0('0x33')];if(!_0x35dea0[_0x59a0('0x37')][_0x59a0('0x3b')](_0x59a0('0x3c'))){_0x183731['limit']=qs['limit'](_0x35dea0[_0x59a0('0x37')][_0x59a0('0x21')]);_0x183731[_0x59a0('0x20')]=qs[_0x59a0('0x20')](_0x35dea0[_0x59a0('0x37')][_0x59a0('0x20')]);}_0x183731['order']=qs[_0x59a0('0x3d')](_0x35dea0[_0x59a0('0x37')][_0x59a0('0x3d')]);_0x183731[_0x59a0('0x3e')]=qs[_0x59a0('0x35')](_['pick'](_0x35dea0[_0x59a0('0x37')],_0x12ffc6[_0x59a0('0x35')]),_0x2f7356);if(_0x35dea0['query']['filter']){_0x183731['where']=_[_0x59a0('0x3f')](_0x183731[_0x59a0('0x3e')],{'$or':_[_0x59a0('0x34')](_0x2f7356,function(_0x3101c2){if(_0x3101c2[_0x59a0('0x31')]!==_0x59a0('0x40')){var _0x5ba5f1={};_0x5ba5f1[_0x3101c2['name']]={'$like':'%'+_0x35dea0[_0x59a0('0x37')][_0x59a0('0x41')]+'%'};return _0x5ba5f1;}})});}_0x183731=_[_0x59a0('0x3f')]({},_0x183731,_0x35dea0['options']);var _0x3996bc={'where':_0x183731[_0x59a0('0x3e')]};return db[_0x59a0('0x2e')][_0x59a0('0x1f')](_0x3996bc)['then'](function(_0x44a3ac){_0x29cdcb[_0x59a0('0x1f')]=_0x44a3ac;if(_0x35dea0[_0x59a0('0x37')][_0x59a0('0x42')]){_0x183731[_0x59a0('0x43')]=[{'all':!![]}];}return db[_0x59a0('0x2e')][_0x59a0('0x44')](_0x183731);})[_0x59a0('0x27')](function(_0x300da5){_0x29cdcb[_0x59a0('0x45')]=_0x300da5;return _0x29cdcb;})[_0x59a0('0x27')](respondWithFilteredResult(_0x42e44a,_0x183731))['catch'](handleError(_0x42e44a,null));};exports[_0x59a0('0x46')]=function(_0x4e37ac,_0x10312f){var _0x82679b={'raw':!![],'where':{'id':_0x4e37ac[_0x59a0('0x47')]['id']}},_0x136c7a={};_0x136c7a[_0x59a0('0x33')]=_[_0x59a0('0x48')](db[_0x59a0('0x2e')][_0x59a0('0x2f')]);_0x136c7a[_0x59a0('0x37')]=_[_0x59a0('0x48')](_0x4e37ac['query']);_0x136c7a['filters']=_[_0x59a0('0x36')](_0x136c7a['model'],_0x136c7a[_0x59a0('0x37')]);_0x82679b[_0x59a0('0x39')]=_[_0x59a0('0x36')](_0x136c7a[_0x59a0('0x33')],qs[_0x59a0('0x38')](_0x4e37ac[_0x59a0('0x37')]['fields']));_0x82679b[_0x59a0('0x39')]=_0x82679b[_0x59a0('0x39')][_0x59a0('0x3a')]?_0x82679b[_0x59a0('0x39')]:_0x136c7a[_0x59a0('0x33')];if(_0x4e37ac[_0x59a0('0x37')]['includeAll']){_0x82679b[_0x59a0('0x43')]=[{'all':!![]}];}_0x82679b=_[_0x59a0('0x3f')]({},_0x82679b,_0x4e37ac[_0x59a0('0x49')]);return db[_0x59a0('0x2e')][_0x59a0('0x4a')](_0x82679b)['then'](handleEntityNotFound(_0x10312f,null))['then'](respondWithResult(_0x10312f,null))['catch'](handleError(_0x10312f,null));};exports['create']=function(_0x179145,_0x334b42){return db[_0x59a0('0x2e')][_0x59a0('0x4b')](_0x179145[_0x59a0('0x4c')],{})[_0x59a0('0x27')](respondWithResult(_0x334b42,0xc9))[_0x59a0('0x4d')](handleError(_0x334b42,null));};exports['update']=function(_0x204b54,_0x654561){if(_0x204b54[_0x59a0('0x4c')]['id']){delete _0x204b54['body']['id'];}return db[_0x59a0('0x2e')][_0x59a0('0x4a')]({'where':{'id':_0x204b54[_0x59a0('0x47')]['id']}})[_0x59a0('0x27')](handleEntityNotFound(_0x654561,null))['then'](saveUpdates(_0x204b54[_0x59a0('0x4c')],null))['then'](respondWithResult(_0x654561,null))[_0x59a0('0x4d')](handleError(_0x654561,null));};exports[_0x59a0('0x28')]=function(_0x2f36b9,_0x3eab8e){return db[_0x59a0('0x2e')]['find']({'where':{'id':_0x2f36b9[_0x59a0('0x47')]['id']}})[_0x59a0('0x27')](handleEntityNotFound(_0x3eab8e,null))[_0x59a0('0x27')](removeEntity(_0x3eab8e,null))[_0x59a0('0x4d')](handleError(_0x3eab8e,null));};exports['describe']=function(_0x8c12c1,_0x4c3918){return db[_0x59a0('0x2e')][_0x59a0('0x4e')]()['then'](respondWithResult(_0x4c3918,null))['catch'](handleError(_0x4c3918,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 89385a8..2d669fb 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 _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 +var _0x6dc9=['moment','bluebird','rimraf','../../config/environment','exports','define','MailQueueReport','uniqueid','lodash','util','api'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0x6dc9,0x1ec));var _0x96dc=function(_0x1f040a,_0x314f9e){_0x1f040a=_0x1f040a-0x0;var _0x575c11=_0x6dc9[_0x1f040a];return _0x575c11;};'use strict';var _=require(_0x96dc('0x0'));var util=require(_0x96dc('0x1'));var logger=require('../../config/logger')(_0x96dc('0x2'));var moment=require(_0x96dc('0x3'));var BPromise=require(_0x96dc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x96dc('0x5'));var config=require(_0x96dc('0x6'));var attributes=require('./mailQueueReport.attributes');module[_0x96dc('0x7')]=function(_0x59c5e8,_0x2e955d){return _0x59c5e8[_0x96dc('0x8')](_0x96dc('0x9'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x96dc('0xa'),'fields':[_0x96dc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index c2d535c..3787777 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 _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 +var _0x3539=['update','raw','where','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','MailQueueReport','create','body','options','CreateMailQueueReport','UpdateMailQueueReport'];(function(_0x4d9bb2,_0x3db50d){var _0x3179fe=function(_0x5272f3){while(--_0x5272f3){_0x4d9bb2['push'](_0x4d9bb2['shift']());}};_0x3179fe(++_0x3db50d);}(_0x3539,0x67));var _0x9353=function(_0x176783,_0x395a26){_0x176783=_0x176783-0x0;var _0x7770a2=_0x3539[_0x176783];return _0x7770a2;};'use strict';var _=require('lodash');var util=require(_0x9353('0x0'));var moment=require(_0x9353('0x1'));var BPromise=require(_0x9353('0x2'));var rs=require(_0x9353('0x3'));var fs=require('fs');var Redis=require(_0x9353('0x4'));var db=require(_0x9353('0x5'))['db'];var utils=require(_0x9353('0x6'));var logger=require(_0x9353('0x7'))(_0x9353('0x8'));var config=require(_0x9353('0x9'));var jayson=require(_0x9353('0xa'));var client=jayson['client'][_0x9353('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x63b55f,_0x4f46d0,_0x39f7f9){return new BPromise(function(_0x2f6e34,_0x19bf85){return client[_0x9353('0xc')](_0x63b55f,_0x39f7f9)[_0x9353('0xd')](function(_0x77a7bc){logger[_0x9353('0xe')](_0x9353('0xf'),_0x4f46d0,_0x9353('0x10'));logger[_0x9353('0x11')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x4f46d0,_0x9353('0x10'),JSON[_0x9353('0x12')](_0x77a7bc));if(_0x77a7bc['error']){if(_0x77a7bc[_0x9353('0x13')]['code']===0x1f4){logger[_0x9353('0x13')](_0x9353('0xf'),_0x4f46d0,_0x77a7bc['error'][_0x9353('0x14')]);return _0x19bf85(_0x77a7bc[_0x9353('0x13')][_0x9353('0x14')]);}logger[_0x9353('0x13')](_0x9353('0xf'),_0x4f46d0,_0x77a7bc['error']['message']);return _0x2f6e34(_0x77a7bc[_0x9353('0x13')]['message']);}else{logger[_0x9353('0xe')](_0x9353('0xf'),_0x4f46d0,'request\x20sent');_0x2f6e34(_0x77a7bc[_0x9353('0x15')][_0x9353('0x14')]);}})[_0x9353('0x16')](function(_0x19dfdc){logger[_0x9353('0x13')](_0x9353('0xf'),_0x4f46d0,_0x19dfdc);_0x19bf85(_0x19dfdc);});});}exports['CreateMailQueueReport']=function(_0x28ebf5){var _0xfe8ba9=this;return new Promise(function(_0x163a5d,_0x4a9655){return db[_0x9353('0x17')][_0x9353('0x18')](_0x28ebf5[_0x9353('0x19')],{'raw':_0x28ebf5['options']?_0x28ebf5[_0x9353('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x9353('0xd')](function(_0x2c0cac){logger[_0x9353('0xe')](_0x9353('0x1b'),_0x28ebf5);logger[_0x9353('0x11')](_0x9353('0x1b'),_0x28ebf5,JSON[_0x9353('0x12')](_0x2c0cac));_0x163a5d(_0x2c0cac);})[_0x9353('0x16')](function(_0x5a21d9){logger[_0x9353('0x13')](_0x9353('0x1b'),_0x5a21d9[_0x9353('0x14')],_0x28ebf5);_0x4a9655(_0xfe8ba9[_0x9353('0x13')](0x1f4,_0x5a21d9[_0x9353('0x14')]));});});};exports[_0x9353('0x1c')]=function(_0x1ef609){var _0xa70aad=this;return new Promise(function(_0x5eb15a,_0x3fba54){return db[_0x9353('0x17')][_0x9353('0x1d')](_0x1ef609[_0x9353('0x19')],{'raw':_0x1ef609[_0x9353('0x1a')]?_0x1ef609[_0x9353('0x1a')][_0x9353('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ef609['options']?_0x1ef609[_0x9353('0x1a')][_0x9353('0x1f')]||null:null,'attributes':_0x1ef609[_0x9353('0x1a')]?_0x1ef609[_0x9353('0x1a')]['attributes']||null:null,'limit':_0x1ef609[_0x9353('0x1a')]?_0x1ef609[_0x9353('0x1a')][_0x9353('0x20')]||null:null})[_0x9353('0xd')](function(_0x3e88f5){logger['info'](_0x9353('0x1c'),_0x1ef609);logger[_0x9353('0x11')]('UpdateMailQueueReport',_0x1ef609,JSON['stringify'](_0x3e88f5));_0x5eb15a(_0x3e88f5);})[_0x9353('0x16')](function(_0x5b4a16){logger[_0x9353('0x13')](_0x9353('0x1c'),_0x5b4a16[_0x9353('0x14')],_0x1ef609);_0x3fba54(_0xa70aad['error'](0x1f4,_0x5b4a16[_0x9353('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index dd62415..d8b94c3 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 _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 +var _0x9ce5=['express','Router','../../components/interaction/service','../../config/environment','exports','multer','connect-timeout'];(function(_0x4189a2,_0x4fd289){var _0x1611c5=function(_0xf4749b){while(--_0xf4749b){_0x4189a2['push'](_0x4189a2['shift']());}};_0x1611c5(++_0x4fd289);}(_0x9ce5,0x108));var _0x59ce=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x9ce5[_0x9dfc10];return _0x4f938a;};'use strict';var multer=require(_0x59ce('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x59ce('0x1'));var express=require(_0x59ce('0x2'));var router=express[_0x59ce('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x59ce('0x4'));var config=require(_0x59ce('0x5'));module[_0x59ce('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index ddd4c93..e50b5b2 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 _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 +var _0x658b=['sequelize','exports','STRING','BOOLEAN','username','INTEGER'];(function(_0x2eea9a,_0x368daf){var _0x1ec61e=function(_0x1fc2fc){while(--_0x1fc2fc){_0x2eea9a['push'](_0x2eea9a['shift']());}};_0x1ec61e(++_0x368daf);}(_0x658b,0x156));var _0xb658=function(_0x129a3c,_0x27c4ff){_0x129a3c=_0x129a3c-0x0;var _0x3a100e=_0x658b[_0x129a3c];return _0x3a100e;};'use strict';var Sequelize=require(_0xb658('0x0'));module[_0xb658('0x1')]={'description':{'type':Sequelize[_0xb658('0x2')]},'host':{'type':Sequelize[_0xb658('0x2')]},'authentication':{'type':Sequelize[_0xb658('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xb658('0x2')],'unique':_0xb658('0x4')},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xb658('0x5')]},'tls':{'type':Sequelize[_0xb658('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xb658('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xb658('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xb658('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0xb658('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 4770868..712530d 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 _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 +var _0x087b=['../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','moment','request-promise','path','rimraf'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x087b,0x11a));var _0xb087=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x087b[_0x4a3898];return _0x25ceb0;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb087('0x2'));var BPromise=require('bluebird');var rp=require(_0xb087('0x3'));var fs=require('fs');var path=require(_0xb087('0x4'));var rimraf=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var attributes=require(_0xb087('0x7'));module[_0xb087('0x8')]=function(_0x40156d,_0x17d6e8){return _0x40156d[_0xb087('0x9')](_0xb087('0xa'),attributes,{'tableName':_0xb087('0xb'),'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 6ac3a42..0d840ce 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 _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 +var _0x22cc=['randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','message','error','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','limit','map','include','model','lodash','moment','bluebird'];(function(_0x265a5,_0x57fea9){var _0x3e681a=function(_0x4abee4){while(--_0x4abee4){_0x265a5['push'](_0x265a5['shift']());}};_0x3e681a(++_0x57fea9);}(_0x22cc,0x15d));var _0xc22c=function(_0x260e4b,_0x54668d){_0x260e4b=_0x260e4b-0x0;var _0x18dfba=_0x22cc[_0x260e4b];return _0x18dfba;};'use strict';var _=require(_0xc22c('0x0'));var util=require('util');var moment=require(_0xc22c('0x1'));var BPromise=require(_0xc22c('0x2'));var rs=require(_0xc22c('0x3'));var fs=require('fs');var Redis=require(_0xc22c('0x4'));var db=require(_0xc22c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc22c('0x6'));var jayson=require(_0xc22c('0x7'));var client=jayson[_0xc22c('0x8')][_0xc22c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23ba4a,_0x2bf8ba,_0xb0a17a){return new BPromise(function(_0x2b2893,_0x36c3e8){return client[_0xc22c('0xa')](_0x23ba4a,_0xb0a17a)[_0xc22c('0xb')](function(_0x31c9ab){logger[_0xc22c('0xc')](_0xc22c('0xd'),_0x2bf8ba,_0xc22c('0xe'));logger[_0xc22c('0xf')](_0xc22c('0x10'),_0x2bf8ba,'request\x20sent',JSON[_0xc22c('0x11')](_0x31c9ab));if(_0x31c9ab['error']){if(_0x31c9ab['error']['code']===0x1f4){logger['error'](_0xc22c('0xd'),_0x2bf8ba,_0x31c9ab['error']['message']);return _0x36c3e8(_0x31c9ab['error'][_0xc22c('0x12')]);}logger[_0xc22c('0x13')](_0xc22c('0xd'),_0x2bf8ba,_0x31c9ab['error']['message']);return _0x2b2893(_0x31c9ab['error'][_0xc22c('0x12')]);}else{logger[_0xc22c('0xc')](_0xc22c('0xd'),_0x2bf8ba,_0xc22c('0xe'));_0x2b2893(_0x31c9ab[_0xc22c('0x14')][_0xc22c('0x12')]);}})[_0xc22c('0x15')](function(_0x4f4e9f){logger['error'](_0xc22c('0xd'),_0x2bf8ba,_0x4f4e9f);_0x36c3e8(_0x4f4e9f);});});}exports[_0xc22c('0x16')]=function(_0x27bd6){var _0x4b21e0=this;return new Promise(function(_0x27ea13,_0x508b3a){return db[_0xc22c('0x17')][_0xc22c('0x18')]({'raw':_0x27bd6[_0xc22c('0x19')]?_0x27bd6[_0xc22c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x27bd6[_0xc22c('0x19')]?_0x27bd6[_0xc22c('0x19')][_0xc22c('0x1a')]||null:null,'attributes':_0x27bd6['options']?_0x27bd6[_0xc22c('0x19')][_0xc22c('0x1b')]||null:null,'limit':_0x27bd6[_0xc22c('0x19')]?_0x27bd6[_0xc22c('0x19')][_0xc22c('0x1c')]||null:null,'include':_0x27bd6['options']?_0x27bd6[_0xc22c('0x19')]['include']?_[_0xc22c('0x1d')](_0x27bd6['options'][_0xc22c('0x1e')],function(_0x208fd2){return{'model':db[_0x208fd2[_0xc22c('0x1f')]],'as':_0x208fd2['as'],'attributes':_0x208fd2[_0xc22c('0x1b')],'include':_0x208fd2[_0xc22c('0x1e')]?_['map'](_0x208fd2['include'],function(_0x221cd1){return{'model':db[_0x221cd1[_0xc22c('0x1f')]],'as':_0x221cd1['as'],'attributes':_0x221cd1[_0xc22c('0x1b')],'include':_0x221cd1['include']?_[_0xc22c('0x1d')](_0x221cd1[_0xc22c('0x1e')],function(_0xc5dedf){return{'model':db[_0xc5dedf[_0xc22c('0x1f')]],'as':_0xc5dedf['as'],'attributes':_0xc5dedf['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x27edcd){logger[_0xc22c('0xc')](_0xc22c('0x16'),_0x27bd6);logger['debug'](_0xc22c('0x16'),_0x27bd6,JSON[_0xc22c('0x11')](_0x27edcd));_0x27ea13(_0x27edcd);})['catch'](function(_0x3485d5){logger[_0xc22c('0x13')]('GetMailServerIn',_0x3485d5[_0xc22c('0x12')],_0x27bd6);_0x508b3a(_0x4b21e0['error'](0x1f4,_0x3485d5[_0xc22c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 72fa81a..2cfb8ab 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 _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 +var _0x67ae=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','multer','util','path'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x67ae,0x101));var _0xe67a=function(_0x43b21a,_0x7a37ab){_0x43b21a=_0x43b21a-0x0;var _0x39dbc7=_0x67ae[_0x43b21a];return _0x39dbc7;};'use strict';var multer=require(_0xe67a('0x0'));var util=require(_0xe67a('0x1'));var path=require(_0xe67a('0x2'));var timeout=require(_0xe67a('0x3'));var express=require(_0xe67a('0x4'));var router=express[_0xe67a('0x5')]();var auth=require(_0xe67a('0x6'));var interaction=require(_0xe67a('0x7'));var config=require(_0xe67a('0x8'));var controller=require(_0xe67a('0x9'));router[_0xe67a('0xa')]('/',auth['isAuthenticated'](),controller[_0xe67a('0xb')]);router[_0xe67a('0xa')](_0xe67a('0xc'),auth['isAuthenticated'](),controller[_0xe67a('0xd')]);router[_0xe67a('0xe')]('/',auth[_0xe67a('0xf')](),controller[_0xe67a('0x10')]);router[_0xe67a('0x11')]('/:id',auth[_0xe67a('0xf')](),controller[_0xe67a('0x12')]);router[_0xe67a('0x13')](_0xe67a('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 8502618..2665640 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 _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 +var _0x8f9d=['STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x35e9cf,_0x1c29b7){var _0x33a998=function(_0x2b96dd){while(--_0x2b96dd){_0x35e9cf['push'](_0x35e9cf['shift']());}};_0x33a998(++_0x1c29b7);}(_0x8f9d,0x93));var _0xd8f9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8f9d[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xd8f9('0x0'));module['exports']={'description':{'type':Sequelize[_0xd8f9('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xd8f9('0x1')]},'pass':{'type':Sequelize[_0xd8f9('0x1')]},'port':{'type':Sequelize[_0xd8f9('0x2')]},'secure':{'type':Sequelize[_0xd8f9('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xd8f9('0x1')]},'authentication':{'type':Sequelize[_0xd8f9('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index ae007a0..c5a49eb 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 _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 +var _0x59db=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','model','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','merge','type','filter','options','include','findAll','rows','params','keys','includeAll','catch','create','body','find','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x59db,0x18f));var _0xb59d=function(_0x85b47d,_0x1208e1){_0x85b47d=_0x85b47d-0x0;var _0x24f4d3=_0x59db[_0x85b47d];return _0x24f4d3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb59d('0x0'));var jsonpatch=require(_0xb59d('0x1'));var rp=require(_0xb59d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb59d('0x3'));var util=require(_0xb59d('0x4'));var path=require('path');var sox=require(_0xb59d('0x5'));var csv=require(_0xb59d('0x6'));var ejs=require(_0xb59d('0x7'));var fs=require('fs');var _=require(_0xb59d('0x8'));var squel=require('squel');var crypto=require(_0xb59d('0x9'));var jsforce=require(_0xb59d('0xa'));var deskjs=require(_0xb59d('0xb'));var toCsv=require(_0xb59d('0x6'));var querystring=require('querystring');var Papa=require(_0xb59d('0xc'));var Redis=require(_0xb59d('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb59d('0xe'));var hardwareService=require(_0xb59d('0xf'));var logger=require(_0xb59d('0x10'))(_0xb59d('0x11'));var utils=require(_0xb59d('0x12'));var config=require(_0xb59d('0x13'));var licenseUtil=require(_0xb59d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ea953,_0x3dcb8c){_0x3dcb8c=_0x3dcb8c||0xcc;return function(_0x2bc9b3){if(_0x2bc9b3){return _0x2ea953[_0xb59d('0x15')](_0x3dcb8c);}return _0x2ea953[_0xb59d('0x16')](_0x3dcb8c)[_0xb59d('0x17')]();};}function respondWithResult(_0xb5c2b6,_0x394cca){_0x394cca=_0x394cca||0xc8;return function(_0x20c11f){if(_0x20c11f){return _0xb5c2b6[_0xb59d('0x16')](_0x394cca)[_0xb59d('0x18')](_0x20c11f);}};}function respondWithFilteredResult(_0x4b1145,_0x5af827){return function(_0x1e097a){if(_0x1e097a){var _0x20d7ad=_0x1e097a[_0xb59d('0x19')],_0x151300=_0x5af827[_0xb59d('0x1a')],_0x3b478e=_0x5af827[_0xb59d('0x1a')]+_0x5af827[_0xb59d('0x1b')],_0x26d28c;if(_0x3b478e>=_0x20d7ad){_0x3b478e=_0x20d7ad;_0x26d28c=0xc8;}else{_0x26d28c=0xce;}_0x4b1145['status'](_0x26d28c);return _0x4b1145[_0xb59d('0x1c')](_0xb59d('0x1d'),_0x151300+'-'+_0x3b478e+'/'+_0x20d7ad)['json'](_0x1e097a);}return null;};}function patchUpdates(_0x5b9471){return function(_0x11bfdc){try{jsonpatch[_0xb59d('0x1e')](_0x11bfdc,_0x5b9471,!![]);}catch(_0x206d68){return BPromise['reject'](_0x206d68);}return _0x11bfdc[_0xb59d('0x1f')]();};}function saveUpdates(_0x1857ac,_0x238584){return function(_0x4daa3b){if(_0x4daa3b){return _0x4daa3b[_0xb59d('0x20')](_0x1857ac)[_0xb59d('0x21')](function(_0x343b09){return _0x343b09;});}return null;};}function removeEntity(_0x3aa22b,_0x212dcb){return function(_0x2256ad){if(_0x2256ad){return _0x2256ad[_0xb59d('0x22')]()[_0xb59d('0x21')](function(){_0x3aa22b[_0xb59d('0x16')](0xcc)[_0xb59d('0x17')]();});}};}function handleEntityNotFound(_0xb6ab10,_0x14df31){return function(_0x47f252){if(!_0x47f252){_0xb6ab10[_0xb59d('0x15')](0x194);}return _0x47f252;};}function handleError(_0x3f87be,_0x3036f7){_0x3036f7=_0x3036f7||0x1f4;return function(_0x51be4a){logger[_0xb59d('0x23')](_0x51be4a[_0xb59d('0x24')]);if(_0x51be4a[_0xb59d('0x25')]){delete _0x51be4a[_0xb59d('0x25')];}_0x3f87be[_0xb59d('0x16')](_0x3036f7)[_0xb59d('0x26')](_0x51be4a);};}exports[_0xb59d('0x27')]=function(_0x441af3,_0x53b184){var _0x7cf9be={},_0x3edc29={},_0x5e2869={'count':0x0,'rows':[]};var _0x4451b7=_[_0xb59d('0x28')](db[_0xb59d('0x29')][_0xb59d('0x2a')],function(_0x2bb8c3){return{'name':_0x2bb8c3['fieldName'],'type':_0x2bb8c3['type']['key']};});_0x3edc29[_0xb59d('0x2b')]=_['map'](_0x4451b7,_0xb59d('0x25'));_0x3edc29['query']=_['keys'](_0x441af3['query']);_0x3edc29[_0xb59d('0x2c')]=_[_0xb59d('0x2d')](_0x3edc29[_0xb59d('0x2b')],_0x3edc29[_0xb59d('0x2e')]);_0x7cf9be['attributes']=_[_0xb59d('0x2d')](_0x3edc29[_0xb59d('0x2b')],qs[_0xb59d('0x2f')](_0x441af3[_0xb59d('0x2e')][_0xb59d('0x2f')]));_0x7cf9be['attributes']=_0x7cf9be[_0xb59d('0x30')][_0xb59d('0x31')]?_0x7cf9be['attributes']:_0x3edc29['model'];if(!_0x441af3[_0xb59d('0x2e')]['hasOwnProperty'](_0xb59d('0x32'))){_0x7cf9be[_0xb59d('0x1b')]=qs[_0xb59d('0x1b')](_0x441af3['query'][_0xb59d('0x1b')]);_0x7cf9be[_0xb59d('0x1a')]=qs[_0xb59d('0x1a')](_0x441af3['query'][_0xb59d('0x1a')]);}_0x7cf9be[_0xb59d('0x33')]=qs[_0xb59d('0x34')](_0x441af3['query'][_0xb59d('0x34')]);_0x7cf9be[_0xb59d('0x35')]=qs[_0xb59d('0x2c')](_[_0xb59d('0x36')](_0x441af3[_0xb59d('0x2e')],_0x3edc29['filters']),_0x4451b7);if(_0x441af3[_0xb59d('0x2e')]['filter']){_0x7cf9be[_0xb59d('0x35')]=_[_0xb59d('0x37')](_0x7cf9be['where'],{'$or':_[_0xb59d('0x28')](_0x4451b7,function(_0x1c2e46){if(_0x1c2e46[_0xb59d('0x38')]!=='VIRTUAL'){var _0x5dc453={};_0x5dc453[_0x1c2e46[_0xb59d('0x25')]]={'$like':'%'+_0x441af3[_0xb59d('0x2e')][_0xb59d('0x39')]+'%'};return _0x5dc453;}})});}_0x7cf9be=_[_0xb59d('0x37')]({},_0x7cf9be,_0x441af3[_0xb59d('0x3a')]);var _0x5eadb9={'where':_0x7cf9be['where']};return db[_0xb59d('0x29')][_0xb59d('0x19')](_0x5eadb9)[_0xb59d('0x21')](function(_0x59ba16){_0x5e2869['count']=_0x59ba16;if(_0x441af3[_0xb59d('0x2e')]['includeAll']){_0x7cf9be[_0xb59d('0x3b')]=[{'all':!![]}];}return db[_0xb59d('0x29')][_0xb59d('0x3c')](_0x7cf9be);})['then'](function(_0xa88014){_0x5e2869[_0xb59d('0x3d')]=_0xa88014;return _0x5e2869;})[_0xb59d('0x21')](respondWithFilteredResult(_0x53b184,_0x7cf9be))['catch'](handleError(_0x53b184,null));};exports['show']=function(_0x20e236,_0x296512){var _0x2b53e8={'raw':!![],'where':{'id':_0x20e236[_0xb59d('0x3e')]['id']}},_0x2abd1c={};_0x2abd1c[_0xb59d('0x2b')]=_[_0xb59d('0x3f')](db[_0xb59d('0x29')][_0xb59d('0x2a')]);_0x2abd1c[_0xb59d('0x2e')]=_['keys'](_0x20e236['query']);_0x2abd1c[_0xb59d('0x2c')]=_[_0xb59d('0x2d')](_0x2abd1c[_0xb59d('0x2b')],_0x2abd1c[_0xb59d('0x2e')]);_0x2b53e8['attributes']=_[_0xb59d('0x2d')](_0x2abd1c[_0xb59d('0x2b')],qs[_0xb59d('0x2f')](_0x20e236[_0xb59d('0x2e')][_0xb59d('0x2f')]));_0x2b53e8['attributes']=_0x2b53e8[_0xb59d('0x30')][_0xb59d('0x31')]?_0x2b53e8[_0xb59d('0x30')]:_0x2abd1c['model'];if(_0x20e236[_0xb59d('0x2e')][_0xb59d('0x40')]){_0x2b53e8['include']=[{'all':!![]}];}_0x2b53e8=_[_0xb59d('0x37')]({},_0x2b53e8,_0x20e236['options']);return db['MailServerOut']['find'](_0x2b53e8)['then'](handleEntityNotFound(_0x296512,null))[_0xb59d('0x21')](respondWithResult(_0x296512,null))[_0xb59d('0x41')](handleError(_0x296512,null));};exports[_0xb59d('0x42')]=function(_0x2eaacf,_0x33140d){return db[_0xb59d('0x29')][_0xb59d('0x42')](_0x2eaacf[_0xb59d('0x43')],{})['then'](respondWithResult(_0x33140d,0xc9))['catch'](handleError(_0x33140d,null));};exports[_0xb59d('0x20')]=function(_0x5900ae,_0x2b731e){if(_0x5900ae[_0xb59d('0x43')]['id']){delete _0x5900ae[_0xb59d('0x43')]['id'];}return db[_0xb59d('0x29')][_0xb59d('0x44')]({'where':{'id':_0x5900ae['params']['id']}})[_0xb59d('0x21')](handleEntityNotFound(_0x2b731e,null))[_0xb59d('0x21')](saveUpdates(_0x5900ae[_0xb59d('0x43')],null))[_0xb59d('0x21')](respondWithResult(_0x2b731e,null))[_0xb59d('0x41')](handleError(_0x2b731e,null));};exports[_0xb59d('0x22')]=function(_0x39fdf4,_0x19e186){return db[_0xb59d('0x29')][_0xb59d('0x44')]({'where':{'id':_0x39fdf4[_0xb59d('0x3e')]['id']}})[_0xb59d('0x21')](handleEntityNotFound(_0x19e186,null))['then'](removeEntity(_0x19e186,null))[_0xb59d('0x41')](handleError(_0x19e186,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index c204bb8..0ddda6a 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 _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 +var _0x5fab=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash','util'];(function(_0x1dda07,_0x5db499){var _0x9fce6f=function(_0x288314){while(--_0x288314){_0x1dda07['push'](_0x1dda07['shift']());}};_0x9fce6f(++_0x5db499);}(_0x5fab,0x177));var _0xb5fa=function(_0x494986,_0x4debb8){_0x494986=_0x494986-0x0;var _0x1c805b=_0x5fab[_0x494986];return _0x1c805b;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'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 84027e1..3ffca51 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 _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 +var _0x1af4=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','MailServerOut,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x49dd53,_0x120b38){var _0x5d0898=function(_0x33ec5a){while(--_0x33ec5a){_0x49dd53['push'](_0x49dd53['shift']());}};_0x5d0898(++_0x120b38);}(_0x1af4,0xf6));var _0x41af=function(_0x23e79e,_0x5c740a){_0x23e79e=_0x23e79e-0x0;var _0x3f8723=_0x1af4[_0x23e79e];return _0x3f8723;};'use strict';var _=require(_0x41af('0x0'));var util=require(_0x41af('0x1'));var moment=require(_0x41af('0x2'));var BPromise=require(_0x41af('0x3'));var rs=require(_0x41af('0x4'));var fs=require('fs');var Redis=require(_0x41af('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x41af('0x6'));var logger=require(_0x41af('0x7'))(_0x41af('0x8'));var config=require('../../config/environment');var jayson=require(_0x41af('0x9'));var client=jayson[_0x41af('0xa')][_0x41af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x595aec,_0x374105,_0x235bef){return new BPromise(function(_0x1e5d2a,_0x151c24){return client[_0x41af('0xc')](_0x595aec,_0x235bef)[_0x41af('0xd')](function(_0x3467d7){logger[_0x41af('0xe')]('MailServerOut,\x20%s,\x20%s',_0x374105,'request\x20sent');logger[_0x41af('0xf')](_0x41af('0x10'),_0x374105,'request\x20sent',JSON['stringify'](_0x3467d7));if(_0x3467d7[_0x41af('0x11')]){if(_0x3467d7[_0x41af('0x11')][_0x41af('0x12')]===0x1f4){logger['error']('MailServerOut,\x20%s,\x20%s',_0x374105,_0x3467d7[_0x41af('0x11')][_0x41af('0x13')]);return _0x151c24(_0x3467d7[_0x41af('0x11')][_0x41af('0x13')]);}logger['error'](_0x41af('0x14'),_0x374105,_0x3467d7['error'][_0x41af('0x13')]);return _0x1e5d2a(_0x3467d7[_0x41af('0x11')][_0x41af('0x13')]);}else{logger['info'](_0x41af('0x14'),_0x374105,'request\x20sent');_0x1e5d2a(_0x3467d7[_0x41af('0x15')][_0x41af('0x13')]);}})[_0x41af('0x16')](function(_0x16dd22){logger['error'](_0x41af('0x14'),_0x374105,_0x16dd22);_0x151c24(_0x16dd22);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index cd653ab..9c76aff 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 _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 +var _0xee9a=['express','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','util','path','connect-timeout'];(function(_0xb81379,_0x3c6d34){var _0x520a1e=function(_0x2cb0e3){while(--_0x2cb0e3){_0xb81379['push'](_0xb81379['shift']());}};_0x520a1e(++_0x3c6d34);}(_0xee9a,0xc9));var _0xaee9=function(_0x4a6322,_0x1dac50){_0x4a6322=_0x4a6322-0x0;var _0x4c4f0d=_0xee9a[_0x4a6322];return _0x4c4f0d;};'use strict';var multer=require('multer');var util=require(_0xaee9('0x0'));var path=require(_0xaee9('0x1'));var timeout=require(_0xaee9('0x2'));var express=require(_0xaee9('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(_0xaee9('0x4'));router[_0xaee9('0x5')]('/',auth[_0xaee9('0x6')](),controller[_0xaee9('0x7')]);router[_0xaee9('0x5')](_0xaee9('0x8'),auth[_0xaee9('0x6')](),controller[_0xaee9('0x9')]);router[_0xaee9('0x5')](_0xaee9('0xa'),auth[_0xaee9('0x6')](),controller[_0xaee9('0xb')]);router['post']('/',auth[_0xaee9('0x6')](),controller[_0xaee9('0xc')]);router[_0xaee9('0xd')](_0xaee9('0xa'),auth[_0xaee9('0x6')](),controller[_0xaee9('0xe')]);router[_0xaee9('0xf')]('/:id',auth[_0xaee9('0x6')](),controller[_0xaee9('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 09d99d7..e2e327b 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 _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 +var _0x23bb=['STRING','sequelize','name'];(function(_0x2012f5,_0x41f107){var _0x3c2f46=function(_0x28f3cd){while(--_0x28f3cd){_0x2012f5['push'](_0x2012f5['shift']());}};_0x3c2f46(++_0x41f107);}(_0x23bb,0x79));var _0xb23b=function(_0x4552ea,_0x5c6323){_0x4552ea=_0x4552ea-0x0;var _0x45499a=_0x23bb[_0x4552ea];return _0x45499a;};'use strict';var Sequelize=require(_0xb23b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb23b('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb23b('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 5d2128e..b798186 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 _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 +var _0xbe42=['where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','options','create','body','destroy','find','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort'];(function(_0x5d9613,_0x11eead){var _0x3d96f4=function(_0x1947f9){while(--_0x1947f9){_0x5d9613['push'](_0x5d9613['shift']());}};_0x3d96f4(++_0x11eead);}(_0xbe42,0x1d4));var _0x2be4=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0xbe42[_0x31dde9];return _0x1fbf2d;};'use strict';var pdf=require(_0x2be4('0x0'));var emlformat=require(_0x2be4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2be4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2be4('0x3'));var moment=require(_0x2be4('0x4'));var BPromise=require(_0x2be4('0x5'));var Mustache=require(_0x2be4('0x6'));var util=require(_0x2be4('0x7'));var path=require(_0x2be4('0x8'));var sox=require(_0x2be4('0x9'));var csv=require(_0x2be4('0xa'));var ejs=require(_0x2be4('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2be4('0xc'));var crypto=require(_0x2be4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2be4('0xe'));var toCsv=require(_0x2be4('0xa'));var querystring=require(_0x2be4('0xf'));var Papa=require(_0x2be4('0x10'));var Redis=require(_0x2be4('0x11'));var authService=require(_0x2be4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2be4('0x13'));var hardwareService=require(_0x2be4('0x14'));var logger=require(_0x2be4('0x15'))(_0x2be4('0x16'));var utils=require('../../config/utils');var config=require(_0x2be4('0x17'));var licenseUtil=require(_0x2be4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e01f6,_0x251e8a){_0x251e8a=_0x251e8a||0xcc;return function(_0x219717){if(_0x219717){return _0x3e01f6['sendStatus'](_0x251e8a);}return _0x3e01f6[_0x2be4('0x19')](_0x251e8a)['end']();};}function respondWithResult(_0x5ac741,_0x46ec98){_0x46ec98=_0x46ec98||0xc8;return function(_0x54160d){if(_0x54160d){return _0x5ac741[_0x2be4('0x19')](_0x46ec98)[_0x2be4('0x1a')](_0x54160d);}};}function respondWithFilteredResult(_0x3a5358,_0x5b2be9){return function(_0x5f22e6){if(_0x5f22e6){var _0x55fea1=_0x5f22e6[_0x2be4('0x1b')],_0x420ee9=_0x5b2be9['offset'],_0x20501b=_0x5b2be9[_0x2be4('0x1c')]+_0x5b2be9[_0x2be4('0x1d')],_0x2f4f74;if(_0x20501b>=_0x55fea1){_0x20501b=_0x55fea1;_0x2f4f74=0xc8;}else{_0x2f4f74=0xce;}_0x3a5358[_0x2be4('0x19')](_0x2f4f74);return _0x3a5358[_0x2be4('0x1e')](_0x2be4('0x1f'),_0x420ee9+'-'+_0x20501b+'/'+_0x55fea1)['json'](_0x5f22e6);}return null;};}function patchUpdates(_0x22ec30){return function(_0xff484f){try{jsonpatch[_0x2be4('0x20')](_0xff484f,_0x22ec30,!![]);}catch(_0x33c58f){return BPromise['reject'](_0x33c58f);}return _0xff484f[_0x2be4('0x21')]();};}function saveUpdates(_0x5271e8,_0x1a40ac){return function(_0x162938){if(_0x162938){return _0x162938[_0x2be4('0x22')](_0x5271e8)['then'](function(_0x54fdf9){return _0x54fdf9;});}return null;};}function removeEntity(_0x389dd4,_0x29247a){return function(_0x3ee718){if(_0x3ee718){return _0x3ee718['destroy']()[_0x2be4('0x23')](function(){_0x389dd4['status'](0xcc)[_0x2be4('0x24')]();});}};}function handleEntityNotFound(_0x3052af,_0x5d1f2e){return function(_0x8ae6b2){if(!_0x8ae6b2){_0x3052af['sendStatus'](0x194);}return _0x8ae6b2;};}function handleError(_0x4c114a,_0x37f47a){_0x37f47a=_0x37f47a||0x1f4;return function(_0x178a93){logger[_0x2be4('0x25')](_0x178a93[_0x2be4('0x26')]);if(_0x178a93['name']){delete _0x178a93[_0x2be4('0x27')];}_0x4c114a[_0x2be4('0x19')](_0x37f47a)[_0x2be4('0x28')](_0x178a93);};}exports[_0x2be4('0x29')]=function(_0x500f5f,_0x56fd72){var _0x40fc9f={},_0x1ac923={},_0x529fa0={'count':0x0,'rows':[]};var _0x390d3d=_['map'](db[_0x2be4('0x2a')][_0x2be4('0x2b')],function(_0x470281){return{'name':_0x470281[_0x2be4('0x2c')],'type':_0x470281['type'][_0x2be4('0x2d')]};});_0x1ac923[_0x2be4('0x2e')]=_[_0x2be4('0x2f')](_0x390d3d,_0x2be4('0x27'));_0x1ac923[_0x2be4('0x30')]=_['keys'](_0x500f5f['query']);_0x1ac923[_0x2be4('0x31')]=_[_0x2be4('0x32')](_0x1ac923['model'],_0x1ac923[_0x2be4('0x30')]);_0x40fc9f[_0x2be4('0x33')]=_[_0x2be4('0x32')](_0x1ac923[_0x2be4('0x2e')],qs[_0x2be4('0x34')](_0x500f5f[_0x2be4('0x30')][_0x2be4('0x34')]));_0x40fc9f[_0x2be4('0x33')]=_0x40fc9f['attributes'][_0x2be4('0x35')]?_0x40fc9f[_0x2be4('0x33')]:_0x1ac923[_0x2be4('0x2e')];if(!_0x500f5f['query']['hasOwnProperty'](_0x2be4('0x36'))){_0x40fc9f[_0x2be4('0x1d')]=qs['limit'](_0x500f5f[_0x2be4('0x30')][_0x2be4('0x1d')]);_0x40fc9f[_0x2be4('0x1c')]=qs[_0x2be4('0x1c')](_0x500f5f[_0x2be4('0x30')][_0x2be4('0x1c')]);}_0x40fc9f[_0x2be4('0x37')]=qs[_0x2be4('0x38')](_0x500f5f[_0x2be4('0x30')][_0x2be4('0x38')]);_0x40fc9f[_0x2be4('0x39')]=qs[_0x2be4('0x31')](_[_0x2be4('0x3a')](_0x500f5f[_0x2be4('0x30')],_0x1ac923[_0x2be4('0x31')]),_0x390d3d);if(_0x500f5f['query'][_0x2be4('0x3b')]){_0x40fc9f['where']=_[_0x2be4('0x3c')](_0x40fc9f[_0x2be4('0x39')],{'$or':_[_0x2be4('0x2f')](_0x390d3d,function(_0x205354){if(_0x205354['type']!==_0x2be4('0x3d')){var _0x20cb16={};_0x20cb16[_0x205354['name']]={'$like':'%'+_0x500f5f[_0x2be4('0x30')][_0x2be4('0x3b')]+'%'};return _0x20cb16;}})});}_0x40fc9f=_[_0x2be4('0x3c')]({},_0x40fc9f,_0x500f5f['options']);var _0x1cfb94={'where':_0x40fc9f[_0x2be4('0x39')]};return db[_0x2be4('0x2a')][_0x2be4('0x1b')](_0x1cfb94)[_0x2be4('0x23')](function(_0x2fa433){_0x529fa0[_0x2be4('0x1b')]=_0x2fa433;if(_0x500f5f[_0x2be4('0x30')][_0x2be4('0x3e')]){_0x40fc9f[_0x2be4('0x3f')]=[{'all':!![]}];}return db[_0x2be4('0x2a')]['findAll'](_0x40fc9f);})[_0x2be4('0x23')](function(_0x6b6b48){_0x529fa0[_0x2be4('0x40')]=_0x6b6b48;return _0x529fa0;})[_0x2be4('0x23')](respondWithFilteredResult(_0x56fd72,_0x40fc9f))[_0x2be4('0x41')](handleError(_0x56fd72,null));};exports[_0x2be4('0x42')]=function(_0x66887c,_0x3d987e){var _0x1d7d0a={'raw':!![],'where':{'id':_0x66887c[_0x2be4('0x43')]['id']}},_0x22ebbd={};_0x22ebbd[_0x2be4('0x2e')]=_[_0x2be4('0x44')](db[_0x2be4('0x2a')][_0x2be4('0x2b')]);_0x22ebbd[_0x2be4('0x30')]=_[_0x2be4('0x44')](_0x66887c[_0x2be4('0x30')]);_0x22ebbd['filters']=_[_0x2be4('0x32')](_0x22ebbd[_0x2be4('0x2e')],_0x22ebbd[_0x2be4('0x30')]);_0x1d7d0a['attributes']=_[_0x2be4('0x32')](_0x22ebbd['model'],qs[_0x2be4('0x34')](_0x66887c[_0x2be4('0x30')][_0x2be4('0x34')]));_0x1d7d0a[_0x2be4('0x33')]=_0x1d7d0a['attributes']['length']?_0x1d7d0a[_0x2be4('0x33')]:_0x22ebbd[_0x2be4('0x2e')];if(_0x66887c[_0x2be4('0x30')][_0x2be4('0x3e')]){_0x1d7d0a[_0x2be4('0x3f')]=[{'all':!![]}];}_0x1d7d0a=_[_0x2be4('0x3c')]({},_0x1d7d0a,_0x66887c[_0x2be4('0x45')]);return db[_0x2be4('0x2a')]['find'](_0x1d7d0a)['then'](handleEntityNotFound(_0x3d987e,null))[_0x2be4('0x23')](respondWithResult(_0x3d987e,null))[_0x2be4('0x41')](handleError(_0x3d987e,null));};exports['create']=function(_0x4239b3,_0x67f488){return db[_0x2be4('0x2a')][_0x2be4('0x46')](_0x4239b3[_0x2be4('0x47')],{})['then'](respondWithResult(_0x67f488,0xc9))[_0x2be4('0x41')](handleError(_0x67f488,null));};exports[_0x2be4('0x22')]=function(_0x5c8df6,_0x2fcaf3){if(_0x5c8df6[_0x2be4('0x47')]['id']){delete _0x5c8df6[_0x2be4('0x47')]['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x5c8df6[_0x2be4('0x43')]['id']}})[_0x2be4('0x23')](handleEntityNotFound(_0x2fcaf3,null))[_0x2be4('0x23')](saveUpdates(_0x5c8df6['body'],null))[_0x2be4('0x23')](respondWithResult(_0x2fcaf3,null))['catch'](handleError(_0x2fcaf3,null));};exports[_0x2be4('0x48')]=function(_0x2caa7b,_0x49848f){return db[_0x2be4('0x2a')][_0x2be4('0x49')]({'where':{'id':_0x2caa7b[_0x2be4('0x43')]['id']}})[_0x2be4('0x23')](handleEntityNotFound(_0x49848f,null))['then'](removeEntity(_0x49848f,null))[_0x2be4('0x41')](handleError(_0x49848f,null));};exports[_0x2be4('0x4a')]=function(_0x489f51,_0x321a7c){return db[_0x2be4('0x2a')][_0x2be4('0x4a')]()[_0x2be4('0x23')](respondWithResult(_0x321a7c,null))['catch'](handleError(_0x321a7c,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 7a8d3d4..b84478c 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 _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 +var _0x28f2=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','mail_substatuses'];(function(_0x1f0138,_0x3254e9){var _0x52f9e0=function(_0x4e72e6){while(--_0x4e72e6){_0x1f0138['push'](_0x1f0138['shift']());}};_0x52f9e0(++_0x3254e9);}(_0x28f2,0x193));var _0x228f=function(_0x337e5f,_0x519eb3){_0x337e5f=_0x337e5f-0x0;var _0x5789fc=_0x28f2[_0x337e5f];return _0x5789fc;};'use strict';var _=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var logger=require(_0x228f('0x2'))(_0x228f('0x3'));var moment=require(_0x228f('0x4'));var BPromise=require('bluebird');var rp=require(_0x228f('0x5'));var fs=require('fs');var path=require(_0x228f('0x6'));var rimraf=require(_0x228f('0x7'));var config=require(_0x228f('0x8'));var attributes=require(_0x228f('0x9'));module[_0x228f('0xa')]=function(_0x32c5c3,_0x485423){return _0x32c5c3[_0x228f('0xb')]('MailSubstatus',attributes,{'tableName':_0x228f('0xc'),'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 96df0ea..340030e 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 _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 +var _0xb4e6=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x44b585,_0x120e48){var _0x38dd43=function(_0x2c6be7){while(--_0x2c6be7){_0x44b585['push'](_0x44b585['shift']());}};_0x38dd43(++_0x120e48);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0xe3e0af,_0x4564ed){_0xe3e0af=_0xe3e0af-0x0;var _0x4828e9=_0xb4e6[_0xe3e0af];return _0x4828e9;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var moment=require(_0x6b4e('0x1'));var BPromise=require(_0x6b4e('0x2'));var rs=require(_0x6b4e('0x3'));var fs=require('fs');var Redis=require(_0x6b4e('0x4'));var db=require(_0x6b4e('0x5'))['db'];var utils=require(_0x6b4e('0x6'));var logger=require(_0x6b4e('0x7'))('rpc');var config=require(_0x6b4e('0x8'));var jayson=require(_0x6b4e('0x9'));var client=jayson[_0x6b4e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd3138f,_0x570346,_0x4f00be){return new BPromise(function(_0x2311d9,_0x48c870){return client['request'](_0xd3138f,_0x4f00be)[_0x6b4e('0xb')](function(_0x2bd576){logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));logger[_0x6b4e('0xf')](_0x6b4e('0x10'),_0x570346,'request\x20sent',JSON[_0x6b4e('0x11')](_0x2bd576));if(_0x2bd576[_0x6b4e('0x12')]){if(_0x2bd576['error'][_0x6b4e('0x13')]===0x1f4){logger[_0x6b4e('0x12')](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);return _0x48c870(_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);}logger['error'](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')]['message']);return _0x2311d9(_0x2bd576[_0x6b4e('0x12')]['message']);}else{logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));_0x2311d9(_0x2bd576[_0x6b4e('0x15')][_0x6b4e('0x14')]);}})[_0x6b4e('0x16')](function(_0x53a934){logger['error'](_0x6b4e('0xd'),_0x570346,_0x53a934);_0x48c870(_0x53a934);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 485fab2..e8b503a 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 _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 +var _0x9efe=['/describe','describe','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index'];(function(_0x2dd4cd,_0x2c7c19){var _0x20558c=function(_0x9fdc2c){while(--_0x9fdc2c){_0x2dd4cd['push'](_0x2dd4cd['shift']());}};_0x20558c(++_0x2c7c19);}(_0x9efe,0xf9));var _0xe9ef=function(_0x28433a,_0x2b479a){_0x28433a=_0x28433a-0x0;var _0x1b9156=_0x9efe[_0x28433a];return _0x1b9156;};'use strict';var multer=require(_0xe9ef('0x0'));var util=require(_0xe9ef('0x1'));var path=require(_0xe9ef('0x2'));var timeout=require(_0xe9ef('0x3'));var express=require(_0xe9ef('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe9ef('0x5'));var config=require(_0xe9ef('0x6'));var controller=require(_0xe9ef('0x7'));router[_0xe9ef('0x8')]('/',auth[_0xe9ef('0x9')](),controller[_0xe9ef('0xa')]);router[_0xe9ef('0x8')](_0xe9ef('0xb'),auth['isAuthenticated'](),controller[_0xe9ef('0xc')]);router['get'](_0xe9ef('0xd'),auth[_0xe9ef('0x9')](),controller[_0xe9ef('0xe')]);router[_0xe9ef('0xf')]('/',auth['isAuthenticated'](),controller[_0xe9ef('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe9ef('0x11')]);router['delete']('/:id',auth[_0xe9ef('0x9')](),controller[_0xe9ef('0x12')]);module[_0xe9ef('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 106024f..477e1c9 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 _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 +var _0x61ee=['exports','ENUM','agent','queue','DATE','moment','sequelize'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x61ee,0xd0));var _0xe61e=function(_0x3181cc,_0x28447f){_0x3181cc=_0x3181cc-0x0;var _0x547a4a=_0x61ee[_0x3181cc];return _0x547a4a;};'use strict';var moment=require(_0xe61e('0x0'));var Sequelize=require(_0xe61e('0x1'));module[_0xe61e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe61e('0x3')]('account',_0xe61e('0x4'),_0xe61e('0x5')),'allowNull':![],'defaultValue':_0xe61e('0x5')},'transferredAt':{'type':Sequelize[_0xe61e('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index b125bdc..845866c 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 _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 +var _0x7980=['type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','merge','filter','count','includeAll','include','findAll','rows','catch','show','keys','length','options','create','body','find','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','MailTransferReport','rawAttributes'];(function(_0x5c64d1,_0x1920fd){var _0x29646f=function(_0x24d01c){while(--_0x24d01c){_0x5c64d1['push'](_0x5c64d1['shift']());}};_0x29646f(++_0x1920fd);}(_0x7980,0x1a6));var _0x0798=function(_0x100209,_0x3b7819){_0x100209=_0x100209-0x0;var _0x3a3fda=_0x7980[_0x100209];return _0x3a3fda;};'use strict';var pdf=require(_0x0798('0x0'));var emlformat=require(_0x0798('0x1'));var rimraf=require(_0x0798('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0798('0x3'));var rp=require(_0x0798('0x4'));var moment=require('moment');var BPromise=require(_0x0798('0x5'));var Mustache=require(_0x0798('0x6'));var util=require(_0x0798('0x7'));var path=require(_0x0798('0x8'));var sox=require(_0x0798('0x9'));var csv=require(_0x0798('0xa'));var ejs=require(_0x0798('0xb'));var fs=require('fs');var _=require(_0x0798('0xc'));var squel=require(_0x0798('0xd'));var crypto=require('crypto');var jsforce=require(_0x0798('0xe'));var deskjs=require(_0x0798('0xf'));var toCsv=require(_0x0798('0xa'));var querystring=require(_0x0798('0x10'));var Papa=require(_0x0798('0x11'));var Redis=require(_0x0798('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0798('0x13'));var as=require(_0x0798('0x14'));var hardwareService=require(_0x0798('0x15'));var logger=require(_0x0798('0x16'))(_0x0798('0x17'));var utils=require(_0x0798('0x18'));var config=require(_0x0798('0x19'));var licenseUtil=require(_0x0798('0x1a'));var db=require(_0x0798('0x1b'))['db'];function respondWithStatusCode(_0x278630,_0x11fb0b){_0x11fb0b=_0x11fb0b||0xcc;return function(_0x576008){if(_0x576008){return _0x278630['sendStatus'](_0x11fb0b);}return _0x278630[_0x0798('0x1c')](_0x11fb0b)[_0x0798('0x1d')]();};}function respondWithResult(_0x2457dd,_0x224136){_0x224136=_0x224136||0xc8;return function(_0x46a6e9){if(_0x46a6e9){return _0x2457dd[_0x0798('0x1c')](_0x224136)['json'](_0x46a6e9);}};}function respondWithFilteredResult(_0x577f39,_0x58bb11){return function(_0x2da8ea){if(_0x2da8ea){var _0xafd274=_0x2da8ea['count'],_0x247df4=_0x58bb11[_0x0798('0x1e')],_0x54accc=_0x58bb11['offset']+_0x58bb11['limit'],_0x574fb3;if(_0x54accc>=_0xafd274){_0x54accc=_0xafd274;_0x574fb3=0xc8;}else{_0x574fb3=0xce;}_0x577f39[_0x0798('0x1c')](_0x574fb3);return _0x577f39['set'](_0x0798('0x1f'),_0x247df4+'-'+_0x54accc+'/'+_0xafd274)[_0x0798('0x20')](_0x2da8ea);}return null;};}function patchUpdates(_0x496ea7){return function(_0x189971){try{jsonpatch[_0x0798('0x21')](_0x189971,_0x496ea7,!![]);}catch(_0x3eb63b){return BPromise[_0x0798('0x22')](_0x3eb63b);}return _0x189971[_0x0798('0x23')]();};}function saveUpdates(_0x38aaea,_0x288bc6){return function(_0x45e56a){if(_0x45e56a){return _0x45e56a[_0x0798('0x24')](_0x38aaea)[_0x0798('0x25')](function(_0x73f449){return _0x73f449;});}return null;};}function removeEntity(_0x9f1b98,_0x41f6c3){return function(_0x2b0f91){if(_0x2b0f91){return _0x2b0f91[_0x0798('0x26')]()[_0x0798('0x25')](function(){_0x9f1b98[_0x0798('0x1c')](0xcc)[_0x0798('0x1d')]();});}};}function handleEntityNotFound(_0x19946c,_0x444570){return function(_0x1064b4){if(!_0x1064b4){_0x19946c['sendStatus'](0x194);}return _0x1064b4;};}function handleError(_0x8df36e,_0x122f73){_0x122f73=_0x122f73||0x1f4;return function(_0x3c9da9){logger[_0x0798('0x27')](_0x3c9da9[_0x0798('0x28')]);if(_0x3c9da9[_0x0798('0x29')]){delete _0x3c9da9[_0x0798('0x29')];}_0x8df36e['status'](_0x122f73)[_0x0798('0x2a')](_0x3c9da9);};}exports[_0x0798('0x2b')]=function(_0x306e90,_0x264596){var _0x29091f={},_0x2a6eab={},_0xf26bc8={'count':0x0,'rows':[]};var _0x52a2d3=_['map'](db[_0x0798('0x2c')][_0x0798('0x2d')],function(_0x1834a1){return{'name':_0x1834a1['fieldName'],'type':_0x1834a1[_0x0798('0x2e')][_0x0798('0x2f')]};});_0x2a6eab[_0x0798('0x30')]=_[_0x0798('0x31')](_0x52a2d3,_0x0798('0x29'));_0x2a6eab[_0x0798('0x32')]=_['keys'](_0x306e90[_0x0798('0x32')]);_0x2a6eab[_0x0798('0x33')]=_[_0x0798('0x34')](_0x2a6eab[_0x0798('0x30')],_0x2a6eab['query']);_0x29091f[_0x0798('0x35')]=_[_0x0798('0x34')](_0x2a6eab['model'],qs['fields'](_0x306e90['query'][_0x0798('0x36')]));_0x29091f[_0x0798('0x35')]=_0x29091f[_0x0798('0x35')]['length']?_0x29091f['attributes']:_0x2a6eab[_0x0798('0x30')];if(!_0x306e90[_0x0798('0x32')][_0x0798('0x37')]('nolimit')){_0x29091f[_0x0798('0x38')]=qs[_0x0798('0x38')](_0x306e90[_0x0798('0x32')]['limit']);_0x29091f[_0x0798('0x1e')]=qs[_0x0798('0x1e')](_0x306e90[_0x0798('0x32')][_0x0798('0x1e')]);}_0x29091f[_0x0798('0x39')]=qs[_0x0798('0x3a')](_0x306e90[_0x0798('0x32')][_0x0798('0x3a')]);_0x29091f[_0x0798('0x3b')]=qs[_0x0798('0x33')](_[_0x0798('0x3c')](_0x306e90[_0x0798('0x32')],_0x2a6eab[_0x0798('0x33')]),_0x52a2d3);if(_0x306e90['query']['filter']){_0x29091f[_0x0798('0x3b')]=_[_0x0798('0x3d')](_0x29091f['where'],{'$or':_[_0x0798('0x31')](_0x52a2d3,function(_0x5ef881){if(_0x5ef881[_0x0798('0x2e')]!=='VIRTUAL'){var _0xa40ee7={};_0xa40ee7[_0x5ef881[_0x0798('0x29')]]={'$like':'%'+_0x306e90[_0x0798('0x32')][_0x0798('0x3e')]+'%'};return _0xa40ee7;}})});}_0x29091f=_[_0x0798('0x3d')]({},_0x29091f,_0x306e90['options']);var _0x88fab4={'where':_0x29091f[_0x0798('0x3b')]};return db['MailTransferReport'][_0x0798('0x3f')](_0x88fab4)['then'](function(_0x4d5f79){_0xf26bc8[_0x0798('0x3f')]=_0x4d5f79;if(_0x306e90[_0x0798('0x32')][_0x0798('0x40')]){_0x29091f[_0x0798('0x41')]=[{'all':!![]}];}return db[_0x0798('0x2c')][_0x0798('0x42')](_0x29091f);})[_0x0798('0x25')](function(_0x111944){_0xf26bc8[_0x0798('0x43')]=_0x111944;return _0xf26bc8;})[_0x0798('0x25')](respondWithFilteredResult(_0x264596,_0x29091f))[_0x0798('0x44')](handleError(_0x264596,null));};exports[_0x0798('0x45')]=function(_0x5a32ee,_0x37f8ca){var _0x311e75={'raw':!![],'where':{'id':_0x5a32ee['params']['id']}},_0x51a77a={};_0x51a77a[_0x0798('0x30')]=_[_0x0798('0x46')](db[_0x0798('0x2c')]['rawAttributes']);_0x51a77a[_0x0798('0x32')]=_[_0x0798('0x46')](_0x5a32ee[_0x0798('0x32')]);_0x51a77a[_0x0798('0x33')]=_['intersection'](_0x51a77a[_0x0798('0x30')],_0x51a77a[_0x0798('0x32')]);_0x311e75[_0x0798('0x35')]=_[_0x0798('0x34')](_0x51a77a[_0x0798('0x30')],qs[_0x0798('0x36')](_0x5a32ee[_0x0798('0x32')][_0x0798('0x36')]));_0x311e75[_0x0798('0x35')]=_0x311e75['attributes'][_0x0798('0x47')]?_0x311e75[_0x0798('0x35')]:_0x51a77a[_0x0798('0x30')];if(_0x5a32ee[_0x0798('0x32')]['includeAll']){_0x311e75['include']=[{'all':!![]}];}_0x311e75=_[_0x0798('0x3d')]({},_0x311e75,_0x5a32ee[_0x0798('0x48')]);return db['MailTransferReport']['find'](_0x311e75)[_0x0798('0x25')](handleEntityNotFound(_0x37f8ca,null))[_0x0798('0x25')](respondWithResult(_0x37f8ca,null))[_0x0798('0x44')](handleError(_0x37f8ca,null));};exports[_0x0798('0x49')]=function(_0x50417a,_0x19debd){return db[_0x0798('0x2c')][_0x0798('0x49')](_0x50417a[_0x0798('0x4a')],{})[_0x0798('0x25')](respondWithResult(_0x19debd,0xc9))[_0x0798('0x44')](handleError(_0x19debd,null));};exports[_0x0798('0x24')]=function(_0x53aa8d,_0x472d5f){if(_0x53aa8d[_0x0798('0x4a')]['id']){delete _0x53aa8d['body']['id'];}return db['MailTransferReport'][_0x0798('0x4b')]({'where':{'id':_0x53aa8d['params']['id']}})[_0x0798('0x25')](handleEntityNotFound(_0x472d5f,null))[_0x0798('0x25')](saveUpdates(_0x53aa8d[_0x0798('0x4a')],null))[_0x0798('0x25')](respondWithResult(_0x472d5f,null))[_0x0798('0x44')](handleError(_0x472d5f,null));};exports[_0x0798('0x26')]=function(_0x4ec713,_0x5e4261){return db[_0x0798('0x2c')][_0x0798('0x4b')]({'where':{'id':_0x4ec713[_0x0798('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5e4261,null))['then'](removeEntity(_0x5e4261,null))[_0x0798('0x44')](handleError(_0x5e4261,null));};exports[_0x0798('0x4d')]=function(_0x1baf0d,_0x3cadce){return db[_0x0798('0x2c')]['describe']()[_0x0798('0x25')](respondWithResult(_0x3cadce,null))[_0x0798('0x44')](handleError(_0x3cadce,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 0dda957..156d20e 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 _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 +var _0xe95a=['lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x14eb15,_0x5df0a8){var _0x460dab=function(_0x107e8d){while(--_0x107e8d){_0x14eb15['push'](_0x14eb15['shift']());}};_0x460dab(++_0x5df0a8);}(_0xe95a,0x168));var _0xae95=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xe95a[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xae95('0x0'));var util=require(_0xae95('0x1'));var logger=require(_0xae95('0x2'))('api');var moment=require('moment');var BPromise=require(_0xae95('0x3'));var rp=require(_0xae95('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xae95('0x5'));var attributes=require(_0xae95('0x6'));module[_0xae95('0x7')]=function(_0x3dd349,_0x26bf7b){return _0x3dd349[_0xae95('0x8')](_0xae95('0x9'),attributes,{'tableName':_0xae95('0xa'),'paranoid':![],'indexes':[{'name':_0xae95('0xb'),'fields':[_0xae95('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 15c2d43..29a7e16 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 _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 +var _0x1cb4=['bluebird','ioredis','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','MailTransferReport,\x20%s,\x20%s','message','result','catch','util','moment'];(function(_0x1457ba,_0x4952c2){var _0x3839e2=function(_0x44179b){while(--_0x44179b){_0x1457ba['push'](_0x1457ba['shift']());}};_0x3839e2(++_0x4952c2);}(_0x1cb4,0x1a0));var _0x41cb=function(_0x4a078f,_0x10f969){_0x4a078f=_0x4a078f-0x0;var _0x50f45f=_0x1cb4[_0x4a078f];return _0x50f45f;};'use strict';var _=require('lodash');var util=require(_0x41cb('0x0'));var moment=require(_0x41cb('0x1'));var BPromise=require(_0x41cb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41cb('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x41cb('0x4'));var config=require('../../config/environment');var jayson=require(_0x41cb('0x5'));var client=jayson[_0x41cb('0x6')][_0x41cb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d8430,_0x5785cd,_0x508faf){return new BPromise(function(_0xb5003a,_0x1fc9bb){return client[_0x41cb('0x8')](_0x5d8430,_0x508faf)[_0x41cb('0x9')](function(_0x228ab0){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x5785cd,_0x41cb('0xa'));logger[_0x41cb('0xb')](_0x41cb('0xc'),_0x5785cd,'request\x20sent',JSON[_0x41cb('0xd')](_0x228ab0));if(_0x228ab0['error']){if(_0x228ab0['error']['code']===0x1f4){logger[_0x41cb('0xe')](_0x41cb('0xf'),_0x5785cd,_0x228ab0[_0x41cb('0xe')][_0x41cb('0x10')]);return _0x1fc9bb(_0x228ab0['error'][_0x41cb('0x10')]);}logger[_0x41cb('0xe')](_0x41cb('0xf'),_0x5785cd,_0x228ab0[_0x41cb('0xe')][_0x41cb('0x10')]);return _0xb5003a(_0x228ab0[_0x41cb('0xe')]['message']);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x5785cd,'request\x20sent');_0xb5003a(_0x228ab0[_0x41cb('0x11')][_0x41cb('0x10')]);}})[_0x41cb('0x12')](function(_0x19917f){logger[_0x41cb('0xe')](_0x41cb('0xf'),_0x5785cd,_0x19917f);_0x1fc9bb(_0x19917f);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index e456bd6..bf3e982 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 _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 +var _0x2bdf=['put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./memberReport.controller','isAuthenticated','index','/describe','get','show','post'];(function(_0x11d695,_0x377b72){var _0x52fc15=function(_0x1a3e5b){while(--_0x1a3e5b){_0x11d695['push'](_0x11d695['shift']());}};_0x52fc15(++_0x377b72);}(_0x2bdf,0x123));var _0xf2bd=function(_0x1ad9a1,_0x5e99ed){_0x1ad9a1=_0x1ad9a1-0x0;var _0x262d00=_0x2bdf[_0x1ad9a1];return _0x262d00;};'use strict';var multer=require('multer');var util=require(_0xf2bd('0x0'));var path=require(_0xf2bd('0x1'));var timeout=require(_0xf2bd('0x2'));var express=require(_0xf2bd('0x3'));var router=express['Router']();var auth=require(_0xf2bd('0x4'));var interaction=require(_0xf2bd('0x5'));var config=require('../../config/environment');var controller=require(_0xf2bd('0x6'));router['get']('/',auth[_0xf2bd('0x7')](),controller[_0xf2bd('0x8')]);router['get'](_0xf2bd('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xf2bd('0xa')]('/:id',auth[_0xf2bd('0x7')](),controller[_0xf2bd('0xb')]);router[_0xf2bd('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf2bd('0xd')](_0xf2bd('0xe'),auth[_0xf2bd('0x7')](),controller[_0xf2bd('0xf')]);router[_0xf2bd('0x10')](_0xf2bd('0xe'),auth['isAuthenticated'](),controller[_0xf2bd('0x11')]);module[_0xf2bd('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 8fe1e8d..00956f9 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 _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 +var _0xa044=['STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','diff','seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa044,0xeb));var _0x4a04=function(_0x3569d5,_0x46185c){_0x3569d5=_0x3569d5-0x0;var _0x584ba5=_0xa044[_0x3569d5];return _0x584ba5;};'use strict';var Sequelize=require(_0x4a04('0x0'));var moment=require(_0x4a04('0x1'));module[_0x4a04('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4a04('0x3')]},'interface':{'type':Sequelize[_0x4a04('0x3')]},'type':{'type':Sequelize[_0x4a04('0x3')],'defaultValue':_0x4a04('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x4a04('0x5')]},'enterAt':{'type':Sequelize[_0x4a04('0x6')]},'exitAt':{'type':Sequelize[_0x4a04('0x6')],'set':function(_0x1bac27){var _0x56d35f=moment(_0x1bac27);var _0x383a1a=moment(this[_0x4a04('0x7')]('enterAt'));var _0x2a3aae=_0x56d35f[_0x4a04('0x8')](_0x383a1a,_0x4a04('0x9'));this['setDataValue'](_0x4a04('0xa'),_0x1bac27);this[_0x4a04('0xb')](_0x4a04('0xc'),_0x2a3aae||null);}},'data1':{'type':Sequelize[_0x4a04('0x3')],'comment':_0x4a04('0xd')},'data2':{'type':Sequelize[_0x4a04('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x4a04('0x3')],'comment':_0x4a04('0xe')},'data4':{'type':Sequelize[_0x4a04('0x3')],'comment':_0x4a04('0xf')},'data5':{'type':Sequelize[_0x4a04('0x3')],'comment':_0x4a04('0x10')},'role':{'type':Sequelize[_0x4a04('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x4a04('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 8163eae..7c1a8f1 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 _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 +var _0xed9c=['type','key','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','error','send','index','map','MemberReport','rawAttributes','fieldName'];(function(_0x5bb4e8,_0x44b756){var _0x2a86f2=function(_0x279ab2){while(--_0x279ab2){_0x5bb4e8['push'](_0x5bb4e8['shift']());}};_0x2a86f2(++_0x44b756);}(_0xed9c,0x19b));var _0xced9=function(_0x388e16,_0x44bef5){_0x388e16=_0x388e16-0x0;var _0x1896aa=_0xed9c[_0x388e16];return _0x1896aa;};'use strict';var pdf=require(_0xced9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xced9('0x1'));var zipdir=require(_0xced9('0x2'));var jsonpatch=require(_0xced9('0x3'));var rp=require(_0xced9('0x4'));var moment=require('moment');var BPromise=require(_0xced9('0x5'));var Mustache=require('mustache');var util=require(_0xced9('0x6'));var path=require(_0xced9('0x7'));var sox=require('sox');var csv=require(_0xced9('0x8'));var ejs=require(_0xced9('0x9'));var fs=require('fs');var _=require(_0xced9('0xa'));var squel=require('squel');var crypto=require(_0xced9('0xb'));var jsforce=require(_0xced9('0xc'));var deskjs=require(_0xced9('0xd'));var toCsv=require(_0xced9('0x8'));var querystring=require(_0xced9('0xe'));var Papa=require(_0xced9('0xf'));var Redis=require(_0xced9('0x10'));var authService=require(_0xced9('0x11'));var qs=require(_0xced9('0x12'));var as=require(_0xced9('0x13'));var hardwareService=require(_0xced9('0x14'));var logger=require(_0xced9('0x15'))(_0xced9('0x16'));var utils=require('../../config/utils');var config=require(_0xced9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xced9('0x18'))['db'];function respondWithStatusCode(_0x206c0e,_0x782599){_0x782599=_0x782599||0xcc;return function(_0x13c016){if(_0x13c016){return _0x206c0e[_0xced9('0x19')](_0x782599);}return _0x206c0e[_0xced9('0x1a')](_0x782599)[_0xced9('0x1b')]();};}function respondWithResult(_0xf96c88,_0x3572d9){_0x3572d9=_0x3572d9||0xc8;return function(_0x4f58c3){if(_0x4f58c3){return _0xf96c88[_0xced9('0x1a')](_0x3572d9)[_0xced9('0x1c')](_0x4f58c3);}};}function respondWithFilteredResult(_0x50b4cc,_0x52ecd1){return function(_0x13bffd){if(_0x13bffd){var _0x26bfde=_0x13bffd[_0xced9('0x1d')],_0x64be=_0x52ecd1[_0xced9('0x1e')],_0x4cae19=_0x52ecd1['offset']+_0x52ecd1[_0xced9('0x1f')],_0x3ef1b1;if(_0x4cae19>=_0x26bfde){_0x4cae19=_0x26bfde;_0x3ef1b1=0xc8;}else{_0x3ef1b1=0xce;}_0x50b4cc[_0xced9('0x1a')](_0x3ef1b1);return _0x50b4cc[_0xced9('0x20')]('Content-Range',_0x64be+'-'+_0x4cae19+'/'+_0x26bfde)[_0xced9('0x1c')](_0x13bffd);}return null;};}function patchUpdates(_0x8d2735){return function(_0x5959da){try{jsonpatch[_0xced9('0x21')](_0x5959da,_0x8d2735,!![]);}catch(_0x1610c1){return BPromise[_0xced9('0x22')](_0x1610c1);}return _0x5959da[_0xced9('0x23')]();};}function saveUpdates(_0x855afb,_0x28211a){return function(_0x248b26){if(_0x248b26){return _0x248b26['update'](_0x855afb)[_0xced9('0x24')](function(_0x53d6fc){return _0x53d6fc;});}return null;};}function removeEntity(_0x4b6c24,_0x1c6663){return function(_0x4bdbc3){if(_0x4bdbc3){return _0x4bdbc3[_0xced9('0x25')]()['then'](function(){_0x4b6c24['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x11a0f0,_0x21751d){return function(_0x109094){if(!_0x109094){_0x11a0f0['sendStatus'](0x194);}return _0x109094;};}function handleError(_0x4291e6,_0x2e7779){_0x2e7779=_0x2e7779||0x1f4;return function(_0x31ac2b){logger[_0xced9('0x26')](_0x31ac2b['stack']);if(_0x31ac2b['name']){delete _0x31ac2b['name'];}_0x4291e6[_0xced9('0x1a')](_0x2e7779)[_0xced9('0x27')](_0x31ac2b);};}exports[_0xced9('0x28')]=function(_0x5a4451,_0x4e5d3c){var _0x3d58c0={},_0x1751fd={},_0x2be809={'count':0x0,'rows':[]};var _0x482b40=_[_0xced9('0x29')](db[_0xced9('0x2a')][_0xced9('0x2b')],function(_0x5d36d9){return{'name':_0x5d36d9[_0xced9('0x2c')],'type':_0x5d36d9[_0xced9('0x2d')][_0xced9('0x2e')]};});_0x1751fd['model']=_[_0xced9('0x29')](_0x482b40,_0xced9('0x2f'));_0x1751fd[_0xced9('0x30')]=_[_0xced9('0x31')](_0x5a4451[_0xced9('0x30')]);_0x1751fd[_0xced9('0x32')]=_[_0xced9('0x33')](_0x1751fd[_0xced9('0x34')],_0x1751fd[_0xced9('0x30')]);_0x3d58c0['attributes']=_['intersection'](_0x1751fd[_0xced9('0x34')],qs[_0xced9('0x35')](_0x5a4451[_0xced9('0x30')][_0xced9('0x35')]));_0x3d58c0[_0xced9('0x36')]=_0x3d58c0[_0xced9('0x36')][_0xced9('0x37')]?_0x3d58c0[_0xced9('0x36')]:_0x1751fd['model'];if(!_0x5a4451[_0xced9('0x30')][_0xced9('0x38')](_0xced9('0x39'))){_0x3d58c0[_0xced9('0x1f')]=qs['limit'](_0x5a4451[_0xced9('0x30')][_0xced9('0x1f')]);_0x3d58c0[_0xced9('0x1e')]=qs[_0xced9('0x1e')](_0x5a4451[_0xced9('0x30')][_0xced9('0x1e')]);}_0x3d58c0[_0xced9('0x3a')]=qs[_0xced9('0x3b')](_0x5a4451[_0xced9('0x30')]['sort']);_0x3d58c0[_0xced9('0x3c')]=qs['filters'](_[_0xced9('0x3d')](_0x5a4451[_0xced9('0x30')],_0x1751fd['filters']),_0x482b40);if(_0x5a4451[_0xced9('0x30')][_0xced9('0x3e')]){_0x3d58c0[_0xced9('0x3c')]=_[_0xced9('0x3f')](_0x3d58c0[_0xced9('0x3c')],{'$or':_['map'](_0x482b40,function(_0x40bcd9){if(_0x40bcd9[_0xced9('0x2d')]!==_0xced9('0x40')){var _0x703957={};_0x703957[_0x40bcd9[_0xced9('0x2f')]]={'$like':'%'+_0x5a4451[_0xced9('0x30')][_0xced9('0x3e')]+'%'};return _0x703957;}})});}_0x3d58c0=_[_0xced9('0x3f')]({},_0x3d58c0,_0x5a4451[_0xced9('0x41')]);var _0x110d83={'where':_0x3d58c0[_0xced9('0x3c')]};return db[_0xced9('0x2a')][_0xced9('0x1d')](_0x110d83)[_0xced9('0x24')](function(_0x3bc47e){_0x2be809[_0xced9('0x1d')]=_0x3bc47e;if(_0x5a4451[_0xced9('0x30')][_0xced9('0x42')]){_0x3d58c0[_0xced9('0x43')]=[{'all':!![]}];}return db[_0xced9('0x2a')]['findAll'](_0x3d58c0);})['then'](function(_0x59469f){_0x2be809[_0xced9('0x44')]=_0x59469f;return _0x2be809;})[_0xced9('0x24')](respondWithFilteredResult(_0x4e5d3c,_0x3d58c0))[_0xced9('0x45')](handleError(_0x4e5d3c,null));};exports[_0xced9('0x46')]=function(_0x3656e5,_0x3628a1){var _0x4933c7={'raw':!![],'where':{'id':_0x3656e5['params']['id']}},_0x3b15f1={};_0x3b15f1[_0xced9('0x34')]=_[_0xced9('0x31')](db[_0xced9('0x2a')][_0xced9('0x2b')]);_0x3b15f1[_0xced9('0x30')]=_[_0xced9('0x31')](_0x3656e5[_0xced9('0x30')]);_0x3b15f1[_0xced9('0x32')]=_[_0xced9('0x33')](_0x3b15f1[_0xced9('0x34')],_0x3b15f1[_0xced9('0x30')]);_0x4933c7[_0xced9('0x36')]=_[_0xced9('0x33')](_0x3b15f1['model'],qs['fields'](_0x3656e5[_0xced9('0x30')][_0xced9('0x35')]));_0x4933c7['attributes']=_0x4933c7['attributes'][_0xced9('0x37')]?_0x4933c7[_0xced9('0x36')]:_0x3b15f1[_0xced9('0x34')];if(_0x3656e5[_0xced9('0x30')][_0xced9('0x42')]){_0x4933c7[_0xced9('0x43')]=[{'all':!![]}];}_0x4933c7=_[_0xced9('0x3f')]({},_0x4933c7,_0x3656e5[_0xced9('0x41')]);return db[_0xced9('0x2a')][_0xced9('0x47')](_0x4933c7)[_0xced9('0x24')](handleEntityNotFound(_0x3628a1,null))[_0xced9('0x24')](respondWithResult(_0x3628a1,null))['catch'](handleError(_0x3628a1,null));};exports['create']=function(_0x51b5c5,_0x3f95b8){return db['MemberReport'][_0xced9('0x48')](_0x51b5c5['body'],{})[_0xced9('0x24')](respondWithResult(_0x3f95b8,0xc9))[_0xced9('0x45')](handleError(_0x3f95b8,null));};exports['update']=function(_0x2be023,_0x1593aa){if(_0x2be023[_0xced9('0x49')]['id']){delete _0x2be023[_0xced9('0x49')]['id'];}return db[_0xced9('0x2a')][_0xced9('0x47')]({'where':{'id':_0x2be023[_0xced9('0x4a')]['id']}})[_0xced9('0x24')](handleEntityNotFound(_0x1593aa,null))[_0xced9('0x24')](saveUpdates(_0x2be023[_0xced9('0x49')],null))[_0xced9('0x24')](respondWithResult(_0x1593aa,null))[_0xced9('0x45')](handleError(_0x1593aa,null));};exports[_0xced9('0x25')]=function(_0x445637,_0x227507){return db['MemberReport']['find']({'where':{'id':_0x445637[_0xced9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x227507,null))[_0xced9('0x24')](removeEntity(_0x227507,null))['catch'](handleError(_0x227507,null));};exports['describe']=function(_0x1c7ef6,_0x5d28fd){return db[_0xced9('0x2a')][_0xced9('0x4b')]()[_0xced9('0x24')](respondWithResult(_0x5d28fd,null))[_0xced9('0x45')](handleError(_0x5d28fd,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 8129a87..7ca194b 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 _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 +var _0x188d=['define','membername_interface','membername','interface','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x25dff6,_0x534025){var _0x49dfd1=function(_0x452c74){while(--_0x452c74){_0x25dff6['push'](_0x25dff6['shift']());}};_0x49dfd1(++_0x534025);}(_0x188d,0x6c));var _0xd188=function(_0x305486,_0x24acd4){_0x305486=_0x305486-0x0;var _0xa04940=_0x188d[_0x305486];return _0xa04940;};'use strict';var _=require('lodash');var util=require(_0xd188('0x0'));var logger=require(_0xd188('0x1'))(_0xd188('0x2'));var moment=require(_0xd188('0x3'));var BPromise=require(_0xd188('0x4'));var rp=require(_0xd188('0x5'));var fs=require('fs');var path=require(_0xd188('0x6'));var rimraf=require(_0xd188('0x7'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0xd188('0x8')]=function(_0x7f5ea1,_0x395a27){return _0x7f5ea1[_0xd188('0x9')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xd188('0xa'),'fields':[_0xd188('0xb'),_0xd188('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index dfd7e72..102b98c 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 _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 +var _0xf680=['limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MemberReport','findAll','options','raw','attributes','include','map','model','GetMemberReport','stringify','CreateMemberReport','create','body','UpdateMemberReport','update','where'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xf680,0xa9));var _0x0f68=function(_0x5249f4,_0x4af9a0){_0x5249f4=_0x5249f4-0x0;var _0x554114=_0xf680[_0x5249f4];return _0x554114;};'use strict';var _=require(_0x0f68('0x0'));var util=require(_0x0f68('0x1'));var moment=require(_0x0f68('0x2'));var BPromise=require(_0x0f68('0x3'));var rs=require(_0x0f68('0x4'));var fs=require('fs');var Redis=require(_0x0f68('0x5'));var db=require(_0x0f68('0x6'))['db'];var utils=require(_0x0f68('0x7'));var logger=require(_0x0f68('0x8'))('rpc');var config=require(_0x0f68('0x9'));var jayson=require(_0x0f68('0xa'));var client=jayson[_0x0f68('0xb')][_0x0f68('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21510d,_0x46ac83,_0x20e465){return new BPromise(function(_0x46706f,_0x329523){return client[_0x0f68('0xd')](_0x21510d,_0x20e465)[_0x0f68('0xe')](function(_0x5f6032){logger[_0x0f68('0xf')](_0x0f68('0x10'),_0x46ac83,_0x0f68('0x11'));logger[_0x0f68('0x12')](_0x0f68('0x13'),_0x46ac83,_0x0f68('0x11'),JSON['stringify'](_0x5f6032));if(_0x5f6032[_0x0f68('0x14')]){if(_0x5f6032['error'][_0x0f68('0x15')]===0x1f4){logger[_0x0f68('0x14')]('MemberReport,\x20%s,\x20%s',_0x46ac83,_0x5f6032['error']['message']);return _0x329523(_0x5f6032[_0x0f68('0x14')][_0x0f68('0x16')]);}logger[_0x0f68('0x14')](_0x0f68('0x10'),_0x46ac83,_0x5f6032[_0x0f68('0x14')][_0x0f68('0x16')]);return _0x46706f(_0x5f6032['error'][_0x0f68('0x16')]);}else{logger[_0x0f68('0xf')](_0x0f68('0x10'),_0x46ac83,_0x0f68('0x11'));_0x46706f(_0x5f6032[_0x0f68('0x17')][_0x0f68('0x16')]);}})[_0x0f68('0x18')](function(_0x515299){logger[_0x0f68('0x14')](_0x0f68('0x10'),_0x46ac83,_0x515299);_0x329523(_0x515299);});});}exports['GetMemberReport']=function(_0x2f01a1){var _0x3e0853=this;return new Promise(function(_0x4477ca,_0x3ebb8c){return db[_0x0f68('0x19')][_0x0f68('0x1a')]({'raw':_0x2f01a1[_0x0f68('0x1b')]?_0x2f01a1['options'][_0x0f68('0x1c')]===undefined?!![]:![]:!![],'where':_0x2f01a1[_0x0f68('0x1b')]?_0x2f01a1[_0x0f68('0x1b')]['where']||null:null,'attributes':_0x2f01a1['options']?_0x2f01a1[_0x0f68('0x1b')][_0x0f68('0x1d')]||null:null,'limit':_0x2f01a1[_0x0f68('0x1b')]?_0x2f01a1[_0x0f68('0x1b')]['limit']||null:null,'include':_0x2f01a1['options']?_0x2f01a1[_0x0f68('0x1b')][_0x0f68('0x1e')]?_[_0x0f68('0x1f')](_0x2f01a1['options']['include'],function(_0x24c63d){return{'model':db[_0x24c63d[_0x0f68('0x20')]],'as':_0x24c63d['as'],'attributes':_0x24c63d[_0x0f68('0x1d')],'include':_0x24c63d['include']?_[_0x0f68('0x1f')](_0x24c63d[_0x0f68('0x1e')],function(_0x2abfbe){return{'model':db[_0x2abfbe[_0x0f68('0x20')]],'as':_0x2abfbe['as'],'attributes':_0x2abfbe[_0x0f68('0x1d')],'include':_0x2abfbe['include']?_[_0x0f68('0x1f')](_0x2abfbe[_0x0f68('0x1e')],function(_0x3bd44c){return{'model':db[_0x3bd44c[_0x0f68('0x20')]],'as':_0x3bd44c['as'],'attributes':_0x3bd44c['attributes']};}):[]};}):[]};}):[]:[]})[_0x0f68('0xe')](function(_0x93cf98){logger[_0x0f68('0xf')](_0x0f68('0x21'),_0x2f01a1);logger[_0x0f68('0x12')](_0x0f68('0x21'),_0x2f01a1,JSON[_0x0f68('0x22')](_0x93cf98));_0x4477ca(_0x93cf98);})['catch'](function(_0x4390ee){logger[_0x0f68('0x14')]('GetMemberReport',_0x4390ee['message'],_0x2f01a1);_0x3ebb8c(_0x3e0853[_0x0f68('0x14')](0x1f4,_0x4390ee[_0x0f68('0x16')]));});});};exports[_0x0f68('0x23')]=function(_0x9b3b){var _0x305e1c=this;return new Promise(function(_0x587526,_0x11e897){return db[_0x0f68('0x19')][_0x0f68('0x24')](_0x9b3b[_0x0f68('0x25')],{'raw':_0x9b3b[_0x0f68('0x1b')]?_0x9b3b[_0x0f68('0x1b')][_0x0f68('0x1c')]===undefined?!![]:![]:!![]})[_0x0f68('0xe')](function(_0x2c6549){logger[_0x0f68('0xf')](_0x0f68('0x23'),_0x9b3b);logger['debug'](_0x0f68('0x23'),_0x9b3b,JSON['stringify'](_0x2c6549));_0x587526(_0x2c6549);})[_0x0f68('0x18')](function(_0x5d7179){logger[_0x0f68('0x14')](_0x0f68('0x23'),_0x5d7179[_0x0f68('0x16')],_0x9b3b);_0x11e897(_0x305e1c[_0x0f68('0x14')](0x1f4,_0x5d7179[_0x0f68('0x16')]));});});};exports[_0x0f68('0x26')]=function(_0x966bf4){var _0xf19f27=this;return new Promise(function(_0x4b37d0,_0x5ee6bc){return db[_0x0f68('0x19')][_0x0f68('0x27')](_0x966bf4[_0x0f68('0x25')],{'raw':_0x966bf4[_0x0f68('0x1b')]?_0x966bf4[_0x0f68('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x966bf4[_0x0f68('0x1b')]?_0x966bf4['options'][_0x0f68('0x28')]||null:null,'attributes':_0x966bf4[_0x0f68('0x1b')]?_0x966bf4['options'][_0x0f68('0x1d')]||null:null,'limit':_0x966bf4[_0x0f68('0x1b')]?_0x966bf4['options'][_0x0f68('0x29')]||null:null})[_0x0f68('0xe')](function(_0x2710d8){logger[_0x0f68('0xf')](_0x0f68('0x26'),_0x966bf4);logger[_0x0f68('0x12')](_0x0f68('0x26'),_0x966bf4,JSON['stringify'](_0x2710d8));_0x4b37d0(_0x2710d8);})[_0x0f68('0x18')](function(_0x46ec4f){logger[_0x0f68('0x14')](_0x0f68('0x26'),_0x46ec4f[_0x0f68('0x16')],_0x966bf4);_0x5ee6bc(_0xf19f27['error'](0x1f4,_0x46ec4f[_0x0f68('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index d15449a..b9d4bf8 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 _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 +var _0xe5b5=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x31b31b,_0x5f044e){_0x31b31b=_0x31b31b-0x0;var _0x2c8fc2=_0xe5b5[_0x31b31b];return _0x2c8fc2;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var auth=require(_0x5e5b('0x6'));var interaction=require(_0x5e5b('0x7'));var config=require(_0x5e5b('0x8'));var controller=require(_0x5e5b('0x9'));router[_0x5e5b('0xa')]('/',controller[_0x5e5b('0xb')]);module[_0x5e5b('0xc')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index bb7b4fc..8c53cbf 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 _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 +var _0x17e7=['sequelize','exports','STRING','version'];(function(_0x1cfe60,_0xfdc00c){var _0x3f9bf6=function(_0x276522){while(--_0x276522){_0x1cfe60['push'](_0x1cfe60['shift']());}};_0x3f9bf6(++_0xfdc00c);}(_0x17e7,0x180));var _0x717e=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0x17e7[_0x49c057];return _0xd8f0e6;};'use strict';var Sequelize=require(_0x717e('0x0'));module[_0x717e('0x1')]={'version':{'type':Sequelize[_0x717e('0x2')],'unique':_0x717e('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 837d03e..a128469 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 _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 +var _0xc87c=['type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','json','apply','reject','then','error','stack','name','send','index','Migration','rawAttributes','fieldName'];(function(_0x3370ea,_0x4c5e63){var _0x471118=function(_0xf3290c){while(--_0xf3290c){_0x3370ea['push'](_0x3370ea['shift']());}};_0x471118(++_0x4c5e63);}(_0xc87c,0x155));var _0xcc87=function(_0x1adaa9,_0x386aa8){_0x1adaa9=_0x1adaa9-0x0;var _0x4ad6f4=_0xc87c[_0x1adaa9];return _0x4ad6f4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcc87('0x0'));var rimraf=require(_0xcc87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcc87('0x2'));var moment=require(_0xcc87('0x3'));var BPromise=require(_0xcc87('0x4'));var Mustache=require(_0xcc87('0x5'));var util=require(_0xcc87('0x6'));var path=require(_0xcc87('0x7'));var sox=require(_0xcc87('0x8'));var csv=require(_0xcc87('0x9'));var ejs=require(_0xcc87('0xa'));var fs=require('fs');var _=require(_0xcc87('0xb'));var squel=require(_0xcc87('0xc'));var crypto=require(_0xcc87('0xd'));var jsforce=require(_0xcc87('0xe'));var deskjs=require(_0xcc87('0xf'));var toCsv=require(_0xcc87('0x9'));var querystring=require(_0xcc87('0x10'));var Papa=require(_0xcc87('0x11'));var Redis=require(_0xcc87('0x12'));var authService=require(_0xcc87('0x13'));var qs=require(_0xcc87('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc87('0x15'))('api');var utils=require(_0xcc87('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcc87('0x17'));var db=require(_0xcc87('0x18'))['db'];function respondWithStatusCode(_0xf4a0fb,_0x3bccb8){_0x3bccb8=_0x3bccb8||0xcc;return function(_0x206631){if(_0x206631){return _0xf4a0fb['sendStatus'](_0x3bccb8);}return _0xf4a0fb[_0xcc87('0x19')](_0x3bccb8)[_0xcc87('0x1a')]();};}function respondWithResult(_0x1094bf,_0x1c753c){_0x1c753c=_0x1c753c||0xc8;return function(_0x55e6b4){if(_0x55e6b4){return _0x1094bf[_0xcc87('0x19')](_0x1c753c)['json'](_0x55e6b4);}};}function respondWithFilteredResult(_0x4e224c,_0x34e4f1){return function(_0x27935b){if(_0x27935b){var _0x49fcb0=_0x27935b[_0xcc87('0x1b')],_0x274139=_0x34e4f1[_0xcc87('0x1c')],_0x288b6a=_0x34e4f1[_0xcc87('0x1c')]+_0x34e4f1[_0xcc87('0x1d')],_0x5dc6cb;if(_0x288b6a>=_0x49fcb0){_0x288b6a=_0x49fcb0;_0x5dc6cb=0xc8;}else{_0x5dc6cb=0xce;}_0x4e224c[_0xcc87('0x19')](_0x5dc6cb);return _0x4e224c[_0xcc87('0x1e')]('Content-Range',_0x274139+'-'+_0x288b6a+'/'+_0x49fcb0)[_0xcc87('0x1f')](_0x27935b);}return null;};}function patchUpdates(_0x45f705){return function(_0x1dfb5e){try{jsonpatch[_0xcc87('0x20')](_0x1dfb5e,_0x45f705,!![]);}catch(_0x25aa05){return BPromise[_0xcc87('0x21')](_0x25aa05);}return _0x1dfb5e['save']();};}function saveUpdates(_0x57b19c,_0x2722b1){return function(_0x1750a9){if(_0x1750a9){return _0x1750a9['update'](_0x57b19c)[_0xcc87('0x22')](function(_0x68babf){return _0x68babf;});}return null;};}function removeEntity(_0x200cdd,_0x4b66e1){return function(_0x23ec47){if(_0x23ec47){return _0x23ec47['destroy']()[_0xcc87('0x22')](function(){_0x200cdd['status'](0xcc)[_0xcc87('0x1a')]();});}};}function handleEntityNotFound(_0x40cc81,_0x1929c7){return function(_0xd7ebb4){if(!_0xd7ebb4){_0x40cc81['sendStatus'](0x194);}return _0xd7ebb4;};}function handleError(_0x28cc15,_0x862462){_0x862462=_0x862462||0x1f4;return function(_0x3e8e43){logger[_0xcc87('0x23')](_0x3e8e43[_0xcc87('0x24')]);if(_0x3e8e43[_0xcc87('0x25')]){delete _0x3e8e43[_0xcc87('0x25')];}_0x28cc15[_0xcc87('0x19')](_0x862462)[_0xcc87('0x26')](_0x3e8e43);};}exports[_0xcc87('0x27')]=function(_0x2a0f93,_0x1d79bb){var _0x3399df={},_0x21a991={},_0x3c76a4={'count':0x0,'rows':[]};var _0x5961f5=_['map'](db[_0xcc87('0x28')][_0xcc87('0x29')],function(_0x4d8dd6){return{'name':_0x4d8dd6[_0xcc87('0x2a')],'type':_0x4d8dd6[_0xcc87('0x2b')]['key']};});_0x21a991[_0xcc87('0x2c')]=_['map'](_0x5961f5,_0xcc87('0x25'));_0x21a991[_0xcc87('0x2d')]=_[_0xcc87('0x2e')](_0x2a0f93[_0xcc87('0x2d')]);_0x21a991[_0xcc87('0x2f')]=_[_0xcc87('0x30')](_0x21a991[_0xcc87('0x2c')],_0x21a991[_0xcc87('0x2d')]);_0x3399df[_0xcc87('0x31')]=_[_0xcc87('0x30')](_0x21a991[_0xcc87('0x2c')],qs['fields'](_0x2a0f93['query']['fields']));_0x3399df[_0xcc87('0x31')]=_0x3399df['attributes'][_0xcc87('0x32')]?_0x3399df[_0xcc87('0x31')]:_0x21a991[_0xcc87('0x2c')];if(!_0x2a0f93[_0xcc87('0x2d')][_0xcc87('0x33')](_0xcc87('0x34'))){_0x3399df['limit']=qs[_0xcc87('0x1d')](_0x2a0f93['query']['limit']);_0x3399df[_0xcc87('0x1c')]=qs[_0xcc87('0x1c')](_0x2a0f93[_0xcc87('0x2d')][_0xcc87('0x1c')]);}_0x3399df[_0xcc87('0x35')]=qs[_0xcc87('0x36')](_0x2a0f93['query']['sort']);_0x3399df[_0xcc87('0x37')]=qs[_0xcc87('0x2f')](_[_0xcc87('0x38')](_0x2a0f93[_0xcc87('0x2d')],_0x21a991['filters']),_0x5961f5);if(_0x2a0f93[_0xcc87('0x2d')][_0xcc87('0x39')]){_0x3399df['where']=_[_0xcc87('0x3a')](_0x3399df[_0xcc87('0x37')],{'$or':_['map'](_0x5961f5,function(_0x15fac9){if(_0x15fac9['type']!==_0xcc87('0x3b')){var _0x30a916={};_0x30a916[_0x15fac9['name']]={'$like':'%'+_0x2a0f93[_0xcc87('0x2d')][_0xcc87('0x39')]+'%'};return _0x30a916;}})});}_0x3399df=_[_0xcc87('0x3a')]({},_0x3399df,_0x2a0f93[_0xcc87('0x3c')]);var _0xd7bc18={'where':_0x3399df[_0xcc87('0x37')]};return db[_0xcc87('0x28')][_0xcc87('0x1b')](_0xd7bc18)[_0xcc87('0x22')](function(_0x9bd57c){_0x3c76a4[_0xcc87('0x1b')]=_0x9bd57c;if(_0x2a0f93[_0xcc87('0x2d')][_0xcc87('0x3d')]){_0x3399df[_0xcc87('0x3e')]=[{'all':!![]}];}return db[_0xcc87('0x28')][_0xcc87('0x3f')](_0x3399df);})[_0xcc87('0x22')](function(_0xe17767){_0x3c76a4['rows']=_0xe17767;return _0x3c76a4;})[_0xcc87('0x22')](respondWithFilteredResult(_0x1d79bb,_0x3399df))['catch'](handleError(_0x1d79bb,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 96a435d..550656c 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 _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 +var _0xfe91=['Migration','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./migration.attributes','exports','define'];(function(_0x54a6ca,_0x12bef6){var _0x1e7a1b=function(_0x21967c){while(--_0x21967c){_0x54a6ca['push'](_0x54a6ca['shift']());}};_0x1e7a1b(++_0x12bef6);}(_0xfe91,0x175));var _0x1fe9=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0xfe91[_0x25662e];return _0x59b7bc;};'use strict';var _=require(_0x1fe9('0x0'));var util=require(_0x1fe9('0x1'));var logger=require(_0x1fe9('0x2'))(_0x1fe9('0x3'));var moment=require(_0x1fe9('0x4'));var BPromise=require('bluebird');var rp=require(_0x1fe9('0x5'));var fs=require('fs');var path=require(_0x1fe9('0x6'));var rimraf=require(_0x1fe9('0x7'));var config=require('../../config/environment');var attributes=require(_0x1fe9('0x8'));module[_0x1fe9('0x9')]=function(_0x1c3c1d,_0x4bbcd1){return _0x1c3c1d[_0x1fe9('0xa')](_0x1fe9('0xb'),attributes,{'tableName':'migrations','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 cb86f0d..b3c14d3 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 _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 +var _0xfdf1=['stringify','error','code','message','request\x20sent','result','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s'];(function(_0x518642,_0x1092c8){var _0x5c3c46=function(_0x3f5864){while(--_0x3f5864){_0x518642['push'](_0x518642['shift']());}};_0x5c3c46(++_0x1092c8);}(_0xfdf1,0xba));var _0x1fdf=function(_0x328a21,_0x4d5d05){_0x328a21=_0x328a21-0x0;var _0x5ec30f=_0xfdf1[_0x328a21];return _0x5ec30f;};'use strict';var _=require('lodash');var util=require(_0x1fdf('0x0'));var moment=require('moment');var BPromise=require(_0x1fdf('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fdf('0x2'));var db=require(_0x1fdf('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1fdf('0x4'))(_0x1fdf('0x5'));var config=require(_0x1fdf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1fdf('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13e6ac,_0x1aaeb0,_0x14864b){return new BPromise(function(_0x2c919e,_0x36f60a){return client['request'](_0x13e6ac,_0x14864b)['then'](function(_0x1367fc){logger[_0x1fdf('0x8')](_0x1fdf('0x9'),_0x1aaeb0,'request\x20sent');logger[_0x1fdf('0xa')](_0x1fdf('0xb'),_0x1aaeb0,'request\x20sent',JSON[_0x1fdf('0xc')](_0x1367fc));if(_0x1367fc[_0x1fdf('0xd')]){if(_0x1367fc[_0x1fdf('0xd')][_0x1fdf('0xe')]===0x1f4){logger[_0x1fdf('0xd')](_0x1fdf('0x9'),_0x1aaeb0,_0x1367fc[_0x1fdf('0xd')][_0x1fdf('0xf')]);return _0x36f60a(_0x1367fc[_0x1fdf('0xd')][_0x1fdf('0xf')]);}logger['error'](_0x1fdf('0x9'),_0x1aaeb0,_0x1367fc[_0x1fdf('0xd')][_0x1fdf('0xf')]);return _0x2c919e(_0x1367fc[_0x1fdf('0xd')][_0x1fdf('0xf')]);}else{logger[_0x1fdf('0x8')](_0x1fdf('0x9'),_0x1aaeb0,_0x1fdf('0x10'));_0x2c919e(_0x1367fc[_0x1fdf('0x11')][_0x1fdf('0xf')]);}})['catch'](function(_0xc4673){logger['error'](_0x1fdf('0x9'),_0x1aaeb0,_0xc4673);_0x36f60a(_0xc4673);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 5f2cad3..a8fc4b9 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 _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 +var _0x8e9b=['show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x35adc2,_0x1b6d71){var _0x4606fd=function(_0x5a7a72){while(--_0x5a7a72){_0x35adc2['push'](_0x35adc2['shift']());}};_0x4606fd(++_0x1b6d71);}(_0x8e9b,0x138));var _0xb8e9=function(_0x5c98cc,_0x58190a){_0x5c98cc=_0x5c98cc-0x0;var _0x164644=_0x8e9b[_0x5c98cc];return _0x164644;};'use strict';var multer=require(_0xb8e9('0x0'));var util=require(_0xb8e9('0x1'));var path=require(_0xb8e9('0x2'));var timeout=require(_0xb8e9('0x3'));var express=require(_0xb8e9('0x4'));var router=express[_0xb8e9('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb8e9('0x6'));var controller=require('./network.controller');router[_0xb8e9('0x7')]('/',auth[_0xb8e9('0x8')](),controller[_0xb8e9('0x9')]);router[_0xb8e9('0x7')](_0xb8e9('0xa'),auth['isAuthenticated'](),controller[_0xb8e9('0xb')]);router[_0xb8e9('0xc')]('/',auth[_0xb8e9('0x8')](),controller[_0xb8e9('0xd')]);router['put'](_0xb8e9('0xa'),auth['isAuthenticated'](),controller[_0xb8e9('0xe')]);router[_0xb8e9('0xf')](_0xb8e9('0xa'),auth[_0xb8e9('0x8')](),controller['destroy']);module[_0xb8e9('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 0d82071..47293d1 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(_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 +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0xce0f13,_0x2d200c){var _0x1c80f1=function(_0x2ec598){while(--_0x2ec598){_0xce0f13['push'](_0xce0f13['shift']());}};_0x1c80f1(++_0x2d200c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 1bba3a7..1128409 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 _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 +var _0xe791=['jayson/promise','client','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','destroy','then','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','Network','includeAll','include','findAll','rows','show','params','catch','create','sequelize','transaction','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','find','STUN','/etc/asterisk/stun_xcally.conf','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2bb0c1,_0x1d5686){var _0x11f95e=function(_0x18efe7){while(--_0x18efe7){_0x2bb0c1['push'](_0x2bb0c1['shift']());}};_0x11f95e(++_0x1d5686);}(_0xe791,0x126));var _0x1e79=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xe791[_0x18ab2a];return _0x16dcee;};'use strict';var pdf=require(_0x1e79('0x0'));var emlformat=require(_0x1e79('0x1'));var rimraf=require(_0x1e79('0x2'));var zipdir=require(_0x1e79('0x3'));var jsonpatch=require(_0x1e79('0x4'));var rp=require('request-promise');var moment=require(_0x1e79('0x5'));var BPromise=require(_0x1e79('0x6'));var Mustache=require(_0x1e79('0x7'));var util=require(_0x1e79('0x8'));var path=require(_0x1e79('0x9'));var sox=require('sox');var csv=require(_0x1e79('0xa'));var ejs=require(_0x1e79('0xb'));var fs=require('fs');var _=require(_0x1e79('0xc'));var squel=require(_0x1e79('0xd'));var crypto=require(_0x1e79('0xe'));var jsforce=require(_0x1e79('0xf'));var deskjs=require(_0x1e79('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1e79('0x11'));var Papa=require(_0x1e79('0x12'));var Redis=require(_0x1e79('0x13'));var authService=require(_0x1e79('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1e79('0x15'));var logger=require(_0x1e79('0x16'))(_0x1e79('0x17'));var utils=require(_0x1e79('0x18'));var config=require(_0x1e79('0x19'));var licenseUtil=require(_0x1e79('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0x1e79('0x1b'));var client=jayson[_0x1e79('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33009,_0x2c02ff,_0x5c85e0,_0x125dbc){return new BPromise(function(_0x599ea9,_0x2dbc31){var _0x4cc90f=_0x125dbc||client;return _0x4cc90f['request'](_0x33009,_0x5c85e0)['then'](function(_0x31c28a){logger[_0x1e79('0x1d')](_0x1e79('0x1e'),_0x2c02ff,_0x1e79('0x1f'));logger['debug'](_0x1e79('0x20'),_0x2c02ff,_0x1e79('0x1f'),JSON['stringify'](_0x31c28a));if(_0x31c28a[_0x1e79('0x21')]){if(_0x31c28a[_0x1e79('0x21')][_0x1e79('0x22')]===0x1f4){logger[_0x1e79('0x21')]('Network,\x20%s,\x20%s',_0x2c02ff,_0x31c28a[_0x1e79('0x21')][_0x1e79('0x23')]);return _0x2dbc31(_0x31c28a[_0x1e79('0x21')][_0x1e79('0x23')]);}logger[_0x1e79('0x21')](_0x1e79('0x1e'),_0x2c02ff,_0x31c28a['error'][_0x1e79('0x23')]);return _0x599ea9(_0x31c28a['error']['message']);}else{logger['info'](_0x1e79('0x1e'),_0x2c02ff,_0x1e79('0x1f'));_0x599ea9(_0x31c28a[_0x1e79('0x24')]['message']);}})['catch'](function(_0x58e1e7){logger['error'](_0x1e79('0x1e'),_0x2c02ff,_0x58e1e7);_0x2dbc31(_0x58e1e7);});});}function respondWithStatusCode(_0x1a2590,_0x3d95a9){_0x3d95a9=_0x3d95a9||0xcc;return function(_0x1030fe){if(_0x1030fe){return _0x1a2590[_0x1e79('0x25')](_0x3d95a9);}return _0x1a2590[_0x1e79('0x26')](_0x3d95a9)['end']();};}function respondWithResult(_0x1ec2cd,_0x3930f0){_0x3930f0=_0x3930f0||0xc8;return function(_0x22e1db){if(_0x22e1db){return _0x1ec2cd[_0x1e79('0x26')](_0x3930f0)[_0x1e79('0x27')](_0x22e1db);}};}function respondWithFilteredResult(_0x45f2df,_0x57875e){return function(_0x576474){if(_0x576474){var _0x43c274=_0x576474[_0x1e79('0x28')],_0x3bdaa3=_0x57875e[_0x1e79('0x29')],_0x5e01fb=_0x57875e[_0x1e79('0x29')]+_0x57875e[_0x1e79('0x2a')],_0x2d833f;if(_0x5e01fb>=_0x43c274){_0x5e01fb=_0x43c274;_0x2d833f=0xc8;}else{_0x2d833f=0xce;}_0x45f2df[_0x1e79('0x26')](_0x2d833f);return _0x45f2df['set'](_0x1e79('0x2b'),_0x3bdaa3+'-'+_0x5e01fb+'/'+_0x43c274)[_0x1e79('0x27')](_0x576474);}return null;};}function patchUpdates(_0x565dd1){return function(_0x4db088){try{jsonpatch[_0x1e79('0x2c')](_0x4db088,_0x565dd1,!![]);}catch(_0x8ce8c9){return BPromise['reject'](_0x8ce8c9);}return _0x4db088[_0x1e79('0x2d')]();};}function saveUpdates(_0x1f0c3f,_0x434e7d){return function(_0x546b4e){if(_0x546b4e){return _0x546b4e['update'](_0x1f0c3f)['then'](function(_0x42cb57){return _0x42cb57;});}return null;};}function removeEntity(_0x474058,_0x43eeff){return function(_0x562237){if(_0x562237){return _0x562237[_0x1e79('0x2e')]()[_0x1e79('0x2f')](function(){_0x474058[_0x1e79('0x26')](0xcc)[_0x1e79('0x30')]();});}};}function handleEntityNotFound(_0x57702f,_0xf4fd26){return function(_0x4accc4){if(!_0x4accc4){_0x57702f[_0x1e79('0x25')](0x194);}return _0x4accc4;};}function handleError(_0x888d84,_0x4eb59e){_0x4eb59e=_0x4eb59e||0x1f4;return function(_0xf16c9b){logger[_0x1e79('0x21')](_0xf16c9b[_0x1e79('0x31')]);if(_0xf16c9b[_0x1e79('0x32')]){delete _0xf16c9b[_0x1e79('0x32')];}_0x888d84[_0x1e79('0x26')](_0x4eb59e)[_0x1e79('0x33')](_0xf16c9b);};}exports[_0x1e79('0x34')]=function(_0x55296,_0x302c33){var _0x452918={},_0xca3806={},_0x5c0871={'count':0x0,'rows':[]};var _0x8853ad=_[_0x1e79('0x35')](db['Network'][_0x1e79('0x36')],function(_0xe370ad){return{'name':_0xe370ad[_0x1e79('0x37')],'type':_0xe370ad[_0x1e79('0x38')]['key']};});_0xca3806[_0x1e79('0x39')]=_[_0x1e79('0x35')](_0x8853ad,'name');_0xca3806[_0x1e79('0x3a')]=_[_0x1e79('0x3b')](_0x55296[_0x1e79('0x3a')]);_0xca3806['filters']=_[_0x1e79('0x3c')](_0xca3806[_0x1e79('0x39')],_0xca3806[_0x1e79('0x3a')]);_0x452918['attributes']=_['intersection'](_0xca3806[_0x1e79('0x39')],qs[_0x1e79('0x3d')](_0x55296[_0x1e79('0x3a')][_0x1e79('0x3d')]));_0x452918[_0x1e79('0x3e')]=_0x452918[_0x1e79('0x3e')][_0x1e79('0x3f')]?_0x452918[_0x1e79('0x3e')]:_0xca3806[_0x1e79('0x39')];if(!_0x55296['query']['hasOwnProperty']('nolimit')){_0x452918['limit']=qs[_0x1e79('0x2a')](_0x55296[_0x1e79('0x3a')][_0x1e79('0x2a')]);_0x452918[_0x1e79('0x29')]=qs['offset'](_0x55296[_0x1e79('0x3a')][_0x1e79('0x29')]);}_0x452918[_0x1e79('0x40')]=qs[_0x1e79('0x41')](_0x55296[_0x1e79('0x3a')][_0x1e79('0x41')]);_0x452918[_0x1e79('0x42')]=qs[_0x1e79('0x43')](_[_0x1e79('0x44')](_0x55296[_0x1e79('0x3a')],_0xca3806[_0x1e79('0x43')]),_0x8853ad);if(_0x55296[_0x1e79('0x3a')]['filter']){_0x452918[_0x1e79('0x42')]=_[_0x1e79('0x45')](_0x452918[_0x1e79('0x42')],{'$or':_[_0x1e79('0x35')](_0x8853ad,function(_0x1e4a01){if(_0x1e4a01[_0x1e79('0x38')]!==_0x1e79('0x46')){var _0x2fc165={};_0x2fc165[_0x1e4a01[_0x1e79('0x32')]]={'$like':'%'+_0x55296[_0x1e79('0x3a')][_0x1e79('0x47')]+'%'};return _0x2fc165;}})});}_0x452918=_[_0x1e79('0x45')]({},_0x452918,_0x55296[_0x1e79('0x48')]);var _0x519902={'where':_0x452918[_0x1e79('0x42')]};return db[_0x1e79('0x49')]['count'](_0x519902)[_0x1e79('0x2f')](function(_0x118c03){_0x5c0871[_0x1e79('0x28')]=_0x118c03;if(_0x55296[_0x1e79('0x3a')][_0x1e79('0x4a')]){_0x452918[_0x1e79('0x4b')]=[{'all':!![]}];}return db[_0x1e79('0x49')][_0x1e79('0x4c')](_0x452918);})['then'](function(_0x336ce2){_0x5c0871[_0x1e79('0x4d')]=_0x336ce2;return _0x5c0871;})[_0x1e79('0x2f')](respondWithFilteredResult(_0x302c33,_0x452918))['catch'](handleError(_0x302c33,null));};exports[_0x1e79('0x4e')]=function(_0x1315bc,_0x4e3d52){var _0x22369b={'raw':!![],'where':{'id':_0x1315bc[_0x1e79('0x4f')]['id']}},_0x44478a={};_0x44478a[_0x1e79('0x39')]=_[_0x1e79('0x3b')](db[_0x1e79('0x49')][_0x1e79('0x36')]);_0x44478a[_0x1e79('0x3a')]=_[_0x1e79('0x3b')](_0x1315bc['query']);_0x44478a['filters']=_[_0x1e79('0x3c')](_0x44478a[_0x1e79('0x39')],_0x44478a['query']);_0x22369b[_0x1e79('0x3e')]=_[_0x1e79('0x3c')](_0x44478a[_0x1e79('0x39')],qs[_0x1e79('0x3d')](_0x1315bc['query'][_0x1e79('0x3d')]));_0x22369b['attributes']=_0x22369b['attributes']['length']?_0x22369b['attributes']:_0x44478a[_0x1e79('0x39')];if(_0x1315bc[_0x1e79('0x3a')][_0x1e79('0x4a')]){_0x22369b[_0x1e79('0x4b')]=[{'all':!![]}];}_0x22369b=_['merge']({},_0x22369b,_0x1315bc[_0x1e79('0x48')]);return db['Network']['find'](_0x22369b)[_0x1e79('0x2f')](handleEntityNotFound(_0x4e3d52,null))[_0x1e79('0x2f')](respondWithResult(_0x4e3d52,null))[_0x1e79('0x50')](handleError(_0x4e3d52,null));};exports[_0x1e79('0x51')]=function(_0x4fd59c,_0x58debf,_0x4abf25){var _0x225c20;return db[_0x1e79('0x52')][_0x1e79('0x53')](function(_0x2c3b97){return db['Network'][_0x1e79('0x51')](_0x4fd59c[_0x1e79('0x54')],{'raw':!![]})['then'](function(_0x11e37d){_0x225c20=_0x11e37d;return db[_0x1e79('0x49')][_0x1e79('0x4c')]({'where':{'type':_0x4fd59c[_0x1e79('0x54')][_0x1e79('0x38')]},'raw':!![]});})[_0x1e79('0x2f')](function(_0x5ab988){if(_0x225c20[_0x1e79('0x38')][_0x1e79('0x55')]()=='STUN'){var _0x197947=fs[_0x1e79('0x56')](path[_0x1e79('0x57')](config[_0x1e79('0x58')],_0x1e79('0x59')),_0x1e79('0x5a'));var _0xd55bdc=ejs[_0x1e79('0x5b')](_0x197947,{'networks':_0x5ab988||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0xd55bdc);return respondWithRpcPromise(_0x1e79('0x5c'),_0x1e79('0x51'),{'module':_0x1e79('0x5d')});}else if(_0x225c20['type']['toUpperCase']()==_0x1e79('0x5e')){var _0x2a7c4a=fs['readFileSync'](path['join'](config[_0x1e79('0x58')],_0x1e79('0x5f')),_0x1e79('0x5a'));var _0x17be53=ejs[_0x1e79('0x5b')](_0x2a7c4a,{'networks':_0x5ab988||[]});fs[_0x1e79('0x60')](_0x1e79('0x61'),_0x17be53);return respondWithRpcPromise(_0x1e79('0x5c'),_0x1e79('0x51'),{'module':_0x1e79('0x5d')});}else{var _0x19b8fc=fs[_0x1e79('0x56')](path[_0x1e79('0x57')](config[_0x1e79('0x58')],_0x1e79('0x62')),_0x1e79('0x5a'));var _0x4ea524=ejs[_0x1e79('0x5b')](_0x19b8fc,{'networks':_0x5ab988||[]});fs[_0x1e79('0x60')](util[_0x1e79('0x63')](_0x1e79('0x64'),_0x4fd59c[_0x1e79('0x54')][_0x1e79('0x38')][_0x1e79('0x65')]()),_0x4ea524);return respondWithRpcPromise(_0x1e79('0x5c'),'create',{'module':_0x1e79('0x66')});}return null;})[_0x1e79('0x2f')](function(){return _0x225c20;});})[_0x1e79('0x2f')](respondWithResult(_0x58debf,0xc9))[_0x1e79('0x50')](handleError(_0x58debf,null));};exports[_0x1e79('0x67')]=function(_0x1673ac,_0x402da0,_0x5b5004){var _0x2d11d0;return db[_0x1e79('0x52')][_0x1e79('0x53')](function(_0x34c757){return db[_0x1e79('0x49')][_0x1e79('0x68')]({'where':{'id':_0x1673ac['params']['id']}})[_0x1e79('0x2f')](handleEntityNotFound(_0x402da0,null))['then'](saveUpdates(_0x1673ac[_0x1e79('0x54')],null))[_0x1e79('0x2f')](function(_0xf71b27){if(_0xf71b27){_0x2d11d0=_0xf71b27;return db['Network'][_0x1e79('0x4c')]({'where':{'type':_0x2d11d0[_0x1e79('0x38')]},'raw':!![]});}return null;})[_0x1e79('0x2f')](function(_0x46af80){if(_0x2d11d0[_0x1e79('0x38')][_0x1e79('0x55')]()==_0x1e79('0x69')){var _0x1ce35c=fs[_0x1e79('0x56')](path[_0x1e79('0x57')](config[_0x1e79('0x58')],_0x1e79('0x59')),_0x1e79('0x5a'));var _0x109728=ejs[_0x1e79('0x5b')](_0x1ce35c,{'networks':_0x46af80||[]});fs[_0x1e79('0x60')]('/etc/asterisk/stun_xcally.conf',_0x109728);return respondWithRpcPromise(_0x1e79('0x5c'),'update',{'module':_0x1e79('0x5d')});}else if(_0x2d11d0[_0x1e79('0x38')][_0x1e79('0x55')]()==_0x1e79('0x5e')){var _0x107be9=fs['readFileSync'](path[_0x1e79('0x57')](config[_0x1e79('0x58')],'server/files/templates/turn_multiple.ejs'),_0x1e79('0x5a'));var _0x3635f2=ejs[_0x1e79('0x5b')](_0x107be9,{'networks':_0x46af80||[]});fs[_0x1e79('0x60')](_0x1e79('0x61'),_0x3635f2);return respondWithRpcPromise(_0x1e79('0x5c'),_0x1e79('0x67'),{'module':_0x1e79('0x5d')});}else{var _0x1443e2=fs[_0x1e79('0x56')](path[_0x1e79('0x57')](config[_0x1e79('0x58')],'server/files/templates/network.ejs'),_0x1e79('0x5a'));var _0x4d2a68=ejs[_0x1e79('0x5b')](_0x1443e2,{'networks':_0x46af80||[]});fs['writeFileSync'](util[_0x1e79('0x63')]('/etc/asterisk/sip_xcally_%s.conf',_0x1673ac[_0x1e79('0x54')]['type']['toLowerCase']()),_0x4d2a68);return respondWithRpcPromise(_0x1e79('0x5c'),_0x1e79('0x67'),{'module':_0x1e79('0x66')});}return null;})['then'](function(_0x15f804){if(_0x15f804){return _0x2d11d0;}return null;});})['then'](respondWithResult(_0x402da0,null))[_0x1e79('0x50')](handleError(_0x402da0,null));};exports[_0x1e79('0x2e')]=function(_0xc5de57,_0xa5ce89,_0x28ceb4){var _0x322f99;return db[_0x1e79('0x49')]['find']({'where':{'id':_0xc5de57[_0x1e79('0x4f')]['id']}})[_0x1e79('0x2f')](function(_0x57824d){_0x322f99=_0x57824d;return _0x57824d;})[_0x1e79('0x2f')](handleEntityNotFound(_0xa5ce89,null))[_0x1e79('0x2f')](removeEntity(_0xa5ce89,null))[_0x1e79('0x2f')](function(){if(_0x322f99){return db[_0x1e79('0x49')][_0x1e79('0x4c')]({'where':{'type':_0x322f99[_0x1e79('0x38')]},'raw':!![]});}})['then'](function(_0x25a982){if(_0x322f99[_0x1e79('0x38')][_0x1e79('0x55')]()==_0x1e79('0x69')){var _0xa3efb1=fs[_0x1e79('0x56')](path[_0x1e79('0x57')](config['root'],_0x1e79('0x59')),_0x1e79('0x5a'));var _0x543a0a=ejs[_0x1e79('0x5b')](_0xa3efb1,{'networks':_0x25a982||[]});fs[_0x1e79('0x60')](_0x1e79('0x6a'),_0x543a0a);return respondWithRpcPromise(_0x1e79('0x5c'),_0x1e79('0x2e'),{'module':_0x1e79('0x5d')});}else if(_0x322f99[_0x1e79('0x38')][_0x1e79('0x55')]()==_0x1e79('0x5e')){var _0x4e4b1c=fs['readFileSync'](path['join'](config[_0x1e79('0x58')],_0x1e79('0x5f')),_0x1e79('0x5a'));var _0x295c71=ejs[_0x1e79('0x5b')](_0x4e4b1c,{'networks':_0x25a982||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x295c71);return respondWithRpcPromise(_0x1e79('0x5c'),_0x1e79('0x2e'),{'module':_0x1e79('0x5d')});}else{var _0x1cf337=fs[_0x1e79('0x56')](path[_0x1e79('0x57')](config['root'],'server/files/templates/network.ejs'),_0x1e79('0x5a'));var _0x37fbd9=ejs[_0x1e79('0x5b')](_0x1cf337,{'networks':_0x25a982||[]});fs[_0x1e79('0x60')](util[_0x1e79('0x63')]('/etc/asterisk/sip_xcally_%s.conf',_0xc5de57[_0x1e79('0x54')]['type'][_0x1e79('0x65')]()),_0x37fbd9);return respondWithRpcPromise(_0x1e79('0x5c'),_0x1e79('0x2e'),{'module':_0x1e79('0x66')});}return null;})[_0x1e79('0x50')](handleError(_0xa5ce89,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index cc9d636..48a4b84 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 _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 +var _0x77a8=['../../config/environment','./network.attributes','exports','define','network','lodash','util','api','bluebird','request-promise'];(function(_0x526efe,_0x481229){var _0x384c77=function(_0x477808){while(--_0x477808){_0x526efe['push'](_0x526efe['shift']());}};_0x384c77(++_0x481229);}(_0x77a8,0x127));var _0x877a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77a8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x877a('0x0'));var util=require(_0x877a('0x1'));var logger=require('../../config/logger')(_0x877a('0x2'));var moment=require('moment');var BPromise=require(_0x877a('0x3'));var rp=require(_0x877a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x877a('0x5'));var attributes=require(_0x877a('0x6'));module[_0x877a('0x7')]=function(_0x185cf0,_0x1778e1){return _0x185cf0[_0x877a('0x8')]('Network',attributes,{'tableName':_0x877a('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 42b76c2..bdd4f6e 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 _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 +var _0xf861=['request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s'];(function(_0x5524fe,_0x225c46){var _0x477ea2=function(_0x2f479c){while(--_0x2f479c){_0x5524fe['push'](_0x5524fe['shift']());}};_0x477ea2(++_0x225c46);}(_0xf861,0x125));var _0x1f86=function(_0x2d8ead,_0x3f0825){_0x2d8ead=_0x2d8ead-0x0;var _0xef6c2e=_0xf861[_0x2d8ead];return _0xef6c2e;};'use strict';var _=require(_0x1f86('0x0'));var util=require(_0x1f86('0x1'));var moment=require(_0x1f86('0x2'));var BPromise=require(_0x1f86('0x3'));var rs=require(_0x1f86('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f86('0x5'))['db'];var utils=require(_0x1f86('0x6'));var logger=require('../../config/logger')(_0x1f86('0x7'));var config=require(_0x1f86('0x8'));var jayson=require(_0x1f86('0x9'));var client=jayson[_0x1f86('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2afce9,_0x371e8c,_0x205610){return new BPromise(function(_0x3dd5ef,_0x50885f){return client[_0x1f86('0xb')](_0x2afce9,_0x205610)[_0x1f86('0xc')](function(_0x3ccd62){logger[_0x1f86('0xd')](_0x1f86('0xe'),_0x371e8c,_0x1f86('0xf'));logger[_0x1f86('0x10')]('Network,\x20%s,\x20%s,\x20%s',_0x371e8c,_0x1f86('0xf'),JSON[_0x1f86('0x11')](_0x3ccd62));if(_0x3ccd62[_0x1f86('0x12')]){if(_0x3ccd62[_0x1f86('0x12')][_0x1f86('0x13')]===0x1f4){logger[_0x1f86('0x12')](_0x1f86('0xe'),_0x371e8c,_0x3ccd62[_0x1f86('0x12')][_0x1f86('0x14')]);return _0x50885f(_0x3ccd62[_0x1f86('0x12')][_0x1f86('0x14')]);}logger[_0x1f86('0x12')](_0x1f86('0xe'),_0x371e8c,_0x3ccd62[_0x1f86('0x12')][_0x1f86('0x14')]);return _0x3dd5ef(_0x3ccd62[_0x1f86('0x12')][_0x1f86('0x14')]);}else{logger[_0x1f86('0xd')](_0x1f86('0xe'),_0x371e8c,_0x1f86('0xf'));_0x3dd5ef(_0x3ccd62[_0x1f86('0x15')][_0x1f86('0x14')]);}})['catch'](function(_0x43ee52){logger[_0x1f86('0x12')](_0x1f86('0xe'),_0x371e8c,_0x43ee52);_0x50885f(_0x43ee52);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index dde3cbe..b29da83 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 _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 +var _0x9823=['../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','multer','util','path','express','Router','../../components/interaction/service'];(function(_0x2350dd,_0x53e293){var _0x5ca2db=function(_0x5dacc7){while(--_0x5dacc7){_0x2350dd['push'](_0x2350dd['shift']());}};_0x5ca2db(++_0x53e293);}(_0x9823,0x1bd));var _0x3982=function(_0x48f537,_0x5ba858){_0x48f537=_0x48f537-0x0;var _0x22169b=_0x9823[_0x48f537];return _0x22169b;};'use strict';var multer=require(_0x3982('0x0'));var util=require(_0x3982('0x1'));var path=require(_0x3982('0x2'));var timeout=require('connect-timeout');var express=require(_0x3982('0x3'));var router=express[_0x3982('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3982('0x5'));var config=require(_0x3982('0x6'));var controller=require(_0x3982('0x7'));router[_0x3982('0x8')]('/',auth[_0x3982('0x9')](),controller[_0x3982('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 373e4cb..b64638a 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 _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 +var _0xa03f=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa03f,0xe6));var _0xfa03=function(_0x1c420f,_0x16bbed){_0x1c420f=_0x1c420f-0x0;var _0x135a3e=_0xa03f[_0x1c420f];return _0x135a3e;};'use strict';var Sequelize=require(_0xfa03('0x0'));module[_0xfa03('0x1')]={'body':{'type':Sequelize[_0xfa03('0x2')]},'senderName':{'type':Sequelize[_0xfa03('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xfa03('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 8bc2bcd..84ba69f 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 _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 +var _0xffae=['then','destroy','end','error','name','send','sendNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','some','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','join','sequelize','transaction','Notification','create','forEach','recipient','emit','notification:send','catch','text','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','startCase','model','User','union','ids','includes','queue','replace','Queue','all','flatten','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update'];(function(_0x5de214,_0x107e9d){var _0x4df627=function(_0x4199e1){while(--_0x4199e1){_0x5de214['push'](_0x5de214['shift']());}};_0x4df627(++_0x107e9d);}(_0xffae,0x175));var _0xeffa=function(_0x31dab2,_0xb9f9c){_0x31dab2=_0x31dab2-0x0;var _0x2bbae6=_0xffae[_0x31dab2];return _0x2bbae6;};'use strict';var pdf=require(_0xeffa('0x0'));var emlformat=require(_0xeffa('0x1'));var rimraf=require(_0xeffa('0x2'));var zipdir=require(_0xeffa('0x3'));var jsonpatch=require(_0xeffa('0x4'));var rp=require(_0xeffa('0x5'));var moment=require(_0xeffa('0x6'));var BPromise=require(_0xeffa('0x7'));var Mustache=require('mustache');var util=require(_0xeffa('0x8'));var path=require(_0xeffa('0x9'));var sox=require(_0xeffa('0xa'));var csv=require(_0xeffa('0xb'));var ejs=require(_0xeffa('0xc'));var fs=require('fs');var _=require(_0xeffa('0xd'));var squel=require('squel');var crypto=require(_0xeffa('0xe'));var jsforce=require(_0xeffa('0xf'));var deskjs=require(_0xeffa('0x10'));var toCsv=require(_0xeffa('0xb'));var querystring=require(_0xeffa('0x11'));var Papa=require(_0xeffa('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeffa('0x13'));var as=require(_0xeffa('0x14'));var hardwareService=require(_0xeffa('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xeffa('0x16'));var config=require(_0xeffa('0x17'));var licenseUtil=require(_0xeffa('0x18'));var db=require(_0xeffa('0x19'))['db'];config[_0xeffa('0x1a')]=_[_0xeffa('0x1b')](config[_0xeffa('0x1a')],{'host':_0xeffa('0x1c'),'port':0x18eb});var socket=require(_0xeffa('0x1d'))(new Redis(config[_0xeffa('0x1a')]));require(_0xeffa('0x1e'))[_0xeffa('0x1f')](socket);function respondWithStatusCode(_0x5e9951,_0x53e245){_0x53e245=_0x53e245||0xcc;return function(_0x16dc6d){if(_0x16dc6d){return _0x5e9951[_0xeffa('0x20')](_0x53e245);}return _0x5e9951[_0xeffa('0x21')](_0x53e245)['end']();};}function respondWithResult(_0x138682,_0x2630bb){_0x2630bb=_0x2630bb||0xc8;return function(_0x2a4b38){if(_0x2a4b38){return _0x138682['status'](_0x2630bb)['json'](_0x2a4b38);}};}function respondWithFilteredResult(_0x46c4f4,_0x661688){return function(_0x231e89){if(_0x231e89){var _0x2cc67c=_0x231e89[_0xeffa('0x22')],_0x9f1689=_0x661688[_0xeffa('0x23')],_0x54602e=_0x661688[_0xeffa('0x23')]+_0x661688['limit'],_0x2875ff;if(_0x54602e>=_0x2cc67c){_0x54602e=_0x2cc67c;_0x2875ff=0xc8;}else{_0x2875ff=0xce;}_0x46c4f4[_0xeffa('0x21')](_0x2875ff);return _0x46c4f4[_0xeffa('0x24')](_0xeffa('0x25'),_0x9f1689+'-'+_0x54602e+'/'+_0x2cc67c)[_0xeffa('0x26')](_0x231e89);}return null;};}function patchUpdates(_0x3424a6){return function(_0x54ae43){try{jsonpatch[_0xeffa('0x27')](_0x54ae43,_0x3424a6,!![]);}catch(_0x41c57b){return BPromise[_0xeffa('0x28')](_0x41c57b);}return _0x54ae43[_0xeffa('0x29')]();};}function saveUpdates(_0xb65ace,_0x585d56){return function(_0x3f9abf){if(_0x3f9abf){return _0x3f9abf[_0xeffa('0x2a')](_0xb65ace)[_0xeffa('0x2b')](function(_0x386358){return _0x386358;});}return null;};}function removeEntity(_0x4749ca,_0xa7055){return function(_0x5f3ade){if(_0x5f3ade){return _0x5f3ade[_0xeffa('0x2c')]()['then'](function(){_0x4749ca['status'](0xcc)[_0xeffa('0x2d')]();});}};}function handleEntityNotFound(_0x1d028a,_0x3aa418){return function(_0x18281c){if(!_0x18281c){_0x1d028a[_0xeffa('0x20')](0x194);}return _0x18281c;};}function handleError(_0x3217fa,_0x3c2099){_0x3c2099=_0x3c2099||0x1f4;return function(_0x2bc278){logger[_0xeffa('0x2e')](_0x2bc278['stack']);if(_0x2bc278[_0xeffa('0x2f')]){delete _0x2bc278[_0xeffa('0x2f')];}_0x3217fa[_0xeffa('0x21')](_0x3c2099)[_0xeffa('0x30')](_0x2bc278);};}exports[_0xeffa('0x31')]=function(_0x2374c4,_0x450225,_0x5670d5){if(!_0x2374c4[_0xeffa('0x32')]['hasOwnProperty']('text')&&!_0x2374c4[_0xeffa('0x32')][_0xeffa('0x33')](_0xeffa('0x34'))){throw new db[(_0xeffa('0x35'))][(_0xeffa('0x36'))](_0xeffa('0x37'));}else{if(_0x2374c4[_0xeffa('0x32')][_0xeffa('0x33')](_0xeffa('0x34'))&&!_0x2374c4['body']['hasOwnProperty'](_0xeffa('0x38'))){throw new db[(_0xeffa('0x35'))][(_0xeffa('0x36'))](_0xeffa('0x39'));}if(!_0x2374c4[_0xeffa('0x32')][_0xeffa('0x33')](_0xeffa('0x3a'))){throw new db[(_0xeffa('0x35'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x33a904=JSON[_0xeffa('0x3b')](_0x2374c4[_0xeffa('0x32')][_0xeffa('0x3a')]);}catch(_0x1fbf40){logger[_0xeffa('0x2e')](_0x1fbf40);throw new db[(_0xeffa('0x35'))][(_0xeffa('0x36'))]('Invalid\x20\x27recipients\x27\x20object');}var _0xd7911a=[_0xeffa('0x3c'),_0xeffa('0x3d'),_0xeffa('0x3e'),_0xeffa('0x3f'),_0xeffa('0x40'),'voicequeue',_0xeffa('0x41'),_0xeffa('0x42'),'user'];if(_[_0xeffa('0x43')](_0x33a904,function(_0x8b6415){return!_['includes'](_0xd7911a,_0x8b6415['model'][_0xeffa('0x44')]());})){throw new db[(_0xeffa('0x35'))][(_0xeffa('0x36'))](_0xeffa('0x45'));}}}var _0x3e72cf={};_0x3e72cf[_0xeffa('0x46')]=_0x2374c4[_0xeffa('0x32')][_0xeffa('0x33')]('senderName')?_0x2374c4[_0xeffa('0x32')][_0xeffa('0x46')]:_0x2374c4[_0xeffa('0x47')][_0xeffa('0x48')];_0x3e72cf[_0xeffa('0x49')]=_[_0xeffa('0x4a')](_0x2374c4[_0xeffa('0x32')][_0xeffa('0x49')])?null:_0x2374c4[_0xeffa('0x32')][_0xeffa('0x49')];_0x3e72cf['beep']=_0x2374c4[_0xeffa('0x32')][_0xeffa('0x4b')]||![];_0x3e72cf['SenderId']=_0x2374c4[_0xeffa('0x47')]['id'];return getContent(_0x2374c4[_0xeffa('0x32')])[_0xeffa('0x2b')](function(_0x202601){_0x3e72cf[_0xeffa('0x32')]=_0x202601;return getRecipients(_0x33a904);})[_0xeffa('0x2b')](function(_0x333283){_0x3e72cf['recipientsId']=_['sortBy'](_0x333283)[_0xeffa('0x4c')](',');return db[_0xeffa('0x4d')][_0xeffa('0x4e')](function(_0xff03cf){return db[_0xeffa('0x4f')][_0xeffa('0x50')](_0x3e72cf,{'raw':!![],'transaction':_0xff03cf})[_0xeffa('0x2b')](function(_0x76982a){var _0x16ad7b={'sender':_0x3e72cf['senderName'],'description':_0x3e72cf[_0xeffa('0x49')],'content':_0x3e72cf[_0xeffa('0x32')],'beep':_0x3e72cf[_0xeffa('0x4b')]};_0x333283[_0xeffa('0x51')](function(_0x3f21f4){_0x16ad7b[_0xeffa('0x52')]=_0x3f21f4;socket[_0xeffa('0x53')](_0xeffa('0x54'),_0x16ad7b);});return _0x76982a;});});})['then'](respondWithResult(_0x450225,0xc9))[_0xeffa('0x55')](handleError(_0x450225,null));};function getContent(_0x47b8b7){return new BPromise(function(_0x461551,_0x4453b7){if(_0x47b8b7[_0xeffa('0x56')]){_0x461551(_0x47b8b7['text']);return;}return db[_0xeffa('0x57')][_0xeffa('0x58')]({'attributes':['html'],'where':{'id':_0x47b8b7[_0xeffa('0x34')]},'raw':!![]})['then'](function(_0x44c9fb){if(!_0x44c9fb)throw new db[(_0xeffa('0x35'))][(_0xeffa('0x36'))](_0xeffa('0x59'));var _0x43d080=Mustache['render'](_0x44c9fb[_0xeffa('0x5a')],_0x47b8b7[_0xeffa('0x38')]);_0x461551(_0x43d080);})['catch'](function(_0x25b181){_0x4453b7(_0x25b181);});});}function getRecipients(_0x433e8a){return new BPromise(function(_0x5c4c8c,_0x5bef8b){var _0x5bcaef=[];var _0xadba57=[];_0x433e8a['forEach'](function(_0x2e6fec){var _0x2a6cee=_[_0xeffa('0x5b')](_0x2e6fec[_0xeffa('0x5c')]['toLowerCase']());if(_0x2a6cee===_0xeffa('0x5d')){_0x5bcaef=_[_0xeffa('0x5e')](_0x5bcaef,_0x2e6fec[_0xeffa('0x5f')]);}else{if(_[_0xeffa('0x60')](_0x2a6cee,_0xeffa('0x61')))_0x2a6cee=_0x2a6cee[_0xeffa('0x62')]('queue',_0xeffa('0x63'));_0x2e6fec[_0xeffa('0x5f')][_0xeffa('0x51')](function(_0x14af5a){_0xadba57['push'](getAgents(_0x2a6cee,_0x14af5a));});}});return BPromise[_0xeffa('0x64')](_0xadba57)[_0xeffa('0x2b')](function(_0xcbceba){_0x5bcaef=_[_0xeffa('0x5e')](_0x5bcaef,_[_0xeffa('0x65')](_0xcbceba));_0x5c4c8c(_0x5bcaef);})['catch'](function(_0x30a159){_0x5bef8b(_0x30a159);});});}function getAgents(_0x498100,_0xe5da67){return new BPromise(function(_0x80ddbd,_0x42cde4){return db[_0x498100]['findOne']({'where':{'id':_0xe5da67}})[_0xeffa('0x2b')](function(_0x5760b3){return _0x5760b3[_0xeffa('0x66')]({'attributes':['id'],'raw':!![]})[_0xeffa('0x2b')](function(_0x55bc17){var _0xc619dd=_[_0xeffa('0x67')](_0x55bc17,'id');_0x80ddbd(_0xc619dd);});})[_0xeffa('0x55')](function(_0xf6c11a){_0x42cde4(_0xf6c11a);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index b68bb95..e91d364 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 _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 +var _0xb10b=['hasOwnProperty','hook','events','Notification','setMaxListeners','save','remove','emit'];(function(_0x2e7c26,_0x23f10d){var _0x16f118=function(_0x19b1d2){while(--_0x19b1d2){_0x2e7c26['push'](_0x2e7c26['shift']());}};_0x16f118(++_0x23f10d);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a3cc7,_0x2900e3){_0x1a3cc7=_0x1a3cc7-0x0;var _0x338438=_0xb10b[_0x1a3cc7];return _0x338438;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var Notification=require('../../mysqldb')['db'][_0xbb10('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){NotificationEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);NotificationEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];Notification[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index c1ae895..8c5dc71 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 _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 +var _0x0794=['bluebird','path','../../config/environment','./notification.attributes','exports','Notification','notifications','utf8mb4','api','moment'];(function(_0x2dea94,_0x3990c0){var _0x35ad07=function(_0x21b486){while(--_0x21b486){_0x2dea94['push'](_0x2dea94['shift']());}};_0x35ad07(++_0x3990c0);}(_0x0794,0x120));var _0x4079=function(_0x36a46e,_0x112dae){_0x36a46e=_0x36a46e-0x0;var _0x1e9e8c=_0x0794[_0x36a46e];return _0x1e9e8c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x4079('0x0'));var moment=require(_0x4079('0x1'));var BPromise=require(_0x4079('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4079('0x3'));var rimraf=require('rimraf');var config=require(_0x4079('0x4'));var attributes=require(_0x4079('0x5'));module[_0x4079('0x6')]=function(_0x1089aa,_0x52ade6){return _0x1089aa['define'](_0x4079('0x7'),attributes,{'tableName':_0x4079('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4079('0x9'),'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 3e2b5bf..4f34d2a 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 _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 +var _0x2973=['Notification,\x20%s,\x20%s,\x20%s','stringify','error','code','Notification,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','./notification.socket','register','request','info','request\x20sent','debug'];(function(_0x2bc160,_0x17d80b){var _0x229cb9=function(_0x191c58){while(--_0x191c58){_0x2bc160['push'](_0x2bc160['shift']());}};_0x229cb9(++_0x17d80b);}(_0x2973,0x84));var _0x3297=function(_0x37d36f,_0x736947){_0x37d36f=_0x37d36f-0x0;var _0x285016=_0x2973[_0x37d36f];return _0x285016;};'use strict';var _=require(_0x3297('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3297('0x1'));var rs=require(_0x3297('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3297('0x3'))['db'];var utils=require(_0x3297('0x4'));var logger=require(_0x3297('0x5'))(_0x3297('0x6'));var config=require(_0x3297('0x7'));var jayson=require(_0x3297('0x8'));var client=jayson[_0x3297('0x9')][_0x3297('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x3297('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3297('0xc'))[_0x3297('0xd')](socket);function respondWithRpcPromise(_0x16cafd,_0x2f66bc,_0x421604){return new BPromise(function(_0x2bdad5,_0x138760){return client[_0x3297('0xe')](_0x16cafd,_0x421604)['then'](function(_0x518427){logger[_0x3297('0xf')]('Notification,\x20%s,\x20%s',_0x2f66bc,_0x3297('0x10'));logger[_0x3297('0x11')](_0x3297('0x12'),_0x2f66bc,'request\x20sent',JSON[_0x3297('0x13')](_0x518427));if(_0x518427['error']){if(_0x518427[_0x3297('0x14')][_0x3297('0x15')]===0x1f4){logger['error'](_0x3297('0x16'),_0x2f66bc,_0x518427['error'][_0x3297('0x17')]);return _0x138760(_0x518427[_0x3297('0x14')]['message']);}logger[_0x3297('0x14')](_0x3297('0x16'),_0x2f66bc,_0x518427[_0x3297('0x14')][_0x3297('0x17')]);return _0x2bdad5(_0x518427['error']['message']);}else{logger['info']('Notification,\x20%s,\x20%s',_0x2f66bc,_0x3297('0x10'));_0x2bdad5(_0x518427[_0x3297('0x18')][_0x3297('0x17')]);}})['catch'](function(_0x4d62d1){logger[_0x3297('0x14')](_0x3297('0x16'),_0x2f66bc,_0x4d62d1);_0x138760(_0x4d62d1);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index e354a67..3423e49 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 _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 +var _0x7e60=['save','remove','update','emit','removeListener','length','notification:'];(function(_0x2c9509,_0x159071){var _0x7125e7=function(_0x3d101f){while(--_0x3d101f){_0x2c9509['push'](_0x2c9509['shift']());}};_0x7125e7(++_0x159071);}(_0x7e60,0x85));var _0x07e6=function(_0x21642c,_0x4a4fed){_0x21642c=_0x21642c-0x0;var _0x20ec18=_0x7e60[_0x21642c];return _0x20ec18;};'use strict';var NotificationEvents=require('./notification.events');var events=[_0x07e6('0x0'),_0x07e6('0x1'),_0x07e6('0x2')];function createListener(_0x5fc764,_0x520880){return function(_0x475352){_0x520880[_0x07e6('0x3')](_0x5fc764,_0x475352);};}function removeListener(_0x313ffe,_0x4b9ac3){return function(){NotificationEvents[_0x07e6('0x4')](_0x313ffe,_0x4b9ac3);};}exports['register']=function(_0x92e5fa){for(var _0x2cc695=0x0,_0x4a501c=events[_0x07e6('0x5')];_0x2cc695<_0x4a501c;_0x2cc695++){var _0x22b1cf=events[_0x2cc695];var _0x13cd46=createListener(_0x07e6('0x6')+_0x22b1cf,_0x92e5fa);NotificationEvents['on'](_0x22b1cf,_0x13cd46);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 1a63e7d..cec783f 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 _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 +var _0xad29=['express','Router','../../config/environment','get','isAuthenticated','/describe','describe','/:id','getDispositions','/:id/canned_answers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','delete','/:id/dispositions','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x1bc9b8,_0x379fc7){var _0x1a9a13=function(_0x3a73ea){while(--_0x3a73ea){_0x1bc9b8['push'](_0x1bc9b8['shift']());}};_0x1a9a13(++_0x379fc7);}(_0xad29,0xf1));var _0x9ad2=function(_0xd5fd5c,_0x3e2a66){_0xd5fd5c=_0xd5fd5c-0x0;var _0x3b0663=_0xad29[_0xd5fd5c];return _0x3b0663;};'use strict';var multer=require(_0x9ad2('0x0'));var util=require(_0x9ad2('0x1'));var path=require(_0x9ad2('0x2'));var timeout=require(_0x9ad2('0x3'));var express=require(_0x9ad2('0x4'));var router=express[_0x9ad2('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9ad2('0x6'));var controller=require('./openchannelAccount.controller');router[_0x9ad2('0x7')]('/',auth[_0x9ad2('0x8')](),controller['index']);router['get'](_0x9ad2('0x9'),auth[_0x9ad2('0x8')](),controller[_0x9ad2('0xa')]);router[_0x9ad2('0x7')](_0x9ad2('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x9ad2('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9ad2('0xc')]);router[_0x9ad2('0x7')](_0x9ad2('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x9ad2('0x7')]('/:id/applications',auth[_0x9ad2('0x8')](),controller[_0x9ad2('0xe')]);router[_0x9ad2('0x7')](_0x9ad2('0xf'),auth[_0x9ad2('0x8')](),controller[_0x9ad2('0x10')]);router['get'](_0x9ad2('0x11'),auth[_0x9ad2('0x8')](),controller[_0x9ad2('0x12')]);router[_0x9ad2('0x13')]('/',auth['isAuthenticated'](),controller[_0x9ad2('0x14')]);router['post']('/:id/dispositions',auth[_0x9ad2('0x8')](),controller[_0x9ad2('0x15')]);router[_0x9ad2('0x13')](_0x9ad2('0xd'),auth[_0x9ad2('0x8')](),controller[_0x9ad2('0x16')]);router[_0x9ad2('0x13')](_0x9ad2('0x17'),controller[_0x9ad2('0x18')]);router[_0x9ad2('0x13')]('/:id/applications',auth[_0x9ad2('0x8')](),controller[_0x9ad2('0x19')]);router[_0x9ad2('0x13')](_0x9ad2('0x11'),auth[_0x9ad2('0x8')](),controller[_0x9ad2('0x1a')]);router[_0x9ad2('0x13')](_0x9ad2('0x1b'),auth[_0x9ad2('0x8')](),controller[_0x9ad2('0x1c')]);router[_0x9ad2('0x1d')](_0x9ad2('0xb'),auth[_0x9ad2('0x8')](),controller[_0x9ad2('0x1e')]);router[_0x9ad2('0x1f')]('/:id',auth[_0x9ad2('0x8')](),controller['destroy']);router[_0x9ad2('0x1f')](_0x9ad2('0x20'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x9ad2('0x1f')](_0x9ad2('0xd'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0x9ad2('0x11'),auth['isAuthenticated'](),controller[_0x9ad2('0x21')]);module[_0x9ad2('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index ac57fde..f1c5d5a 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 _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 +var _0xe24c=['name','STRING','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x5eb868,_0x3edfb0){var _0x278458=function(_0x266273){while(--_0x266273){_0x5eb868['push'](_0x5eb868['shift']());}};_0x278458(++_0x3edfb0);}(_0xe24c,0xad));var _0xce24=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xe24c[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0xce24('0x0'));var rs=require(_0xce24('0x1'));module[_0xce24('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xce24('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xce24('0x4')]},'token':{'type':Sequelize[_0xce24('0x4')],'defaultValue':function(){return rs[_0xce24('0x5')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xce24('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xce24('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xce24('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xce24('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xce24('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xce24('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xce24('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xce24('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xce24('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x213801){if(!_0x213801)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0xce24('0xa'),_0x213801);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index fa36581..aef94a6 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 _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 +var _0x6841=['isArray','userOpenchannelAccount:remove','getAgents','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','destroy','OpenchannelAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','user','get','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','removeAnswers','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','updatedAt','Applications','account','applications','list','orderBy','asc','from','firstName','threadId','OpenchannelInteraction','externalUrl','spread','contact','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','sequelize','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Owner','fullname','Tag','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents'];(function(_0x560408,_0x45c914){var _0x3fd4da=function(_0x47e9a9){while(--_0x47e9a9){_0x560408['push'](_0x560408['shift']());}};_0x3fd4da(++_0x45c914);}(_0x6841,0xc6));var _0x1684=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x6841[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x1684('0x0'));var emlformat=require(_0x1684('0x1'));var rimraf=require(_0x1684('0x2'));var zipdir=require(_0x1684('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1684('0x4'));var moment=require(_0x1684('0x5'));var BPromise=require(_0x1684('0x6'));var Mustache=require(_0x1684('0x7'));var util=require(_0x1684('0x8'));var path=require(_0x1684('0x9'));var sox=require('sox');var csv=require(_0x1684('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1684('0xb'));var squel=require(_0x1684('0xc'));var crypto=require('crypto');var jsforce=require(_0x1684('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1684('0xa'));var querystring=require('querystring');var Papa=require(_0x1684('0xe'));var Redis=require(_0x1684('0xf'));var authService=require(_0x1684('0x10'));var qs=require(_0x1684('0x11'));var as=require(_0x1684('0x12'));var hardwareService=require(_0x1684('0x13'));var logger=require(_0x1684('0x14'))(_0x1684('0x15'));var utils=require(_0x1684('0x16'));var config=require(_0x1684('0x17'));var licenseUtil=require(_0x1684('0x18'));var db=require(_0x1684('0x19'))['db'];config[_0x1684('0x1a')]=_['defaults'](config[_0x1684('0x1a')],{'host':_0x1684('0x1b'),'port':0x18eb});var socket=require(_0x1684('0x1c'))(new Redis(config[_0x1684('0x1a')]));require(_0x1684('0x1d'))[_0x1684('0x1e')](socket);var jayson=require(_0x1684('0x1f'));var client=jayson[_0x1684('0x20')][_0x1684('0x21')]({'port':0x232c});var client9002=jayson[_0x1684('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d2d8e,_0x4bf5a7,_0x1f08c7,_0x207a94){return new BPromise(function(_0x114d9c,_0x47ecd2){var _0x40a012=_0x207a94||client;return _0x40a012[_0x1684('0x22')](_0x3d2d8e,_0x1f08c7)[_0x1684('0x23')](function(_0xa58e46){logger[_0x1684('0x24')](_0x1684('0x25'),_0x4bf5a7,_0x1684('0x26'));logger[_0x1684('0x27')](_0x1684('0x28'),_0x4bf5a7,_0x1684('0x26'),JSON[_0x1684('0x29')](_0xa58e46));if(_0xa58e46[_0x1684('0x2a')]){if(_0xa58e46[_0x1684('0x2a')]['code']===0x1f4){logger[_0x1684('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0x4bf5a7,_0xa58e46['error'][_0x1684('0x2b')]);return _0x47ecd2(_0xa58e46[_0x1684('0x2a')]['message']);}logger[_0x1684('0x2a')](_0x1684('0x25'),_0x4bf5a7,_0xa58e46[_0x1684('0x2a')][_0x1684('0x2b')]);return _0x114d9c(_0xa58e46[_0x1684('0x2a')][_0x1684('0x2b')]);}else{logger['info'](_0x1684('0x25'),_0x4bf5a7,_0x1684('0x26'));_0x114d9c(_0xa58e46[_0x1684('0x2c')][_0x1684('0x2b')]);}})[_0x1684('0x2d')](function(_0x2f47c4){logger[_0x1684('0x2a')](_0x1684('0x25'),_0x4bf5a7,_0x2f47c4);_0x47ecd2(_0x2f47c4);});});}function respondWithStatusCode(_0xeccb17,_0x4e6d05){_0x4e6d05=_0x4e6d05||0xcc;return function(_0x1bcf11){if(_0x1bcf11){return _0xeccb17[_0x1684('0x2e')](_0x4e6d05);}return _0xeccb17[_0x1684('0x2f')](_0x4e6d05)[_0x1684('0x30')]();};}function respondWithResult(_0x4c7435,_0x347f36){_0x347f36=_0x347f36||0xc8;return function(_0x3a455a){if(_0x3a455a){return _0x4c7435[_0x1684('0x2f')](_0x347f36)['json'](_0x3a455a);}};}function respondWithFilteredResult(_0x3d3631,_0x3d511d){return function(_0x6f3b5b){if(_0x6f3b5b){var _0x3f2950=_0x6f3b5b[_0x1684('0x31')],_0x1ced91=_0x3d511d[_0x1684('0x32')],_0x14ad0a=_0x3d511d[_0x1684('0x32')]+_0x3d511d[_0x1684('0x33')],_0x37e592;if(_0x14ad0a>=_0x3f2950){_0x14ad0a=_0x3f2950;_0x37e592=0xc8;}else{_0x37e592=0xce;}_0x3d3631['status'](_0x37e592);return _0x3d3631[_0x1684('0x34')]('Content-Range',_0x1ced91+'-'+_0x14ad0a+'/'+_0x3f2950)[_0x1684('0x35')](_0x6f3b5b);}return null;};}function patchUpdates(_0x2f30b7){return function(_0x3ec84f){try{jsonpatch[_0x1684('0x36')](_0x3ec84f,_0x2f30b7,!![]);}catch(_0x5b7be1){return BPromise[_0x1684('0x37')](_0x5b7be1);}return _0x3ec84f[_0x1684('0x38')]();};}function saveUpdates(_0x2a2853,_0xaff76){return function(_0x406baa){if(_0x406baa){return _0x406baa[_0x1684('0x39')](_0x2a2853)[_0x1684('0x23')](function(_0x49b9ac){return _0x49b9ac;});}return null;};}function removeEntity(_0x1ec5cc,_0x5cdc6e){return function(_0x925eb1){if(_0x925eb1){return _0x925eb1[_0x1684('0x3a')]()['then'](function(){var _0x592180=_0x925eb1['get']({'plain':!![]});var _0x97bc12=_0x1684('0x3b');return db['UserProfileResource'][_0x1684('0x3a')]({'where':{'type':_0x97bc12,'resourceId':_0x592180['id']}})[_0x1684('0x23')](function(){return _0x925eb1;});})['then'](function(){_0x1ec5cc[_0x1684('0x2f')](0xcc)[_0x1684('0x30')]();});}};}function handleEntityNotFound(_0x1f9a31,_0x170fa2){return function(_0x84af15){if(!_0x84af15){_0x1f9a31[_0x1684('0x2e')](0x194);}return _0x84af15;};}function handleError(_0x83df73,_0x210f30){_0x210f30=_0x210f30||0x1f4;return function(_0x3cda34){logger['error'](_0x3cda34[_0x1684('0x3c')]);if(_0x3cda34[_0x1684('0x3d')]){delete _0x3cda34[_0x1684('0x3d')];}_0x83df73[_0x1684('0x2f')](_0x210f30)[_0x1684('0x3e')](_0x3cda34);};}exports[_0x1684('0x3f')]=function(_0x15c447,_0x24917b){var _0x477eb9={'include':[{'model':db[_0x1684('0x40')],'as':_0x1684('0x41')}]},_0x6f8397={},_0x43239b={'count':0x0,'rows':[]};var _0x19bb0c=_['map'](db[_0x1684('0x42')][_0x1684('0x43')],function(_0x2b40a2){return{'name':_0x2b40a2[_0x1684('0x44')],'type':_0x2b40a2[_0x1684('0x45')][_0x1684('0x46')]};});_0x6f8397[_0x1684('0x47')]=_[_0x1684('0x48')](_0x19bb0c,'name');_0x6f8397['query']=_[_0x1684('0x49')](_0x15c447[_0x1684('0x4a')]);_0x6f8397[_0x1684('0x4b')]=_[_0x1684('0x4c')](_0x6f8397['model'],_0x6f8397[_0x1684('0x4a')]);_0x477eb9[_0x1684('0x4d')]=_['intersection'](_0x6f8397['model'],qs[_0x1684('0x4e')](_0x15c447[_0x1684('0x4a')][_0x1684('0x4e')]));_0x477eb9[_0x1684('0x4d')]=_0x477eb9[_0x1684('0x4d')][_0x1684('0x4f')]?_0x477eb9['attributes']:_0x6f8397[_0x1684('0x47')];if(!_0x15c447['query'][_0x1684('0x50')](_0x1684('0x51'))){_0x477eb9[_0x1684('0x33')]=qs[_0x1684('0x33')](_0x15c447[_0x1684('0x4a')]['limit']);_0x477eb9[_0x1684('0x32')]=qs['offset'](_0x15c447['query'][_0x1684('0x32')]);}_0x477eb9[_0x1684('0x52')]=qs[_0x1684('0x53')](_0x15c447[_0x1684('0x4a')][_0x1684('0x53')]);_0x477eb9[_0x1684('0x54')]=qs['filters'](_['pick'](_0x15c447['query'],_0x6f8397[_0x1684('0x4b')]),_0x19bb0c);if(_0x15c447['query'][_0x1684('0x55')]){_0x477eb9[_0x1684('0x54')]=_[_0x1684('0x56')](_0x477eb9[_0x1684('0x54')],{'$or':_[_0x1684('0x48')](_0x19bb0c,function(_0x577ec6){if(_0x577ec6[_0x1684('0x45')]!==_0x1684('0x57')){var _0x4d2def={};_0x4d2def[_0x577ec6[_0x1684('0x3d')]]={'$like':'%'+_0x15c447['query']['filter']+'%'};return _0x4d2def;}})});}_0x477eb9=_[_0x1684('0x56')]({},_0x477eb9,_0x15c447['options']);var _0x4c1a07={'where':_0x477eb9[_0x1684('0x54')]};return db[_0x1684('0x42')]['count'](_0x4c1a07)[_0x1684('0x23')](function(_0x3e5178){_0x43239b[_0x1684('0x31')]=_0x3e5178;if(_0x15c447['query'][_0x1684('0x58')]){_0x477eb9[_0x1684('0x59')]=[{'all':!![]}];}return db[_0x1684('0x42')][_0x1684('0x5a')](_0x477eb9);})[_0x1684('0x23')](function(_0xc18011){_0x43239b[_0x1684('0x5b')]=_0xc18011;return _0x43239b;})[_0x1684('0x23')](respondWithFilteredResult(_0x24917b,_0x477eb9))['catch'](handleError(_0x24917b,null));};exports[_0x1684('0x5c')]=function(_0x383478,_0x5a8331){var _0x331052={'raw':![],'where':{'id':_0x383478[_0x1684('0x5d')]['id']},'include':[{'model':db[_0x1684('0x40')],'as':'mandatoryDispositionPause'}]},_0x595ebe={};_0x595ebe[_0x1684('0x47')]=_['keys'](db[_0x1684('0x42')][_0x1684('0x43')]);_0x595ebe['query']=_[_0x1684('0x49')](_0x383478[_0x1684('0x4a')]);_0x595ebe[_0x1684('0x4b')]=_[_0x1684('0x4c')](_0x595ebe['model'],_0x595ebe[_0x1684('0x4a')]);_0x331052[_0x1684('0x4d')]=_[_0x1684('0x4c')](_0x595ebe['model'],qs[_0x1684('0x4e')](_0x383478['query'][_0x1684('0x4e')]));_0x331052[_0x1684('0x4d')]=_0x331052[_0x1684('0x4d')][_0x1684('0x4f')]?_0x331052['attributes']:_0x595ebe['model'];if(_0x383478[_0x1684('0x4a')][_0x1684('0x58')]){_0x331052['include']=[{'all':!![]}];}_0x331052=_[_0x1684('0x56')]({},_0x331052,_0x383478[_0x1684('0x5e')]);return db[_0x1684('0x42')][_0x1684('0x5f')](_0x331052)[_0x1684('0x23')](handleEntityNotFound(_0x5a8331,null))[_0x1684('0x23')](respondWithResult(_0x5a8331,null))['catch'](handleError(_0x5a8331,null));};exports[_0x1684('0x60')]=function(_0x4a961a,_0x2d65bb){return db[_0x1684('0x42')][_0x1684('0x60')](_0x4a961a['body'],{})[_0x1684('0x23')](function(_0x1c3cd3){var _0x489e20=_0x4a961a[_0x1684('0x61')][_0x1684('0x62')]({'plain':!![]});if(!_0x489e20)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x489e20[_0x1684('0x63')]===_0x1684('0x61')){var _0x4365d6=_0x1c3cd3[_0x1684('0x62')]({'plain':!![]});var _0x31eadc=_0x1684('0x3b');return db[_0x1684('0x64')]['find']({'where':{'name':_0x31eadc,'userProfileId':_0x489e20['userProfileId']},'raw':!![]})[_0x1684('0x23')](function(_0x462e49){if(_0x462e49&&_0x462e49[_0x1684('0x65')]===0x0){return db[_0x1684('0x66')][_0x1684('0x60')]({'name':_0x4365d6['name'],'resourceId':_0x4365d6['id'],'type':_0x462e49[_0x1684('0x3d')],'sectionId':_0x462e49['id']},{})[_0x1684('0x23')](function(){return _0x1c3cd3;});}else{return _0x1c3cd3;}})[_0x1684('0x2d')](function(_0x43ee25){logger['error'](_0x1684('0x67'),_0x43ee25);throw _0x43ee25;});}return _0x1c3cd3;})[_0x1684('0x23')](respondWithResult(_0x2d65bb,0xc9))[_0x1684('0x2d')](handleError(_0x2d65bb,null));};exports[_0x1684('0x39')]=function(_0x1e40a6,_0x3e0658){if(_0x1e40a6['body']['id']){delete _0x1e40a6['body']['id'];}return db[_0x1684('0x42')]['find']({'where':{'id':_0x1e40a6['params']['id']},'include':[{'model':db[_0x1684('0x40')],'as':'mandatoryDispositionPause'}]})[_0x1684('0x23')](handleEntityNotFound(_0x3e0658,null))[_0x1684('0x23')](saveUpdates(_0x1e40a6[_0x1684('0x68')],null))[_0x1684('0x23')](respondWithResult(_0x3e0658,null))[_0x1684('0x2d')](handleError(_0x3e0658,null));};exports[_0x1684('0x3a')]=function(_0x3e6cac,_0x320654){return db[_0x1684('0x42')][_0x1684('0x5f')]({'where':{'id':_0x3e6cac[_0x1684('0x5d')]['id']}})['then'](handleEntityNotFound(_0x320654,null))['then'](removeEntity(_0x320654,null))[_0x1684('0x2d')](handleError(_0x320654,null));};exports['describe']=function(_0x24cd7e,_0x31b5b8){return db[_0x1684('0x42')][_0x1684('0x69')]()[_0x1684('0x23')](respondWithResult(_0x31b5b8,null))['catch'](handleError(_0x31b5b8,null));};exports[_0x1684('0x6a')]=function(_0x12ac8d,_0x511c92,_0x31be9c){if(_0x12ac8d[_0x1684('0x68')]['id']){delete _0x12ac8d[_0x1684('0x68')]['id'];}return db[_0x1684('0x42')][_0x1684('0x5f')]({'where':{'id':_0x12ac8d[_0x1684('0x5d')]['id']}})['then'](handleEntityNotFound(_0x511c92,null))[_0x1684('0x23')](function(_0xdee80c){if(_0xdee80c){_0x12ac8d[_0x1684('0x68')]['OpenchannelAccountId']=_0xdee80c['id'];return db[_0x1684('0x6b')][_0x1684('0x60')](_0x12ac8d[_0x1684('0x68')]);}})[_0x1684('0x23')](respondWithResult(_0x511c92,null))[_0x1684('0x2d')](handleError(_0x511c92,null));};exports[_0x1684('0x6c')]=function(_0x553276,_0x11a751,_0x45a92c){var _0x4a1071={'raw':![],'where':{}};var _0x39206b={};var _0x537b12={'count':0x0,'rows':[]};return db[_0x1684('0x42')][_0x1684('0x6d')]({'where':{'id':_0x553276['params']['id']}})[_0x1684('0x23')](handleEntityNotFound(_0x11a751,null))[_0x1684('0x23')](function(_0x2ee7a1){if(_0x2ee7a1){_0x39206b[_0x1684('0x47')]=_['keys'](db['Disposition']['rawAttributes']);_0x39206b[_0x1684('0x4a')]=_[_0x1684('0x49')](_0x553276[_0x1684('0x4a')]);_0x39206b['filters']=_[_0x1684('0x4c')](_0x39206b['model'],_0x39206b[_0x1684('0x4a')]);_0x4a1071[_0x1684('0x4d')]=_['intersection'](_0x39206b[_0x1684('0x47')],qs[_0x1684('0x4e')](_0x553276[_0x1684('0x4a')][_0x1684('0x4e')]));_0x4a1071[_0x1684('0x4d')]=_0x4a1071['attributes'][_0x1684('0x4f')]?_0x4a1071['attributes']:_0x39206b['model'];if(!_0x553276['query'][_0x1684('0x50')](_0x1684('0x51'))){_0x4a1071[_0x1684('0x33')]=qs[_0x1684('0x33')](_0x553276[_0x1684('0x4a')][_0x1684('0x33')]);_0x4a1071['offset']=qs[_0x1684('0x32')](_0x553276[_0x1684('0x4a')][_0x1684('0x32')]);}_0x4a1071['order']=qs[_0x1684('0x53')](_0x553276[_0x1684('0x4a')][_0x1684('0x53')]);_0x4a1071[_0x1684('0x54')]=qs[_0x1684('0x4b')](_[_0x1684('0x6e')](_0x553276[_0x1684('0x4a')],_0x39206b['filters']));_0x4a1071[_0x1684('0x54')]['OpenchannelAccountId']=_0x2ee7a1['id'];if(_0x553276[_0x1684('0x4a')]['filter']){_0x4a1071[_0x1684('0x54')]=_[_0x1684('0x56')](_0x4a1071[_0x1684('0x54')],{'$or':_['map'](_0x4a1071[_0x1684('0x4d')],function(_0x469219){var _0x53361a={};_0x53361a[_0x469219]={'$like':'%'+_0x553276[_0x1684('0x4a')][_0x1684('0x55')]+'%'};return _0x53361a;})});}_0x4a1071=_[_0x1684('0x56')]({},_0x4a1071,_0x553276[_0x1684('0x5e')]);return db[_0x1684('0x6b')][_0x1684('0x31')]({'where':_0x4a1071[_0x1684('0x54')]})[_0x1684('0x23')](function(_0x23dc17){_0x537b12[_0x1684('0x31')]=_0x23dc17;if(_0x553276[_0x1684('0x4a')][_0x1684('0x58')]){_0x4a1071[_0x1684('0x59')]=[{'all':!![]}];}return db[_0x1684('0x6b')][_0x1684('0x5a')](_0x4a1071);})[_0x1684('0x23')](function(_0x551dde){_0x537b12[_0x1684('0x5b')]=_0x551dde;return _0x537b12;});}})[_0x1684('0x23')](respondWithFilteredResult(_0x11a751,_0x4a1071))[_0x1684('0x2d')](handleError(_0x11a751,null));};exports[_0x1684('0x6f')]=function(_0xb591a9,_0xd2d32f,_0x15e021){return db['OpenchannelAccount'][_0x1684('0x5f')]({'where':{'id':_0xb591a9[_0x1684('0x5d')]['id']}})['then'](handleEntityNotFound(_0xd2d32f,null))[_0x1684('0x23')](function(_0x3de41b){if(_0x3de41b){return _0x3de41b['removeDispositions'](_0xb591a9[_0x1684('0x4a')][_0x1684('0x70')]);}})[_0x1684('0x23')](respondWithStatusCode(_0xd2d32f,null))['catch'](handleError(_0xd2d32f,null));};exports[_0x1684('0x71')]=function(_0x4e0308,_0x4907f3,_0x422db2){if(_0x4e0308['body']['id']){delete _0x4e0308[_0x1684('0x68')]['id'];}return db[_0x1684('0x42')][_0x1684('0x5f')]({'where':{'id':_0x4e0308[_0x1684('0x5d')]['id']}})[_0x1684('0x23')](handleEntityNotFound(_0x4907f3,null))[_0x1684('0x23')](function(_0x2cb9e7){if(_0x2cb9e7){_0x4e0308[_0x1684('0x68')][_0x1684('0x72')]=_0x2cb9e7['id'];return db[_0x1684('0x73')][_0x1684('0x60')](_0x4e0308[_0x1684('0x68')]);}})[_0x1684('0x23')](respondWithResult(_0x4907f3,null))['catch'](handleError(_0x4907f3,null));};exports['getAnswers']=function(_0xf06d1a,_0x1a8b84,_0x3a5867){var _0x295b6e={'raw':![],'where':{}};var _0x20587a={};var _0x43a312={'count':0x0,'rows':[]};return db[_0x1684('0x42')][_0x1684('0x6d')]({'where':{'id':_0xf06d1a[_0x1684('0x5d')]['id']}})[_0x1684('0x23')](handleEntityNotFound(_0x1a8b84,null))[_0x1684('0x23')](function(_0x44ac48){if(_0x44ac48){_0x20587a['model']=_[_0x1684('0x49')](db[_0x1684('0x73')]['rawAttributes']);_0x20587a[_0x1684('0x4a')]=_[_0x1684('0x49')](_0xf06d1a[_0x1684('0x4a')]);_0x20587a[_0x1684('0x4b')]=_['intersection'](_0x20587a['model'],_0x20587a['query']);_0x295b6e[_0x1684('0x4d')]=_[_0x1684('0x4c')](_0x20587a[_0x1684('0x47')],qs[_0x1684('0x4e')](_0xf06d1a[_0x1684('0x4a')]['fields']));_0x295b6e[_0x1684('0x4d')]=_0x295b6e[_0x1684('0x4d')][_0x1684('0x4f')]?_0x295b6e[_0x1684('0x4d')]:_0x20587a[_0x1684('0x47')];if(!_0xf06d1a[_0x1684('0x4a')][_0x1684('0x50')]('nolimit')){_0x295b6e[_0x1684('0x33')]=qs['limit'](_0xf06d1a[_0x1684('0x4a')]['limit']);_0x295b6e['offset']=qs['offset'](_0xf06d1a['query']['offset']);}_0x295b6e[_0x1684('0x52')]=qs['sort'](_0xf06d1a['query'][_0x1684('0x53')]);_0x295b6e[_0x1684('0x54')]=qs[_0x1684('0x4b')](_[_0x1684('0x6e')](_0xf06d1a['query'],_0x20587a['filters']));_0x295b6e[_0x1684('0x54')][_0x1684('0x72')]=_0x44ac48['id'];if(_0xf06d1a[_0x1684('0x4a')][_0x1684('0x55')]){_0x295b6e['where']=_[_0x1684('0x56')](_0x295b6e[_0x1684('0x54')],{'$or':_[_0x1684('0x48')](_0x295b6e['attributes'],function(_0x1f070e){var _0x55f122={};_0x55f122[_0x1f070e]={'$like':'%'+_0xf06d1a['query'][_0x1684('0x55')]+'%'};return _0x55f122;})});}_0x295b6e=_['merge']({},_0x295b6e,_0xf06d1a[_0x1684('0x5e')]);return db['CannedAnswer'][_0x1684('0x31')]({'where':_0x295b6e['where']})['then'](function(_0x449449){_0x43a312[_0x1684('0x31')]=_0x449449;if(_0xf06d1a[_0x1684('0x4a')][_0x1684('0x58')]){_0x295b6e[_0x1684('0x59')]=[{'all':!![]}];}return db[_0x1684('0x73')][_0x1684('0x5a')](_0x295b6e);})[_0x1684('0x23')](function(_0xe48e4b){_0x43a312[_0x1684('0x5b')]=_0xe48e4b;return _0x43a312;});}})[_0x1684('0x23')](respondWithFilteredResult(_0x1a8b84,_0x295b6e))[_0x1684('0x2d')](handleError(_0x1a8b84,null));};exports[_0x1684('0x74')]=function(_0x2570c9,_0x3f020b,_0x1a90d3){return db[_0x1684('0x42')]['find']({'where':{'id':_0x2570c9[_0x1684('0x5d')]['id']}})[_0x1684('0x23')](handleEntityNotFound(_0x3f020b,null))[_0x1684('0x23')](function(_0x1b9a49){if(_0x1b9a49){return _0x1b9a49[_0x1684('0x74')](_0x2570c9['query'][_0x1684('0x70')]);}})[_0x1684('0x23')](respondWithStatusCode(_0x3f020b,null))[_0x1684('0x2d')](handleError(_0x3f020b,null));};exports[_0x1684('0x75')]=function(_0x6d6304,_0x46e538,_0x336a4b){var _0xdebd7b={'body':_0x6d6304['body'],'channel':_0x1684('0x76')};var _0x485ebb=[];var _0xf83ebd=[];var _0x167d45={};var _0x3f79d4=![];return db[_0x1684('0x77')]['describe']()['then'](function(_0x47ca6a){if(!_0x47ca6a){throw new db['Sequelize'][(_0x1684('0x78'))](_0x1684('0x79'));}_0x485ebb=_[_0x1684('0x7a')](_[_0x1684('0x49')](_0x47ca6a),[_0x1684('0x7b'),'updatedAt']);_0xf83ebd=_['difference'](_[_0x1684('0x49')](_0x47ca6a),['createdAt','updatedAt',_0x1684('0x7c'),_0x1684('0x7d')]);if(_0x6d6304['body']['id']){delete _0x6d6304['body']['id'];}if(_[_0x1684('0x7e')](_0x6d6304[_0x1684('0x68')]['from'])){throw new db[(_0x1684('0x7f'))][(_0x1684('0x78'))](_0x1684('0x80'));}if(_[_0x1684('0x7e')](_0x6d6304[_0x1684('0x68')][_0x1684('0x68')])||_0x6d6304[_0x1684('0x68')]['body']===''){throw new db[(_0x1684('0x7f'))][(_0x1684('0x78'))](_0x1684('0x81'));}if(_[_0x1684('0x7e')](_0x6d6304[_0x1684('0x68')][_0x1684('0x82')])){throw new db[(_0x1684('0x7f'))][(_0x1684('0x78'))](_0x1684('0x83')+_0xf83ebd);}if(!_[_0x1684('0x84')](_0xf83ebd,_0x6d6304['body'][_0x1684('0x82')])){throw new db['Sequelize'][(_0x1684('0x78'))](_0x1684('0x85')+_0xf83ebd);}_0x167d45[_0x6d6304['body'][_0x1684('0x82')]]=_0x6d6304[_0x1684('0x68')]['from'];})[_0x1684('0x23')](function(){return db['OpenchannelAccount'][_0x1684('0x5f')]({'where':{'id':_0x6d6304[_0x1684('0x5d')]['id']},'include':[{'model':db[_0x1684('0x86')],'as':_0x1684('0x87'),'include':[{'model':db[_0x1684('0x77')],'as':_0x1684('0x88'),'where':_0x167d45,'limit':0x1,'order':[[_0x1684('0x89'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x1684('0x8a')}]});})[_0x1684('0x23')](handleEntityNotFound(_0x46e538,null))['then'](function(_0x1bdc7c){if(_0x1bdc7c&&_0x1bdc7c['List']){_0xdebd7b[_0x1684('0x8b')]=_0x1bdc7c;_0xdebd7b[_0x1684('0x8c')]=_0x1bdc7c[_0x1684('0x8a')];_0xdebd7b[_0x1684('0x8d')]=_0x1bdc7c[_0x1684('0x87')];_0xdebd7b['applications']=_[_0x1684('0x8e')](_0xdebd7b['applications'],['priority'],[_0x1684('0x8f')]);if(_0xdebd7b[_0x1684('0x8b')]['Applications']){delete _0xdebd7b[_0x1684('0x8b')][_0x1684('0x8a')];}if(_0xdebd7b['account'][_0x1684('0x87')]&&_0xdebd7b[_0x1684('0x8b')][_0x1684('0x87')][_0x1684('0x88')][_0x1684('0x4f')]){return _0xdebd7b['account']['List']['Contacts'][0x0];}var _0x59cafd=_['defaults'](_0x6d6304[_0x1684('0x68')],{'firstName':_0x6d6304['body']['from'],'ListId':_0x1bdc7c[_0x1684('0x7d')]});_0x59cafd[_0x6d6304[_0x1684('0x68')][_0x1684('0x82')]]=_0x6d6304[_0x1684('0x68')][_0x1684('0x90')];return db[_0x1684('0x77')][_0x1684('0x60')](_0x59cafd,{'fields':_0x485ebb,'raw':!![]});}})['then'](handleEntityNotFound(_0x46e538,null))[_0x1684('0x23')](function(_0x11d44c){_0xdebd7b['contact']=_0x11d44c;if(_0x11d44c){var _0x32c129={'ContactId':_0x11d44c['id'],'OpenchannelAccountId':_0x6d6304[_0x1684('0x5d')]['id'],'from':(_0x11d44c[_0x1684('0x91')]||'')+'\x20'+(_0x11d44c['lastName']||'')};var _0x5a6944={'OpenchannelAccountId':_0x6d6304[_0x1684('0x5d')]['id'],'closed':![]};if(_0x6d6304[_0x1684('0x68')][_0x1684('0x92')]){_0x5a6944['threadId']=_0x6d6304[_0x1684('0x68')][_0x1684('0x92')];return db[_0x1684('0x93')][_0x1684('0x5f')]({'where':_0x5a6944})['then'](function(_0x18251e){if(_0x18251e){return[_0x18251e,![]];}_0x32c129[_0x1684('0x92')]=_0x6d6304[_0x1684('0x68')][_0x1684('0x92')];_0x32c129[_0x1684('0x94')]=_0x6d6304[_0x1684('0x68')][_0x1684('0x94')];return db['OpenchannelInteraction'][_0x1684('0x60')](_0x32c129)[_0x1684('0x23')](function(_0x3782e4){return[_0x3782e4,!![]];});});}else{_0x5a6944[_0x1684('0x92')]=null;}_0x5a6944['ContactId']=_0x11d44c['id'];return db[_0x1684('0x93')][_0x1684('0x5f')]({'where':_0x5a6944})[_0x1684('0x23')](function(_0x297826){if(_0x297826){return[_0x297826,![]];}return db[_0x1684('0x93')][_0x1684('0x60')](_0x32c129)[_0x1684('0x23')](function(_0x51a211){return[_0x51a211,!![]];});});}})[_0x1684('0x95')](function(_0x4d0e7a,_0x5a7016){if(_0x4d0e7a){_0x3f79d4=_0x5a7016;if(!_0x5a7016){var _0x1c7bbf={'from':(_0xdebd7b[_0x1684('0x96')][_0x1684('0x91')]||'')+'\x20'+(_0xdebd7b['contact'][_0x1684('0x97')]||'')};if(_0x6d6304[_0x1684('0x68')][_0x1684('0x92')]&&_0x6d6304[_0x1684('0x68')][_0x1684('0x98')]&&_0x6d6304[_0x1684('0x68')]['threadId']!=_0x6d6304[_0x1684('0x68')]['messageId']){_0x1c7bbf[_0x1684('0x92')]=_0x6d6304[_0x1684('0x68')][_0x1684('0x98')];}return _0x4d0e7a['update'](_0x1c7bbf);}else{return _0x4d0e7a;}}})[_0x1684('0x23')](function(_0x1c3071){_0xdebd7b['interaction']=_0x1c3071[_0x1684('0x62')]({'plain':!![]});_0xdebd7b[_0x1684('0x99')][_0x1684('0x9a')]=_0x3f79d4;if(_0xdebd7b[_0x1684('0x99')]['created']){if(_0xdebd7b[_0x1684('0x8b')][_0x1684('0x9b')]){_0xdebd7b['applications'][_0x1684('0x9c')]({'id':0x0,'priority':_0xdebd7b['applications'][_0x1684('0x4f')]+0x1,'app':_0x1684('0x9d'),'appdata':_0x1684('0x9e'),'interval':_0x1684('0x9f')});}}return db[_0x1684('0xa0')][_0x1684('0x60')]({'body':_0x6d6304['body'][_0x1684('0x68')],'OpenchannelAccountId':_0x6d6304[_0x1684('0x5d')]['id'],'OpenchannelInteractionId':_0x1c3071['id'],'direction':'in','ContactId':_0xdebd7b[_0x1684('0x96')]['id'],'AttachmentId':_0x6d6304[_0x1684('0x68')][_0x1684('0xa1')]});})[_0x1684('0x23')](function(_0x2b7b98){_0xdebd7b['message']=_0x2b7b98;if(_0xdebd7b[_0x1684('0x99')][_0x1684('0xa2')]){return db[_0x1684('0xa3')]['find']({'attributes':['id',_0x1684('0x3d')],'where':{'id':_0xdebd7b[_0x1684('0x99')][_0x1684('0xa2')]}})[_0x1684('0x23')](function(_0x3393cd){if(_0x3393cd){_0xdebd7b[_0x1684('0x8c')][_0x1684('0xa4')]({'id':0x0,'priority':0x0,'app':_0x1684('0xa5'),'appdata':_0x3393cd['name']+','+(_0xdebd7b['account']['waitForTheAssignedAgent']||0xa),'interval':_0x1684('0x9f')});_0xdebd7b[_0x1684('0xa6')]=![];}return respondWithRpcPromise(_0x1684('0xa7'),'startRouting',_0xdebd7b);});}return respondWithRpcPromise(_0x1684('0xa7'),_0x1684('0xa8'),_0xdebd7b);})[_0x1684('0x23')](function(_0x383de8){respondWithRpcPromise('EventManager',_0x1684('0xa9'),{'event':_0x1684('0x75'),'message':_0x383de8},client9002);return _0x383de8;})[_0x1684('0x23')](respondWithResult(_0x46e538,null))[_0x1684('0x2d')](handleError(_0x46e538,null));};exports['addApplications']=function(_0x3599ae,_0x269d7e,_0x20ccfe){return db['OpenchannelAccount'][_0x1684('0x6d')]({'where':{'id':_0x3599ae[_0x1684('0x5d')]['id']}})[_0x1684('0x23')](handleEntityNotFound(_0x269d7e,null))[_0x1684('0x23')](function(_0x320bbc){if(_0x320bbc){return db[_0x1684('0xaa')][_0x1684('0xab')](function(_0x4a813a){return db[_0x1684('0xac')]['destroy']({'where':{'OpenchannelAccountId':_0x3599ae[_0x1684('0x5d')]['id']},'transaction':_0x4a813a})[_0x1684('0x23')](function(_0x330801){var _0x4d8c43=_[_0x1684('0x48')](_0x3599ae['body'],function(_0x1140dc){_0x1140dc[_0x1684('0x72')]=_0x3599ae['params']['id'];return _0x1140dc;});return db[_0x1684('0xac')][_0x1684('0xad')](_0x4d8c43,{'transaction':_0x4a813a});});})['then'](function(){return db['OpenchannelApplication'][_0x1684('0xae')]({'where':{'OpenchannelAccountId':_0x3599ae[_0x1684('0x5d')]['id']},'order':_0x1684('0xaf')});});}})[_0x1684('0x23')](respondWithResult(_0x269d7e,null))[_0x1684('0x2d')](handleError(_0x269d7e,null));};exports[_0x1684('0xb0')]=function(_0x3df921,_0x4dfbf0,_0x495e6b){var _0x46c786={};var _0x1ab9a3={};var _0x5823db;var _0x5b82a9;return db[_0x1684('0x42')][_0x1684('0x6d')]({'where':{'id':_0x3df921['params']['id']}})[_0x1684('0x23')](handleEntityNotFound(_0x4dfbf0,null))[_0x1684('0x23')](function(_0x4d4747){if(_0x4d4747){_0x5823db=_0x4d4747;_0x1ab9a3[_0x1684('0x47')]=_[_0x1684('0x49')](db['OpenchannelApplication'][_0x1684('0x43')]);_0x1ab9a3[_0x1684('0x4a')]=_[_0x1684('0x49')](_0x3df921[_0x1684('0x4a')]);_0x1ab9a3[_0x1684('0x4b')]=_['intersection'](_0x1ab9a3[_0x1684('0x47')],_0x1ab9a3[_0x1684('0x4a')]);_0x46c786['attributes']=_[_0x1684('0x4c')](_0x1ab9a3[_0x1684('0x47')],qs[_0x1684('0x4e')](_0x3df921['query'][_0x1684('0x4e')]));_0x46c786['attributes']=_0x46c786[_0x1684('0x4d')][_0x1684('0x4f')]?_0x46c786[_0x1684('0x4d')]:_0x1ab9a3['model'];_0x46c786[_0x1684('0x52')]=qs[_0x1684('0x53')](_0x3df921[_0x1684('0x4a')]['sort']);_0x46c786[_0x1684('0x54')]=qs[_0x1684('0x4b')](_[_0x1684('0x6e')](_0x3df921[_0x1684('0x4a')],_0x1ab9a3['filters']));if(_0x3df921[_0x1684('0x4a')][_0x1684('0x55')]){_0x46c786[_0x1684('0x54')]=_['merge'](_0x46c786[_0x1684('0x54')],{'$or':_[_0x1684('0x48')](_0x46c786[_0x1684('0x4d')],function(_0x4527e2){var _0x1f436b={};_0x1f436b[_0x4527e2]={'$like':'%'+_0x3df921[_0x1684('0x4a')][_0x1684('0x55')]+'%'};return _0x1f436b;})});}_0x46c786=_[_0x1684('0x56')]({},_0x46c786,_0x3df921['options']);return _0x5823db[_0x1684('0xb0')](_0x46c786);}})[_0x1684('0x23')](function(_0x541a07){if(_0x541a07){_0x5b82a9=_0x541a07['length'];if(!_0x3df921[_0x1684('0x4a')][_0x1684('0x50')]('nolimit')){_0x46c786['limit']=qs['limit'](_0x3df921[_0x1684('0x4a')][_0x1684('0x33')]);_0x46c786['offset']=qs[_0x1684('0x32')](_0x3df921[_0x1684('0x4a')][_0x1684('0x32')]);}return _0x5823db[_0x1684('0xb0')](_0x46c786);}})[_0x1684('0x23')](function(_0x2be538){if(_0x2be538){return _0x2be538?{'count':_0x5b82a9,'rows':_0x2be538}:null;}})['then'](respondWithResult(_0x4dfbf0,null))[_0x1684('0x2d')](handleError(_0x4dfbf0,null));};exports[_0x1684('0xb1')]=function(_0xe5784d,_0x3a50be,_0x46f38c){var _0x52fc77={'raw':![],'where':{}};var _0xfc48ca={};var _0x19f6ad={'count':0x0,'rows':[]};return db[_0x1684('0x42')][_0x1684('0x6d')]({'where':{'id':_0xe5784d[_0x1684('0x5d')]['id']}})[_0x1684('0x23')](handleEntityNotFound(_0x3a50be,null))[_0x1684('0x23')](function(_0x26ee88){if(_0x26ee88){_0xfc48ca[_0x1684('0x47')]=_[_0x1684('0x49')](db[_0x1684('0x93')][_0x1684('0x43')]);_0xfc48ca['query']=_[_0x1684('0x49')](_0xe5784d[_0x1684('0x4a')]);_0xfc48ca[_0x1684('0x4b')]=_['intersection'](_0xfc48ca[_0x1684('0x47')],_0xfc48ca[_0x1684('0x4a')]);_0x52fc77[_0x1684('0x4d')]=_[_0x1684('0x4c')](_0xfc48ca['model'],qs[_0x1684('0x4e')](_0xe5784d[_0x1684('0x4a')]['fields']));_0x52fc77[_0x1684('0x4d')]=_0x52fc77[_0x1684('0x4d')][_0x1684('0x4f')]?_0x52fc77[_0x1684('0x4d')]:_0xfc48ca[_0x1684('0x47')];if(!_0xe5784d[_0x1684('0x4a')][_0x1684('0x50')](_0x1684('0x51'))){_0x52fc77[_0x1684('0x33')]=qs['limit'](_0xe5784d[_0x1684('0x4a')]['limit']);_0x52fc77['offset']=qs[_0x1684('0x32')](_0xe5784d[_0x1684('0x4a')][_0x1684('0x32')]);}_0x52fc77[_0x1684('0x52')]=qs[_0x1684('0x53')](_0xe5784d[_0x1684('0x4a')][_0x1684('0x53')]);_0x52fc77[_0x1684('0x54')]=qs[_0x1684('0x4b')](_['pick'](_0xe5784d[_0x1684('0x4a')],_0xfc48ca[_0x1684('0x4b')]));_0x52fc77[_0x1684('0x54')][_0x1684('0x72')]=_0x26ee88['id'];if(_0xe5784d[_0x1684('0x4a')]['filter']){_0x52fc77['where']=_['merge'](_0x52fc77[_0x1684('0x54')],{'$or':_[_0x1684('0x48')](_0x52fc77[_0x1684('0x4d')],function(_0xf76270){var _0x2fa2e0={};_0x2fa2e0[_0xf76270]={'$like':'%'+_0xe5784d[_0x1684('0x4a')][_0x1684('0x55')]+'%'};return _0x2fa2e0;})});}_0x52fc77=_[_0x1684('0x56')]({},_0x52fc77,_0xe5784d[_0x1684('0x5e')]);return db[_0x1684('0x93')][_0x1684('0x31')]({'where':_0x52fc77[_0x1684('0x54')]})['then'](function(_0x5bf814){_0x19f6ad[_0x1684('0x31')]=_0x5bf814;if(_0xe5784d['query'][_0x1684('0x58')]){_0x52fc77[_0x1684('0x59')]=[{'model':db[_0x1684('0x77')],'as':'Contact','required':![]},{'model':db[_0x1684('0xa3')],'as':_0x1684('0xb2'),'attributes':['name',_0x1684('0xb3'),'internal'],'required':![]},{'model':db[_0x1684('0xb4')],'as':_0x1684('0xb5'),'attributes':['id',_0x1684('0x3d'),_0x1684('0xb6')],'where':_0xe5784d[_0x1684('0x4a')][_0x1684('0xb7')]?{'id':_0xe5784d[_0x1684('0x4a')][_0x1684('0xb7')]}:undefined,'required':_0xe5784d['query'][_0x1684('0xb7')]?!![]:![]}];}return db[_0x1684('0x93')][_0x1684('0x5a')](_0x52fc77);})[_0x1684('0x23')](function(_0x7ee7b8){_0x19f6ad['rows']=_0x7ee7b8;return _0x19f6ad;});}})['then'](respondWithFilteredResult(_0x3a50be,_0x52fc77))[_0x1684('0x2d')](handleError(_0x3a50be,null));};exports[_0x1684('0xb8')]=function(_0x4d8784,_0x51f0db,_0x4156c8){return db[_0x1684('0x42')][_0x1684('0x5f')]({'where':{'id':_0x4d8784[_0x1684('0x5d')]['id']}})[_0x1684('0x23')](handleEntityNotFound(_0x51f0db,null))[_0x1684('0x23')](function(_0x3fadb6){if(_0x3fadb6){return _0x3fadb6[_0x1684('0xb8')](_0x4d8784[_0x1684('0x68')][_0x1684('0x70')],_['omit'](_0x4d8784[_0x1684('0x68')],[_0x1684('0x70'),'id'])||{})['spread'](function(_0x19962b){for(var _0x499312=0x0;_0x499312<_0x4d8784[_0x1684('0x68')]['ids'][_0x1684('0x4f')];_0x499312+=0x1){socket[_0x1684('0xb9')](_0x1684('0xba'),{'UserId':_0x4d8784[_0x1684('0x68')][_0x1684('0x70')][_0x499312],'OpenchannelAccountId':_0x4d8784[_0x1684('0x5d')]['id']});}return _0x19962b;});}})['then'](respondWithResult(_0x51f0db,null))[_0x1684('0x2d')](handleError(_0x51f0db,null));};exports[_0x1684('0xbb')]=function(_0x434a9f,_0x5d0e3a,_0x7c3dde){return db[_0x1684('0x42')]['find']({'where':{'id':_0x434a9f['params']['id']}})[_0x1684('0x23')](handleEntityNotFound(_0x5d0e3a,null))[_0x1684('0x23')](function(_0x4e3ee5){if(_0x4e3ee5){return _0x4e3ee5['removeAgents'](_0x434a9f[_0x1684('0x4a')][_0x1684('0x70')])[_0x1684('0x23')](function(){if(_[_0x1684('0xbc')](_0x434a9f['query'][_0x1684('0x70')])){for(var _0x2b3a3e=0x0;_0x2b3a3e<_0x434a9f['query'][_0x1684('0x70')]['length'];_0x2b3a3e+=0x1){socket[_0x1684('0xb9')](_0x1684('0xbd'),{'UserId':Number(_0x434a9f[_0x1684('0x4a')][_0x1684('0x70')][_0x2b3a3e]),'OpenchannelAccountId':Number(_0x434a9f[_0x1684('0x5d')]['id'])});}}else{socket[_0x1684('0xb9')]('userOpenchannelAccount:remove',{'UserId':Number(_0x434a9f[_0x1684('0x4a')][_0x1684('0x70')]),'OpenchannelAccountId':Number(_0x434a9f[_0x1684('0x5d')]['id'])});}});}})[_0x1684('0x23')](respondWithStatusCode(_0x5d0e3a,null))[_0x1684('0x2d')](handleError(_0x5d0e3a,null));};exports['getAgents']=function(_0xbec258,_0x52d315,_0x2a28bc){var _0x194a03={};var _0x283a03={};var _0x14082a;var _0x8c6c8a;return db[_0x1684('0x42')][_0x1684('0x6d')]({'where':{'id':_0xbec258['params']['id']}})['then'](handleEntityNotFound(_0x52d315,null))[_0x1684('0x23')](function(_0x16ab59){if(_0x16ab59){_0x14082a=_0x16ab59;_0x283a03[_0x1684('0x47')]=_[_0x1684('0x49')](db[_0x1684('0xa3')][_0x1684('0x43')]);_0x283a03['query']=_[_0x1684('0x49')](_0xbec258['query']);_0x283a03['filters']=_[_0x1684('0x4c')](_0x283a03[_0x1684('0x47')],_0x283a03[_0x1684('0x4a')]);_0x194a03[_0x1684('0x4d')]=_['intersection'](_0x283a03[_0x1684('0x47')],qs[_0x1684('0x4e')](_0xbec258['query']['fields']));_0x194a03[_0x1684('0x4d')]=_0x194a03[_0x1684('0x4d')]['length']?_0x194a03[_0x1684('0x4d')]:_0x283a03['model'];_0x194a03[_0x1684('0x52')]=qs[_0x1684('0x53')](_0xbec258['query'][_0x1684('0x53')]);_0x194a03[_0x1684('0x54')]=qs[_0x1684('0x4b')](_[_0x1684('0x6e')](_0xbec258[_0x1684('0x4a')],_0x283a03[_0x1684('0x4b')]));if(_0xbec258[_0x1684('0x4a')][_0x1684('0x55')]){_0x194a03[_0x1684('0x54')]=_[_0x1684('0x56')](_0x194a03[_0x1684('0x54')],{'$or':_[_0x1684('0x48')](_0x194a03[_0x1684('0x4d')],function(_0x39078d){var _0x163b7d={};_0x163b7d[_0x39078d]={'$like':'%'+_0xbec258[_0x1684('0x4a')][_0x1684('0x55')]+'%'};return _0x163b7d;})});}_0x194a03=_[_0x1684('0x56')]({},_0x194a03,_0xbec258[_0x1684('0x5e')]);return _0x14082a['getAgents'](_0x194a03);}})[_0x1684('0x23')](function(_0x30b481){if(_0x30b481){_0x8c6c8a=_0x30b481[_0x1684('0x4f')];if(!_0xbec258[_0x1684('0x4a')][_0x1684('0x50')](_0x1684('0x51'))){_0x194a03[_0x1684('0x33')]=qs[_0x1684('0x33')](_0xbec258[_0x1684('0x4a')]['limit']);_0x194a03[_0x1684('0x32')]=qs[_0x1684('0x32')](_0xbec258[_0x1684('0x4a')][_0x1684('0x32')]);}return _0x14082a[_0x1684('0xbe')](_0x194a03);}})[_0x1684('0x23')](function(_0x4fd790){if(_0x4fd790){return _0x4fd790?{'count':_0x8c6c8a,'rows':_0x4fd790}:null;}})['then'](respondWithResult(_0x52d315,null))[_0x1684('0x2d')](handleError(_0x52d315,null));};exports[_0x1684('0x3e')]=function(_0x1a652a,_0x550d03,_0x451fd9){var _0x54dd71,_0x36b53b,_0x3166cf;if(_[_0x1684('0x7e')](_0x1a652a['body'][_0x1684('0x68')])||_0x1a652a['body'][_0x1684('0x68')]===''){throw new db[(_0x1684('0x7f'))][(_0x1684('0x78'))](_0x1684('0x81'));}if(_[_0x1684('0x7e')](_0x1a652a[_0x1684('0x68')]['to'])){}_0x54dd71=_0x1a652a[_0x1684('0x68')]['to'];return db[_0x1684('0x42')][_0x1684('0x6d')]({'where':{'id':_0x1a652a[_0x1684('0x5d')]['id']}})[_0x1684('0x23')](handleEntityNotFound(_0x550d03,null))[_0x1684('0x23')](function(_0x5da043){if(_0x5da043){return db['OpenchannelAccount'][_0x1684('0x5f')]({'where':{'id':_0x5da043['id']},'include':[{'model':db[_0x1684('0x86')],'as':_0x1684('0x87'),'include':[{'model':db['CmContact'],'as':_0x1684('0x88'),'where':{[_0x5da043[_0x1684('0x82')]]:_0x54dd71},'limit':0x1,'order':[[_0x1684('0x89'),'DESC']]}]}]})[_0x1684('0x23')](handleEntityNotFound(_0x550d03,null))['then'](function(_0x47c12f){if(_0x47c12f&&_0x47c12f[_0x1684('0x87')]){_0x36b53b=_0x47c12f[_0x1684('0x62')]({'plain':!![]});if(_0x36b53b['List']&&_0x36b53b['List'][_0x1684('0x88')][_0x1684('0x4f')]){return _0x36b53b[_0x1684('0x87')][_0x1684('0x88')][0x0];}return db[_0x1684('0x77')][_0x1684('0x60')](_['defaults'](_0x1a652a[_0x1684('0x68')],{'firstName':_0x54dd71,[_0x47c12f[_0x1684('0x82')]]:_0x54dd71,'phone':_0x54dd71,'ListId':_0x36b53b[_0x1684('0x7d')]}));}})['then'](handleEntityNotFound(_0x550d03,null))[_0x1684('0x23')](function(_0x21e553){if(_0x21e553){_0x3166cf=_0x21e553;return db[_0x1684('0x93')][_0x1684('0x5f')]({'where':{'ContactId':_0x3166cf['id'],'closed':![],'OpenchannelAccountId':_0x36b53b['id']}})[_0x1684('0x23')](function(_0x9c53ff){if(_0x9c53ff){return[_0x9c53ff,![]];}return db[_0x1684('0x93')][_0x1684('0x60')]({'UserId':_0x1a652a[_0x1684('0x61')]['id'],'ContactId':_0x3166cf['id'],'OpenchannelAccountId':_0x36b53b['id'],'lastMsgDirection':'out','Messages':[_['merge'](_0x1a652a[_0x1684('0x68')],{'read':![],'body':_0x1a652a[_0x1684('0x68')][_0x1684('0x68')],'OpenchannelAccountId':_0x36b53b['id'],'UserId':_0x1a652a['user']['id'],'ContactId':_0x3166cf['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x1684('0xbf')}]})[_0x1684('0x23')](function(_0x5653a4){return[_0x5653a4,!![]];});});}})[_0x1684('0x95')](function(_0x5100f1,_0x459555){if(_0x459555){return _0x5100f1;}return db[_0x1684('0xa0')][_0x1684('0x60')](_[_0x1684('0x56')](_0x1a652a[_0x1684('0x68')],{'read':![],'body':_0x1a652a[_0x1684('0x68')][_0x1684('0x68')],'OpenchannelAccountId':_0x36b53b['id'],'OpenchannelInteractionId':_0x5100f1['id'],'UserId':_0x1a652a[_0x1684('0x61')]['id'],'ContactId':_0x3166cf['id']}))[_0x1684('0x23')](function(_0x1471cc){_0x5100f1[_0x1684('0xc0')][_0x1684('0xbf')]=[];_0x5100f1[_0x1684('0xc0')][_0x1684('0xbf')]['push'](_0x1471cc['dataValues']);return _0x5100f1;});});}})[_0x1684('0x23')](respondWithResult(_0x550d03,null))[_0x1684('0x2d')](handleError(_0x550d03,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 27d4c2f..23f7c30 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 _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 +var _0xc49f=['emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount','save','update','remove'];(function(_0x4912ca,_0x1345b0){var _0x1b8006=function(_0x232d71){while(--_0x232d71){_0x4912ca['push'](_0x4912ca['shift']());}};_0x1b8006(++_0x1345b0);}(_0xc49f,0x150));var _0xfc49=function(_0x230daa,_0x2d4dd0){_0x230daa=_0x230daa-0x0;var _0x210dc5=_0xc49f[_0x230daa];return _0x210dc5;};'use strict';var EventEmitter=require(_0xfc49('0x0'));var OpenchannelAccount=require(_0xfc49('0x1'))['db'][_0xfc49('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfc49('0x3'),'afterUpdate':_0xfc49('0x4'),'afterDestroy':_0xfc49('0x5')};function emitEvent(_0x44a170){return function(_0x23bc10,_0x431148,_0x9b27c3){OpenchannelAccountEvents[_0xfc49('0x6')](_0x44a170+':'+_0x23bc10['id'],_0x23bc10);OpenchannelAccountEvents[_0xfc49('0x6')](_0x44a170,_0x23bc10);_0x9b27c3(null);};}for(var e in events){if(events[_0xfc49('0x7')](e)){var event=events[e];OpenchannelAccount[_0xfc49('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 0269c46..46e9f34 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 _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 +var _0xc288=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','openchannel_accounts','lodash'];(function(_0x15b7e9,_0x3f2d24){var _0xdbda57=function(_0x4b5af7){while(--_0x4b5af7){_0x15b7e9['push'](_0x15b7e9['shift']());}};_0xdbda57(++_0x3f2d24);}(_0xc288,0x18b));var _0x8c28=function(_0x573a1a,_0x4042a7){_0x573a1a=_0x573a1a-0x0;var _0x31d31b=_0xc288[_0x573a1a];return _0x31d31b;};'use strict';var _=require(_0x8c28('0x0'));var util=require('util');var logger=require(_0x8c28('0x1'))(_0x8c28('0x2'));var moment=require(_0x8c28('0x3'));var BPromise=require(_0x8c28('0x4'));var rp=require(_0x8c28('0x5'));var fs=require('fs');var path=require(_0x8c28('0x6'));var rimraf=require(_0x8c28('0x7'));var config=require(_0x8c28('0x8'));var attributes=require(_0x8c28('0x9'));module[_0x8c28('0xa')]=function(_0x572d7b,_0x3d5973){return _0x572d7b['define']('OpenchannelAccount',attributes,{'tableName':_0x8c28('0xb'),'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 56d76fd..4e48b71 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 _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 +var _0xd4ef=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash'];(function(_0x217ae8,_0x38d263){var _0xc7f25a=function(_0x529399){while(--_0x529399){_0x217ae8['push'](_0x217ae8['shift']());}};_0xc7f25a(++_0x38d263);}(_0xd4ef,0xfb));var _0xfd4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4ef[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfd4e('0x0'));var util=require(_0xfd4e('0x1'));var moment=require(_0xfd4e('0x2'));var BPromise=require(_0xfd4e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd4e('0x4'));var db=require(_0xfd4e('0x5'))['db'];var utils=require(_0xfd4e('0x6'));var logger=require(_0xfd4e('0x7'))(_0xfd4e('0x8'));var config=require(_0xfd4e('0x9'));var jayson=require(_0xfd4e('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xfd4e('0xb')]=_[_0xfd4e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfd4e('0xd'))(new Redis(config['redis']));require(_0xfd4e('0xe'))[_0xfd4e('0xf')](socket);function respondWithRpcPromise(_0x4cd99e,_0x194c5e,_0x3a95e7){return new BPromise(function(_0x393ae3,_0x178111){return client[_0xfd4e('0x10')](_0x4cd99e,_0x3a95e7)[_0xfd4e('0x11')](function(_0x2b0f83){logger[_0xfd4e('0x12')](_0xfd4e('0x13'),_0x194c5e,_0xfd4e('0x14'));logger['debug'](_0xfd4e('0x15'),_0x194c5e,_0xfd4e('0x14'),JSON[_0xfd4e('0x16')](_0x2b0f83));if(_0x2b0f83['error']){if(_0x2b0f83['error'][_0xfd4e('0x17')]===0x1f4){logger[_0xfd4e('0x18')](_0xfd4e('0x13'),_0x194c5e,_0x2b0f83[_0xfd4e('0x18')][_0xfd4e('0x19')]);return _0x178111(_0x2b0f83[_0xfd4e('0x18')][_0xfd4e('0x19')]);}logger[_0xfd4e('0x18')](_0xfd4e('0x13'),_0x194c5e,_0x2b0f83[_0xfd4e('0x18')][_0xfd4e('0x19')]);return _0x393ae3(_0x2b0f83[_0xfd4e('0x18')]['message']);}else{logger[_0xfd4e('0x12')](_0xfd4e('0x13'),_0x194c5e,_0xfd4e('0x14'));_0x393ae3(_0x2b0f83[_0xfd4e('0x1a')][_0xfd4e('0x19')]);}})[_0xfd4e('0x1b')](function(_0x532ab6){logger['error'](_0xfd4e('0x13'),_0x194c5e,_0x532ab6);_0x178111(_0x532ab6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 469fb6f..7c31a4d 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 _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 +var _0x670a=['remove','update','removeListener','register','length','openchannelAccount:'];(function(_0x490ecf,_0x3e8df4){var _0x157f7c=function(_0xbaf021){while(--_0xbaf021){_0x490ecf['push'](_0x490ecf['shift']());}};_0x157f7c(++_0x3e8df4);}(_0x670a,0x186));var _0xa670=function(_0x25d0af,_0x2a614e){_0x25d0af=_0x25d0af-0x0;var _0x28ae43=_0x670a[_0x25d0af];return _0x28ae43;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0xa670('0x0'),_0xa670('0x1')];function createListener(_0x39dc7a,_0x41ff65){return function(_0x5ef4da){_0x41ff65['emit'](_0x39dc7a,_0x5ef4da);};}function removeListener(_0x196fa8,_0x491a73){return function(){OpenchannelAccountEvents[_0xa670('0x2')](_0x196fa8,_0x491a73);};}exports[_0xa670('0x3')]=function(_0x2a3fda){for(var _0x3cab7=0x0,_0x82be19=events[_0xa670('0x4')];_0x3cab7<_0x82be19;_0x3cab7++){var _0x5c27cf=events[_0x3cab7];var _0x3863eb=createListener(_0xa670('0x5')+_0x5c27cf,_0x2a3fda);OpenchannelAccountEvents['on'](_0x5c27cf,_0x3863eb);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 45c6a41..f0cdcbc 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 _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 +var _0x46e3=['update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x402453,_0x27cca6){var _0x11b0d8=function(_0x1b395d){while(--_0x1b395d){_0x402453['push'](_0x402453['shift']());}};_0x11b0d8(++_0x27cca6);}(_0x46e3,0x88));var _0x346e=function(_0x2ff550,_0x2e9776){_0x2ff550=_0x2ff550-0x0;var _0x42fe44=_0x46e3[_0x2ff550];return _0x42fe44;};'use strict';var multer=require(_0x346e('0x0'));var util=require(_0x346e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x346e('0x2'));var router=express[_0x346e('0x3')]();var auth=require(_0x346e('0x4'));var interaction=require(_0x346e('0x5'));var config=require(_0x346e('0x6'));var controller=require(_0x346e('0x7'));router[_0x346e('0x8')]('/',auth[_0x346e('0x9')](),controller[_0x346e('0xa')]);router[_0x346e('0x8')]('/:id',auth[_0x346e('0x9')](),controller[_0x346e('0xb')]);router[_0x346e('0xc')]('/',auth[_0x346e('0x9')](),controller[_0x346e('0xd')]);router[_0x346e('0xe')](_0x346e('0xf'),auth[_0x346e('0x9')](),controller[_0x346e('0x10')]);router['delete']('/:id',auth[_0x346e('0x9')](),controller[_0x346e('0x11')]);module[_0x346e('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 832939b..edabb8f 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 _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 +var _0x350f=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x350f,0xe0));var _0xf350=function(_0x389832,_0x10a4a9){_0x389832=_0x389832-0x0;var _0x59429e=_0x350f[_0x389832];return _0x59429e;};'use strict';var Sequelize=require(_0xf350('0x0'));module[_0xf350('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf350('0x2')],'allowNull':![],'defaultValue':_0xf350('0x3')},'appdata':{'type':Sequelize[_0xf350('0x4')]()},'description':{'type':Sequelize[_0xf350('0x2')]},'interval':{'type':Sequelize[_0xf350('0x2')],'defaultValue':_0xf350('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 7becd3e..a5a2701 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 _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 +var _0x7e16=['desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','count','offset','limit','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','name','index','map','OpenchannelApplication','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','where','merge','VIRTUAL','filter','findAll','catch','show','include','options','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x16b19e,_0x59877d){var _0x49a970=function(_0x5106c0){while(--_0x5106c0){_0x16b19e['push'](_0x16b19e['shift']());}};_0x49a970(++_0x59877d);}(_0x7e16,0x78));var _0x67e1=function(_0x1ec4a0,_0x1c2001){_0x1ec4a0=_0x1ec4a0-0x0;var _0x40ca58=_0x7e16[_0x1ec4a0];return _0x40ca58;};'use strict';var pdf=require(_0x67e1('0x0'));var emlformat=require(_0x67e1('0x1'));var rimraf=require(_0x67e1('0x2'));var zipdir=require(_0x67e1('0x3'));var jsonpatch=require(_0x67e1('0x4'));var rp=require(_0x67e1('0x5'));var moment=require(_0x67e1('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x67e1('0x7'));var path=require('path');var sox=require(_0x67e1('0x8'));var csv=require(_0x67e1('0x9'));var ejs=require(_0x67e1('0xa'));var fs=require('fs');var _=require(_0x67e1('0xb'));var squel=require(_0x67e1('0xc'));var crypto=require(_0x67e1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x67e1('0xe'));var toCsv=require(_0x67e1('0x9'));var querystring=require('querystring');var Papa=require(_0x67e1('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x67e1('0x10'));var as=require(_0x67e1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x67e1('0x12'));var utils=require(_0x67e1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x67e1('0x14'));var db=require(_0x67e1('0x15'))['db'];function respondWithStatusCode(_0x54a489,_0x9cc724){_0x9cc724=_0x9cc724||0xcc;return function(_0x5db7d2){if(_0x5db7d2){return _0x54a489['sendStatus'](_0x9cc724);}return _0x54a489['status'](_0x9cc724)[_0x67e1('0x16')]();};}function respondWithResult(_0x45e0d5,_0x48656b){_0x48656b=_0x48656b||0xc8;return function(_0x41e850){if(_0x41e850){return _0x45e0d5[_0x67e1('0x17')](_0x48656b)['json'](_0x41e850);}};}function respondWithFilteredResult(_0x3834f3,_0xa9b47c){return function(_0x282903){if(_0x282903){var _0x5e4fe9=_0x282903[_0x67e1('0x18')],_0x5e9973=_0xa9b47c[_0x67e1('0x19')],_0x39caee=_0xa9b47c[_0x67e1('0x19')]+_0xa9b47c[_0x67e1('0x1a')],_0x2b7b6b;if(_0x39caee>=_0x5e4fe9){_0x39caee=_0x5e4fe9;_0x2b7b6b=0xc8;}else{_0x2b7b6b=0xce;}_0x3834f3[_0x67e1('0x17')](_0x2b7b6b);return _0x3834f3['set'](_0x67e1('0x1b'),_0x5e9973+'-'+_0x39caee+'/'+_0x5e4fe9)[_0x67e1('0x1c')](_0x282903);}return null;};}function patchUpdates(_0x34edbf){return function(_0x135065){try{jsonpatch[_0x67e1('0x1d')](_0x135065,_0x34edbf,!![]);}catch(_0x308687){return BPromise['reject'](_0x308687);}return _0x135065[_0x67e1('0x1e')]();};}function saveUpdates(_0x1843f4,_0x563127){return function(_0x55cb2c){if(_0x55cb2c){return _0x55cb2c[_0x67e1('0x1f')](_0x1843f4)[_0x67e1('0x20')](function(_0x23d779){return _0x23d779;});}return null;};}function removeEntity(_0x288602,_0x27cec0){return function(_0x104cb2){if(_0x104cb2){return _0x104cb2[_0x67e1('0x21')]()[_0x67e1('0x20')](function(){_0x288602[_0x67e1('0x17')](0xcc)[_0x67e1('0x16')]();});}};}function handleEntityNotFound(_0x4cca63,_0x177d79){return function(_0x5dbe58){if(!_0x5dbe58){_0x4cca63[_0x67e1('0x22')](0x194);}return _0x5dbe58;};}function handleError(_0x54fa5b,_0x34e398){_0x34e398=_0x34e398||0x1f4;return function(_0x299904){logger[_0x67e1('0x23')](_0x299904['stack']);if(_0x299904['name']){delete _0x299904[_0x67e1('0x24')];}_0x54fa5b[_0x67e1('0x17')](_0x34e398)['send'](_0x299904);};}exports[_0x67e1('0x25')]=function(_0x4a2c9d,_0x3a56c8){var _0x23bf3d={},_0x370223={},_0x3259d0={'count':0x0,'rows':[]};var _0x58c796=_[_0x67e1('0x26')](db[_0x67e1('0x27')][_0x67e1('0x28')],function(_0x462c66){return{'name':_0x462c66[_0x67e1('0x29')],'type':_0x462c66['type'][_0x67e1('0x2a')]};});_0x370223[_0x67e1('0x2b')]=_['map'](_0x58c796,_0x67e1('0x24'));_0x370223['query']=_[_0x67e1('0x2c')](_0x4a2c9d[_0x67e1('0x2d')]);_0x370223[_0x67e1('0x2e')]=_[_0x67e1('0x2f')](_0x370223[_0x67e1('0x2b')],_0x370223['query']);_0x23bf3d[_0x67e1('0x30')]=_[_0x67e1('0x2f')](_0x370223['model'],qs[_0x67e1('0x31')](_0x4a2c9d[_0x67e1('0x2d')]['fields']));_0x23bf3d[_0x67e1('0x30')]=_0x23bf3d[_0x67e1('0x30')][_0x67e1('0x32')]?_0x23bf3d[_0x67e1('0x30')]:_0x370223[_0x67e1('0x2b')];if(!_0x4a2c9d[_0x67e1('0x2d')][_0x67e1('0x33')]('nolimit')){_0x23bf3d[_0x67e1('0x1a')]=qs[_0x67e1('0x1a')](_0x4a2c9d[_0x67e1('0x2d')][_0x67e1('0x1a')]);_0x23bf3d[_0x67e1('0x19')]=qs[_0x67e1('0x19')](_0x4a2c9d[_0x67e1('0x2d')][_0x67e1('0x19')]);}_0x23bf3d['order']=qs[_0x67e1('0x34')](_0x4a2c9d['query']['sort']);_0x23bf3d['where']=qs[_0x67e1('0x2e')](_[_0x67e1('0x35')](_0x4a2c9d[_0x67e1('0x2d')],_0x370223[_0x67e1('0x2e')]),_0x58c796);if(_0x4a2c9d['query']['filter']){_0x23bf3d[_0x67e1('0x36')]=_[_0x67e1('0x37')](_0x23bf3d['where'],{'$or':_['map'](_0x58c796,function(_0x25b90f){if(_0x25b90f['type']!==_0x67e1('0x38')){var _0x1b4ed2={};_0x1b4ed2[_0x25b90f['name']]={'$like':'%'+_0x4a2c9d[_0x67e1('0x2d')][_0x67e1('0x39')]+'%'};return _0x1b4ed2;}})});}_0x23bf3d=_[_0x67e1('0x37')]({},_0x23bf3d,_0x4a2c9d['options']);var _0x1f03dc={'where':_0x23bf3d[_0x67e1('0x36')]};return db[_0x67e1('0x27')]['count'](_0x1f03dc)[_0x67e1('0x20')](function(_0x5d893b){_0x3259d0[_0x67e1('0x18')]=_0x5d893b;if(_0x4a2c9d[_0x67e1('0x2d')]['includeAll']){_0x23bf3d['include']=[{'all':!![]}];}return db[_0x67e1('0x27')][_0x67e1('0x3a')](_0x23bf3d);})[_0x67e1('0x20')](function(_0xa4b391){_0x3259d0['rows']=_0xa4b391;return _0x3259d0;})[_0x67e1('0x20')](respondWithFilteredResult(_0x3a56c8,_0x23bf3d))[_0x67e1('0x3b')](handleError(_0x3a56c8,null));};exports[_0x67e1('0x3c')]=function(_0x49119e,_0xa5d1fa){var _0x769a92={'raw':!![],'where':{'id':_0x49119e['params']['id']}},_0x1bd34b={};_0x1bd34b['model']=_[_0x67e1('0x2c')](db[_0x67e1('0x27')][_0x67e1('0x28')]);_0x1bd34b['query']=_[_0x67e1('0x2c')](_0x49119e[_0x67e1('0x2d')]);_0x1bd34b[_0x67e1('0x2e')]=_[_0x67e1('0x2f')](_0x1bd34b[_0x67e1('0x2b')],_0x1bd34b['query']);_0x769a92[_0x67e1('0x30')]=_[_0x67e1('0x2f')](_0x1bd34b[_0x67e1('0x2b')],qs[_0x67e1('0x31')](_0x49119e[_0x67e1('0x2d')]['fields']));_0x769a92[_0x67e1('0x30')]=_0x769a92[_0x67e1('0x30')]['length']?_0x769a92['attributes']:_0x1bd34b[_0x67e1('0x2b')];if(_0x49119e[_0x67e1('0x2d')]['includeAll']){_0x769a92[_0x67e1('0x3d')]=[{'all':!![]}];}_0x769a92=_[_0x67e1('0x37')]({},_0x769a92,_0x49119e[_0x67e1('0x3e')]);return db['OpenchannelApplication'][_0x67e1('0x3f')](_0x769a92)[_0x67e1('0x20')](handleEntityNotFound(_0xa5d1fa,null))[_0x67e1('0x20')](respondWithResult(_0xa5d1fa,null))[_0x67e1('0x3b')](handleError(_0xa5d1fa,null));};exports[_0x67e1('0x40')]=function(_0x5b783f,_0x4885f9){return db[_0x67e1('0x27')][_0x67e1('0x40')](_0x5b783f[_0x67e1('0x41')],{})[_0x67e1('0x20')](respondWithResult(_0x4885f9,0xc9))[_0x67e1('0x3b')](handleError(_0x4885f9,null));};exports[_0x67e1('0x1f')]=function(_0x475f01,_0x3685ec){if(_0x475f01['body']['id']){delete _0x475f01[_0x67e1('0x41')]['id'];}return db[_0x67e1('0x27')]['find']({'where':{'id':_0x475f01[_0x67e1('0x42')]['id']}})[_0x67e1('0x20')](handleEntityNotFound(_0x3685ec,null))[_0x67e1('0x20')](saveUpdates(_0x475f01[_0x67e1('0x41')],null))[_0x67e1('0x20')](respondWithResult(_0x3685ec,null))[_0x67e1('0x3b')](handleError(_0x3685ec,null));};exports[_0x67e1('0x21')]=function(_0x47a574,_0x383f34){return db[_0x67e1('0x27')]['find']({'where':{'id':_0x47a574['params']['id']}})['then'](handleEntityNotFound(_0x383f34,null))['then'](removeEntity(_0x383f34,null))['catch'](handleError(_0x383f34,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index c2c85d3..3f65bac 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 _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 +var _0xf921=['./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x358dd8,_0xb20f80){var _0x56e53c=function(_0x4a78b9){while(--_0x4a78b9){_0x358dd8['push'](_0x358dd8['shift']());}};_0x56e53c(++_0xb20f80);}(_0xf921,0x199));var _0x1f92=function(_0x31e5cb,_0x2f5adf){_0x31e5cb=_0x31e5cb-0x0;var _0x4170df=_0xf921[_0x31e5cb];return _0x4170df;};'use strict';var _=require(_0x1f92('0x0'));var util=require(_0x1f92('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1f92('0x2'));var rp=require(_0x1f92('0x3'));var fs=require('fs');var path=require(_0x1f92('0x4'));var rimraf=require(_0x1f92('0x5'));var config=require(_0x1f92('0x6'));var attributes=require(_0x1f92('0x7'));module[_0x1f92('0x8')]=function(_0x4b04a5,_0x3171ad){return _0x4b04a5[_0x1f92('0x9')]('OpenchannelApplication',attributes,{'tableName':_0x1f92('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1f92('0xb'),'collate':_0x1f92('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index c8f611d..0dc939e 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_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 +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(_0x5a103e,_0x2f3d20){var _0x57700a=function(_0x3b389b){while(--_0x3b389b){_0x5a103e['push'](_0x5a103e['shift']());}};_0x57700a(++_0x2f3d20);}(_0xb10b,0x12a));var _0xbb10=function(_0x55d7c2,_0x4ce6fb){_0x55d7c2=_0x55d7c2-0x0;var _0x1755ef=_0xb10b[_0x55d7c2];return _0x1755ef;};'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 92907e0..58c6f69 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 _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 +var _0x35fb=['/:id','openchannelinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','show','getMessages','download','post','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','openchannelinteraction:update','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x35fb,0x9f));var _0xb35f=function(_0xed4881,_0x45771c){_0xed4881=_0xed4881-0x0;var _0x7fcbd5=_0x35fb[_0xed4881];return _0x7fcbd5;};'use strict';var multer=require(_0xb35f('0x0'));var util=require(_0xb35f('0x1'));var path=require(_0xb35f('0x2'));var timeout=require(_0xb35f('0x3'));var express=require(_0xb35f('0x4'));var router=express[_0xb35f('0x5')]();var auth=require(_0xb35f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb35f('0x7'));var controller=require(_0xb35f('0x8'));router[_0xb35f('0x9')]('/',auth[_0xb35f('0xa')](),controller[_0xb35f('0xb')]);router[_0xb35f('0x9')](_0xb35f('0xc'),auth[_0xb35f('0xa')](),controller[_0xb35f('0xd')]);router[_0xb35f('0x9')]('/:id',auth[_0xb35f('0xa')](),controller[_0xb35f('0xe')]);router[_0xb35f('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0xb35f('0xf')]);router[_0xb35f('0x9')]('/:id/download',auth[_0xb35f('0xa')](),controller[_0xb35f('0x10')]);router['post']('/',auth[_0xb35f('0xa')](),controller['create']);router[_0xb35f('0x11')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0xb35f('0x11')](_0xb35f('0x12'),auth[_0xb35f('0xa')](),interaction[_0xb35f('0x13')]('openchannel',_0xb35f('0x14')),controller[_0xb35f('0x15')]);router[_0xb35f('0x16')]('/:id',auth[_0xb35f('0xa')](),interaction[_0xb35f('0x13')](_0xb35f('0x17'),_0xb35f('0x18')),controller[_0xb35f('0x19')]);router[_0xb35f('0x1a')](_0xb35f('0x1b'),auth[_0xb35f('0xa')](),interaction['tracked'](_0xb35f('0x17'),_0xb35f('0x1c')),controller['destroy']);router['delete'](_0xb35f('0x12'),auth['isAuthenticated'](),controller[_0xb35f('0x1d')]);module[_0xb35f('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 89a4e83..86a3f51 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 _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 +var _0x7590=['BOOLEAN','DATE','STRING','out','exports'];(function(_0x317c51,_0x2f27d6){var _0x2e36cd=function(_0x3af7ed){while(--_0x3af7ed){_0x317c51['push'](_0x317c51['shift']());}};_0x2e36cd(++_0x2f27d6);}(_0x7590,0x1c6));var _0x0759=function(_0x148879,_0x5b4c11){_0x148879=_0x148879-0x0;var _0x4f7027=_0x7590[_0x148879];return _0x4f7027;};'use strict';var Sequelize=require('sequelize');module[_0x0759('0x0')]={'closed':{'type':Sequelize[_0x0759('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0759('0x2')]},'disposition':{'type':Sequelize[_0x0759('0x3')]},'secondDisposition':{'type':Sequelize[_0x0759('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0759('0x3')]},'note':{'type':Sequelize[_0x0759('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x0759('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x0759('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x0759('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x0759('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 871a15f..5f08cc7 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 _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 +var _0x6a87=['then','destroy','error','stack','name','status','send','Users','fullname','TagIds','split','Tags','push','index','map','OpenchannelInteraction','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','where','select','field','from','u.id','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','tools_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','buildExpression','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','catch','params','intersection','include','options','update','describe','addMessage','ids','findOne','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','OpenchannelMessage','includeAll','addTags','setTags','omit','spread','findAll','color','emit','removeTags','download','unix','root','server','tmp','join','files','attachments','transcript-%d-%s.zip','CmContact','firstName','Attachment','Messages','createdAt','direction','secret','OpenchannelAccount','Account','Owner','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\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','closed','closedAt','threadId','Public','Private','basename','existsSync','createWriteStream','System','lastName','out','renderFile','downloadInteraction.html','transcript-','log','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0xad6f1b,_0x831c38){var _0x260e64=function(_0x1dab53){while(--_0x1dab53){_0xad6f1b['push'](_0xad6f1b['shift']());}};_0x260e64(++_0x831c38);}(_0x6a87,0xcf));var _0x76a8=function(_0x2767a2,_0xe05029){_0x2767a2=_0x2767a2-0x0;var _0x1fea78=_0x6a87[_0x2767a2];return _0x1fea78;};'use strict';var pdf=require(_0x76a8('0x0'));var emlformat=require(_0x76a8('0x1'));var rimraf=require(_0x76a8('0x2'));var zipdir=require(_0x76a8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x76a8('0x4'));var BPromise=require(_0x76a8('0x5'));var Mustache=require(_0x76a8('0x6'));var util=require(_0x76a8('0x7'));var path=require(_0x76a8('0x8'));var sox=require(_0x76a8('0x9'));var csv=require(_0x76a8('0xa'));var ejs=require(_0x76a8('0xb'));var fs=require('fs');var _=require(_0x76a8('0xc'));var squel=require('squel');var crypto=require(_0x76a8('0xd'));var jsforce=require(_0x76a8('0xe'));var deskjs=require(_0x76a8('0xf'));var toCsv=require(_0x76a8('0xa'));var querystring=require(_0x76a8('0x10'));var Papa=require(_0x76a8('0x11'));var Redis=require('ioredis');var authService=require(_0x76a8('0x12'));var qs=require(_0x76a8('0x13'));var as=require(_0x76a8('0x14'));var hardwareService=require(_0x76a8('0x15'));var logger=require(_0x76a8('0x16'))(_0x76a8('0x17'));var utils=require(_0x76a8('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x76a8('0x19'));var db=require(_0x76a8('0x1a'))['db'];config[_0x76a8('0x1b')]=_[_0x76a8('0x1c')](config[_0x76a8('0x1b')],{'host':_0x76a8('0x1d'),'port':0x18eb});var socket=require(_0x76a8('0x1e'))(new Redis(config[_0x76a8('0x1b')]));require(_0x76a8('0x1f'))[_0x76a8('0x20')](socket);function respondWithStatusCode(_0x209205,_0x212ddc){_0x212ddc=_0x212ddc||0xcc;return function(_0x4c2502){if(_0x4c2502){return _0x209205[_0x76a8('0x21')](_0x212ddc);}return _0x209205['status'](_0x212ddc)[_0x76a8('0x22')]();};}function respondWithResult(_0x158a46,_0x3ca1a6){_0x3ca1a6=_0x3ca1a6||0xc8;return function(_0x164193){if(_0x164193){return _0x158a46['status'](_0x3ca1a6)[_0x76a8('0x23')](_0x164193);}};}function respondWithFilteredResult(_0xf3324d,_0x58736b){return function(_0xed4867){if(_0xed4867){var _0x5adad8=_0xed4867[_0x76a8('0x24')],_0x500063=_0x58736b[_0x76a8('0x25')],_0x34ae86=_0x58736b[_0x76a8('0x25')]+_0x58736b[_0x76a8('0x26')],_0x4bcfee;if(_0x34ae86>=_0x5adad8){_0x34ae86=_0x5adad8;_0x4bcfee=0xc8;}else{_0x4bcfee=0xce;}_0xf3324d['status'](_0x4bcfee);return _0xf3324d[_0x76a8('0x27')](_0x76a8('0x28'),_0x500063+'-'+_0x34ae86+'/'+_0x5adad8)[_0x76a8('0x23')](_0xed4867);}return null;};}function patchUpdates(_0x31931d){return function(_0x4c1801){try{jsonpatch[_0x76a8('0x29')](_0x4c1801,_0x31931d,!![]);}catch(_0x57b09e){return BPromise[_0x76a8('0x2a')](_0x57b09e);}return _0x4c1801[_0x76a8('0x2b')]();};}function saveUpdates(_0x4318dc,_0x2f4914){return function(_0x5344d0){if(_0x5344d0){return _0x5344d0['update'](_0x4318dc)[_0x76a8('0x2c')](function(_0x3e3630){return _0x3e3630;});}return null;};}function removeEntity(_0x7bfa4f,_0x35c648){return function(_0x524790){if(_0x524790){return _0x524790[_0x76a8('0x2d')]()['then'](function(){_0x7bfa4f['status'](0xcc)[_0x76a8('0x22')]();});}};}function handleEntityNotFound(_0x19a13a,_0x59c2cd){return function(_0x3c6e9e){if(!_0x3c6e9e){_0x19a13a[_0x76a8('0x21')](0x194);}return _0x3c6e9e;};}function handleError(_0x357f52,_0x5bdde3){_0x5bdde3=_0x5bdde3||0x1f4;return function(_0x1114ce){logger[_0x76a8('0x2e')](_0x1114ce[_0x76a8('0x2f')]);if(_0x1114ce[_0x76a8('0x30')]){delete _0x1114ce[_0x76a8('0x30')];}_0x357f52[_0x76a8('0x31')](_0x5bdde3)[_0x76a8('0x32')](_0x1114ce);};}function getInteractionUsers(_0x144503,_0x2cc2db){return new BPromise(function(_0x5f1a90,_0x414611){try{if(_0x2cc2db[_0x144503['id']]){_0x144503[_0x76a8('0x33')]=_['map'](_0x2cc2db[_0x144503['id']],function(_0x4e0449){return{'id':_0x4e0449['id'],'fullname':_0x4e0449[_0x76a8('0x34')]};});}}catch(_0xec8443){_0x414611(_0xec8443);}_0x5f1a90(_0x144503);});}function getInteractionTags(_0x3c5bd8,_0x35921e){return new BPromise(function(_0x2ea0de,_0x59d27e){try{if(_0x3c5bd8[_0x76a8('0x35')]){_0x3c5bd8['Tags']=[];_0x3c5bd8['TagIds'][_0x76a8('0x36')](',')['forEach'](function(_0x5aa6a9){_0x3c5bd8[_0x76a8('0x37')][_0x76a8('0x38')](_0x35921e[_0x5aa6a9]);});}delete _0x3c5bd8[_0x76a8('0x35')];}catch(_0xcd4c71){_0x59d27e(_0xcd4c71);}_0x2ea0de(_0x3c5bd8);});}function updateOpenchannelInteraction(_0x24d797,_0xe5d0f9,_0x49b539){return new BPromise(function(_0x1005a5,_0x3b03b4){return getInteractionUsers(_0x24d797,_0x49b539)['then'](function(_0x4e5130){return getInteractionTags(_0x4e5130,_0xe5d0f9);})[_0x76a8('0x2c')](function(_0x379020){_0x1005a5(_0x379020);})['catch'](function(_0x55e0d3){_0x3b03b4(_0x55e0d3);});});}exports[_0x76a8('0x39')]=function(_0x2dbbdd,_0x4c20b2){var _0x4a3433={},_0x4a5c8d={},_0x2568bf={'count':0x0,'rows':[]};var _0x8aea41=_[_0x76a8('0x3a')](db[_0x76a8('0x3b')][_0x76a8('0x3c')],function(_0x5c8536){return{'name':_0x5c8536['fieldName'],'type':_0x5c8536[_0x76a8('0x3d')][_0x76a8('0x3e')]};});_0x4a5c8d[_0x76a8('0x3f')]=_['map'](_0x8aea41,_0x76a8('0x30'));_0x4a5c8d[_0x76a8('0x40')]=_[_0x76a8('0x41')](_0x2dbbdd['query']);_0x4a5c8d[_0x76a8('0x42')]=_['intersection'](_0x4a5c8d[_0x76a8('0x3f')],_0x4a5c8d[_0x76a8('0x40')]);_0x4a3433[_0x76a8('0x43')]=_['intersection'](_0x4a5c8d['model'],qs[_0x76a8('0x44')](_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x44')]));_0x4a3433[_0x76a8('0x43')]=_0x4a3433[_0x76a8('0x43')][_0x76a8('0x45')]?_0x4a3433[_0x76a8('0x43')]:_0x4a5c8d['model'];if(!_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x46')]('nolimit')){_0x4a3433[_0x76a8('0x26')]=qs[_0x76a8('0x26')](_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x26')]);_0x4a3433['offset']=qs['offset'](_0x2dbbdd['query'][_0x76a8('0x25')]);}_0x4a3433['order']=qs['sort'](_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x47')]);_0x4a3433[_0x76a8('0x48')]=qs[_0x76a8('0x42')](_['pick'](_0x2dbbdd[_0x76a8('0x40')],_0x4a5c8d[_0x76a8('0x42')]),_0x8aea41);var _0x193873=[];var _0x104460=squel[_0x76a8('0x49')]()[_0x76a8('0x4a')]('id')[_0x76a8('0x4a')](_0x76a8('0x30'))[_0x76a8('0x4a')]('color')[_0x76a8('0x4b')]('tools_tags');var _0x45e543=squel[_0x76a8('0x49')]()[_0x76a8('0x4a')](_0x76a8('0x4c'))[_0x76a8('0x4a')]('u.fullname')['field'](_0x76a8('0x4d'))[_0x76a8('0x4b')](_0x76a8('0x4e'),'ui')['left_join'](_0x76a8('0x4f'),'u',_0x76a8('0x50'));var _0x45a138=squel[_0x76a8('0x49')]()[_0x76a8('0x4b')](_0x76a8('0x51'),'i')[_0x76a8('0x52')](_0x76a8('0x53'),'c',_0x76a8('0x54'))[_0x76a8('0x52')](_0x76a8('0x4f'),'o',_0x76a8('0x55'))['left_join'](_0x76a8('0x56'),'a',_0x76a8('0x57'))['left_join']('openchannel_messages','me',_0x76a8('0x58'))[_0x76a8('0x52')](_0x76a8('0x59'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x76a8('0x52')](_0x76a8('0x5a'),'t','t.id\x20=\x20it.TagId');var _0xef2b6a=squel[_0x76a8('0x5b')]();var _0x3c7cee=[];var _0x378008=squel[_0x76a8('0x5b')]();var _0x587e51;if(_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x5c')]){_0x587e51=as[_0x76a8('0x5d')](_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x5c')]);var _0x12b39e=_0x587e51[_0x76a8('0x5e')];for(var _0x331c2e=0x0;_0x331c2e<_0x587e51[_0x76a8('0x5f')][_0x76a8('0x45')];_0x331c2e++){var _0x4ed072=_0x587e51['conditions'][_0x331c2e];var _0x5acb08='i';var _0x31f1b2=_[_0x76a8('0x60')](_0x8aea41,[_0x76a8('0x30'),_0x4ed072[_0x76a8('0x4a')]]);if(!_0x31f1b2){switch(_0x4ed072['field']){case _0x76a8('0x61'):if(_0x4ed072[_0x76a8('0x62')]==0x1){_0x45a138[_0x76a8('0x63')]('`'+_0x4ed072[_0x76a8('0x4a')]+_0x76a8('0x64'));}else{_0x45a138[_0x76a8('0x63')]('`'+_0x4ed072[_0x76a8('0x4a')]+_0x76a8('0x65'));}break;case _0x76a8('0x66'):if(_0x4ed072['operator']===_0x76a8('0x67')){if(_0x4ed072[_0x76a8('0x62')]['split']('\x20')['length']>0x1){_0xef2b6a[_0x12b39e](_0x76a8('0x68'),qs['getFullTextValue'](_0x4ed072[_0x76a8('0x62')]),null);}else{var _0x1d000f='%'+_0x4ed072[_0x76a8('0x62')]+'%';_0xef2b6a[_0x12b39e](_0x76a8('0x69'),_0x1d000f,_0x1d000f,_0x1d000f);}}else{_0x31f1b2=_[_0x76a8('0x60')](_0x8aea41,['name','ContactId']);_0x4ed072['field']=_0x76a8('0x6a');_0x2835de=as['buildExpression'](_0x5acb08,_0x31f1b2['type'],_0x4ed072);_0xef2b6a[_0x12b39e](_0x2835de[_0x76a8('0x6b')],_0x2835de[_0x76a8('0x62')][_0x76a8('0x6c')],_0x2835de[_0x76a8('0x62')][_0x76a8('0x22')]);}break;case _0x76a8('0x6d'):var _0x1d3862=_0x4ed072['value']['split'](',')[_0x76a8('0x3a')](function(_0x48fda8){return Number(_0x48fda8);});_0x1d3862[_0x76a8('0x6e')](function(_0x2c329f){_0x378008['or'](_0x76a8('0x6f'),'%,'+_0x2c329f+',%');});_0x3c7cee=_['union'](_0x3c7cee,_0x1d3862);break;case _0x76a8('0x70'):if(_0x4ed072[_0x76a8('0x71')]===_0x76a8('0x67')){_0xef2b6a[_0x12b39e](_0x76a8('0x72'),'%'+_0x4ed072[_0x76a8('0x62')]+'%',null);}else{_0x31f1b2=_[_0x76a8('0x60')](_0x8aea41,[_0x76a8('0x30'),'UserId']);_0x4ed072['field']=_0x76a8('0x73');_0x2835de=as['buildExpression'](_0x5acb08,_0x31f1b2['type'],_0x4ed072);_0xef2b6a[_0x12b39e](_0x2835de[_0x76a8('0x6b')],_0x2835de[_0x76a8('0x62')][_0x76a8('0x6c')],_0x2835de['value'][_0x76a8('0x22')]);}break;case _0x76a8('0x74'):_0x2835de=as[_0x76a8('0x75')]('me',null,_0x4ed072);_0xef2b6a[_0x12b39e](_0x2835de['text'],_0x2835de[_0x76a8('0x62')][_0x76a8('0x6c')],_0x2835de['value'][_0x76a8('0x22')]);break;}}else{var _0x2835de=as[_0x76a8('0x75')](_0x5acb08,_0x31f1b2[_0x76a8('0x3d')],_0x4ed072);_0xef2b6a[_0x12b39e](_0x2835de[_0x76a8('0x6b')],_0x2835de[_0x76a8('0x62')]['start'],_0x2835de[_0x76a8('0x62')][_0x76a8('0x22')]);}}}else{var _0xd24a3=_(_0x2dbbdd[_0x76a8('0x40')])[_0x76a8('0x41')]()[_0x76a8('0x3a')](function(_0x3ff0a1){return _[_0x76a8('0x76')](_0x8aea41,['name',_0x3ff0a1])?_0x3ff0a1:undefined;})['compact']()[_0x76a8('0x62')]();if(!_[_0x76a8('0x77')](_0xd24a3)){_0xd24a3['forEach'](function(_0x5caadb){if(_0x5caadb===_0x76a8('0x78')){_0x45a138[_0x76a8('0x48')](_0x76a8('0x79'),[][_0x76a8('0x7a')](_0x2dbbdd[_0x76a8('0x40')][_0x5caadb]));}else if(_0x5caadb==='createdAt'){var _0x3447bb=JSON['parse'](_0x2dbbdd[_0x76a8('0x40')][_0x5caadb])['$gte'];var _0x54a3ec=JSON[_0x76a8('0x7b')](_0x2dbbdd['query'][_0x5caadb])[_0x76a8('0x7c')];_0x45a138['where'](_0x76a8('0x7d'),_0x3447bb,_0x54a3ec);}else{if(_0x2dbbdd[_0x76a8('0x40')][_0x5caadb]==='null'){_0x45a138[_0x76a8('0x48')]('i.'+_0x5caadb+_0x76a8('0x7e'));}else{_0x45a138[_0x76a8('0x48')]('i.'+_0x5caadb+_0x76a8('0x7f'),_0x2dbbdd[_0x76a8('0x40')][_0x5caadb]);}}});}if(_0x2dbbdd['query'][_0x76a8('0x80')]){if(_0x2dbbdd['query'][_0x76a8('0x80')]==0x1){_0x45a138[_0x76a8('0x63')](_0x76a8('0x81'));}else{_0x45a138['having'](_0x76a8('0x82'));}}if(_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x83')]){_0x3c7cee=_[_0x76a8('0x84')](_0x2dbbdd[_0x76a8('0x40')]['tag'])?_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x83')]:new Array(_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x83')]);_0x3c7cee['forEach'](function(_0xcea63d){_0x378008['or'](_0x76a8('0x6f'),'%,'+_0xcea63d+',%');});}if(_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x85')]){var _0x16f1d0=_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x85')]['replace']('\x5c','\x5c\x5c')[_0x76a8('0x86')](/'/g,'\x27\x27');if(qs[_0x76a8('0x87')](_0x16f1d0)){_0xef2b6a['or'](_0x76a8('0x88'),_0x16f1d0+'%');}else{_0xef2b6a['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x76a8('0x89')](_0x16f1d0))['or'](_0x76a8('0x8a'),_0x16f1d0+'%')['or'](_0x76a8('0x8b'),_0x16f1d0+'%');}}}_0x45a138[_0x76a8('0x48')](_0xef2b6a);_0x45a138[_0x76a8('0x8c')]('i.id');var _0x119203={'type':db[_0x76a8('0x8d')][_0x76a8('0x8e')][_0x76a8('0x8f')],'raw':!![]};var _0x42728f=_0x45a138[_0x76a8('0x90')]();_0x42728f[_0x76a8('0x4a')](_0x76a8('0x91'));_0x42728f['field'](_0x76a8('0x92'),_0x76a8('0x61'));if(_0x4a3433[_0x76a8('0x93')]){_0x4a3433[_0x76a8('0x93')][_0x76a8('0x6e')](function(_0xfc60b0){var _0x18f11c=_0xfc60b0[0x0]===_0x76a8('0x94')?_0xfc60b0[0x0]:'i.'+_0xfc60b0[0x0];_0x45a138['order'](_0x18f11c,_0xfc60b0[0x1]==='DESC'?![]:!![]);});}if(!_[_0x76a8('0x77')](_0x3c7cee)){_0x45a138['having'](_0x378008);_0x42728f[_0x76a8('0x48')](_0x76a8('0x95'),_0x3c7cee);}BPromise[_0x76a8('0x96')]()[_0x76a8('0x2c')](function(){if(!_0x587e51){if(_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x78')])return;_0x42728f[_0x76a8('0x48')](_0x76a8('0x97'));_0x45a138[_0x76a8('0x48')](_0x76a8('0x97'));return;}if(_0x2dbbdd[_0x76a8('0x98')][_0x76a8('0x99')]!==_0x76a8('0x9a'))return;return _0x2dbbdd[_0x76a8('0x98')][_0x76a8('0x9b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1ef44c){if(_[_0x76a8('0x77')](_0x1ef44c)){_0x42728f[_0x76a8('0x48')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x45a138['where'](_0x76a8('0x9c'));}else{_0x42728f[_0x76a8('0x48')](_0x76a8('0x79'),_[_0x76a8('0x3a')](_0x1ef44c,'id'));_0x45a138['where'](_0x76a8('0x79'),_[_0x76a8('0x3a')](_0x1ef44c,'id'));}});})[_0x76a8('0x2c')](function(){if(_0x2dbbdd[_0x76a8('0x98')][_0x76a8('0x99')]===_0x76a8('0x9a')&&!_0x587e51&&!_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x78')])return[];return db[_0x76a8('0x9d')]['query'](_0x42728f['toString'](),_0x119203);})[_0x76a8('0x2c')](function(_0x1ddca8){_0x2568bf[_0x76a8('0x24')]=_0x1ddca8[_0x76a8('0x45')];if(_0x2568bf[_0x76a8('0x24')]===0x0)return[];return db['sequelize'][_0x76a8('0x40')](_0x104460[_0x76a8('0x9e')](),_0x119203)['then'](function(_0x424f51){_0x193873=_['keyBy'](_0x424f51,'id');_0x119203=_[_0x76a8('0x9f')](_0x119203,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x44')]){_0x4a3433[_0x76a8('0x43')][_0x76a8('0x6e')](function(_0x1f45c0){_0x45a138[_0x76a8('0x4a')]('i.'+_0x1f45c0);});}else{_0x45a138[_0x76a8('0x4a')](_0x76a8('0x92'),_0x76a8('0x61'));_0x45a138[_0x76a8('0x4a')]('a.key',_0x76a8('0xa0'));_0x45a138[_0x76a8('0x4a')](_0x76a8('0xa1'),_0x76a8('0xa2'));_0x45a138[_0x76a8('0x4a')](_0x76a8('0xa3'),_0x76a8('0x94'));_0x45a138['field'](_0x76a8('0xa4'));_0x45a138[_0x76a8('0x4a')](_0x76a8('0xa5'),_0x76a8('0xa6'));_0x45a138[_0x76a8('0x4a')]('c.lastName',_0x76a8('0xa7'));_0x45a138['field'](_0x76a8('0xa8'),_0x76a8('0xa9'));_0x45a138[_0x76a8('0x4a')](_0x76a8('0xaa'),'Contact.phone');_0x45a138[_0x76a8('0x4a')](_0x76a8('0xab'),_0x76a8('0xac'));_0x45a138[_0x76a8('0x4a')](_0x76a8('0xad'),_0x76a8('0xae'));_0x45a138[_0x76a8('0x4a')](_0x76a8('0xaf'),_0x76a8('0xb0'));_0x45a138['field'](_0x76a8('0xb1'),'Owner.internal');_0x45a138['field'](_0x76a8('0xb2'),_0x76a8('0x35'));}if(_0x4a3433['limit'])_0x45a138['limit'](_0x4a3433[_0x76a8('0x26')]);if(_0x4a3433[_0x76a8('0x25')])_0x45a138['offset'](_0x4a3433[_0x76a8('0x25')]);return db[_0x76a8('0x9d')][_0x76a8('0x40')](_0x45a138[_0x76a8('0x9e')](),_0x119203);})[_0x76a8('0x2c')](function(_0x2335ba){_0x45e543[_0x76a8('0x48')](_0x76a8('0xb3'),_[_0x76a8('0x3a')](_0x2335ba,'id'));return db[_0x76a8('0x9d')][_0x76a8('0x40')](_0x45e543[_0x76a8('0x9e')](),_0x119203)[_0x76a8('0x2c')](function(_0x409d31){var _0x5e539d=_[_0x76a8('0xb4')](_0x409d31,_0x76a8('0xb5'));var _0x828d14=[];_0x2335ba[_0x76a8('0x6e')](function(_0xfaa35b){_0x828d14[_0x76a8('0x38')](updateOpenchannelInteraction(_0xfaa35b,_0x193873,_0x5e539d));});return BPromise[_0x76a8('0xb6')](_0x828d14);});});})[_0x76a8('0x2c')](function(_0x615f26){_0x2568bf[_0x76a8('0xb7')]=_0x615f26;return _0x2568bf;})[_0x76a8('0x2c')](respondWithFilteredResult(_0x4c20b2,_0x4a3433))[_0x76a8('0xb8')](handleError(_0x4c20b2,null));};exports['show']=function(_0x399fc9,_0xfcbce0){var _0x318c91={};if(_0x399fc9['query'][_0x76a8('0x3d')]&&_0x399fc9['query']['type']===_0x76a8('0x4b')){_0x318c91[_0x76a8('0x4b')]=_0x399fc9['params']['id'];}else{_0x318c91['id']=_0x399fc9[_0x76a8('0xb9')]['id'];}var _0x14abd6={'raw':![],'where':_0x318c91},_0x41368b={};_0x41368b['model']=_[_0x76a8('0x41')](db['OpenchannelInteraction'][_0x76a8('0x3c')]);_0x41368b[_0x76a8('0x40')]=_['keys'](_0x399fc9[_0x76a8('0x40')]);_0x41368b[_0x76a8('0x42')]=_[_0x76a8('0xba')](_0x41368b['model'],_0x41368b[_0x76a8('0x40')]);_0x14abd6[_0x76a8('0x43')]=_[_0x76a8('0xba')](_0x41368b[_0x76a8('0x3f')],qs[_0x76a8('0x44')](_0x399fc9[_0x76a8('0x40')]['fields']));_0x14abd6[_0x76a8('0x43')]=_0x14abd6['attributes'][_0x76a8('0x45')]?_0x14abd6[_0x76a8('0x43')]:_0x41368b['model'];if(_0x399fc9['query']['includeAll']){_0x14abd6[_0x76a8('0xbb')]=[{'all':!![]}];}_0x14abd6=_[_0x76a8('0x9f')]({},_0x14abd6,_0x399fc9[_0x76a8('0xbc')]);return db[_0x76a8('0x3b')][_0x76a8('0x60')](_0x14abd6)['then'](handleEntityNotFound(_0xfcbce0,null))[_0x76a8('0x2c')](respondWithResult(_0xfcbce0,null))[_0x76a8('0xb8')](handleError(_0xfcbce0,null));};exports['create']=function(_0x596f3c,_0x7a5cd9){return db[_0x76a8('0x3b')]['create'](_0x596f3c[_0x76a8('0x74')],{})['then'](respondWithResult(_0x7a5cd9,0xc9))[_0x76a8('0xb8')](handleError(_0x7a5cd9,null));};exports[_0x76a8('0xbd')]=function(_0x2320bb,_0x24f21d){if(_0x2320bb[_0x76a8('0x74')]['id']){delete _0x2320bb[_0x76a8('0x74')]['id'];}return db[_0x76a8('0x3b')]['find']({'where':{'id':_0x2320bb[_0x76a8('0xb9')]['id']}})[_0x76a8('0x2c')](handleEntityNotFound(_0x24f21d,null))[_0x76a8('0x2c')](saveUpdates(_0x2320bb[_0x76a8('0x74')],null))[_0x76a8('0x2c')](respondWithResult(_0x24f21d,null))['catch'](handleError(_0x24f21d,null));};exports['destroy']=function(_0x450b67,_0x265f98){return db[_0x76a8('0x3b')][_0x76a8('0x60')]({'where':{'id':_0x450b67[_0x76a8('0xb9')]['id']}})['then'](handleEntityNotFound(_0x265f98,null))[_0x76a8('0x2c')](removeEntity(_0x265f98,null))[_0x76a8('0xb8')](handleError(_0x265f98,null));};exports[_0x76a8('0xbe')]=function(_0x96bacc,_0x2fee0c){return db['OpenchannelInteraction'][_0x76a8('0xbe')]()[_0x76a8('0x2c')](respondWithResult(_0x2fee0c,null))[_0x76a8('0xb8')](handleError(_0x2fee0c,null));};exports[_0x76a8('0xbf')]=function(_0x57875c,_0x30c279,_0x144ddb){return db['OpenchannelMessage'][_0x76a8('0x60')]({'where':{'id':_0x57875c[_0x76a8('0xb9')]['id']}})['then'](handleEntityNotFound(_0x30c279,null))['then'](function(_0x257f04){if(_0x257f04){return _0x257f04['addMessage'](_0x57875c['body'][_0x76a8('0xc0')],_['omit'](_0x57875c[_0x76a8('0x74')],[_0x76a8('0xc0'),'id'])||{});}})[_0x76a8('0x2c')](respondWithResult(_0x30c279,null))[_0x76a8('0xb8')](handleError(_0x30c279,null));};exports['getMessages']=function(_0x282af2,_0x5c58bd,_0x3cd9a1){var _0x55e57b={'raw':![],'where':{}};var _0x5ce1dd={};var _0x4ca7e6={'count':0x0,'rows':[]};return db[_0x76a8('0x3b')][_0x76a8('0xc1')]({'where':{'id':_0x282af2['params']['id']}})[_0x76a8('0x2c')](handleEntityNotFound(_0x5c58bd,null))[_0x76a8('0x2c')](function(_0x4070f3){if(_0x4070f3){_0x5ce1dd[_0x76a8('0x3f')]=_['keys'](db['OpenchannelMessage'][_0x76a8('0x3c')]);_0x5ce1dd[_0x76a8('0x40')]=_[_0x76a8('0x41')](_0x282af2[_0x76a8('0x40')]);_0x5ce1dd[_0x76a8('0x42')]=_[_0x76a8('0xba')](_0x5ce1dd[_0x76a8('0x3f')],_0x5ce1dd[_0x76a8('0x40')]);_0x55e57b[_0x76a8('0x43')]=_['intersection'](_0x5ce1dd[_0x76a8('0x3f')],qs[_0x76a8('0x44')](_0x282af2[_0x76a8('0x40')][_0x76a8('0x44')]));_0x55e57b[_0x76a8('0x43')]=_0x55e57b[_0x76a8('0x43')]['length']?_0x55e57b[_0x76a8('0x43')]:_0x5ce1dd[_0x76a8('0x3f')];if(!_0x282af2['query'][_0x76a8('0x46')](_0x76a8('0xc2'))){_0x55e57b[_0x76a8('0x26')]=qs[_0x76a8('0x26')](_0x282af2['query'][_0x76a8('0x26')]);_0x55e57b[_0x76a8('0x25')]=qs[_0x76a8('0x25')](_0x282af2[_0x76a8('0x40')][_0x76a8('0x25')]);}_0x55e57b[_0x76a8('0x93')]=qs[_0x76a8('0x47')](_0x282af2[_0x76a8('0x40')][_0x76a8('0x47')]);_0x55e57b['where']=qs[_0x76a8('0x42')](_[_0x76a8('0xc3')](_0x282af2[_0x76a8('0x40')],_0x5ce1dd[_0x76a8('0x42')]));_0x55e57b[_0x76a8('0x48')][_0x76a8('0xb5')]=_0x4070f3['id'];if(_0x282af2[_0x76a8('0x40')]['filter']){_0x55e57b[_0x76a8('0x48')]=_[_0x76a8('0x9f')](_0x55e57b[_0x76a8('0x48')],{'$or':_[_0x76a8('0x3a')](_0x55e57b[_0x76a8('0x43')],function(_0x199040){var _0x47fe43={};_0x47fe43[_0x199040]={'$like':'%'+_0x282af2['query'][_0x76a8('0x85')]+'%'};return _0x47fe43;})});}if(_0x282af2[_0x76a8('0x40')][_0x76a8('0xc4')]){var _0xe70f37=_0x282af2[_0x76a8('0x40')][_0x76a8('0xc4')][_0x76a8('0x36')](',');var _0x1bd538={};_0x1bd538[_0xe70f37[0x0]]={'$gte':moment(_0xe70f37[0x1])[_0x76a8('0xc5')](_0x76a8('0xc6'))};_0x55e57b['where']=_[_0x76a8('0x9f')](_0x55e57b[_0x76a8('0x48')],_0x1bd538);}_0x55e57b=_[_0x76a8('0x9f')]({},_0x55e57b,_0x282af2[_0x76a8('0xbc')]);return db[_0x76a8('0xc7')][_0x76a8('0x24')]({'where':_0x55e57b[_0x76a8('0x48')]})[_0x76a8('0x2c')](function(_0x32d976){_0x4ca7e6['count']=_0x32d976;if(_0x282af2[_0x76a8('0x40')][_0x76a8('0xc8')]){_0x55e57b[_0x76a8('0xbb')]=[{'all':!![]}];}return db[_0x76a8('0xc7')]['findAll'](_0x55e57b);})['then'](function(_0x26f9b6){_0x4ca7e6[_0x76a8('0xb7')]=_0x26f9b6;return _0x4ca7e6;});}})['then'](respondWithFilteredResult(_0x5c58bd,_0x55e57b))['catch'](handleError(_0x5c58bd,null));};exports[_0x76a8('0xc9')]=function(_0x3af707,_0x18fb69,_0x2c5edd){return db[_0x76a8('0x3b')][_0x76a8('0x60')]({'where':{'id':_0x3af707[_0x76a8('0xb9')]['id']}})[_0x76a8('0x2c')](handleEntityNotFound(_0x18fb69,null))[_0x76a8('0x2c')](function(_0xce00f7){if(_0xce00f7){return _0xce00f7[_0x76a8('0xca')](_0x3af707[_0x76a8('0x74')][_0x76a8('0xc0')],_[_0x76a8('0xcb')](_0x3af707[_0x76a8('0x74')],[_0x76a8('0xc0'),'id'])||{})[_0x76a8('0xcc')](function(){return db[_0x76a8('0x6d')][_0x76a8('0xcd')]({'attributes':['id','name',_0x76a8('0xce')],'where':{'id':_0x3af707[_0x76a8('0x74')][_0x76a8('0xc0')]}});})[_0x76a8('0x2c')](function(_0x266924){socket[_0x76a8('0xcf')]('openchannelInteractionTags:save',{'id':Number(_0x3af707['params']['id']),'tags':_0x266924||[]});return{'id':Number(_0x3af707['params']['id']),'tags':_0x266924||[]};});}})[_0x76a8('0x2c')](respondWithResult(_0x18fb69,null))[_0x76a8('0xb8')](handleError(_0x18fb69,null));};exports[_0x76a8('0xd0')]=function(_0x570eb1,_0x529143,_0x36a287){return db[_0x76a8('0x3b')][_0x76a8('0x60')]({'where':{'id':_0x570eb1[_0x76a8('0xb9')]['id']}})['then'](handleEntityNotFound(_0x529143,null))[_0x76a8('0x2c')](function(_0x1def57){if(_0x1def57){return _0x1def57[_0x76a8('0xd0')](_0x570eb1['query'][_0x76a8('0xc0')]);}})['then'](respondWithStatusCode(_0x529143,null))[_0x76a8('0xb8')](handleError(_0x529143,null));};exports[_0x76a8('0xd1')]=function(_0x33e9b2,_0x558e1e){var _0x2a8dd6=moment()[_0x76a8('0xd2')]()[_0x76a8('0x9e')]();var _0x1eb283=path['join'](config[_0x76a8('0xd3')],_0x76a8('0xd4'),'files',_0x76a8('0xd5'));var _0x44ed8b=path[_0x76a8('0xd6')](config['root'],'server',_0x76a8('0xd7'),_0x76a8('0xd8'));var _0x34e47=path[_0x76a8('0xd6')](_0x1eb283,_0x2a8dd6);var _0x53d9ff=util[_0x76a8('0xc5')](_0x76a8('0xd9'),_0x33e9b2['params']['id'],_0x2a8dd6);var _0x8fe220=path[_0x76a8('0xd6')](_0x1eb283,_0x53d9ff);var _0x5f1531=[];_0x5f1531['push']({'model':db[_0x76a8('0x70')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x5f1531[_0x76a8('0x38')]({'model':db[_0x76a8('0xda')],'as':_0x76a8('0x66'),'attributes':['id',_0x76a8('0xdb'),'lastName'],'raw':!![]});if(_0x33e9b2['query']['attachments']){_0x5f1531[_0x76a8('0x38')]({'model':db[_0x76a8('0xdc')],'as':'Attachment','raw':!![]});}var _0x4f63a9=[{'model':db[_0x76a8('0xc7')],'as':_0x76a8('0xdd'),'attributes':['id',_0x76a8('0x74'),_0x76a8('0xde'),_0x76a8('0xdf'),_0x76a8('0xe0'),_0x76a8('0x80')],'include':_0x5f1531}];_0x4f63a9[_0x76a8('0x38')]({'model':db[_0x76a8('0xe1')],'as':_0x76a8('0xe2'),'attributes':['id',_0x76a8('0x30')]});_0x4f63a9[_0x76a8('0x38')]({'model':db['User'],'as':_0x76a8('0xe3'),'attributes':['id',_0x76a8('0x34')]});return db[_0x76a8('0x3b')][_0x76a8('0x60')]({'where':{'id':_0x33e9b2['params']['id']},'include':_0x4f63a9})[_0x76a8('0x2c')](handleEntityNotFound(_0x558e1e,null))[_0x76a8('0x2c')](function(_0x2fc2ab){if(_0x2fc2ab){var _0x2176dd=_0x2fc2ab['get']({'plain':!![]});fs[_0x76a8('0xe4')](_0x34e47);var _0x3b3e65={'format':'A4','border':_0x76a8('0xe5'),'header':{'height':'40px','contents':{'first':_0x76a8('0xe6')}},'footer':{'height':_0x76a8('0xe7'),'contents':{'default':util[_0x76a8('0xc5')](_0x76a8('0xe8'),util['format'](_0x76a8('0xe9'),_0x76a8('0xea'),_0x2176dd['id']),moment()['format'](_0x76a8('0xeb'))[_0x76a8('0x9e')]())}}};var _0x8d8f26={'channel':'Openchannel','account':_0x2176dd[_0x76a8('0xe2')][_0x76a8('0x30')],'agent':_0x2176dd[_0x76a8('0xe3')]?_0x2176dd['Owner'][_0x76a8('0x34')]:'N.A.','createdAt':moment(_0x2176dd[_0x76a8('0xde')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x76a8('0x9e')](),'closedAt':_0x2176dd[_0x76a8('0xec')]?moment(_0x2176dd[_0x76a8('0xed')])[_0x76a8('0xc5')](_0x76a8('0xc6'))[_0x76a8('0x9e')]():'','disposition':_0x2176dd['disposition'],'visibility':_0x2176dd[_0x76a8('0xee')]?_0x76a8('0xef'):_0x76a8('0xf0'),'messages':_(_0x2176dd[_0x76a8('0xdd')])['filter']({'secret':![]})[_0x76a8('0x3a')](function(_0x18e202){if(_0x18e202[_0x76a8('0xdc')]){var _0x24d599=path[_0x76a8('0xd6')](_0x44ed8b,_0x18e202['Attachment'][_0x76a8('0xf1')]);if(fs[_0x76a8('0xf2')](_0x24d599)){fs['createReadStream'](_0x24d599)['pipe'](fs[_0x76a8('0xf3')](path[_0x76a8('0xd6')](_0x34e47,_0x18e202[_0x76a8('0xdc')][_0x76a8('0xf1')])));}}return{'date':moment(_0x18e202[_0x76a8('0xde')])[_0x76a8('0xc5')](_0x76a8('0xc6'))[_0x76a8('0x9e')](),'sender':_0x18e202['direction']==='out'?_0x18e202['User']?_0x18e202['User'][_0x76a8('0x34')]:_0x76a8('0xf4'):_0x18e202[_0x76a8('0x66')][_0x76a8('0xdb')]+(_0x18e202[_0x76a8('0x66')]['lastName']?'\x20'+_0x18e202[_0x76a8('0x66')][_0x76a8('0xf5')]:''),'body':_0x18e202[_0x76a8('0xdc')]?_0x18e202[_0x76a8('0xdc')][_0x76a8('0xf1')]:_0x18e202[_0x76a8('0x74')],'direction':_0x18e202[_0x76a8('0xdf')]===_0x76a8('0xf6')?'A':'C','secret':_0x18e202[_0x76a8('0xe0')],'read':_0x18e202[_0x76a8('0x80')],'attachment':_0x18e202[_0x76a8('0xdc')]};})['value']()};return ejs[_0x76a8('0xf7')](path[_0x76a8('0xd6')](config['root'],_0x76a8('0xd4'),'views',_0x76a8('0xf8')),{'interaction':_0x8d8f26})[_0x76a8('0x2c')](function(_0x22657f){return new BPromise(function(_0x16ea4b,_0x2d6710){pdf['create'](_0x22657f,_0x3b3e65)['toFile'](path[_0x76a8('0xd6')](_0x34e47,_0x76a8('0xf9')+_0x2176dd['id']+'-'+_0x2a8dd6+'.pdf'),function(_0x1e00ac,_0x104073){if(_0x1e00ac)return _0x2d6710(_0x1e00ac);_0x16ea4b(_0x104073);});});})[_0x76a8('0x2c')](function(){return new BPromise(function(_0x1f1e5e,_0x388d82){zipdir(_0x34e47,{'saveTo':_0x8fe220},function(_0xc9c950,_0x1e73cd){if(_0xc9c950)return _0x388d82(_0xc9c950);return _0x1f1e5e(_0x1e73cd);});})[_0x76a8('0x2c')](function(){return new BPromise(function(_0x10b26b,_0x2b1d71){rimraf(_0x34e47,function(_0x2c6f5f){if(_0x2c6f5f)_0x2b1d71(_0x2c6f5f);return _0x10b26b();});});})[_0x76a8('0x2c')](function(){return _0x558e1e[_0x76a8('0xd1')](_0x8fe220,_0x53d9ff,function(_0x5d6e2b){if(_0x5d6e2b){console[_0x76a8('0xfa')]('err',_0x5d6e2b);}else{fs['unlinkSync'](_0x8fe220);}});});});}else{return _0x558e1e[_0x76a8('0x21')](0xc8);}})[_0x76a8('0xb8')](handleError(_0x558e1e,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index eaf1a35..ef15e7c 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 _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 +var _0x9b71=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hook'];(function(_0x383875,_0x45b02b){var _0x128fc2=function(_0x247f99){while(--_0x247f99){_0x383875['push'](_0x383875['shift']());}};_0x128fc2(++_0x45b02b);}(_0x9b71,0x1aa));var _0x19b7=function(_0x51b25d,_0x4035cf){_0x51b25d=_0x51b25d-0x0;var _0x5351de=_0x9b71[_0x51b25d];return _0x5351de;};'use strict';var EventEmitter=require(_0x19b7('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x19b7('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x19b7('0x2')](0x0);var events={'afterCreate':_0x19b7('0x3'),'afterUpdate':_0x19b7('0x4'),'afterDestroy':_0x19b7('0x5')};function emitEvent(_0x2b140b){return function(_0x5df642,_0x5f4f75,_0x13e522){_0x5df642[_0x19b7('0x6')]({'attributes':['id'],'raw':!![]})[_0x19b7('0x7')](function(_0xf852e0){_0x5df642[_0x19b7('0x8')](_0x19b7('0x9'),_0xf852e0[_0x19b7('0xa')](function(_0x2b1e32){return{'id':_0x2b1e32['id']};}));return OpenchannelMessage[_0x19b7('0xb')]({'where':{'OpenchannelInteractionId':_0x5df642['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1ada88){_0x5df642[_0x19b7('0x8')]('unreadMessages',_0x1ada88[_0x19b7('0xc')]);OpenchannelInteractionEvents[_0x19b7('0xd')](_0x2b140b+':'+_0x5df642['id'],_0x5df642);OpenchannelInteractionEvents[_0x19b7('0xd')](_0x2b140b,_0x5df642);_0x13e522(null);})[_0x19b7('0xe')](_0x13e522(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x19b7('0xf')](e,emitEvent(event));}}module[_0x19b7('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 b14a061..d1f0c2e 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 _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 +var _0x8f9d=['../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4c4f8a,_0x4efb9f){var _0x55b208=function(_0x17fe7d){while(--_0x17fe7d){_0x4c4f8a['push'](_0x4c4f8a['shift']());}};_0x55b208(++_0x4efb9f);}(_0x8f9d,0x93));var _0xd8f9=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8f9d[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xd8f9('0x0'));var util=require('util');var logger=require(_0xd8f9('0x1'))('api');var moment=require(_0xd8f9('0x2'));var BPromise=require(_0xd8f9('0x3'));var rp=require(_0xd8f9('0x4'));var fs=require('fs');var path=require(_0xd8f9('0x5'));var rimraf=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var attributes=require(_0xd8f9('0x8'));module['exports']=function(_0x1c37be,_0x24dd1e){return _0x1c37be[_0xd8f9('0x9')](_0xd8f9('0xa'),attributes,{'tableName':_0xd8f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c410f,_0x46babd,_0x6691e){if(_0x5c410f['changed'](_0xd8f9('0xc'))){_0x5c410f['closedAt']=moment()['format'](_0xd8f9('0xd'));}_0x6691e(null,_0x5c410f);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 2f39bec..9c267a4 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 _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 +var _0x5699=['where','attributes','limit','AddTagsToOpenchannelInteraction','find','then','addTags','ids','spread','AddTags','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x5699,0xaf));var _0x9569=function(_0x3514ae,_0x3a6ffa){_0x3514ae=_0x3514ae-0x0;var _0x1f168c=_0x5699[_0x3514ae];return _0x1f168c;};'use strict';var _=require(_0x9569('0x0'));var util=require(_0x9569('0x1'));var moment=require(_0x9569('0x2'));var BPromise=require('bluebird');var rs=require(_0x9569('0x3'));var fs=require('fs');var Redis=require(_0x9569('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9569('0x5'));var logger=require(_0x9569('0x6'))('rpc');var config=require(_0x9569('0x7'));var jayson=require(_0x9569('0x8'));var client=jayson[_0x9569('0x9')][_0x9569('0xa')]({'port':0x232a});config['redis']=_[_0x9569('0xb')](config['redis'],{'host':_0x9569('0xc'),'port':0x18eb});var socket=require(_0x9569('0xd'))(new Redis(config['redis']));require(_0x9569('0xe'))[_0x9569('0xf')](socket);function respondWithRpcPromise(_0x2077d0,_0x467e1a,_0x37a32a){return new BPromise(function(_0x5c799b,_0x4708ca){return client['request'](_0x2077d0,_0x37a32a)['then'](function(_0x454867){logger['info'](_0x9569('0x10'),_0x467e1a,_0x9569('0x11'));logger[_0x9569('0x12')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x467e1a,'request\x20sent',JSON[_0x9569('0x13')](_0x454867));if(_0x454867['error']){if(_0x454867['error'][_0x9569('0x14')]===0x1f4){logger[_0x9569('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x467e1a,_0x454867['error'][_0x9569('0x16')]);return _0x4708ca(_0x454867[_0x9569('0x15')][_0x9569('0x16')]);}logger[_0x9569('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x467e1a,_0x454867['error'][_0x9569('0x16')]);return _0x5c799b(_0x454867['error'][_0x9569('0x16')]);}else{logger[_0x9569('0x17')](_0x9569('0x10'),_0x467e1a,_0x9569('0x11'));_0x5c799b(_0x454867['result'][_0x9569('0x16')]);}})['catch'](function(_0x2d393b){logger[_0x9569('0x15')](_0x9569('0x10'),_0x467e1a,_0x2d393b);_0x4708ca(_0x2d393b);});});}exports[_0x9569('0x18')]=function(_0x308b9e){var _0x54acf8=this;return new Promise(function(_0x1da65d,_0xfc0d24){return db[_0x9569('0x19')][_0x9569('0x1a')](_0x308b9e[_0x9569('0x1b')],{'raw':_0x308b9e[_0x9569('0x1c')]?_0x308b9e[_0x9569('0x1c')][_0x9569('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x308b9e[_0x9569('0x1c')]?_0x308b9e['options'][_0x9569('0x1e')]||null:null,'attributes':_0x308b9e['options']?_0x308b9e[_0x9569('0x1c')][_0x9569('0x1f')]||null:null,'limit':_0x308b9e[_0x9569('0x1c')]?_0x308b9e[_0x9569('0x1c')][_0x9569('0x20')]||null:null})['then'](function(_0x12476c){logger[_0x9569('0x17')](_0x9569('0x18'),_0x308b9e);logger[_0x9569('0x12')](_0x9569('0x18'),_0x308b9e,JSON[_0x9569('0x13')](_0x12476c));_0x1da65d(_0x12476c);})['catch'](function(_0x41f47b){logger['error']('UpdateOpenchannelInteraction',_0x41f47b[_0x9569('0x16')],_0x308b9e);_0xfc0d24(_0x54acf8['error'](0x1f4,_0x41f47b[_0x9569('0x16')]));});});};exports[_0x9569('0x21')]=function(_0x18ce3d){return new Promise(function(_0x43e505,_0x25cc38){return db[_0x9569('0x19')][_0x9569('0x22')]({'where':_0x18ce3d[_0x9569('0x1c')]?_0x18ce3d[_0x9569('0x1c')][_0x9569('0x1e')]||null:null})[_0x9569('0x23')](function(_0x2b3e1d){if(_0x2b3e1d){return _0x2b3e1d[_0x9569('0x24')](_0x18ce3d['body'][_0x9569('0x25')],_['omit'](_0x18ce3d[_0x9569('0x1b')],[_0x9569('0x25'),'id'])||{});}})[_0x9569('0x26')](function(_0x58178f){logger[_0x9569('0x17')](_0x9569('0x27'),_0x18ce3d);logger['debug'](_0x9569('0x27'),_0x18ce3d,JSON['stringify'](_0x58178f));_0x43e505(_0x58178f);})[_0x9569('0x28')](function(_0x2bc6d1){logger[_0x9569('0x15')](_0x9569('0x27'),_0x2bc6d1[_0x9569('0x16')],_0x18ce3d);_0x25cc38(_this[_0x9569('0x15')](0x1f4,_0x2bc6d1['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index ca54b14..de55cd7 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 _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 +var _0xb34b=['remove','register','length','./openchannelInteraction.events','save'];(function(_0x41ee3f,_0x177fef){var _0xdffe9f=function(_0x427568){while(--_0x427568){_0x41ee3f['push'](_0x41ee3f['shift']());}};_0xdffe9f(++_0x177fef);}(_0xb34b,0x14d));var _0xbb34=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb34b[_0x57b54c];return _0x59cc19;};'use strict';var OpenchannelInteractionEvents=require(_0xbb34('0x0'));var events=[_0xbb34('0x1'),_0xbb34('0x2'),'update'];function createListener(_0x3b6119,_0x26a5d2){return function(_0x3c407d){_0x26a5d2['emit'](_0x3b6119,_0x3c407d);};}function removeListener(_0x39aadc,_0x5aa699){return function(){OpenchannelInteractionEvents['removeListener'](_0x39aadc,_0x5aa699);};}exports[_0xbb34('0x3')]=function(_0x414768){for(var _0x54cee1=0x0,_0x2e204e=events[_0xbb34('0x4')];_0x54cee1<_0x2e204e;_0x54cee1++){var _0x3928b9=events[_0x54cee1];var _0x42b138=createListener('openchannelInteraction:'+_0x3928b9,_0x414768);OpenchannelInteractionEvents['on'](_0x3928b9,_0x42b138);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 5447bd3..29248ea 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 _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 +var _0x076e=['delete','destroy','exports','multer','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','put','update','accept','/:id/reject','reject'];(function(_0x562621,_0x1c7d90){var _0x410de6=function(_0x430f15){while(--_0x430f15){_0x562621['push'](_0x562621['shift']());}};_0x410de6(++_0x1c7d90);}(_0x076e,0x153));var _0xe076=function(_0x33d519,_0x5235e3){_0x33d519=_0x33d519-0x0;var _0x2f83ef=_0x076e[_0x33d519];return _0x2f83ef;};'use strict';var multer=require(_0xe076('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe076('0x1')]();var auth=require(_0xe076('0x2'));var interaction=require(_0xe076('0x3'));var config=require(_0xe076('0x4'));var controller=require('./openchannelMessage.controller');router[_0xe076('0x5')]('/',auth[_0xe076('0x6')](),controller[_0xe076('0x7')]);router[_0xe076('0x5')]('/describe',auth[_0xe076('0x6')](),controller[_0xe076('0x8')]);router[_0xe076('0x5')](_0xe076('0x9'),auth[_0xe076('0x6')](),controller[_0xe076('0xa')]);router[_0xe076('0xb')]('/',auth[_0xe076('0x6')](),interaction[_0xe076('0xc')](_0xe076('0xd'),_0xe076('0xe')),controller[_0xe076('0xf')]);router[_0xe076('0x10')](_0xe076('0x9'),auth[_0xe076('0x6')](),controller[_0xe076('0x11')]);router[_0xe076('0x10')]('/:id/accept',auth[_0xe076('0x6')](),controller[_0xe076('0x12')]);router['put'](_0xe076('0x13'),auth[_0xe076('0x6')](),controller[_0xe076('0x14')]);router[_0xe076('0x15')](_0xe076('0x9'),auth[_0xe076('0x6')](),controller[_0xe076('0x16')]);module[_0xe076('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 180f6cb..ba395fa 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 _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 +var _0x45aa=['medium','BOOLEAN','out','STRING','exports','TEXT'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x45aa,0x154));var _0xa45a=function(_0x318372,_0x56ae1e){_0x318372=_0x318372-0x0;var _0x518e04=_0x45aa[_0x318372];return _0x518e04;};'use strict';var Sequelize=require('sequelize');module[_0xa45a('0x0')]={'body':{'type':Sequelize[_0xa45a('0x1')](_0xa45a('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xa45a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa45a('0x4')),'defaultValue':_0xa45a('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xa45a('0x5')]},'providerResponse':{'type':Sequelize[_0xa45a('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 8465103..135e532 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 _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 +var _0x05dc=['length','create','body','find','describe','openchannel-interactions','accept','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','CmContact','Contact','OpenchannelInteraction','isNil','read1stAt','interaction','get','info','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','SIP/%s','event','EventManager','acceptmessage','UserId','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','channel','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','request','debug','request\x20sent','stringify','code','error','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params'];(function(_0x483e3a,_0x568361){var _0x43fca9=function(_0x273d7e){while(--_0x273d7e){_0x483e3a['push'](_0x483e3a['shift']());}};_0x43fca9(++_0x568361);}(_0x05dc,0x19c));var _0xc05d=function(_0x7430b4,_0x3526ec){_0x7430b4=_0x7430b4-0x0;var _0x44bbd5=_0x05dc[_0x7430b4];return _0x44bbd5;};'use strict';var pdf=require(_0xc05d('0x0'));var emlformat=require(_0xc05d('0x1'));var rimraf=require(_0xc05d('0x2'));var zipdir=require(_0xc05d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc05d('0x4'));var moment=require(_0xc05d('0x5'));var BPromise=require(_0xc05d('0x6'));var Mustache=require(_0xc05d('0x7'));var util=require(_0xc05d('0x8'));var path=require(_0xc05d('0x9'));var sox=require(_0xc05d('0xa'));var csv=require(_0xc05d('0xb'));var ejs=require(_0xc05d('0xc'));var fs=require('fs');var _=require(_0xc05d('0xd'));var squel=require(_0xc05d('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc05d('0xf'));var toCsv=require(_0xc05d('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc05d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc05d('0x11'));var hardwareService=require(_0xc05d('0x12'));var logger=require(_0xc05d('0x13'))(_0xc05d('0x14'));var utils=require(_0xc05d('0x15'));var config=require(_0xc05d('0x16'));var licenseUtil=require(_0xc05d('0x17'));var db=require(_0xc05d('0x18'))['db'];config[_0xc05d('0x19')]=_[_0xc05d('0x1a')](config['redis'],{'host':_0xc05d('0x1b'),'port':0x18eb});var socket=require(_0xc05d('0x1c'))(new Redis(config['redis']));require(_0xc05d('0x1d'))[_0xc05d('0x1e')](socket);var jayson=require(_0xc05d('0x1f'));var client=jayson['client'][_0xc05d('0x20')]({'port':0x232c});var client9002=jayson[_0xc05d('0x21')][_0xc05d('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x33082a,_0x4f6e3f,_0x21b722,_0x4b8e3e){return new BPromise(function(_0xcb0012,_0x206b08){var _0x33bdc8=_0x4b8e3e||client;return _0x33bdc8[_0xc05d('0x22')](_0x33082a,_0x21b722)['then'](function(_0x36a35f){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x4f6e3f,'request\x20sent');logger[_0xc05d('0x23')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x4f6e3f,_0xc05d('0x24'),JSON[_0xc05d('0x25')](_0x36a35f));if(_0x36a35f['error']){if(_0x36a35f['error'][_0xc05d('0x26')]===0x1f4){logger[_0xc05d('0x27')](_0xc05d('0x28'),_0x4f6e3f,_0x36a35f['error'][_0xc05d('0x29')]);return _0x206b08(_0x36a35f[_0xc05d('0x27')]['message']);}logger[_0xc05d('0x27')](_0xc05d('0x28'),_0x4f6e3f,_0x36a35f[_0xc05d('0x27')][_0xc05d('0x29')]);return _0xcb0012(_0x36a35f['error'][_0xc05d('0x29')]);}else{logger['info'](_0xc05d('0x28'),_0x4f6e3f,_0xc05d('0x24'));_0xcb0012(_0x36a35f[_0xc05d('0x2a')][_0xc05d('0x29')]);}})[_0xc05d('0x2b')](function(_0x21e1cc){logger[_0xc05d('0x27')](_0xc05d('0x28'),_0x4f6e3f,_0x21e1cc);_0x206b08(_0x21e1cc);});});}function respondWithStatusCode(_0x268419,_0x5cdefd){_0x5cdefd=_0x5cdefd||0xcc;return function(_0x5091bd){if(_0x5091bd){return _0x268419['sendStatus'](_0x5cdefd);}return _0x268419[_0xc05d('0x2c')](_0x5cdefd)['end']();};}function respondWithResult(_0x3c5a8b,_0x5c5ca2){_0x5c5ca2=_0x5c5ca2||0xc8;return function(_0x2a8743){if(_0x2a8743){return _0x3c5a8b[_0xc05d('0x2c')](_0x5c5ca2)[_0xc05d('0x2d')](_0x2a8743);}};}function respondWithFilteredResult(_0x376718,_0x151871){return function(_0x146d2a){if(_0x146d2a){var _0xea6de1=_0x146d2a[_0xc05d('0x2e')],_0x3a9357=_0x151871['offset'],_0x54cc96=_0x151871[_0xc05d('0x2f')]+_0x151871[_0xc05d('0x30')],_0x52031c;if(_0x54cc96>=_0xea6de1){_0x54cc96=_0xea6de1;_0x52031c=0xc8;}else{_0x52031c=0xce;}_0x376718[_0xc05d('0x2c')](_0x52031c);return _0x376718[_0xc05d('0x31')](_0xc05d('0x32'),_0x3a9357+'-'+_0x54cc96+'/'+_0xea6de1)['json'](_0x146d2a);}return null;};}function patchUpdates(_0x3996e9){return function(_0x3b3c4e){try{jsonpatch[_0xc05d('0x33')](_0x3b3c4e,_0x3996e9,!![]);}catch(_0x7a4aaf){return BPromise[_0xc05d('0x34')](_0x7a4aaf);}return _0x3b3c4e[_0xc05d('0x35')]();};}function saveUpdates(_0x1bfe59,_0x599877){return function(_0x2c142f){if(_0x2c142f){return _0x2c142f[_0xc05d('0x36')](_0x1bfe59)[_0xc05d('0x37')](function(_0x1243a8){return _0x1243a8;});}return null;};}function removeEntity(_0x50757b,_0x481067){return function(_0x3529cd){if(_0x3529cd){return _0x3529cd[_0xc05d('0x38')]()[_0xc05d('0x37')](function(){_0x50757b[_0xc05d('0x2c')](0xcc)[_0xc05d('0x39')]();});}};}function handleEntityNotFound(_0x382f9c,_0x5974eb){return function(_0x3e541b){if(!_0x3e541b){_0x382f9c[_0xc05d('0x3a')](0x194);}return _0x3e541b;};}function handleError(_0x511db8,_0x43a3b0){_0x43a3b0=_0x43a3b0||0x1f4;return function(_0xa3bb44){logger[_0xc05d('0x27')](_0xa3bb44[_0xc05d('0x3b')]);if(_0xa3bb44[_0xc05d('0x3c')]){delete _0xa3bb44['name'];}_0x511db8['status'](_0x43a3b0)[_0xc05d('0x3d')](_0xa3bb44);};}exports[_0xc05d('0x3e')]=function(_0x23ef6a,_0x57833b){var _0x57987d={},_0xcd9fa9={},_0xa6de91={'count':0x0,'rows':[]};var _0x50e233=_['map'](db[_0xc05d('0x3f')][_0xc05d('0x40')],function(_0x1ea5fa){return{'name':_0x1ea5fa[_0xc05d('0x41')],'type':_0x1ea5fa[_0xc05d('0x42')]['key']};});_0xcd9fa9[_0xc05d('0x43')]=_[_0xc05d('0x44')](_0x50e233,'name');_0xcd9fa9['query']=_[_0xc05d('0x45')](_0x23ef6a[_0xc05d('0x46')]);_0xcd9fa9[_0xc05d('0x47')]=_['intersection'](_0xcd9fa9['model'],_0xcd9fa9[_0xc05d('0x46')]);_0x57987d['attributes']=_[_0xc05d('0x48')](_0xcd9fa9[_0xc05d('0x43')],qs['fields'](_0x23ef6a[_0xc05d('0x46')][_0xc05d('0x49')]));_0x57987d['attributes']=_0x57987d[_0xc05d('0x4a')]['length']?_0x57987d[_0xc05d('0x4a')]:_0xcd9fa9['model'];if(!_0x23ef6a[_0xc05d('0x46')][_0xc05d('0x4b')]('nolimit')){_0x57987d[_0xc05d('0x30')]=qs[_0xc05d('0x30')](_0x23ef6a['query'][_0xc05d('0x30')]);_0x57987d[_0xc05d('0x2f')]=qs[_0xc05d('0x2f')](_0x23ef6a['query'][_0xc05d('0x2f')]);}_0x57987d[_0xc05d('0x4c')]=qs[_0xc05d('0x4d')](_0x23ef6a['query'][_0xc05d('0x4d')]);_0x57987d[_0xc05d('0x4e')]=qs[_0xc05d('0x47')](_[_0xc05d('0x4f')](_0x23ef6a[_0xc05d('0x46')],_0xcd9fa9[_0xc05d('0x47')]),_0x50e233);if(_0x23ef6a[_0xc05d('0x46')][_0xc05d('0x50')]){_0x57987d['where']=_['merge'](_0x57987d[_0xc05d('0x4e')],{'$or':_['map'](_0x50e233,function(_0x374032){if(_0x374032[_0xc05d('0x42')]!=='VIRTUAL'){var _0x57d577={};_0x57d577[_0x374032['name']]={'$like':'%'+_0x23ef6a[_0xc05d('0x46')][_0xc05d('0x50')]+'%'};return _0x57d577;}})});}_0x57987d=_[_0xc05d('0x51')]({},_0x57987d,_0x23ef6a[_0xc05d('0x52')]);var _0x8a870b={'where':_0x57987d[_0xc05d('0x4e')]};return db[_0xc05d('0x3f')]['count'](_0x8a870b)[_0xc05d('0x37')](function(_0x3dcc2f){_0xa6de91[_0xc05d('0x2e')]=_0x3dcc2f;if(_0x23ef6a[_0xc05d('0x46')][_0xc05d('0x53')]){_0x57987d[_0xc05d('0x54')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xc05d('0x55')](_0x57987d);})[_0xc05d('0x37')](function(_0x64a2b0){_0xa6de91['rows']=_0x64a2b0;return _0xa6de91;})[_0xc05d('0x37')](respondWithFilteredResult(_0x57833b,_0x57987d))[_0xc05d('0x2b')](handleError(_0x57833b,null));};exports[_0xc05d('0x56')]=function(_0x2375bd,_0x4ab4bc){var _0x1b7066={'raw':!![],'where':{'id':_0x2375bd[_0xc05d('0x57')]['id']}},_0x4c9309={};_0x4c9309[_0xc05d('0x43')]=_[_0xc05d('0x45')](db['OpenchannelMessage'][_0xc05d('0x40')]);_0x4c9309['query']=_[_0xc05d('0x45')](_0x2375bd[_0xc05d('0x46')]);_0x4c9309['filters']=_[_0xc05d('0x48')](_0x4c9309[_0xc05d('0x43')],_0x4c9309['query']);_0x1b7066['attributes']=_['intersection'](_0x4c9309[_0xc05d('0x43')],qs[_0xc05d('0x49')](_0x2375bd['query'][_0xc05d('0x49')]));_0x1b7066[_0xc05d('0x4a')]=_0x1b7066[_0xc05d('0x4a')][_0xc05d('0x58')]?_0x1b7066['attributes']:_0x4c9309['model'];if(_0x2375bd[_0xc05d('0x46')][_0xc05d('0x53')]){_0x1b7066[_0xc05d('0x54')]=[{'all':!![]}];}_0x1b7066=_['merge']({},_0x1b7066,_0x2375bd[_0xc05d('0x52')]);return db[_0xc05d('0x3f')]['find'](_0x1b7066)[_0xc05d('0x37')](handleEntityNotFound(_0x4ab4bc,null))['then'](respondWithResult(_0x4ab4bc,null))[_0xc05d('0x2b')](handleError(_0x4ab4bc,null));};exports[_0xc05d('0x59')]=function(_0x48579d,_0x6f9f21){return db['OpenchannelMessage'][_0xc05d('0x59')](_0x48579d[_0xc05d('0x5a')],{})[_0xc05d('0x37')](respondWithResult(_0x6f9f21,0xc9))['catch'](handleError(_0x6f9f21,null));};exports['update']=function(_0x524cd3,_0x106fa3){if(_0x524cd3[_0xc05d('0x5a')]['id']){delete _0x524cd3[_0xc05d('0x5a')]['id'];}return db[_0xc05d('0x3f')][_0xc05d('0x5b')]({'where':{'id':_0x524cd3[_0xc05d('0x57')]['id']}})[_0xc05d('0x37')](handleEntityNotFound(_0x106fa3,null))[_0xc05d('0x37')](saveUpdates(_0x524cd3[_0xc05d('0x5a')],null))[_0xc05d('0x37')](respondWithResult(_0x106fa3,null))[_0xc05d('0x2b')](handleError(_0x106fa3,null));};exports[_0xc05d('0x38')]=function(_0x346bdf,_0xe27095){return db[_0xc05d('0x3f')][_0xc05d('0x5b')]({'where':{'id':_0x346bdf[_0xc05d('0x57')]['id']}})[_0xc05d('0x37')](handleEntityNotFound(_0xe27095,null))[_0xc05d('0x37')](removeEntity(_0xe27095,null))[_0xc05d('0x2b')](handleError(_0xe27095,null));};exports['describe']=function(_0x842e00,_0x124598){return db[_0xc05d('0x3f')][_0xc05d('0x5c')]()[_0xc05d('0x37')](respondWithResult(_0x124598,null))['catch'](handleError(_0x124598,null));};var interaction_log=require(_0xc05d('0x13'))(_0xc05d('0x5d'));exports[_0xc05d('0x5e')]=function(_0x5508ed,_0x47daaf,_0x26de24){var _0x30ea6e={'agent':{},'channel':_0xc05d('0x5f')};if(_0x5508ed[_0xc05d('0x5a')]['id']){delete _0x5508ed[_0xc05d('0x5a')]['id'];}_0x5508ed[_0xc05d('0x5a')][_0xc05d('0x60')]=!![];_0x5508ed[_0xc05d('0x5a')]['readAt']=moment()[_0xc05d('0x61')](_0xc05d('0x62'));_0x5508ed[_0xc05d('0x5a')]['UserId']=_0x5508ed[_0xc05d('0x5a')]['UserId']||_0x5508ed[_0xc05d('0x63')]['id'];_0x30ea6e[_0xc05d('0x64')]['id']=_0x5508ed[_0xc05d('0x5a')]['UserId'];return db[_0xc05d('0x3f')][_0xc05d('0x5b')]({'where':{'id':_0x5508ed[_0xc05d('0x57')]['id'],'UserId':null},'include':[{'model':db[_0xc05d('0x65')],'as':_0xc05d('0x66')}]})[_0xc05d('0x37')](handleEntityNotFound(_0x47daaf,null))[_0xc05d('0x37')](saveUpdates(_0x5508ed['body'],null))['then'](function(_0x14a82){if(_0x14a82){_0x30ea6e[_0xc05d('0x29')]=_0x14a82['get']({'plain':!![]});return db[_0xc05d('0x67')][_0xc05d('0x5b')]({'where':{'id':_0x14a82['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x47daaf,null))[_0xc05d('0x37')](function(_0x2075bb){if(_0x2075bb){return _0x2075bb[_0xc05d('0x36')]({'UserId':_0x5508ed[_0xc05d('0x5a')]['UserId'],'read1stAt':_[_0xc05d('0x68')](_0x2075bb[_0xc05d('0x69')])?moment()[_0xc05d('0x61')](_0xc05d('0x62')):undefined});}return null;})['then'](function(_0x1d596f){if(_0x1d596f){_0x30ea6e[_0xc05d('0x6a')]=_0x1d596f[_0xc05d('0x6b')]({'plain':!![]});interaction_log[_0xc05d('0x6c')](_0xc05d('0x6d'),_0x5508ed[_0xc05d('0x63')]['id'],_0x5508ed['user'][_0xc05d('0x3c')],_0x5508ed[_0xc05d('0x63')][_0xc05d('0x6e')],_0x30ea6e[_0xc05d('0x6a')]['id'],_0x5508ed[_0xc05d('0x5a')]?JSON[_0xc05d('0x25')](_0x5508ed['body']):_0xc05d('0x6f'));return respondWithRpcPromise(_0xc05d('0x70'),'acceptMessage',_0x30ea6e);}return null;})[_0xc05d('0x37')](function(_0x152941){if(_0x152941){if(_0x5508ed[_0xc05d('0x5a')][_0xc05d('0x71')]){_0x30ea6e[_0xc05d('0x29')][_0xc05d('0x72')]=util[_0xc05d('0x61')](_0xc05d('0x73'),_0x5508ed[_0xc05d('0x63')]['name']);_0x30ea6e[_0xc05d('0x29')]['channel']=_0x30ea6e['channel'];_0x30ea6e[_0xc05d('0x29')][_0xc05d('0x74')]='accept';return respondWithRpcPromise(_0xc05d('0x75'),'EventManager',{'event':_0xc05d('0x76'),'message':_0x30ea6e['message']},client9002)[_0xc05d('0x37')](function(){return _0x30ea6e;});}return _0x30ea6e;}return null;})['then'](respondWithResult(_0x47daaf,null))[_0xc05d('0x2b')](handleError(_0x47daaf,null));};var interaction_log=require(_0xc05d('0x13'))('openchannel-interactions');exports[_0xc05d('0x34')]=function(_0x3c24e1,_0x50227f,_0x5ae240){var _0x5ed956={'agent':{},'channel':'openchannel'};if(_0x3c24e1[_0xc05d('0x5a')]['id']){delete _0x3c24e1[_0xc05d('0x5a')]['id'];}_0x3c24e1[_0xc05d('0x5a')][_0xc05d('0x77')]=_0x3c24e1['body'][_0xc05d('0x77')]||_0x3c24e1[_0xc05d('0x63')]['id'];_0x5ed956[_0xc05d('0x64')]['id']=_0x3c24e1[_0xc05d('0x5a')]['UserId'];return db[_0xc05d('0x3f')][_0xc05d('0x5b')]({'where':{'id':_0x3c24e1[_0xc05d('0x57')]['id'],'UserId':null}})[_0xc05d('0x37')](handleEntityNotFound(_0x50227f,null))['then'](function(_0x24eb63){if(_0x24eb63){_0x5ed956['message']=_0x24eb63['get']({'plain':!![]});return db[_0xc05d('0x67')][_0xc05d('0x5b')]({'where':{'id':_0x24eb63[_0xc05d('0x78')]}});}return null;})[_0xc05d('0x37')](handleEntityNotFound(_0x50227f,null))[_0xc05d('0x37')](function(_0x2f2e6b){if(_0x2f2e6b){_0x5ed956[_0xc05d('0x6a')]=_0x2f2e6b[_0xc05d('0x6b')]({'plain':!![]});interaction_log['info'](_0xc05d('0x79'),_0x3c24e1[_0xc05d('0x63')]['id'],_0x3c24e1[_0xc05d('0x63')]['name'],_0x3c24e1[_0xc05d('0x63')][_0xc05d('0x6e')],_0x5ed956[_0xc05d('0x6a')]['id'],_0x3c24e1[_0xc05d('0x5a')]?JSON[_0xc05d('0x25')](_0x3c24e1['body']):_0xc05d('0x6f'));return respondWithRpcPromise(_0xc05d('0x7a'),'rejectMessage',_0x5ed956);}return null;})[_0xc05d('0x37')](function(_0x5a275d){if(_0x5a275d){_0x5a275d[_0xc05d('0x29')][_0xc05d('0x72')]=util[_0xc05d('0x61')](_0xc05d('0x73'),_0x3c24e1[_0xc05d('0x63')][_0xc05d('0x3c')]);_0x5a275d[_0xc05d('0x29')][_0xc05d('0x7b')]=_0x5ed956[_0xc05d('0x7b')];_0x5a275d['message'][_0xc05d('0x74')]=_0xc05d('0x34');respondWithRpcPromise('EventManager',_0xc05d('0x75'),{'event':_0xc05d('0x7c'),'message':_0x5a275d[_0xc05d('0x29')]},client9002);return _0x5ed956;}return null;})['then'](respondWithResult(_0x50227f,null))[_0xc05d('0x2b')](handleError(_0x50227f,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 7dc9c39..43cbe69 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 _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 +var _0xf933=['setMaxListeners','update','remove','emit','hook','events','../../mysqldb','OpenchannelMessage'];(function(_0x2de5d9,_0x3c8beb){var _0x18b1b0=function(_0x4d4811){while(--_0x4d4811){_0x2de5d9['push'](_0x2de5d9['shift']());}};_0x18b1b0(++_0x3c8beb);}(_0xf933,0x175));var _0x3f93=function(_0x5400a1,_0x2275aa){_0x5400a1=_0x5400a1-0x0;var _0x4006c7=_0xf933[_0x5400a1];return _0x4006c7;};'use strict';var EventEmitter=require(_0x3f93('0x0'));var OpenchannelMessage=require(_0x3f93('0x1'))['db'][_0x3f93('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x3f93('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3f93('0x4'),'afterDestroy':_0x3f93('0x5')};function emitEvent(_0x1c3302){return function(_0x165384,_0x3e2bf2,_0x1f2434){OpenchannelMessageEvents['emit'](_0x1c3302+':'+_0x165384['id'],_0x165384);OpenchannelMessageEvents[_0x3f93('0x6')](_0x1c3302,_0x165384);_0x1f2434(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x3f93('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index f419653..5454ab7 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 _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 +var _0x6462=['method','GET','POST','format','threadId','Interaction','inspect','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','OpenchannelInteraction','findOne','then','update','createdAt','catch','error','CmContact','OpenchannelAccount','find','Interactions','OpenchannelInteractionId','Contact','keys','get','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','omit'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x6462,0x160));var _0x2646=function(_0x351782,_0x183c66){_0x351782=_0x351782-0x0;var _0x520c8b=_0x6462[_0x351782];return _0x520c8b;};'use strict';var _=require(_0x2646('0x0'));var util=require(_0x2646('0x1'));var logger=require(_0x2646('0x2'))(_0x2646('0x3'));var moment=require('moment');var BPromise=require(_0x2646('0x4'));var rp=require(_0x2646('0x5'));var fs=require('fs');var path=require(_0x2646('0x6'));var rimraf=require('rimraf');var config=require(_0x2646('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0x2646('0x8')]=function(_0x4ea91c,_0x466e44){return _0x4ea91c[_0x2646('0x9')](_0x2646('0xa'),attributes,{'tableName':_0x2646('0xb'),'paranoid':![],'indexes':[{'name':_0x2646('0xc'),'fields':[_0x2646('0xd')],'type':_0x2646('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x23f83b,_0x44fe38,_0x5a4e3d){var _0x3c38da=_0x4ea91c[_0x2646('0xf')];var _0x3c95cb=_0x23f83b['get']({'plain':!![]});if(_0x3c95cb[_0x2646('0x10')][_0x2646('0x11')]()==='in'||_0x3c95cb[_0x2646('0x10')][_0x2646('0x11')]()===_0x2646('0x12')&&!_0x3c95cb[_0x2646('0x13')]&&!_['isNil'](_0x3c95cb['UserId'])){_0x3c38da[_0x2646('0x14')][_0x2646('0x15')]({'where':{'id':_0x3c95cb['OpenchannelInteractionId']}})[_0x2646('0x16')](function(_0x5b00a6){if(_0x5b00a6){_0x5b00a6[_0x2646('0x17')]({'lastMsgAt':_0x3c95cb[_0x2646('0x18')],'lastMsgDirection':_0x3c95cb[_0x2646('0x10')][_0x2646('0x11')]()});}})[_0x2646('0x19')](function(_0x2c55f5){console[_0x2646('0x1a')](_0x2c55f5);});}if(_0x3c95cb[_0x2646('0x10')]===_0x2646('0x12')&&!_0x3c95cb['secret']){var _0x58a29c;_0x3c38da[_0x2646('0x1b')]['describe']()['then'](function(_0x43e007){return _0x3c38da[_0x2646('0x1c')][_0x2646('0x1d')]({'where':{'id':_0x3c95cb['OpenchannelAccountId']},'include':[{'model':_0x3c38da[_0x2646('0x14')],'as':_0x2646('0x1e'),'where':{'id':_0x3c95cb[_0x2646('0x1f')]},'limit':0x1,'include':[{'model':_0x3c38da['CmContact'],'as':_0x2646('0x20'),'attributes':_[_0x2646('0x21')](_0x43e007)}]}]});})[_0x2646('0x16')](function(_0x25d946){_0x58a29c=_0x25d946[_0x2646('0x22')]({'plain':!![]});if(_0x58a29c&&_0x58a29c['replyUri']){logger[_0x2646('0x23')](_0x2646('0x24'),_0x2646('0x25'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x3c95cb['id'],_0x58a29c['replyUri']));if(_0x58a29c[_0x2646('0x1e')]&&_0x58a29c['Interactions'][_0x2646('0x26')]){_0x3c95cb['Interaction']=_[_0x2646('0x27')](_0x58a29c[_0x2646('0x1e')][0x0],_0x2646('0x20'));_0x3c95cb['Contact']=_0x58a29c['Interactions'][0x0][_0x2646('0x20')];}var _0x44fe38={'method':'POST','uri':encodeURI(_0x58a29c['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x44fe38[_0x2646('0x28')]){case _0x2646('0x29'):_0x44fe38['qs']=_0x3c95cb;break;case _0x2646('0x2a'):_0x44fe38[_0x2646('0xd')]=_0x3c95cb;break;}return rp(_0x44fe38)['then'](function(_0x2b2955){logger[_0x2646('0x23')](_0x2646('0x24'),'afterCreate',util[_0x2646('0x2b')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x3c95cb['id'],_0x58a29c['replyUri']));if(_0x2b2955[_0x2646('0xd')][_0x2646('0x2c')]&&_0x2b2955[_0x2646('0xd')][_0x2646('0x2c')]!=_0x3c95cb[_0x2646('0x2d')][_0x2646('0x2c')]){return _0x3c38da[_0x2646('0x14')]['update']({'threadId':_0x2b2955[_0x2646('0xd')]['threadId']},{'logging':!![],'where':{'id':_0x3c95cb['Interaction']['id']}});}else{return;}})[_0x2646('0x16')](function(){return _0x23f83b[_0x2646('0x17')]({'read':!![]});})['catch'](function(_0x5378c6){logger[_0x2646('0x1a')]('OpenchannelMessage,\x20%s,\x20%s',_0x2646('0x25'),util[_0x2646('0x2e')](_0x5378c6,{'showHidden':![],'depth':null}));_0x5a4e3d();});}else{_0x5a4e3d();}})[_0x2646('0x2f')](function(){_0x5a4e3d();});}else{_0x5a4e3d();}}},'charset':'utf8mb4','collate':_0x2646('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 4e9c975..24bd589 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_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 +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x372b1d,_0x4ef413){var _0x357963=function(_0x3ed5d6){while(--_0x3ed5d6){_0x372b1d['push'](_0x372b1d['shift']());}};_0x357963(++_0x4ef413);}(_0x5f2f,0x73));var _0xf5f2=function(_0x211b7a,_0x864ee2){_0x211b7a=_0x211b7a-0x0;var _0x22d5f5=_0x5f2f[_0x211b7a];return _0x22d5f5;};'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});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index a130c49..86aa376 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 _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 +var _0xedd9=['removeListener','register','length','openchannelMessage:','save','remove','update','emit'];(function(_0x23d679,_0x1a4ba2){var _0x370008=function(_0x5f0425){while(--_0x5f0425){_0x23d679['push'](_0x23d679['shift']());}};_0x370008(++_0x1a4ba2);}(_0xedd9,0xfc));var _0x9edd=function(_0x5d3379,_0x33e21b){_0x5d3379=_0x5d3379-0x0;var _0xacfdb4=_0xedd9[_0x5d3379];return _0xacfdb4;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x9edd('0x0'),_0x9edd('0x1'),_0x9edd('0x2')];function createListener(_0x2c16b8,_0x3b51bc){return function(_0x127cbe){_0x3b51bc[_0x9edd('0x3')](_0x2c16b8,_0x127cbe);};}function removeListener(_0x36b53f,_0x5943b3){return function(){OpenchannelMessageEvents[_0x9edd('0x4')](_0x36b53f,_0x5943b3);};}exports[_0x9edd('0x5')]=function(_0x268f9e){for(var _0x34c1a7=0x0,_0x5319f7=events[_0x9edd('0x6')];_0x34c1a7<_0x5319f7;_0x34c1a7++){var _0x571af9=events[_0x34c1a7];var _0x172522=createListener(_0x9edd('0x7')+_0x571af9,_0x268f9e);OpenchannelMessageEvents['on'](_0x571af9,_0x172522);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 89ffc94..bf7e632 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 _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 +var _0x0b3d=['getMembers','getTeams','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','exports','multer','path','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x242e41,_0x2beb78){var _0x171510=function(_0x4d8a5a){while(--_0x4d8a5a){_0x242e41['push'](_0x242e41['shift']());}};_0x171510(++_0x2beb78);}(_0x0b3d,0x76));var _0xd0b3=function(_0x163ab5,_0x6a7dbe){_0x163ab5=_0x163ab5-0x0;var _0x17e579=_0x0b3d[_0x163ab5];return _0x17e579;};'use strict';var multer=require(_0xd0b3('0x0'));var util=require('util');var path=require(_0xd0b3('0x1'));var timeout=require('connect-timeout');var express=require(_0xd0b3('0x2'));var router=express['Router']();var auth=require(_0xd0b3('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd0b3('0x4'));var controller=require('./openchannelQueue.controller');router[_0xd0b3('0x5')]('/',auth[_0xd0b3('0x6')](),controller['index']);router[_0xd0b3('0x5')]('/describe',auth[_0xd0b3('0x6')](),controller['describe']);router['get'](_0xd0b3('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xd0b3('0x5')]('/:id/members',auth[_0xd0b3('0x6')](),controller[_0xd0b3('0x8')]);router['get']('/:id/teams',auth[_0xd0b3('0x6')](),controller[_0xd0b3('0x9')]);router[_0xd0b3('0x5')](_0xd0b3('0xa'),auth['isAuthenticated'](),controller['getAgents']);router[_0xd0b3('0xb')]('/',auth[_0xd0b3('0x6')](),controller[_0xd0b3('0xc')]);router[_0xd0b3('0xb')](_0xd0b3('0xd'),auth[_0xd0b3('0x6')](),controller[_0xd0b3('0xe')]);router['post'](_0xd0b3('0xa'),auth[_0xd0b3('0x6')](),controller[_0xd0b3('0xf')]);router[_0xd0b3('0x10')]('/:id',auth[_0xd0b3('0x6')](),controller[_0xd0b3('0x11')]);router[_0xd0b3('0x12')]('/:id',auth[_0xd0b3('0x6')](),controller[_0xd0b3('0x13')]);router['delete'](_0xd0b3('0xd'),auth[_0xd0b3('0x6')](),controller['removeTeams']);router[_0xd0b3('0x12')](_0xd0b3('0xa'),auth[_0xd0b3('0x6')](),controller['removeAgents']);module[_0xd0b3('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index ef3993b..ac2ecab 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 _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 +var _0x42fa=['roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x413f20,_0x530557){var _0x31309b=function(_0x1b1de9){while(--_0x1b1de9){_0x413f20['push'](_0x413f20['shift']());}};_0x31309b(++_0x530557);}(_0x42fa,0x161));var _0xa42f=function(_0x4246bd,_0x51191b){_0x4246bd=_0x4246bd-0x0;var _0x4aea95=_0x42fa[_0x4246bd];return _0x4aea95;};'use strict';var Sequelize=require(_0xa42f('0x0'));module[_0xa42f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa42f('0x2')]},'timeout':{'type':Sequelize[_0xa42f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa42f('0x4')](_0xa42f('0x5'),_0xa42f('0x6'),_0xa42f('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index be024b9..1692985 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 _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 +var _0x66ad=['User','online','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','select','field','tq.TeamId','team_has_openchannel_queues','user_has_teams','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','userOpenchannelQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','status','end','count','offset','limit','set','json','apply','save','update','then','destroy','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','OpenchannelQueue','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','options','includeAll','findAll','catch','show','rawAttributes','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','describe','getMembers','findOne','UserOpenchannelQueue','order','findAndCountAll','UserId','agent','createdAt','rows','format','%s/%s','openchannelPause','updatedAt','getTeams','Team','pick','ids'];(function(_0xb0de07,_0x3ca2a0){var _0x4633d8=function(_0x2368e0){while(--_0x2368e0){_0xb0de07['push'](_0xb0de07['shift']());}};_0x4633d8(++_0x3ca2a0);}(_0x66ad,0x12a));var _0xd66a=function(_0xd0c661,_0x458554){_0xd0c661=_0xd0c661-0x0;var _0x224591=_0x66ad[_0xd0c661];return _0x224591;};'use strict';var pdf=require(_0xd66a('0x0'));var emlformat=require(_0xd66a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd66a('0x2'));var jsonpatch=require(_0xd66a('0x3'));var rp=require('request-promise');var moment=require(_0xd66a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd66a('0x5'));var util=require(_0xd66a('0x6'));var path=require(_0xd66a('0x7'));var sox=require('sox');var csv=require(_0xd66a('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd66a('0x9'));var squel=require(_0xd66a('0xa'));var crypto=require('crypto');var jsforce=require(_0xd66a('0xb'));var deskjs=require(_0xd66a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd66a('0xd'));var Papa=require('papaparse');var Redis=require(_0xd66a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd66a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd66a('0x10'));var logger=require(_0xd66a('0x11'))(_0xd66a('0x12'));var utils=require(_0xd66a('0x13'));var config=require(_0xd66a('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd66a('0x15')]=_[_0xd66a('0x16')](config['redis'],{'host':_0xd66a('0x17'),'port':0x18eb});var socket=require(_0xd66a('0x18'))(new Redis(config[_0xd66a('0x15')]));require(_0xd66a('0x19'))['register'](socket);function respondWithStatusCode(_0x46cfa8,_0x2c4334){_0x2c4334=_0x2c4334||0xcc;return function(_0x1ceb6e){if(_0x1ceb6e){return _0x46cfa8['sendStatus'](_0x2c4334);}return _0x46cfa8[_0xd66a('0x1a')](_0x2c4334)[_0xd66a('0x1b')]();};}function respondWithResult(_0x401a4e,_0x2ea979){_0x2ea979=_0x2ea979||0xc8;return function(_0x4b17ad){if(_0x4b17ad){return _0x401a4e[_0xd66a('0x1a')](_0x2ea979)['json'](_0x4b17ad);}};}function respondWithFilteredResult(_0x519ff0,_0x42361f){return function(_0xcf67c){if(_0xcf67c){var _0x225e1b=_0xcf67c[_0xd66a('0x1c')],_0x335ebe=_0x42361f[_0xd66a('0x1d')],_0x576288=_0x42361f['offset']+_0x42361f[_0xd66a('0x1e')],_0xd90717;if(_0x576288>=_0x225e1b){_0x576288=_0x225e1b;_0xd90717=0xc8;}else{_0xd90717=0xce;}_0x519ff0[_0xd66a('0x1a')](_0xd90717);return _0x519ff0[_0xd66a('0x1f')]('Content-Range',_0x335ebe+'-'+_0x576288+'/'+_0x225e1b)[_0xd66a('0x20')](_0xcf67c);}return null;};}function patchUpdates(_0x580120){return function(_0x4fc7a1){try{jsonpatch[_0xd66a('0x21')](_0x4fc7a1,_0x580120,!![]);}catch(_0x19339c){return BPromise['reject'](_0x19339c);}return _0x4fc7a1[_0xd66a('0x22')]();};}function saveUpdates(_0x584df7,_0x4c2190){return function(_0x31d593){if(_0x31d593){return _0x31d593[_0xd66a('0x23')](_0x584df7)[_0xd66a('0x24')](function(_0x5ea595){return _0x5ea595;});}return null;};}function removeEntity(_0x292a08,_0x22c813){return function(_0x259f10){if(_0x259f10){return _0x259f10[_0xd66a('0x25')]()[_0xd66a('0x24')](function(){var _0x1354fe=_0x259f10['get']({'plain':!![]});var _0x379073=_0xd66a('0x26');return db[_0xd66a('0x27')][_0xd66a('0x25')]({'where':{'type':_0x379073,'resourceId':_0x1354fe['id']}})['then'](function(){return _0x259f10;});})[_0xd66a('0x24')](function(){_0x292a08['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x133abf,_0x110e35){return function(_0x441891){if(!_0x441891){_0x133abf[_0xd66a('0x28')](0x194);}return _0x441891;};}function handleError(_0xce655e,_0x562986){_0x562986=_0x562986||0x1f4;return function(_0xb2e230){logger[_0xd66a('0x29')](_0xb2e230[_0xd66a('0x2a')]);if(_0xb2e230[_0xd66a('0x2b')]){delete _0xb2e230['name'];}_0xce655e[_0xd66a('0x1a')](_0x562986)[_0xd66a('0x2c')](_0xb2e230);};}exports[_0xd66a('0x2d')]=function(_0x2a3125,_0x732c0d){var _0x4b46d1={},_0x31c722={},_0x2d3bf1={'count':0x0,'rows':[]};var _0x122b3b=_[_0xd66a('0x2e')](db[_0xd66a('0x2f')]['rawAttributes'],function(_0x584620){return{'name':_0x584620[_0xd66a('0x30')],'type':_0x584620['type'][_0xd66a('0x31')]};});_0x31c722[_0xd66a('0x32')]=_[_0xd66a('0x2e')](_0x122b3b,'name');_0x31c722[_0xd66a('0x33')]=_[_0xd66a('0x34')](_0x2a3125[_0xd66a('0x33')]);_0x31c722[_0xd66a('0x35')]=_[_0xd66a('0x36')](_0x31c722[_0xd66a('0x32')],_0x31c722['query']);_0x4b46d1[_0xd66a('0x37')]=_[_0xd66a('0x36')](_0x31c722['model'],qs[_0xd66a('0x38')](_0x2a3125['query'][_0xd66a('0x38')]));_0x4b46d1['attributes']=_0x4b46d1[_0xd66a('0x37')][_0xd66a('0x39')]?_0x4b46d1[_0xd66a('0x37')]:_0x31c722[_0xd66a('0x32')];if(!_0x2a3125['query'][_0xd66a('0x3a')](_0xd66a('0x3b'))){_0x4b46d1[_0xd66a('0x1e')]=qs['limit'](_0x2a3125[_0xd66a('0x33')][_0xd66a('0x1e')]);_0x4b46d1['offset']=qs[_0xd66a('0x1d')](_0x2a3125['query']['offset']);}_0x4b46d1['order']=qs[_0xd66a('0x3c')](_0x2a3125[_0xd66a('0x33')]['sort']);_0x4b46d1['where']=qs['filters'](_['pick'](_0x2a3125[_0xd66a('0x33')],_0x31c722[_0xd66a('0x35')]),_0x122b3b);if(_0x2a3125[_0xd66a('0x33')][_0xd66a('0x3d')]){_0x4b46d1[_0xd66a('0x3e')]=_[_0xd66a('0x3f')](_0x4b46d1[_0xd66a('0x3e')],{'$or':_['map'](_0x122b3b,function(_0x4cd794){if(_0x4cd794['type']!=='VIRTUAL'){var _0xb67323={};_0xb67323[_0x4cd794[_0xd66a('0x2b')]]={'$like':'%'+_0x2a3125['query'][_0xd66a('0x3d')]+'%'};return _0xb67323;}})});}_0x4b46d1=_[_0xd66a('0x3f')]({},_0x4b46d1,_0x2a3125[_0xd66a('0x40')]);var _0x201ac3={'where':_0x4b46d1[_0xd66a('0x3e')]};return db[_0xd66a('0x2f')][_0xd66a('0x1c')](_0x201ac3)[_0xd66a('0x24')](function(_0x2a1fd6){_0x2d3bf1[_0xd66a('0x1c')]=_0x2a1fd6;if(_0x2a3125['query'][_0xd66a('0x41')]){_0x4b46d1['include']=[{'all':!![]}];}return db[_0xd66a('0x2f')][_0xd66a('0x42')](_0x4b46d1);})[_0xd66a('0x24')](function(_0x535bf7){_0x2d3bf1['rows']=_0x535bf7;return _0x2d3bf1;})[_0xd66a('0x24')](respondWithFilteredResult(_0x732c0d,_0x4b46d1))[_0xd66a('0x43')](handleError(_0x732c0d,null));};exports[_0xd66a('0x44')]=function(_0x254e51,_0x50751e){var _0x7bdc50={'raw':!![],'where':{'id':_0x254e51['params']['id']}},_0x15f866={};_0x15f866['model']=_[_0xd66a('0x34')](db[_0xd66a('0x2f')][_0xd66a('0x45')]);_0x15f866[_0xd66a('0x33')]=_['keys'](_0x254e51['query']);_0x15f866[_0xd66a('0x35')]=_[_0xd66a('0x36')](_0x15f866[_0xd66a('0x32')],_0x15f866[_0xd66a('0x33')]);_0x7bdc50['attributes']=_[_0xd66a('0x36')](_0x15f866[_0xd66a('0x32')],qs[_0xd66a('0x38')](_0x254e51[_0xd66a('0x33')][_0xd66a('0x38')]));_0x7bdc50[_0xd66a('0x37')]=_0x7bdc50[_0xd66a('0x37')][_0xd66a('0x39')]?_0x7bdc50['attributes']:_0x15f866['model'];if(_0x254e51['query'][_0xd66a('0x41')]){_0x7bdc50[_0xd66a('0x46')]=[{'all':!![]}];}_0x7bdc50=_[_0xd66a('0x3f')]({},_0x7bdc50,_0x254e51[_0xd66a('0x40')]);return db['OpenchannelQueue'][_0xd66a('0x47')](_0x7bdc50)[_0xd66a('0x24')](handleEntityNotFound(_0x50751e,null))[_0xd66a('0x24')](respondWithResult(_0x50751e,null))[_0xd66a('0x43')](handleError(_0x50751e,null));};exports['create']=function(_0x57493a,_0x28009f){return db[_0xd66a('0x2f')][_0xd66a('0x48')](_0x57493a[_0xd66a('0x49')],{})[_0xd66a('0x24')](function(_0x5abadf){var _0x3db66f=_0x57493a['user'][_0xd66a('0x4a')]({'plain':!![]});if(!_0x3db66f)throw new Error(_0xd66a('0x4b'));if(_0x3db66f[_0xd66a('0x4c')]==='user'){var _0x380112=_0x5abadf[_0xd66a('0x4a')]({'plain':!![]});var _0x4818dc='OpenchannelQueues';return db[_0xd66a('0x4d')][_0xd66a('0x47')]({'where':{'name':_0x4818dc,'userProfileId':_0x3db66f[_0xd66a('0x4e')]},'raw':!![]})[_0xd66a('0x24')](function(_0xa838db){if(_0xa838db&&_0xa838db['autoAssociation']===0x0){return db[_0xd66a('0x27')][_0xd66a('0x48')]({'name':_0x380112[_0xd66a('0x2b')],'resourceId':_0x380112['id'],'type':_0xa838db[_0xd66a('0x2b')],'sectionId':_0xa838db['id']},{})[_0xd66a('0x24')](function(){return _0x5abadf;});}else{return _0x5abadf;}})[_0xd66a('0x43')](function(_0x2a942d){logger[_0xd66a('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a942d);throw _0x2a942d;});}return _0x5abadf;})[_0xd66a('0x24')](respondWithResult(_0x28009f,0xc9))[_0xd66a('0x43')](handleError(_0x28009f,null));};exports[_0xd66a('0x23')]=function(_0x37b63c,_0x27a629){if(_0x37b63c[_0xd66a('0x49')]['id']){delete _0x37b63c['body']['id'];}return db[_0xd66a('0x2f')][_0xd66a('0x47')]({'where':{'id':_0x37b63c[_0xd66a('0x4f')]['id']}})[_0xd66a('0x24')](handleEntityNotFound(_0x27a629,null))[_0xd66a('0x24')](saveUpdates(_0x37b63c[_0xd66a('0x49')],null))[_0xd66a('0x24')](respondWithResult(_0x27a629,null))[_0xd66a('0x43')](handleError(_0x27a629,null));};exports[_0xd66a('0x25')]=function(_0x39ab9a,_0x503ab5){return db[_0xd66a('0x2f')][_0xd66a('0x47')]({'where':{'id':_0x39ab9a[_0xd66a('0x4f')]['id']}})[_0xd66a('0x24')](handleEntityNotFound(_0x503ab5,null))['then'](removeEntity(_0x503ab5,null))['catch'](handleError(_0x503ab5,null));};exports[_0xd66a('0x50')]=function(_0x5e40a,_0x2fb06e){return db['OpenchannelQueue'][_0xd66a('0x50')]()[_0xd66a('0x24')](respondWithResult(_0x2fb06e,null))[_0xd66a('0x43')](handleError(_0x2fb06e,null));};exports[_0xd66a('0x51')]=function(_0x4a21b3,_0x2abda1,_0x204d0b){var _0x22bca0={'raw':!![],'where':{}},_0x5f1873={},_0x42c5d3;return db[_0xd66a('0x2f')][_0xd66a('0x52')]({'where':{'id':_0x4a21b3[_0xd66a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2abda1,null))[_0xd66a('0x24')](function(_0x25bba4){if(_0x25bba4){_0x42c5d3=_0x25bba4['get']({'plain':!![]});_0x5f1873[_0xd66a('0x32')]=_[_0xd66a('0x34')](db[_0xd66a('0x53')][_0xd66a('0x45')]);_0x5f1873[_0xd66a('0x33')]=_[_0xd66a('0x34')](_0x4a21b3['query']);_0x5f1873[_0xd66a('0x35')]=_['intersection'](_0x5f1873[_0xd66a('0x32')],_0x5f1873[_0xd66a('0x33')]);_0x22bca0['attributes']=_[_0xd66a('0x36')](_0x5f1873[_0xd66a('0x32')],qs[_0xd66a('0x38')](_0x4a21b3[_0xd66a('0x33')]['fields']));_0x22bca0[_0xd66a('0x37')]=_0x22bca0[_0xd66a('0x37')][_0xd66a('0x39')]?_0x22bca0[_0xd66a('0x37')]:_0x5f1873[_0xd66a('0x32')];if(!_0x4a21b3[_0xd66a('0x33')][_0xd66a('0x3a')](_0xd66a('0x3b'))){_0x22bca0[_0xd66a('0x1e')]=qs[_0xd66a('0x1e')](_0x4a21b3[_0xd66a('0x33')][_0xd66a('0x1e')]);_0x22bca0[_0xd66a('0x1d')]=qs[_0xd66a('0x1d')](_0x4a21b3['query'][_0xd66a('0x1d')]);}_0x22bca0[_0xd66a('0x54')]=qs['sort'](_0x4a21b3['query']['sort']);_0x22bca0[_0xd66a('0x3e')]=qs['filters'](_['pick'](_0x4a21b3[_0xd66a('0x33')],_0x5f1873['filters']));_0x22bca0['where']['OpenchannelQueueId']=_0x25bba4['id'];if(_0x4a21b3['query'][_0xd66a('0x3d')]){_0x22bca0['where']=_[_0xd66a('0x3f')](_0x22bca0['where'],{'$or':_[_0xd66a('0x2e')](_0x22bca0[_0xd66a('0x37')],function(_0x5c065b){var _0x135999={};_0x135999[_0x5c065b]={'$like':'%'+_0x4a21b3[_0xd66a('0x33')][_0xd66a('0x3d')]+'%'};return _0x135999;})});}_0x22bca0=_[_0xd66a('0x3f')]({},_0x22bca0,_0x4a21b3[_0xd66a('0x40')]);return db[_0xd66a('0x53')][_0xd66a('0x42')](_0x22bca0);}})[_0xd66a('0x24')](function(_0x1326e5){if(_0x1326e5){return db['User'][_0xd66a('0x55')]({'where':{'id':_[_0xd66a('0x2e')](_0x1326e5,_0xd66a('0x56')),'role':_0xd66a('0x57')},'attributes':['id',_0xd66a('0x2b'),'openchannelPause','updatedAt',_0xd66a('0x58')]});}})[_0xd66a('0x24')](function(_0x56e9bb){if(_0x56e9bb){return{'count':_0x56e9bb[_0xd66a('0x1c')],'rows':_[_0xd66a('0x2e')](_0x56e9bb[_0xd66a('0x59')],function(_0x2f608e){return{'membername':_0x2f608e[_0xd66a('0x2b')],'UserId':_0x2f608e['id'],'queue_name':_0x42c5d3[_0xd66a('0x2b')],'OpenchannelQueueId':_0x42c5d3['id'],'interface':util[_0xd66a('0x5a')](_0xd66a('0x5b'),'SIP',_0x2f608e['name']),'penalty':0x0,'paused':_0x2f608e[_0xd66a('0x5c')],'createdAt':_0x2f608e[_0xd66a('0x58')],'updatedAt':_0x2f608e[_0xd66a('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd66a('0x24')](respondWithFilteredResult(_0x2abda1,_0x22bca0))[_0xd66a('0x43')](handleError(_0x2abda1,null));};exports[_0xd66a('0x5e')]=function(_0x26b811,_0x48e690,_0x184c65){var _0x4fc29a={};var _0x35065d={};var _0x5b17b3;var _0x7e1f6e;return db[_0xd66a('0x2f')][_0xd66a('0x52')]({'where':{'id':_0x26b811[_0xd66a('0x4f')]['id']}})[_0xd66a('0x24')](handleEntityNotFound(_0x48e690,null))[_0xd66a('0x24')](function(_0x4c9005){if(_0x4c9005){_0x5b17b3=_0x4c9005;_0x35065d[_0xd66a('0x32')]=_[_0xd66a('0x34')](db[_0xd66a('0x5f')][_0xd66a('0x45')]);_0x35065d['query']=_[_0xd66a('0x34')](_0x26b811['query']);_0x35065d['filters']=_[_0xd66a('0x36')](_0x35065d[_0xd66a('0x32')],_0x35065d[_0xd66a('0x33')]);_0x4fc29a['attributes']=_[_0xd66a('0x36')](_0x35065d[_0xd66a('0x32')],qs['fields'](_0x26b811[_0xd66a('0x33')][_0xd66a('0x38')]));_0x4fc29a['attributes']=_0x4fc29a[_0xd66a('0x37')][_0xd66a('0x39')]?_0x4fc29a[_0xd66a('0x37')]:_0x35065d[_0xd66a('0x32')];_0x4fc29a[_0xd66a('0x54')]=qs[_0xd66a('0x3c')](_0x26b811[_0xd66a('0x33')][_0xd66a('0x3c')]);_0x4fc29a['where']=qs[_0xd66a('0x35')](_[_0xd66a('0x60')](_0x26b811[_0xd66a('0x33')],_0x35065d['filters']));if(_0x26b811[_0xd66a('0x33')][_0xd66a('0x3d')]){_0x4fc29a['where']=_[_0xd66a('0x3f')](_0x4fc29a[_0xd66a('0x3e')],{'$or':_['map'](_0x4fc29a[_0xd66a('0x37')],function(_0x59478f){var _0x4b6dcc={};_0x4b6dcc[_0x59478f]={'$like':'%'+_0x26b811['query'][_0xd66a('0x3d')]+'%'};return _0x4b6dcc;})});}_0x4fc29a=_['merge']({},_0x4fc29a,_0x26b811['options']);return _0x5b17b3[_0xd66a('0x5e')](_0x4fc29a);}})[_0xd66a('0x24')](function(_0x30e54a){if(_0x30e54a){_0x7e1f6e=_0x30e54a[_0xd66a('0x39')];if(!_0x26b811[_0xd66a('0x33')][_0xd66a('0x3a')]('nolimit')){_0x4fc29a[_0xd66a('0x1e')]=qs[_0xd66a('0x1e')](_0x26b811[_0xd66a('0x33')][_0xd66a('0x1e')]);_0x4fc29a[_0xd66a('0x1d')]=qs['offset'](_0x26b811[_0xd66a('0x33')][_0xd66a('0x1d')]);}return _0x5b17b3['getTeams'](_0x4fc29a);}})[_0xd66a('0x24')](function(_0x359ecd){if(_0x359ecd){return _0x359ecd?{'count':_0x7e1f6e,'rows':_0x359ecd}:null;}})[_0xd66a('0x24')](respondWithResult(_0x48e690,null))[_0xd66a('0x43')](handleError(_0x48e690,null));};exports['addTeams']=function(_0x27cb3b,_0x37aa24,_0x46812a){var _0x3c0320=_0x27cb3b[_0xd66a('0x49')][_0xd66a('0x61')];return db[_0xd66a('0x5f')][_0xd66a('0x42')]({'where':{'id':_0x3c0320},'attributes':['id'],'include':[{'model':db[_0xd66a('0x62')],'as':'Agents','attributes':['id',_0xd66a('0x2b'),_0xd66a('0x63'),'voicePause',_0xd66a('0x64')],'raw':!![]}]})['then'](function(_0x2637f2){if(_0x2637f2){var _0x658110=_[_0xd66a('0x65')](_0x2637f2,function(_0x414481){var _0x14b11f=_0x414481[_0xd66a('0x4a')]({'plain':!![]});return _0x14b11f[_0xd66a('0x66')];});return db[_0xd66a('0x2f')][_0xd66a('0x47')]({'where':{'id':_0x27cb3b['params']['id']}})['then'](function(_0x5894e6){return db[_0xd66a('0x67')]['transaction'](function(_0x1041ca){return _0x5894e6['addTeams'](_0x3c0320,{'transaction':_0x1041ca})[_0xd66a('0x24')](function(){return BPromise[_0xd66a('0x68')](_0x658110,function(_0x45c54e){return db[_0xd66a('0x53')][_0xd66a('0x69')]({'where':{'UserId':_0x45c54e['id'],'OpenchannelQueueId':_0x27cb3b[_0xd66a('0x4f')]['id']},'transaction':_0x1041ca});});})[_0xd66a('0x24')](function(){_0x658110[_0xd66a('0x6a')](function(_0x23add9){socket[_0xd66a('0x6b')](_0xd66a('0x6c'),{'UserId':_0x23add9['id'],'OpenchannelQueueId':_0x5894e6['id']});});});});});}})[_0xd66a('0x24')](respondWithStatusCode(_0x37aa24,null))['catch'](handleError(_0x37aa24,null));};exports['removeTeams']=function(_0x362884,_0x3422ca,_0x45881c){return db[_0xd66a('0x5f')][_0xd66a('0x42')]({'where':{'id':_0x362884[_0xd66a('0x33')][_0xd66a('0x61')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd66a('0x66'),'attributes':['id'],'raw':!![]}]})[_0xd66a('0x24')](handleEntityNotFound(_0x3422ca,null))[_0xd66a('0x24')](function(_0xa310ae){var _0x301e84=_['map'](_0xa310ae,'id');var _0x30f994=[];var _0xf10a07=[];var _0x244181=squel[_0xd66a('0x6d')]();_0x244181[_0xd66a('0x6e')](_0xd66a('0x6f'))['from'](_0xd66a('0x70'),'tq')['join'](_0xd66a('0x71'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xd66a('0x72'),_0x362884['params']['id']);for(var _0x2c4bbb=0x0;_0x2c4bbb<_0xa310ae['length'];_0x2c4bbb+=0x1){let _0x431b4c=_0xa310ae[_0x2c4bbb];for(var _0x5c7f63=0x0;_0x5c7f63<_0x431b4c['Agents']['length'];_0x5c7f63+=0x1){let _0x290e49=_0x431b4c['Agents'][_0x5c7f63];var _0x109b31=_0x244181['clone']();_0x109b31[_0xd66a('0x3e')](_0xd66a('0x73'),_0x290e49['id']);_0xf10a07['push'](db[_0xd66a('0x67')][_0xd66a('0x33')](_0x109b31[_0xd66a('0x74')](),{'type':db[_0xd66a('0x67')]['QueryTypes'][_0xd66a('0x75')]})['then'](function(_0x4c4ecd){if(_0x4c4ecd['length']===0x1){return _0x290e49['id'];}else{var _0x57e024=_['every'](_[_0xd66a('0x2e')](_0x4c4ecd,_0xd66a('0x76')),function(_0x4fd6ec){return _[_0xd66a('0x77')](_0x301e84,_0x4fd6ec);});if(_0x57e024){return _0x290e49['id'];}}}));}}return BPromise[_0xd66a('0x78')](_0xf10a07)[_0xd66a('0x24')](function(_0x3b3e53){_0x30f994=_(_0x30f994)[_0xd66a('0x79')](_0x3b3e53)[_0xd66a('0x7a')]()[_0xd66a('0x7b')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x362884[_0xd66a('0x4f')]['id']}})[_0xd66a('0x24')](function(_0x59b848){return db[_0xd66a('0x67')]['transaction'](function(_0x270b17){return _0x59b848[_0xd66a('0x7c')](_0x362884['query']['ids'],{'transaction':_0x270b17})[_0xd66a('0x24')](function(){if(!_[_0xd66a('0x7d')](_0x30f994)){return _0x59b848['removeAgents'](_0x30f994,{'transaction':_0x270b17});}})['then'](function(){_0x30f994[_0xd66a('0x6a')](function(_0x688fda){socket[_0xd66a('0x6b')](_0xd66a('0x7e'),{'UserId':_0x688fda,'OpenchannelQueueId':_0x59b848['id']});});});});});});})[_0xd66a('0x24')](respondWithStatusCode(_0x3422ca,null))['catch'](handleError(_0x3422ca,null));};exports[_0xd66a('0x7f')]=function(_0xf4d3e0,_0x718005,_0x4a1736){return db[_0xd66a('0x2f')][_0xd66a('0x47')]({'where':{'id':_0xf4d3e0['params']['id']}})[_0xd66a('0x24')](handleEntityNotFound(_0x718005,null))['then'](function(_0x2aa703){if(_0x2aa703){return _0x2aa703[_0xd66a('0x7f')](_0xf4d3e0['body']['ids'],_[_0xd66a('0x80')](_0xf4d3e0['body'],['ids','id'])||{})['spread'](function(_0x2055e8){for(var _0x11bff0=0x0;_0x11bff0<_0xf4d3e0[_0xd66a('0x49')][_0xd66a('0x61')][_0xd66a('0x39')];_0x11bff0+=0x1){socket['emit'](_0xd66a('0x6c'),{'UserId':_0xf4d3e0[_0xd66a('0x49')]['ids'][_0x11bff0],'OpenchannelQueueId':_0xf4d3e0[_0xd66a('0x4f')]['id']});}return _0x2055e8;});}})[_0xd66a('0x24')](respondWithResult(_0x718005,null))[_0xd66a('0x43')](handleError(_0x718005,null));};exports[_0xd66a('0x81')]=function(_0x45502a,_0x5e9033,_0xd91b74){return db['OpenchannelQueue']['find']({'where':{'id':_0x45502a[_0xd66a('0x4f')]['id']}})[_0xd66a('0x24')](handleEntityNotFound(_0x5e9033,null))[_0xd66a('0x24')](function(_0x27f5aa){if(_0x27f5aa){return _0x27f5aa[_0xd66a('0x81')](_0x45502a[_0xd66a('0x33')][_0xd66a('0x61')])[_0xd66a('0x24')](function(){if(_[_0xd66a('0x82')](_0x45502a[_0xd66a('0x33')]['ids'])){for(var _0x21653e=0x0;_0x21653e<_0x45502a[_0xd66a('0x33')][_0xd66a('0x61')][_0xd66a('0x39')];_0x21653e+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x45502a['query'][_0xd66a('0x61')][_0x21653e]),'OpenchannelQueueId':Number(_0x45502a[_0xd66a('0x4f')]['id'])});}}else{socket[_0xd66a('0x6b')](_0xd66a('0x7e'),{'UserId':Number(_0x45502a['query'][_0xd66a('0x61')]),'OpenchannelQueueId':Number(_0x45502a['params']['id'])});}});}})[_0xd66a('0x24')](respondWithStatusCode(_0x5e9033,null))[_0xd66a('0x43')](handleError(_0x5e9033,null));};exports[_0xd66a('0x83')]=function(_0x6bc45c,_0x3615d0,_0x387492){var _0x36a5a4={};var _0x5e87a8={};var _0xc1d6ff;var _0x477473;return db[_0xd66a('0x2f')][_0xd66a('0x52')]({'where':{'id':_0x6bc45c[_0xd66a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3615d0,null))[_0xd66a('0x24')](function(_0x5ca367){if(_0x5ca367){_0xc1d6ff=_0x5ca367;_0x5e87a8['model']=_[_0xd66a('0x34')](db['User'][_0xd66a('0x45')]);_0x5e87a8[_0xd66a('0x33')]=_[_0xd66a('0x34')](_0x6bc45c[_0xd66a('0x33')]);_0x5e87a8[_0xd66a('0x35')]=_[_0xd66a('0x36')](_0x5e87a8[_0xd66a('0x32')],_0x5e87a8[_0xd66a('0x33')]);_0x36a5a4[_0xd66a('0x37')]=_[_0xd66a('0x36')](_0x5e87a8[_0xd66a('0x32')],qs[_0xd66a('0x38')](_0x6bc45c[_0xd66a('0x33')][_0xd66a('0x38')]));_0x36a5a4[_0xd66a('0x37')]=_0x36a5a4[_0xd66a('0x37')][_0xd66a('0x39')]?_0x36a5a4['attributes']:_0x5e87a8[_0xd66a('0x32')];_0x36a5a4[_0xd66a('0x54')]=qs[_0xd66a('0x3c')](_0x6bc45c[_0xd66a('0x33')]['sort']);_0x36a5a4['where']=qs[_0xd66a('0x35')](_[_0xd66a('0x60')](_0x6bc45c[_0xd66a('0x33')],_0x5e87a8[_0xd66a('0x35')]));if(_0x6bc45c[_0xd66a('0x33')][_0xd66a('0x3d')]){_0x36a5a4['where']=_[_0xd66a('0x3f')](_0x36a5a4[_0xd66a('0x3e')],{'$or':_[_0xd66a('0x2e')](_0x36a5a4[_0xd66a('0x37')],function(_0x3dba18){var _0x8da3b9={};_0x8da3b9[_0x3dba18]={'$like':'%'+_0x6bc45c['query']['filter']+'%'};return _0x8da3b9;})});}_0x36a5a4=_[_0xd66a('0x3f')]({},_0x36a5a4,_0x6bc45c[_0xd66a('0x40')]);return _0xc1d6ff[_0xd66a('0x83')](_0x36a5a4);}})[_0xd66a('0x24')](function(_0x404cf6){if(_0x404cf6){_0x477473=_0x404cf6['length'];if(!_0x6bc45c[_0xd66a('0x33')][_0xd66a('0x3a')](_0xd66a('0x3b'))){_0x36a5a4[_0xd66a('0x1e')]=qs[_0xd66a('0x1e')](_0x6bc45c[_0xd66a('0x33')][_0xd66a('0x1e')]);_0x36a5a4[_0xd66a('0x1d')]=qs[_0xd66a('0x1d')](_0x6bc45c[_0xd66a('0x33')][_0xd66a('0x1d')]);}return _0xc1d6ff[_0xd66a('0x83')](_0x36a5a4);}})[_0xd66a('0x24')](function(_0x133875){if(_0x133875){return _0x133875?{'count':_0x477473,'rows':_0x133875}:null;}})[_0xd66a('0x24')](respondWithResult(_0x3615d0,null))[_0xd66a('0x43')](handleError(_0x3615d0,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 080b909..0642bb1 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 _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 +var _0x56b8=['update','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save'];(function(_0x4c34ef,_0x3b438d){var _0x377846=function(_0x2d8741){while(--_0x2d8741){_0x4c34ef['push'](_0x4c34ef['shift']());}};_0x377846(++_0x3b438d);}(_0x56b8,0x12d));var _0x856b=function(_0x390bbe,_0x514843){_0x390bbe=_0x390bbe-0x0;var _0x5aaed0=_0x56b8[_0x390bbe];return _0x5aaed0;};'use strict';var EventEmitter=require(_0x856b('0x0'));var OpenchannelQueue=require(_0x856b('0x1'))['db'][_0x856b('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x856b('0x3')](0x0);var events={'afterCreate':_0x856b('0x4'),'afterUpdate':_0x856b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x509aef){return function(_0x3e7958,_0x489f5e,_0x334140){OpenchannelQueueEvents[_0x856b('0x6')](_0x509aef+':'+_0x3e7958['id'],_0x3e7958);OpenchannelQueueEvents[_0x856b('0x6')](_0x509aef,_0x3e7958);_0x334140(null);};}for(var e in events){if(events[_0x856b('0x7')](e)){var event=events[e];OpenchannelQueue[_0x856b('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index e4571bd..96f1fde 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 _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 +var _0x809a=['../../config/logger','api','moment','./openchannelQueue.attributes','define','openchannel_queues','lodash','util'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x809a,0x186));var _0xa809=function(_0x3fbb29,_0x6372e5){_0x3fbb29=_0x3fbb29-0x0;var _0x4a9526=_0x809a[_0x3fbb29];return _0x4a9526;};'use strict';var _=require(_0xa809('0x0'));var util=require(_0xa809('0x1'));var logger=require(_0xa809('0x2'))(_0xa809('0x3'));var moment=require(_0xa809('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa809('0x5'));module['exports']=function(_0x2c6237,_0x4a161d){return _0x2c6237[_0xa809('0x6')]('OpenchannelQueue',attributes,{'tableName':_0xa809('0x7'),'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 7aa71af..e6d67bd 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 _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 +var _0x8605=['info','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./openchannelQueue.socket','register','then','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetOpenchannelQueue','options','where','attributes','limit','include','map','model','ShowOpenchannelQueue','OpenchannelQueue','find','raw'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8605,0x1c9));var _0x5860=function(_0x574a7e,_0x17f2cb){_0x574a7e=_0x574a7e-0x0;var _0x116ffd=_0x8605[_0x574a7e];return _0x116ffd;};'use strict';var _=require(_0x5860('0x0'));var util=require(_0x5860('0x1'));var moment=require(_0x5860('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5860('0x3'));var db=require(_0x5860('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5860('0x5'))('rpc');var config=require(_0x5860('0x6'));var jayson=require(_0x5860('0x7'));var client=jayson[_0x5860('0x8')][_0x5860('0x9')]({'port':0x232a});config['redis']=_[_0x5860('0xa')](config[_0x5860('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5860('0xc'))(new Redis(config[_0x5860('0xb')]));require(_0x5860('0xd'))[_0x5860('0xe')](socket);function respondWithRpcPromise(_0x123dab,_0x25c1d3,_0x2ae9f5){return new BPromise(function(_0x441184,_0x3bb227){return client['request'](_0x123dab,_0x2ae9f5)[_0x5860('0xf')](function(_0x4b1678){logger['info'](_0x5860('0x10'),_0x25c1d3,'request\x20sent');logger[_0x5860('0x11')](_0x5860('0x12'),_0x25c1d3,_0x5860('0x13'),JSON[_0x5860('0x14')](_0x4b1678));if(_0x4b1678[_0x5860('0x15')]){if(_0x4b1678[_0x5860('0x15')][_0x5860('0x16')]===0x1f4){logger[_0x5860('0x15')](_0x5860('0x10'),_0x25c1d3,_0x4b1678[_0x5860('0x15')]['message']);return _0x3bb227(_0x4b1678['error']['message']);}logger['error'](_0x5860('0x10'),_0x25c1d3,_0x4b1678[_0x5860('0x15')][_0x5860('0x17')]);return _0x441184(_0x4b1678[_0x5860('0x15')][_0x5860('0x17')]);}else{logger['info'](_0x5860('0x10'),_0x25c1d3,_0x5860('0x13'));_0x441184(_0x4b1678['result']['message']);}})[_0x5860('0x18')](function(_0x11b4ea){logger[_0x5860('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x25c1d3,_0x11b4ea);_0x3bb227(_0x11b4ea);});});}exports[_0x5860('0x19')]=function(_0x568003){var _0x291421=this;return new Promise(function(_0x23167b,_0x1371d6){return db['OpenchannelQueue']['findAll']({'raw':_0x568003['options']?_0x568003['options']['raw']===undefined?!![]:![]:!![],'where':_0x568003[_0x5860('0x1a')]?_0x568003[_0x5860('0x1a')][_0x5860('0x1b')]||null:null,'attributes':_0x568003[_0x5860('0x1a')]?_0x568003[_0x5860('0x1a')][_0x5860('0x1c')]||null:null,'limit':_0x568003['options']?_0x568003['options'][_0x5860('0x1d')]||null:null,'include':_0x568003[_0x5860('0x1a')]?_0x568003[_0x5860('0x1a')][_0x5860('0x1e')]?_[_0x5860('0x1f')](_0x568003[_0x5860('0x1a')]['include'],function(_0x19320c){return{'model':db[_0x19320c[_0x5860('0x20')]],'as':_0x19320c['as'],'attributes':_0x19320c[_0x5860('0x1c')],'include':_0x19320c[_0x5860('0x1e')]?_[_0x5860('0x1f')](_0x19320c[_0x5860('0x1e')],function(_0x1b1942){return{'model':db[_0x1b1942['model']],'as':_0x1b1942['as'],'attributes':_0x1b1942['attributes'],'include':_0x1b1942[_0x5860('0x1e')]?_[_0x5860('0x1f')](_0x1b1942[_0x5860('0x1e')],function(_0x14be98){return{'model':db[_0x14be98['model']],'as':_0x14be98['as'],'attributes':_0x14be98['attributes']};}):[]};}):[]};}):[]:[]})[_0x5860('0xf')](function(_0x2ce30d){logger['info'](_0x5860('0x19'),_0x568003);logger[_0x5860('0x11')](_0x5860('0x19'),_0x568003,JSON[_0x5860('0x14')](_0x2ce30d));_0x23167b(_0x2ce30d);})[_0x5860('0x18')](function(_0x56743d){logger[_0x5860('0x15')](_0x5860('0x19'),_0x56743d[_0x5860('0x17')],_0x568003);_0x1371d6(_0x291421[_0x5860('0x15')](0x1f4,_0x56743d[_0x5860('0x17')]));});});};exports[_0x5860('0x21')]=function(_0x105132){var _0x57eb43=this;return new Promise(function(_0x5acb59,_0x46a7d9){return db[_0x5860('0x22')][_0x5860('0x23')]({'raw':_0x105132[_0x5860('0x1a')]?_0x105132[_0x5860('0x1a')][_0x5860('0x24')]===undefined?!![]:![]:!![],'where':_0x105132[_0x5860('0x1a')]?_0x105132['options'][_0x5860('0x1b')]||null:null,'attributes':_0x105132['options']?_0x105132[_0x5860('0x1a')][_0x5860('0x1c')]||null:null,'include':_0x105132['options']?_0x105132[_0x5860('0x1a')][_0x5860('0x1e')]?_['map'](_0x105132[_0x5860('0x1a')][_0x5860('0x1e')],function(_0x252d51){return{'model':db[_0x252d51[_0x5860('0x20')]],'as':_0x252d51['as'],'attributes':_0x252d51[_0x5860('0x1c')],'include':_0x252d51[_0x5860('0x1e')]?_[_0x5860('0x1f')](_0x252d51[_0x5860('0x1e')],function(_0x44f6a9){return{'model':db[_0x44f6a9[_0x5860('0x20')]],'as':_0x44f6a9['as'],'attributes':_0x44f6a9[_0x5860('0x1c')],'include':_0x44f6a9[_0x5860('0x1e')]?_[_0x5860('0x1f')](_0x44f6a9[_0x5860('0x1e')],function(_0x1681a0){return{'model':db[_0x1681a0[_0x5860('0x20')]],'as':_0x1681a0['as'],'attributes':_0x1681a0[_0x5860('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5860('0xf')](function(_0x20939b){logger[_0x5860('0x25')](_0x5860('0x21'),_0x105132);logger[_0x5860('0x11')]('ShowOpenchannelQueue',_0x105132,JSON[_0x5860('0x14')](_0x20939b));_0x5acb59(_0x20939b);})[_0x5860('0x18')](function(_0x4bc70c){logger[_0x5860('0x15')]('ShowOpenchannelQueue',_0x4bc70c[_0x5860('0x17')],_0x105132);_0x46a7d9(_0x57eb43[_0x5860('0x15')](0x1f4,_0x4bc70c[_0x5860('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index c3380a1..cec7487 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 _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 +var _0x8c38=['remove','update','register','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x51f89a,_0x31ab06){var _0x29de14=function(_0x10dbc3){while(--_0x10dbc3){_0x51f89a['push'](_0x51f89a['shift']());}};_0x29de14(++_0x31ab06);}(_0x8c38,0x16d));var _0x88c3=function(_0x1befd9,_0xb45d42){_0x1befd9=_0x1befd9-0x0;var _0xf26749=_0x8c38[_0x1befd9];return _0xf26749;};'use strict';var OpenchannelQueueEvents=require(_0x88c3('0x0'));var events=['save',_0x88c3('0x1'),_0x88c3('0x2')];function createListener(_0xeadc80,_0x342185){return function(_0x46fe42){_0x342185['emit'](_0xeadc80,_0x46fe42);};}function removeListener(_0x157028,_0x2ba457){return function(){OpenchannelQueueEvents['removeListener'](_0x157028,_0x2ba457);};}exports[_0x88c3('0x3')]=function(_0x5284cc){for(var _0x4828e5=0x0,_0x3c84f0=events[_0x88c3('0x4')];_0x4828e5<_0x3c84f0;_0x4828e5++){var _0x59a12f=events[_0x4828e5];var _0x5a86d7=createListener(_0x88c3('0x5')+_0x59a12f,_0x5284cc);OpenchannelQueueEvents['on'](_0x59a12f,_0x5a86d7);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index bfdd406..e98adf6 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 _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 +var _0xc614=['post','create','put','/:id','delete','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','show'];(function(_0x467e24,_0x299d23){var _0x243a62=function(_0x4ab55c){while(--_0x4ab55c){_0x467e24['push'](_0x467e24['shift']());}};_0x243a62(++_0x299d23);}(_0xc614,0xfe));var _0x4c61=function(_0x2f1a23,_0x120632){_0x2f1a23=_0x2f1a23-0x0;var _0x3a12b5=_0xc614[_0x2f1a23];return _0x3a12b5;};'use strict';var multer=require(_0x4c61('0x0'));var util=require('util');var path=require(_0x4c61('0x1'));var timeout=require('connect-timeout');var express=require(_0x4c61('0x2'));var router=express['Router']();var auth=require(_0x4c61('0x3'));var interaction=require(_0x4c61('0x4'));var config=require(_0x4c61('0x5'));var controller=require(_0x4c61('0x6'));router[_0x4c61('0x7')]('/',auth[_0x4c61('0x8')](),controller[_0x4c61('0x9')]);router['get'](_0x4c61('0xa'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x4c61('0x8')](),controller[_0x4c61('0xb')]);router[_0x4c61('0xc')]('/',auth[_0x4c61('0x8')](),controller[_0x4c61('0xd')]);router[_0x4c61('0xe')](_0x4c61('0xf'),auth[_0x4c61('0x8')](),controller['update']);router[_0x4c61('0x10')](_0x4c61('0xf'),auth[_0x4c61('0x8')](),controller[_0x4c61('0x11')]);module[_0x4c61('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index bbe71d5..3090c69 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 _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 +var _0x439d=['STRING','DATE'];(function(_0x415e9e,_0x45cb1c){var _0x49f61c=function(_0x53e700){while(--_0x53e700){_0x415e9e['push'](_0x415e9e['shift']());}};_0x49f61c(++_0x45cb1c);}(_0x439d,0xb0));var _0xd439=function(_0x429003,_0x3508da){_0x429003=_0x429003-0x0;var _0x3cc0d9=_0x439d[_0x429003];return _0x3cc0d9;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xd439('0x0')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd439('0x1')]},'acceptAt':{'type':Sequelize[_0xd439('0x1')]},'exitAt':{'type':Sequelize[_0xd439('0x1')]},'reason':{'type':Sequelize[_0xd439('0x0')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index e0b88ad..ce0d8b7 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 _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 +var _0x0b78=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','fields','attributes','hasOwnProperty','limit','order','sort','pick','filters','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','intersection','length','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x497559,_0x470d32){var _0x21f316=function(_0x3ff15f){while(--_0x3ff15f){_0x497559['push'](_0x497559['shift']());}};_0x21f316(++_0x470d32);}(_0x0b78,0x1ad));var _0x80b7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0b78[_0x40a045];return _0x1a687c;};'use strict';var pdf=require(_0x80b7('0x0'));var emlformat=require(_0x80b7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x80b7('0x2'));var jsonpatch=require(_0x80b7('0x3'));var rp=require('request-promise');var moment=require(_0x80b7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x80b7('0x5'));var util=require(_0x80b7('0x6'));var path=require(_0x80b7('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x80b7('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x80b7('0x9'));var crypto=require(_0x80b7('0xa'));var jsforce=require(_0x80b7('0xb'));var deskjs=require(_0x80b7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x80b7('0xd'));var Papa=require(_0x80b7('0xe'));var Redis=require(_0x80b7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x80b7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x80b7('0x11'));var logger=require(_0x80b7('0x12'))(_0x80b7('0x13'));var utils=require(_0x80b7('0x14'));var config=require(_0x80b7('0x15'));var licenseUtil=require(_0x80b7('0x16'));var db=require(_0x80b7('0x17'))['db'];function respondWithStatusCode(_0x145241,_0x323d06){_0x323d06=_0x323d06||0xcc;return function(_0x366e34){if(_0x366e34){return _0x145241[_0x80b7('0x18')](_0x323d06);}return _0x145241['status'](_0x323d06)[_0x80b7('0x19')]();};}function respondWithResult(_0x401ad3,_0x527c5b){_0x527c5b=_0x527c5b||0xc8;return function(_0x2ee168){if(_0x2ee168){return _0x401ad3[_0x80b7('0x1a')](_0x527c5b)['json'](_0x2ee168);}};}function respondWithFilteredResult(_0x46822c,_0x3b6b13){return function(_0x21ea65){if(_0x21ea65){var _0x2c0c4e=_0x21ea65[_0x80b7('0x1b')],_0x36d0bb=_0x3b6b13[_0x80b7('0x1c')],_0x352805=_0x3b6b13[_0x80b7('0x1c')]+_0x3b6b13['limit'],_0x1e3d1c;if(_0x352805>=_0x2c0c4e){_0x352805=_0x2c0c4e;_0x1e3d1c=0xc8;}else{_0x1e3d1c=0xce;}_0x46822c[_0x80b7('0x1a')](_0x1e3d1c);return _0x46822c[_0x80b7('0x1d')](_0x80b7('0x1e'),_0x36d0bb+'-'+_0x352805+'/'+_0x2c0c4e)[_0x80b7('0x1f')](_0x21ea65);}return null;};}function patchUpdates(_0x58dbda){return function(_0x48c356){try{jsonpatch[_0x80b7('0x20')](_0x48c356,_0x58dbda,!![]);}catch(_0x1e27aa){return BPromise[_0x80b7('0x21')](_0x1e27aa);}return _0x48c356[_0x80b7('0x22')]();};}function saveUpdates(_0x574e5c,_0x4f6eec){return function(_0x2aebe3){if(_0x2aebe3){return _0x2aebe3[_0x80b7('0x23')](_0x574e5c)[_0x80b7('0x24')](function(_0x3ad8c1){return _0x3ad8c1;});}return null;};}function removeEntity(_0x527d0f,_0x18d407){return function(_0x4c3bed){if(_0x4c3bed){return _0x4c3bed['destroy']()[_0x80b7('0x24')](function(){_0x527d0f[_0x80b7('0x1a')](0xcc)[_0x80b7('0x19')]();});}};}function handleEntityNotFound(_0x155c00,_0x3f3aa5){return function(_0x3a029b){if(!_0x3a029b){_0x155c00[_0x80b7('0x18')](0x194);}return _0x3a029b;};}function handleError(_0x8fa95e,_0x375f10){_0x375f10=_0x375f10||0x1f4;return function(_0x1e751a){logger[_0x80b7('0x25')](_0x1e751a[_0x80b7('0x26')]);if(_0x1e751a[_0x80b7('0x27')]){delete _0x1e751a[_0x80b7('0x27')];}_0x8fa95e[_0x80b7('0x1a')](_0x375f10)['send'](_0x1e751a);};}exports[_0x80b7('0x28')]=function(_0x1661be,_0x5e3f6f){var _0x370bfb={},_0x37fda1={},_0x17d845={'count':0x0,'rows':[]};var _0x5497e2=_[_0x80b7('0x29')](db[_0x80b7('0x2a')][_0x80b7('0x2b')],function(_0x30cd74){return{'name':_0x30cd74[_0x80b7('0x2c')],'type':_0x30cd74[_0x80b7('0x2d')][_0x80b7('0x2e')]};});_0x37fda1[_0x80b7('0x2f')]=_[_0x80b7('0x29')](_0x5497e2,_0x80b7('0x27'));_0x37fda1[_0x80b7('0x30')]=_[_0x80b7('0x31')](_0x1661be[_0x80b7('0x30')]);_0x37fda1['filters']=_['intersection'](_0x37fda1[_0x80b7('0x2f')],_0x37fda1[_0x80b7('0x30')]);_0x370bfb['attributes']=_['intersection'](_0x37fda1[_0x80b7('0x2f')],qs[_0x80b7('0x32')](_0x1661be[_0x80b7('0x30')][_0x80b7('0x32')]));_0x370bfb[_0x80b7('0x33')]=_0x370bfb[_0x80b7('0x33')]['length']?_0x370bfb[_0x80b7('0x33')]:_0x37fda1[_0x80b7('0x2f')];if(!_0x1661be[_0x80b7('0x30')][_0x80b7('0x34')]('nolimit')){_0x370bfb[_0x80b7('0x35')]=qs[_0x80b7('0x35')](_0x1661be['query'][_0x80b7('0x35')]);_0x370bfb[_0x80b7('0x1c')]=qs[_0x80b7('0x1c')](_0x1661be[_0x80b7('0x30')][_0x80b7('0x1c')]);}_0x370bfb[_0x80b7('0x36')]=qs[_0x80b7('0x37')](_0x1661be[_0x80b7('0x30')]['sort']);_0x370bfb['where']=qs['filters'](_[_0x80b7('0x38')](_0x1661be[_0x80b7('0x30')],_0x37fda1[_0x80b7('0x39')]),_0x5497e2);if(_0x1661be[_0x80b7('0x30')][_0x80b7('0x3a')]){_0x370bfb[_0x80b7('0x3b')]=_[_0x80b7('0x3c')](_0x370bfb[_0x80b7('0x3b')],{'$or':_['map'](_0x5497e2,function(_0x2a34eb){if(_0x2a34eb[_0x80b7('0x2d')]!==_0x80b7('0x3d')){var _0x44acf2={};_0x44acf2[_0x2a34eb[_0x80b7('0x27')]]={'$like':'%'+_0x1661be[_0x80b7('0x30')]['filter']+'%'};return _0x44acf2;}})});}_0x370bfb=_[_0x80b7('0x3c')]({},_0x370bfb,_0x1661be['options']);var _0x9ab5e6={'where':_0x370bfb[_0x80b7('0x3b')]};return db['OpenchannelQueueReport']['count'](_0x9ab5e6)[_0x80b7('0x24')](function(_0x5e21eb){_0x17d845['count']=_0x5e21eb;if(_0x1661be[_0x80b7('0x30')][_0x80b7('0x3e')]){_0x370bfb['include']=[{'all':!![]}];}return db[_0x80b7('0x2a')][_0x80b7('0x3f')](_0x370bfb);})['then'](function(_0x59e0c4){_0x17d845[_0x80b7('0x40')]=_0x59e0c4;return _0x17d845;})[_0x80b7('0x24')](respondWithFilteredResult(_0x5e3f6f,_0x370bfb))[_0x80b7('0x41')](handleError(_0x5e3f6f,null));};exports[_0x80b7('0x42')]=function(_0x213c0a,_0x21d4f2){var _0x57fcbf={'raw':!![],'where':{'id':_0x213c0a[_0x80b7('0x43')]['id']}},_0x1c28d2={};_0x1c28d2[_0x80b7('0x2f')]=_[_0x80b7('0x31')](db['OpenchannelQueueReport'][_0x80b7('0x2b')]);_0x1c28d2['query']=_[_0x80b7('0x31')](_0x213c0a[_0x80b7('0x30')]);_0x1c28d2[_0x80b7('0x39')]=_[_0x80b7('0x44')](_0x1c28d2[_0x80b7('0x2f')],_0x1c28d2[_0x80b7('0x30')]);_0x57fcbf[_0x80b7('0x33')]=_[_0x80b7('0x44')](_0x1c28d2[_0x80b7('0x2f')],qs[_0x80b7('0x32')](_0x213c0a[_0x80b7('0x30')][_0x80b7('0x32')]));_0x57fcbf[_0x80b7('0x33')]=_0x57fcbf['attributes'][_0x80b7('0x45')]?_0x57fcbf[_0x80b7('0x33')]:_0x1c28d2['model'];if(_0x213c0a[_0x80b7('0x30')]['includeAll']){_0x57fcbf['include']=[{'all':!![]}];}_0x57fcbf=_[_0x80b7('0x3c')]({},_0x57fcbf,_0x213c0a['options']);return db['OpenchannelQueueReport'][_0x80b7('0x46')](_0x57fcbf)[_0x80b7('0x24')](handleEntityNotFound(_0x21d4f2,null))['then'](respondWithResult(_0x21d4f2,null))[_0x80b7('0x41')](handleError(_0x21d4f2,null));};exports[_0x80b7('0x47')]=function(_0x226c20,_0x5455a5){return db[_0x80b7('0x2a')][_0x80b7('0x47')](_0x226c20[_0x80b7('0x48')],{})[_0x80b7('0x24')](respondWithResult(_0x5455a5,0xc9))['catch'](handleError(_0x5455a5,null));};exports['update']=function(_0x5417b9,_0x1ee2f9){if(_0x5417b9[_0x80b7('0x48')]['id']){delete _0x5417b9[_0x80b7('0x48')]['id'];}return db[_0x80b7('0x2a')][_0x80b7('0x46')]({'where':{'id':_0x5417b9[_0x80b7('0x43')]['id']}})[_0x80b7('0x24')](handleEntityNotFound(_0x1ee2f9,null))[_0x80b7('0x24')](saveUpdates(_0x5417b9['body'],null))['then'](respondWithResult(_0x1ee2f9,null))[_0x80b7('0x41')](handleError(_0x1ee2f9,null));};exports[_0x80b7('0x49')]=function(_0x3d01c6,_0x2d9168){return db[_0x80b7('0x2a')][_0x80b7('0x46')]({'where':{'id':_0x3d01c6['params']['id']}})[_0x80b7('0x24')](handleEntityNotFound(_0x2d9168,null))[_0x80b7('0x24')](removeEntity(_0x2d9168,null))['catch'](handleError(_0x2d9168,null));};exports[_0x80b7('0x4a')]=function(_0x40b524,_0xc5e5a4){return db['OpenchannelQueueReport']['describe']()[_0x80b7('0x24')](respondWithResult(_0xc5e5a4,null))[_0x80b7('0x41')](handleError(_0xc5e5a4,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 654b259..3c99e0e 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 _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 +var _0x9f62=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','util','api','moment','bluebird','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports'];(function(_0x46451c,_0x88ddd){var _0x12dce4=function(_0x2e4087){while(--_0x2e4087){_0x46451c['push'](_0x46451c['shift']());}};_0x12dce4(++_0x88ddd);}(_0x9f62,0x154));var _0x29f6=function(_0x2d19d0,_0x3c4a5a){_0x2d19d0=_0x2d19d0-0x0;var _0xff6948=_0x9f62[_0x2d19d0];return _0xff6948;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'paranoid':![],'indexes':[{'name':_0x29f6('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 02c710b..ab4ca50 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 _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 +var _0x53dc=['request','then','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','OpenchannelQueueReport,\x20%s,\x20%s','result','catch','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','where','attributes','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x122b6a,_0x5c684e){var _0x5e08f7=function(_0x3a0a4f){while(--_0x3a0a4f){_0x122b6a['push'](_0x122b6a['shift']());}};_0x5e08f7(++_0x5c684e);}(_0x53dc,0xee));var _0xc53d=function(_0x56bab1,_0x12c10d){_0x56bab1=_0x56bab1-0x0;var _0x1f85e1=_0x53dc[_0x56bab1];return _0x1f85e1;};'use strict';var _=require(_0xc53d('0x0'));var util=require('util');var moment=require(_0xc53d('0x1'));var BPromise=require(_0xc53d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc53d('0x3'));var db=require(_0xc53d('0x4'))['db'];var utils=require(_0xc53d('0x5'));var logger=require('../../config/logger')(_0xc53d('0x6'));var config=require(_0xc53d('0x7'));var jayson=require(_0xc53d('0x8'));var client=jayson['client'][_0xc53d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x88c0a8,_0x2f3262,_0x24005a){return new BPromise(function(_0x2a1506,_0x145932){return client[_0xc53d('0xa')](_0x88c0a8,_0x24005a)[_0xc53d('0xb')](function(_0x52e06){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x2f3262,_0xc53d('0xc'));logger[_0xc53d('0xd')](_0xc53d('0xe'),_0x2f3262,_0xc53d('0xc'),JSON[_0xc53d('0xf')](_0x52e06));if(_0x52e06['error']){if(_0x52e06[_0xc53d('0x10')][_0xc53d('0x11')]===0x1f4){logger[_0xc53d('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2f3262,_0x52e06['error'][_0xc53d('0x12')]);return _0x145932(_0x52e06[_0xc53d('0x10')][_0xc53d('0x12')]);}logger[_0xc53d('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2f3262,_0x52e06['error'][_0xc53d('0x12')]);return _0x2a1506(_0x52e06['error'][_0xc53d('0x12')]);}else{logger[_0xc53d('0x13')](_0xc53d('0x14'),_0x2f3262,'request\x20sent');_0x2a1506(_0x52e06[_0xc53d('0x15')][_0xc53d('0x12')]);}})[_0xc53d('0x16')](function(_0x3f6f71){logger[_0xc53d('0x10')](_0xc53d('0x14'),_0x2f3262,_0x3f6f71);_0x145932(_0x3f6f71);});});}exports['CreateOpenchannelQueueReport']=function(_0x3fbcea){var _0x61ecae=this;return new Promise(function(_0x4fdf14,_0x4470a1){return db['OpenchannelQueueReport']['create'](_0x3fbcea[_0xc53d('0x17')],{'raw':_0x3fbcea[_0xc53d('0x18')]?_0x3fbcea[_0xc53d('0x18')][_0xc53d('0x19')]===undefined?!![]:![]:!![]})[_0xc53d('0xb')](function(_0xa80d5){logger[_0xc53d('0x13')](_0xc53d('0x1a'),_0x3fbcea);logger[_0xc53d('0xd')](_0xc53d('0x1a'),_0x3fbcea,JSON[_0xc53d('0xf')](_0xa80d5));_0x4fdf14(_0xa80d5);})[_0xc53d('0x16')](function(_0x1d56ac){logger[_0xc53d('0x10')](_0xc53d('0x1a'),_0x1d56ac[_0xc53d('0x12')],_0x3fbcea);_0x4470a1(_0x61ecae[_0xc53d('0x10')](0x1f4,_0x1d56ac[_0xc53d('0x12')]));});});};exports[_0xc53d('0x1b')]=function(_0x2d32fb){var _0x2eb93a=this;return new Promise(function(_0x5ea7d9,_0x388c14){return db[_0xc53d('0x1c')]['update'](_0x2d32fb[_0xc53d('0x17')],{'raw':_0x2d32fb[_0xc53d('0x18')]?_0x2d32fb[_0xc53d('0x18')][_0xc53d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d32fb[_0xc53d('0x18')]?_0x2d32fb['options'][_0xc53d('0x1d')]||null:null,'attributes':_0x2d32fb['options']?_0x2d32fb['options'][_0xc53d('0x1e')]||null:null,'limit':_0x2d32fb[_0xc53d('0x18')]?_0x2d32fb[_0xc53d('0x18')]['limit']||null:null})['then'](function(_0x120f10){logger[_0xc53d('0x13')]('UpdateOpenchannelQueueReport',_0x2d32fb);logger[_0xc53d('0xd')]('UpdateOpenchannelQueueReport',_0x2d32fb,JSON[_0xc53d('0xf')](_0x120f10));_0x5ea7d9(_0x120f10);})[_0xc53d('0x16')](function(_0x4ff364){logger['error'](_0xc53d('0x1b'),_0x4ff364[_0xc53d('0x12')],_0x2d32fb);_0x388c14(_0x2eb93a[_0xc53d('0x10')](0x1f4,_0x4ff364[_0xc53d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index edd9779..b8381e2 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(_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 +var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x2cd1fb,_0x291f55){var _0x48fd2b=function(_0x18e23e){while(--_0x18e23e){_0x2cd1fb['push'](_0x2cd1fb['shift']());}};_0x48fd2b(++_0x291f55);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 33f77b7..e5dc8d3 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 _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 +var _0x61e5=['agent','queue','NOW','exports','account'];(function(_0x42f318,_0x336c90){var _0x4aa72a=function(_0xfce356){while(--_0xfce356){_0x42f318['push'](_0x42f318['shift']());}};_0x4aa72a(++_0x336c90);}(_0x61e5,0xfd));var _0x561e=function(_0x1e5d32,_0x36a176){_0x1e5d32=_0x1e5d32-0x0;var _0x44c0d6=_0x61e5[_0x1e5d32];return _0x44c0d6;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x561e('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x561e('0x1'),_0x561e('0x2'),_0x561e('0x3')),'allowNull':![],'defaultValue':_0x561e('0x3')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x561e('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 324a414..9f54952 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 _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 +var _0x317c=['describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','sort','filters','where','merge','VIRTUAL','filter','OpenchannelTransferReport','count','include','findAll','show','params','rawAttributes','fields','options','find','create','body','catch','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x317c,0x135));var _0xc317=function(_0x396297,_0x31644b){_0x396297=_0x396297-0x0;var _0x7afcb1=_0x317c[_0x396297];return _0x7afcb1;};'use strict';var pdf=require(_0xc317('0x0'));var emlformat=require(_0xc317('0x1'));var rimraf=require(_0xc317('0x2'));var zipdir=require(_0xc317('0x3'));var jsonpatch=require(_0xc317('0x4'));var rp=require('request-promise');var moment=require(_0xc317('0x5'));var BPromise=require(_0xc317('0x6'));var Mustache=require(_0xc317('0x7'));var util=require('util');var path=require(_0xc317('0x8'));var sox=require('sox');var csv=require(_0xc317('0x9'));var ejs=require(_0xc317('0xa'));var fs=require('fs');var _=require(_0xc317('0xb'));var squel=require(_0xc317('0xc'));var crypto=require(_0xc317('0xd'));var jsforce=require(_0xc317('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc317('0xf'));var Papa=require(_0xc317('0x10'));var Redis=require(_0xc317('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc317('0x12'));var as=require(_0xc317('0x13'));var hardwareService=require(_0xc317('0x14'));var logger=require(_0xc317('0x15'))(_0xc317('0x16'));var utils=require(_0xc317('0x17'));var config=require(_0xc317('0x18'));var licenseUtil=require(_0xc317('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38896f,_0x530176){_0x530176=_0x530176||0xcc;return function(_0x5cde1b){if(_0x5cde1b){return _0x38896f[_0xc317('0x1a')](_0x530176);}return _0x38896f[_0xc317('0x1b')](_0x530176)[_0xc317('0x1c')]();};}function respondWithResult(_0x2184fa,_0x4674c4){_0x4674c4=_0x4674c4||0xc8;return function(_0x267b57){if(_0x267b57){return _0x2184fa[_0xc317('0x1b')](_0x4674c4)[_0xc317('0x1d')](_0x267b57);}};}function respondWithFilteredResult(_0x573e63,_0xae4b6b){return function(_0x59fa27){if(_0x59fa27){var _0x580cae=_0x59fa27['count'],_0x14eafa=_0xae4b6b[_0xc317('0x1e')],_0x33f540=_0xae4b6b[_0xc317('0x1e')]+_0xae4b6b[_0xc317('0x1f')],_0x3d7751;if(_0x33f540>=_0x580cae){_0x33f540=_0x580cae;_0x3d7751=0xc8;}else{_0x3d7751=0xce;}_0x573e63[_0xc317('0x1b')](_0x3d7751);return _0x573e63[_0xc317('0x20')](_0xc317('0x21'),_0x14eafa+'-'+_0x33f540+'/'+_0x580cae)['json'](_0x59fa27);}return null;};}function patchUpdates(_0x53e306){return function(_0x3362ad){try{jsonpatch[_0xc317('0x22')](_0x3362ad,_0x53e306,!![]);}catch(_0x170acf){return BPromise[_0xc317('0x23')](_0x170acf);}return _0x3362ad[_0xc317('0x24')]();};}function saveUpdates(_0x3f8148,_0xc4d6c){return function(_0x53997d){if(_0x53997d){return _0x53997d['update'](_0x3f8148)['then'](function(_0x43e564){return _0x43e564;});}return null;};}function removeEntity(_0x13d63e,_0x36d817){return function(_0x246538){if(_0x246538){return _0x246538[_0xc317('0x25')]()[_0xc317('0x26')](function(){_0x13d63e[_0xc317('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c132a,_0x313bcb){return function(_0x4e0d66){if(!_0x4e0d66){_0x4c132a['sendStatus'](0x194);}return _0x4e0d66;};}function handleError(_0x22fb5b,_0x576f62){_0x576f62=_0x576f62||0x1f4;return function(_0x3830f9){logger[_0xc317('0x27')](_0x3830f9[_0xc317('0x28')]);if(_0x3830f9[_0xc317('0x29')]){delete _0x3830f9['name'];}_0x22fb5b[_0xc317('0x1b')](_0x576f62)[_0xc317('0x2a')](_0x3830f9);};}exports[_0xc317('0x2b')]=function(_0x3b9c73,_0x1af4f6){var _0x38c1d6={},_0x46e392={},_0x280f3e={'count':0x0,'rows':[]};var _0xc0753=_['map'](db['OpenchannelTransferReport']['rawAttributes'],function(_0x5198a7){return{'name':_0x5198a7[_0xc317('0x2c')],'type':_0x5198a7[_0xc317('0x2d')][_0xc317('0x2e')]};});_0x46e392[_0xc317('0x2f')]=_[_0xc317('0x30')](_0xc0753,_0xc317('0x29'));_0x46e392[_0xc317('0x31')]=_[_0xc317('0x32')](_0x3b9c73['query']);_0x46e392['filters']=_[_0xc317('0x33')](_0x46e392[_0xc317('0x2f')],_0x46e392[_0xc317('0x31')]);_0x38c1d6['attributes']=_['intersection'](_0x46e392[_0xc317('0x2f')],qs['fields'](_0x3b9c73[_0xc317('0x31')]['fields']));_0x38c1d6['attributes']=_0x38c1d6[_0xc317('0x34')][_0xc317('0x35')]?_0x38c1d6[_0xc317('0x34')]:_0x46e392[_0xc317('0x2f')];if(!_0x3b9c73[_0xc317('0x31')][_0xc317('0x36')](_0xc317('0x37'))){_0x38c1d6[_0xc317('0x1f')]=qs[_0xc317('0x1f')](_0x3b9c73[_0xc317('0x31')]['limit']);_0x38c1d6[_0xc317('0x1e')]=qs[_0xc317('0x1e')](_0x3b9c73[_0xc317('0x31')][_0xc317('0x1e')]);}_0x38c1d6['order']=qs[_0xc317('0x38')](_0x3b9c73[_0xc317('0x31')]['sort']);_0x38c1d6['where']=qs['filters'](_['pick'](_0x3b9c73['query'],_0x46e392[_0xc317('0x39')]),_0xc0753);if(_0x3b9c73['query']['filter']){_0x38c1d6[_0xc317('0x3a')]=_[_0xc317('0x3b')](_0x38c1d6[_0xc317('0x3a')],{'$or':_[_0xc317('0x30')](_0xc0753,function(_0x27efa5){if(_0x27efa5[_0xc317('0x2d')]!==_0xc317('0x3c')){var _0x3a76aa={};_0x3a76aa[_0x27efa5[_0xc317('0x29')]]={'$like':'%'+_0x3b9c73[_0xc317('0x31')][_0xc317('0x3d')]+'%'};return _0x3a76aa;}})});}_0x38c1d6=_[_0xc317('0x3b')]({},_0x38c1d6,_0x3b9c73['options']);var _0x152f48={'where':_0x38c1d6[_0xc317('0x3a')]};return db[_0xc317('0x3e')][_0xc317('0x3f')](_0x152f48)[_0xc317('0x26')](function(_0x474225){_0x280f3e[_0xc317('0x3f')]=_0x474225;if(_0x3b9c73[_0xc317('0x31')]['includeAll']){_0x38c1d6[_0xc317('0x40')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xc317('0x41')](_0x38c1d6);})[_0xc317('0x26')](function(_0x10cc02){_0x280f3e['rows']=_0x10cc02;return _0x280f3e;})[_0xc317('0x26')](respondWithFilteredResult(_0x1af4f6,_0x38c1d6))['catch'](handleError(_0x1af4f6,null));};exports[_0xc317('0x42')]=function(_0x57addc,_0x57ccb3){var _0x4e9ffe={'raw':!![],'where':{'id':_0x57addc[_0xc317('0x43')]['id']}},_0x4a0bfb={};_0x4a0bfb[_0xc317('0x2f')]=_['keys'](db['OpenchannelTransferReport'][_0xc317('0x44')]);_0x4a0bfb[_0xc317('0x31')]=_['keys'](_0x57addc[_0xc317('0x31')]);_0x4a0bfb['filters']=_['intersection'](_0x4a0bfb[_0xc317('0x2f')],_0x4a0bfb[_0xc317('0x31')]);_0x4e9ffe['attributes']=_[_0xc317('0x33')](_0x4a0bfb['model'],qs['fields'](_0x57addc['query'][_0xc317('0x45')]));_0x4e9ffe[_0xc317('0x34')]=_0x4e9ffe[_0xc317('0x34')][_0xc317('0x35')]?_0x4e9ffe[_0xc317('0x34')]:_0x4a0bfb['model'];if(_0x57addc['query']['includeAll']){_0x4e9ffe[_0xc317('0x40')]=[{'all':!![]}];}_0x4e9ffe=_[_0xc317('0x3b')]({},_0x4e9ffe,_0x57addc[_0xc317('0x46')]);return db[_0xc317('0x3e')][_0xc317('0x47')](_0x4e9ffe)[_0xc317('0x26')](handleEntityNotFound(_0x57ccb3,null))[_0xc317('0x26')](respondWithResult(_0x57ccb3,null))['catch'](handleError(_0x57ccb3,null));};exports[_0xc317('0x48')]=function(_0x3e3f59,_0x5a3612){return db[_0xc317('0x3e')][_0xc317('0x48')](_0x3e3f59[_0xc317('0x49')],{})[_0xc317('0x26')](respondWithResult(_0x5a3612,0xc9))[_0xc317('0x4a')](handleError(_0x5a3612,null));};exports[_0xc317('0x4b')]=function(_0x10c7bd,_0x21b36d){if(_0x10c7bd[_0xc317('0x49')]['id']){delete _0x10c7bd['body']['id'];}return db['OpenchannelTransferReport'][_0xc317('0x47')]({'where':{'id':_0x10c7bd[_0xc317('0x43')]['id']}})[_0xc317('0x26')](handleEntityNotFound(_0x21b36d,null))['then'](saveUpdates(_0x10c7bd[_0xc317('0x49')],null))['then'](respondWithResult(_0x21b36d,null))['catch'](handleError(_0x21b36d,null));};exports['destroy']=function(_0x36b415,_0x2f4be5){return db[_0xc317('0x3e')][_0xc317('0x47')]({'where':{'id':_0x36b415[_0xc317('0x43')]['id']}})[_0xc317('0x26')](handleEntityNotFound(_0x2f4be5,null))[_0xc317('0x26')](removeEntity(_0x2f4be5,null))[_0xc317('0x4a')](handleError(_0x2f4be5,null));};exports[_0xc317('0x4c')]=function(_0x5d7896,_0x56b270){return db['OpenchannelTransferReport']['describe']()[_0xc317('0x26')](respondWithResult(_0x56b270,null))[_0xc317('0x4a')](handleError(_0x56b270,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index d9795f0..a8555a0 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 _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 +var _0xa698=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','OpenchannelTransferReport','uniqueid'];(function(_0x568ed9,_0x839e5d){var _0x2cbad8=function(_0x1b4fdd){while(--_0x1b4fdd){_0x568ed9['push'](_0x568ed9['shift']());}};_0x2cbad8(++_0x839e5d);}(_0xa698,0x1ef));var _0x8a69=function(_0x1ac978,_0x1348e9){_0x1ac978=_0x1ac978-0x0;var _0x573024=_0xa698[_0x1ac978];return _0x573024;};'use strict';var _=require(_0x8a69('0x0'));var util=require(_0x8a69('0x1'));var logger=require(_0x8a69('0x2'))(_0x8a69('0x3'));var moment=require('moment');var BPromise=require(_0x8a69('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a69('0x5'));var rimraf=require(_0x8a69('0x6'));var config=require(_0x8a69('0x7'));var attributes=require(_0x8a69('0x8'));module['exports']=function(_0xa23752,_0x215c06){return _0xa23752['define'](_0x8a69('0x9'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x8a69('0xa'),'fields':[_0x8a69('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 7a5de73..42259df 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 _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 +var _0x625e=['lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x1138bd,_0x173cec){var _0x1cadbe=function(_0x505930){while(--_0x505930){_0x1138bd['push'](_0x1138bd['shift']());}};_0x1cadbe(++_0x173cec);}(_0x625e,0xd2));var _0xe625=function(_0x5b27da,_0x4a6532){_0x5b27da=_0x5b27da-0x0;var _0x3254f4=_0x625e[_0x5b27da];return _0x3254f4;};'use strict';var _=require(_0xe625('0x0'));var util=require(_0xe625('0x1'));var moment=require(_0xe625('0x2'));var BPromise=require('bluebird');var rs=require(_0xe625('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe625('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe625('0x5'))(_0xe625('0x6'));var config=require(_0xe625('0x7'));var jayson=require(_0xe625('0x8'));var client=jayson[_0xe625('0x9')][_0xe625('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5eb44b,_0x1ccefd,_0x417adc){return new BPromise(function(_0x19e9d5,_0x4f3ecb){return client['request'](_0x5eb44b,_0x417adc)[_0xe625('0xb')](function(_0x5b9705){logger[_0xe625('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1ccefd,_0xe625('0xd'));logger['debug'](_0xe625('0xe'),_0x1ccefd,_0xe625('0xd'),JSON[_0xe625('0xf')](_0x5b9705));if(_0x5b9705[_0xe625('0x10')]){if(_0x5b9705[_0xe625('0x10')]['code']===0x1f4){logger[_0xe625('0x10')](_0xe625('0x11'),_0x1ccefd,_0x5b9705[_0xe625('0x10')][_0xe625('0x12')]);return _0x4f3ecb(_0x5b9705[_0xe625('0x10')]['message']);}logger[_0xe625('0x10')](_0xe625('0x11'),_0x1ccefd,_0x5b9705[_0xe625('0x10')][_0xe625('0x12')]);return _0x19e9d5(_0x5b9705[_0xe625('0x10')][_0xe625('0x12')]);}else{logger[_0xe625('0xc')](_0xe625('0x11'),_0x1ccefd,_0xe625('0xd'));_0x19e9d5(_0x5b9705[_0xe625('0x13')][_0xe625('0x12')]);}})[_0xe625('0x14')](function(_0x620af2){logger[_0xe625('0x10')](_0xe625('0x11'),_0x1ccefd,_0x620af2);_0x4f3ecb(_0x620af2);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index ce2fad8..357b0ed 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 _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 +var _0xc7ba=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create','put','/:id','update','delete'];(function(_0x59bca9,_0x3cf77f){var _0x472e28=function(_0x3175e4){while(--_0x3175e4){_0x59bca9['push'](_0x59bca9['shift']());}};_0x472e28(++_0x3cf77f);}(_0xc7ba,0x7a));var _0xac7b=function(_0x35d638,_0x1f909c){_0x35d638=_0x35d638-0x0;var _0x4e7b79=_0xc7ba[_0x35d638];return _0x4e7b79;};'use strict';var multer=require(_0xac7b('0x0'));var util=require(_0xac7b('0x1'));var path=require(_0xac7b('0x2'));var timeout=require(_0xac7b('0x3'));var express=require(_0xac7b('0x4'));var router=express[_0xac7b('0x5')]();var auth=require(_0xac7b('0x6'));var interaction=require(_0xac7b('0x7'));var config=require(_0xac7b('0x8'));var controller=require('./pause.controller');router[_0xac7b('0x9')]('/',auth[_0xac7b('0xa')](),controller[_0xac7b('0xb')]);router[_0xac7b('0x9')]('/:id',auth[_0xac7b('0xa')](),controller[_0xac7b('0xc')]);router['post']('/',auth[_0xac7b('0xa')](),controller[_0xac7b('0xd')]);router[_0xac7b('0xe')](_0xac7b('0xf'),auth[_0xac7b('0xa')](),controller[_0xac7b('0x10')]);router[_0xac7b('0x11')](_0xac7b('0xf'),auth[_0xac7b('0xa')](),controller[_0xac7b('0x12')]);module[_0xac7b('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 52c8536..4298fc1 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 _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 +var _0x5629=['STRING','sequelize','name'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0x5629,0xf7));var _0x9562=function(_0x504ccb,_0x5951ae){_0x504ccb=_0x504ccb-0x0;var _0x5cea26=_0x5629[_0x504ccb];return _0x5cea26;};'use strict';var Sequelize=require(_0x9562('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x9562('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x9562('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 5b84837..a8501a2 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 _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 +var _0x9123=['params','keys','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','reject','update','then','destroy','Pauses','sendStatus','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show'];(function(_0x5625cc,_0x28483e){var _0x5c858e=function(_0x511f7a){while(--_0x511f7a){_0x5625cc['push'](_0x5625cc['shift']());}};_0x5c858e(++_0x28483e);}(_0x9123,0xb0));var _0x3912=function(_0x4ff845,_0x53caa8){_0x4ff845=_0x4ff845-0x0;var _0x221498=_0x9123[_0x4ff845];return _0x221498;};'use strict';var pdf=require(_0x3912('0x0'));var emlformat=require(_0x3912('0x1'));var rimraf=require(_0x3912('0x2'));var zipdir=require(_0x3912('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3912('0x4'));var moment=require(_0x3912('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3912('0x6'));var path=require(_0x3912('0x7'));var sox=require(_0x3912('0x8'));var csv=require(_0x3912('0x9'));var ejs=require(_0x3912('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3912('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3912('0xc'));var toCsv=require(_0x3912('0x9'));var querystring=require(_0x3912('0xd'));var Papa=require('papaparse');var Redis=require(_0x3912('0xe'));var authService=require(_0x3912('0xf'));var qs=require(_0x3912('0x10'));var as=require(_0x3912('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3912('0x12'))(_0x3912('0x13'));var utils=require(_0x3912('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3912('0x15'));var db=require(_0x3912('0x16'))['db'];function respondWithStatusCode(_0x5ed0c2,_0x5dbfc1){_0x5dbfc1=_0x5dbfc1||0xcc;return function(_0x4b62cc){if(_0x4b62cc){return _0x5ed0c2['sendStatus'](_0x5dbfc1);}return _0x5ed0c2['status'](_0x5dbfc1)[_0x3912('0x17')]();};}function respondWithResult(_0x177e0a,_0x3769fc){_0x3769fc=_0x3769fc||0xc8;return function(_0x459981){if(_0x459981){return _0x177e0a[_0x3912('0x18')](_0x3769fc)[_0x3912('0x19')](_0x459981);}};}function respondWithFilteredResult(_0x925bd8,_0x19622b){return function(_0x105f01){if(_0x105f01){var _0x4f768c=_0x105f01[_0x3912('0x1a')],_0x12aa4d=_0x19622b['offset'],_0x4b4197=_0x19622b[_0x3912('0x1b')]+_0x19622b[_0x3912('0x1c')],_0x373b03;if(_0x4b4197>=_0x4f768c){_0x4b4197=_0x4f768c;_0x373b03=0xc8;}else{_0x373b03=0xce;}_0x925bd8[_0x3912('0x18')](_0x373b03);return _0x925bd8[_0x3912('0x1d')]('Content-Range',_0x12aa4d+'-'+_0x4b4197+'/'+_0x4f768c)[_0x3912('0x19')](_0x105f01);}return null;};}function patchUpdates(_0x3af5da){return function(_0x3209e8){try{jsonpatch['apply'](_0x3209e8,_0x3af5da,!![]);}catch(_0x3c1baa){return BPromise[_0x3912('0x1e')](_0x3c1baa);}return _0x3209e8['save']();};}function saveUpdates(_0x56206a,_0x95f8ad){return function(_0x2d8117){if(_0x2d8117){return _0x2d8117[_0x3912('0x1f')](_0x56206a)[_0x3912('0x20')](function(_0xc046eb){return _0xc046eb;});}return null;};}function removeEntity(_0x3f6d03,_0x28ea00){return function(_0x2fdc6b){if(_0x2fdc6b){return _0x2fdc6b[_0x3912('0x21')]()['then'](function(){var _0x4ea24b=_0x2fdc6b['get']({'plain':!![]});var _0x32ddb0=_0x3912('0x22');return db['UserProfileResource'][_0x3912('0x21')]({'where':{'type':_0x32ddb0,'resourceId':_0x4ea24b['id']}})[_0x3912('0x20')](function(){return _0x2fdc6b;});})[_0x3912('0x20')](function(){_0x3f6d03[_0x3912('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2269d1,_0x554c31){return function(_0x38a202){if(!_0x38a202){_0x2269d1[_0x3912('0x23')](0x194);}return _0x38a202;};}function handleError(_0x454643,_0x3e209c){_0x3e209c=_0x3e209c||0x1f4;return function(_0x2a0a42){logger[_0x3912('0x24')](_0x2a0a42[_0x3912('0x25')]);if(_0x2a0a42[_0x3912('0x26')]){delete _0x2a0a42['name'];}_0x454643[_0x3912('0x18')](_0x3e209c)[_0x3912('0x27')](_0x2a0a42);};}exports[_0x3912('0x28')]=function(_0x5430ee,_0x5cf06c){var _0x5b5e25={},_0x4f5bf2={},_0x29c9ad={'count':0x0,'rows':[]};var _0x475d4c=_[_0x3912('0x29')](db[_0x3912('0x2a')][_0x3912('0x2b')],function(_0x2b71e0){return{'name':_0x2b71e0[_0x3912('0x2c')],'type':_0x2b71e0[_0x3912('0x2d')][_0x3912('0x2e')]};});_0x4f5bf2['model']=_[_0x3912('0x29')](_0x475d4c,'name');_0x4f5bf2[_0x3912('0x2f')]=_['keys'](_0x5430ee['query']);_0x4f5bf2[_0x3912('0x30')]=_[_0x3912('0x31')](_0x4f5bf2[_0x3912('0x32')],_0x4f5bf2[_0x3912('0x2f')]);_0x5b5e25['attributes']=_[_0x3912('0x31')](_0x4f5bf2[_0x3912('0x32')],qs['fields'](_0x5430ee[_0x3912('0x2f')][_0x3912('0x33')]));_0x5b5e25[_0x3912('0x34')]=_0x5b5e25[_0x3912('0x34')][_0x3912('0x35')]?_0x5b5e25[_0x3912('0x34')]:_0x4f5bf2[_0x3912('0x32')];if(!_0x5430ee[_0x3912('0x2f')][_0x3912('0x36')](_0x3912('0x37'))){_0x5b5e25['limit']=qs['limit'](_0x5430ee['query']['limit']);_0x5b5e25['offset']=qs[_0x3912('0x1b')](_0x5430ee[_0x3912('0x2f')][_0x3912('0x1b')]);}_0x5b5e25[_0x3912('0x38')]=qs[_0x3912('0x39')](_0x5430ee[_0x3912('0x2f')]['sort']);_0x5b5e25[_0x3912('0x3a')]=qs['filters'](_[_0x3912('0x3b')](_0x5430ee[_0x3912('0x2f')],_0x4f5bf2[_0x3912('0x30')]),_0x475d4c);if(_0x5430ee[_0x3912('0x2f')][_0x3912('0x3c')]){_0x5b5e25[_0x3912('0x3a')]=_['merge'](_0x5b5e25['where'],{'$or':_[_0x3912('0x29')](_0x475d4c,function(_0x266f05){if(_0x266f05[_0x3912('0x2d')]!=='VIRTUAL'){var _0x1e765f={};_0x1e765f[_0x266f05[_0x3912('0x26')]]={'$like':'%'+_0x5430ee[_0x3912('0x2f')][_0x3912('0x3c')]+'%'};return _0x1e765f;}})});}_0x5b5e25=_[_0x3912('0x3d')]({},_0x5b5e25,_0x5430ee['options']);var _0x203424={'where':_0x5b5e25[_0x3912('0x3a')]};return db[_0x3912('0x2a')][_0x3912('0x1a')](_0x203424)[_0x3912('0x20')](function(_0x37038f){_0x29c9ad[_0x3912('0x1a')]=_0x37038f;if(_0x5430ee['query']['includeAll']){_0x5b5e25[_0x3912('0x3e')]=[{'all':!![]}];}return db[_0x3912('0x2a')][_0x3912('0x3f')](_0x5b5e25);})[_0x3912('0x20')](function(_0x1def51){_0x29c9ad[_0x3912('0x40')]=_0x1def51;return _0x29c9ad;})[_0x3912('0x20')](respondWithFilteredResult(_0x5cf06c,_0x5b5e25))[_0x3912('0x41')](handleError(_0x5cf06c,null));};exports[_0x3912('0x42')]=function(_0x29443b,_0x5e6d95){var _0xd18d98={'raw':!![],'where':{'id':_0x29443b[_0x3912('0x43')]['id']}},_0x4f7946={};_0x4f7946[_0x3912('0x32')]=_[_0x3912('0x44')](db[_0x3912('0x2a')][_0x3912('0x2b')]);_0x4f7946[_0x3912('0x2f')]=_['keys'](_0x29443b[_0x3912('0x2f')]);_0x4f7946['filters']=_[_0x3912('0x31')](_0x4f7946[_0x3912('0x32')],_0x4f7946[_0x3912('0x2f')]);_0xd18d98[_0x3912('0x34')]=_[_0x3912('0x31')](_0x4f7946[_0x3912('0x32')],qs[_0x3912('0x33')](_0x29443b[_0x3912('0x2f')]['fields']));_0xd18d98['attributes']=_0xd18d98[_0x3912('0x34')]['length']?_0xd18d98[_0x3912('0x34')]:_0x4f7946[_0x3912('0x32')];if(_0x29443b[_0x3912('0x2f')][_0x3912('0x45')]){_0xd18d98[_0x3912('0x3e')]=[{'all':!![]}];}_0xd18d98=_[_0x3912('0x3d')]({},_0xd18d98,_0x29443b['options']);return db[_0x3912('0x2a')][_0x3912('0x46')](_0xd18d98)[_0x3912('0x20')](handleEntityNotFound(_0x5e6d95,null))[_0x3912('0x20')](respondWithResult(_0x5e6d95,null))[_0x3912('0x41')](handleError(_0x5e6d95,null));};exports[_0x3912('0x47')]=function(_0x43e432,_0x497b89){return db['Pause'][_0x3912('0x47')](_0x43e432[_0x3912('0x48')],{})[_0x3912('0x20')](function(_0x2570aa){var _0x4fefc5=_0x43e432['user'][_0x3912('0x49')]({'plain':!![]});if(!_0x4fefc5)throw new Error(_0x3912('0x4a'));if(_0x4fefc5[_0x3912('0x4b')]===_0x3912('0x4c')){var _0x56697e=_0x2570aa[_0x3912('0x49')]({'plain':!![]});var _0x32d93b=_0x3912('0x22');return db[_0x3912('0x4d')][_0x3912('0x46')]({'where':{'name':_0x32d93b,'userProfileId':_0x4fefc5[_0x3912('0x4e')]},'raw':!![]})['then'](function(_0x376d01){if(_0x376d01&&_0x376d01[_0x3912('0x4f')]===0x0){return db['UserProfileResource'][_0x3912('0x47')]({'name':_0x56697e[_0x3912('0x26')],'resourceId':_0x56697e['id'],'type':_0x376d01[_0x3912('0x26')],'sectionId':_0x376d01['id']},{})[_0x3912('0x20')](function(){return _0x2570aa;});}else{return _0x2570aa;}})[_0x3912('0x41')](function(_0xcd15ca){logger[_0x3912('0x24')](_0x3912('0x50'),_0xcd15ca);throw _0xcd15ca;});}return _0x2570aa;})['then'](respondWithResult(_0x497b89,0xc9))[_0x3912('0x41')](handleError(_0x497b89,null));};exports['update']=function(_0x12c902,_0x3393c9){if(_0x12c902[_0x3912('0x48')]['id']){delete _0x12c902[_0x3912('0x48')]['id'];}return db[_0x3912('0x2a')][_0x3912('0x46')]({'where':{'id':_0x12c902[_0x3912('0x43')]['id']}})['then'](handleEntityNotFound(_0x3393c9,null))['then'](saveUpdates(_0x12c902[_0x3912('0x48')],null))[_0x3912('0x20')](respondWithResult(_0x3393c9,null))['catch'](handleError(_0x3393c9,null));};exports[_0x3912('0x21')]=function(_0x5db558,_0x194dc2){return db[_0x3912('0x2a')][_0x3912('0x46')]({'where':{'id':_0x5db558[_0x3912('0x43')]['id']}})['then'](handleEntityNotFound(_0x194dc2,null))[_0x3912('0x20')](removeEntity(_0x194dc2,null))['catch'](handleError(_0x194dc2,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 76bade7..f49049e 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 _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 +var _0x63ef=['bluebird','rimraf','../../config/environment','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','moment'];(function(_0x338b15,_0x3202d8){var _0x466e43=function(_0x3c79ae){while(--_0x3c79ae){_0x338b15['push'](_0x338b15['shift']());}};_0x466e43(++_0x3202d8);}(_0x63ef,0x11a));var _0xf63e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x63ef[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0xf63e('0x0'));var util=require(_0xf63e('0x1'));var logger=require(_0xf63e('0x2'))('api');var moment=require(_0xf63e('0x3'));var BPromise=require(_0xf63e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf63e('0x5'));var config=require(_0xf63e('0x6'));var attributes=require('./pause.attributes');module[_0xf63e('0x7')]=function(_0x367f73,_0x519a33){return _0x367f73[_0xf63e('0x8')](_0xf63e('0x9'),attributes,{'tableName':_0xf63e('0xa'),'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 7e27b29..b200b31 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 _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 +var _0xe700=['request','then','info','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','ShowPause','Pause','find','options','raw','where','include','model','attributes','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http'];(function(_0x260a78,_0x20c234){var _0x56c872=function(_0x37db61){while(--_0x37db61){_0x260a78['push'](_0x260a78['shift']());}};_0x56c872(++_0x20c234);}(_0xe700,0x16a));var _0x0e70=function(_0x1e7e50,_0x404257){_0x1e7e50=_0x1e7e50-0x0;var _0x28dc81=_0xe700[_0x1e7e50];return _0x28dc81;};'use strict';var _=require(_0x0e70('0x0'));var util=require(_0x0e70('0x1'));var moment=require(_0x0e70('0x2'));var BPromise=require(_0x0e70('0x3'));var rs=require(_0x0e70('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e70('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0e70('0x6'))(_0x0e70('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0e70('0x8')][_0x0e70('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4415bb,_0x65a900,_0x51382d){return new BPromise(function(_0x33f0c3,_0x37da83){return client[_0x0e70('0xa')](_0x4415bb,_0x51382d)[_0x0e70('0xb')](function(_0x151c76){logger[_0x0e70('0xc')](_0x0e70('0xd'),_0x65a900,'request\x20sent');logger[_0x0e70('0xe')](_0x0e70('0xf'),_0x65a900,_0x0e70('0x10'),JSON['stringify'](_0x151c76));if(_0x151c76[_0x0e70('0x11')]){if(_0x151c76[_0x0e70('0x11')][_0x0e70('0x12')]===0x1f4){logger[_0x0e70('0x11')](_0x0e70('0xd'),_0x65a900,_0x151c76[_0x0e70('0x11')]['message']);return _0x37da83(_0x151c76[_0x0e70('0x11')][_0x0e70('0x13')]);}logger[_0x0e70('0x11')](_0x0e70('0xd'),_0x65a900,_0x151c76[_0x0e70('0x11')][_0x0e70('0x13')]);return _0x33f0c3(_0x151c76['error']['message']);}else{logger[_0x0e70('0xc')](_0x0e70('0xd'),_0x65a900,_0x0e70('0x10'));_0x33f0c3(_0x151c76['result'][_0x0e70('0x13')]);}})[_0x0e70('0x14')](function(_0x3c9545){logger[_0x0e70('0x11')](_0x0e70('0xd'),_0x65a900,_0x3c9545);_0x37da83(_0x3c9545);});});}exports[_0x0e70('0x15')]=function(_0x5300d6){var _0x536cda=this;return new Promise(function(_0x482ad,_0x5e5fdc){return db[_0x0e70('0x16')][_0x0e70('0x17')]({'raw':_0x5300d6['options']?_0x5300d6[_0x0e70('0x18')][_0x0e70('0x19')]===undefined?!![]:![]:!![],'where':_0x5300d6[_0x0e70('0x18')]?_0x5300d6[_0x0e70('0x18')][_0x0e70('0x1a')]||null:null,'attributes':_0x5300d6[_0x0e70('0x18')]?_0x5300d6[_0x0e70('0x18')]['attributes']||null:null,'include':_0x5300d6[_0x0e70('0x18')]?_0x5300d6[_0x0e70('0x18')][_0x0e70('0x1b')]?_['map'](_0x5300d6[_0x0e70('0x18')]['include'],function(_0xc01490){return{'model':db[_0xc01490[_0x0e70('0x1c')]],'as':_0xc01490['as'],'attributes':_0xc01490[_0x0e70('0x1d')],'include':_0xc01490[_0x0e70('0x1b')]?_['map'](_0xc01490['include'],function(_0x260d1b){return{'model':db[_0x260d1b[_0x0e70('0x1c')]],'as':_0x260d1b['as'],'attributes':_0x260d1b[_0x0e70('0x1d')],'include':_0x260d1b[_0x0e70('0x1b')]?_['map'](_0x260d1b[_0x0e70('0x1b')],function(_0x42e20d){return{'model':db[_0x42e20d['model']],'as':_0x42e20d['as'],'attributes':_0x42e20d[_0x0e70('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0e70('0xb')](function(_0x48d979){logger['info'](_0x0e70('0x15'),_0x5300d6);logger[_0x0e70('0xe')](_0x0e70('0x15'),_0x5300d6,JSON[_0x0e70('0x1e')](_0x48d979));_0x482ad(_0x48d979);})[_0x0e70('0x14')](function(_0x150e45){logger[_0x0e70('0x11')]('ShowPause',_0x150e45[_0x0e70('0x13')],_0x5300d6);_0x5e5fdc(_0x536cda['error'](0x1f4,_0x150e45['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index e6e8785..9289946 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 _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 +var _0x211d=['single','file','webhookPost','put','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','/webhook','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post'];(function(_0x298582,_0x37cdd6){var _0x47ce4d=function(_0xaddc49){while(--_0xaddc49){_0x298582['push'](_0x298582['shift']());}};_0x47ce4d(++_0x37cdd6);}(_0x211d,0x186));var _0xd211=function(_0x57e6a8,_0x13a585){_0x57e6a8=_0x57e6a8-0x0;var _0x5e8420=_0x211d[_0x57e6a8];return _0x5e8420;};'use strict';var multer=require(_0xd211('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd211('0x1'));var express=require(_0xd211('0x2'));var router=express[_0xd211('0x3')]();var auth=require(_0xd211('0x4'));var interaction=require(_0xd211('0x5'));var config=require(_0xd211('0x6'));var controller=require(_0xd211('0x7'));router[_0xd211('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd211('0x8')](_0xd211('0x9'),controller['webhookGet']);router[_0xd211('0x8')](_0xd211('0xa'),auth[_0xd211('0xb')](),controller[_0xd211('0xc')]);router[_0xd211('0x8')](_0xd211('0xd'),auth[_0xd211('0xb')](),controller[_0xd211('0xe')]);var upload=multer({'storage':multer[_0xd211('0xf')]({'destination':function(_0x2798d1,_0x29ad19,_0x4b3237){_0x4b3237(null,path[_0xd211('0x10')](config[_0xd211('0x11')],_0xd211('0x12')));},'filename':function(_0x3f00bb,_0x437008,_0x2decb7){_0x437008[_0xd211('0x13')]=_0x437008['originalname'][_0xd211('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2decb7(null,util[_0xd211('0x15')](_0xd211('0x16'),path['basename'](_0x437008[_0xd211('0x13')],path[_0xd211('0x17')](_0x437008[_0xd211('0x13')])),Date[_0xd211('0x18')](),path[_0xd211('0x17')](_0x437008[_0xd211('0x13')])));}})});router[_0xd211('0x19')]('/',upload[_0xd211('0x1a')](_0xd211('0x1b')),controller['upload']);router[_0xd211('0x19')](_0xd211('0x9'),controller[_0xd211('0x1c')]);router[_0xd211('0x1d')](_0xd211('0xa'),auth[_0xd211('0xb')](),controller['update']);router[_0xd211('0x1e')](_0xd211('0xa'),auth[_0xd211('0xb')](),controller[_0xd211('0x1e')]);module[_0xd211('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index a6552a5..5b3e4f2 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 _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 +var _0x0edf=['exports','STRING','ENUM','html','script','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x0edf,0x83));var _0xf0ed=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x0edf[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require(_0xf0ed('0x0'));module[_0xf0ed('0x1')]={'name':{'type':Sequelize[_0xf0ed('0x2')]},'type':{'type':Sequelize[_0xf0ed('0x3')](_0xf0ed('0x4'),_0xf0ed('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xf0ed('0x2')],'comment':_0xf0ed('0x6')},'active':{'type':Sequelize[_0xf0ed('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0xf0ed('0x8'),_0xf0ed('0x9'),'never'),'defaultValue':_0xf0ed('0x9'),'comment':_0xf0ed('0xa')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xf0ed('0x2')]},'scriptName':{'type':Sequelize[_0xf0ed('0x2')]},'scriptPath':{'type':Sequelize[_0xf0ed('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 0eb3f29..d149ec5 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 _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 +var _0x56a1=['params','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','glob','join','server/files/plugins','dirname','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','root','info','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','parse','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','role','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','encoding','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','hostname','method','%s%s','sendStatus','html-pdf','eml-format','request-promise','moment','bluebird','util','path','to-csv','lodash','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','index','map','Plugin','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','fields','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','length','options','download','find'];(function(_0x33f6a9,_0x5e195c){var _0x36df01=function(_0x2225d9){while(--_0x2225d9){_0x33f6a9['push'](_0x33f6a9['shift']());}};_0x36df01(++_0x5e195c);}(_0x56a1,0x1a9));var _0x156a=function(_0x26a818,_0x40708a){_0x26a818=_0x26a818-0x0;var _0x5d8ca0=_0x56a1[_0x26a818];return _0x5d8ca0;};'use strict';var pdf=require(_0x156a('0x0'));var emlformat=require(_0x156a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x156a('0x2'));var moment=require(_0x156a('0x3'));var BPromise=require(_0x156a('0x4'));var Mustache=require('mustache');var util=require(_0x156a('0x5'));var path=require(_0x156a('0x6'));var sox=require('sox');var csv=require(_0x156a('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x156a('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x156a('0x9'));var toCsv=require(_0x156a('0x7'));var querystring=require(_0x156a('0xa'));var Papa=require(_0x156a('0xb'));var extract=require(_0x156a('0xc'));var rimraf=require(_0x156a('0xd'));var archiver=require(_0x156a('0xe'));var Redis=require(_0x156a('0xf'));var authService=require(_0x156a('0x10'));var qs=require(_0x156a('0x11'));var as=require(_0x156a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x156a('0x13'));var utils=require(_0x156a('0x14'));var config=require(_0x156a('0x15'));var licenseUtil=require(_0x156a('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x156a('0x17')](config[_0x156a('0x18')],{'host':_0x156a('0x19'),'port':0x18eb});var socket=require(_0x156a('0x1a'))(new Redis(config[_0x156a('0x18')]));require(_0x156a('0x1b'))[_0x156a('0x1c')](socket);function respondWithStatusCode(_0x763a44,_0x354ba6){_0x354ba6=_0x354ba6||0xcc;return function(_0x16ef7e){if(_0x16ef7e){return _0x763a44['sendStatus'](_0x354ba6);}return _0x763a44[_0x156a('0x1d')](_0x354ba6)[_0x156a('0x1e')]();};}function respondWithResult(_0x3d0410,_0x1b9b0c){_0x1b9b0c=_0x1b9b0c||0xc8;return function(_0x3aea35){if(_0x3aea35){return _0x3d0410[_0x156a('0x1d')](_0x1b9b0c)[_0x156a('0x1f')](_0x3aea35);}};}function respondWithFilteredResult(_0x25fcb8,_0xe07c96){return function(_0x1ca0a5){if(_0x1ca0a5){var _0x43613b=_0x1ca0a5['count'],_0x507d8f=_0xe07c96['offset'],_0x279b44=_0xe07c96[_0x156a('0x20')]+_0xe07c96[_0x156a('0x21')],_0x42a205;if(_0x279b44>=_0x43613b){_0x279b44=_0x43613b;_0x42a205=0xc8;}else{_0x42a205=0xce;}_0x25fcb8[_0x156a('0x1d')](_0x42a205);return _0x25fcb8[_0x156a('0x22')](_0x156a('0x23'),_0x507d8f+'-'+_0x279b44+'/'+_0x43613b)[_0x156a('0x1f')](_0x1ca0a5);}return null;};}function patchUpdates(_0x793772){return function(_0x462367){try{jsonpatch[_0x156a('0x24')](_0x462367,_0x793772,!![]);}catch(_0x39fec1){return BPromise[_0x156a('0x25')](_0x39fec1);}return _0x462367[_0x156a('0x26')]();};}function saveUpdates(_0x5cbcc5,_0x402ec4){return function(_0x24e957){if(_0x24e957){return _0x24e957[_0x156a('0x27')](_0x5cbcc5)[_0x156a('0x28')](function(_0x4832c7){return _0x4832c7;});}return null;};}function removeEntity(_0x3cfc7b,_0x2e8fe0){return function(_0x1e5c60){if(_0x1e5c60){return _0x1e5c60[_0x156a('0x29')]()[_0x156a('0x28')](function(){var _0x5b34b8=_0x1e5c60[_0x156a('0x2a')]({'plain':!![]});var _0x5a2858=_0x156a('0x2b');return db[_0x156a('0x2c')][_0x156a('0x29')]({'where':{'type':_0x5a2858,'resourceId':_0x5b34b8['id']}})[_0x156a('0x28')](function(){return _0x1e5c60;});})[_0x156a('0x28')](function(){_0x3cfc7b[_0x156a('0x1d')](0xcc)[_0x156a('0x1e')]();});}};}function handleEntityNotFound(_0x49c5b4,_0x2689ca){return function(_0x49edf3){if(!_0x49edf3){_0x49c5b4['sendStatus'](0x194);}return _0x49edf3;};}function handleError(_0x305377,_0x2ccc3d){_0x2ccc3d=_0x2ccc3d||0x1f4;return function(_0x4e1fae){logger[_0x156a('0x2d')](_0x4e1fae[_0x156a('0x2e')]);if(_0x4e1fae['name']){delete _0x4e1fae[_0x156a('0x2f')];}_0x305377[_0x156a('0x1d')](_0x2ccc3d)['send'](_0x4e1fae);};}exports[_0x156a('0x30')]=function(_0x3eb0c7,_0x4454db){var _0x51743f={},_0x1b89d1={},_0x337443={'count':0x0,'rows':[]};var _0x26d39c=_[_0x156a('0x31')](db[_0x156a('0x32')][_0x156a('0x33')],function(_0x50716a){return{'name':_0x50716a[_0x156a('0x34')],'type':_0x50716a[_0x156a('0x35')][_0x156a('0x36')]};});_0x1b89d1['model']=_[_0x156a('0x31')](_0x26d39c,'name');_0x1b89d1[_0x156a('0x37')]=_[_0x156a('0x38')](_0x3eb0c7[_0x156a('0x37')]);_0x1b89d1['filters']=_['intersection'](_0x1b89d1['model'],_0x1b89d1[_0x156a('0x37')]);_0x51743f[_0x156a('0x39')]=_[_0x156a('0x3a')](_0x1b89d1[_0x156a('0x3b')],qs[_0x156a('0x3c')](_0x3eb0c7[_0x156a('0x37')][_0x156a('0x3c')]));_0x51743f[_0x156a('0x39')]=_0x51743f[_0x156a('0x39')]['length']?_0x51743f['attributes']:_0x1b89d1['model'];if(!_0x3eb0c7[_0x156a('0x37')]['hasOwnProperty'](_0x156a('0x3d'))){_0x51743f['limit']=qs[_0x156a('0x21')](_0x3eb0c7[_0x156a('0x37')][_0x156a('0x21')]);_0x51743f[_0x156a('0x20')]=qs[_0x156a('0x20')](_0x3eb0c7['query']['offset']);}_0x51743f['order']=qs[_0x156a('0x3e')](_0x3eb0c7[_0x156a('0x37')][_0x156a('0x3e')]);_0x51743f[_0x156a('0x3f')]=qs['filters'](_[_0x156a('0x40')](_0x3eb0c7[_0x156a('0x37')],_0x1b89d1[_0x156a('0x41')]),_0x26d39c);if(_0x3eb0c7['query']['filter']){_0x51743f['where']=_[_0x156a('0x42')](_0x51743f[_0x156a('0x3f')],{'$or':_[_0x156a('0x31')](_0x26d39c,function(_0x467f21){if(_0x467f21[_0x156a('0x35')]!==_0x156a('0x43')){var _0x419fa4={};_0x419fa4[_0x467f21[_0x156a('0x2f')]]={'$like':'%'+_0x3eb0c7[_0x156a('0x37')][_0x156a('0x44')]+'%'};return _0x419fa4;}})});}_0x51743f=_[_0x156a('0x42')]({},_0x51743f,_0x3eb0c7['options']);var _0x51ae24={'where':_0x51743f[_0x156a('0x3f')]};return db[_0x156a('0x32')]['count'](_0x51ae24)[_0x156a('0x28')](function(_0x4ecc82){_0x337443['count']=_0x4ecc82;if(_0x3eb0c7[_0x156a('0x37')][_0x156a('0x45')]){_0x51743f[_0x156a('0x46')]=[{'all':!![]}];}return db[_0x156a('0x32')][_0x156a('0x47')](_0x51743f);})[_0x156a('0x28')](function(_0x2d4638){_0x337443[_0x156a('0x48')]=_0x2d4638;return _0x337443;})[_0x156a('0x28')](respondWithFilteredResult(_0x4454db,_0x51743f))[_0x156a('0x49')](handleError(_0x4454db,null));};exports[_0x156a('0x4a')]=function(_0x386080,_0x2f5130){var _0x33c4cf={'raw':!![],'where':{'id':_0x386080['params']['id']}},_0x13ba43={};_0x13ba43[_0x156a('0x3b')]=_['keys'](db[_0x156a('0x32')][_0x156a('0x33')]);_0x13ba43[_0x156a('0x37')]=_[_0x156a('0x38')](_0x386080[_0x156a('0x37')]);_0x13ba43[_0x156a('0x41')]=_[_0x156a('0x3a')](_0x13ba43[_0x156a('0x3b')],_0x13ba43[_0x156a('0x37')]);_0x33c4cf[_0x156a('0x39')]=_[_0x156a('0x3a')](_0x13ba43['model'],qs[_0x156a('0x3c')](_0x386080[_0x156a('0x37')]['fields']));_0x33c4cf[_0x156a('0x39')]=_0x33c4cf['attributes'][_0x156a('0x4b')]?_0x33c4cf[_0x156a('0x39')]:_0x13ba43[_0x156a('0x3b')];if(_0x386080[_0x156a('0x37')]['includeAll']){_0x33c4cf[_0x156a('0x46')]=[{'all':!![]}];}_0x33c4cf=_[_0x156a('0x42')]({},_0x33c4cf,_0x386080[_0x156a('0x4c')]);return db[_0x156a('0x32')]['find'](_0x33c4cf)[_0x156a('0x28')](handleEntityNotFound(_0x2f5130,null))[_0x156a('0x28')](respondWithResult(_0x2f5130,null))[_0x156a('0x49')](handleError(_0x2f5130,null));};exports[_0x156a('0x4d')]=function(_0x18b4be,_0x219662,_0x281513){return db['Plugin'][_0x156a('0x4e')]({'where':{'id':_0x18b4be[_0x156a('0x4f')]['id']},'attributes':[_0x156a('0x2f'),'path'],'raw':!![]})[_0x156a('0x28')](handleEntityNotFound(_0x219662,null))[_0x156a('0x28')](function(_0x4382be){if(_0x4382be){var _0xa9c98c=path['join'](config['root'],'server/files/plugins',util[_0x156a('0x50')](_0x156a('0x51'),path[_0x156a('0x52')](_0x4382be[_0x156a('0x6')])));var _0x231488=fs[_0x156a('0x53')](_0xa9c98c);var _0x49e678=archiver('zip',{'zlib':{'level':0x9}});_0x49e678['on'](_0x156a('0x54'),function(_0x228e2a){if(_0x228e2a[_0x156a('0x55')]===_0x156a('0x56')){logger[_0x156a('0x2d')](_0x228e2a);}else{throw new db['Sequelize'][(_0x156a('0x57'))](_0x156a('0x58'));}});_0x49e678['on']('error',function(_0x474b6b){throw new db[(_0x156a('0x59'))][(_0x156a('0x57'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x49e678['pipe'](_0x231488);_0x49e678[_0x156a('0x5a')]('**/*',{'cwd':path[_0x156a('0x5b')](config['root'],_0x156a('0x5c'),path[_0x156a('0x5d')](_0x4382be[_0x156a('0x6')])),'ignore':[path[_0x156a('0x5b')](path[_0x156a('0x52')](_0x4382be[_0x156a('0x6')]),_0x156a('0x5e')),path[_0x156a('0x5b')](path['basename'](_0x4382be['path']),'attachments/**/*')],'nodir':!![]})[_0x156a('0x5f')]();_0x231488['on'](_0x156a('0x60'),function(){if(!fs[_0x156a('0x61')](_0xa9c98c)){throw new db[(_0x156a('0x59'))][(_0x156a('0x57'))](_0x156a('0x62'));}return _0x219662[_0x156a('0x4d')](_0xa9c98c,util[_0x156a('0x50')](_0x156a('0x51'),path[_0x156a('0x52')](_0x4382be[_0x156a('0x6')])),function(_0x482f39){if(_0x482f39){throw new db[(_0x156a('0x59'))][(_0x156a('0x57'))](_0x156a('0x63'));}fs[_0x156a('0x64')](_0xa9c98c);logger['info'](_0x156a('0x65'));logger['info'](_0x156a('0x66'));});});}return null;})[_0x156a('0x49')](handleError(_0x219662,null));};exports[_0x156a('0x67')]=function(_0x79f547,_0x188ba7,_0x19e1f5){var _0xbf7f82=path[_0x156a('0x52')](_0x79f547[_0x156a('0x68')][_0x156a('0x69')],path[_0x156a('0x6a')](_0x79f547['file'][_0x156a('0x69')]));var _0x4e16ab=path['join'](config['root'],'server/files/plugins',_0x79f547[_0x156a('0x68')][_0x156a('0x69')]);var _0x3c7d0d=path[_0x156a('0x5b')](config[_0x156a('0x6b')],_0x156a('0x5c'),_0xbf7f82);logger[_0x156a('0x6c')]('Plugin\x20upload\x20filepath:\x20%s',_0x4e16ab);logger[_0x156a('0x6c')](_0x156a('0x6d'),_0x3c7d0d);try{fs[_0x156a('0x6e')](_0x4e16ab,parseInt(_0x156a('0x6f'),0x8));extract(_0x4e16ab,{'dir':_0x3c7d0d},function(_0x30f2b4){if(_0x30f2b4){logger[_0x156a('0x2d')](_0x30f2b4);handleError(_0x30f2b4,!![]);};var _0x442b41=fs[_0x156a('0x70')](_0x3c7d0d);if(_0x442b41[_0x156a('0x4b')]>0x1){removeReferences(_0x4e16ab,_0x3c7d0d);logger[_0x156a('0x2d')](_0x156a('0x71'));return _0x19e1f5(new Error(_0x156a('0x71')));}var _0x312629=fs[_0x156a('0x72')](path[_0x156a('0x5b')](_0x3c7d0d,_0x442b41[0x0]));if(_0x312629[_0x156a('0x73')]()){removeReferences(_0x4e16ab,_0x3c7d0d);logger[_0x156a('0x2d')]('Invalid\x20plugin\x20structure');return _0x19e1f5(new Error(_0x156a('0x71')));}if(_0x312629[_0x156a('0x74')]()){var _0x37f564=fs[_0x156a('0x70')](path[_0x156a('0x5b')](_0x3c7d0d,_0x442b41[0x0]));if(_0x37f564[_0x156a('0x4b')]===0x0){removeReferences(_0x4e16ab,_0x3c7d0d);logger[_0x156a('0x2d')](_0x156a('0x71'));return _0x19e1f5(new Error(_0x156a('0x71')));}var _0x283b3c=_0x37f564[_0x156a('0x75')](function(_0x1929e7){return _0x1929e7===_0x156a('0x76');});if(!_0x283b3c){return _0x19e1f5(new Error('Plugin\x20manifest\x20missing'));}var _0x305083=fs['readFileSync'](path[_0x156a('0x5b')](_0x3c7d0d,_0x442b41[0x0],_0x156a('0x76')));var _0x4ef1b2=JSON[_0x156a('0x77')](_0x305083);if('undefined'==typeof _0x4ef1b2[_0x156a('0x2f')]){return _0x19e1f5(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x156a('0x78')==typeof _0x4ef1b2['type']){return _0x19e1f5(new Error(_0x156a('0x79')));}if(_0x156a('0x78')==typeof _0x4ef1b2[_0x156a('0x7a')]){return _0x19e1f5(new Error(_0x156a('0x7b')));}if('undefined'==typeof _0x4ef1b2[_0x156a('0x7c')]){return _0x19e1f5(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x4ef1b2['type']==='html'){if('undefined'==typeof _0x4ef1b2[_0x156a('0x7c')]['views']){return _0x19e1f5(new Error(_0x156a('0x7d')));}if(_0x156a('0x78')==typeof _0x4ef1b2[_0x156a('0x7c')][_0x156a('0x7e')][_0x156a('0x7f')]&&'undefined'==typeof _0x4ef1b2[_0x156a('0x7c')][_0x156a('0x7e')][_0x156a('0x80')]){return _0x19e1f5(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x4ef1b2[_0x156a('0x35')]==='script'){if(_0x156a('0x78')==typeof _0x4ef1b2[_0x156a('0x7c')]['scriptName']){return _0x19e1f5(new Error(_0x156a('0x81')));}if(_0x156a('0x78')==typeof _0x4ef1b2[_0x156a('0x7c')]['scriptPath']){return _0x19e1f5(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x19e1f5(new Error(_0x156a('0x82')));}var _0x441721=_0x4ef1b2[_0x156a('0x2f')];var _0x3f327f=_0x4ef1b2[_0x156a('0x83')];var _0x5d1af2=_0x4ef1b2[_0x156a('0x35')];var _0x11460f=_0x4ef1b2[_0x156a('0x84')]?_0x4ef1b2['sidebar']:_0x156a('0x85');var _0x22867b=_0x4ef1b2[_0x156a('0x86')]?_0x4ef1b2[_0x156a('0x86')]:_0x156a('0x87');var _0x204662='';var _0x18884e='';var _0x22de24='';var _0x50767a='';var _0x21d293=_0x4ef1b2['version'];if(_0x5d1af2==='html'){if('undefined'!=typeof _0x4ef1b2[_0x156a('0x7c')]['views'][_0x156a('0x7f')]){var _0x58dcd1=_0x4ef1b2[_0x156a('0x7c')]['views'][_0x156a('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x156a('0x88')](_0x58dcd1)){_0x204662=path[_0x156a('0x5b')](_0x156a('0x89'),_0xbf7f82,_0x442b41[0x0],_0x58dcd1);}else{_0x204662=_0x58dcd1;}}else{logger[_0x156a('0x6c')](_0x156a('0x8a'));}if(_0x156a('0x78')!=typeof _0x4ef1b2[_0x156a('0x7c')][_0x156a('0x7e')][_0x156a('0x80')]){var _0x5b5bca=_0x4ef1b2[_0x156a('0x7c')][_0x156a('0x7e')][_0x156a('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x5b5bca)){_0x18884e=path[_0x156a('0x5b')](_0x156a('0x89'),_0xbf7f82,_0x442b41[0x0],_0x5b5bca);}else{_0x18884e=_0x5b5bca;}}else{logger[_0x156a('0x6c')](_0x156a('0x8b'));}}else if(_0x5d1af2==='script'){_0x22de24=_0x4ef1b2[_0x156a('0x7c')]['scriptName'];_0x50767a=_0x4ef1b2[_0x156a('0x7c')][_0x156a('0x8c')];if('undefined'!=typeof _0x4ef1b2['parameters']['views']){if(_0x156a('0x78')!=typeof _0x4ef1b2[_0x156a('0x7c')][_0x156a('0x7e')][_0x156a('0x7f')]){var _0x58dcd1=_0x4ef1b2['parameters']['views'][_0x156a('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x156a('0x88')](_0x58dcd1)){_0x204662=path[_0x156a('0x5b')](_0x156a('0x89'),_0xbf7f82,_0x442b41[0x0],_0x58dcd1);}else{_0x204662=_0x58dcd1;}}if(_0x156a('0x78')!=typeof _0x4ef1b2['parameters'][_0x156a('0x7e')][_0x156a('0x80')]){var _0x5b5bca=_0x4ef1b2[_0x156a('0x7c')][_0x156a('0x7e')][_0x156a('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x156a('0x88')](_0x5b5bca)){_0x18884e=path[_0x156a('0x5b')]('plugins',_0xbf7f82,_0x442b41[0x0],_0x5b5bca);}else{_0x18884e=_0x5b5bca;}}}}var _0x38f86b={'name':_0x441721,'description':_0x3f327f,'path':path[_0x156a('0x5b')](_0xbf7f82,_0x442b41[0x0]),'type':_0x5d1af2,'sidebar':_0x11460f,'icon':_0x22867b,'adminUrl':_0x204662,'agentUrl':_0x18884e,'scriptName':_0x22de24,'scriptPath':_0x50767a,'version':_0x21d293};removeReferences(_0x4e16ab,null);return db[_0x156a('0x32')][_0x156a('0x8d')](_0x38f86b)[_0x156a('0x28')](function(_0x52d373){var _0x3f03e6={'role':_0x79f547['body'][_0x156a('0x8e')],'userProfileId':_0x79f547[_0x156a('0x8f')]['userProfileId']};if(!_0x3f03e6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f03e6[_0x156a('0x8e')]===_0x156a('0x90')){var _0x5f42c6=_0x52d373[_0x156a('0x2a')]({'plain':!![]});return db[_0x156a('0x91')]['find']({'where':{'name':'Plugins','userProfileId':_0x3f03e6[_0x156a('0x92')]},'raw':!![]})[_0x156a('0x28')](function(_0x50a461){if(_0x50a461&&_0x50a461[_0x156a('0x93')]===0x0){return db['UserProfileResource'][_0x156a('0x8d')]({'name':_0x5f42c6[_0x156a('0x2f')],'resourceId':_0x5f42c6['id'],'type':_0x50a461[_0x156a('0x2f')],'sectionId':_0x50a461['id']},{})[_0x156a('0x28')](function(){return _0x52d373;});}else{return _0x52d373;}})[_0x156a('0x49')](function(_0x4ef149){logger[_0x156a('0x2d')](_0x156a('0x94'),_0x4ef149);throw _0x4ef149;});}return _0x52d373;})['then'](respondWithResult(_0x188ba7,null))[_0x156a('0x49')](handleError(_0x188ba7,null));}});}catch(_0xb2203f){_0x188ba7[_0x156a('0x1d')](0x1f4)[_0x156a('0x95')](_0xb2203f);}};function removeReferences(_0x115dfa,_0x17a6da){try{if(_0x115dfa){fs[_0x156a('0x64')](_0x115dfa);logger[_0x156a('0x6c')]('Zip\x20archive\x20removed');}if(_0x17a6da){rimraf(_0x17a6da,function(){});logger[_0x156a('0x6c')]('Extracted\x20folder\x20removed');}}catch(_0x361710){logger[_0x156a('0x2d')](_0x361710);}}exports['update']=function(_0x4d4d9a,_0x1e91c4,_0x18217d){return db[_0x156a('0x32')][_0x156a('0x4e')]({'where':{'id':_0x4d4d9a[_0x156a('0x4f')]['id']}})[_0x156a('0x28')](handleEntityNotFound(_0x1e91c4,null))['then'](saveUpdates(_0x4d4d9a[_0x156a('0x8f')],null))[_0x156a('0x28')](respondWithResult(_0x1e91c4,null))[_0x156a('0x49')](handleError(_0x1e91c4,null));};exports[_0x156a('0x96')]=function(_0xcfc91f,_0xdaadb,_0x248ee1){return db[_0x156a('0x32')][_0x156a('0x4e')]({'where':{'id':_0xcfc91f[_0x156a('0x4f')]['id']}})[_0x156a('0x28')](function(_0x2c7ee8){if(_0x2c7ee8){return _0x2c7ee8[_0x156a('0x29')]();}})[_0x156a('0x28')](function(_0x1a3da6){rimraf(path[_0x156a('0x5b')](config[_0x156a('0x6b')],'server/files/plugins',path[_0x156a('0x5d')](_0x1a3da6[_0x156a('0x6')])),function(){});return _0x1a3da6;})[_0x156a('0x28')](handleEntityNotFound(_0xdaadb,null))[_0x156a('0x28')](respondWithStatusCode(_0xdaadb,null))['catch'](handleError(_0xdaadb,null));};exports[_0x156a('0x97')]=function(_0x6020fb,_0x4354da,_0x394780){return BPromise['resolve']()[_0x156a('0x28')](function(){if(!_0x6020fb[_0x156a('0x37')]['path']){throw new Error(_0x156a('0x98'));}if(!_0x6020fb[_0x156a('0x37')][_0x156a('0x99')]){throw new Error(_0x156a('0x9a'));}var _0x5f6832=_0x6020fb[_0x156a('0x37')]['hostname']?_0x6020fb['query']['hostname']+':'+_0x6020fb[_0x156a('0x37')]['port']:_0x156a('0x9b')+_0x6020fb['query'][_0x156a('0x99')];var _0x263690=_0x6020fb['query'][_0x156a('0x1f')]?_0x6020fb[_0x156a('0x37')][_0x156a('0x1f')]:!![];var _0x16239d=_0x6020fb[_0x156a('0x37')][_0x156a('0x9c')]?_0x6020fb[_0x156a('0x37')][_0x156a('0x9c')]:null;var _0x4c141a={'method':_0x6020fb['method'],'uri':util['format']('%s%s',_0x5f6832,_0x6020fb[_0x156a('0x37')][_0x156a('0x6')]),'json':_0x263690,'resolveWithFullResponse':!![],'encoding':_0x16239d,'qs':_0x6020fb[_0x156a('0x37')]};if(_0x6020fb[_0x156a('0x9d')]){_0x4c141a[_0x156a('0x9d')]=_0x6020fb[_0x156a('0x9d')];if(_0x4c141a[_0x156a('0x9d')][_0x156a('0x9e')]){delete _0x4c141a[_0x156a('0x9d')][_0x156a('0x9e')];}}if(_0x4c141a['headers'][_0x156a('0x9f')]){delete _0x4c141a[_0x156a('0x9d')]['content-type'];}return rp(_0x4c141a);})[_0x156a('0x28')](function(_0x50b119){if(_0x50b119){_0x4354da[_0x156a('0x22')](_0x50b119['headers']);logger[_0x156a('0x6c')](_0x50b119['body']);if(_[_0x156a('0xa0')](_0x6020fb['query'][_0x156a('0x6')],_0x156a('0x4d'))&&_0x50b119['statusCode']==0x1f4){return _0x4354da['sendStatus'](_0x50b119[_0x156a('0xa1')]);}else{return _0x4354da[_0x156a('0x1d')](_0x50b119[_0x156a('0xa1')])[_0x156a('0x95')](_0x50b119[_0x156a('0x8f')]);}}else{return _0x4354da['sendStatus'](0xc8);}})[_0x156a('0x49')](handleError(_0x4354da,null));};exports[_0x156a('0xa2')]=function(_0x5f159d,_0x37777f,_0x3ee356){return BPromise[_0x156a('0xa3')]()[_0x156a('0x28')](function(){if(!_0x5f159d['query'][_0x156a('0x6')]){throw new Error(_0x156a('0x98'));}if(!_0x5f159d[_0x156a('0x37')][_0x156a('0x99')]){throw new Error(_0x156a('0x9a'));}var _0x189e1a=_0x5f159d['query'][_0x156a('0xa4')]?_0x5f159d['query']['hostname']+':'+_0x5f159d['query'][_0x156a('0x99')]:'http://localhost:'+_0x5f159d[_0x156a('0x37')][_0x156a('0x99')];var _0x20d354=_0x5f159d['query']['json']?_0x5f159d[_0x156a('0x37')][_0x156a('0x1f')]:!![];var _0x3337e7=_0x5f159d[_0x156a('0x37')][_0x156a('0x9c')]?_0x5f159d[_0x156a('0x37')][_0x156a('0x9c')]:null;var _0x2babfb={'method':_0x5f159d[_0x156a('0xa5')],'uri':util[_0x156a('0x50')](_0x156a('0xa6'),_0x189e1a,_0x5f159d[_0x156a('0x37')][_0x156a('0x6')]),'json':_0x20d354,'resolveWithFullResponse':!![],'encoding':_0x3337e7,'body':_0x5f159d[_0x156a('0x8f')]};if(_0x5f159d[_0x156a('0x9d')]){_0x2babfb[_0x156a('0x9d')]=_0x5f159d[_0x156a('0x9d')];if(_0x2babfb[_0x156a('0x9d')][_0x156a('0x9e')]){delete _0x2babfb[_0x156a('0x9d')][_0x156a('0x9e')];}}if(_0x2babfb['headers'][_0x156a('0x9f')]){delete _0x2babfb[_0x156a('0x9d')]['content-type'];}return rp(_0x2babfb);})[_0x156a('0x28')](function(_0x47977c){if(_0x47977c){_0x37777f[_0x156a('0x22')](_0x47977c['headers']);logger['info'](_0x47977c[_0x156a('0x8f')]);return _0x37777f[_0x156a('0x1d')](_0x47977c[_0x156a('0xa1')])['send'](_0x47977c[_0x156a('0x8f')]);}else{return _0x37777f[_0x156a('0xa7')](0xc8);}})[_0x156a('0x49')](handleError(_0x37777f,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 4de3474..0224131 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 _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 +var _0xa30a=['../../mysqldb','Plugin','save','update','remove','emit','hook','exports','events'];(function(_0x4a4dc9,_0x706f71){var _0x4decc2=function(_0x7e4d23){while(--_0x7e4d23){_0x4a4dc9['push'](_0x4a4dc9['shift']());}};_0x4decc2(++_0x706f71);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xaa30('0x0'));var Plugin=require(_0xaa30('0x1'))['db'][_0xaa30('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaa30('0x3'),'afterUpdate':_0xaa30('0x4'),'afterDestroy':_0xaa30('0x5')};function emitEvent(_0x2901b7){return function(_0x2a9b06,_0x271425,_0x102ad7){PluginEvents['emit'](_0x2901b7+':'+_0x2a9b06['id'],_0x2a9b06);PluginEvents[_0xaa30('0x6')](_0x2901b7,_0x2a9b06);_0x102ad7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xaa30('0x7')](e,emitEvent(event));}}module[_0xaa30('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 c5b884b..c2f3be6 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 _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 +var _0xa41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','plugins','lodash','util','api'];(function(_0x10dac8,_0x1827a7){var _0x22117d=function(_0x4ff6f0){while(--_0x4ff6f0){_0x10dac8['push'](_0x10dac8['shift']());}};_0x22117d(++_0x1827a7);}(_0xa41a,0x6b));var _0xaa41=function(_0x4ab65e,_0x2405ea){_0x4ab65e=_0x4ab65e-0x0;var _0x52a368=_0xa41a[_0x4ab65e];return _0x52a368;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('Plugin',attributes,{'tableName':_0xaa41('0xa'),'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 2fe07ea..5e7fcf0 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 _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 +var _0xf7eb=['body','options','raw','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf7eb,0x163));var _0xbf7e=function(_0x571b13,_0x100ff3){_0x571b13=_0x571b13-0x0;var _0x19110b=_0xf7eb[_0x571b13];return _0x19110b;};'use strict';var _=require(_0xbf7e('0x0'));var util=require(_0xbf7e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbf7e('0x2'));var fs=require('fs');var Redis=require(_0xbf7e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf7e('0x4'))(_0xbf7e('0x5'));var config=require(_0xbf7e('0x6'));var jayson=require(_0xbf7e('0x7'));var client=jayson[_0xbf7e('0x8')][_0xbf7e('0x9')]({'port':0x232a});config[_0xbf7e('0xa')]=_[_0xbf7e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbf7e('0xc'))(new Redis(config[_0xbf7e('0xa')]));require(_0xbf7e('0xd'))[_0xbf7e('0xe')](socket);function respondWithRpcPromise(_0x4b7b92,_0x35c5aa,_0x22128c){return new BPromise(function(_0x501e2f,_0x28cda1){return client[_0xbf7e('0xf')](_0x4b7b92,_0x22128c)['then'](function(_0x53736c){logger[_0xbf7e('0x10')](_0xbf7e('0x11'),_0x35c5aa,_0xbf7e('0x12'));logger[_0xbf7e('0x13')](_0xbf7e('0x14'),_0x35c5aa,'request\x20sent',JSON[_0xbf7e('0x15')](_0x53736c));if(_0x53736c['error']){if(_0x53736c[_0xbf7e('0x16')][_0xbf7e('0x17')]===0x1f4){logger['error'](_0xbf7e('0x11'),_0x35c5aa,_0x53736c[_0xbf7e('0x16')][_0xbf7e('0x18')]);return _0x28cda1(_0x53736c[_0xbf7e('0x16')][_0xbf7e('0x18')]);}logger[_0xbf7e('0x16')]('Plugin,\x20%s,\x20%s',_0x35c5aa,_0x53736c[_0xbf7e('0x16')]['message']);return _0x501e2f(_0x53736c[_0xbf7e('0x16')][_0xbf7e('0x18')]);}else{logger['info'](_0xbf7e('0x11'),_0x35c5aa,_0xbf7e('0x12'));_0x501e2f(_0x53736c[_0xbf7e('0x19')]['message']);}})[_0xbf7e('0x1a')](function(_0x5507ff){logger[_0xbf7e('0x16')](_0xbf7e('0x11'),_0x35c5aa,_0x5507ff);_0x28cda1(_0x5507ff);});});}exports[_0xbf7e('0x1b')]=function(_0x4a727c){var _0xea8a19=this;return new Promise(function(_0x140f73,_0x21289b){return db[_0xbf7e('0x1c')]['create'](_0x4a727c[_0xbf7e('0x1d')],{'raw':_0x4a727c[_0xbf7e('0x1e')]?_0x4a727c[_0xbf7e('0x1e')][_0xbf7e('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x1120c7){logger[_0xbf7e('0x10')](_0xbf7e('0x1b'),_0x4a727c);logger[_0xbf7e('0x13')](_0xbf7e('0x1b'),_0x4a727c,JSON[_0xbf7e('0x15')](_0x1120c7));_0x140f73(_0x1120c7);})[_0xbf7e('0x1a')](function(_0x39e7d9){logger[_0xbf7e('0x16')](_0xbf7e('0x1b'),_0x39e7d9['message'],_0x4a727c);_0x21289b(_0xea8a19[_0xbf7e('0x16')](0x1f4,_0x39e7d9[_0xbf7e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 5346e38..1e1a41e 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 _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 +var _0x3237=['plugin:','remove','update','emit','removeListener'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x3237,0x150));var _0x7323=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x3237[_0x6c993a];return _0x27f547;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0x7323('0x0'),_0x7323('0x1')];function createListener(_0x562932,_0xa06873){return function(_0x531128){_0xa06873[_0x7323('0x2')](_0x562932,_0x531128);};}function removeListener(_0xf32d0c,_0x63d2fe){return function(){PluginEvents[_0x7323('0x3')](_0xf32d0c,_0x63d2fe);};}exports['register']=function(_0x1fbba0){for(var _0x2f4dd6=0x0,_0xdfdb3c=events['length'];_0x2f4dd6<_0xdfdb3c;_0x2f4dd6++){var _0x418bc2=events[_0x2f4dd6];var _0x48bee7=createListener(_0x7323('0x4')+_0x418bc2,_0x1fbba0);PluginEvents['on'](_0x418bc2,_0x48bee7);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 9c276d5..76d5ad9 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 _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 +var _0x3792=['Router','../../components/auth/service','./pm2.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','express'];(function(_0x3bf4d5,_0x366a37){var _0x48fdea=function(_0x665bbe){while(--_0x665bbe){_0x3bf4d5['push'](_0x3bf4d5['shift']());}};_0x48fdea(++_0x366a37);}(_0x3792,0x1df));var _0x2379=function(_0x313766,_0x1f5479){_0x313766=_0x313766-0x0;var _0x593542=_0x3792[_0x313766];return _0x593542;};'use strict';var express=require(_0x2379('0x0'));var router=express[_0x2379('0x1')]();var auth=require(_0x2379('0x2'));var controller=require(_0x2379('0x3'));router[_0x2379('0x4')]('/',auth[_0x2379('0x5')](),controller[_0x2379('0x6')]);router[_0x2379('0x4')](_0x2379('0x7'),auth[_0x2379('0x5')](),controller[_0x2379('0x8')]);router[_0x2379('0x9')]('/',auth['isAuthenticated'](),controller[_0x2379('0xa')]);router[_0x2379('0xb')]('/:id',auth[_0x2379('0x5')](),controller[_0x2379('0xc')]);router[_0x2379('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x2379('0xe')]);module[_0x2379('0xf')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 3270802..ff2a4bd 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 _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 +var _0x67ab=['send','npm\x20install','index','list','then','reject','motion2','length','catch','show','describe','params','create','body','script','join','cwd','dirname','start','dump','update','restart','stop','hasOwnProperty','destroy','delete','Unknown\x20id','lodash','../../config/pm2','api','child_process','bluebird','sendStatus','status','json','error','name'];(function(_0xa53067,_0x48b0e1){var _0x1fe763=function(_0x47a63f){while(--_0x47a63f){_0xa53067['push'](_0xa53067['shift']());}};_0x1fe763(++_0x48b0e1);}(_0x67ab,0x1d7));var _0xb67a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x67ab[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb67a('0x0'));var pm2=require(_0xb67a('0x1'));var logger=require('../../config/logger')(_0xb67a('0x2'));var path=require('path');var exec=require(_0xb67a('0x3'))['exec'];var BPromise=require(_0xb67a('0x4'));function handleEntityNotFound(_0x459ef4,_0xcdc1a7){return function(_0x2fa1af){if(!_0x2fa1af){_0x459ef4[_0xb67a('0x5')](0x194);;}return _0x2fa1af;};}function respondWithResult(_0x458f48,_0x38a06a){_0x38a06a=_0x38a06a||0xc8;return function(_0x152661){if(_0x152661){return _0x458f48[_0xb67a('0x6')](_0x38a06a)[_0xb67a('0x7')](_0x152661);}return null;};}function handleError(_0x34a72e,_0x592356){_0x592356=_0x592356||0x1f4;return function(_0x10738b){logger[_0xb67a('0x8')](_0x10738b['stack']);if(_0x10738b['name']){delete _0x10738b[_0xb67a('0x9')];}_0x34a72e[_0xb67a('0x6')](_0x592356)[_0xb67a('0xa')](_0x10738b);};}function execChildProcess(){return new BPromise(function(_0x3d8345,_0x370e12){exec(_0xb67a('0xb'),function(_0x1ff710,_0x46fa76,_0x1cb7a1){logger['info'](_0x46fa76);logger['info'](_0x1cb7a1);if(_0x1ff710){logger[_0xb67a('0x8')](_0x1ff710);return _0x370e12(_0x1ff710);}return _0x3d8345(_0x46fa76);});});}exports[_0xb67a('0xc')]=function(_0x48f8f9,_0x25d06b){return pm2[_0xb67a('0xd')]()[_0xb67a('0xe')](function(_0x49eb78){if(_0x49eb78){var _0x308acd=_[_0xb67a('0xf')](_0x49eb78,function(_0xb85e75){return _0xb85e75['name']==='express'||_0xb85e75[_0xb67a('0x9')]===_0xb67a('0x10');});return{'rows':_0x308acd,'count':_0x308acd[_0xb67a('0x11')]};}return null;})[_0xb67a('0xe')](respondWithResult(_0x25d06b,null))[_0xb67a('0x12')](handleError(_0x25d06b,null));};exports[_0xb67a('0x13')]=function(_0x182084,_0x1b4f09){return pm2[_0xb67a('0x14')](_0x182084[_0xb67a('0x15')]['id'])[_0xb67a('0xe')](respondWithResult(_0x1b4f09,null))[_0xb67a('0xe')](handleEntityNotFound(_0x1b4f09,null))[_0xb67a('0x12')](handleError(_0x1b4f09,null));};exports[_0xb67a('0x16')]=function(_0x2a66a6,_0x449820){if(_0x2a66a6[_0xb67a('0x17')][_0xb67a('0x9')]&&_0x2a66a6['body'][_0xb67a('0x18')]){var _0x32ffee=path[_0xb67a('0x19')](__dirname,'../../files/plugins',_0x2a66a6[_0xb67a('0x17')][_0xb67a('0x18')]);var _0x3add6e=process[_0xb67a('0x1a')]();process['chdir'](path[_0xb67a('0x1b')](_0x32ffee));return execChildProcess()[_0xb67a('0xe')](function(_0x331e50){process['chdir'](_0x3add6e);return pm2[_0xb67a('0x1c')]({'name':_0x2a66a6[_0xb67a('0x17')][_0xb67a('0x9')],'script':_0x32ffee});})[_0xb67a('0xe')](function(_0x1f777f){pm2[_0xb67a('0x1d')]();return _0x1f777f[0x0];})[_0xb67a('0xe')](respondWithResult(_0x449820,0xc9))['catch'](handleError(_0x449820,null));}else{return _0x449820[_0xb67a('0x6')](0x1f4)[_0xb67a('0xa')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xb67a('0x1e')]=function(_0x10ad90,_0x2940eb){if(_0x10ad90[_0xb67a('0x17')]['id']){delete _0x10ad90['body']['id'];}var _0x50599b={'online':_0xb67a('0x1f'),'stopped':_0xb67a('0x20')};if(_0x50599b[_0xb67a('0x21')](_0x10ad90['body']['status'])){return pm2[_0x50599b[_0x10ad90[_0xb67a('0x17')]['status']]](_0x10ad90[_0xb67a('0x15')]['id'])[_0xb67a('0xe')](respondWithResult(_0x2940eb,0xc8))[_0xb67a('0x12')](handleError(_0x2940eb,null));}else{return _0x2940eb[_0xb67a('0x6')](0x1f4)[_0xb67a('0xa')]({'message':'Unknown\x20status'});}};exports[_0xb67a('0x22')]=function(_0x407ad1,_0x26cc90){if(_0x407ad1[_0xb67a('0x17')]['id']){delete _0x407ad1['body']['id'];}if(_0x407ad1[_0xb67a('0x15')]['id']){return pm2[_0xb67a('0x23')](_0x407ad1[_0xb67a('0x15')]['id'])[_0xb67a('0xe')](function(_0x1b38d9){pm2[_0xb67a('0x1d')]();return _0x1b38d9[0x0];})['then'](respondWithResult(_0x26cc90,null))[_0xb67a('0x12')](handleError(_0x26cc90,null));}else{return _0x26cc90[_0xb67a('0x6')](0x1f4)[_0xb67a('0xa')]({'message':_0xb67a('0x24')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 73f2e66..a99cb99 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 _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 +var _0x5b64=['../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x3f4fc8,_0xd48416){var _0xf00ef2=function(_0x1f6c55){while(--_0x1f6c55){_0x3f4fc8['push'](_0x3f4fc8['shift']());}};_0xf00ef2(++_0xd48416);}(_0x5b64,0x122));var _0x45b6=function(_0x330d6c,_0x159218){_0x330d6c=_0x330d6c-0x0;var _0x4388ba=_0x5b64[_0x330d6c];return _0x4388ba;};'use strict';var multer=require(_0x45b6('0x0'));var util=require(_0x45b6('0x1'));var path=require(_0x45b6('0x2'));var timeout=require(_0x45b6('0x3'));var express=require(_0x45b6('0x4'));var router=express[_0x45b6('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x45b6('0x6'));var config=require(_0x45b6('0x7'));module[_0x45b6('0x8')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 00715a2..b313289 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 _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 +var _0xb461=['exports','INTEGER','STRING','DATE'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0xb461,0x180));var _0x1b46=function(_0x5ed6a4,_0x3e42dc){_0x5ed6a4=_0x5ed6a4-0x0;var _0x58cf91=_0xb461[_0x5ed6a4];return _0x58cf91;};'use strict';var Sequelize=require('sequelize');module[_0x1b46('0x0')]={'state':{'type':Sequelize[_0x1b46('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x1b46('0x2')]},'scheduledat':{'type':Sequelize[_0x1b46('0x3')]},'uniqueid':{'type':Sequelize[_0x1b46('0x2')]},'starttime':{'type':Sequelize[_0x1b46('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x1b46('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x1b46('0x2')]},'campaigntype':{'type':Sequelize[_0x1b46('0x2')]},'membername':{'type':Sequelize[_0x1b46('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 3e1dfab..b51bca6 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 _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 +var _0x71cd=['report_agent_preview','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','ReportAgentPreview'];(function(_0x14d39d,_0x585cdc){var _0x3218ba=function(_0x3b7ace){while(--_0x3b7ace){_0x14d39d['push'](_0x14d39d['shift']());}};_0x3218ba(++_0x585cdc);}(_0x71cd,0x10f));var _0xd71c=function(_0x56a061,_0x53fb1b){_0x56a061=_0x56a061-0x0;var _0x105fa0=_0x71cd[_0x56a061];return _0x105fa0;};'use strict';var _=require(_0xd71c('0x0'));var util=require('util');var logger=require(_0xd71c('0x1'))(_0xd71c('0x2'));var moment=require(_0xd71c('0x3'));var BPromise=require(_0xd71c('0x4'));var rp=require(_0xd71c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd71c('0x6'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module[_0xd71c('0x7')]=function(_0x5a49a1,_0x3f7161){return _0x5a49a1['define'](_0xd71c('0x8'),attributes,{'tableName':_0xd71c('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 8977144..d16983b 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 _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 +var _0x8fff=['../../config/logger','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x492535,_0x46524a){var _0x256620=function(_0x3015f8){while(--_0x3015f8){_0x492535['push'](_0x492535['shift']());}};_0x256620(++_0x46524a);}(_0x8fff,0x1ba));var _0xf8ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8fff[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf8ff('0x0'));var moment=require('moment');var BPromise=require(_0xf8ff('0x1'));var rs=require(_0xf8ff('0x2'));var fs=require('fs');var Redis=require(_0xf8ff('0x3'));var db=require(_0xf8ff('0x4'))['db'];var utils=require(_0xf8ff('0x5'));var logger=require(_0xf8ff('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf8ff('0x7')][_0xf8ff('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c5de0,_0x23b3f4,_0x1bb98b){return new BPromise(function(_0x1312dc,_0x5be1e5){return client[_0xf8ff('0x9')](_0x3c5de0,_0x1bb98b)[_0xf8ff('0xa')](function(_0x4c6f3f){logger[_0xf8ff('0xb')](_0xf8ff('0xc'),_0x23b3f4,_0xf8ff('0xd'));logger[_0xf8ff('0xe')](_0xf8ff('0xf'),_0x23b3f4,'request\x20sent',JSON[_0xf8ff('0x10')](_0x4c6f3f));if(_0x4c6f3f[_0xf8ff('0x11')]){if(_0x4c6f3f[_0xf8ff('0x11')][_0xf8ff('0x12')]===0x1f4){logger[_0xf8ff('0x11')](_0xf8ff('0xc'),_0x23b3f4,_0x4c6f3f[_0xf8ff('0x11')]['message']);return _0x5be1e5(_0x4c6f3f[_0xf8ff('0x11')]['message']);}logger['error'](_0xf8ff('0xc'),_0x23b3f4,_0x4c6f3f[_0xf8ff('0x11')][_0xf8ff('0x13')]);return _0x1312dc(_0x4c6f3f[_0xf8ff('0x11')]['message']);}else{logger[_0xf8ff('0xb')](_0xf8ff('0xc'),_0x23b3f4,'request\x20sent');_0x1312dc(_0x4c6f3f[_0xf8ff('0x14')][_0xf8ff('0x13')]);}})[_0xf8ff('0x15')](function(_0x319b8d){logger['error'](_0xf8ff('0xc'),_0x23b3f4,_0x319b8d);_0x5be1e5(_0x319b8d);});});}exports[_0xf8ff('0x16')]=function(_0x4866e7){var _0x2211e0=this;return new Promise(function(_0x23185b,_0x22cd19){return db[_0xf8ff('0x17')][_0xf8ff('0x18')](_0x4866e7[_0xf8ff('0x19')],{'raw':_0x4866e7['options']?_0x4866e7[_0xf8ff('0x1a')][_0xf8ff('0x1b')]===undefined?!![]:![]:!![]})[_0xf8ff('0xa')](function(_0x3695a2){logger[_0xf8ff('0xb')](_0xf8ff('0x16'),_0x4866e7);logger[_0xf8ff('0xe')](_0xf8ff('0x16'),_0x4866e7,JSON[_0xf8ff('0x10')](_0x3695a2));_0x23185b(_0x3695a2);})[_0xf8ff('0x15')](function(_0x215e74){logger[_0xf8ff('0x11')](_0xf8ff('0x16'),_0x215e74['message'],_0x4866e7);_0x22cd19(_0x2211e0[_0xf8ff('0x11')](0x1f4,_0x215e74[_0xf8ff('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 7e60575..8d36a4a 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 _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 +var _0xbeb1=['Router','../../components/auth/service','isAuthenticated','get','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','/chat/queues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','smsQueues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/outbound','outbound','outboundChannels','/agents','agents','put','/agents/:id/capacity','/telephones','trunks','campaigns','faxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','express'];(function(_0x377828,_0x58c57e){var _0x26adb1=function(_0x25c4cc){while(--_0x25c4cc){_0x377828['push'](_0x377828['shift']());}};_0x26adb1(++_0x58c57e);}(_0xbeb1,0xf9));var _0x1beb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xbeb1[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x1beb('0x0'));var util=require(_0x1beb('0x1'));var path=require('path');var express=require(_0x1beb('0x2'));var router=express[_0x1beb('0x3')]();var auth=require(_0x1beb('0x4'));var controller=require('./rpc.controller');router['get']('/voice/channels',auth[_0x1beb('0x5')](),controller['voiceChannels']);router[_0x1beb('0x6')](_0x1beb('0x7'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router['get'](_0x1beb('0x8'),auth[_0x1beb('0x5')](),controller['voiceChannelStopMixMonitor']);router['get']('/voice/queues',auth[_0x1beb('0x5')](),controller['voiceQueues']);router[_0x1beb('0x6')](_0x1beb('0x9'),auth[_0x1beb('0x5')](),controller['chatQueues']);router[_0x1beb('0x6')](_0x1beb('0xa'),auth[_0x1beb('0x5')](),controller[_0x1beb('0xb')]);router[_0x1beb('0x6')](_0x1beb('0xc'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0x1beb('0x6')](_0x1beb('0xd'),auth[_0x1beb('0x5')](),controller[_0x1beb('0xe')]);router[_0x1beb('0x6')]('/sms/queues',auth['isAuthenticated'](),controller[_0x1beb('0xf')]);router[_0x1beb('0x6')]('/whatsapp/queues',auth[_0x1beb('0x5')](),controller[_0x1beb('0x10')]);router[_0x1beb('0x6')]('/fax/queues',auth['isAuthenticated'](),controller[_0x1beb('0x11')]);router[_0x1beb('0x6')](_0x1beb('0x12'),auth[_0x1beb('0x5')](),controller[_0x1beb('0x13')]);router['get']('/voice/queues/channels',auth[_0x1beb('0x5')](),controller['voiceQueuesChannels']);router[_0x1beb('0x6')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x1beb('0x14')]);router[_0x1beb('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x1beb('0x5')](),controller[_0x1beb('0x15')]);router[_0x1beb('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0x1beb('0x16')]);router[_0x1beb('0x6')]('/voice/queues/:id',auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0x1beb('0x6')](_0x1beb('0x17'),auth[_0x1beb('0x5')](),controller[_0x1beb('0x18')]);router['get']('/outbound/channels',auth[_0x1beb('0x5')](),controller[_0x1beb('0x19')]);router[_0x1beb('0x6')](_0x1beb('0x1a'),auth['isAuthenticated'](),controller[_0x1beb('0x1b')]);router[_0x1beb('0x1c')](_0x1beb('0x1d'),auth[_0x1beb('0x5')](),controller['agentCapacity']);router['get'](_0x1beb('0x1e'),auth[_0x1beb('0x5')](),controller['telephones']);router['get']('/trunks',auth[_0x1beb('0x5')](),controller[_0x1beb('0x1f')]);router['get']('/campaigns',auth[_0x1beb('0x5')](),controller[_0x1beb('0x20')]);router[_0x1beb('0x6')]('/fax/accounts',auth[_0x1beb('0x5')](),controller[_0x1beb('0x21')]);router[_0x1beb('0x6')]('/chat/queues/waitinginteractions',auth[_0x1beb('0x5')](),controller[_0x1beb('0x22')]);router['get']('/mail/queues/waitinginteractions',auth[_0x1beb('0x5')](),controller[_0x1beb('0x23')]);router[_0x1beb('0x6')](_0x1beb('0x24'),auth['isAuthenticated'](),controller[_0x1beb('0x25')]);router[_0x1beb('0x6')](_0x1beb('0x26'),auth[_0x1beb('0x5')](),controller[_0x1beb('0x27')]);router[_0x1beb('0x6')]('/sms/queues/waitinginteractions',auth[_0x1beb('0x5')](),controller['smsQueuesWaitingInteractions']);router[_0x1beb('0x6')](_0x1beb('0x28'),auth['isAuthenticated'](),controller[_0x1beb('0x29')]);router[_0x1beb('0x6')](_0x1beb('0x2a'),auth[_0x1beb('0x5')](),controller[_0x1beb('0x2b')]);router[_0x1beb('0x2c')](_0x1beb('0x2d'),auth[_0x1beb('0x5')](),controller['queueNotify']('mail'));router[_0x1beb('0x6')]('/mail/queues/:id',auth[_0x1beb('0x5')](),controller[_0x1beb('0x2e')]);router[_0x1beb('0x2c')](_0x1beb('0x2f'),auth[_0x1beb('0x5')](),controller[_0x1beb('0x30')](_0x1beb('0x31')));router[_0x1beb('0x6')](_0x1beb('0x32'),auth[_0x1beb('0x5')](),controller['showChatQueues']);router[_0x1beb('0x2c')]('/fax/queues/:id/notify',auth[_0x1beb('0x5')](),controller[_0x1beb('0x30')](_0x1beb('0x33')));router['get']('/fax/queues/:id',auth[_0x1beb('0x5')](),controller[_0x1beb('0x34')]);router[_0x1beb('0x2c')](_0x1beb('0x35'),auth[_0x1beb('0x5')](),controller[_0x1beb('0x30')](_0x1beb('0x36')));router[_0x1beb('0x6')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0x1beb('0x37')]);router['post'](_0x1beb('0x38'),auth[_0x1beb('0x5')](),controller[_0x1beb('0x30')]('sms'));router[_0x1beb('0x2c')]('/whatsapp/queues/:id/notify',auth[_0x1beb('0x5')](),controller[_0x1beb('0x30')](_0x1beb('0x39')));router[_0x1beb('0x6')](_0x1beb('0x3a'),auth['isAuthenticated'](),controller['showSmsQueues']);router[_0x1beb('0x6')](_0x1beb('0x3b'),auth[_0x1beb('0x5')](),controller[_0x1beb('0x3c')]);router[_0x1beb('0x2c')](_0x1beb('0x3d'),auth[_0x1beb('0x5')](),controller['agentNotify']);module[_0x1beb('0x3e')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 927caa3..caf788c 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 _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 +var _0x2f0d=['value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','Account','QueueId','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','TransferReport','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','catch','json','sendStatus','stack','name','send','isNil','rows','voiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','format','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','uniq'];(function(_0x176a30,_0x214804){var _0x568f0a=function(_0x133e05){while(--_0x133e05){_0x176a30['push'](_0x176a30['shift']());}};_0x568f0a(++_0x214804);}(_0x2f0d,0xa8));var _0xd2f0=function(_0x1a20d9,_0x24f24d){_0x1a20d9=_0x1a20d9-0x0;var _0x3b50ac=_0x2f0d[_0x1a20d9];return _0x3b50ac;};'use strict';var BPromise=require(_0xd2f0('0x0'));var moment=require(_0xd2f0('0x1'));var _=require(_0xd2f0('0x2'));var util=require(_0xd2f0('0x3'));var db=require(_0xd2f0('0x4'))['db'];var logger=require(_0xd2f0('0x5'))(_0xd2f0('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0xd2f0('0x7')][_0xd2f0('0x8')]({'port':0x232a});var mailClient=jayson[_0xd2f0('0x7')][_0xd2f0('0x8')]({'port':0x232b});var routingClient=jayson['client'][_0xd2f0('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x1c8200,_0xa5ade5,_0x1d749e){return new BPromise(function(_0x287e19,_0xf204be){var _0x55e27e=_0x1d749e?_0x1d749e:amiClient;return _0x55e27e[_0xd2f0('0x9')](_0x1c8200,_0xa5ade5)[_0xd2f0('0xa')](function(_0x21fff9){if(_0x21fff9[_0xd2f0('0xb')]){if(_0x21fff9[_0xd2f0('0xb')][_0xd2f0('0xc')]===0x1f4){return _0xf204be(_0x21fff9[_0xd2f0('0xb')][_0xd2f0('0xd')]);}return _0x287e19(_0x21fff9[_0xd2f0('0xb')][_0xd2f0('0xd')]);}else{_0x287e19(_0x21fff9[_0xd2f0('0xe')]);}})[_0xd2f0('0xf')](function(_0x91c28){_0xf204be(_0x91c28);});});}function respondWithResult(_0x287b47,_0x5cb7ad){_0x5cb7ad=_0x5cb7ad||0xc8;return function(_0x4e4a2f){if(_0x4e4a2f){return _0x287b47['status'](_0x5cb7ad)[_0xd2f0('0x10')](_0x4e4a2f);}return _0x287b47[_0xd2f0('0x11')](0x194);};}function handleError(_0x559bd6,_0x5e16c1){_0x5e16c1=_0x5e16c1||0x1f4;return function(_0x418976){logger['error'](_0x418976[_0xd2f0('0x12')]);if(_0x418976[_0xd2f0('0x13')]){delete _0x418976['name'];}_0x559bd6['status'](_0x5e16c1)[_0xd2f0('0x14')](_0x418976);};}function findById(_0x438a29){return function(_0x4ee456){if(!_[_0xd2f0('0x15')](_0x438a29)&&!_[_0xd2f0('0x15')](_0x4ee456)&&!_['isNil'](_0x4ee456[_0xd2f0('0x16')])){return _['find'](_0x4ee456[_0xd2f0('0x16')],function(_0x254b10){return _0x254b10['id']==_0x438a29;});}return null;};}exports[_0xd2f0('0x17')]=function(_0x46fc59,_0x5abbc4){return respondWithRpcPromise('VoiceChannels',_0x46fc59[_0xd2f0('0x18')])[_0xd2f0('0xa')](respondWithResult(_0x5abbc4,null))[_0xd2f0('0xf')](handleError(_0x5abbc4,null));};exports[_0xd2f0('0x19')]=function(_0x2d8d5d,_0x1c73e0){return respondWithRpcPromise(_0xd2f0('0x1a'),_[_0xd2f0('0x1b')](_0x2d8d5d[_0xd2f0('0x18')],_0x2d8d5d[_0xd2f0('0x1c')]))[_0xd2f0('0xa')](respondWithResult(_0x1c73e0,null))[_0xd2f0('0xf')](handleError(_0x1c73e0,null));};exports['voiceChannelStopMixMonitor']=function(_0xfdc458,_0x28cc24){return respondWithRpcPromise(_0xd2f0('0x1d'),_[_0xd2f0('0x1b')](_0xfdc458[_0xd2f0('0x18')],_0xfdc458[_0xd2f0('0x1c')]))[_0xd2f0('0xa')](respondWithResult(_0x28cc24,null))[_0xd2f0('0xf')](handleError(_0x28cc24,null));};exports['voiceQueues']=function(_0x336da3,_0xbbd3a7){return respondWithRpcPromise(_0xd2f0('0x1e'),_0x336da3[_0xd2f0('0x18')])['then'](respondWithResult(_0xbbd3a7,null))[_0xd2f0('0xf')](handleError(_0xbbd3a7,null));};exports[_0xd2f0('0x1f')]=function(_0x44f130,_0x2f344b){return respondWithRpcPromise(_0xd2f0('0x1e'),_0x44f130['query'])[_0xd2f0('0xa')](findById(_0x44f130[_0xd2f0('0x1c')]['id']))[_0xd2f0('0xa')](respondWithResult(_0x2f344b,null))[_0xd2f0('0xf')](handleError(_0x2f344b,null));};exports['voiceQueuesPreview']=function(_0x5b4cfe,_0x4df06a){return respondWithRpcPromise(_0xd2f0('0x20'),_['merge'](_0x5b4cfe['query'],_0x5b4cfe[_0xd2f0('0x1c')]))[_0xd2f0('0xa')](respondWithResult(_0x4df06a,null))['catch'](handleError(_0x4df06a,null));};exports['voiceQueuesChannels']=function(_0x30a87e,_0x13a88b){return respondWithRpcPromise(_0xd2f0('0x21'),_0x30a87e[_0xd2f0('0x18')])[_0xd2f0('0xa')](respondWithResult(_0x13a88b,null))['catch'](handleError(_0x13a88b,null));};exports[_0xd2f0('0x22')]=function(_0x478c0d,_0x46ea4a){return respondWithRpcPromise(_0xd2f0('0x23'),_[_0xd2f0('0x1b')](_0x478c0d[_0xd2f0('0x18')],_0x478c0d[_0xd2f0('0x1c')]))[_0xd2f0('0xa')](respondWithResult(_0x46ea4a,null))['catch'](handleError(_0x46ea4a,null));};exports[_0xd2f0('0x24')]=function(_0x237a9f,_0xbefcb8){return respondWithRpcPromise(_0xd2f0('0x25'),_[_0xd2f0('0x1b')](_0x237a9f['query'],_0x237a9f[_0xd2f0('0x1c')]))[_0xd2f0('0xa')](respondWithResult(_0xbefcb8,null))[_0xd2f0('0xf')](handleError(_0xbefcb8,null));};exports['voiceQueuesChannelRedirect']=function(_0x1bf86d,_0x355161){return respondWithRpcPromise(_0xd2f0('0x26'),_[_0xd2f0('0x1b')](_0x1bf86d[_0xd2f0('0x18')],_0x1bf86d[_0xd2f0('0x1c')]))[_0xd2f0('0xa')](respondWithResult(_0x355161,null))[_0xd2f0('0xf')](handleError(_0x355161,null));};exports[_0xd2f0('0x27')]=function(_0x26ef4c,_0x62563e){return respondWithRpcPromise(_0xd2f0('0x28'),_0x26ef4c[_0xd2f0('0x18')])[_0xd2f0('0xa')](respondWithResult(_0x62563e,null))[_0xd2f0('0xf')](handleError(_0x62563e,null));};exports[_0xd2f0('0x29')]=function(_0x18dae5,_0x30fa35){return respondWithRpcPromise(_0xd2f0('0x2a'),_0x18dae5[_0xd2f0('0x18')])[_0xd2f0('0xa')](respondWithResult(_0x30fa35,null))[_0xd2f0('0xf')](handleError(_0x30fa35,null));};exports[_0xd2f0('0x2b')]=function(_0x18521e,_0x1d3c94){var _0x42fad6;return respondWithRpcPromise(_0xd2f0('0x2c'),_0x18521e['query'])[_0xd2f0('0xa')](function(_0x54ef34){_0x42fad6=_0x54ef34;return respondWithRpcPromise('Agents',_0x18521e[_0xd2f0('0x18')],routingClient);})[_0xd2f0('0xa')](function(_0x48ecd0){return _[_0xd2f0('0x1b')]({},_0x48ecd0,_0x42fad6);})[_0xd2f0('0xa')](respondWithResult(_0x1d3c94,null))['catch'](handleError(_0x1d3c94,null));};exports[_0xd2f0('0x2d')]=function(_0x4dca4d,_0x3faa2d){if(_0x4dca4d['body']&&_0x4dca4d[_0xd2f0('0x2e')][_0xd2f0('0x2f')]&&_0x4dca4d[_0xd2f0('0x30')]&&_0x4dca4d[_0xd2f0('0x30')][_0xd2f0('0x13')]){for(var _0x42972b in _0x4dca4d[_0xd2f0('0x2e')][_0xd2f0('0x2f')]){if(_0x4dca4d[_0xd2f0('0x2e')]['interaction'][_0xd2f0('0x31')](_0x42972b)){db[_0xd2f0('0x32')]['findAll']({'where':{'channel':_0x42972b,'membername':_0x4dca4d['user'][_0xd2f0('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x4dca4d[_0xd2f0('0x2e')][_0xd2f0('0x2f')][_0x42972b]&&_0x4dca4d['body'][_0xd2f0('0x2f')][_0x42972b][_0xd2f0('0x33')]?{'$notIn':_0x4dca4d[_0xd2f0('0x2e')][_0xd2f0('0x2f')][_0x42972b]}:{'$ne':null}}})[_0xd2f0('0xa')](function(_0x2ff1fe){var _0x426af9=moment()['format'](_0xd2f0('0x34'));for(var _0x5a4bfb=0x0,_0x5a4e2e=_0x2ff1fe[_0xd2f0('0x33')];_0x5a4bfb<_0x5a4e2e;_0x5a4bfb+=0x1){_0x2ff1fe[_0x5a4bfb][_0xd2f0('0x35')]({'exitAt':_0x426af9});}});for(var _0x29d1ab=0x0;_0x29d1ab<_0x4dca4d['body']['interaction'][_0x42972b]['length'];_0x29d1ab+=0x1){db[_0xd2f0('0x32')][_0xd2f0('0x36')]({'where':{'channel':_0x42972b,'membername':_0x4dca4d[_0xd2f0('0x30')][_0xd2f0('0x13')],'type':_0xd2f0('0x37'),'uniqueid':_0x4dca4d[_0xd2f0('0x2e')]['interaction'][_0x42972b][_0x29d1ab],'exitAt':null},'defaults':{'channel':_0x42972b,'membername':_0x4dca4d[_0xd2f0('0x30')][_0xd2f0('0x13')],'interface':_[_0xd2f0('0x15')](_0x4dca4d[_0xd2f0('0x30')][_0xd2f0('0x38')])?util[_0xd2f0('0x39')](_0xd2f0('0x3a'),_0x4dca4d[_0xd2f0('0x30')][_0xd2f0('0x13')]):_0x4dca4d['user'][_0xd2f0('0x38')],'type':_0xd2f0('0x37'),'enterAt':moment()['format'](_0xd2f0('0x34')),'role':_0xd2f0('0x3b'),'internal':_0x4dca4d[_0xd2f0('0x30')][_0xd2f0('0x3c')],'uniqueid':_0x4dca4d['body'][_0xd2f0('0x2f')][_0x42972b][_0x29d1ab]}});}}}}return respondWithRpcPromise(_0xd2f0('0x3d'),{'id':_0x4dca4d['params']['id'],'capacity':_0x4dca4d[_0xd2f0('0x2e')][_0xd2f0('0x3e')]},routingClient)[_0xd2f0('0xa')](respondWithResult(_0x3faa2d,null))['catch'](handleError(_0x3faa2d,null));};exports[_0xd2f0('0x3f')]=function(_0x48ad48,_0x1b43d6){return respondWithRpcPromise(_0xd2f0('0x40'),_0x48ad48['query'])['then'](respondWithResult(_0x1b43d6,null))[_0xd2f0('0xf')](handleError(_0x1b43d6,null));};exports[_0xd2f0('0x41')]=function(_0x3fe993,_0x4a25ca){return respondWithRpcPromise(_0xd2f0('0x42'),_0x3fe993['query'])['then'](respondWithResult(_0x4a25ca,null))[_0xd2f0('0xf')](handleError(_0x4a25ca,null));};exports[_0xd2f0('0x43')]=function(_0x5ce2d0,_0x45dc36){return respondWithRpcPromise(_0xd2f0('0x44'),_0x5ce2d0[_0xd2f0('0x18')])['then'](respondWithResult(_0x45dc36,null))[_0xd2f0('0xf')](handleError(_0x45dc36,null));};exports['chatQueues']=function(_0xade04d,_0x4badc4){return respondWithRpcPromise(_0xd2f0('0x45'),_0xade04d[_0xd2f0('0x18')],routingClient)['then'](respondWithResult(_0x4badc4,null))[_0xd2f0('0xf')](handleError(_0x4badc4,null));};exports[_0xd2f0('0x46')]=function(_0x5e3654,_0xf9026d){return respondWithRpcPromise(_0xd2f0('0x45'),_0x5e3654['query'],routingClient)[_0xd2f0('0xa')](findById(_0x5e3654[_0xd2f0('0x1c')]['id']))['then'](respondWithResult(_0xf9026d,null))[_0xd2f0('0xf')](handleError(_0xf9026d,null));};exports[_0xd2f0('0x47')]=function(_0x5c5700,_0x46c2bd){return respondWithRpcPromise(_0xd2f0('0x48'),_0x5c5700['query'],routingClient)['then'](respondWithResult(_0x46c2bd,null))['catch'](handleError(_0x46c2bd,null));};exports[_0xd2f0('0x49')]=function(_0xfbc913,_0x32910f){return respondWithRpcPromise(_0xd2f0('0x48'),_0xfbc913['query'],routingClient)[_0xd2f0('0xa')](findById(_0xfbc913[_0xd2f0('0x1c')]['id']))[_0xd2f0('0xa')](respondWithResult(_0x32910f,null))[_0xd2f0('0xf')](handleError(_0x32910f,null));};exports[_0xd2f0('0x4a')]=function(_0x2e7247,_0x33987a){return respondWithRpcPromise(_0xd2f0('0x4b'),_0x2e7247[_0xd2f0('0x18')],mailClient)[_0xd2f0('0xa')](respondWithResult(_0x33987a,null))[_0xd2f0('0xf')](handleError(_0x33987a,null));};exports[_0xd2f0('0x4c')]=function(_0x4385ee,_0x9bb4f8){return respondWithRpcPromise('OpenchannelQueues',_0x4385ee['query'],routingClient)[_0xd2f0('0xa')](respondWithResult(_0x9bb4f8,null))['catch'](handleError(_0x9bb4f8,null));};exports['showOpenchannelQueues']=function(_0x318ffe,_0xb778b0){return respondWithRpcPromise(_0xd2f0('0x4d'),_0x318ffe[_0xd2f0('0x18')],routingClient)[_0xd2f0('0xa')](findById(_0x318ffe[_0xd2f0('0x1c')]['id']))[_0xd2f0('0xa')](respondWithResult(_0xb778b0,null))['catch'](handleError(_0xb778b0,null));};exports[_0xd2f0('0x4e')]=function(_0xf5f533,_0x13dce5){return respondWithRpcPromise(_0xd2f0('0x4f'),_0xf5f533['query'],routingClient)[_0xd2f0('0xa')](respondWithResult(_0x13dce5,null))[_0xd2f0('0xf')](handleError(_0x13dce5,null));};exports[_0xd2f0('0x50')]=function(_0x5b0042,_0x3af8d2){return respondWithRpcPromise('SmsQueues',_0x5b0042[_0xd2f0('0x18')],routingClient)[_0xd2f0('0xa')](findById(_0x5b0042[_0xd2f0('0x1c')]['id']))[_0xd2f0('0xa')](respondWithResult(_0x3af8d2,null))[_0xd2f0('0xf')](handleError(_0x3af8d2,null));};exports[_0xd2f0('0x51')]=function(_0x4337ff,_0xfa96c1){return respondWithRpcPromise(_0xd2f0('0x52'),_0x4337ff['query'],routingClient)[_0xd2f0('0xa')](respondWithResult(_0xfa96c1,null))[_0xd2f0('0xf')](handleError(_0xfa96c1,null));};exports[_0xd2f0('0x53')]=function(_0x32e427,_0x4f1b1b){return respondWithRpcPromise('WhatsappQueues',_0x32e427[_0xd2f0('0x18')],routingClient)[_0xd2f0('0xa')](findById(_0x32e427[_0xd2f0('0x1c')]['id']))[_0xd2f0('0xa')](respondWithResult(_0x4f1b1b,null))[_0xd2f0('0xf')](handleError(_0x4f1b1b,null));};exports[_0xd2f0('0x54')]=function(_0x35e2fe,_0x39eafd){return respondWithRpcPromise(_0xd2f0('0x55'),_0x35e2fe[_0xd2f0('0x18')],routingClient)['then'](respondWithResult(_0x39eafd,null))[_0xd2f0('0xf')](handleError(_0x39eafd,null));};exports['showFaxQueues']=function(_0x415727,_0x41b47a){return respondWithRpcPromise(_0xd2f0('0x55'),_0x415727['query'],routingClient)[_0xd2f0('0xa')](findById(_0x415727[_0xd2f0('0x1c')]['id']))[_0xd2f0('0xa')](respondWithResult(_0x41b47a,null))['catch'](handleError(_0x41b47a,null));};exports[_0xd2f0('0x56')]=function(_0x13dfef,_0x351086){return respondWithRpcPromise(_0xd2f0('0x57'),_0x13dfef['query'])['then'](respondWithResult(_0x351086,null))[_0xd2f0('0xf')](handleError(_0x351086,null));};exports[_0xd2f0('0x58')]=function(_0x28cc62,_0xa55732){return respondWithRpcPromise(_0xd2f0('0x59'),_0x28cc62[_0xd2f0('0x18')],routingClient)[_0xd2f0('0xa')](respondWithResult(_0xa55732,null))[_0xd2f0('0xf')](handleError(_0xa55732,null));};exports[_0xd2f0('0x5a')]=function(_0x2e9435,_0x26e2b3){return respondWithRpcPromise(_0xd2f0('0x5b'),_0x2e9435[_0xd2f0('0x18')],routingClient)[_0xd2f0('0xa')](respondWithResult(_0x26e2b3,null))['catch'](handleError(_0x26e2b3,null));};exports[_0xd2f0('0x5c')]=function(_0x3310e6,_0x5aa5e6){return respondWithRpcPromise(_0xd2f0('0x5d'),_0x3310e6[_0xd2f0('0x18')],routingClient)[_0xd2f0('0xa')](respondWithResult(_0x5aa5e6,null))['catch'](handleError(_0x5aa5e6,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x2d57b6,_0x3cee8a){return respondWithRpcPromise(_0xd2f0('0x5d'),_0x2d57b6[_0xd2f0('0x18')],routingClient)[_0xd2f0('0xa')](function(_0x5957c8){if(_0x2d57b6[_0xd2f0('0x18')][_0xd2f0('0x5e')]!==undefined){var _0x1186cb=_(_0x5957c8[_0xd2f0('0x16')])[_0xd2f0('0x5f')]([_0x2d57b6[_0xd2f0('0x18')]['type'],_0x2d57b6[_0xd2f0('0x1c')]['id']])['map'](_0xd2f0('0x60'))[_0xd2f0('0x61')]()[_0xd2f0('0x62')]();return _0x5957c8['rows'][_0xd2f0('0x5f')](function(_0x34fc06){return _0x1186cb[_0xd2f0('0x63')](_0x34fc06['queue_id'])>-0x1;});}else{return _0x5957c8[_0xd2f0('0x16')]['filter'](function(_0x258d8f){return _0x258d8f['queue_id']===parseInt(_0x2d57b6[_0xd2f0('0x1c')]['id']);});}})['then'](respondWithResult(_0x3cee8a,null))['catch'](handleError(_0x3cee8a,null));};exports[_0xd2f0('0x64')]=function(_0x59b1e3,_0x209fa5){return respondWithRpcPromise(_0xd2f0('0x65'),_0x59b1e3[_0xd2f0('0x18')],routingClient)[_0xd2f0('0xa')](respondWithResult(_0x209fa5,null))[_0xd2f0('0xf')](handleError(_0x209fa5,null));};exports[_0xd2f0('0x66')]=function(_0x5e20a3,_0x2ffae5){return respondWithRpcPromise(_0xd2f0('0x67'),_0x5e20a3[_0xd2f0('0x18')],routingClient)['then'](respondWithResult(_0x2ffae5,null))['catch'](handleError(_0x2ffae5,null));};exports[_0xd2f0('0x68')]=function(_0x556cb6,_0x3589dc){return respondWithRpcPromise(_0xd2f0('0x69'),_0x556cb6[_0xd2f0('0x18')],routingClient)['then'](respondWithResult(_0x3589dc,null))[_0xd2f0('0xf')](handleError(_0x3589dc,null));};exports[_0xd2f0('0x6a')]=function(_0x42d6c3){return function(_0x5bbc16,_0x5070e7){var _0x22bfec,_0x436ff8;var _0x142f9c=_[_0xd2f0('0x6b')](_0x42d6c3);var _0x42e628=_0x42d6c3===_0xd2f0('0x6c')?_0xd2f0('0x6d'):'Account';return db[_0x142f9c+_0xd2f0('0x6e')][_0xd2f0('0x6f')]({'raw':!![],'where':{'id':_0x5bbc16[_0xd2f0('0x1c')]['id']}})[_0xd2f0('0xa')](function(_0x137e5e){if(_['isNil'](_0x137e5e)){throw new Error(_0x142f9c+_0xd2f0('0x70'));}_0x22bfec=_0x137e5e;return db[_0x142f9c+_0xd2f0('0x71')][_0xd2f0('0x6f')]({'where':{'id':_0x5bbc16[_0xd2f0('0x2e')][_0xd2f0('0x72')]},'include':[{'model':db[_0x142f9c+_0xd2f0('0x73')],'as':_0xd2f0('0x73')},{'model':db[_0x142f9c+_0x42e628],'as':'Account'}]});})['then'](function(_0x48288f){if(_[_0xd2f0('0x15')](_0x48288f)){throw new Error(_0x142f9c+_0xd2f0('0x74'));}_0x436ff8=_0x48288f;return _0x48288f[_0xd2f0('0x75')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd2f0('0xa')](function(){var _0xb08e11={'uniqueid':_0x42d6c3+'.'+_0x436ff8['id']+'.'+_0x436ff8[_0xd2f0('0x73')]['id'],'FromUserId':_0x5bbc16[_0xd2f0('0x30')]['id'],'type':'queue'};_0xb08e11[_0x142f9c+_0xd2f0('0x76')]=_0x436ff8['id'];_0xb08e11[_0x142f9c+_0xd2f0('0x77')]=_0x436ff8[_0xd2f0('0x73')]['id'];_0xb08e11[_0xd2f0('0x78')+_0x142f9c+_0x42e628+'Id']=_0x436ff8[_0xd2f0('0x79')]['id'];_0xb08e11['To'+_0x142f9c+_0xd2f0('0x7a')]=_0x22bfec['id'];return db[_0x142f9c+'TransferReport']['create'](_0xb08e11);})[_0xd2f0('0xa')](function(){return respondWithRpcPromise(_0xd2f0('0x7b'),{'channel':_0x42d6c3,'interaction':_0x436ff8['Interaction'],'message':_0x436ff8,'account':_0x436ff8[_0xd2f0('0x79')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd2f0('0x7c'),'appdata':_0x22bfec[_0xd2f0('0x13')]+','+(_0x436ff8[_0xd2f0('0x79')][_0xd2f0('0x7d')]||0x12c),'interval':_0xd2f0('0x7e')}]},routingClient);})[_0xd2f0('0xa')](respondWithResult(_0x5070e7,null))[_0xd2f0('0xf')](handleError(_0x5070e7,null));};};exports[_0xd2f0('0x7f')]=function(_0x34a3c3,_0x4b45a5){var _0x31cb42,_0x8a3b76;if(_['isNil'](_0x34a3c3[_0xd2f0('0x2e')]['channel'])){throw new Error(_0xd2f0('0x80'));}var _0x127eb9=_0x34a3c3[_0xd2f0('0x2e')][_0xd2f0('0x81')];var _0x3f1d4e=_[_0xd2f0('0x6b')](_0x127eb9);var _0x136c77=_0x127eb9===_0xd2f0('0x6c')?_0xd2f0('0x6d'):_0xd2f0('0x79');return db[_0xd2f0('0x82')][_0xd2f0('0x6f')]({'raw':!![],'where':{'id':_0x34a3c3[_0xd2f0('0x1c')]['id'],'role':_0xd2f0('0x3b')}})[_0xd2f0('0xa')](function(_0x23bfa1){if(_['isNil'](_0x23bfa1)){throw new Error(_0xd2f0('0x83'));}_0x31cb42=_0x23bfa1;return db[_0x3f1d4e+_0xd2f0('0x71')][_0xd2f0('0x6f')]({'where':{'id':_0x34a3c3['body'][_0xd2f0('0x72')]},'include':[{'model':db[_0x3f1d4e+'Interaction'],'as':_0xd2f0('0x73')},{'model':db[_0x3f1d4e+_0x136c77],'as':_0xd2f0('0x79')}]});})[_0xd2f0('0xa')](function(_0x4e5c61){if(_['isNil'](_0x4e5c61)){throw new Error(_0x3f1d4e+_0xd2f0('0x74'));}_0x8a3b76=_0x4e5c61;return _0x4e5c61[_0xd2f0('0x75')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd2f0('0xa')](function(){var _0x37287d={'uniqueid':_0x127eb9+'.'+_0x8a3b76['id']+'.'+_0x8a3b76['Interaction']['id'],'FromUserId':_0x34a3c3[_0xd2f0('0x30')]['id'],'type':_0xd2f0('0x7c'),'ToUserId':_0x31cb42['id']};_0x37287d[_0x3f1d4e+'MessageId']=_0x8a3b76['id'];_0x37287d[_0x3f1d4e+_0xd2f0('0x77')]=_0x8a3b76[_0xd2f0('0x73')]['id'];_0x37287d['From'+_0x3f1d4e+_0x136c77+'Id']=_0x8a3b76[_0xd2f0('0x79')]['id'];return db[_0x3f1d4e+_0xd2f0('0x84')]['create'](_0x37287d);})[_0xd2f0('0xa')](function(){return respondWithRpcPromise(_0xd2f0('0x7b'),{'channel':_0x127eb9,'interaction':_0x8a3b76['Interaction'],'message':_0x8a3b76,'account':_0x8a3b76[_0xd2f0('0x79')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd2f0('0x3b'),'appdata':_0x31cb42['name']+','+(_0x8a3b76[_0xd2f0('0x79')]['agentTransferTimeout']||0x12c),'interval':_0xd2f0('0x7e')}]},routingClient);})[_0xd2f0('0xa')](respondWithResult(_0x4b45a5,null))[_0xd2f0('0xf')](handleError(_0x4b45a5,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 59c7483..3d5dbf0 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 _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 +var _0x4cd6=['index','show','/:id/run','post','create','put','/:id','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4cd6,0xbe));var _0x64cd=function(_0x28c31b,_0x1e21e1){_0x28c31b=_0x28c31b-0x0;var _0x230e48=_0x4cd6[_0x28c31b];return _0x230e48;};'use strict';var multer=require(_0x64cd('0x0'));var util=require(_0x64cd('0x1'));var path=require(_0x64cd('0x2'));var timeout=require('connect-timeout');var express=require(_0x64cd('0x3'));var router=express[_0x64cd('0x4')]();var auth=require(_0x64cd('0x5'));var interaction=require(_0x64cd('0x6'));var config=require('../../config/environment');var controller=require(_0x64cd('0x7'));router[_0x64cd('0x8')]('/',auth[_0x64cd('0x9')](),controller[_0x64cd('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x64cd('0xb')]);router[_0x64cd('0x8')](_0x64cd('0xc'),auth[_0x64cd('0x9')](),controller['run']);router[_0x64cd('0xd')]('/',auth[_0x64cd('0x9')](),controller[_0x64cd('0xe')]);router[_0x64cd('0xf')](_0x64cd('0x10'),auth[_0x64cd('0x9')](),controller['update']);router[_0x64cd('0x11')](_0x64cd('0x10'),auth[_0x64cd('0x9')](),controller[_0x64cd('0x12')]);module[_0x64cd('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 84d58d3..7c01212 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 _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 +var _0xba18=['0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','hours','minutes','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN'];(function(_0x5c43e1,_0x4c1705){var _0x397fa7=function(_0x4485e8){while(--_0x4485e8){_0x5c43e1['push'](_0x5c43e1['shift']());}};_0x397fa7(++_0x4c1705);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8ba1('0x0'));module[_0x8ba1('0x1')]={'name':{'type':Sequelize[_0x8ba1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8ba1('0x2')]},'active':{'type':Sequelize[_0x8ba1('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x8ba1('0x2')],'allowNull':![],'defaultValue':_0x8ba1('0x4')},'startAt':{'type':Sequelize[_0x8ba1('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x8ba1('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x8ba1('0x7')](_0x8ba1('0x8'),_0x8ba1('0x9'),_0x8ba1('0xa'),_0x8ba1('0xb'),'days',_0x8ba1('0xc'),_0x8ba1('0xd')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM']('csv',_0x8ba1('0xe'),_0x8ba1('0xf')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x8ba1('0x7')](_0x8ba1('0x10'),_0x8ba1('0x11')),'allowNull':![],'defaultValue':_0x8ba1('0x10')},'sendMail':{'type':Sequelize[_0x8ba1('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x8ba1('0x12')]},'bcc':{'type':Sequelize[_0x8ba1('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x8ba1('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index df23a5e..7dee26c 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 _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 +var _0xa047=['model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','length','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','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/license/util','../../mysqldb','sendStatus','status','offset','limit','Content-Range','apply','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','index','map','Schedule','type','query','keys','filters','intersection','attributes','fields'];(function(_0x535bb4,_0x4ef0c7){var _0x275848=function(_0x2f46e6){while(--_0x2f46e6){_0x535bb4['push'](_0x535bb4['shift']());}};_0x275848(++_0x4ef0c7);}(_0xa047,0xb6));var _0x7a04=function(_0x10dfdf,_0x36b623){_0x10dfdf=_0x10dfdf-0x0;var _0x4d857d=_0xa047[_0x10dfdf];return _0x4d857d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7a04('0x0'));var rimraf=require(_0x7a04('0x1'));var zipdir=require(_0x7a04('0x2'));var jsonpatch=require(_0x7a04('0x3'));var rp=require(_0x7a04('0x4'));var moment=require(_0x7a04('0x5'));var BPromise=require(_0x7a04('0x6'));var Mustache=require(_0x7a04('0x7'));var util=require(_0x7a04('0x8'));var path=require(_0x7a04('0x9'));var sox=require('sox');var csv=require(_0x7a04('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7a04('0xb'));var crypto=require('crypto');var jsforce=require(_0x7a04('0xc'));var deskjs=require(_0x7a04('0xd'));var toCsv=require(_0x7a04('0xa'));var querystring=require(_0x7a04('0xe'));var Papa=require(_0x7a04('0xf'));var Redis=require(_0x7a04('0x10'));var authService=require(_0x7a04('0x11'));var qs=require(_0x7a04('0x12'));var as=require(_0x7a04('0x13'));var hardwareService=require(_0x7a04('0x14'));var logger=require(_0x7a04('0x15'))(_0x7a04('0x16'));var utils=require(_0x7a04('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7a04('0x18'));var db=require(_0x7a04('0x19'))['db'];function respondWithStatusCode(_0x146693,_0xe34555){_0xe34555=_0xe34555||0xcc;return function(_0x4b5100){if(_0x4b5100){return _0x146693[_0x7a04('0x1a')](_0xe34555);}return _0x146693[_0x7a04('0x1b')](_0xe34555)['end']();};}function respondWithResult(_0x282507,_0x2bbaff){_0x2bbaff=_0x2bbaff||0xc8;return function(_0x3f51b4){if(_0x3f51b4){return _0x282507[_0x7a04('0x1b')](_0x2bbaff)['json'](_0x3f51b4);}};}function respondWithFilteredResult(_0x3fcd06,_0x54ec0d){return function(_0x5c768f){if(_0x5c768f){var _0x2d7f00=_0x5c768f['count'],_0x1d85e0=_0x54ec0d[_0x7a04('0x1c')],_0x5b249f=_0x54ec0d[_0x7a04('0x1c')]+_0x54ec0d[_0x7a04('0x1d')],_0x537470;if(_0x5b249f>=_0x2d7f00){_0x5b249f=_0x2d7f00;_0x537470=0xc8;}else{_0x537470=0xce;}_0x3fcd06[_0x7a04('0x1b')](_0x537470);return _0x3fcd06['set'](_0x7a04('0x1e'),_0x1d85e0+'-'+_0x5b249f+'/'+_0x2d7f00)['json'](_0x5c768f);}return null;};}function patchUpdates(_0x396151){return function(_0x2de1bd){try{jsonpatch[_0x7a04('0x1f')](_0x2de1bd,_0x396151,!![]);}catch(_0x27b730){return BPromise['reject'](_0x27b730);}return _0x2de1bd[_0x7a04('0x20')]();};}function saveUpdates(_0x23ede0,_0x412202){return function(_0x3d23f7){if(_0x3d23f7){return _0x3d23f7[_0x7a04('0x21')](_0x23ede0)[_0x7a04('0x22')](function(_0x247151){return _0x247151;});}return null;};}function removeEntity(_0x1aef65,_0x57d701){return function(_0x48ff5a){if(_0x48ff5a){return _0x48ff5a[_0x7a04('0x23')]()[_0x7a04('0x22')](function(){var _0x17f106=_0x48ff5a[_0x7a04('0x24')]({'plain':!![]});var _0x1b319b=_0x7a04('0x25');return db[_0x7a04('0x26')][_0x7a04('0x23')]({'where':{'type':_0x1b319b,'resourceId':_0x17f106['id']}})['then'](function(){return _0x48ff5a;});})[_0x7a04('0x22')](function(){_0x1aef65[_0x7a04('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe31f3,_0x40c849){return function(_0x7186d0){if(!_0x7186d0){_0xe31f3[_0x7a04('0x1a')](0x194);}return _0x7186d0;};}function handleError(_0x24bbb8,_0x550a74){_0x550a74=_0x550a74||0x1f4;return function(_0x28433b){logger[_0x7a04('0x27')](_0x28433b[_0x7a04('0x28')]);if(_0x28433b[_0x7a04('0x29')]){delete _0x28433b[_0x7a04('0x29')];}_0x24bbb8[_0x7a04('0x1b')](_0x550a74)['send'](_0x28433b);};}exports[_0x7a04('0x2a')]=function(_0x436b4f,_0x58f721){var _0x395226={},_0x23cdb7={},_0x3ff899={'count':0x0,'rows':[]};var _0x362013=_[_0x7a04('0x2b')](db[_0x7a04('0x2c')]['rawAttributes'],function(_0x19385a){return{'name':_0x19385a['fieldName'],'type':_0x19385a[_0x7a04('0x2d')]['key']};});_0x23cdb7['model']=_[_0x7a04('0x2b')](_0x362013,'name');_0x23cdb7[_0x7a04('0x2e')]=_[_0x7a04('0x2f')](_0x436b4f[_0x7a04('0x2e')]);_0x23cdb7[_0x7a04('0x30')]=_[_0x7a04('0x31')](_0x23cdb7['model'],_0x23cdb7[_0x7a04('0x2e')]);_0x395226[_0x7a04('0x32')]=_[_0x7a04('0x31')](_0x23cdb7['model'],qs[_0x7a04('0x33')](_0x436b4f[_0x7a04('0x2e')][_0x7a04('0x33')]));_0x395226[_0x7a04('0x32')]=_0x395226[_0x7a04('0x32')]['length']?_0x395226['attributes']:_0x23cdb7[_0x7a04('0x34')];if(!_0x436b4f[_0x7a04('0x2e')][_0x7a04('0x35')](_0x7a04('0x36'))){_0x395226['limit']=qs[_0x7a04('0x1d')](_0x436b4f[_0x7a04('0x2e')][_0x7a04('0x1d')]);_0x395226[_0x7a04('0x1c')]=qs[_0x7a04('0x1c')](_0x436b4f[_0x7a04('0x2e')][_0x7a04('0x1c')]);}_0x395226['order']=qs['sort'](_0x436b4f['query'][_0x7a04('0x37')]);_0x395226[_0x7a04('0x38')]=qs[_0x7a04('0x30')](_[_0x7a04('0x39')](_0x436b4f[_0x7a04('0x2e')],_0x23cdb7[_0x7a04('0x30')]),_0x362013);if(_0x436b4f['query'][_0x7a04('0x3a')]){_0x395226[_0x7a04('0x38')]=_[_0x7a04('0x3b')](_0x395226['where'],{'$or':_['map'](_0x362013,function(_0x84610d){if(_0x84610d[_0x7a04('0x2d')]!==_0x7a04('0x3c')){var _0x3cb8e5={};_0x3cb8e5[_0x84610d[_0x7a04('0x29')]]={'$like':'%'+_0x436b4f['query']['filter']+'%'};return _0x3cb8e5;}})});}_0x395226=_['merge']({},_0x395226,_0x436b4f[_0x7a04('0x3d')]);var _0x47b8d4={'where':_0x395226[_0x7a04('0x38')]};return db[_0x7a04('0x2c')]['count'](_0x47b8d4)[_0x7a04('0x22')](function(_0x1b69ee){_0x3ff899['count']=_0x1b69ee;if(_0x436b4f[_0x7a04('0x2e')][_0x7a04('0x3e')]){_0x395226[_0x7a04('0x3f')]=[{'all':!![]}];}return db['Schedule'][_0x7a04('0x40')](_0x395226);})[_0x7a04('0x22')](function(_0x3ce418){_0x3ff899['rows']=_0x3ce418;return _0x3ff899;})[_0x7a04('0x22')](respondWithFilteredResult(_0x58f721,_0x395226))['catch'](handleError(_0x58f721,null));};exports['show']=function(_0x1e8b0b,_0x134bc1){var _0x4449ec={'raw':![],'where':{'id':_0x1e8b0b['params']['id']}},_0x49321a={};_0x49321a[_0x7a04('0x34')]=_[_0x7a04('0x2f')](db['Schedule']['rawAttributes']);_0x49321a['query']=_[_0x7a04('0x2f')](_0x1e8b0b[_0x7a04('0x2e')]);_0x49321a['filters']=_[_0x7a04('0x31')](_0x49321a['model'],_0x49321a[_0x7a04('0x2e')]);_0x4449ec[_0x7a04('0x32')]=_[_0x7a04('0x31')](_0x49321a[_0x7a04('0x34')],qs[_0x7a04('0x33')](_0x1e8b0b['query'][_0x7a04('0x33')]));_0x4449ec['attributes']=_0x4449ec[_0x7a04('0x32')][_0x7a04('0x41')]?_0x4449ec[_0x7a04('0x32')]:_0x49321a[_0x7a04('0x34')];if(_0x1e8b0b[_0x7a04('0x2e')]['includeAll']){_0x4449ec[_0x7a04('0x3f')]=[{'all':!![]}];}_0x4449ec=_[_0x7a04('0x3b')]({},_0x4449ec,_0x1e8b0b[_0x7a04('0x3d')]);return db['Schedule']['find'](_0x4449ec)[_0x7a04('0x22')](handleEntityNotFound(_0x134bc1,null))[_0x7a04('0x22')](respondWithResult(_0x134bc1,null))[_0x7a04('0x42')](handleError(_0x134bc1,null));};exports['create']=function(_0x2aa08e,_0x41af5b){return db[_0x7a04('0x2c')][_0x7a04('0x43')](_0x2aa08e[_0x7a04('0x44')],{})[_0x7a04('0x22')](function(_0x49743a){var _0x4d18cc=_0x2aa08e['user'][_0x7a04('0x24')]({'plain':!![]});if(!_0x4d18cc)throw new Error(_0x7a04('0x45'));if(_0x4d18cc['role']===_0x7a04('0x46')){var _0x102248=_0x49743a[_0x7a04('0x24')]({'plain':!![]});var _0x5de468=_0x7a04('0x25');return db[_0x7a04('0x47')][_0x7a04('0x48')]({'where':{'name':_0x5de468,'userProfileId':_0x4d18cc['userProfileId']},'raw':!![]})[_0x7a04('0x22')](function(_0x4d4d21){if(_0x4d4d21&&_0x4d4d21[_0x7a04('0x49')]===0x0){return db[_0x7a04('0x26')][_0x7a04('0x43')]({'name':_0x102248[_0x7a04('0x29')],'resourceId':_0x102248['id'],'type':_0x4d4d21[_0x7a04('0x29')],'sectionId':_0x4d4d21['id']},{})['then'](function(){return _0x49743a;});}else{return _0x49743a;}})[_0x7a04('0x42')](function(_0x1311c6){logger[_0x7a04('0x27')](_0x7a04('0x4a'),_0x1311c6);throw _0x1311c6;});}return _0x49743a;})[_0x7a04('0x22')](respondWithResult(_0x41af5b,0xc9))[_0x7a04('0x42')](handleError(_0x41af5b,null));};exports[_0x7a04('0x21')]=function(_0x482080,_0x13118c){if(_0x482080[_0x7a04('0x44')]['id']){delete _0x482080['body']['id'];}return db[_0x7a04('0x2c')][_0x7a04('0x48')]({'where':{'id':_0x482080[_0x7a04('0x4b')]['id']}})[_0x7a04('0x22')](handleEntityNotFound(_0x13118c,null))[_0x7a04('0x22')](saveUpdates(_0x482080[_0x7a04('0x44')],null))[_0x7a04('0x22')](respondWithResult(_0x13118c,null))['catch'](handleError(_0x13118c,null));};exports['destroy']=function(_0x456605,_0x74fe8a){return db[_0x7a04('0x2c')]['find']({'where':{'id':_0x456605[_0x7a04('0x4b')]['id']}})[_0x7a04('0x22')](handleEntityNotFound(_0x74fe8a,null))[_0x7a04('0x22')](removeEntity(_0x74fe8a,null))[_0x7a04('0x42')](handleError(_0x74fe8a,null));};exports[_0x7a04('0x4c')]=function(_0x34769d,_0x8facbe,_0x2ff4f8){var _0x29242e=require(_0x7a04('0x4d'));return db[_0x7a04('0x2c')]['find']({'where':{'id':_0x34769d['params']['id']},'raw':!![]})[_0x7a04('0x22')](handleEntityNotFound(_0x8facbe,null))['then'](function(){_0x29242e[_0x7a04('0x4c')](_0x34769d[_0x7a04('0x4b')]['id']);})[_0x7a04('0x22')](respondWithStatusCode(_0x8facbe,null))['catch'](handleError(_0x8facbe,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index a278aaf..6e31cef 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 _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 +var _0xe686=['tools_schedules','moment','bluebird','request-promise','path','rimraf','./schedule.attributes','exports','define','Schedule'];(function(_0x3f4c67,_0x1a5f87){var _0x5c3777=function(_0x5b9906){while(--_0x5b9906){_0x3f4c67['push'](_0x3f4c67['shift']());}};_0x5c3777(++_0x1a5f87);}(_0xe686,0xbf));var _0x6e68=function(_0x7627e2,_0xbf2007){_0x7627e2=_0x7627e2-0x0;var _0x1442ac=_0xe686[_0x7627e2];return _0x1442ac;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6e68('0x0'));var BPromise=require(_0x6e68('0x1'));var rp=require(_0x6e68('0x2'));var fs=require('fs');var path=require(_0x6e68('0x3'));var rimraf=require(_0x6e68('0x4'));var config=require('../../config/environment');var attributes=require(_0x6e68('0x5'));module[_0x6e68('0x6')]=function(_0x146368,_0x27809d){return _0x146368[_0x6e68('0x7')](_0x6e68('0x8'),attributes,{'tableName':_0x6e68('0x9'),'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 fe28dda..4fde2b3 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 _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 +var _0xfc57=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0xdb357c,_0x3786b6){var _0x5c8735=function(_0x2e179c){while(--_0x2e179c){_0xdb357c['push'](_0xdb357c['shift']());}};_0x5c8735(++_0x3786b6);}(_0xfc57,0x108));var _0x7fc5=function(_0x5e9d70,_0x37d7a1){_0x5e9d70=_0x5e9d70-0x0;var _0x415475=_0xfc57[_0x5e9d70];return _0x415475;};'use strict';var _=require(_0x7fc5('0x0'));var util=require(_0x7fc5('0x1'));var moment=require('moment');var BPromise=require(_0x7fc5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7fc5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7fc5('0x4'));var logger=require(_0x7fc5('0x5'))(_0x7fc5('0x6'));var config=require(_0x7fc5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7fc5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2123c5,_0x5bc564,_0x5545c6){return new BPromise(function(_0x533099,_0x45c14f){return client['request'](_0x2123c5,_0x5545c6)['then'](function(_0x54ed9b){logger['info'](_0x7fc5('0x9'),_0x5bc564,_0x7fc5('0xa'));logger[_0x7fc5('0xb')](_0x7fc5('0xc'),_0x5bc564,_0x7fc5('0xa'),JSON[_0x7fc5('0xd')](_0x54ed9b));if(_0x54ed9b['error']){if(_0x54ed9b[_0x7fc5('0xe')][_0x7fc5('0xf')]===0x1f4){logger[_0x7fc5('0xe')](_0x7fc5('0x9'),_0x5bc564,_0x54ed9b['error'][_0x7fc5('0x10')]);return _0x45c14f(_0x54ed9b['error'][_0x7fc5('0x10')]);}logger[_0x7fc5('0xe')]('Schedule,\x20%s,\x20%s',_0x5bc564,_0x54ed9b[_0x7fc5('0xe')][_0x7fc5('0x10')]);return _0x533099(_0x54ed9b[_0x7fc5('0xe')][_0x7fc5('0x10')]);}else{logger['info'](_0x7fc5('0x9'),_0x5bc564,_0x7fc5('0xa'));_0x533099(_0x54ed9b[_0x7fc5('0x11')][_0x7fc5('0x10')]);}})[_0x7fc5('0x12')](function(_0x5e81f8){logger[_0x7fc5('0xe')](_0x7fc5('0x9'),_0x5bc564,_0x5e81f8);_0x45c14f(_0x5e81f8);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index c123e35..73489cb 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 _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 +var _0x81d6=['Router','../../components/auth/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','create','put','delete','exports','util','path','express'];(function(_0x466bfd,_0x56f4bb){var _0x29293d=function(_0x47298b){while(--_0x47298b){_0x466bfd['push'](_0x466bfd['shift']());}};_0x29293d(++_0x56f4bb);}(_0x81d6,0x95));var _0x681d=function(_0x414b2d,_0x5785d9){_0x414b2d=_0x414b2d-0x0;var _0xb6333f=_0x81d6[_0x414b2d];return _0xb6333f;};'use strict';var multer=require('multer');var util=require(_0x681d('0x0'));var path=require(_0x681d('0x1'));var timeout=require('connect-timeout');var express=require(_0x681d('0x2'));var router=express[_0x681d('0x3')]();var auth=require(_0x681d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x681d('0x5'));var controller=require(_0x681d('0x6'));router[_0x681d('0x7')]('/',auth[_0x681d('0x8')](),controller[_0x681d('0x9')]);router[_0x681d('0x7')](_0x681d('0xa'),auth[_0x681d('0x8')](),controller[_0x681d('0xb')]);router[_0x681d('0x7')](_0x681d('0xc'),auth[_0x681d('0x8')](),controller[_0x681d('0xd')]);router[_0x681d('0x7')]('/:id/download',auth[_0x681d('0x8')](),controller[_0x681d('0xe')]);router['post']('/',auth[_0x681d('0x8')](),controller[_0x681d('0xf')]);router[_0x681d('0x10')](_0x681d('0xc'),auth[_0x681d('0x8')](),controller['update']);router[_0x681d('0x11')](_0x681d('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x681d('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index f498e70..eef7755 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 _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 +var _0x5636=['format','MM-DD-YYYY\x20HH:mm','toString','closedAt','createdAt','updatedAt','sequelize','moment','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','subtract','DATE','startedAt'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5636,0x102));var _0x6563=function(_0x59c3ba,_0x15b023){_0x59c3ba=_0x59c3ba-0x0;var _0x277993=_0x5636[_0x59c3ba];return _0x277993;};'use strict';var Sequelize=require(_0x6563('0x0'));var moment=require(_0x6563('0x1'));var path=require('path');var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x6563('0x2')],'get':function(){return this[_0x6563('0x3')](_0x6563('0x4'))?path['extname'](this[_0x6563('0x3')](_0x6563('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x6563('0x5')]},'channel':{'type':Sequelize[_0x6563('0x5')]},'value':{'type':Sequelize[_0x6563('0x5')],'set':function(_0x193942){var _0x9884a9=_0x193942[_0x6563('0x6')](/\\/g,'/');this[_0x6563('0x7')](_0x6563('0x4'),_0x9884a9);}},'rating':{'type':Sequelize[_0x6563('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x6563('0x8')],'set':function(_0x3ccb4e){this['setDataValue']('startedAt',moment()[_0x6563('0x9')](_0x3ccb4e,'ms'));this[_0x6563('0x7')]('closedAt',moment());this['setDataValue']('duration',_0x3ccb4e);}},'startedAt':{'type':Sequelize[_0x6563('0xa')],'get':function(){return moment(this[_0x6563('0x3')](_0x6563('0xb')))[_0x6563('0xc')](_0x6563('0xd'))[_0x6563('0xe')]();}},'closedAt':{'type':Sequelize[_0x6563('0xa')],'get':function(){return moment(this[_0x6563('0x3')](_0x6563('0xf')))['format'](_0x6563('0xd'))['toString']();}},'createdAt':{'type':Sequelize[_0x6563('0xa')],'get':function(){return moment(this[_0x6563('0x3')](_0x6563('0x10')))[_0x6563('0xc')]('MM-DD-YYYY\x20HH:mm')[_0x6563('0xe')]();}},'updatedAt':{'type':Sequelize[_0x6563('0xa')],'get':function(){return moment(this[_0x6563('0x3')](_0x6563('0x11')))['format'](_0x6563('0xd'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index e5331a4..193e1ff 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 _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 +var _0x9e46=['sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','type','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','decryptFile','recording','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','end','status','json','count','offset','set','apply','save','update','then','destroy','error','name','send','index','ScreenRecording','rawAttributes','model','differenceBy','map','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0x29c750,_0x224fcc){var _0x2dfcab=function(_0x4238f6){while(--_0x4238f6){_0x29c750['push'](_0x29c750['shift']());}};_0x2dfcab(++_0x224fcc);}(_0x9e46,0x94));var _0x69e4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9e46[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require(_0x69e4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x69e4('0x1'));var zipdir=require(_0x69e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x69e4('0x3'));var moment=require(_0x69e4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x69e4('0x5'));var util=require(_0x69e4('0x6'));var path=require(_0x69e4('0x7'));var sox=require(_0x69e4('0x8'));var csv=require(_0x69e4('0x9'));var ejs=require(_0x69e4('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x69e4('0xb'));var crypto=require(_0x69e4('0xc'));var jsforce=require(_0x69e4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x69e4('0x9'));var querystring=require(_0x69e4('0xe'));var Papa=require(_0x69e4('0xf'));var Redis=require(_0x69e4('0x10'));var authService=require(_0x69e4('0x11'));var qs=require(_0x69e4('0x12'));var as=require(_0x69e4('0x13'));var hardwareService=require(_0x69e4('0x14'));var logger=require(_0x69e4('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x69e4('0x16'))['db'];function respondWithStatusCode(_0x472c81,_0xafff1f){_0xafff1f=_0xafff1f||0xcc;return function(_0x5513b4){if(_0x5513b4){return _0x472c81[_0x69e4('0x17')](_0xafff1f);}return _0x472c81['status'](_0xafff1f)[_0x69e4('0x18')]();};}function respondWithResult(_0x16bfae,_0x407e39){_0x407e39=_0x407e39||0xc8;return function(_0x4b54fc){if(_0x4b54fc){return _0x16bfae[_0x69e4('0x19')](_0x407e39)[_0x69e4('0x1a')](_0x4b54fc);}};}function respondWithFilteredResult(_0x1bc316,_0x4bd058){return function(_0x1b76c7){if(_0x1b76c7){var _0x1097cd=_0x1b76c7[_0x69e4('0x1b')],_0x4822e7=_0x4bd058[_0x69e4('0x1c')],_0xadb8a2=_0x4bd058[_0x69e4('0x1c')]+_0x4bd058['limit'],_0x63b84;if(_0xadb8a2>=_0x1097cd){_0xadb8a2=_0x1097cd;_0x63b84=0xc8;}else{_0x63b84=0xce;}_0x1bc316[_0x69e4('0x19')](_0x63b84);return _0x1bc316[_0x69e4('0x1d')]('Content-Range',_0x4822e7+'-'+_0xadb8a2+'/'+_0x1097cd)[_0x69e4('0x1a')](_0x1b76c7);}return null;};}function patchUpdates(_0x1361bb){return function(_0x1fe64b){try{jsonpatch[_0x69e4('0x1e')](_0x1fe64b,_0x1361bb,!![]);}catch(_0x11453f){return BPromise['reject'](_0x11453f);}return _0x1fe64b[_0x69e4('0x1f')]();};}function saveUpdates(_0x14381d,_0x7f5e0a){return function(_0x3be0f4){if(_0x3be0f4){return _0x3be0f4[_0x69e4('0x20')](_0x14381d)[_0x69e4('0x21')](function(_0xc4228d){return _0xc4228d;});}return null;};}function removeEntity(_0x3a2d5b,_0x11877e){return function(_0x2672f6){if(_0x2672f6){return _0x2672f6[_0x69e4('0x22')]()[_0x69e4('0x21')](function(){_0x3a2d5b[_0x69e4('0x19')](0xcc)[_0x69e4('0x18')]();});}};}function handleEntityNotFound(_0x3bb2e7,_0x5a3d05){return function(_0x25cb9b){if(!_0x25cb9b){_0x3bb2e7[_0x69e4('0x17')](0x194);}return _0x25cb9b;};}function handleError(_0x349f37,_0x160fe6){_0x160fe6=_0x160fe6||0x1f4;return function(_0x2f1962){logger[_0x69e4('0x23')](_0x2f1962['stack']);if(_0x2f1962[_0x69e4('0x24')]){delete _0x2f1962['name'];}_0x349f37[_0x69e4('0x19')](_0x160fe6)[_0x69e4('0x25')](_0x2f1962);};}exports[_0x69e4('0x26')]=function(_0x133fea,_0x389ac1){var _0x416371={},_0xe2b2a7={},_0x1c462c={'count':0x0,'rows':[]};var _0x5d2525=_['map'](db[_0x69e4('0x27')][_0x69e4('0x28')],function(_0x5eb629){return{'name':_0x5eb629['fieldName'],'type':_0x5eb629['type']['key']};});_0xe2b2a7[_0x69e4('0x29')]=_[_0x69e4('0x2a')](_[_0x69e4('0x2b')](_0x5d2525,_0x69e4('0x24')),[_0x69e4('0x2c')]);_0xe2b2a7[_0x69e4('0x2d')]=_[_0x69e4('0x2e')](_0x133fea[_0x69e4('0x2d')]);_0xe2b2a7[_0x69e4('0x2f')]=_[_0x69e4('0x30')](_0xe2b2a7[_0x69e4('0x29')],_0xe2b2a7[_0x69e4('0x2d')]);_0x416371[_0x69e4('0x31')]=_[_0x69e4('0x30')](_0xe2b2a7['model'],qs['fields'](_0x133fea[_0x69e4('0x2d')][_0x69e4('0x32')]));_0x416371[_0x69e4('0x31')]=_0x416371[_0x69e4('0x31')][_0x69e4('0x33')]?_0x416371[_0x69e4('0x31')]:_0xe2b2a7['model'];if(!_0x133fea['query'][_0x69e4('0x34')](_0x69e4('0x35'))){_0x416371[_0x69e4('0x36')]=qs[_0x69e4('0x36')](_0x133fea[_0x69e4('0x2d')]['limit']);_0x416371['offset']=qs[_0x69e4('0x1c')](_0x133fea[_0x69e4('0x2d')]['offset']);}_0x416371[_0x69e4('0x37')]=qs[_0x69e4('0x38')](_0x133fea[_0x69e4('0x2d')][_0x69e4('0x38')]);_0x416371[_0x69e4('0x39')]=qs['filters'](_['pick'](_0x133fea[_0x69e4('0x2d')],_0xe2b2a7['filters']),_0x5d2525);if(_0x133fea[_0x69e4('0x2d')][_0x69e4('0x3a')]){_0x416371[_0x69e4('0x39')]=_[_0x69e4('0x3b')](_0x416371[_0x69e4('0x39')],{'$or':_[_0x69e4('0x2b')](_0x5d2525,function(_0x1b229b){if(_0x1b229b['type']!=='VIRTUAL'){var _0x145752={};_0x145752[_0x1b229b[_0x69e4('0x24')]]={'$like':'%'+_0x133fea['query'][_0x69e4('0x3a')]+'%'};return _0x145752;}})});}_0x416371=_[_0x69e4('0x3b')]({},_0x416371,_0x133fea[_0x69e4('0x3c')]);var _0x2fbf5f={'where':_0x416371[_0x69e4('0x39')]};return db[_0x69e4('0x27')][_0x69e4('0x1b')](_0x2fbf5f)[_0x69e4('0x21')](function(_0x47be80){_0x1c462c[_0x69e4('0x1b')]=_0x47be80;if(_0x133fea[_0x69e4('0x2d')][_0x69e4('0x3d')]){_0x416371[_0x69e4('0x3e')]=[{'all':!![]}];}return db[_0x69e4('0x27')][_0x69e4('0x3f')](_0x416371);})[_0x69e4('0x21')](function(_0x317b5e){_0x1c462c[_0x69e4('0x40')]=_0x317b5e;return _0x1c462c;})['then'](respondWithFilteredResult(_0x389ac1,_0x416371))[_0x69e4('0x41')](handleError(_0x389ac1,null));};exports[_0x69e4('0x42')]=function(_0x379b98,_0x1cde2b){var _0x2052c7={'raw':![],'where':{'id':_0x379b98[_0x69e4('0x43')]['id']}},_0x13c1dd={};_0x13c1dd[_0x69e4('0x29')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x13c1dd['query']=_['keys'](_0x379b98[_0x69e4('0x2d')]);_0x13c1dd[_0x69e4('0x2f')]=_[_0x69e4('0x30')](_0x13c1dd[_0x69e4('0x29')],_0x13c1dd[_0x69e4('0x2d')]);_0x2052c7[_0x69e4('0x31')]=_[_0x69e4('0x30')](_0x13c1dd['model'],qs[_0x69e4('0x32')](_0x379b98[_0x69e4('0x2d')][_0x69e4('0x32')]));_0x2052c7['attributes']=_0x2052c7[_0x69e4('0x31')][_0x69e4('0x33')]?_0x2052c7[_0x69e4('0x31')]:_0x13c1dd[_0x69e4('0x29')];if(_0x379b98[_0x69e4('0x2d')]['includeAll']){_0x2052c7[_0x69e4('0x3e')]=[{'all':!![]}];}_0x2052c7=_[_0x69e4('0x3b')]({},_0x2052c7,_0x379b98['options']);return db['ScreenRecording'][_0x69e4('0x44')](_0x2052c7)[_0x69e4('0x21')](handleEntityNotFound(_0x1cde2b,null))[_0x69e4('0x21')](respondWithResult(_0x1cde2b,null))['catch'](handleError(_0x1cde2b,null));};exports['create']=function(_0x1d49d9,_0x5f5318){return db['ScreenRecording'][_0x69e4('0x45')](_0x1d49d9[_0x69e4('0x46')],{})[_0x69e4('0x21')](respondWithResult(_0x5f5318,0xc9))[_0x69e4('0x41')](handleError(_0x5f5318,null));};exports[_0x69e4('0x20')]=function(_0x3db331,_0x4786d2){if(_0x3db331[_0x69e4('0x46')]['id']){delete _0x3db331[_0x69e4('0x46')]['id'];}delete _0x3db331['body'][_0x69e4('0x47')];delete _0x3db331[_0x69e4('0x46')][_0x69e4('0x48')];delete _0x3db331[_0x69e4('0x46')][_0x69e4('0x49')];delete _0x3db331[_0x69e4('0x46')]['value'];return db['ScreenRecording']['find']({'where':{'id':_0x3db331[_0x69e4('0x43')]['id']}})['then'](handleEntityNotFound(_0x4786d2,null))[_0x69e4('0x21')](saveUpdates(_0x3db331[_0x69e4('0x46')],null))[_0x69e4('0x21')](respondWithResult(_0x4786d2,null))[_0x69e4('0x41')](handleError(_0x4786d2,null));};exports[_0x69e4('0x4a')]=function(_0x329f72,_0x42c1c0){return db[_0x69e4('0x27')][_0x69e4('0x4a')]()[_0x69e4('0x21')](respondWithResult(_0x42c1c0,null))[_0x69e4('0x41')](handleError(_0x42c1c0,null));};exports[_0x69e4('0x4b')]=function(_0x1b89f5,_0xaed9d,_0x480c81){var _0x51a80d=require(_0x69e4('0x4c'));var _0x395370=![];var _0x2bc48b={};if(_0x1b89f5['query'][_0x69e4('0x4d')]&&_0x1b89f5['query'][_0x69e4('0x4d')]===_0x69e4('0x4e')){_0x2bc48b[_0x69e4('0x4e')]=_0x1b89f5[_0x69e4('0x43')]['id'];}else{_0x2bc48b['id']=_0x1b89f5['params']['id'];}return db[_0x69e4('0x27')][_0x69e4('0x44')]({'where':_0x2bc48b,'attributes':['id',_0x69e4('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0xaed9d,null))[_0x69e4('0x21')](function(_0x42a38c){if(_0x42a38c){var _0xe15bf6=path[_0x69e4('0x50')](config[_0x69e4('0x51')],_0x69e4('0x52'),_0x42a38c[_0x69e4('0x4f')]);var _0x518245=util[_0x69e4('0x2c')](_0x69e4('0x53'),_0xe15bf6);if(fs['existsSync'](_0x518245)){_0x395370=!![];return _0x51a80d[_0x69e4('0x54')](_0x518245,_0xe15bf6,config['secrets'][_0x69e4('0x55')])['then'](function(){return _0x42a38c;});}return _0x42a38c;}})[_0x69e4('0x21')](function(_0x48b904){if(_0x48b904){var _0x5c313a=path[_0x69e4('0x50')](config[_0x69e4('0x51')],_0x69e4('0x52'),_0x48b904[_0x69e4('0x4f')]);if(!fs[_0x69e4('0x56')](_0x5c313a)){throw new db[(_0x69e4('0x57'))][(_0x69e4('0x58'))](_0x69e4('0x59'));}if(_0x48b904['filename']){return _0xaed9d['download'](_0x5c313a,_0x48b904[_0x69e4('0x5a')]+path[_0x69e4('0x5b')](_0x5c313a),function(){if(_0x395370){fs[_0x69e4('0x5c')](_0x5c313a);}});}else{return _0xaed9d[_0x69e4('0x4b')](_0x5c313a,function(_0x21a415){if(_0x395370){fs[_0x69e4('0x5c')](_0x5c313a);}});}}})[_0x69e4('0x41')](function(_0x4b63ed){if(_0x4b63ed[_0x69e4('0x5d')]===_0x69e4('0x59')){_0xaed9d['status'](0x194)['send'](_0x69e4('0x5e'));}else{return handleError(_0xaed9d,null);}});};exports[_0x69e4('0x22')]=function(_0x3d5907,_0xde4066){return db['ScreenRecording'][_0x69e4('0x44')]({'where':{'id':_0x3d5907[_0x69e4('0x43')]['id']}})[_0x69e4('0x21')](function(_0x23781b){if(!_0x23781b)throw new ReferenceError(_0x69e4('0x5f'));return _0x23781b;})[_0x69e4('0x21')](function(_0x1ff06a){var _0x1c97ba=path[_0x69e4('0x50')](config['root'],'server/files/screen_recordings',_0x1ff06a[_0x69e4('0x4f')]);logger[_0x69e4('0x60')]('cancellazione\x20fisica\x20documento\x20%s',_0x1c97ba);if(!_[_0x69e4('0x61')](_0x1ff06a[_0x69e4('0x4f')])&&fs[_0x69e4('0x56')](_0x1c97ba)){logger[_0x69e4('0x60')](_0x69e4('0x62')+_0x1c97ba+_0x69e4('0x63'));fs[_0x69e4('0x64')](_0x1c97ba);}_0x1c97ba=_0x1c97ba+_0x69e4('0x65');if(!_[_0x69e4('0x61')](_0x1ff06a[_0x69e4('0x4f')])&&fs[_0x69e4('0x56')](_0x1c97ba)){logger[_0x69e4('0x60')](_0x69e4('0x62')+_0x1c97ba+_0x69e4('0x63'));fs[_0x69e4('0x64')](_0x1c97ba);}return _0x1ff06a;})['then'](function(_0x334b5b){if(!_0x334b5b)throw new InternalError();return _0x334b5b['destroy']();})[_0x69e4('0x21')](function(){_0xde4066[_0x69e4('0x19')](0xcc)[_0x69e4('0x18')]();})[_0x69e4('0x41')](handleError(_0xde4066,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index c1de40a..84a4626 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 _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 +var _0x8348=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x8348,0xd2));var _0x8834=function(_0x3a616d,_0x30411f){_0x3a616d=_0x3a616d-0x0;var _0x135212=_0x8348[_0x3a616d];return _0x135212;};'use strict';var _=require(_0x8834('0x0'));var util=require(_0x8834('0x1'));var logger=require(_0x8834('0x2'))(_0x8834('0x3'));var moment=require(_0x8834('0x4'));var BPromise=require(_0x8834('0x5'));var rp=require(_0x8834('0x6'));var fs=require('fs');var path=require(_0x8834('0x7'));var rimraf=require(_0x8834('0x8'));var config=require(_0x8834('0x9'));var attributes=require(_0x8834('0xa'));module[_0x8834('0xb')]=function(_0x216835,_0x3dad75){return _0x216835['define'](_0x8834('0xc'),attributes,{'tableName':_0x8834('0xd'),'paranoid':![],'indexes':[{'name':_0x8834('0xe'),'fields':[_0x8834('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 7be8812..2d8f57d 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(_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 +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(_0x3c4fb5,_0x5b39b4){var _0xf484c6=function(_0x3e7d34){while(--_0x3e7d34){_0x3c4fb5['push'](_0x3c4fb5['shift']());}};_0xf484c6(++_0x5b39b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 0de2f2a..933dac3 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 _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 +var _0x4b20=['preferred','/:id/favicon','addFavicon','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','getDate','/:id','show','getLogo','/:id/logo_login','/:id/gdpr','/:id/preferred','getFavicon','diskStorage','join','root','format','logo','extname','originalname','post','single','file','addLogo','server/files/images/logos/','%s%s','logologin','addLogoLogin'];(function(_0x58a485,_0x49f1ff){var _0x26cb5c=function(_0x2a6397){while(--_0x2a6397){_0x58a485['push'](_0x58a485['shift']());}};_0x26cb5c(++_0x49f1ff);}(_0x4b20,0xd2));var _0x04b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b20[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x04b2('0x0'));var util=require(_0x04b2('0x1'));var path=require(_0x04b2('0x2'));var timeout=require(_0x04b2('0x3'));var express=require(_0x04b2('0x4'));var router=express[_0x04b2('0x5')]();var auth=require(_0x04b2('0x6'));var interaction=require(_0x04b2('0x7'));var config=require(_0x04b2('0x8'));var controller=require(_0x04b2('0x9'));router['get']('/',auth[_0x04b2('0xa')](),controller[_0x04b2('0xb')]);router[_0x04b2('0xc')]('/now',controller[_0x04b2('0xd')]);router[_0x04b2('0xc')](_0x04b2('0xe'),controller[_0x04b2('0xf')]);router['get']('/:id/logo',controller[_0x04b2('0x10')]);router['get'](_0x04b2('0x11'),controller['getLogoLogin']);router[_0x04b2('0xc')](_0x04b2('0x12'),controller['gdpr']);router[_0x04b2('0xc')](_0x04b2('0x13'),controller['getPreferred']);router[_0x04b2('0xc')]('/:id/favicon',controller[_0x04b2('0x14')]);var upload=multer({'storage':multer[_0x04b2('0x15')]({'destination':function(_0x62a317,_0x2fbb2b,_0x344ee6){_0x344ee6(null,path[_0x04b2('0x16')](config[_0x04b2('0x17')],'server/files/images/logos/'));},'filename':function(_0x59a5f1,_0x329796,_0x3df5eb){_0x3df5eb(null,util[_0x04b2('0x18')]('%s%s',_0x04b2('0x19'),path[_0x04b2('0x1a')](_0x329796[_0x04b2('0x1b')])));}})});router[_0x04b2('0x1c')]('/:id/logo',upload[_0x04b2('0x1d')](_0x04b2('0x1e')),controller[_0x04b2('0x1f')]);var upload=multer({'storage':multer[_0x04b2('0x15')]({'destination':function(_0x5c5c17,_0x21305d,_0x29d9dd){_0x29d9dd(null,path[_0x04b2('0x16')](config[_0x04b2('0x17')],_0x04b2('0x20')));},'filename':function(_0x1545d0,_0x597be4,_0x43390){_0x43390(null,util[_0x04b2('0x18')](_0x04b2('0x21'),_0x04b2('0x22'),path['extname'](_0x597be4[_0x04b2('0x1b')])));}})});router[_0x04b2('0x1c')]('/:id/logo_login',upload[_0x04b2('0x1d')](_0x04b2('0x1e')),controller[_0x04b2('0x23')]);var upload=multer({'storage':multer[_0x04b2('0x15')]({'destination':function(_0x12e83a,_0x425866,_0x1664f0){_0x1664f0(null,path[_0x04b2('0x16')](config[_0x04b2('0x17')],_0x04b2('0x20')));},'filename':function(_0x2c33ee,_0x277eb7,_0x3da81f){_0x3da81f(null,util[_0x04b2('0x18')]('%s%s',_0x04b2('0x24'),path[_0x04b2('0x1a')](_0x277eb7[_0x04b2('0x1b')])));}})});router[_0x04b2('0x1c')](_0x04b2('0x13'),upload[_0x04b2('0x1d')](_0x04b2('0x1e')),controller['addPreferred']);var upload=multer({'storage':multer[_0x04b2('0x15')]({'destination':function(_0x423e3f,_0x42b957,_0x9868b5){_0x9868b5(null,path[_0x04b2('0x16')](config[_0x04b2('0x17')],_0x04b2('0x20')));},'filename':function(_0x2e610f,_0xbd286f,_0x4d76f7){_0x4d76f7(null,util[_0x04b2('0x18')]('%s%s','favicon',path[_0x04b2('0x1a')](_0xbd286f[_0x04b2('0x1b')])));}})});router[_0x04b2('0x1c')](_0x04b2('0x25'),upload['single'](_0x04b2('0x1e')),controller[_0x04b2('0x26')]);router[_0x04b2('0x27')](_0x04b2('0xe'),auth[_0x04b2('0xa')](),controller[_0x04b2('0x28')]);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 7f958b6..74e7aee 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 _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 +var _0x2e88=['UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate'];(function(_0x278d5b,_0x21571d){var _0x340019=function(_0x378e84){while(--_0x378e84){_0x278d5b['push'](_0x278d5b['shift']());}};_0x340019(++_0x21571d);}(_0x2e88,0xc7));var _0x82e8=function(_0x14d896,_0x53578b){_0x14d896=_0x14d896-0x0;var _0x28679a=_0x2e88[_0x14d896];return _0x28679a;};'use strict';var Sequelize=require(_0x82e8('0x0'));module[_0x82e8('0x1')]={'min_internal':{'type':Sequelize[_0x82e8('0x2')](0xb),'unique':_0x82e8('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x82e8('0x2')](0xb),'unique':_0x82e8('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x82e8('0x5')],'defaultValue':_0x82e8('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x82e8('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x82e8('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x82e8('0x5')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x82e8('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x82e8('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x82e8('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x82e8('0x5')],'defaultValue':_0x82e8('0x8')},'enableEmailPreview':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x82e8('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x82e8('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x82e8('0x5')],'defaultValue':_0x82e8('0x9')},'chatTimeout':{'type':Sequelize[_0x82e8('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x82e8('0x5')]},'defaultPreferred':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x82e8('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x82e8('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x82e8('0x5')]},'defaultFavicon':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x82e8('0x5')]},'language':{'type':Sequelize[_0x82e8('0x5')]},'bucket':{'type':Sequelize[_0x82e8('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x82e8('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x82e8('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x82e8('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x82e8('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x82e8('0x2')],'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 2ca600d..47b3dc0 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 _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 +var _0xaeed=['VIRTUAL','options','count','include','findAll','rows','catch','show','rawAttributes','includeAll','update','body','find','addLogo','file','filename','logo','params','addLogoLogin','loginLogo','getLicense','preferred','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','upperFirst','existsSync','\x20not\x20found','server/files/images/logos','favicon','defaultLogo','default_loginLogo.svg','custom','ValidationError','download','gdpr','securePassword','default_preferred.png','Sequelize','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','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','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','Setting,\x20%s,\x20%s','message','result','status','end','json','offset','limit','set','Content-Range','reject','sendStatus','stack','name','send','index','map','Setting','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','merge'];(function(_0x2662ea,_0x47d321){var _0x135667=function(_0x5ab470){while(--_0x5ab470){_0x2662ea['push'](_0x2662ea['shift']());}};_0x135667(++_0x47d321);}(_0xaeed,0x1a5));var _0xdaee=function(_0x1223d6,_0x51863a){_0x1223d6=_0x1223d6-0x0;var _0x2cc448=_0xaeed[_0x1223d6];return _0x2cc448;};'use strict';var pdf=require(_0xdaee('0x0'));var emlformat=require(_0xdaee('0x1'));var rimraf=require(_0xdaee('0x2'));var zipdir=require(_0xdaee('0x3'));var jsonpatch=require(_0xdaee('0x4'));var rp=require(_0xdaee('0x5'));var moment=require(_0xdaee('0x6'));var BPromise=require(_0xdaee('0x7'));var Mustache=require(_0xdaee('0x8'));var util=require('util');var path=require(_0xdaee('0x9'));var sox=require(_0xdaee('0xa'));var csv=require(_0xdaee('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xdaee('0xc'));var crypto=require('crypto');var jsforce=require(_0xdaee('0xd'));var deskjs=require(_0xdaee('0xe'));var toCsv=require(_0xdaee('0xb'));var querystring=require(_0xdaee('0xf'));var Papa=require(_0xdaee('0x10'));var Redis=require(_0xdaee('0x11'));var authService=require(_0xdaee('0x12'));var qs=require(_0xdaee('0x13'));var as=require(_0xdaee('0x14'));var hardwareService=require(_0xdaee('0x15'));var logger=require('../../config/logger')(_0xdaee('0x16'));var utils=require(_0xdaee('0x17'));var config=require(_0xdaee('0x18'));var licenseUtil=require(_0xdaee('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xdaee('0x1a'));var client=jayson['client'][_0xdaee('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3ac7f2,_0x3cd7d6,_0x530394,_0x4c3fde){return new BPromise(function(_0x5e54c0,_0x6e040){var _0x2edb49=_0x4c3fde||client;return _0x2edb49[_0xdaee('0x1c')](_0x3ac7f2,_0x530394)[_0xdaee('0x1d')](function(_0x1f5865){logger[_0xdaee('0x1e')]('Setting,\x20%s,\x20%s',_0x3cd7d6,_0xdaee('0x1f'));logger[_0xdaee('0x20')]('Setting,\x20%s,\x20%s,\x20%s',_0x3cd7d6,_0xdaee('0x1f'),JSON[_0xdaee('0x21')](_0x1f5865));if(_0x1f5865[_0xdaee('0x22')]){if(_0x1f5865[_0xdaee('0x22')][_0xdaee('0x23')]===0x1f4){logger[_0xdaee('0x22')](_0xdaee('0x24'),_0x3cd7d6,_0x1f5865[_0xdaee('0x22')][_0xdaee('0x25')]);return _0x6e040(_0x1f5865[_0xdaee('0x22')][_0xdaee('0x25')]);}logger['error']('Setting,\x20%s,\x20%s',_0x3cd7d6,_0x1f5865[_0xdaee('0x22')]['message']);return _0x5e54c0(_0x1f5865[_0xdaee('0x22')]['message']);}else{logger[_0xdaee('0x1e')](_0xdaee('0x24'),_0x3cd7d6,_0xdaee('0x1f'));_0x5e54c0(_0x1f5865[_0xdaee('0x26')]['message']);}})['catch'](function(_0x37d52b){logger[_0xdaee('0x22')](_0xdaee('0x24'),_0x3cd7d6,_0x37d52b);_0x6e040(_0x37d52b);});});}function respondWithStatusCode(_0x34d4c4,_0x25eb3c){_0x25eb3c=_0x25eb3c||0xcc;return function(_0x4f5dd8){if(_0x4f5dd8){return _0x34d4c4['sendStatus'](_0x25eb3c);}return _0x34d4c4[_0xdaee('0x27')](_0x25eb3c)[_0xdaee('0x28')]();};}function respondWithResult(_0x229cee,_0x2e5bc5){_0x2e5bc5=_0x2e5bc5||0xc8;return function(_0x2faa15){if(_0x2faa15){return _0x229cee['status'](_0x2e5bc5)[_0xdaee('0x29')](_0x2faa15);}};}function respondWithFilteredResult(_0x30d5db,_0x2a8116){return function(_0x19728a){if(_0x19728a){var _0x4dad75=_0x19728a['count'],_0x24abc1=_0x2a8116['offset'],_0x53254b=_0x2a8116[_0xdaee('0x2a')]+_0x2a8116[_0xdaee('0x2b')],_0xfa07af;if(_0x53254b>=_0x4dad75){_0x53254b=_0x4dad75;_0xfa07af=0xc8;}else{_0xfa07af=0xce;}_0x30d5db[_0xdaee('0x27')](_0xfa07af);return _0x30d5db[_0xdaee('0x2c')](_0xdaee('0x2d'),_0x24abc1+'-'+_0x53254b+'/'+_0x4dad75)[_0xdaee('0x29')](_0x19728a);}return null;};}function patchUpdates(_0x186bf5){return function(_0x37797e){try{jsonpatch['apply'](_0x37797e,_0x186bf5,!![]);}catch(_0x551976){return BPromise[_0xdaee('0x2e')](_0x551976);}return _0x37797e['save']();};}function saveUpdates(_0x3cc7a1,_0x1b2b1f){return function(_0x37aa9b){if(_0x37aa9b){return _0x37aa9b['update'](_0x3cc7a1)['then'](function(_0x2d1eb6){return _0x2d1eb6;});}return null;};}function removeEntity(_0x3afd65,_0x5caafc){return function(_0x56bb87){if(_0x56bb87){return _0x56bb87['destroy']()[_0xdaee('0x1d')](function(){_0x3afd65[_0xdaee('0x27')](0xcc)[_0xdaee('0x28')]();});}};}function handleEntityNotFound(_0x5c5fee,_0x5b3c44){return function(_0x5662ed){if(!_0x5662ed){_0x5c5fee[_0xdaee('0x2f')](0x194);}return _0x5662ed;};}function handleError(_0x5a96ef,_0x1a0f28){_0x1a0f28=_0x1a0f28||0x1f4;return function(_0x3a0abc){logger['error'](_0x3a0abc[_0xdaee('0x30')]);if(_0x3a0abc[_0xdaee('0x31')]){delete _0x3a0abc[_0xdaee('0x31')];}_0x5a96ef[_0xdaee('0x27')](_0x1a0f28)[_0xdaee('0x32')](_0x3a0abc);};}exports[_0xdaee('0x33')]=function(_0x47253b,_0x58ed79){var _0x4b651a={},_0x3175cf={},_0x3cf10f={'count':0x0,'rows':[]};var _0x188ecd=_[_0xdaee('0x34')](db[_0xdaee('0x35')]['rawAttributes'],function(_0x14dc37){return{'name':_0x14dc37[_0xdaee('0x36')],'type':_0x14dc37[_0xdaee('0x37')][_0xdaee('0x38')]};});_0x3175cf[_0xdaee('0x39')]=_[_0xdaee('0x34')](_0x188ecd,'name');_0x3175cf[_0xdaee('0x3a')]=_[_0xdaee('0x3b')](_0x47253b[_0xdaee('0x3a')]);_0x3175cf['filters']=_[_0xdaee('0x3c')](_0x3175cf[_0xdaee('0x39')],_0x3175cf[_0xdaee('0x3a')]);_0x4b651a[_0xdaee('0x3d')]=_[_0xdaee('0x3c')](_0x3175cf[_0xdaee('0x39')],qs['fields'](_0x47253b[_0xdaee('0x3a')][_0xdaee('0x3e')]));_0x4b651a['attributes']=_0x4b651a[_0xdaee('0x3d')][_0xdaee('0x3f')]?_0x4b651a[_0xdaee('0x3d')]:_0x3175cf[_0xdaee('0x39')];if(!_0x47253b[_0xdaee('0x3a')][_0xdaee('0x40')](_0xdaee('0x41'))){_0x4b651a[_0xdaee('0x2b')]=qs[_0xdaee('0x2b')](_0x47253b['query']['limit']);_0x4b651a['offset']=qs[_0xdaee('0x2a')](_0x47253b[_0xdaee('0x3a')][_0xdaee('0x2a')]);}_0x4b651a[_0xdaee('0x42')]=qs['sort'](_0x47253b['query']['sort']);_0x4b651a[_0xdaee('0x43')]=qs[_0xdaee('0x44')](_['pick'](_0x47253b[_0xdaee('0x3a')],_0x3175cf[_0xdaee('0x44')]),_0x188ecd);if(_0x47253b[_0xdaee('0x3a')][_0xdaee('0x45')]){_0x4b651a['where']=_[_0xdaee('0x46')](_0x4b651a[_0xdaee('0x43')],{'$or':_[_0xdaee('0x34')](_0x188ecd,function(_0x3dbea1){if(_0x3dbea1['type']!==_0xdaee('0x47')){var _0x5b0262={};_0x5b0262[_0x3dbea1[_0xdaee('0x31')]]={'$like':'%'+_0x47253b[_0xdaee('0x3a')][_0xdaee('0x45')]+'%'};return _0x5b0262;}})});}_0x4b651a=_[_0xdaee('0x46')]({},_0x4b651a,_0x47253b[_0xdaee('0x48')]);var _0x470276={'where':_0x4b651a[_0xdaee('0x43')]};return db[_0xdaee('0x35')][_0xdaee('0x49')](_0x470276)['then'](function(_0x257b27){_0x3cf10f['count']=_0x257b27;if(_0x47253b[_0xdaee('0x3a')]['includeAll']){_0x4b651a[_0xdaee('0x4a')]=[{'all':!![]}];}return db[_0xdaee('0x35')][_0xdaee('0x4b')](_0x4b651a);})['then'](function(_0x4008e3){_0x3cf10f[_0xdaee('0x4c')]=_0x4008e3;return _0x3cf10f;})[_0xdaee('0x1d')](respondWithFilteredResult(_0x58ed79,_0x4b651a))[_0xdaee('0x4d')](handleError(_0x58ed79,null));};exports[_0xdaee('0x4e')]=function(_0xe0e087,_0x2b9b5c){var _0x474d6f={'raw':![],'where':{'id':_0xe0e087['params']['id']}},_0x322330={};_0x322330[_0xdaee('0x39')]=_['keys'](db[_0xdaee('0x35')][_0xdaee('0x4f')]);_0x322330['query']=_['keys'](_0xe0e087[_0xdaee('0x3a')]);_0x322330[_0xdaee('0x44')]=_['intersection'](_0x322330[_0xdaee('0x39')],_0x322330[_0xdaee('0x3a')]);_0x474d6f[_0xdaee('0x3d')]=_[_0xdaee('0x3c')](_0x322330[_0xdaee('0x39')],qs[_0xdaee('0x3e')](_0xe0e087['query']['fields']));_0x474d6f[_0xdaee('0x3d')]=_0x474d6f[_0xdaee('0x3d')]['length']?_0x474d6f[_0xdaee('0x3d')]:_0x322330[_0xdaee('0x39')];if(_0xe0e087[_0xdaee('0x3a')][_0xdaee('0x50')]){_0x474d6f[_0xdaee('0x4a')]=[{'all':!![]}];}_0x474d6f=_['merge']({},_0x474d6f,_0xe0e087[_0xdaee('0x48')]);return db[_0xdaee('0x35')]['find'](_0x474d6f)[_0xdaee('0x1d')](handleEntityNotFound(_0x2b9b5c,null))[_0xdaee('0x1d')](respondWithResult(_0x2b9b5c,null))[_0xdaee('0x4d')](handleError(_0x2b9b5c,null));};exports[_0xdaee('0x51')]=function(_0x4ec4f0,_0x13fa17){if(_0x4ec4f0[_0xdaee('0x52')]['id']){delete _0x4ec4f0[_0xdaee('0x52')]['id'];}return db['Setting'][_0xdaee('0x53')]({'where':{'id':_0x4ec4f0['params']['id']}})[_0xdaee('0x1d')](handleEntityNotFound(_0x13fa17,null))['then'](saveUpdates(_0x4ec4f0[_0xdaee('0x52')],null))[_0xdaee('0x1d')](respondWithResult(_0x13fa17,null))[_0xdaee('0x4d')](handleError(_0x13fa17,null));};exports[_0xdaee('0x54')]=function(_0xa35b2d,_0x5beee0,_0x2b4463){if(_0xa35b2d[_0xdaee('0x55')]&&_0xa35b2d[_0xdaee('0x55')][_0xdaee('0x56')]){_0xa35b2d[_0xdaee('0x52')][_0xdaee('0x57')]=_0xa35b2d[_0xdaee('0x55')][_0xdaee('0x56')];}return db[_0xdaee('0x35')][_0xdaee('0x53')]({'where':{'id':_0xa35b2d[_0xdaee('0x58')]['id']}})[_0xdaee('0x1d')](handleEntityNotFound(_0x5beee0,null))[_0xdaee('0x1d')](saveUpdates(_0xa35b2d[_0xdaee('0x52')],null))[_0xdaee('0x1d')](respondWithResult(_0x5beee0,null))[_0xdaee('0x4d')](handleError(_0x5beee0,null));};exports[_0xdaee('0x59')]=function(_0x15a5c,_0x5b8b13,_0x4a3524){if(_0x15a5c[_0xdaee('0x55')]&&_0x15a5c[_0xdaee('0x55')][_0xdaee('0x56')]){_0x15a5c[_0xdaee('0x52')][_0xdaee('0x5a')]=_0x15a5c[_0xdaee('0x55')][_0xdaee('0x56')];}return db[_0xdaee('0x35')][_0xdaee('0x53')]({'where':{'id':_0x15a5c[_0xdaee('0x58')]['id']}})['then'](handleEntityNotFound(_0x5b8b13,null))[_0xdaee('0x1d')](saveUpdates(_0x15a5c['body'],null))[_0xdaee('0x1d')](respondWithResult(_0x5b8b13,null))[_0xdaee('0x4d')](handleError(_0x5b8b13,null));};var utilLicense=require(_0xdaee('0x19'));exports['getLogo']=function(_0x4b1f83,_0x5eba36,_0x85b81e){var _0x1d9ff3='server/files/images/logos';var _0x80976e={'custom':![]};return utilLicense[_0xdaee('0x5b')]()[_0xdaee('0x1d')](function(_0xd67b3){if(_0xd67b3){_0x80976e=_0xd67b3;}return db[_0xdaee('0x35')][_0xdaee('0x53')]({'where':{'id':_0x4b1f83[_0xdaee('0x58')]['id']},'attributes':[_0xdaee('0x57'),_0xdaee('0x5a'),_0xdaee('0x5c'),'favicon','defaultLogo',_0xdaee('0x5d'),_0xdaee('0x5e'),_0xdaee('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x5eba36,null))[_0xdaee('0x1d')](function(_0x270ea0){if(_0x270ea0){var _0x23706b=_0x270ea0['logo']&&fs['existsSync'](path[_0xdaee('0x60')](config[_0xdaee('0x61')],_0x1d9ff3,_[_0xdaee('0x62')](_0x270ea0['logo'])))?path[_0xdaee('0x60')](config['root'],_0x1d9ff3,_[_0xdaee('0x62')](_0x270ea0[_0xdaee('0x57')])):path[_0xdaee('0x60')](config[_0xdaee('0x61')],_0x1d9ff3,_[_0xdaee('0x62')](_0xdaee('0x63')));var _0x3e12e8=_0xdaee('0x64')+_[_0xdaee('0x65')](_0xdaee('0x57'));if(_0x270ea0[_0x3e12e8]||!_0x80976e['custom']){_0x23706b=path[_0xdaee('0x60')](config['root'],_0x1d9ff3,_[_0xdaee('0x62')](_0xdaee('0x63')));}if(!fs[_0xdaee('0x66')](_0x23706b)){throw new db['Sequelize']['ValidationError'](_[_0xdaee('0x65')](_0xdaee('0x57'))+_0xdaee('0x67'));}return _0x5eba36['download'](_0x23706b);}})[_0xdaee('0x4d')](handleError(_0x5eba36,null));};var utilLicense=require(_0xdaee('0x19'));exports['getLogoLogin']=function(_0x5ce765,_0x3bd466,_0x29b770){var _0x1553d8=_0xdaee('0x68');var _0x304cde={'custom':![]};return utilLicense[_0xdaee('0x5b')]()[_0xdaee('0x1d')](function(_0x4eb251){if(_0x4eb251){_0x304cde=_0x4eb251;}return db[_0xdaee('0x35')]['find']({'where':{'id':_0x5ce765[_0xdaee('0x58')]['id']},'attributes':[_0xdaee('0x57'),_0xdaee('0x5a'),'preferred',_0xdaee('0x69'),_0xdaee('0x6a'),_0xdaee('0x5d'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xdaee('0x1d')](handleEntityNotFound(_0x3bd466,null))['then'](function(_0xb36e30){if(_0xb36e30){var _0x139474=_0xb36e30['loginLogo']&&fs[_0xdaee('0x66')](path[_0xdaee('0x60')](config[_0xdaee('0x61')],_0x1553d8,_[_0xdaee('0x62')](_0xb36e30['loginLogo'])))?path[_0xdaee('0x60')](config[_0xdaee('0x61')],_0x1553d8,_[_0xdaee('0x62')](_0xb36e30[_0xdaee('0x5a')])):path['join'](config[_0xdaee('0x61')],_0x1553d8,_['toLower'](_0xdaee('0x6b')));var _0x327693='default'+_[_0xdaee('0x65')]('loginLogo');if(_0xb36e30[_0x327693]||!_0x304cde[_0xdaee('0x6c')]){_0x139474=path[_0xdaee('0x60')](config[_0xdaee('0x61')],_0x1553d8,_['toLower'](_0xdaee('0x6b')));}if(!fs[_0xdaee('0x66')](_0x139474)){throw new db['Sequelize'][(_0xdaee('0x6d'))](_[_0xdaee('0x65')](_0xdaee('0x5a'))+_0xdaee('0x67'));}return _0x3bd466[_0xdaee('0x6e')](_0x139474);}})[_0xdaee('0x4d')](handleError(_0x3bd466,null));};exports[_0xdaee('0x6f')]=function(_0x372167,_0x44f05d){return db[_0xdaee('0x35')][_0xdaee('0x53')]({'where':{'id':_0x372167[_0xdaee('0x58')]['id']},'attributes':[_0xdaee('0x70')]})[_0xdaee('0x1d')](respondWithResult(_0x44f05d,null))['catch'](handleError(_0x44f05d,null));};exports['addPreferred']=function(_0x5e53ee,_0x4a89d2,_0x7e264a){if(_0x5e53ee[_0xdaee('0x55')]&&_0x5e53ee[_0xdaee('0x55')][_0xdaee('0x56')]){_0x5e53ee[_0xdaee('0x52')]['preferred']=_0x5e53ee['file']['filename'];}return db['Setting']['find']({'where':{'id':_0x5e53ee[_0xdaee('0x58')]['id']}})[_0xdaee('0x1d')](handleEntityNotFound(_0x4a89d2,null))[_0xdaee('0x1d')](saveUpdates(_0x5e53ee[_0xdaee('0x52')],null))['then'](respondWithResult(_0x4a89d2,null))[_0xdaee('0x4d')](handleError(_0x4a89d2,null));};var utilLicense=require(_0xdaee('0x19'));exports['getPreferred']=function(_0xf45447,_0x368427,_0x1f3803){var _0x3c33a8=_0xdaee('0x68');var _0x59ba76={'custom':![]};return utilLicense[_0xdaee('0x5b')]()[_0xdaee('0x1d')](function(_0x3deb80){if(_0x3deb80){_0x59ba76=_0x3deb80;}return db[_0xdaee('0x35')]['find']({'where':{'id':_0xf45447[_0xdaee('0x58')]['id']},'attributes':[_0xdaee('0x57'),_0xdaee('0x5a'),_0xdaee('0x5c'),'favicon','defaultLogo',_0xdaee('0x5d'),_0xdaee('0x5e'),_0xdaee('0x5f')],'raw':!![]});})[_0xdaee('0x1d')](handleEntityNotFound(_0x368427,null))[_0xdaee('0x1d')](function(_0x5758f7){if(_0x5758f7){var _0x3c98f7=_0x5758f7[_0xdaee('0x5c')]&&fs[_0xdaee('0x66')](path['join'](config[_0xdaee('0x61')],_0x3c33a8,_[_0xdaee('0x62')](_0x5758f7[_0xdaee('0x5c')])))?path[_0xdaee('0x60')](config['root'],_0x3c33a8,_[_0xdaee('0x62')](_0x5758f7['preferred'])):path[_0xdaee('0x60')](config[_0xdaee('0x61')],_0x3c33a8,_[_0xdaee('0x62')]('default_preferred.png'));var _0x48d728=_0xdaee('0x64')+_[_0xdaee('0x65')]('preferred');if(_0x5758f7[_0x48d728]||!_0x59ba76[_0xdaee('0x6c')]||!_0x59ba76[_0xdaee('0x5c')]){_0x3c98f7=path[_0xdaee('0x60')](config[_0xdaee('0x61')],_0x3c33a8,_[_0xdaee('0x62')](_0xdaee('0x71')));}if(!fs['existsSync'](_0x3c98f7)){throw new db[(_0xdaee('0x72'))][(_0xdaee('0x6d'))](_[_0xdaee('0x65')](_0xdaee('0x5c'))+'\x20not\x20found');}return _0x368427[_0xdaee('0x6e')](_0x3c98f7);}})[_0xdaee('0x4d')](handleError(_0x368427,null));};exports[_0xdaee('0x73')]=function(_0x4fc6fb,_0xc1cae9,_0x38d023){if(_0x4fc6fb[_0xdaee('0x55')]&&_0x4fc6fb['file'][_0xdaee('0x56')]){_0x4fc6fb[_0xdaee('0x52')]['favicon']=_0x4fc6fb[_0xdaee('0x55')]['filename'];}return db[_0xdaee('0x35')]['find']({'where':{'id':_0x4fc6fb[_0xdaee('0x58')]['id']}})['then'](handleEntityNotFound(_0xc1cae9,null))[_0xdaee('0x1d')](saveUpdates(_0x4fc6fb[_0xdaee('0x52')],null))[_0xdaee('0x1d')](respondWithResult(_0xc1cae9,null))[_0xdaee('0x4d')](handleError(_0xc1cae9,null));};var utilLicense=require(_0xdaee('0x19'));exports[_0xdaee('0x74')]=function(_0x18b65c,_0x3e7bb9,_0x59d909){var _0x477d1e='server/files/images/logos';var _0x446f83={'custom':![]};return utilLicense[_0xdaee('0x5b')]()[_0xdaee('0x1d')](function(_0x171763){if(_0x171763){_0x446f83=_0x171763;}return db[_0xdaee('0x35')][_0xdaee('0x53')]({'where':{'id':_0x18b65c[_0xdaee('0x58')]['id']},'attributes':[_0xdaee('0x57'),_0xdaee('0x5a'),_0xdaee('0x5c'),_0xdaee('0x69'),'defaultLogo',_0xdaee('0x5d'),_0xdaee('0x5e'),'defaultFavicon'],'raw':!![]});})[_0xdaee('0x1d')](handleEntityNotFound(_0x3e7bb9,null))['then'](function(_0x567ef1){if(_0x567ef1){var _0x11138c=_0x567ef1[_0xdaee('0x69')]&&fs['existsSync'](path['join'](config[_0xdaee('0x61')],_0x477d1e,_['toLower'](_0x567ef1['favicon'])))?path[_0xdaee('0x60')](config[_0xdaee('0x61')],_0x477d1e,_[_0xdaee('0x62')](_0x567ef1[_0xdaee('0x69')])):path['join'](config[_0xdaee('0x61')],_0x477d1e,_[_0xdaee('0x62')](_0xdaee('0x75')));var _0x12cce1=_0xdaee('0x64')+_[_0xdaee('0x65')](_0xdaee('0x69'));if(_0x567ef1[_0x12cce1]||!_0x446f83[_0xdaee('0x6c')]){_0x11138c=path['join'](config[_0xdaee('0x61')],_0x477d1e,_[_0xdaee('0x62')]('default_favicon.ico'));}if(!fs[_0xdaee('0x66')](_0x11138c)){throw new db['Sequelize'][(_0xdaee('0x6d'))](_['upperFirst'](_0xdaee('0x69'))+_0xdaee('0x67'));}return _0x3e7bb9[_0xdaee('0x6e')](_0x11138c);}})[_0xdaee('0x4d')](handleError(_0x3e7bb9,null));};exports[_0xdaee('0x76')]=function(_0x497745,_0x5bb043){var _0x2e198e={'offset':moment()[_0xdaee('0x77')]()};_0x2e198e[_0xdaee('0x78')]=moment()['utcOffset'](_0x2e198e[_0xdaee('0x2a')])[_0xdaee('0x79')](_0xdaee('0x7a'));return _0x5bb043['status'](0xc8)['send'](_0x2e198e);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index dec6116..f930a26 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 _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 +var _0x238f=['rimraf','./setting.attributes','exports','define','Setting','settings','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0xc6d32b,_0x608367){var _0x5d773a=function(_0x2285cc){while(--_0x2285cc){_0xc6d32b['push'](_0xc6d32b['shift']());}};_0x5d773a(++_0x608367);}(_0x238f,0x6e));var _0xf238=function(_0x757156,_0x2d0c5d){_0x757156=_0x757156-0x0;var _0x8178f6=_0x238f[_0x757156];return _0x8178f6;};'use strict';var _=require(_0xf238('0x0'));var util=require(_0xf238('0x1'));var logger=require('../../config/logger')(_0xf238('0x2'));var moment=require(_0xf238('0x3'));var BPromise=require(_0xf238('0x4'));var rp=require(_0xf238('0x5'));var fs=require('fs');var path=require(_0xf238('0x6'));var rimraf=require(_0xf238('0x7'));var config=require('../../config/environment');var attributes=require(_0xf238('0x8'));module[_0xf238('0x9')]=function(_0x316485,_0x3d1c1e){return _0x316485[_0xf238('0xa')](_0xf238('0xb'),attributes,{'tableName':_0xf238('0xc'),'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 1823158..fc2f007 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 _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 +var _0x9795=['result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5242a7,_0x4c9896){var _0x968c01=function(_0x12e722){while(--_0x12e722){_0x5242a7['push'](_0x5242a7['shift']());}};_0x968c01(++_0x4c9896);}(_0x9795,0xb2));var _0x5979=function(_0x24c5ad,_0x1d9ecb){_0x24c5ad=_0x24c5ad-0x0;var _0x504d5e=_0x9795[_0x24c5ad];return _0x504d5e;};'use strict';var _=require(_0x5979('0x0'));var util=require(_0x5979('0x1'));var moment=require('moment');var BPromise=require(_0x5979('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5979('0x3'));var logger=require(_0x5979('0x4'))('rpc');var config=require(_0x5979('0x5'));var jayson=require(_0x5979('0x6'));var client=jayson[_0x5979('0x7')][_0x5979('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b7d7b,_0x53e3bd,_0x1e0255){return new BPromise(function(_0x165365,_0x283230){return client[_0x5979('0x9')](_0x4b7d7b,_0x1e0255)[_0x5979('0xa')](function(_0x126589){logger[_0x5979('0xb')](_0x5979('0xc'),_0x53e3bd,_0x5979('0xd'));logger[_0x5979('0xe')](_0x5979('0xf'),_0x53e3bd,_0x5979('0xd'),JSON[_0x5979('0x10')](_0x126589));if(_0x126589[_0x5979('0x11')]){if(_0x126589[_0x5979('0x11')][_0x5979('0x12')]===0x1f4){logger[_0x5979('0x11')]('Setting,\x20%s,\x20%s',_0x53e3bd,_0x126589[_0x5979('0x11')][_0x5979('0x13')]);return _0x283230(_0x126589[_0x5979('0x11')]['message']);}logger['error'](_0x5979('0xc'),_0x53e3bd,_0x126589[_0x5979('0x11')]['message']);return _0x165365(_0x126589[_0x5979('0x11')][_0x5979('0x13')]);}else{logger[_0x5979('0xb')]('Setting,\x20%s,\x20%s',_0x53e3bd,'request\x20sent');_0x165365(_0x126589[_0x5979('0x14')][_0x5979('0x13')]);}})[_0x5979('0x15')](function(_0x15e729){logger[_0x5979('0x11')](_0x5979('0xc'),_0x53e3bd,_0x15e729);_0x283230(_0x15e729);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 5c06c49..fd74975 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 _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 +var _0x323f=['removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','/:id/send','send','status','addAgents','put','update','destroy','delete','removeAnswers'];(function(_0x34c24c,_0x3a056f){var _0x35c544=function(_0x3c7a43){while(--_0x3c7a43){_0x34c24c['push'](_0x34c24c['shift']());}};_0x35c544(++_0x3a056f);}(_0x323f,0x185));var _0xf323=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x323f[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xf323('0x0'));var util=require('util');var path=require(_0xf323('0x1'));var timeout=require(_0xf323('0x2'));var express=require(_0xf323('0x3'));var router=express[_0xf323('0x4')]();var auth=require(_0xf323('0x5'));var interaction=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var controller=require(_0xf323('0x8'));router[_0xf323('0x9')]('/',auth[_0xf323('0xa')](),controller[_0xf323('0xb')]);router[_0xf323('0x9')](_0xf323('0xc'),auth[_0xf323('0xa')](),controller[_0xf323('0xd')]);router['get'](_0xf323('0xe'),auth[_0xf323('0xa')](),controller['show']);router['get'](_0xf323('0xf'),auth[_0xf323('0xa')](),controller[_0xf323('0x10')]);router[_0xf323('0x9')](_0xf323('0x11'),auth[_0xf323('0xa')](),controller[_0xf323('0x12')]);router[_0xf323('0x9')]('/:id/applications',auth[_0xf323('0xa')](),controller['getApplications']);router[_0xf323('0x9')](_0xf323('0x13'),auth['isAuthenticated'](),controller[_0xf323('0x14')]);router['get'](_0xf323('0x15'),controller[_0xf323('0x16')]);router[_0xf323('0x9')](_0xf323('0x17'),auth[_0xf323('0xa')](),controller[_0xf323('0x18')]);router[_0xf323('0x19')]('/',auth[_0xf323('0xa')](),controller[_0xf323('0x1a')]);router[_0xf323('0x19')](_0xf323('0xf'),auth['isAuthenticated'](),controller[_0xf323('0x1b')]);router[_0xf323('0x19')](_0xf323('0x11'),auth[_0xf323('0xa')](),controller[_0xf323('0x1c')]);router[_0xf323('0x19')](_0xf323('0x1d'),controller[_0xf323('0x1e')]);router[_0xf323('0x19')](_0xf323('0x1f'),auth[_0xf323('0xa')](),controller['addApplications']);router[_0xf323('0x19')](_0xf323('0x20'),auth[_0xf323('0xa')](),controller[_0xf323('0x21')]);router[_0xf323('0x19')](_0xf323('0x15'),controller[_0xf323('0x22')]);router[_0xf323('0x19')]('/:id/users',auth[_0xf323('0xa')](),controller[_0xf323('0x23')]);router[_0xf323('0x24')](_0xf323('0xe'),auth[_0xf323('0xa')](),controller[_0xf323('0x25')]);router['delete'](_0xf323('0xe'),auth['isAuthenticated'](),controller[_0xf323('0x26')]);router[_0xf323('0x27')](_0xf323('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0xf323('0x11'),auth[_0xf323('0xa')](),controller[_0xf323('0x28')]);router[_0xf323('0x27')](_0xf323('0x17'),auth[_0xf323('0xa')](),controller[_0xf323('0x29')]);module[_0xf323('0x2a')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index e52e5f1..7b48ffd 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 _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 +var _0x38c9=['bandwidth','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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','ENUM','twilio','skebby','clicksend','plivo','clickatell'];(function(_0x42d709,_0x2e336c){var _0x2ac71e=function(_0x4049c2){while(--_0x4049c2){_0x42d709['push'](_0x42d709['shift']());}};_0x2ac71e(++_0x2e336c);}(_0x38c9,0x199));var _0x938c=function(_0x2d6197,_0x82ebfb){_0x2d6197=_0x2d6197-0x0;var _0x4d0e75=_0x38c9[_0x2d6197];return _0x4d0e75;};'use strict';var Sequelize=require(_0x938c('0x0'));var rs=require(_0x938c('0x1'));module[_0x938c('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x938c('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x938c('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x938c('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x938c('0x4')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x938c('0x4')]},'type':{'type':Sequelize[_0x938c('0x5')](_0x938c('0x6'),_0x938c('0x7'),'connectel',_0x938c('0x8'),_0x938c('0x9'),_0x938c('0xa'),_0x938c('0xb'),'csc','infobip',_0x938c('0xc'))},'accountSid':{'type':Sequelize[_0x938c('0x4')]},'authId':{'type':Sequelize[_0x938c('0x4')]},'authToken':{'type':Sequelize[_0x938c('0x4')]},'smsMethod':{'type':Sequelize[_0x938c('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x938c('0x4')]},'password':{'type':Sequelize[_0x938c('0x4')]},'apiKey':{'type':Sequelize[_0x938c('0x4')]},'applicationId':{'type':Sequelize[_0x938c('0x4')]},'accountId':{'type':Sequelize[_0x938c('0x4')]},'senderString':{'type':Sequelize[_0x938c('0x4')]},'deliveryReport':{'type':Sequelize[_0x938c('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x938c('0x4')]},'notificationTemplate':{'type':Sequelize[_0x938c('0xe')],'defaultValue':function(){return _0x938c('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x938c('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x938c('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x938c('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x938c('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x938c('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x938c('0x10')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x938c('0xd')],'defaultValue':![],'comment':_0x938c('0x11'),'set':function(_0x9d9f88){if(!_0x9d9f88)this[_0x938c('0x12')](_0x938c('0x13'),null);this['setDataValue'](_0x938c('0x14'),_0x9d9f88);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index e7fe756..6458f0b 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 _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 +var _0x3fae=['SmsApplication','Applications','account','orderBy','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','from','From','Body','messageId','MessageSid','text','connectel','clicksend','message_id','MessageUUID','infobip','results','csc','originatingAddress','fromNumber','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey','CmList','CmContact','Contacts','DESC','omit','SmsInteraction','spread','interaction','created','autoclose','applications','push','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','Contact','User','Owner','fullname','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','redif','DELIVERED','error_code','groupName','clickatell','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','ACCEPTD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','destroy','SmsAccounts','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','include','rows','show','params','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','SmsAccountId','Disposition','addAnswer','getAnswers','findOne','CannedAnswer','findAll','removeAnswers','ids','notify'];(function(_0x31bab3,_0x44554f){var _0x4fd382=function(_0x42b336){while(--_0x42b336){_0x31bab3['push'](_0x31bab3['shift']());}};_0x4fd382(++_0x44554f);}(_0x3fae,0x6a));var _0xe3fa=function(_0x2bc7d4,_0x2cbf1f){_0x2bc7d4=_0x2bc7d4-0x0;var _0x3e60b0=_0x3fae[_0x2bc7d4];return _0x3e60b0;};'use strict';var pdf=require(_0xe3fa('0x0'));var emlformat=require(_0xe3fa('0x1'));var rimraf=require(_0xe3fa('0x2'));var zipdir=require(_0xe3fa('0x3'));var jsonpatch=require(_0xe3fa('0x4'));var rp=require('request-promise');var moment=require(_0xe3fa('0x5'));var BPromise=require(_0xe3fa('0x6'));var Mustache=require(_0xe3fa('0x7'));var util=require(_0xe3fa('0x8'));var path=require(_0xe3fa('0x9'));var sox=require('sox');var csv=require(_0xe3fa('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe3fa('0xb'));var squel=require(_0xe3fa('0xc'));var crypto=require(_0xe3fa('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe3fa('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe3fa('0xf'));var Papa=require(_0xe3fa('0x10'));var Redis=require(_0xe3fa('0x11'));var authService=require(_0xe3fa('0x12'));var qs=require(_0xe3fa('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3fa('0x14'));var logger=require(_0xe3fa('0x15'))(_0xe3fa('0x16'));var utils=require(_0xe3fa('0x17'));var config=require(_0xe3fa('0x18'));var licenseUtil=require(_0xe3fa('0x19'));var db=require(_0xe3fa('0x1a'))['db'];config[_0xe3fa('0x1b')]=_[_0xe3fa('0x1c')](config['redis'],{'host':_0xe3fa('0x1d'),'port':0x18eb});var socket=require(_0xe3fa('0x1e'))(new Redis(config[_0xe3fa('0x1b')]));require(_0xe3fa('0x1f'))[_0xe3fa('0x20')](socket);var jayson=require(_0xe3fa('0x21'));var client=jayson[_0xe3fa('0x22')][_0xe3fa('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x226938,_0x1ab5ee,_0x31f3b7,_0x548fd0){return new BPromise(function(_0x506d2a,_0x9eb198){var _0x11e492=_0x548fd0||client;return _0x11e492[_0xe3fa('0x24')](_0x226938,_0x31f3b7)[_0xe3fa('0x25')](function(_0x270682){logger[_0xe3fa('0x26')](_0xe3fa('0x27'),_0x1ab5ee,_0xe3fa('0x28'));logger[_0xe3fa('0x29')](_0xe3fa('0x2a'),_0x1ab5ee,_0xe3fa('0x28'),JSON['stringify'](_0x270682));if(_0x270682['error']){if(_0x270682[_0xe3fa('0x2b')]['code']===0x1f4){logger[_0xe3fa('0x2b')](_0xe3fa('0x27'),_0x1ab5ee,_0x270682[_0xe3fa('0x2b')][_0xe3fa('0x2c')]);return _0x9eb198(_0x270682[_0xe3fa('0x2b')][_0xe3fa('0x2c')]);}logger[_0xe3fa('0x2b')](_0xe3fa('0x27'),_0x1ab5ee,_0x270682['error'][_0xe3fa('0x2c')]);return _0x506d2a(_0x270682['error'][_0xe3fa('0x2c')]);}else{logger[_0xe3fa('0x26')](_0xe3fa('0x27'),_0x1ab5ee,_0xe3fa('0x28'));_0x506d2a(_0x270682[_0xe3fa('0x2d')]['message']);}})[_0xe3fa('0x2e')](function(_0x4016e1){logger[_0xe3fa('0x2b')](_0xe3fa('0x27'),_0x1ab5ee,_0x4016e1);_0x9eb198(_0x4016e1);});});}function respondWithStatusCode(_0x484c4e,_0x4f3edd){_0x4f3edd=_0x4f3edd||0xcc;return function(_0x20b719){if(_0x20b719){return _0x484c4e[_0xe3fa('0x2f')](_0x4f3edd);}return _0x484c4e[_0xe3fa('0x30')](_0x4f3edd)['end']();};}function respondWithResult(_0x1e8b83,_0x304bc){_0x304bc=_0x304bc||0xc8;return function(_0x56521d){if(_0x56521d){return _0x1e8b83[_0xe3fa('0x30')](_0x304bc)[_0xe3fa('0x31')](_0x56521d);}};}function respondWithFilteredResult(_0x2c5524,_0x2dea21){return function(_0x2ae9a9){if(_0x2ae9a9){var _0x15f265=_0x2ae9a9[_0xe3fa('0x32')],_0x3d6e97=_0x2dea21[_0xe3fa('0x33')],_0x478f81=_0x2dea21[_0xe3fa('0x33')]+_0x2dea21['limit'],_0x37234a;if(_0x478f81>=_0x15f265){_0x478f81=_0x15f265;_0x37234a=0xc8;}else{_0x37234a=0xce;}_0x2c5524[_0xe3fa('0x30')](_0x37234a);return _0x2c5524[_0xe3fa('0x34')](_0xe3fa('0x35'),_0x3d6e97+'-'+_0x478f81+'/'+_0x15f265)[_0xe3fa('0x31')](_0x2ae9a9);}return null;};}function patchUpdates(_0x5c6ac3){return function(_0x968ec0){try{jsonpatch[_0xe3fa('0x36')](_0x968ec0,_0x5c6ac3,!![]);}catch(_0x1deb4d){return BPromise[_0xe3fa('0x37')](_0x1deb4d);}return _0x968ec0[_0xe3fa('0x38')]();};}function saveUpdates(_0x4a7d89,_0x32662f){return function(_0x57362f){if(_0x57362f){return _0x57362f['update'](_0x4a7d89)['then'](function(_0x2c83c9){return _0x2c83c9;});}return null;};}function removeEntity(_0x206b5f,_0x458658){return function(_0x157642){if(_0x157642){return _0x157642[_0xe3fa('0x39')]()['then'](function(){var _0x3ef22d=_0x157642['get']({'plain':!![]});var _0x267ecf=_0xe3fa('0x3a');return db[_0xe3fa('0x3b')][_0xe3fa('0x39')]({'where':{'type':_0x267ecf,'resourceId':_0x3ef22d['id']}})['then'](function(){return _0x157642;});})['then'](function(){_0x206b5f[_0xe3fa('0x30')](0xcc)[_0xe3fa('0x3c')]();});}};}function handleEntityNotFound(_0x206052,_0x196ff2){return function(_0x384816){if(!_0x384816){_0x206052[_0xe3fa('0x2f')](0x194);}return _0x384816;};}function handleError(_0x28c11a,_0x39642a){_0x39642a=_0x39642a||0x1f4;return function(_0x447d4d){logger[_0xe3fa('0x2b')](_0x447d4d[_0xe3fa('0x3d')]);if(_0x447d4d['name']){delete _0x447d4d[_0xe3fa('0x3e')];}_0x28c11a['status'](_0x39642a)[_0xe3fa('0x3f')](_0x447d4d);};}exports[_0xe3fa('0x40')]=function(_0x13dc9a,_0x43561b){var _0x1c17da={'include':[{'model':db[_0xe3fa('0x41')],'as':_0xe3fa('0x42')}]},_0x389ec2={},_0x232d39={'count':0x0,'rows':[]};var _0x29cd26=_[_0xe3fa('0x43')](db[_0xe3fa('0x44')][_0xe3fa('0x45')],function(_0x236757){return{'name':_0x236757[_0xe3fa('0x46')],'type':_0x236757['type']['key']};});_0x389ec2[_0xe3fa('0x47')]=_[_0xe3fa('0x43')](_0x29cd26,'name');_0x389ec2[_0xe3fa('0x48')]=_[_0xe3fa('0x49')](_0x13dc9a[_0xe3fa('0x48')]);_0x389ec2[_0xe3fa('0x4a')]=_[_0xe3fa('0x4b')](_0x389ec2[_0xe3fa('0x47')],_0x389ec2[_0xe3fa('0x48')]);_0x1c17da[_0xe3fa('0x4c')]=_[_0xe3fa('0x4b')](_0x389ec2[_0xe3fa('0x47')],qs['fields'](_0x13dc9a[_0xe3fa('0x48')][_0xe3fa('0x4d')]));_0x1c17da[_0xe3fa('0x4c')]=_0x1c17da[_0xe3fa('0x4c')]['length']?_0x1c17da['attributes']:_0x389ec2['model'];if(!_0x13dc9a[_0xe3fa('0x48')][_0xe3fa('0x4e')](_0xe3fa('0x4f'))){_0x1c17da[_0xe3fa('0x50')]=qs[_0xe3fa('0x50')](_0x13dc9a[_0xe3fa('0x48')]['limit']);_0x1c17da[_0xe3fa('0x33')]=qs[_0xe3fa('0x33')](_0x13dc9a[_0xe3fa('0x48')][_0xe3fa('0x33')]);}_0x1c17da[_0xe3fa('0x51')]=qs[_0xe3fa('0x52')](_0x13dc9a[_0xe3fa('0x48')][_0xe3fa('0x52')]);_0x1c17da['where']=qs[_0xe3fa('0x4a')](_[_0xe3fa('0x53')](_0x13dc9a[_0xe3fa('0x48')],_0x389ec2[_0xe3fa('0x4a')]),_0x29cd26);if(_0x13dc9a['query'][_0xe3fa('0x54')]){_0x1c17da['where']=_[_0xe3fa('0x55')](_0x1c17da[_0xe3fa('0x56')],{'$or':_[_0xe3fa('0x43')](_0x29cd26,function(_0x4aef80){if(_0x4aef80[_0xe3fa('0x57')]!==_0xe3fa('0x58')){var _0x4d82ac={};_0x4d82ac[_0x4aef80[_0xe3fa('0x3e')]]={'$like':'%'+_0x13dc9a[_0xe3fa('0x48')][_0xe3fa('0x54')]+'%'};return _0x4d82ac;}})});}_0x1c17da=_[_0xe3fa('0x55')]({},_0x1c17da,_0x13dc9a[_0xe3fa('0x59')]);var _0x26ad47={'where':_0x1c17da[_0xe3fa('0x56')]};return db[_0xe3fa('0x44')][_0xe3fa('0x32')](_0x26ad47)[_0xe3fa('0x25')](function(_0x29402c){_0x232d39[_0xe3fa('0x32')]=_0x29402c;if(_0x13dc9a[_0xe3fa('0x48')]['includeAll']){_0x1c17da[_0xe3fa('0x5a')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x1c17da);})[_0xe3fa('0x25')](function(_0x3105c8){_0x232d39[_0xe3fa('0x5b')]=_0x3105c8;return _0x232d39;})[_0xe3fa('0x25')](respondWithFilteredResult(_0x43561b,_0x1c17da))['catch'](handleError(_0x43561b,null));};exports[_0xe3fa('0x5c')]=function(_0x10d0ef,_0x330828){var _0x5ae9fd={'raw':![],'where':{'id':_0x10d0ef[_0xe3fa('0x5d')]['id']},'include':[{'model':db[_0xe3fa('0x41')],'as':_0xe3fa('0x42')}]},_0x305778={};_0x305778[_0xe3fa('0x47')]=_[_0xe3fa('0x49')](db[_0xe3fa('0x44')]['rawAttributes']);_0x305778[_0xe3fa('0x48')]=_[_0xe3fa('0x49')](_0x10d0ef['query']);_0x305778[_0xe3fa('0x4a')]=_['intersection'](_0x305778['model'],_0x305778[_0xe3fa('0x48')]);_0x5ae9fd[_0xe3fa('0x4c')]=_[_0xe3fa('0x4b')](_0x305778[_0xe3fa('0x47')],qs[_0xe3fa('0x4d')](_0x10d0ef[_0xe3fa('0x48')][_0xe3fa('0x4d')]));_0x5ae9fd[_0xe3fa('0x4c')]=_0x5ae9fd[_0xe3fa('0x4c')][_0xe3fa('0x5e')]?_0x5ae9fd[_0xe3fa('0x4c')]:_0x305778['model'];if(_0x10d0ef[_0xe3fa('0x48')][_0xe3fa('0x5f')]){_0x5ae9fd[_0xe3fa('0x5a')]=[{'all':!![]}];}_0x5ae9fd=_['merge']({},_0x5ae9fd,_0x10d0ef[_0xe3fa('0x59')]);return db['SmsAccount'][_0xe3fa('0x60')](_0x5ae9fd)[_0xe3fa('0x25')](handleEntityNotFound(_0x330828,null))[_0xe3fa('0x25')](respondWithResult(_0x330828,null))[_0xe3fa('0x2e')](handleError(_0x330828,null));};exports['create']=function(_0x383038,_0x2db452){return db[_0xe3fa('0x44')][_0xe3fa('0x61')](_0x383038[_0xe3fa('0x62')],{})['then'](function(_0x568371){var _0x11adc2=_0x383038['user']['get']({'plain':!![]});if(!_0x11adc2)throw new Error(_0xe3fa('0x63'));if(_0x11adc2[_0xe3fa('0x64')]===_0xe3fa('0x65')){var _0x2d306b=_0x568371[_0xe3fa('0x66')]({'plain':!![]});var _0x31d521='SmsAccounts';return db[_0xe3fa('0x67')][_0xe3fa('0x60')]({'where':{'name':_0x31d521,'userProfileId':_0x11adc2['userProfileId']},'raw':!![]})[_0xe3fa('0x25')](function(_0x52e067){if(_0x52e067&&_0x52e067[_0xe3fa('0x68')]===0x0){return db[_0xe3fa('0x3b')][_0xe3fa('0x61')]({'name':_0x2d306b[_0xe3fa('0x3e')],'resourceId':_0x2d306b['id'],'type':_0x52e067[_0xe3fa('0x3e')],'sectionId':_0x52e067['id']},{})[_0xe3fa('0x25')](function(){return _0x568371;});}else{return _0x568371;}})[_0xe3fa('0x2e')](function(_0x2411cb){logger[_0xe3fa('0x2b')](_0xe3fa('0x69'),_0x2411cb);throw _0x2411cb;});}return _0x568371;})[_0xe3fa('0x25')](respondWithResult(_0x2db452,0xc9))[_0xe3fa('0x2e')](handleError(_0x2db452,null));};exports[_0xe3fa('0x6a')]=function(_0xbcc8ad,_0x32bcdf){if(_0xbcc8ad['body']['id']){delete _0xbcc8ad['body']['id'];}return db[_0xe3fa('0x44')]['find']({'where':{'id':_0xbcc8ad[_0xe3fa('0x5d')]['id']},'include':[{'model':db[_0xe3fa('0x41')],'as':_0xe3fa('0x42')}]})['then'](handleEntityNotFound(_0x32bcdf,null))[_0xe3fa('0x25')](saveUpdates(_0xbcc8ad[_0xe3fa('0x62')],null))[_0xe3fa('0x25')](respondWithResult(_0x32bcdf,null))[_0xe3fa('0x2e')](handleError(_0x32bcdf,null));};exports[_0xe3fa('0x39')]=function(_0x25ee4d,_0x24ce29){return db['SmsAccount'][_0xe3fa('0x60')]({'where':{'id':_0x25ee4d[_0xe3fa('0x5d')]['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0x24ce29,null))[_0xe3fa('0x25')](removeEntity(_0x24ce29,null))[_0xe3fa('0x2e')](handleError(_0x24ce29,null));};exports[_0xe3fa('0x6b')]=function(_0x4d8a40,_0x29ac79){return db[_0xe3fa('0x44')]['describe']()['then'](respondWithResult(_0x29ac79,null))[_0xe3fa('0x2e')](handleError(_0x29ac79,null));};exports['addDisposition']=function(_0x1e624f,_0x2161d4,_0x385367){if(_0x1e624f[_0xe3fa('0x62')]['id']){delete _0x1e624f[_0xe3fa('0x62')]['id'];}return db[_0xe3fa('0x44')][_0xe3fa('0x60')]({'where':{'id':_0x1e624f['params']['id']}})['then'](handleEntityNotFound(_0x2161d4,null))[_0xe3fa('0x25')](function(_0x5bda9d){if(_0x5bda9d){_0x1e624f[_0xe3fa('0x62')][_0xe3fa('0x6c')]=_0x5bda9d['id'];return db[_0xe3fa('0x6d')][_0xe3fa('0x61')](_0x1e624f['body']);}})[_0xe3fa('0x25')](respondWithResult(_0x2161d4,null))[_0xe3fa('0x2e')](handleError(_0x2161d4,null));};exports['getDispositions']=function(_0x3acdd4,_0x1d07a5,_0x27c56b){var _0x36053d={'raw':![],'where':{}};var _0x5805c3={};var _0x2893c8={'count':0x0,'rows':[]};return db[_0xe3fa('0x44')]['findOne']({'where':{'id':_0x3acdd4[_0xe3fa('0x5d')]['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0x1d07a5,null))['then'](function(_0x4bb197){if(_0x4bb197){_0x5805c3[_0xe3fa('0x47')]=_['keys'](db[_0xe3fa('0x6d')][_0xe3fa('0x45')]);_0x5805c3[_0xe3fa('0x48')]=_[_0xe3fa('0x49')](_0x3acdd4['query']);_0x5805c3[_0xe3fa('0x4a')]=_[_0xe3fa('0x4b')](_0x5805c3['model'],_0x5805c3[_0xe3fa('0x48')]);_0x36053d['attributes']=_[_0xe3fa('0x4b')](_0x5805c3['model'],qs[_0xe3fa('0x4d')](_0x3acdd4[_0xe3fa('0x48')][_0xe3fa('0x4d')]));_0x36053d[_0xe3fa('0x4c')]=_0x36053d[_0xe3fa('0x4c')]['length']?_0x36053d['attributes']:_0x5805c3[_0xe3fa('0x47')];if(!_0x3acdd4['query'][_0xe3fa('0x4e')](_0xe3fa('0x4f'))){_0x36053d[_0xe3fa('0x50')]=qs[_0xe3fa('0x50')](_0x3acdd4['query'][_0xe3fa('0x50')]);_0x36053d['offset']=qs[_0xe3fa('0x33')](_0x3acdd4['query'][_0xe3fa('0x33')]);}_0x36053d['order']=qs['sort'](_0x3acdd4[_0xe3fa('0x48')]['sort']);_0x36053d[_0xe3fa('0x56')]=qs[_0xe3fa('0x4a')](_[_0xe3fa('0x53')](_0x3acdd4[_0xe3fa('0x48')],_0x5805c3[_0xe3fa('0x4a')]));_0x36053d[_0xe3fa('0x56')][_0xe3fa('0x6c')]=_0x4bb197['id'];if(_0x3acdd4[_0xe3fa('0x48')][_0xe3fa('0x54')]){_0x36053d[_0xe3fa('0x56')]=_[_0xe3fa('0x55')](_0x36053d[_0xe3fa('0x56')],{'$or':_['map'](_0x36053d[_0xe3fa('0x4c')],function(_0x28f3f){var _0x1cc97e={};_0x1cc97e[_0x28f3f]={'$like':'%'+_0x3acdd4[_0xe3fa('0x48')][_0xe3fa('0x54')]+'%'};return _0x1cc97e;})});}_0x36053d=_[_0xe3fa('0x55')]({},_0x36053d,_0x3acdd4[_0xe3fa('0x59')]);return db['Disposition'][_0xe3fa('0x32')]({'where':_0x36053d[_0xe3fa('0x56')]})[_0xe3fa('0x25')](function(_0x204463){_0x2893c8[_0xe3fa('0x32')]=_0x204463;if(_0x3acdd4[_0xe3fa('0x48')]['includeAll']){_0x36053d['include']=[{'all':!![]}];}return db[_0xe3fa('0x6d')]['findAll'](_0x36053d);})[_0xe3fa('0x25')](function(_0x10d55e){_0x2893c8[_0xe3fa('0x5b')]=_0x10d55e;return _0x2893c8;});}})[_0xe3fa('0x25')](respondWithFilteredResult(_0x1d07a5,_0x36053d))[_0xe3fa('0x2e')](handleError(_0x1d07a5,null));};exports['removeDispositions']=function(_0x540e2f,_0x3e6b80,_0x5c1be0){return db[_0xe3fa('0x44')]['find']({'where':{'id':_0x540e2f['params']['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0x3e6b80,null))[_0xe3fa('0x25')](function(_0x572572){if(_0x572572){return _0x572572['removeDispositions'](_0x540e2f[_0xe3fa('0x48')]['ids']);}})[_0xe3fa('0x25')](respondWithStatusCode(_0x3e6b80,null))['catch'](handleError(_0x3e6b80,null));};exports[_0xe3fa('0x6e')]=function(_0x344b38,_0x53b0e7,_0x3848cc){if(_0x344b38[_0xe3fa('0x62')]['id']){delete _0x344b38['body']['id'];}return db[_0xe3fa('0x44')][_0xe3fa('0x60')]({'where':{'id':_0x344b38[_0xe3fa('0x5d')]['id']}})['then'](handleEntityNotFound(_0x53b0e7,null))[_0xe3fa('0x25')](function(_0x2cf066){if(_0x2cf066){_0x344b38[_0xe3fa('0x62')][_0xe3fa('0x6c')]=_0x2cf066['id'];return db['CannedAnswer'][_0xe3fa('0x61')](_0x344b38['body']);}})[_0xe3fa('0x25')](respondWithResult(_0x53b0e7,null))[_0xe3fa('0x2e')](handleError(_0x53b0e7,null));};exports[_0xe3fa('0x6f')]=function(_0x1000f4,_0x21c6fd,_0x40ad1a){var _0x4e018d={'raw':![],'where':{}};var _0x2038b1={};var _0x17d905={'count':0x0,'rows':[]};return db['SmsAccount'][_0xe3fa('0x70')]({'where':{'id':_0x1000f4[_0xe3fa('0x5d')]['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0x21c6fd,null))[_0xe3fa('0x25')](function(_0x57f6c5){if(_0x57f6c5){_0x2038b1['model']=_[_0xe3fa('0x49')](db[_0xe3fa('0x71')][_0xe3fa('0x45')]);_0x2038b1['query']=_[_0xe3fa('0x49')](_0x1000f4['query']);_0x2038b1[_0xe3fa('0x4a')]=_['intersection'](_0x2038b1[_0xe3fa('0x47')],_0x2038b1['query']);_0x4e018d[_0xe3fa('0x4c')]=_[_0xe3fa('0x4b')](_0x2038b1[_0xe3fa('0x47')],qs['fields'](_0x1000f4['query'][_0xe3fa('0x4d')]));_0x4e018d[_0xe3fa('0x4c')]=_0x4e018d[_0xe3fa('0x4c')][_0xe3fa('0x5e')]?_0x4e018d[_0xe3fa('0x4c')]:_0x2038b1[_0xe3fa('0x47')];if(!_0x1000f4[_0xe3fa('0x48')][_0xe3fa('0x4e')](_0xe3fa('0x4f'))){_0x4e018d[_0xe3fa('0x50')]=qs[_0xe3fa('0x50')](_0x1000f4[_0xe3fa('0x48')]['limit']);_0x4e018d[_0xe3fa('0x33')]=qs[_0xe3fa('0x33')](_0x1000f4[_0xe3fa('0x48')][_0xe3fa('0x33')]);}_0x4e018d[_0xe3fa('0x51')]=qs['sort'](_0x1000f4[_0xe3fa('0x48')][_0xe3fa('0x52')]);_0x4e018d[_0xe3fa('0x56')]=qs[_0xe3fa('0x4a')](_[_0xe3fa('0x53')](_0x1000f4[_0xe3fa('0x48')],_0x2038b1[_0xe3fa('0x4a')]));_0x4e018d['where'][_0xe3fa('0x6c')]=_0x57f6c5['id'];if(_0x1000f4[_0xe3fa('0x48')][_0xe3fa('0x54')]){_0x4e018d[_0xe3fa('0x56')]=_[_0xe3fa('0x55')](_0x4e018d[_0xe3fa('0x56')],{'$or':_[_0xe3fa('0x43')](_0x4e018d[_0xe3fa('0x4c')],function(_0x2ba781){var _0x25754e={};_0x25754e[_0x2ba781]={'$like':'%'+_0x1000f4['query'][_0xe3fa('0x54')]+'%'};return _0x25754e;})});}_0x4e018d=_[_0xe3fa('0x55')]({},_0x4e018d,_0x1000f4['options']);return db['CannedAnswer'][_0xe3fa('0x32')]({'where':_0x4e018d[_0xe3fa('0x56')]})[_0xe3fa('0x25')](function(_0x46c53c){_0x17d905[_0xe3fa('0x32')]=_0x46c53c;if(_0x1000f4[_0xe3fa('0x48')][_0xe3fa('0x5f')]){_0x4e018d[_0xe3fa('0x5a')]=[{'all':!![]}];}return db['CannedAnswer'][_0xe3fa('0x72')](_0x4e018d);})[_0xe3fa('0x25')](function(_0x57e132){_0x17d905[_0xe3fa('0x5b')]=_0x57e132;return _0x17d905;});}})[_0xe3fa('0x25')](respondWithFilteredResult(_0x21c6fd,_0x4e018d))[_0xe3fa('0x2e')](handleError(_0x21c6fd,null));};exports[_0xe3fa('0x73')]=function(_0x4aff23,_0x4b17dc,_0x1b41a5){return db['SmsAccount'][_0xe3fa('0x60')]({'where':{'id':_0x4aff23[_0xe3fa('0x5d')]['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0x4b17dc,null))['then'](function(_0x113e27){if(_0x113e27){return _0x113e27[_0xe3fa('0x73')](_0x4aff23[_0xe3fa('0x48')][_0xe3fa('0x74')]);}})[_0xe3fa('0x25')](respondWithStatusCode(_0x4b17dc,null))[_0xe3fa('0x2e')](handleError(_0x4b17dc,null));};exports[_0xe3fa('0x75')]=function(_0x2e9aa9,_0x47a33f,_0x5841c5){var _0x4d27a5={'channel':'sms'};var _0x330aa0=[];var _0x3dbe54=[];var _0x255f38={};return db['SmsAccount'][_0xe3fa('0x60')]({'where':{'id':_0x2e9aa9[_0xe3fa('0x5d')]['id']},'include':[{'model':db[_0xe3fa('0x76')],'as':_0xe3fa('0x77')}]})[_0xe3fa('0x25')](handleEntityNotFound(_0x47a33f,null))[_0xe3fa('0x25')](function(_0x112c8d){_0x4d27a5[_0xe3fa('0x78')]=_0x112c8d;_0x4d27a5['applications']=_[_0xe3fa('0x79')](_0x112c8d[_0xe3fa('0x77')],[_0xe3fa('0x7a')],[_0xe3fa('0x7b')]);if(_0x4d27a5[_0xe3fa('0x78')][_0xe3fa('0x77')]){delete _0x4d27a5[_0xe3fa('0x78')][_0xe3fa('0x77')];}return db['CmContact'][_0xe3fa('0x6b')]();})[_0xe3fa('0x25')](function(_0x48faf3){if(!_0x48faf3){throw new db[(_0xe3fa('0x7c'))][(_0xe3fa('0x7d'))](_0xe3fa('0x7e'));}_0x330aa0=_[_0xe3fa('0x7f')](_[_0xe3fa('0x49')](_0x48faf3),[_0xe3fa('0x80'),'updatedAt']);_0x3dbe54=_[_0xe3fa('0x7f')](_[_0xe3fa('0x49')](_0x48faf3),[_0xe3fa('0x80'),_0xe3fa('0x81'),'CompanyId',_0xe3fa('0x82')]);_0x4d27a5[_0xe3fa('0x62')]={'mapKey':_0xe3fa('0x83')};if(_0x4d27a5[_0xe3fa('0x78')][_0xe3fa('0x57')]){switch(_0x4d27a5[_0xe3fa('0x78')][_0xe3fa('0x57')]){case'twilio':_0x4d27a5['body'][_0xe3fa('0x84')]=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x85')];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x62')]=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x86')];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x87')]=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x88')];break;case'skebby':_0x4d27a5['body'][_0xe3fa('0x84')]='+'+_0x2e9aa9[_0xe3fa('0x62')]['sender'];_0x4d27a5[_0xe3fa('0x62')]['body']=_0x2e9aa9['body'][_0xe3fa('0x89')];break;case _0xe3fa('0x8a'):_0x4d27a5[_0xe3fa('0x62')]['from']=_0x2e9aa9[_0xe3fa('0x62')]['from'];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x62')]=_0x2e9aa9['body'][_0xe3fa('0x2c')];break;case _0xe3fa('0x8b'):_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x84')]=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x84')];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x62')]=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x62')];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x87')]=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x8c')];break;case'plivo':_0x4d27a5['body'][_0xe3fa('0x84')]=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x85')];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x62')]=_0x2e9aa9[_0xe3fa('0x62')]['Text'];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x87')]=_0x2e9aa9['body'][_0xe3fa('0x8d')];break;case _0xe3fa('0x8e'):_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x84')]='+'+_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x8f')][0x0][_0xe3fa('0x84')];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x62')]=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x8f')][0x0][_0xe3fa('0x89')];_0x4d27a5['body']['messageId']=_0x2e9aa9['body']['results'][0x0]['messageId'];break;case _0xe3fa('0x90'):_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x84')]=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x91')];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x62')]=_0x2e9aa9[_0xe3fa('0x62')]['segmentedMessage']['message'];break;case'clickatell':_0x4d27a5['body']['from']=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x92')];_0x4d27a5['body'][_0xe3fa('0x62')]=_0x2e9aa9['body'][_0xe3fa('0x89')];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x87')]=_0x2e9aa9[_0xe3fa('0x62')]['replyMessageId'];break;case _0xe3fa('0x93'):_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x87')]=_0x2e9aa9[_0xe3fa('0x62')][0x0][_0xe3fa('0x2c')]['id'];_0x4d27a5[_0xe3fa('0x62')]['from']=_0x2e9aa9[_0xe3fa('0x62')][0x0][_0xe3fa('0x2c')][_0xe3fa('0x84')];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x62')]=_0x2e9aa9['body'][0x0][_0xe3fa('0x2c')][_0xe3fa('0x89')];break;case _0xe3fa('0x94'):_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x84')]=_0x2e9aa9[_0xe3fa('0x62')]['from'];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x62')]=_0x2e9aa9[_0xe3fa('0x62')]['message'];_0x4d27a5['body'][_0xe3fa('0x87')]=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x95')];break;}}if(_0x4d27a5[_0xe3fa('0x62')]['id']){delete _0x4d27a5[_0xe3fa('0x62')]['id'];}if(_[_0xe3fa('0x96')](_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x84')])){throw new db[(_0xe3fa('0x7c'))][(_0xe3fa('0x7d'))](_0xe3fa('0x97'));}if(_['isNil'](_0x4d27a5['body'][_0xe3fa('0x62')])||_0x4d27a5['body'][_0xe3fa('0x62')]===''){throw new db[(_0xe3fa('0x7c'))][(_0xe3fa('0x7d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe3fa('0x96')](_0x4d27a5['body'][_0xe3fa('0x98')])){throw new db[(_0xe3fa('0x7c'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3dbe54);}if(!_['includes'](_0x3dbe54,_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x98')])){throw new db[(_0xe3fa('0x7c'))][(_0xe3fa('0x7d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3dbe54);}_0x255f38[_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x98')]]=_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x84')];return db[_0xe3fa('0x99')][_0xe3fa('0x60')]({'where':{'id':_0x4d27a5['account'][_0xe3fa('0x82')]},'include':[{'model':db[_0xe3fa('0x9a')],'as':_0xe3fa('0x9b'),'where':_0x255f38,'limit':0x1,'order':[[_0xe3fa('0x81'),_0xe3fa('0x9c')]]}]});})[_0xe3fa('0x25')](handleEntityNotFound(_0x47a33f,null))[_0xe3fa('0x25')](function(_0x241f4c){if(_0x241f4c){_0x4d27a5['list']=_[_0xe3fa('0x9d')](_0x241f4c,[_0xe3fa('0x9b')]);if(_0x241f4c['Contacts'][_0xe3fa('0x5e')]){return _0x241f4c[_0xe3fa('0x9b')][0x0];}var _0x588cdb=_[_0xe3fa('0x1c')](_0x4d27a5[_0xe3fa('0x62')],{'firstName':_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x84')],'ListId':_0x241f4c['id']});_0x588cdb[_0x4d27a5['body']['mapKey']]=_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x84')];return db[_0xe3fa('0x9a')][_0xe3fa('0x61')](_0x588cdb,{'fields':_0x330aa0,'raw':!![]});}})[_0xe3fa('0x25')](handleEntityNotFound(_0x47a33f,null))[_0xe3fa('0x25')](function(_0x3f33dd){if(_0x3f33dd){_0x4d27a5['contact']=_0x3f33dd;var _0x14b151={'ContactId':_0x3f33dd['id'],'phone':_0x4d27a5[_0xe3fa('0x62')]['from'],'SmsAccountId':_0x2e9aa9[_0xe3fa('0x5d')]['id']};var _0x34536e={'ContactId':_0x3f33dd['id'],'SmsAccountId':_0x2e9aa9[_0xe3fa('0x5d')]['id'],'closed':![]};return db[_0xe3fa('0x9e')][_0xe3fa('0x60')]({'where':_0x34536e})[_0xe3fa('0x25')](function(_0x1bedcd){if(_0x1bedcd){return[_0x1bedcd,![]];}return db['SmsInteraction'][_0xe3fa('0x61')](_0x14b151)['then'](function(_0x13a6fd){return[_0x13a6fd,!![]];});});}})[_0xe3fa('0x9f')](function(_0x488d23,_0x5900f8){_0x4d27a5['interaction']=_0x488d23[_0xe3fa('0x66')]({'plain':!![]});_0x4d27a5[_0xe3fa('0xa0')][_0xe3fa('0xa1')]=![];if(_0x5900f8){if(_0x4d27a5['account'][_0xe3fa('0xa2')]){_0x4d27a5[_0xe3fa('0xa3')][_0xe3fa('0xa4')]({'id':0x0,'priority':_0x4d27a5[_0xe3fa('0xa3')]['length']+0x1,'app':_0xe3fa('0xa5'),'appdata':'unmanaged','interval':_0xe3fa('0xa6')});}_0x4d27a5[_0xe3fa('0xa0')][_0xe3fa('0xa1')]=!![];}return db[_0xe3fa('0xa7')][_0xe3fa('0x61')]({'phone':_0x4d27a5['body']['from'],'messageId':_0x4d27a5['body']['messageId'],'body':_0x4d27a5[_0xe3fa('0x62')]['body'],'SmsAccountId':_0x2e9aa9['params']['id'],'SmsInteractionId':_0x488d23['id'],'direction':'in','ContactId':_0x488d23[_0xe3fa('0xa8')],'AttachmentId':_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0xa9')]});})[_0xe3fa('0x25')](function(_0x24e4cc){_0x4d27a5[_0xe3fa('0x2c')]=_0x24e4cc;if(_0x4d27a5[_0xe3fa('0xa0')]['UserId']){return db['User'][_0xe3fa('0x60')]({'attributes':['id',_0xe3fa('0x3e')],'where':{'id':_0x4d27a5['interaction'][_0xe3fa('0xaa')]}})[_0xe3fa('0x25')](function(_0x1d851f){if(_0x1d851f){_0x4d27a5['applications'][_0xe3fa('0xab')]({'id':0x0,'priority':0x0,'app':_0xe3fa('0xac'),'appdata':_0x1d851f[_0xe3fa('0x3e')]+','+(_0x4d27a5[_0xe3fa('0x78')][_0xe3fa('0xad')]||0xa),'interval':_0xe3fa('0xa6')});}return respondWithRpcPromise('Start',_0xe3fa('0xae'),_0x4d27a5);});}return respondWithRpcPromise('Start',_0xe3fa('0xae'),_0x4d27a5);})['then'](function(_0x539c3d){if(_0x539c3d){var _0x3ed522=0xc8;var _0x27ae83=_0xe3fa('0xaf');logger[_0xe3fa('0x26')](_0xe3fa('0x2a'),_0x27ae83,_0x3ed522,_0xe3fa('0xb0'));logger[_0xe3fa('0x29')](_0xe3fa('0xb1'),_0x27ae83,_0x3ed522,'entity\x20found',JSON['stringify'](_0x539c3d));if(_0x4d27a5[_0xe3fa('0x78')]['type']===_0xe3fa('0xb2')){return _0x47a33f[_0xe3fa('0x30')](_0x3ed522)[_0xe3fa('0x34')](_0xe3fa('0xb3'),_0xe3fa('0xb4'))[_0xe3fa('0x3f')](_0xe3fa('0xb5'));}else{return _0x47a33f[_0xe3fa('0x30')](_0x3ed522)[_0xe3fa('0x31')](_0x539c3d);}}})['catch'](handleError(_0x47a33f,null));};exports[_0xe3fa('0xb6')]=function(_0x5a9eda,_0x2c83a8,_0x237dd9){return db[_0xe3fa('0x44')][_0xe3fa('0x70')]({'where':{'id':_0x5a9eda['params']['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0x2c83a8,null))[_0xe3fa('0x25')](function(_0x50b42e){if(_0x50b42e){return db[_0xe3fa('0xb7')][_0xe3fa('0xb8')](function(_0x11bf48){return db['SmsApplication'][_0xe3fa('0x39')]({'where':{'SmsAccountId':_0x5a9eda[_0xe3fa('0x5d')]['id']},'transaction':_0x11bf48})[_0xe3fa('0x25')](function(_0x3ffa8d){var _0x44b10e=_[_0xe3fa('0x43')](_0x5a9eda[_0xe3fa('0x62')],function(_0x2d066d){_0x2d066d['SmsAccountId']=_0x5a9eda[_0xe3fa('0x5d')]['id'];return _0x2d066d;});return db[_0xe3fa('0x76')][_0xe3fa('0xb9')](_0x44b10e,{'transaction':_0x11bf48});});})[_0xe3fa('0x25')](function(){return db['SmsApplication'][_0xe3fa('0xba')]({'where':{'SmsAccountId':_0x5a9eda[_0xe3fa('0x5d')]['id']},'order':_0xe3fa('0x7a')});});}})[_0xe3fa('0x25')](respondWithResult(_0x2c83a8,null))['catch'](handleError(_0x2c83a8,null));};exports['getApplications']=function(_0xac6844,_0x3c52f7,_0x464812){var _0x34cb38={};var _0x2282ec={};var _0x142d8b;var _0x15eea4;return db[_0xe3fa('0x44')][_0xe3fa('0x70')]({'where':{'id':_0xac6844['params']['id']}})['then'](handleEntityNotFound(_0x3c52f7,null))[_0xe3fa('0x25')](function(_0xc1a6bc){if(_0xc1a6bc){_0x142d8b=_0xc1a6bc;_0x2282ec[_0xe3fa('0x47')]=_[_0xe3fa('0x49')](db[_0xe3fa('0x76')][_0xe3fa('0x45')]);_0x2282ec['query']=_[_0xe3fa('0x49')](_0xac6844[_0xe3fa('0x48')]);_0x2282ec['filters']=_['intersection'](_0x2282ec['model'],_0x2282ec[_0xe3fa('0x48')]);_0x34cb38['attributes']=_['intersection'](_0x2282ec[_0xe3fa('0x47')],qs[_0xe3fa('0x4d')](_0xac6844[_0xe3fa('0x48')]['fields']));_0x34cb38[_0xe3fa('0x4c')]=_0x34cb38[_0xe3fa('0x4c')][_0xe3fa('0x5e')]?_0x34cb38['attributes']:_0x2282ec[_0xe3fa('0x47')];_0x34cb38[_0xe3fa('0x51')]=qs[_0xe3fa('0x52')](_0xac6844[_0xe3fa('0x48')][_0xe3fa('0x52')]);_0x34cb38['where']=qs[_0xe3fa('0x4a')](_['pick'](_0xac6844[_0xe3fa('0x48')],_0x2282ec[_0xe3fa('0x4a')]));if(_0xac6844['query'][_0xe3fa('0x54')]){_0x34cb38[_0xe3fa('0x56')]=_[_0xe3fa('0x55')](_0x34cb38[_0xe3fa('0x56')],{'$or':_[_0xe3fa('0x43')](_0x34cb38[_0xe3fa('0x4c')],function(_0x39a6e5){var _0x13df29={};_0x13df29[_0x39a6e5]={'$like':'%'+_0xac6844['query'][_0xe3fa('0x54')]+'%'};return _0x13df29;})});}_0x34cb38=_['merge']({},_0x34cb38,_0xac6844[_0xe3fa('0x59')]);return _0x142d8b['getApplications'](_0x34cb38);}})['then'](function(_0x392b1e){if(_0x392b1e){_0x15eea4=_0x392b1e[_0xe3fa('0x5e')];if(!_0xac6844['query'][_0xe3fa('0x4e')]('nolimit')){_0x34cb38[_0xe3fa('0x50')]=qs['limit'](_0xac6844[_0xe3fa('0x48')]['limit']);_0x34cb38[_0xe3fa('0x33')]=qs['offset'](_0xac6844[_0xe3fa('0x48')][_0xe3fa('0x33')]);}return _0x142d8b[_0xe3fa('0xbb')](_0x34cb38);}})[_0xe3fa('0x25')](function(_0x515fac){if(_0x515fac){return _0x515fac?{'count':_0x15eea4,'rows':_0x515fac}:null;}})[_0xe3fa('0x25')](respondWithResult(_0x3c52f7,null))['catch'](handleError(_0x3c52f7,null));};exports['getInteractions']=function(_0x4aabe0,_0x51fe5d,_0x1be9a2){var _0x14e2f4={'raw':![],'where':{}};var _0x3a0f1b={};var _0x581895={'count':0x0,'rows':[]};return db['SmsAccount'][_0xe3fa('0x70')]({'where':{'id':_0x4aabe0[_0xe3fa('0x5d')]['id']}})['then'](handleEntityNotFound(_0x51fe5d,null))['then'](function(_0x26160b){if(_0x26160b){_0x3a0f1b['model']=_[_0xe3fa('0x49')](db[_0xe3fa('0x9e')][_0xe3fa('0x45')]);_0x3a0f1b['query']=_['keys'](_0x4aabe0['query']);_0x3a0f1b[_0xe3fa('0x4a')]=_['intersection'](_0x3a0f1b[_0xe3fa('0x47')],_0x3a0f1b[_0xe3fa('0x48')]);_0x14e2f4[_0xe3fa('0x4c')]=_[_0xe3fa('0x4b')](_0x3a0f1b[_0xe3fa('0x47')],qs[_0xe3fa('0x4d')](_0x4aabe0[_0xe3fa('0x48')][_0xe3fa('0x4d')]));_0x14e2f4[_0xe3fa('0x4c')]=_0x14e2f4['attributes']['length']?_0x14e2f4['attributes']:_0x3a0f1b[_0xe3fa('0x47')];if(!_0x4aabe0['query'][_0xe3fa('0x4e')](_0xe3fa('0x4f'))){_0x14e2f4[_0xe3fa('0x50')]=qs['limit'](_0x4aabe0[_0xe3fa('0x48')][_0xe3fa('0x50')]);_0x14e2f4['offset']=qs[_0xe3fa('0x33')](_0x4aabe0[_0xe3fa('0x48')][_0xe3fa('0x33')]);}_0x14e2f4['order']=qs[_0xe3fa('0x52')](_0x4aabe0['query'][_0xe3fa('0x52')]);_0x14e2f4[_0xe3fa('0x56')]=qs[_0xe3fa('0x4a')](_[_0xe3fa('0x53')](_0x4aabe0[_0xe3fa('0x48')],_0x3a0f1b[_0xe3fa('0x4a')]));_0x14e2f4[_0xe3fa('0x56')][_0xe3fa('0x6c')]=_0x26160b['id'];if(_0x4aabe0[_0xe3fa('0x48')][_0xe3fa('0x54')]){_0x14e2f4[_0xe3fa('0x56')]=_[_0xe3fa('0x55')](_0x14e2f4[_0xe3fa('0x56')],{'$or':_['map'](_0x14e2f4[_0xe3fa('0x4c')],function(_0x486e88){var _0x2be679={};_0x2be679[_0x486e88]={'$like':'%'+_0x4aabe0[_0xe3fa('0x48')][_0xe3fa('0x54')]+'%'};return _0x2be679;})});}_0x14e2f4=_[_0xe3fa('0x55')]({},_0x14e2f4,_0x4aabe0['options']);return db[_0xe3fa('0x9e')][_0xe3fa('0x32')]({'where':_0x14e2f4[_0xe3fa('0x56')]})['then'](function(_0xfaf187){_0x581895['count']=_0xfaf187;if(_0x4aabe0['query'][_0xe3fa('0x5f')]){_0x14e2f4['include']=[{'model':db[_0xe3fa('0x9a')],'as':_0xe3fa('0xbc'),'required':![]},{'model':db[_0xe3fa('0xbd')],'as':_0xe3fa('0xbe'),'attributes':['name',_0xe3fa('0xbf'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xe3fa('0xc0'),'attributes':['id',_0xe3fa('0x3e'),_0xe3fa('0xc1')],'where':_0x4aabe0[_0xe3fa('0x48')][_0xe3fa('0xc2')]?{'id':_0x4aabe0['query'][_0xe3fa('0xc2')]}:undefined,'required':_0x4aabe0['query']['tag']?!![]:![]}];}return db[_0xe3fa('0x9e')][_0xe3fa('0x72')](_0x14e2f4);})[_0xe3fa('0x25')](function(_0x5dfbcd){_0x581895['rows']=_0x5dfbcd;return _0x581895;});}})[_0xe3fa('0x25')](respondWithFilteredResult(_0x51fe5d,_0x14e2f4))['catch'](handleError(_0x51fe5d,null));};exports[_0xe3fa('0x3f')]=function(_0x4bb8aa,_0x20d064,_0x29328f){var _0x316ec4,_0x585910,_0x4a4f30;if(_[_0xe3fa('0x96')](_0x4bb8aa[_0xe3fa('0x62')][_0xe3fa('0x62')])||_0x4bb8aa[_0xe3fa('0x62')][_0xe3fa('0x62')]===''){throw new db[(_0xe3fa('0x7c'))]['ValidationError'](_0xe3fa('0xc3'));}if(_[_0xe3fa('0x96')](_0x4bb8aa['body']['to'])){throw new db[(_0xe3fa('0x7c'))][(_0xe3fa('0x7d'))](_0xe3fa('0xc4'));}_0x316ec4=_0x4bb8aa[_0xe3fa('0x62')]['to'];return db['SmsAccount']['find']({'where':{'id':_0x4bb8aa[_0xe3fa('0x5d')]['id']},'include':[{'model':db['CmList'],'as':_0xe3fa('0xc5'),'include':[{'model':db[_0xe3fa('0x9a')],'as':_0xe3fa('0x9b'),'where':{'mobile':_0x316ec4},'limit':0x1,'order':[['updatedAt',_0xe3fa('0x9c')]]}]}]})[_0xe3fa('0x25')](handleEntityNotFound(_0x20d064,null))[_0xe3fa('0x25')](function(_0x5a680e){if(_0x5a680e&&_0x5a680e['List']){_0x585910=_0x5a680e['get']({'plain':!![]});if(_0x585910[_0xe3fa('0xc5')]&&_0x585910[_0xe3fa('0xc5')]['Contacts'][_0xe3fa('0x5e')]){return _0x585910[_0xe3fa('0xc5')][_0xe3fa('0x9b')][0x0];}return db[_0xe3fa('0x9a')]['create'](_[_0xe3fa('0x1c')](_0x4bb8aa[_0xe3fa('0x62')],{'firstName':_0x316ec4,'mobile':_0x316ec4,'phone':_0x316ec4,'ListId':_0x585910[_0xe3fa('0x82')]}));}})['then'](handleEntityNotFound(_0x20d064,null))[_0xe3fa('0x25')](function(_0x358147){if(_0x358147){_0x4a4f30=_0x358147;return db[_0xe3fa('0x9e')][_0xe3fa('0x60')]({'where':{'ContactId':_0x4a4f30['id'],'closed':![],'SmsAccountId':_0x585910['id']}})['then'](function(_0x4ab962){if(_0x4ab962){return[_0x4ab962,![]];}return db[_0xe3fa('0x9e')][_0xe3fa('0x61')]({'UserId':_0x4bb8aa[_0xe3fa('0x65')]['id'],'ContactId':_0x4a4f30['id'],'SmsAccountId':_0x585910['id'],'phone':_0x316ec4,'firstMsgDirection':'out','Messages':[_[_0xe3fa('0x55')](_0x4bb8aa[_0xe3fa('0x62')],{'read':![],'body':_0x4bb8aa[_0xe3fa('0x62')][_0xe3fa('0x62')],'phone':_0x316ec4,'SmsAccountId':_0x585910['id'],'UserId':_0x4bb8aa[_0xe3fa('0x65')]['id'],'ContactId':_0x4a4f30['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xe3fa('0xc6')}]})[_0xe3fa('0x25')](function(_0x582bdd){return[_0x582bdd,!![]];});});}})[_0xe3fa('0x9f')](function(_0x374cd8,_0x3af786){if(_0x3af786){return _0x374cd8;}return db[_0xe3fa('0xa7')][_0xe3fa('0x61')](_[_0xe3fa('0x55')](_0x4bb8aa[_0xe3fa('0x62')],{'read':![],'body':_0x4bb8aa[_0xe3fa('0x62')][_0xe3fa('0x62')],'phone':_0x316ec4,'SmsAccountId':_0x585910['id'],'SmsInteractionId':_0x374cd8['id'],'UserId':_0x4bb8aa[_0xe3fa('0x65')]['id'],'ContactId':_0x4a4f30['id']}))[_0xe3fa('0x25')](function(_0x3eeaf0){_0x374cd8[_0xe3fa('0xc7')][_0xe3fa('0xc6')]=[];_0x374cd8['dataValues'][_0xe3fa('0xc6')][_0xe3fa('0xa4')](_0x3eeaf0[_0xe3fa('0xc7')]);return _0x374cd8;});})['then'](respondWithResult(_0x20d064,null))[_0xe3fa('0x2e')](handleError(_0x20d064,null));};exports[_0xe3fa('0x30')]=function(_0x3fd6d5,_0x598312,_0x4a2e84){if(_0x3fd6d5['body']['id']){delete _0x3fd6d5[_0xe3fa('0x62')]['id'];}var _0x14075c,_0x1cd5f8,_0x5cc4f7;return db[_0xe3fa('0x44')][_0xe3fa('0x60')]({'where':{'id':_0x3fd6d5[_0xe3fa('0x5d')]['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0x598312,null))[_0xe3fa('0x25')](function(_0x1db48f){if(_0x1db48f){_0x5cc4f7=_0x1db48f;logger['debug'](_0xe3fa('0x2a'),_0xe3fa('0x30'),_0xe3fa('0xc8'),_0x1db48f[_0xe3fa('0x57')],util[_0xe3fa('0xc9')](_0x3fd6d5[_0xe3fa('0x62')],{'showHidden':![],'depth':null}));switch(_0x1db48f[_0xe3fa('0x57')]){case _0xe3fa('0xca'):if(_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0xcb')]&&_0x3fd6d5['body'][_0xe3fa('0x30')]){_0x1cd5f8=_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0x30')];return db[_0xe3fa('0xa7')]['find']({'where':{'messageId':_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0xcb')]}});}break;case _0xe3fa('0x8a'):if(_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0xcc')]&&_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0xcd')]){_0x1cd5f8=_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0xcd')];return db[_0xe3fa('0xa7')][_0xe3fa('0x60')]({'where':{'messageId':_0x3fd6d5[_0xe3fa('0x62')]['requestid']}});}break;case _0xe3fa('0x8b'):if(_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0x8c')]&&_0x3fd6d5[_0xe3fa('0x62')]['status_code']){_0x1cd5f8=_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0xce')];return db[_0xe3fa('0xa7')][_0xe3fa('0x60')]({'where':{'messageId':_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0x8c')]}});}break;case'infobip':var _0x291fad=_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0x8f')][0x0];if(_0x291fad[_0xe3fa('0x87')]&&_0x291fad[_0xe3fa('0x30')]['groupName']==='DELIVERED'){_0x1cd5f8=_0x291fad[_0xe3fa('0x30')]['groupName'];return db['SmsMessage']['find']({'where':{'messageId':_0x291fad[_0xe3fa('0x87')]}});}break;case'clickatell':if(_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0x87')]&&_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0x30')]){_0x1cd5f8=_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0x30')];return db[_0xe3fa('0xa7')]['find']({'where':{'messageId':_0x3fd6d5['body']['messageId']}});}break;case _0xe3fa('0x93'):if(_0x3fd6d5[_0xe3fa('0x62')][0x0][_0xe3fa('0x2c')]['id']){_0x1cd5f8=_0x3fd6d5[_0xe3fa('0x62')][0x0][_0xe3fa('0x57')];return db[_0xe3fa('0xa7')][_0xe3fa('0x60')]({'where':{'messageId':_0x3fd6d5['body'][0x0]['message']['id']}});}break;case _0xe3fa('0x94'):if(_0x3fd6d5['body'][_0xe3fa('0xcf')]&&_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0x30')]){_0x1cd5f8=_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0x30')];return db['SmsMessage']['find']({'where':{'messageId':_0x3fd6d5['body'][_0xe3fa('0xcf')]}});}break;}}})[_0xe3fa('0x25')](handleEntityNotFound(_0x598312,null))['then'](function(_0x2c4a1d){if(_0x2c4a1d){_0x14075c=_0x2c4a1d;switch(_0x5cc4f7[_0xe3fa('0x57')]){case'skebby':if(_0x1cd5f8===_0xe3fa('0xd0')){return _0x14075c[_0xe3fa('0x6a')]({'read':!![]});}else{logger[_0xe3fa('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe3fa('0x30'),_0xe3fa('0xca'),util[_0xe3fa('0xc9')](_0x3fd6d5[_0xe3fa('0x62')],{'showHidden':![],'depth':null}));}break;case _0xe3fa('0x8a'):if(_0x1cd5f8==='1'){return _0x14075c[_0xe3fa('0x6a')]({'read':!![]});}else{logger[_0xe3fa('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe3fa('0x30'),_0xe3fa('0xca'),util[_0xe3fa('0xc9')](_0x3fd6d5[_0xe3fa('0x62')],{'showHidden':![],'depth':null}));}break;case _0xe3fa('0x8b'):if(!_0x3fd6d5['body'][_0xe3fa('0xd1')]&&_0x1cd5f8>=0xc8&&_0x1cd5f8<=0xce){return _0x14075c[_0xe3fa('0x6a')]({'read':!![]});}else{logger[_0xe3fa('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe3fa('0x30'),_0xe3fa('0x8b'),util[_0xe3fa('0xc9')](_0x3fd6d5[_0xe3fa('0x62')],{'showHidden':![],'depth':null}));}break;case _0xe3fa('0x8e'):var _0x1fbf59=_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0x8f')][0x0];if(_0x1fbf59[_0xe3fa('0x30')][_0xe3fa('0xd2')]==='DELIVERED'){return _0x14075c[_0xe3fa('0x6a')]({'read':!![]});}else{logger['error'](_0xe3fa('0x2a'),'status',_0xe3fa('0x8e'),util[_0xe3fa('0xc9')](_0x3fd6d5[_0xe3fa('0x62')],{'showHidden':![],'depth':null}));}break;case _0xe3fa('0xd3'):if(_0x1cd5f8==_0xe3fa('0xd4')||_0x1cd5f8==_0xe3fa('0xd5')){return _0x14075c[_0xe3fa('0x6a')]({'read':!![]});}else{logger[_0xe3fa('0x2b')](_0xe3fa('0x2a'),_0xe3fa('0x30'),_0xe3fa('0xd3'),util[_0xe3fa('0xc9')](_0x3fd6d5[_0xe3fa('0x62')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x1cd5f8=='message-delivered'){return _0x14075c[_0xe3fa('0x6a')]({'read':!![]});}else{logger[_0xe3fa('0x2b')](_0xe3fa('0x2a'),_0xe3fa('0x30'),_0xe3fa('0x93'),util[_0xe3fa('0xc9')](_0x3fd6d5[_0xe3fa('0x62')],{'showHidden':![],'depth':null}));}break;case _0xe3fa('0x94'):if(_0x1cd5f8==='DELIVRD'||_0x1cd5f8===_0xe3fa('0xd6')){return _0x14075c['update']({'read':!![]});}else{logger[_0xe3fa('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe3fa('0x30'),_0xe3fa('0x94'),util['inspect'](_0x3fd6d5[_0xe3fa('0x62')],{'showHidden':![],'depth':null}));}break;}return _0x14075c;}})[_0xe3fa('0x25')](respondWithResult(_0x598312,null))[_0xe3fa('0x2e')](handleError(_0x598312,null));};exports['statusGet']=function(_0x3a78a8,_0x50df5e,_0x33e7a9){var _0x19dc26,_0x3a10b9,_0x535923;return db['SmsAccount']['find']({'where':{'id':_0x3a78a8[_0xe3fa('0x5d')]['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0x50df5e,null))[_0xe3fa('0x25')](function(_0x472a10){if(_0x472a10){_0x535923=_0x472a10;logger[_0xe3fa('0x29')](_0xe3fa('0x2a'),_0xe3fa('0x30'),_0xe3fa('0xc8'),_0x472a10[_0xe3fa('0x57')],util[_0xe3fa('0xc9')](_0x3a78a8[_0xe3fa('0x48')],{'showHidden':![],'depth':null}));switch(_0x472a10[_0xe3fa('0x57')]){case _0xe3fa('0x90'):if(_0x3a78a8[_0xe3fa('0x48')][_0xe3fa('0xd7')]&&_0x3a78a8[_0xe3fa('0x48')][_0xe3fa('0xd8')]){_0x3a10b9=_0x3a78a8[_0xe3fa('0x48')]['state'];return db[_0xe3fa('0xa7')]['find']({'where':{'messageId':_0x3a78a8[_0xe3fa('0x48')]['message-id']}});}break;}}})[_0xe3fa('0x25')](handleEntityNotFound(_0x50df5e,null))[_0xe3fa('0x25')](function(_0x1930ba){if(_0x1930ba){_0x19dc26=_0x1930ba;switch(_0x535923[_0xe3fa('0x57')]){case _0xe3fa('0x90'):if(_0x3a10b9==='2'||_0x3a10b9==='6'){return _0x19dc26[_0xe3fa('0x6a')]({'read':!![]});}else{logger[_0xe3fa('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xe3fa('0x90'),util[_0xe3fa('0xc9')](_0x3a78a8['query'],{'showHidden':![],'depth':null}));};break;}return _0x19dc26;}})[_0xe3fa('0x25')](respondWithResult(_0x50df5e,null))[_0xe3fa('0x2e')](handleError(_0x50df5e,null));};exports[_0xe3fa('0xd9')]=function(_0x46df64,_0x589ded,_0x4546d4){return db[_0xe3fa('0x44')]['find']({'where':{'id':_0x46df64[_0xe3fa('0x5d')]['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0x589ded,null))[_0xe3fa('0x25')](function(_0x184c31){if(_0x184c31){return _0x184c31[_0xe3fa('0xd9')](_0x46df64[_0xe3fa('0x62')][_0xe3fa('0x74')],_[_0xe3fa('0x9d')](_0x46df64[_0xe3fa('0x62')],[_0xe3fa('0x74'),'id'])||{})[_0xe3fa('0x9f')](function(_0x415c4b){for(var _0x186d00=0x0;_0x186d00<_0x46df64[_0xe3fa('0x62')][_0xe3fa('0x74')]['length'];_0x186d00+=0x1){socket[_0xe3fa('0xda')](_0xe3fa('0xdb'),{'UserId':_0x46df64[_0xe3fa('0x62')][_0xe3fa('0x74')][_0x186d00],'SmsAccountId':_0x46df64[_0xe3fa('0x5d')]['id']});}return _0x415c4b;});}})[_0xe3fa('0x25')](respondWithResult(_0x589ded,null))[_0xe3fa('0x2e')](handleError(_0x589ded,null));};exports[_0xe3fa('0xdc')]=function(_0xd490bc,_0xb7afa,_0xb9bf59){return db['SmsAccount']['find']({'where':{'id':_0xd490bc[_0xe3fa('0x5d')]['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0xb7afa,null))[_0xe3fa('0x25')](function(_0x51f237){if(_0x51f237){return _0x51f237[_0xe3fa('0xdc')](_0xd490bc[_0xe3fa('0x48')][_0xe3fa('0x74')])['then'](function(){if(_[_0xe3fa('0xdd')](_0xd490bc[_0xe3fa('0x48')]['ids'])){for(var _0x2527f3=0x0;_0x2527f3<_0xd490bc['query'][_0xe3fa('0x74')][_0xe3fa('0x5e')];_0x2527f3+=0x1){socket[_0xe3fa('0xda')](_0xe3fa('0xde'),{'UserId':Number(_0xd490bc[_0xe3fa('0x48')][_0xe3fa('0x74')][_0x2527f3]),'SmsAccountId':Number(_0xd490bc[_0xe3fa('0x5d')]['id'])});}}else{socket[_0xe3fa('0xda')](_0xe3fa('0xde'),{'UserId':Number(_0xd490bc[_0xe3fa('0x48')][_0xe3fa('0x74')]),'SmsAccountId':Number(_0xd490bc['params']['id'])});}});}})[_0xe3fa('0x25')](respondWithStatusCode(_0xb7afa,null))[_0xe3fa('0x2e')](handleError(_0xb7afa,null));};exports[_0xe3fa('0xdf')]=function(_0xc5aad8,_0x1dac95,_0x22bf37){var _0x59cf61={};var _0x5978a5={};var _0x45d88e;var _0x48afb6;return db[_0xe3fa('0x44')]['findOne']({'where':{'id':_0xc5aad8[_0xe3fa('0x5d')]['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0x1dac95,null))[_0xe3fa('0x25')](function(_0x48aded){if(_0x48aded){_0x45d88e=_0x48aded;_0x5978a5[_0xe3fa('0x47')]=_[_0xe3fa('0x49')](db['User'][_0xe3fa('0x45')]);_0x5978a5['query']=_[_0xe3fa('0x49')](_0xc5aad8[_0xe3fa('0x48')]);_0x5978a5[_0xe3fa('0x4a')]=_[_0xe3fa('0x4b')](_0x5978a5[_0xe3fa('0x47')],_0x5978a5[_0xe3fa('0x48')]);_0x59cf61[_0xe3fa('0x4c')]=_['intersection'](_0x5978a5[_0xe3fa('0x47')],qs[_0xe3fa('0x4d')](_0xc5aad8['query']['fields']));_0x59cf61[_0xe3fa('0x4c')]=_0x59cf61[_0xe3fa('0x4c')][_0xe3fa('0x5e')]?_0x59cf61[_0xe3fa('0x4c')]:_0x5978a5[_0xe3fa('0x47')];_0x59cf61['order']=qs[_0xe3fa('0x52')](_0xc5aad8[_0xe3fa('0x48')][_0xe3fa('0x52')]);_0x59cf61[_0xe3fa('0x56')]=qs[_0xe3fa('0x4a')](_[_0xe3fa('0x53')](_0xc5aad8[_0xe3fa('0x48')],_0x5978a5[_0xe3fa('0x4a')]));if(_0xc5aad8[_0xe3fa('0x48')][_0xe3fa('0x54')]){_0x59cf61[_0xe3fa('0x56')]=_[_0xe3fa('0x55')](_0x59cf61[_0xe3fa('0x56')],{'$or':_[_0xe3fa('0x43')](_0x59cf61['attributes'],function(_0x3bfef7){var _0x571bc1={};_0x571bc1[_0x3bfef7]={'$like':'%'+_0xc5aad8['query'][_0xe3fa('0x54')]+'%'};return _0x571bc1;})});}_0x59cf61=_[_0xe3fa('0x55')]({},_0x59cf61,_0xc5aad8[_0xe3fa('0x59')]);return _0x45d88e[_0xe3fa('0xdf')](_0x59cf61);}})[_0xe3fa('0x25')](function(_0x5599ef){if(_0x5599ef){_0x48afb6=_0x5599ef[_0xe3fa('0x5e')];if(!_0xc5aad8[_0xe3fa('0x48')][_0xe3fa('0x4e')](_0xe3fa('0x4f'))){_0x59cf61[_0xe3fa('0x50')]=qs[_0xe3fa('0x50')](_0xc5aad8[_0xe3fa('0x48')][_0xe3fa('0x50')]);_0x59cf61[_0xe3fa('0x33')]=qs[_0xe3fa('0x33')](_0xc5aad8[_0xe3fa('0x48')][_0xe3fa('0x33')]);}return _0x45d88e[_0xe3fa('0xdf')](_0x59cf61);}})['then'](function(_0xbfc7ef){if(_0xbfc7ef){return _0xbfc7ef?{'count':_0x48afb6,'rows':_0xbfc7ef}:null;}})[_0xe3fa('0x25')](respondWithResult(_0x1dac95,null))['catch'](handleError(_0x1dac95,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 4f11ea3..925f436 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 _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 +var _0x2127=['SmsAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x49194a,_0x3b1c4e){var _0x2c14e6=function(_0x3f870e){while(--_0x3f870e){_0x49194a['push'](_0x49194a['shift']());}};_0x2c14e6(++_0x3b1c4e);}(_0x2127,0x12a));var _0x7212=function(_0xddb363,_0x5bf558){_0xddb363=_0xddb363-0x0;var _0x9c97e0=_0x2127[_0xddb363];return _0x9c97e0;};'use strict';var EventEmitter=require(_0x7212('0x0'));var SmsAccount=require(_0x7212('0x1'))['db'][_0x7212('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x7212('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7212('0x4'),'afterDestroy':_0x7212('0x5')};function emitEvent(_0x19d971){return function(_0x3b2dc2,_0x12d9a4,_0x2cc58c){SmsAccountEvents[_0x7212('0x6')](_0x19d971+':'+_0x3b2dc2['id'],_0x3b2dc2);SmsAccountEvents['emit'](_0x19d971,_0x3b2dc2);_0x2cc58c(null);};}for(var e in events){if(events[_0x7212('0x7')](e)){var event=events[e];SmsAccount[_0x7212('0x8')](e,emitEvent(event));}}module[_0x7212('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 15c17b1..cf25692 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 _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 +var _0x82ba=['util','../../config/logger','moment','bluebird','request-promise','path','./smsAccount.attributes','exports','sms_accounts','lodash'];(function(_0x49b887,_0x116827){var _0x334826=function(_0x2cef9b){while(--_0x2cef9b){_0x49b887['push'](_0x49b887['shift']());}};_0x334826(++_0x116827);}(_0x82ba,0x153));var _0xa82b=function(_0x4c5cfc,_0x4c3607){_0x4c5cfc=_0x4c5cfc-0x0;var _0x3ce4c8=_0x82ba[_0x4c5cfc];return _0x3ce4c8;};'use strict';var _=require(_0xa82b('0x0'));var util=require(_0xa82b('0x1'));var logger=require(_0xa82b('0x2'))('api');var moment=require(_0xa82b('0x3'));var BPromise=require(_0xa82b('0x4'));var rp=require(_0xa82b('0x5'));var fs=require('fs');var path=require(_0xa82b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa82b('0x7'));module[_0xa82b('0x8')]=function(_0xc9f3bf,_0x42854a){return _0xc9f3bf['define']('SmsAccount',attributes,{'tableName':_0xa82b('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 5a3c57f..348e2a5 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 _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 +var _0x9bdc=['error','message','SmsAccount','options','raw','where','attributes','include','model','map','ShowSmsAccount','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5b7f35,_0xbdcc40){var _0x477a99=function(_0x3c3d8e){while(--_0x3c3d8e){_0x5b7f35['push'](_0x5b7f35['shift']());}};_0x477a99(++_0xbdcc40);}(_0x9bdc,0xa0));var _0xc9bd=function(_0x101124,_0x5c5aee){_0x101124=_0x101124-0x0;var _0x1ac695=_0x9bdc[_0x101124];return _0x1ac695;};'use strict';var _=require(_0xc9bd('0x0'));var util=require(_0xc9bd('0x1'));var moment=require(_0xc9bd('0x2'));var BPromise=require(_0xc9bd('0x3'));var rs=require(_0xc9bd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9bd('0x5'))['db'];var utils=require(_0xc9bd('0x6'));var logger=require(_0xc9bd('0x7'))(_0xc9bd('0x8'));var config=require('../../config/environment');var jayson=require(_0xc9bd('0x9'));var client=jayson[_0xc9bd('0xa')][_0xc9bd('0xb')]({'port':0x232a});config[_0xc9bd('0xc')]=_[_0xc9bd('0xd')](config[_0xc9bd('0xc')],{'host':_0xc9bd('0xe'),'port':0x18eb});var socket=require(_0xc9bd('0xf'))(new Redis(config[_0xc9bd('0xc')]));require(_0xc9bd('0x10'))[_0xc9bd('0x11')](socket);function respondWithRpcPromise(_0x5af9a3,_0x4da18b,_0x1b253b){return new BPromise(function(_0x2d947c,_0x58baf0){return client[_0xc9bd('0x12')](_0x5af9a3,_0x1b253b)[_0xc9bd('0x13')](function(_0x48a466){logger[_0xc9bd('0x14')](_0xc9bd('0x15'),_0x4da18b,_0xc9bd('0x16'));logger[_0xc9bd('0x17')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4da18b,'request\x20sent',JSON[_0xc9bd('0x18')](_0x48a466));if(_0x48a466['error']){if(_0x48a466['error']['code']===0x1f4){logger[_0xc9bd('0x19')](_0xc9bd('0x15'),_0x4da18b,_0x48a466[_0xc9bd('0x19')][_0xc9bd('0x1a')]);return _0x58baf0(_0x48a466['error'][_0xc9bd('0x1a')]);}logger[_0xc9bd('0x19')](_0xc9bd('0x15'),_0x4da18b,_0x48a466[_0xc9bd('0x19')]['message']);return _0x2d947c(_0x48a466[_0xc9bd('0x19')][_0xc9bd('0x1a')]);}else{logger[_0xc9bd('0x14')](_0xc9bd('0x15'),_0x4da18b,_0xc9bd('0x16'));_0x2d947c(_0x48a466['result']['message']);}})['catch'](function(_0x576292){logger[_0xc9bd('0x19')]('SmsAccount,\x20%s,\x20%s',_0x4da18b,_0x576292);_0x58baf0(_0x576292);});});}exports['ShowSmsAccount']=function(_0x1691c1){var _0x46871b=this;return new Promise(function(_0x183493,_0x1c40f6){return db[_0xc9bd('0x1b')]['find']({'raw':_0x1691c1[_0xc9bd('0x1c')]?_0x1691c1['options'][_0xc9bd('0x1d')]===undefined?!![]:![]:!![],'where':_0x1691c1[_0xc9bd('0x1c')]?_0x1691c1['options'][_0xc9bd('0x1e')]||null:null,'attributes':_0x1691c1[_0xc9bd('0x1c')]?_0x1691c1[_0xc9bd('0x1c')][_0xc9bd('0x1f')]||null:null,'include':_0x1691c1[_0xc9bd('0x1c')]?_0x1691c1[_0xc9bd('0x1c')][_0xc9bd('0x20')]?_['map'](_0x1691c1[_0xc9bd('0x1c')][_0xc9bd('0x20')],function(_0x14384e){return{'model':db[_0x14384e[_0xc9bd('0x21')]],'as':_0x14384e['as'],'attributes':_0x14384e['attributes'],'include':_0x14384e['include']?_[_0xc9bd('0x22')](_0x14384e['include'],function(_0x8fc892){return{'model':db[_0x8fc892[_0xc9bd('0x21')]],'as':_0x8fc892['as'],'attributes':_0x8fc892[_0xc9bd('0x1f')],'include':_0x8fc892[_0xc9bd('0x20')]?_['map'](_0x8fc892['include'],function(_0x5c6f0e){return{'model':db[_0x5c6f0e[_0xc9bd('0x21')]],'as':_0x5c6f0e['as'],'attributes':_0x5c6f0e['attributes']};}):[]};}):[]};}):[]:[]})[_0xc9bd('0x13')](function(_0x2ca6bb){logger['info']('ShowSmsAccount',_0x1691c1);logger[_0xc9bd('0x17')](_0xc9bd('0x23'),_0x1691c1,JSON['stringify'](_0x2ca6bb));_0x183493(_0x2ca6bb);})[_0xc9bd('0x24')](function(_0xfc4639){logger[_0xc9bd('0x19')](_0xc9bd('0x23'),_0xfc4639[_0xc9bd('0x1a')],_0x1691c1);_0x1c40f6(_0x46871b[_0xc9bd('0x19')](0x1f4,_0xfc4639[_0xc9bd('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index c476717..60d4b09 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 _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 +var _0xa9e2=['removeListener','register','smsAccount:','./smsAccount.events','save','remove','update'];(function(_0x5f05fc,_0x5cefb0){var _0x543b6e=function(_0x2e5fe0){while(--_0x2e5fe0){_0x5f05fc['push'](_0x5f05fc['shift']());}};_0x543b6e(++_0x5cefb0);}(_0xa9e2,0xc0));var _0x2a9e=function(_0x547bcb,_0x36d551){_0x547bcb=_0x547bcb-0x0;var _0x44a7ca=_0xa9e2[_0x547bcb];return _0x44a7ca;};'use strict';var SmsAccountEvents=require(_0x2a9e('0x0'));var events=[_0x2a9e('0x1'),_0x2a9e('0x2'),_0x2a9e('0x3')];function createListener(_0x55e4e9,_0x171570){return function(_0x598aea){_0x171570['emit'](_0x55e4e9,_0x598aea);};}function removeListener(_0x1adf2a,_0x562528){return function(){SmsAccountEvents[_0x2a9e('0x4')](_0x1adf2a,_0x562528);};}exports[_0x2a9e('0x5')]=function(_0x2eb623){for(var _0x2c8a5e=0x0,_0x15a389=events['length'];_0x2c8a5e<_0x15a389;_0x2c8a5e++){var _0x524a57=events[_0x2c8a5e];var _0x4f5b58=createListener(_0x2a9e('0x6')+_0x524a57,_0x2eb623);SmsAccountEvents['on'](_0x524a57,_0x4f5b58);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 4e00e95..edf9206 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 _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 +var _0x4988=['post','create','/:id','update','delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','show'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x4988,0x177));var _0x8498=function(_0x315851,_0x3a273e){_0x315851=_0x315851-0x0;var _0x589e40=_0x4988[_0x315851];return _0x589e40;};'use strict';var multer=require(_0x8498('0x0'));var util=require('util');var path=require(_0x8498('0x1'));var timeout=require('connect-timeout');var express=require(_0x8498('0x2'));var router=express[_0x8498('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8498('0x4'));var config=require('../../config/environment');var controller=require(_0x8498('0x5'));router[_0x8498('0x6')]('/',auth[_0x8498('0x7')](),controller['index']);router[_0x8498('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x8498('0x8')]);router[_0x8498('0x9')]('/',auth[_0x8498('0x7')](),controller[_0x8498('0xa')]);router['put'](_0x8498('0xb'),auth['isAuthenticated'](),controller[_0x8498('0xc')]);router[_0x8498('0xd')]('/:id',auth[_0x8498('0x7')](),controller[_0x8498('0xe')]);module[_0x8498('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 6fc3738..0f5d5cb 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 _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 +var _0xfd08=['INTEGER','STRING','noop'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xfd08,0x159));var _0x8fd0=function(_0x14e27a,_0x3b4136){_0x14e27a=_0x14e27a-0x0;var _0x288688=_0xfd08[_0x14e27a];return _0x288688;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x8fd0('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x8fd0('0x1')],'allowNull':![],'defaultValue':_0x8fd0('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 60a8b72..10f5e83 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 _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 +var _0xd016=['moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','type','key','query','filters','intersection','fields','attributes','model','hasOwnProperty','nolimit','order','sort','filter','where','merge','SmsApplication','include','findAll','show','keys','options','catch','create','body','find','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xd016,0xd5));var _0x6d01=function(_0x54a82e,_0x4dffea){_0x54a82e=_0x54a82e-0x0;var _0x5a0c22=_0xd016[_0x54a82e];return _0x5a0c22;};'use strict';var pdf=require(_0x6d01('0x0'));var emlformat=require(_0x6d01('0x1'));var rimraf=require(_0x6d01('0x2'));var zipdir=require(_0x6d01('0x3'));var jsonpatch=require(_0x6d01('0x4'));var rp=require(_0x6d01('0x5'));var moment=require(_0x6d01('0x6'));var BPromise=require(_0x6d01('0x7'));var Mustache=require(_0x6d01('0x8'));var util=require(_0x6d01('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x6d01('0xa'));var ejs=require(_0x6d01('0xb'));var fs=require('fs');var _=require(_0x6d01('0xc'));var squel=require(_0x6d01('0xd'));var crypto=require(_0x6d01('0xe'));var jsforce=require(_0x6d01('0xf'));var deskjs=require(_0x6d01('0x10'));var toCsv=require(_0x6d01('0xa'));var querystring=require(_0x6d01('0x11'));var Papa=require(_0x6d01('0x12'));var Redis=require(_0x6d01('0x13'));var authService=require(_0x6d01('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x6d01('0x15'));var hardwareService=require(_0x6d01('0x16'));var logger=require(_0x6d01('0x17'))('api');var utils=require(_0x6d01('0x18'));var config=require(_0x6d01('0x19'));var licenseUtil=require(_0x6d01('0x1a'));var db=require(_0x6d01('0x1b'))['db'];function respondWithStatusCode(_0x148f8f,_0x4e5f47){_0x4e5f47=_0x4e5f47||0xcc;return function(_0x5891b7){if(_0x5891b7){return _0x148f8f[_0x6d01('0x1c')](_0x4e5f47);}return _0x148f8f[_0x6d01('0x1d')](_0x4e5f47)[_0x6d01('0x1e')]();};}function respondWithResult(_0x4ff632,_0x13b0cc){_0x13b0cc=_0x13b0cc||0xc8;return function(_0x555763){if(_0x555763){return _0x4ff632[_0x6d01('0x1d')](_0x13b0cc)[_0x6d01('0x1f')](_0x555763);}};}function respondWithFilteredResult(_0x493a4a,_0x2a75e2){return function(_0x8834ec){if(_0x8834ec){var _0x41efec=_0x8834ec[_0x6d01('0x20')],_0x34033a=_0x2a75e2[_0x6d01('0x21')],_0x216c29=_0x2a75e2[_0x6d01('0x21')]+_0x2a75e2[_0x6d01('0x22')],_0x56c28c;if(_0x216c29>=_0x41efec){_0x216c29=_0x41efec;_0x56c28c=0xc8;}else{_0x56c28c=0xce;}_0x493a4a[_0x6d01('0x1d')](_0x56c28c);return _0x493a4a[_0x6d01('0x23')]('Content-Range',_0x34033a+'-'+_0x216c29+'/'+_0x41efec)[_0x6d01('0x1f')](_0x8834ec);}return null;};}function patchUpdates(_0x58f0ae){return function(_0x5896ab){try{jsonpatch[_0x6d01('0x24')](_0x5896ab,_0x58f0ae,!![]);}catch(_0x2582e9){return BPromise['reject'](_0x2582e9);}return _0x5896ab[_0x6d01('0x25')]();};}function saveUpdates(_0x5d000d,_0x4e21dd){return function(_0x4b1472){if(_0x4b1472){return _0x4b1472[_0x6d01('0x26')](_0x5d000d)[_0x6d01('0x27')](function(_0x5d0a4d){return _0x5d0a4d;});}return null;};}function removeEntity(_0x4d2134,_0x53cdad){return function(_0x2b3074){if(_0x2b3074){return _0x2b3074['destroy']()[_0x6d01('0x27')](function(){_0x4d2134[_0x6d01('0x1d')](0xcc)[_0x6d01('0x1e')]();});}};}function handleEntityNotFound(_0x46efd1,_0x11b270){return function(_0x2fab1c){if(!_0x2fab1c){_0x46efd1[_0x6d01('0x1c')](0x194);}return _0x2fab1c;};}function handleError(_0x5b4903,_0xabb190){_0xabb190=_0xabb190||0x1f4;return function(_0x12c33e){logger[_0x6d01('0x28')](_0x12c33e[_0x6d01('0x29')]);if(_0x12c33e['name']){delete _0x12c33e[_0x6d01('0x2a')];}_0x5b4903['status'](_0xabb190)[_0x6d01('0x2b')](_0x12c33e);};}exports[_0x6d01('0x2c')]=function(_0x1aaa5c,_0x1e3d67){var _0x34f8ca={},_0x277b9e={},_0xb66c86={'count':0x0,'rows':[]};var _0x4b96fb=_[_0x6d01('0x2d')](db['SmsApplication'][_0x6d01('0x2e')],function(_0x44b8b8){return{'name':_0x44b8b8['fieldName'],'type':_0x44b8b8[_0x6d01('0x2f')][_0x6d01('0x30')]};});_0x277b9e['model']=_[_0x6d01('0x2d')](_0x4b96fb,'name');_0x277b9e[_0x6d01('0x31')]=_['keys'](_0x1aaa5c[_0x6d01('0x31')]);_0x277b9e[_0x6d01('0x32')]=_[_0x6d01('0x33')](_0x277b9e['model'],_0x277b9e['query']);_0x34f8ca['attributes']=_[_0x6d01('0x33')](_0x277b9e['model'],qs['fields'](_0x1aaa5c['query'][_0x6d01('0x34')]));_0x34f8ca[_0x6d01('0x35')]=_0x34f8ca[_0x6d01('0x35')]['length']?_0x34f8ca['attributes']:_0x277b9e[_0x6d01('0x36')];if(!_0x1aaa5c['query'][_0x6d01('0x37')](_0x6d01('0x38'))){_0x34f8ca[_0x6d01('0x22')]=qs[_0x6d01('0x22')](_0x1aaa5c[_0x6d01('0x31')][_0x6d01('0x22')]);_0x34f8ca[_0x6d01('0x21')]=qs[_0x6d01('0x21')](_0x1aaa5c[_0x6d01('0x31')][_0x6d01('0x21')]);}_0x34f8ca[_0x6d01('0x39')]=qs['sort'](_0x1aaa5c[_0x6d01('0x31')][_0x6d01('0x3a')]);_0x34f8ca['where']=qs[_0x6d01('0x32')](_['pick'](_0x1aaa5c[_0x6d01('0x31')],_0x277b9e['filters']),_0x4b96fb);if(_0x1aaa5c[_0x6d01('0x31')][_0x6d01('0x3b')]){_0x34f8ca[_0x6d01('0x3c')]=_[_0x6d01('0x3d')](_0x34f8ca['where'],{'$or':_['map'](_0x4b96fb,function(_0x400c9b){if(_0x400c9b[_0x6d01('0x2f')]!=='VIRTUAL'){var _0x1989d5={};_0x1989d5[_0x400c9b[_0x6d01('0x2a')]]={'$like':'%'+_0x1aaa5c['query'][_0x6d01('0x3b')]+'%'};return _0x1989d5;}})});}_0x34f8ca=_[_0x6d01('0x3d')]({},_0x34f8ca,_0x1aaa5c['options']);var _0x4bd02f={'where':_0x34f8ca['where']};return db[_0x6d01('0x3e')][_0x6d01('0x20')](_0x4bd02f)[_0x6d01('0x27')](function(_0x3e85e8){_0xb66c86[_0x6d01('0x20')]=_0x3e85e8;if(_0x1aaa5c[_0x6d01('0x31')]['includeAll']){_0x34f8ca[_0x6d01('0x3f')]=[{'all':!![]}];}return db[_0x6d01('0x3e')][_0x6d01('0x40')](_0x34f8ca);})[_0x6d01('0x27')](function(_0x2e52c8){_0xb66c86['rows']=_0x2e52c8;return _0xb66c86;})['then'](respondWithFilteredResult(_0x1e3d67,_0x34f8ca))['catch'](handleError(_0x1e3d67,null));};exports[_0x6d01('0x41')]=function(_0x230b7e,_0x48926a){var _0x5b2a80={'raw':!![],'where':{'id':_0x230b7e['params']['id']}},_0x38fcf4={};_0x38fcf4[_0x6d01('0x36')]=_[_0x6d01('0x42')](db['SmsApplication'][_0x6d01('0x2e')]);_0x38fcf4[_0x6d01('0x31')]=_[_0x6d01('0x42')](_0x230b7e['query']);_0x38fcf4[_0x6d01('0x32')]=_[_0x6d01('0x33')](_0x38fcf4[_0x6d01('0x36')],_0x38fcf4['query']);_0x5b2a80[_0x6d01('0x35')]=_[_0x6d01('0x33')](_0x38fcf4[_0x6d01('0x36')],qs['fields'](_0x230b7e['query']['fields']));_0x5b2a80[_0x6d01('0x35')]=_0x5b2a80[_0x6d01('0x35')]['length']?_0x5b2a80[_0x6d01('0x35')]:_0x38fcf4[_0x6d01('0x36')];if(_0x230b7e[_0x6d01('0x31')]['includeAll']){_0x5b2a80[_0x6d01('0x3f')]=[{'all':!![]}];}_0x5b2a80=_[_0x6d01('0x3d')]({},_0x5b2a80,_0x230b7e[_0x6d01('0x43')]);return db[_0x6d01('0x3e')]['find'](_0x5b2a80)['then'](handleEntityNotFound(_0x48926a,null))[_0x6d01('0x27')](respondWithResult(_0x48926a,null))[_0x6d01('0x44')](handleError(_0x48926a,null));};exports[_0x6d01('0x45')]=function(_0x33e959,_0x57cb77){return db[_0x6d01('0x3e')][_0x6d01('0x45')](_0x33e959[_0x6d01('0x46')],{})['then'](respondWithResult(_0x57cb77,0xc9))[_0x6d01('0x44')](handleError(_0x57cb77,null));};exports[_0x6d01('0x26')]=function(_0x37499f,_0x5cf5b4){if(_0x37499f[_0x6d01('0x46')]['id']){delete _0x37499f[_0x6d01('0x46')]['id'];}return db['SmsApplication'][_0x6d01('0x47')]({'where':{'id':_0x37499f['params']['id']}})[_0x6d01('0x27')](handleEntityNotFound(_0x5cf5b4,null))[_0x6d01('0x27')](saveUpdates(_0x37499f[_0x6d01('0x46')],null))['then'](respondWithResult(_0x5cf5b4,null))[_0x6d01('0x44')](handleError(_0x5cf5b4,null));};exports[_0x6d01('0x48')]=function(_0x566e7f,_0x14bd18){return db[_0x6d01('0x3e')][_0x6d01('0x47')]({'where':{'id':_0x566e7f['params']['id']}})[_0x6d01('0x27')](handleEntityNotFound(_0x14bd18,null))[_0x6d01('0x27')](removeEntity(_0x14bd18,null))['catch'](handleError(_0x14bd18,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 79ec941..11ff303 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 _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 +var _0x7203=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','SmsApplication','sms_applications','utf8mb4'];(function(_0x4fbb3e,_0x55785f){var _0x1eb197=function(_0xfda25){while(--_0xfda25){_0x4fbb3e['push'](_0x4fbb3e['shift']());}};_0x1eb197(++_0x55785f);}(_0x7203,0x69));var _0x3720=function(_0x29a539,_0x10a434){_0x29a539=_0x29a539-0x0;var _0x137682=_0x7203[_0x29a539];return _0x137682;};'use strict';var _=require(_0x3720('0x0'));var util=require('util');var logger=require(_0x3720('0x1'))(_0x3720('0x2'));var moment=require(_0x3720('0x3'));var BPromise=require('bluebird');var rp=require(_0x3720('0x4'));var fs=require('fs');var path=require(_0x3720('0x5'));var rimraf=require(_0x3720('0x6'));var config=require(_0x3720('0x7'));var attributes=require('./smsApplication.attributes');module[_0x3720('0x8')]=function(_0x23ae08,_0x2157ab){return _0x23ae08['define'](_0x3720('0x9'),attributes,{'tableName':_0x3720('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3720('0xb'),'collate':_0x3720('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index ced711f..15a43cb 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 _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 +var _0xdcf6=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsApplication,\x20%s,\x20%s','message','info','result'];(function(_0x2ea10b,_0x1c26b9){var _0x50f1e6=function(_0x50db75){while(--_0x50db75){_0x2ea10b['push'](_0x2ea10b['shift']());}};_0x50f1e6(++_0x1c26b9);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x4c5c97,_0x4f85bf){_0x4c5c97=_0x4c5c97-0x0;var _0xd5d2cb=_0xdcf6[_0x4c5c97];return _0xd5d2cb;};'use strict';var _=require('lodash');var util=require(_0x6dcf('0x0'));var moment=require(_0x6dcf('0x1'));var BPromise=require(_0x6dcf('0x2'));var rs=require(_0x6dcf('0x3'));var fs=require('fs');var Redis=require(_0x6dcf('0x4'));var db=require(_0x6dcf('0x5'))['db'];var utils=require(_0x6dcf('0x6'));var logger=require('../../config/logger')(_0x6dcf('0x7'));var config=require(_0x6dcf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6dcf('0x9')][_0x6dcf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5abd79,_0x56fdb2,_0x5766db){return new BPromise(function(_0x34517a,_0x4e2877){return client[_0x6dcf('0xb')](_0x5abd79,_0x5766db)[_0x6dcf('0xc')](function(_0x304a75){logger['info']('SmsApplication,\x20%s,\x20%s',_0x56fdb2,'request\x20sent');logger[_0x6dcf('0xd')](_0x6dcf('0xe'),_0x56fdb2,_0x6dcf('0xf'),JSON['stringify'](_0x304a75));if(_0x304a75[_0x6dcf('0x10')]){if(_0x304a75[_0x6dcf('0x10')][_0x6dcf('0x11')]===0x1f4){logger[_0x6dcf('0x10')](_0x6dcf('0x12'),_0x56fdb2,_0x304a75[_0x6dcf('0x10')][_0x6dcf('0x13')]);return _0x4e2877(_0x304a75[_0x6dcf('0x10')][_0x6dcf('0x13')]);}logger[_0x6dcf('0x10')](_0x6dcf('0x12'),_0x56fdb2,_0x304a75[_0x6dcf('0x10')][_0x6dcf('0x13')]);return _0x34517a(_0x304a75[_0x6dcf('0x10')][_0x6dcf('0x13')]);}else{logger[_0x6dcf('0x14')](_0x6dcf('0x12'),_0x56fdb2,'request\x20sent');_0x34517a(_0x304a75[_0x6dcf('0x15')][_0x6dcf('0x13')]);}})[_0x6dcf('0x16')](function(_0x4874ff){logger[_0x6dcf('0x10')](_0x6dcf('0x12'),_0x56fdb2,_0x4874ff);_0x4e2877(_0x4874ff);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index bffd08e..ee9ca98 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 _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 +var _0x14bc=['get','index','/describe','describe','show','/:id/messages','isAuthenticated','getMessages','/:id/download','download','create','post','/:id/tags','tracked','smsinteraction:addtags','addTags','put','sms','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','removeTags','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsInteraction.controller'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x14bc,0x199));var _0xc14b=function(_0x532ee0,_0x20be59){_0x532ee0=_0x532ee0-0x0;var _0x22990b=_0x14bc[_0x532ee0];return _0x22990b;};'use strict';var multer=require('multer');var util=require(_0xc14b('0x0'));var path=require('path');var timeout=require(_0xc14b('0x1'));var express=require(_0xc14b('0x2'));var router=express[_0xc14b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc14b('0x4'));var config=require(_0xc14b('0x5'));var controller=require(_0xc14b('0x6'));router[_0xc14b('0x7')]('/',auth['isAuthenticated'](),controller[_0xc14b('0x8')]);router[_0xc14b('0x7')](_0xc14b('0x9'),auth['isAuthenticated'](),controller[_0xc14b('0xa')]);router[_0xc14b('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xc14b('0xb')]);router[_0xc14b('0x7')](_0xc14b('0xc'),auth[_0xc14b('0xd')](),controller[_0xc14b('0xe')]);router[_0xc14b('0x7')](_0xc14b('0xf'),auth[_0xc14b('0xd')](),controller[_0xc14b('0x10')]);router['post']('/',auth[_0xc14b('0xd')](),controller[_0xc14b('0x11')]);router[_0xc14b('0x12')](_0xc14b('0xc'),auth['isAuthenticated'](),controller['addMessage']);router[_0xc14b('0x12')](_0xc14b('0x13'),auth[_0xc14b('0xd')](),interaction[_0xc14b('0x14')]('sms',_0xc14b('0x15')),controller[_0xc14b('0x16')]);router[_0xc14b('0x17')]('/:id',auth[_0xc14b('0xd')](),interaction[_0xc14b('0x14')](_0xc14b('0x18'),_0xc14b('0x19')),controller[_0xc14b('0x1a')]);router['delete']('/:id',auth[_0xc14b('0xd')](),interaction[_0xc14b('0x14')](_0xc14b('0x18'),_0xc14b('0x1b')),controller[_0xc14b('0x1c')]);router[_0xc14b('0x1d')](_0xc14b('0x13'),auth[_0xc14b('0xd')](),controller[_0xc14b('0x1e')]);module[_0xc14b('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index eb05c9e..10f870a 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 _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 +var _0xab8e=['DATE','ENUM','out','sequelize','exports','BOOLEAN','STRING'];(function(_0xeee806,_0x3bbc55){var _0x7ed38e=function(_0x28e2b4){while(--_0x28e2b4){_0xeee806['push'](_0xeee806['shift']());}};_0x7ed38e(++_0x3bbc55);}(_0xab8e,0xf8));var _0xeab8=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xab8e[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0xeab8('0x0'));var moment=require('moment');module[_0xeab8('0x1')]={'closed':{'type':Sequelize[_0xeab8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xeab8('0x3')]},'secondDisposition':{'type':Sequelize[_0xeab8('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xeab8('0x3')]},'read1stAt':{'type':Sequelize[_0xeab8('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xeab8('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xeab8('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xeab8('0x5')]('in',_0xeab8('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 319b4c2..a81c249 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(_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 +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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 2bda502..89bc1a9 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 _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 +var _0xdc97=['update','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb','SmsInteraction','SmsMessage','save'];(function(_0x4c5c83,_0x12be6e){var _0x54c0ff=function(_0x5c7e1d){while(--_0x5c7e1d){_0x4c5c83['push'](_0x4c5c83['shift']());}};_0x54c0ff(++_0x12be6e);}(_0xdc97,0x13b));var _0x7dc9=function(_0xbe42d9,_0x414114){_0xbe42d9=_0xbe42d9-0x0;var _0x3b69a7=_0xdc97[_0xbe42d9];return _0x3b69a7;};'use strict';var EventEmitter=require(_0x7dc9('0x0'));var SmsInteraction=require(_0x7dc9('0x1'))['db'][_0x7dc9('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0x7dc9('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7dc9('0x4'),'afterUpdate':_0x7dc9('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2a77c1){return function(_0x1e513b,_0xb15a0b,_0x3ba3ca){_0x1e513b['getUsers']({'attributes':['id'],'raw':!![]})[_0x7dc9('0x6')](function(_0x4f91c7){_0x1e513b['setDataValue'](_0x7dc9('0x7'),_0x4f91c7[_0x7dc9('0x8')](function(_0x3318ea){return{'id':_0x3318ea['id']};}));return SmsMessage[_0x7dc9('0x9')]({'where':{'SmsInteractionId':_0x1e513b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7dc9('0x6')](function(_0x5ca05b){_0x1e513b[_0x7dc9('0xa')](_0x7dc9('0xb'),_0x5ca05b[_0x7dc9('0xc')]);SmsInteractionEvents[_0x7dc9('0xd')](_0x2a77c1+':'+_0x1e513b['id'],_0x1e513b);SmsInteractionEvents[_0x7dc9('0xd')](_0x2a77c1,_0x1e513b);_0x3ba3ca(null);})[_0x7dc9('0xe')](_0x3ba3ca(null));};}for(var e in events){if(events[_0x7dc9('0xf')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 67bf23d..63638e4 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 _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 +var _0xcc9b=['define','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports'];(function(_0x102235,_0x5afcbd){var _0x301f0b=function(_0x23ffee){while(--_0x23ffee){_0x102235['push'](_0x102235['shift']());}};_0x301f0b(++_0x5afcbd);}(_0xcc9b,0x1f3));var _0xbcc9=function(_0x15686d,_0x3f5829){_0x15686d=_0x15686d-0x0;var _0x850585=_0xcc9b[_0x15686d];return _0x850585;};'use strict';var _=require(_0xbcc9('0x0'));var util=require(_0xbcc9('0x1'));var logger=require(_0xbcc9('0x2'))(_0xbcc9('0x3'));var moment=require('moment');var BPromise=require(_0xbcc9('0x4'));var rp=require(_0xbcc9('0x5'));var fs=require('fs');var path=require(_0xbcc9('0x6'));var rimraf=require(_0xbcc9('0x7'));var config=require(_0xbcc9('0x8'));var attributes=require(_0xbcc9('0x9'));module[_0xbcc9('0xa')]=function(_0x49c3dd,_0x4272f3){return _0x49c3dd[_0xbcc9('0xb')]('SmsInteraction',attributes,{'tableName':_0xbcc9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x50ca3f,_0x31cf08,_0x23459a){if(_0x50ca3f[_0xbcc9('0xd')]('closed')){_0x50ca3f[_0xbcc9('0xe')]=moment()[_0xbcc9('0xf')](_0xbcc9('0x10'));}_0x23459a(null,_0x50ca3f);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d54832c..7c7720b 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 _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 +var _0x1cce=['limit','find','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','attributes'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x1cce,0x80));var _0xe1cc=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0x1cce[_0x5b7788];return _0x573871;};'use strict';var _=require(_0xe1cc('0x0'));var util=require(_0xe1cc('0x1'));var moment=require(_0xe1cc('0x2'));var BPromise=require(_0xe1cc('0x3'));var rs=require(_0xe1cc('0x4'));var fs=require('fs');var Redis=require(_0xe1cc('0x5'));var db=require(_0xe1cc('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe1cc('0x7'));var config=require('../../config/environment');var jayson=require(_0xe1cc('0x8'));var client=jayson[_0xe1cc('0x9')][_0xe1cc('0xa')]({'port':0x232a});config[_0xe1cc('0xb')]=_['defaults'](config[_0xe1cc('0xb')],{'host':_0xe1cc('0xc'),'port':0x18eb});var socket=require(_0xe1cc('0xd'))(new Redis(config['redis']));require(_0xe1cc('0xe'))[_0xe1cc('0xf')](socket);function respondWithRpcPromise(_0x5ed349,_0x230310,_0x191f15){return new BPromise(function(_0x2e35f8,_0x2d0cfb){return client[_0xe1cc('0x10')](_0x5ed349,_0x191f15)[_0xe1cc('0x11')](function(_0xce8b75){logger[_0xe1cc('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x230310,'request\x20sent');logger[_0xe1cc('0x13')](_0xe1cc('0x14'),_0x230310,_0xe1cc('0x15'),JSON[_0xe1cc('0x16')](_0xce8b75));if(_0xce8b75['error']){if(_0xce8b75[_0xe1cc('0x17')][_0xe1cc('0x18')]===0x1f4){logger['error'](_0xe1cc('0x19'),_0x230310,_0xce8b75['error']['message']);return _0x2d0cfb(_0xce8b75['error']['message']);}logger['error'](_0xe1cc('0x19'),_0x230310,_0xce8b75[_0xe1cc('0x17')]['message']);return _0x2e35f8(_0xce8b75[_0xe1cc('0x17')][_0xe1cc('0x1a')]);}else{logger[_0xe1cc('0x12')](_0xe1cc('0x19'),_0x230310,_0xe1cc('0x15'));_0x2e35f8(_0xce8b75[_0xe1cc('0x1b')][_0xe1cc('0x1a')]);}})[_0xe1cc('0x1c')](function(_0x370fcc){logger[_0xe1cc('0x17')](_0xe1cc('0x19'),_0x230310,_0x370fcc);_0x2d0cfb(_0x370fcc);});});}exports[_0xe1cc('0x1d')]=function(_0x127ca5){var _0x5911e3=this;return new Promise(function(_0x2603be,_0xf2b900){return db[_0xe1cc('0x1e')]['update'](_0x127ca5[_0xe1cc('0x1f')],{'raw':_0x127ca5[_0xe1cc('0x20')]?_0x127ca5[_0xe1cc('0x20')][_0xe1cc('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x127ca5[_0xe1cc('0x20')]?_0x127ca5[_0xe1cc('0x20')][_0xe1cc('0x22')]||null:null,'attributes':_0x127ca5[_0xe1cc('0x20')]?_0x127ca5[_0xe1cc('0x20')][_0xe1cc('0x23')]||null:null,'limit':_0x127ca5[_0xe1cc('0x20')]?_0x127ca5[_0xe1cc('0x20')][_0xe1cc('0x24')]||null:null})['then'](function(_0x4d245a){logger['info'](_0xe1cc('0x1d'),_0x127ca5);logger[_0xe1cc('0x13')](_0xe1cc('0x1d'),_0x127ca5,JSON['stringify'](_0x4d245a));_0x2603be(_0x4d245a);})[_0xe1cc('0x1c')](function(_0xde9a6){logger[_0xe1cc('0x17')]('UpdateSmsInteraction',_0xde9a6[_0xe1cc('0x1a')],_0x127ca5);_0xf2b900(_0x5911e3[_0xe1cc('0x17')](0x1f4,_0xde9a6[_0xe1cc('0x1a')]));});});};exports['AddTagsToSmsInteraction']=function(_0x2db3ba){return new Promise(function(_0x5d62f6,_0x15ad0b){return db[_0xe1cc('0x1e')][_0xe1cc('0x25')]({'where':_0x2db3ba[_0xe1cc('0x20')]?_0x2db3ba[_0xe1cc('0x20')][_0xe1cc('0x22')]||null:null})[_0xe1cc('0x11')](function(_0xa94138){if(_0xa94138){return _0xa94138['addTags'](_0x2db3ba[_0xe1cc('0x1f')]['ids'],_[_0xe1cc('0x26')](_0x2db3ba[_0xe1cc('0x1f')],['ids','id'])||{});}})[_0xe1cc('0x27')](function(_0x1554cd){logger['info'](_0xe1cc('0x28'),_0x2db3ba);logger[_0xe1cc('0x13')](_0xe1cc('0x28'),_0x2db3ba,JSON[_0xe1cc('0x16')](_0x1554cd));_0x5d62f6(_0x1554cd);})['catch'](function(_0x21d3c4){logger[_0xe1cc('0x17')](_0xe1cc('0x28'),_0x21d3c4[_0xe1cc('0x1a')],_0x2db3ba);_0x15ad0b(_this[_0xe1cc('0x17')](0x1f4,_0x21d3c4[_0xe1cc('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index f02b417..ec6d897 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(_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 +var _0x2032=['save','remove','update','removeListener','register','length','smsInteraction:'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x2032,0xd9));var _0x2203=function(_0x4b8adf,_0x1017d1){_0x4b8adf=_0x4b8adf-0x0;var _0x173feb=_0x2032[_0x4b8adf];return _0x173feb;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2203('0x0'),_0x2203('0x1'),_0x2203('0x2')];function createListener(_0x4c28da,_0x486390){return function(_0x228a29){_0x486390['emit'](_0x4c28da,_0x228a29);};}function removeListener(_0x46c49a,_0x880dcd){return function(){SmsInteractionEvents[_0x2203('0x3')](_0x46c49a,_0x880dcd);};}exports[_0x2203('0x4')]=function(_0x3f7ba1){for(var _0x13367a=0x0,_0x2e0f63=events[_0x2203('0x5')];_0x13367a<_0x2e0f63;_0x13367a++){var _0x18c4d6=events[_0x13367a];var _0x2049ff=createListener(_0x2203('0x6')+_0x18c4d6,_0x3f7ba1);SmsInteractionEvents['on'](_0x18c4d6,_0x2049ff);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 6ec9649..49578da 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 _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 +var _0x656a=['Router','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','describe','show','tracked','smsmessage:create','create','/:id/status','status','put','/:id','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x656a,0x87));var _0xa656=function(_0x349915,_0x124261){_0x349915=_0x349915-0x0;var _0x8be4f3=_0x656a[_0x349915];return _0x8be4f3;};'use strict';var multer=require(_0xa656('0x0'));var util=require(_0xa656('0x1'));var path=require(_0xa656('0x2'));var timeout=require(_0xa656('0x3'));var express=require(_0xa656('0x4'));var router=express[_0xa656('0x5')]();var auth=require(_0xa656('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa656('0x7'));var controller=require(_0xa656('0x8'));router[_0xa656('0x9')]('/',auth[_0xa656('0xa')](),controller[_0xa656('0xb')]);router[_0xa656('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xa656('0xc')]);router[_0xa656('0x9')]('/:id',auth[_0xa656('0xa')](),controller[_0xa656('0xd')]);router['post']('/',auth[_0xa656('0xa')](),interaction[_0xa656('0xe')]('sms',_0xa656('0xf')),controller[_0xa656('0x10')]);router['post'](_0xa656('0x11'),controller[_0xa656('0x12')]);router[_0xa656('0x13')](_0xa656('0x14'),auth[_0xa656('0xa')](),controller[_0xa656('0x15')]);router[_0xa656('0x13')]('/:id/accept',auth[_0xa656('0xa')](),controller[_0xa656('0x16')]);router['put'](_0xa656('0x17'),auth[_0xa656('0xa')](),controller[_0xa656('0x18')]);router[_0xa656('0x19')](_0xa656('0x14'),auth[_0xa656('0xa')](),controller[_0xa656('0x1a')]);module[_0xa656('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index cfa2c4b..b546e58 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 _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 +var _0xc5ef=['BOOLEAN','sequelize','exports','TEXT','ENUM','out','STRING','DATE'];(function(_0x19c9bc,_0x33df60){var _0x35f5ef=function(_0x4a8836){while(--_0x4a8836){_0x19c9bc['push'](_0x19c9bc['shift']());}};_0x35f5ef(++_0x33df60);}(_0xc5ef,0x149));var _0xfc5e=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xc5ef[_0x487b0c];return _0x1adbdc;};'use strict';var Sequelize=require(_0xfc5e('0x0'));module[_0xfc5e('0x1')]={'body':{'type':Sequelize[_0xfc5e('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xfc5e('0x3')]('in',_0xfc5e('0x4')),'defaultValue':_0xfc5e('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xfc5e('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xfc5e('0x6')]},'secret':{'type':Sequelize[_0xfc5e('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xfc5e('0x5')]},'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 07f370e..bbc312c 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 _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 +var _0x7321=['limit','set','apply','reject','save','update','then','stack','name','index','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','SmsMessage','include','findAll','rows','create','body','params','find','describe','../../config/logger','sms-interactions','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','interaction','user','role','stringify','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','RejectMessage','rejectMessage','SmsAccount','SmsAccountId','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','sent','Status','infobip','results','groupName','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','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/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','count','offset'];(function(_0x4c93d5,_0x202aa2){var _0x3f357b=function(_0x3ba74f){while(--_0x3ba74f){_0x4c93d5['push'](_0x4c93d5['shift']());}};_0x3f357b(++_0x202aa2);}(_0x7321,0x1e3));var _0x1732=function(_0x2f3570,_0x4d7940){_0x2f3570=_0x2f3570-0x0;var _0x5bbab8=_0x7321[_0x2f3570];return _0x5bbab8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1732('0x0'));var rimraf=require(_0x1732('0x1'));var zipdir=require(_0x1732('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1732('0x3'));var moment=require('moment');var BPromise=require(_0x1732('0x4'));var Mustache=require(_0x1732('0x5'));var util=require('util');var path=require(_0x1732('0x6'));var sox=require(_0x1732('0x7'));var csv=require(_0x1732('0x8'));var ejs=require(_0x1732('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1732('0xa'));var crypto=require('crypto');var jsforce=require(_0x1732('0xb'));var deskjs=require(_0x1732('0xc'));var toCsv=require(_0x1732('0x8'));var querystring=require(_0x1732('0xd'));var Papa=require(_0x1732('0xe'));var Redis=require(_0x1732('0xf'));var authService=require(_0x1732('0x10'));var qs=require(_0x1732('0x11'));var as=require(_0x1732('0x12'));var hardwareService=require(_0x1732('0x13'));var logger=require('../../config/logger')(_0x1732('0x14'));var utils=require(_0x1732('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1732('0x16'));var db=require(_0x1732('0x17'))['db'];config['redis']=_['defaults'](config[_0x1732('0x18')],{'host':_0x1732('0x19'),'port':0x18eb});var socket=require(_0x1732('0x1a'))(new Redis(config[_0x1732('0x18')]));require(_0x1732('0x1b'))[_0x1732('0x1c')](socket);var jayson=require(_0x1732('0x1d'));var client=jayson[_0x1732('0x1e')][_0x1732('0x1f')]({'port':0x232c});var client9002=jayson[_0x1732('0x1e')][_0x1732('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x519c06,_0x446fa4,_0x52df0c,_0x4c31a8){return new BPromise(function(_0x14c1e3,_0x16e5e0){var _0x4cd27a=_0x4c31a8||client;return _0x4cd27a[_0x1732('0x20')](_0x519c06,_0x52df0c)['then'](function(_0x276514){logger[_0x1732('0x21')](_0x1732('0x22'),_0x446fa4,_0x1732('0x23'));logger[_0x1732('0x24')](_0x1732('0x25'),_0x446fa4,_0x1732('0x23'),JSON['stringify'](_0x276514));if(_0x276514['error']){if(_0x276514[_0x1732('0x26')][_0x1732('0x27')]===0x1f4){logger['error'](_0x1732('0x22'),_0x446fa4,_0x276514[_0x1732('0x26')]['message']);return _0x16e5e0(_0x276514[_0x1732('0x26')][_0x1732('0x28')]);}logger['error'](_0x1732('0x22'),_0x446fa4,_0x276514[_0x1732('0x26')][_0x1732('0x28')]);return _0x14c1e3(_0x276514['error'][_0x1732('0x28')]);}else{logger['info'](_0x1732('0x22'),_0x446fa4,_0x1732('0x23'));_0x14c1e3(_0x276514[_0x1732('0x29')]['message']);}})[_0x1732('0x2a')](function(_0x3d5fa0){logger[_0x1732('0x26')]('SmsMessage,\x20%s,\x20%s',_0x446fa4,_0x3d5fa0);_0x16e5e0(_0x3d5fa0);});});}function respondWithStatusCode(_0x21125f,_0x495d73){_0x495d73=_0x495d73||0xcc;return function(_0x464496){if(_0x464496){return _0x21125f[_0x1732('0x2b')](_0x495d73);}return _0x21125f['status'](_0x495d73)[_0x1732('0x2c')]();};}function respondWithResult(_0x2e3d46,_0x135331){_0x135331=_0x135331||0xc8;return function(_0xf38155){if(_0xf38155){return _0x2e3d46[_0x1732('0x2d')](_0x135331)[_0x1732('0x2e')](_0xf38155);}};}function respondWithFilteredResult(_0x59587a,_0x36c099){return function(_0x2b07e1){if(_0x2b07e1){var _0x121f58=_0x2b07e1[_0x1732('0x2f')],_0xa49f20=_0x36c099[_0x1732('0x30')],_0x944c1d=_0x36c099[_0x1732('0x30')]+_0x36c099[_0x1732('0x31')],_0x327268;if(_0x944c1d>=_0x121f58){_0x944c1d=_0x121f58;_0x327268=0xc8;}else{_0x327268=0xce;}_0x59587a[_0x1732('0x2d')](_0x327268);return _0x59587a[_0x1732('0x32')]('Content-Range',_0xa49f20+'-'+_0x944c1d+'/'+_0x121f58)[_0x1732('0x2e')](_0x2b07e1);}return null;};}function patchUpdates(_0xb94b2a){return function(_0x574d70){try{jsonpatch[_0x1732('0x33')](_0x574d70,_0xb94b2a,!![]);}catch(_0x22ff1a){return BPromise[_0x1732('0x34')](_0x22ff1a);}return _0x574d70[_0x1732('0x35')]();};}function saveUpdates(_0x179c61,_0x51d71f){return function(_0x5cd227){if(_0x5cd227){return _0x5cd227[_0x1732('0x36')](_0x179c61)[_0x1732('0x37')](function(_0x2b150e){return _0x2b150e;});}return null;};}function removeEntity(_0x3ef8d8,_0x5726c3){return function(_0x21e6c4){if(_0x21e6c4){return _0x21e6c4['destroy']()[_0x1732('0x37')](function(){_0x3ef8d8[_0x1732('0x2d')](0xcc)[_0x1732('0x2c')]();});}};}function handleEntityNotFound(_0x30a29a,_0x19da8f){return function(_0x34ab31){if(!_0x34ab31){_0x30a29a[_0x1732('0x2b')](0x194);}return _0x34ab31;};}function handleError(_0x55b5d6,_0x27c582){_0x27c582=_0x27c582||0x1f4;return function(_0x23aa54){logger[_0x1732('0x26')](_0x23aa54[_0x1732('0x38')]);if(_0x23aa54[_0x1732('0x39')]){delete _0x23aa54[_0x1732('0x39')];}_0x55b5d6['status'](_0x27c582)['send'](_0x23aa54);};}exports[_0x1732('0x3a')]=function(_0x273c61,_0x157c27){var _0x495492={},_0x76862d={},_0x5e7fd0={'count':0x0,'rows':[]};var _0x3f8e82=_[_0x1732('0x3b')](db['SmsMessage'][_0x1732('0x3c')],function(_0x3ad859){return{'name':_0x3ad859['fieldName'],'type':_0x3ad859['type'][_0x1732('0x3d')]};});_0x76862d[_0x1732('0x3e')]=_[_0x1732('0x3b')](_0x3f8e82,'name');_0x76862d['query']=_[_0x1732('0x3f')](_0x273c61[_0x1732('0x40')]);_0x76862d[_0x1732('0x41')]=_[_0x1732('0x42')](_0x76862d['model'],_0x76862d['query']);_0x495492[_0x1732('0x43')]=_[_0x1732('0x42')](_0x76862d['model'],qs[_0x1732('0x44')](_0x273c61[_0x1732('0x40')][_0x1732('0x44')]));_0x495492[_0x1732('0x43')]=_0x495492[_0x1732('0x43')][_0x1732('0x45')]?_0x495492[_0x1732('0x43')]:_0x76862d[_0x1732('0x3e')];if(!_0x273c61[_0x1732('0x40')][_0x1732('0x46')]('nolimit')){_0x495492[_0x1732('0x31')]=qs[_0x1732('0x31')](_0x273c61[_0x1732('0x40')]['limit']);_0x495492[_0x1732('0x30')]=qs[_0x1732('0x30')](_0x273c61[_0x1732('0x40')]['offset']);}_0x495492[_0x1732('0x47')]=qs[_0x1732('0x48')](_0x273c61[_0x1732('0x40')][_0x1732('0x48')]);_0x495492[_0x1732('0x49')]=qs[_0x1732('0x41')](_[_0x1732('0x4a')](_0x273c61[_0x1732('0x40')],_0x76862d['filters']),_0x3f8e82);if(_0x273c61[_0x1732('0x40')]['filter']){_0x495492['where']=_[_0x1732('0x4b')](_0x495492[_0x1732('0x49')],{'$or':_[_0x1732('0x3b')](_0x3f8e82,function(_0x238f6c){if(_0x238f6c[_0x1732('0x4c')]!==_0x1732('0x4d')){var _0x13c5a0={};_0x13c5a0[_0x238f6c[_0x1732('0x39')]]={'$like':'%'+_0x273c61[_0x1732('0x40')][_0x1732('0x4e')]+'%'};return _0x13c5a0;}})});}_0x495492=_['merge']({},_0x495492,_0x273c61[_0x1732('0x4f')]);var _0x45122a={'where':_0x495492[_0x1732('0x49')]};return db[_0x1732('0x50')]['count'](_0x45122a)[_0x1732('0x37')](function(_0x1e7b54){_0x5e7fd0[_0x1732('0x2f')]=_0x1e7b54;if(_0x273c61['query']['includeAll']){_0x495492[_0x1732('0x51')]=[{'all':!![]}];}return db[_0x1732('0x50')][_0x1732('0x52')](_0x495492);})['then'](function(_0x2ae8b5){_0x5e7fd0[_0x1732('0x53')]=_0x2ae8b5;return _0x5e7fd0;})[_0x1732('0x37')](respondWithFilteredResult(_0x157c27,_0x495492))[_0x1732('0x2a')](handleError(_0x157c27,null));};exports['show']=function(_0xf42ecf,_0x32e826){var _0x529904={'raw':!![],'where':{'id':_0xf42ecf['params']['id']}},_0x40d37e={};_0x40d37e[_0x1732('0x3e')]=_['keys'](db[_0x1732('0x50')][_0x1732('0x3c')]);_0x40d37e[_0x1732('0x40')]=_[_0x1732('0x3f')](_0xf42ecf['query']);_0x40d37e[_0x1732('0x41')]=_[_0x1732('0x42')](_0x40d37e[_0x1732('0x3e')],_0x40d37e['query']);_0x529904[_0x1732('0x43')]=_[_0x1732('0x42')](_0x40d37e[_0x1732('0x3e')],qs[_0x1732('0x44')](_0xf42ecf['query'][_0x1732('0x44')]));_0x529904['attributes']=_0x529904['attributes'][_0x1732('0x45')]?_0x529904['attributes']:_0x40d37e[_0x1732('0x3e')];if(_0xf42ecf['query']['includeAll']){_0x529904[_0x1732('0x51')]=[{'all':!![]}];}_0x529904=_[_0x1732('0x4b')]({},_0x529904,_0xf42ecf['options']);return db[_0x1732('0x50')]['find'](_0x529904)[_0x1732('0x37')](handleEntityNotFound(_0x32e826,null))[_0x1732('0x37')](respondWithResult(_0x32e826,null))[_0x1732('0x2a')](handleError(_0x32e826,null));};exports[_0x1732('0x54')]=function(_0x2fea03,_0x1c312f){return db['SmsMessage'][_0x1732('0x54')](_0x2fea03[_0x1732('0x55')],{})['then'](respondWithResult(_0x1c312f,0xc9))[_0x1732('0x2a')](handleError(_0x1c312f,null));};exports[_0x1732('0x36')]=function(_0x13462f,_0x36feb9){if(_0x13462f[_0x1732('0x55')]['id']){delete _0x13462f['body']['id'];}return db[_0x1732('0x50')]['find']({'where':{'id':_0x13462f[_0x1732('0x56')]['id']}})[_0x1732('0x37')](handleEntityNotFound(_0x36feb9,null))[_0x1732('0x37')](saveUpdates(_0x13462f[_0x1732('0x55')],null))[_0x1732('0x37')](respondWithResult(_0x36feb9,null))[_0x1732('0x2a')](handleError(_0x36feb9,null));};exports['destroy']=function(_0x28754a,_0x376765){return db[_0x1732('0x50')][_0x1732('0x57')]({'where':{'id':_0x28754a['params']['id']}})[_0x1732('0x37')](handleEntityNotFound(_0x376765,null))['then'](removeEntity(_0x376765,null))[_0x1732('0x2a')](handleError(_0x376765,null));};exports[_0x1732('0x58')]=function(_0x5e160b,_0x161277){return db[_0x1732('0x50')][_0x1732('0x58')]()[_0x1732('0x37')](respondWithResult(_0x161277,null))[_0x1732('0x2a')](handleError(_0x161277,null));};var interaction_log=require(_0x1732('0x59'))(_0x1732('0x5a'));exports['accept']=function(_0x3c1e8f,_0x1f50c0,_0x586ad2){var _0x5c588a={'agent':{},'channel':_0x1732('0x5b')};if(_0x3c1e8f[_0x1732('0x55')]['id']){delete _0x3c1e8f[_0x1732('0x55')]['id'];}_0x3c1e8f['body'][_0x1732('0x5c')]=!![];_0x3c1e8f[_0x1732('0x55')][_0x1732('0x5d')]=moment()['format'](_0x1732('0x5e'));_0x3c1e8f[_0x1732('0x55')][_0x1732('0x5f')]=_0x3c1e8f[_0x1732('0x55')][_0x1732('0x5f')]||_0x3c1e8f['user']['id'];_0x5c588a[_0x1732('0x60')]['id']=_0x3c1e8f[_0x1732('0x55')][_0x1732('0x5f')];return db[_0x1732('0x50')][_0x1732('0x57')]({'where':{'id':_0x3c1e8f[_0x1732('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x1732('0x61')],'as':_0x1732('0x62')}]})[_0x1732('0x37')](handleEntityNotFound(_0x1f50c0,null))[_0x1732('0x37')](saveUpdates(_0x3c1e8f[_0x1732('0x55')],null))['then'](function(_0x300a66){if(_0x300a66){_0x5c588a[_0x1732('0x28')]=_0x300a66[_0x1732('0x63')]({'plain':!![]});return db[_0x1732('0x64')][_0x1732('0x57')]({'where':{'id':_0x300a66[_0x1732('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x1f50c0,null))[_0x1732('0x37')](function(_0x39abf0){if(_0x39abf0){return _0x39abf0[_0x1732('0x36')]({'UserId':_0x3c1e8f['body'][_0x1732('0x5f')],'read1stAt':_[_0x1732('0x66')](_0x39abf0[_0x1732('0x67')])?moment()[_0x1732('0x68')](_0x1732('0x5e')):undefined});}return null;})[_0x1732('0x37')](function(_0x3ed413){if(_0x3ed413){_0x5c588a[_0x1732('0x69')]=_0x3ed413['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3c1e8f[_0x1732('0x6a')]['id'],_0x3c1e8f[_0x1732('0x6a')][_0x1732('0x39')],_0x3c1e8f['user'][_0x1732('0x6b')],_0x5c588a['interaction']['id'],_0x3c1e8f[_0x1732('0x55')]?JSON[_0x1732('0x6c')](_0x3c1e8f[_0x1732('0x55')]):'null');return respondWithRpcPromise(_0x1732('0x6d'),_0x1732('0x6e'),_0x5c588a);}return null;})[_0x1732('0x37')](function(_0x339b87){if(_0x339b87){if(_0x3c1e8f['body'][_0x1732('0x6f')]){_0x5c588a[_0x1732('0x28')][_0x1732('0x70')]=util[_0x1732('0x68')](_0x1732('0x71'),_0x3c1e8f['user'][_0x1732('0x39')]);_0x5c588a['message'][_0x1732('0x72')]=_0x5c588a[_0x1732('0x72')];_0x5c588a[_0x1732('0x28')]['event']='accept';return respondWithRpcPromise(_0x1732('0x73'),_0x1732('0x73'),{'event':_0x1732('0x74'),'message':_0x5c588a['message']},client9002)['then'](function(){return _0x5c588a;});}return _0x5c588a;}return null;})['then'](respondWithResult(_0x1f50c0,null))['catch'](handleError(_0x1f50c0,null));};var interaction_log=require(_0x1732('0x59'))('sms-interactions');exports['reject']=function(_0xe4451f,_0x403f0f,_0xab29d1){var _0x4ba0b6={'agent':{},'channel':_0x1732('0x5b')};if(_0xe4451f[_0x1732('0x55')]['id']){delete _0xe4451f['body']['id'];}_0xe4451f[_0x1732('0x55')][_0x1732('0x5f')]=_0xe4451f[_0x1732('0x55')][_0x1732('0x5f')]||_0xe4451f[_0x1732('0x6a')]['id'];_0x4ba0b6['agent']['id']=_0xe4451f[_0x1732('0x55')]['UserId'];return db['SmsMessage'][_0x1732('0x57')]({'where':{'id':_0xe4451f[_0x1732('0x56')]['id'],'UserId':null}})[_0x1732('0x37')](handleEntityNotFound(_0x403f0f,null))[_0x1732('0x37')](function(_0x4d2ae4){if(_0x4d2ae4){_0x4ba0b6[_0x1732('0x28')]=_0x4d2ae4[_0x1732('0x63')]({'plain':!![]});return db[_0x1732('0x64')]['find']({'where':{'id':_0x4d2ae4[_0x1732('0x65')]}});}return null;})[_0x1732('0x37')](handleEntityNotFound(_0x403f0f,null))[_0x1732('0x37')](function(_0x3459bd){if(_0x3459bd){_0x4ba0b6[_0x1732('0x69')]=_0x3459bd[_0x1732('0x63')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xe4451f[_0x1732('0x6a')]['id'],_0xe4451f[_0x1732('0x6a')][_0x1732('0x39')],_0xe4451f['user'][_0x1732('0x6b')],_0x4ba0b6[_0x1732('0x69')]['id'],_0xe4451f[_0x1732('0x55')]?JSON[_0x1732('0x6c')](_0xe4451f['body']):'null');return respondWithRpcPromise(_0x1732('0x75'),_0x1732('0x76'),_0x4ba0b6);}return null;})[_0x1732('0x37')](function(_0x53f07d){if(_0x53f07d){_0x53f07d['message'][_0x1732('0x70')]=util['format'](_0x1732('0x71'),_0xe4451f[_0x1732('0x6a')][_0x1732('0x39')]);_0x53f07d[_0x1732('0x28')][_0x1732('0x72')]=_0x4ba0b6['channel'];_0x53f07d[_0x1732('0x28')]['event']='reject';respondWithRpcPromise('EventManager',_0x1732('0x73'),{'event':'rejectmessage','message':_0x53f07d[_0x1732('0x28')]},client9002);return _0x4ba0b6;}return null;})[_0x1732('0x37')](respondWithResult(_0x403f0f,null))[_0x1732('0x2a')](handleError(_0x403f0f,null));};exports[_0x1732('0x2d')]=function(_0x49c83a,_0x2297b6,_0x28ef10){if(_0x49c83a[_0x1732('0x55')]['id']){delete _0x49c83a[_0x1732('0x55')]['id'];}var _0x167a3d;return db[_0x1732('0x50')]['find']({'where':{'id':_0x49c83a[_0x1732('0x56')]['id']}})['then'](handleEntityNotFound(_0x2297b6,null))[_0x1732('0x37')](function(_0x18c6fb){if(_0x18c6fb){_0x167a3d=_0x18c6fb;return db[_0x1732('0x77')][_0x1732('0x57')]({'where':{'id':_0x18c6fb[_0x1732('0x78')]}});}})[_0x1732('0x37')](handleEntityNotFound(_0x2297b6,null))[_0x1732('0x37')](function(_0x21dfe7){if(_0x21dfe7){logger[_0x1732('0x24')](_0x1732('0x25'),_0x1732('0x2d'),'received\x20delivery\x20report\x20from',_0x21dfe7[_0x1732('0x4c')],util[_0x1732('0x79')](_0x49c83a[_0x1732('0x55')],{'showHidden':![],'depth':null}));switch(_0x21dfe7[_0x1732('0x4c')]){case _0x1732('0x7a'):if(_0x49c83a[_0x1732('0x55')][_0x1732('0x7b')]&&_0x49c83a[_0x1732('0x55')]['MessageSid']===_0x167a3d[_0x1732('0x7c')]){return _0x167a3d[_0x1732('0x36')]({'read':!![]});}else{logger[_0x1732('0x26')](_0x1732('0x7d'),_0x1732('0x2d'),'twilio',util['inspect'](_0x49c83a[_0x1732('0x55')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x49c83a[_0x1732('0x55')]['MessageUUID']&&_0x49c83a[_0x1732('0x55')][_0x1732('0x7e')]===_0x167a3d[_0x1732('0x7c')]&&_[_0x1732('0x7f')]([_0x1732('0x80'),'delivered'],_0x49c83a[_0x1732('0x55')][_0x1732('0x81')])>=0x0){return _0x167a3d['update']({'read':!![]});}else{logger['error'](_0x1732('0x7d'),_0x1732('0x2d'),'plivio',util[_0x1732('0x79')](_0x49c83a[_0x1732('0x55')],{'showHidden':![],'depth':null}));}break;case _0x1732('0x82'):var _0x5b26c2=_0x49c83a['body'][_0x1732('0x83')][0x0];if(_0x5b26c2['status'][_0x1732('0x84')]==='DELIVERED'){return _0x167a3d[_0x1732('0x36')]({'read':!![]});}else{logger[_0x1732('0x26')](_0x1732('0x7d'),_0x1732('0x2d'),_0x1732('0x82'),util['inspect'](_0x49c83a[_0x1732('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x167a3d;}})[_0x1732('0x37')](respondWithResult(_0x2297b6,null))['catch'](handleError(_0x2297b6,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 2e3b643..099a49b 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 _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 +var _0xec99=['SmsMessage','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0xd2e2ab,_0x2440cf){var _0x1703a2=function(_0x23deba){while(--_0x23deba){_0xd2e2ab['push'](_0xd2e2ab['shift']());}};_0x1703a2(++_0x2440cf);}(_0xec99,0x7d));var _0x9ec9=function(_0x4b48af,_0x4ad5b9){_0x4b48af=_0x4b48af-0x0;var _0x64ac44=_0xec99[_0x4b48af];return _0x64ac44;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x9ec9('0x0'))['db'][_0x9ec9('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9ec9('0x2'),'afterDestroy':_0x9ec9('0x3')};function emitEvent(_0x285726){return function(_0x3d55fc,_0x26c3e1,_0x4e6a4d){SmsMessageEvents[_0x9ec9('0x4')](_0x285726+':'+_0x3d55fc['id'],_0x3d55fc);SmsMessageEvents[_0x9ec9('0x4')](_0x285726,_0x3d55fc);_0x4e6a4d(null);};}for(var e in events){if(events[_0x9ec9('0x5')](e)){var event=events[e];SmsMessage[_0x9ec9('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index b938fd1..8117f7a 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 _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 +var _0xa830=['internal_order_id','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','read','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','clickSend','plivo','authId','token','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','csc','crypto','login','timestamp','keys','sort','length','apiKey','createHash','md5','digest','signature=','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','SmsInteractionId','update','createdAt','catch','error','then','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?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','GET','split','sms','POST','total_sent'];(function(_0x342ff3,_0x256de7){var _0x291cf5=function(_0x8a336){while(--_0x8a336){_0x342ff3['push'](_0x342ff3['shift']());}};_0x291cf5(++_0x256de7);}(_0xa830,0x198));var _0x0a83=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0xa830[_0x18f64a];return _0x44687f;};'use strict';var _=require(_0x0a83('0x0'));var util=require(_0x0a83('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a83('0x2'));var BPromise=require(_0x0a83('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a83('0x4'));var rimraf=require(_0x0a83('0x5'));var config=require(_0x0a83('0x6'));var attributes=require(_0x0a83('0x7'));module[_0x0a83('0x8')]=function(_0x483839,_0x3664e7){return _0x483839['define'](_0x0a83('0x9'),attributes,{'tableName':_0x0a83('0xa'),'paranoid':![],'indexes':[{'name':_0x0a83('0xb'),'fields':[_0x0a83('0xb')]},{'name':_0x0a83('0xc'),'fields':[_0x0a83('0xd')],'type':_0x0a83('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2461b5,_0x4da291,_0x2d5278){var _0x3bee6a=_0x483839[_0x0a83('0xf')];var _0x28260c=_0x2461b5['get']({'plain':!![]});if(_0x28260c[_0x0a83('0x10')][_0x0a83('0x11')]()==='in'||_0x28260c['direction'][_0x0a83('0x11')]()==='out'&&!_0x28260c[_0x0a83('0x12')]&&!_[_0x0a83('0x13')](_0x28260c[_0x0a83('0x14')])){_0x3bee6a['SmsInteraction']['findOne']({'where':{'id':_0x28260c[_0x0a83('0x15')]}})['then'](function(_0x186a31){if(_0x186a31){_0x186a31[_0x0a83('0x16')]({'lastMsgAt':_0x28260c[_0x0a83('0x17')],'lastMsgDirection':_0x28260c[_0x0a83('0x10')][_0x0a83('0x11')]()});}})[_0x0a83('0x18')](function(_0x5e3a83){console[_0x0a83('0x19')](_0x5e3a83);});}if(_0x28260c[_0x0a83('0x10')]==='out'&&!_0x28260c[_0x0a83('0x12')]){var _0x19ea87;_0x3bee6a['SmsAccount']['find']({'where':{'id':_0x28260c['SmsAccountId']},'raw':!![]})[_0x0a83('0x1a')](function(_0x300fe1){_0x19ea87=_0x300fe1;if(_0x19ea87&&_0x19ea87['type']){switch(_0x19ea87['type']){case _0x0a83('0x1b'):var _0xd49044=require('twilio');if(_0x19ea87[_0x0a83('0x1c')]&&_0x19ea87[_0x0a83('0x1d')]&&_0x19ea87[_0x0a83('0x1e')]){var _0x373144=new _0xd49044(_0x19ea87[_0x0a83('0x1c')],_0x19ea87['authToken']);_0x373144[_0x0a83('0x1f')][_0x0a83('0x20')]({'body':_0x28260c['body'],'to':_0x28260c[_0x0a83('0x1e')],'from':_0x19ea87['phone'],'statusCallback':_0x19ea87[_0x0a83('0x21')]+_0x0a83('0x22')+_0x28260c['id']+_0x0a83('0x23')+_0x19ea87['token']})[_0x0a83('0x1a')](function(_0x404e02){if(_0x404e02[_0x0a83('0x24')]){return _0x2461b5[_0x0a83('0x16')]({'messageId':_0x404e02['sid']});}})[_0x0a83('0x18')](function(_0x58e49c){logger['error'](_0x0a83('0x25'),'afterCreate',_0x0a83('0x1b'),util['inspect'](_0x58e49c,{'showHidden':![],'depth':null}));});}else{logger[_0x0a83('0x19')](_0x0a83('0x25'),_0x0a83('0x26'),'twilio',_0x0a83('0x27'));}break;case _0x0a83('0x28'):var _0x45cf3e=_0x0a83('0x29');if(_0x19ea87['username']&&_0x19ea87[_0x0a83('0x2a')]){var _0x36c210={'recipient':[_0x28260c[_0x0a83('0x1e')]],'message':_0x28260c['body'],'message_type':_0x19ea87[_0x0a83('0x2b')]};if(_0x19ea87[_0x0a83('0x2b')]&&_0x19ea87[_0x0a83('0x2b')]!=='SI'){_0x36c210[_0x0a83('0x2c')]=_0x19ea87[_0x0a83('0x1e')];}var _0x5838e4={'url':_0x45cf3e+_0x0a83('0x2d')+_0x19ea87[_0x0a83('0x2e')]+'&password='+_0x19ea87[_0x0a83('0x2a')],'method':_0x0a83('0x2f')};rp(_0x5838e4)[_0x0a83('0x1a')](function(_0x14d297){var _0x4c5863=_0x14d297[_0x0a83('0x30')](';');var _0x455131={'user_key':_0x4c5863[0x0],'session_key':_0x4c5863[0x1]};_0x5838e4={'url':_0x45cf3e+_0x0a83('0x31'),'method':_0x0a83('0x32'),'headers':{'user_key':_0x455131['user_key'],'Session_key':_0x455131['session_key']},'json':!![],'body':_0x36c210};return rp(_0x5838e4);})[_0x0a83('0x1a')](function(_0x335a1c){if(_0x335a1c[_0x0a83('0x33')]>=0x1){var _0xae8387={'messageId':_0x335a1c[_0x0a83('0x34')]};if(_0x19ea87[_0x0a83('0x2b')]!=='GP'||!_0x19ea87['deliveryReport']){_0xae8387['read']=!![];}return _0x2461b5['update'](_0xae8387);}else{return logger[_0x0a83('0x19')](_0x0a83('0x25'),_0x0a83('0x26'),_0x0a83('0x28'),util[_0x0a83('0x35')](_0x335a1c,{'showHidden':![],'depth':null}));}})['catch'](function(_0x55aedd){return logger[_0x0a83('0x19')](_0x0a83('0x25'),'afterCreate',_0x0a83('0x28'),util[_0x0a83('0x35')](_0x55aedd,{'showHidden':![],'depth':null}));});}else{logger[_0x0a83('0x19')](_0x0a83('0x25'),_0x0a83('0x26'),_0x0a83('0x28'),_0x0a83('0x36'));}break;case _0x0a83('0x37'):if(_0x19ea87[_0x0a83('0x1d')]){var _0x59f360={'recipient':_0x28260c[_0x0a83('0x1e')],'message':_0x28260c[_0x0a83('0xd')],'sender':_0x19ea87[_0x0a83('0x38')]||_0x19ea87[_0x0a83('0x1e')],'authorization':_0x19ea87[_0x0a83('0x1d')]};var _0x4da291={'method':'POST','uri':_0x0a83('0x39'),'body':_0x59f360,'json':!![]};rp(_0x4da291)[_0x0a83('0x1a')](function(_0x5cb46f){var _0x5d2374={'messageId':_0x5cb46f[_0x0a83('0x3a')]};if(!_0x19ea87[_0x0a83('0x3b')]){_0x5d2374[_0x0a83('0x3c')]=!![];}return _0x2461b5[_0x0a83('0x16')](_0x5d2374);})[_0x0a83('0x18')](function(_0x43ac1d){logger[_0x0a83('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0a83('0x37'),util[_0x0a83('0x35')](_0x43ac1d,{'showHidden':![],'depth':null}));});}else{logger[_0x0a83('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0a83('0x26'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0x0a83('0x3d'):if(_0x19ea87[_0x0a83('0x2e')]&&_0x19ea87[_0x0a83('0x2a')]){var _0x59f360={'messages':[{'source':_0x0a83('0x3e'),'to':_0x28260c[_0x0a83('0x1e')],'body':_0x28260c[_0x0a83('0xd')],'from':_0x19ea87[_0x0a83('0x38')]||_0x19ea87['phone']}]};var _0x2b7e85=util[_0x0a83('0x3f')](_0x0a83('0x40'),_0x19ea87['username'],_0x19ea87[_0x0a83('0x2a')]);var _0x4da291={'method':_0x0a83('0x32'),'uri':_0x0a83('0x41'),'body':_0x59f360,'headers':{'Authorization':util[_0x0a83('0x3f')](_0x0a83('0x42'),new Buffer(_0x2b7e85)[_0x0a83('0x43')](_0x0a83('0x44')))},'json':!![]};rp(_0x4da291)[_0x0a83('0x1a')](function(_0x28f110){if(_0x28f110[_0x0a83('0x45')]>=0xc8&&_0x28f110[_0x0a83('0x45')]<=0xce){if(_0x28f110[_0x0a83('0x46')]&&_0x28f110[_0x0a83('0x46')][_0x0a83('0x47')]>0x0){var _0x3574cd=_['head'](_0x28f110[_0x0a83('0x46')]['messages']);var _0xa66f6d={'messageId':_0x3574cd['message_id']};if(!_0x19ea87[_0x0a83('0x3b')]){_0xa66f6d['read']=!![];}return _0x2461b5[_0x0a83('0x16')](_0xa66f6d);}else{logger[_0x0a83('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0a83('0x48'),util[_0x0a83('0x35')](_0x28f110,{'showHidden':![],'depth':null}));}}else{logger[_0x0a83('0x19')](_0x0a83('0x25'),_0x0a83('0x26'),_0x0a83('0x48'),util['inspect'](_0x28f110,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1e3198){logger[_0x0a83('0x19')](_0x0a83('0x25'),_0x0a83('0x26'),'clickSend',util[_0x0a83('0x35')](_0x1e3198,{'showHidden':![],'depth':null}));});}else{logger[_0x0a83('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0a83('0x26'),_0x0a83('0x48'),_0x0a83('0x36'));}break;case _0x0a83('0x49'):if(_0x19ea87[_0x0a83('0x4a')]&&_0x19ea87[_0x0a83('0x1d')]){var _0x59f360={'dst':_0x28260c[_0x0a83('0x1e')],'text':_0x28260c[_0x0a83('0xd')],'src':_0x19ea87['senderString']||_0x19ea87[_0x0a83('0x1e')],'url':_0x19ea87['remote']+'/api/sms/messages/'+_0x28260c['id']+_0x0a83('0x23')+_0x19ea87[_0x0a83('0x4b')]};var _0x2b7e85=util['format'](_0x0a83('0x40'),_0x19ea87[_0x0a83('0x4a')],_0x19ea87[_0x0a83('0x1d')]);var _0x4da291={'method':_0x0a83('0x32'),'uri':util[_0x0a83('0x3f')]('https://api.plivo.com/v1/Account/%s/Message/',_0x19ea87[_0x0a83('0x4a')]),'body':_0x59f360,'headers':{'Authorization':util[_0x0a83('0x3f')](_0x0a83('0x42'),new Buffer(_0x2b7e85)[_0x0a83('0x43')](_0x0a83('0x44')))},'json':!![]};rp(_0x4da291)[_0x0a83('0x1a')](function(_0x15dcfb){var _0x2c8493={'messageId':_0x15dcfb[_0x0a83('0x4c')][0x0]};return _0x2461b5[_0x0a83('0x16')](_0x2c8493);})['catch'](function(_0x241e77){logger[_0x0a83('0x19')](_0x0a83('0x25'),_0x0a83('0x26'),'plivo',util['inspect'](_0x241e77,{'showHidden':![],'depth':null}));});}else{logger[_0x0a83('0x19')](_0x0a83('0x25'),_0x0a83('0x26'),_0x0a83('0x49'),_0x0a83('0x4d'));}break;case'infobip':if(_0x19ea87['username']&&_0x19ea87[_0x0a83('0x2a')]){if(_0x19ea87['baseUrl']){var _0x1d1693={'method':'POST','uri':_0x19ea87[_0x0a83('0x4e')]+_0x0a83('0x4f'),'body':{'username':_0x19ea87[_0x0a83('0x2e')],'password':_0x19ea87[_0x0a83('0x2a')]},'json':!![]};return rp(_0x1d1693)['then'](function(_0x3f3fbc){var _0x1cac9c={'method':_0x0a83('0x32'),'uri':_0x19ea87[_0x0a83('0x4e')]+_0x0a83('0x50'),'body':{'messages':[{'from':_0x19ea87[_0x0a83('0x1e')],'destinations':[{'to':_0x28260c['phone']}],'text':_0x28260c[_0x0a83('0xd')],'notifyUrl':_0x19ea87[_0x0a83('0x21')]+_0x0a83('0x22')+_0x28260c['id']+_0x0a83('0x23')+_0x19ea87[_0x0a83('0x4b')],'notifyContentType':_0x0a83('0x51'),'callbackData':_0x19ea87[_0x0a83('0x1e')]+';'+_0x28260c[_0x0a83('0xd')]}]},'headers':{'Authorization':_0x0a83('0x52')+_0x3f3fbc['token']},'json':!![]};return rp(_0x1cac9c)['then'](function(_0xec9adf){if(_0xec9adf[_0x0a83('0x1f')]){var _0x1e4ce8={'messageId':_0xec9adf[_0x0a83('0x1f')][0x0][_0x0a83('0xb')]};if(!_0x19ea87[_0x0a83('0x3b')]){_0x1e4ce8[_0x0a83('0x3c')]=!![];}return _0x2461b5[_0x0a83('0x16')](_0x1e4ce8);}else{return logger[_0x0a83('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0a83('0x26'),_0x0a83('0x53'),util[_0x0a83('0x35')](_0xec9adf,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x15b46e){return logger[_0x0a83('0x19')](_0x0a83('0x25'),_0x0a83('0x26'),_0x0a83('0x53'),util[_0x0a83('0x35')](_0x15b46e,{'showHidden':![],'depth':null}));});}else{logger[_0x0a83('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0a83('0x26'),_0x0a83('0x53'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x0a83('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0x0a83('0x54'):var _0x5a75ae=require(_0x0a83('0x55'));if(_0x19ea87['apiKey']){var _0x15e78a={};_0x15e78a[_0x0a83('0x56')]=_0x19ea87[_0x0a83('0x2e')];_0x15e78a[_0x0a83('0x1e')]=_0x28260c[_0x0a83('0x1e')];_0x15e78a['sender']=_0x19ea87[_0x0a83('0x1e')];_0x15e78a['text']=_0x28260c[_0x0a83('0xd')];_0x15e78a[_0x0a83('0x57')]=+new Date();var _0x16158b='';var _0x32ebaa='';var _0x40b94e=Object[_0x0a83('0x58')](_0x15e78a);_0x40b94e[_0x0a83('0x59')]();for(var _0x5dab30=0x0;_0x5dab30<_0x40b94e[_0x0a83('0x5a')];_0x5dab30++){if(_0x16158b!=''){_0x16158b+='&';}_0x16158b+=_0x40b94e[_0x5dab30]+'='+encodeURIComponent(_0x15e78a[_0x40b94e[_0x5dab30]]);_0x32ebaa+=_0x15e78a[_0x40b94e[_0x5dab30]];}_0x32ebaa+=_0x19ea87[_0x0a83('0x5b')];_0x32ebaa=_0x5a75ae[_0x0a83('0x5c')](_0x0a83('0x5d'))[_0x0a83('0x16')](_0x32ebaa)[_0x0a83('0x5e')]('hex');if(_0x16158b!==''){_0x16158b+='&';}_0x16158b+=_0x0a83('0x5f')+_0x32ebaa;var _0x5838e4={'method':'GET','uri':_0x19ea87[_0x0a83('0x4e')]+'/external/get/send.php?'+_0x16158b,'json':!![]};return rp(_0x5838e4)[_0x0a83('0x1a')](function(_0x445486){var _0x9dd6ad=Object[_0x0a83('0x58')](_0x445486);if(_0x445486[_0x9dd6ad[0x0]][_0x0a83('0x19')]&&parseInt(_0x445486[_0x9dd6ad[0x0]][_0x0a83('0x19')])===0x0){var _0xa62319={'messageId':_0x445486[_0x9dd6ad[0x0]]['id_sms']};if(!_0x19ea87[_0x0a83('0x3b')]){_0xa62319[_0x0a83('0x3c')]=!![];}return _0x2461b5[_0x0a83('0x16')](_0xa62319);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0a83('0x26'),'csc',util[_0x0a83('0x35')](_0x445486['error'],{'showHidden':![],'depth':null}));}})[_0x0a83('0x18')](function(_0x2f0889){return logger['error'](_0x0a83('0x25'),_0x0a83('0x26'),_0x0a83('0x54'),util[_0x0a83('0x35')](_0x2f0889,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0a83('0x25'),'afterCreate','csc',_0x0a83('0x60'));}break;case _0x0a83('0x61'):if(_0x19ea87['apiKey']){var _0x23f72d={'method':'POST','uri':_0x0a83('0x62'),'headers':{'Authorization':_0x19ea87['apiKey']},'body':{'content':_0x28260c[_0x0a83('0xd')],'to':[_0x28260c[_0x0a83('0x1e')]],'from':_0x19ea87[_0x0a83('0x1e')],'binary':![],'clientMessageId':_0x0a83('0x63'),'charset':'UTF-8'},'json':!![]};rp(_0x23f72d)[_0x0a83('0x1a')](function(_0x3d6bc5){if(!_0x3d6bc5[_0x0a83('0x19')]){var _0x405d10={'messageId':_0x3d6bc5[_0x0a83('0x1f')][0x0][_0x0a83('0x64')]};if(!_0x19ea87['deliveryReport']){_0x405d10[_0x0a83('0x3c')]=!![];}return _0x2461b5[_0x0a83('0x16')](_0x405d10);}else{return logger[_0x0a83('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0a83('0x26'),_0x0a83('0x61'),util[_0x0a83('0x35')](_0x3d6bc5[_0x0a83('0x19')],{'showHidden':![],'depth':null}));}})[_0x0a83('0x18')](function(_0x4cec6f){return logger[_0x0a83('0x19')](_0x0a83('0x25'),'afterCreate','clickatell',util[_0x0a83('0x35')](_0x4cec6f,{'showHidden':![],'depth':null}));});}else{logger[_0x0a83('0x19')](_0x0a83('0x25'),_0x0a83('0x26'),_0x0a83('0x61'),_0x0a83('0x60'));}break;case _0x0a83('0x65'):if(_0x19ea87['username']&&_0x19ea87[_0x0a83('0x2a')]){var _0x2b7e85=util[_0x0a83('0x3f')](_0x0a83('0x40'),_0x19ea87[_0x0a83('0x2e')],_0x19ea87['password']);var _0x4da291={'method':_0x0a83('0x32'),'uri':_0x0a83('0x66')+_0x19ea87[_0x0a83('0x67')]+'/messages','body':{'to':[_0x28260c[_0x0a83('0x1e')]],'text':_0x28260c[_0x0a83('0xd')],'from':_0x19ea87[_0x0a83('0x1e')],'applicationId':_0x19ea87[_0x0a83('0x68')]},'headers':{'Authorization':util[_0x0a83('0x3f')](_0x0a83('0x42'),new Buffer(_0x2b7e85)[_0x0a83('0x43')](_0x0a83('0x44')))},'json':!![]};rp(_0x4da291)['then'](function(_0xf59181){if(_0xf59181['id']){var _0xb992ec={'messageId':_0xf59181['id']};return _0x2461b5[_0x0a83('0x16')](_0xb992ec);}else{logger[_0x0a83('0x19')](_0x0a83('0x25'),'afterCreate','bandwidth',util['inspect'](_0xf59181,{'showHidden':![],'depth':null}));}})[_0x0a83('0x18')](function(_0x492524){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0a83('0x26'),_0x0a83('0x65'),util['inspect'](_0x492524,{'showHidden':![],'depth':null}));});}else{logger[_0x0a83('0x19')](_0x0a83('0x25'),_0x0a83('0x26'),'bandwidth',_0x0a83('0x36'));}break;case _0x0a83('0x69'):if(_0x19ea87[_0x0a83('0x5b')]){var _0x1c5558={};var _0x5838e4={'method':_0x0a83('0x32'),'uri':_0x0a83('0x6a'),'headers':{'Authorization':_0x0a83('0x6b')+_0x19ea87[_0x0a83('0x5b')],'Content-Type':_0x0a83('0x51')},'body':{'from':_0x19ea87[_0x0a83('0x1e')],'to':_0x28260c[_0x0a83('0x1e')],'text':_0x28260c[_0x0a83('0xd')]},'json':!![]};return rp(_0x5838e4)['then'](function(_0x29f85f){if(_0x29f85f[_0x0a83('0x6c')]==0xca){_0x1c5558[_0x0a83('0x6d')]=_0x29f85f;var _0x2df0df={'method':'POST','uri':_0x0a83('0x6e'),'headers':{'Authorization':_0x0a83('0x6b')+_0x19ea87[_0x0a83('0x5b')],'Content-Type':_0x0a83('0x51')},'body':{'refid':_0x1c5558[_0x0a83('0x6d')][_0x0a83('0x6f')]},'json':!![]};return rp(_0x2df0df)[_0x0a83('0x1a')](function(_0x2e96e5){_0x1c5558['status']=_0x2e96e5;var _0x3fa619={'messageId':_0x1c5558['message'][_0x0a83('0x6f')],'read':!![]};return _0x2461b5[_0x0a83('0x16')](_0x3fa619);});}else{return logger[_0x0a83('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0a83('0x26'),_0x0a83('0x69'),util['inspect'](_0x29f85f,{'showHidden':![],'depth':null}));}})[_0x0a83('0x18')](function(_0x5486a9){return logger[_0x0a83('0x19')](_0x0a83('0x25'),'afterCreate',_0x0a83('0x69'),util['inspect'](_0x5486a9,{'showHidden':![],'depth':null}));});}else{return logger[_0x0a83('0x19')](_0x0a83('0x25'),'afterCreate','intelepeer',_0x0a83('0x70'));}break;}}})[_0x0a83('0x71')](function(){_0x2d5278();});}else{_0x2d5278();}}},'charset':'utf8mb4','collate':_0x0a83('0x72')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 25b0791..c7418a1 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 _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 +var _0x3ec2=['info','result','catch','CreateSmsMessage','create','options','debug','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x3ec2,0xee));var _0x23ec=function(_0x56a86e,_0x51f246){_0x56a86e=_0x56a86e-0x0;var _0x48ae90=_0x3ec2[_0x56a86e];return _0x48ae90;};'use strict';var _=require(_0x23ec('0x0'));var util=require(_0x23ec('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x23ec('0x2'));var db=require(_0x23ec('0x3'))['db'];var utils=require(_0x23ec('0x4'));var logger=require(_0x23ec('0x5'))(_0x23ec('0x6'));var config=require(_0x23ec('0x7'));var jayson=require(_0x23ec('0x8'));var client=jayson[_0x23ec('0x9')][_0x23ec('0xa')]({'port':0x232a});config[_0x23ec('0xb')]=_[_0x23ec('0xc')](config['redis'],{'host':_0x23ec('0xd'),'port':0x18eb});var socket=require(_0x23ec('0xe'))(new Redis(config[_0x23ec('0xb')]));require(_0x23ec('0xf'))[_0x23ec('0x10')](socket);function respondWithRpcPromise(_0x174e02,_0x198de5,_0x584f4f){return new BPromise(function(_0x29986a,_0x1765bc){return client[_0x23ec('0x11')](_0x174e02,_0x584f4f)[_0x23ec('0x12')](function(_0x200031){logger['info']('SmsMessage,\x20%s,\x20%s',_0x198de5,_0x23ec('0x13'));logger['debug'](_0x23ec('0x14'),_0x198de5,_0x23ec('0x13'),JSON[_0x23ec('0x15')](_0x200031));if(_0x200031[_0x23ec('0x16')]){if(_0x200031['error'][_0x23ec('0x17')]===0x1f4){logger[_0x23ec('0x16')](_0x23ec('0x18'),_0x198de5,_0x200031[_0x23ec('0x16')][_0x23ec('0x19')]);return _0x1765bc(_0x200031[_0x23ec('0x16')][_0x23ec('0x19')]);}logger[_0x23ec('0x16')](_0x23ec('0x18'),_0x198de5,_0x200031[_0x23ec('0x16')]['message']);return _0x29986a(_0x200031[_0x23ec('0x16')][_0x23ec('0x19')]);}else{logger[_0x23ec('0x1a')]('SmsMessage,\x20%s,\x20%s',_0x198de5,_0x23ec('0x13'));_0x29986a(_0x200031[_0x23ec('0x1b')][_0x23ec('0x19')]);}})[_0x23ec('0x1c')](function(_0x2ea900){logger[_0x23ec('0x16')](_0x23ec('0x18'),_0x198de5,_0x2ea900);_0x1765bc(_0x2ea900);});});}exports[_0x23ec('0x1d')]=function(_0x548594){var _0x52ae90=this;return new Promise(function(_0x40df90,_0x104cd0){return db['SmsMessage'][_0x23ec('0x1e')](_0x548594['body'],{'raw':_0x548594[_0x23ec('0x1f')]?_0x548594[_0x23ec('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x23ec('0x12')](function(_0x310af6){logger[_0x23ec('0x1a')](_0x23ec('0x1d'),_0x548594);logger[_0x23ec('0x20')](_0x23ec('0x1d'),_0x548594,JSON[_0x23ec('0x15')](_0x310af6));_0x40df90(_0x310af6);})[_0x23ec('0x1c')](function(_0x59480d){logger[_0x23ec('0x16')](_0x23ec('0x1d'),_0x59480d[_0x23ec('0x19')],_0x548594);_0x104cd0(_0x52ae90[_0x23ec('0x16')](0x1f4,_0x59480d[_0x23ec('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index f471e39..2eef5e1 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 _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 +var _0xd209=['./smsMessage.events','save','update','emit','removeListener','register','length','smsMessage:'];(function(_0x35e75a,_0x5ed225){var _0xb23c7f=function(_0x2fa40c){while(--_0x2fa40c){_0x35e75a['push'](_0x35e75a['shift']());}};_0xb23c7f(++_0x5ed225);}(_0xd209,0xf8));var _0x9d20=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xd209[_0x3a6efd];return _0x487b9a;};'use strict';var SmsMessageEvents=require(_0x9d20('0x0'));var events=[_0x9d20('0x1'),'remove',_0x9d20('0x2')];function createListener(_0x471387,_0x4d96de){return function(_0x40e953){_0x4d96de[_0x9d20('0x3')](_0x471387,_0x40e953);};}function removeListener(_0x4446c5,_0xec3cc8){return function(){SmsMessageEvents[_0x9d20('0x4')](_0x4446c5,_0xec3cc8);};}exports[_0x9d20('0x5')]=function(_0x3a0c0a){for(var _0x26ff8d=0x0,_0x1f9b9d=events[_0x9d20('0x6')];_0x26ff8d<_0x1f9b9d;_0x26ff8d++){var _0x10fa4f=events[_0x26ff8d];var _0x46748f=createListener(_0x9d20('0x7')+_0x10fa4f,_0x3a0c0a);SmsMessageEvents['on'](_0x10fa4f,_0x46748f);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index e9a0816..79a2c4e 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 _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 +var _0x89fb=['addAgents','put','update','destroy','delete','removeTeams','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','create','post','/:id/teams','addTeams'];(function(_0x13ba18,_0x39041f){var _0x5e292a=function(_0x4f35da){while(--_0x4f35da){_0x13ba18['push'](_0x13ba18['shift']());}};_0x5e292a(++_0x39041f);}(_0x89fb,0x14b));var _0xb89f=function(_0x2a3e29,_0x367135){_0x2a3e29=_0x2a3e29-0x0;var _0x472dca=_0x89fb[_0x2a3e29];return _0x472dca;};'use strict';var multer=require('multer');var util=require(_0xb89f('0x0'));var path=require(_0xb89f('0x1'));var timeout=require(_0xb89f('0x2'));var express=require(_0xb89f('0x3'));var router=express[_0xb89f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb89f('0x5'));var config=require(_0xb89f('0x6'));var controller=require(_0xb89f('0x7'));router[_0xb89f('0x8')]('/',auth[_0xb89f('0x9')](),controller['index']);router[_0xb89f('0x8')]('/describe',auth[_0xb89f('0x9')](),controller['describe']);router[_0xb89f('0x8')](_0xb89f('0xa'),auth[_0xb89f('0x9')](),controller['show']);router[_0xb89f('0x8')](_0xb89f('0xb'),auth[_0xb89f('0x9')](),controller[_0xb89f('0xc')]);router[_0xb89f('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0xb89f('0xd')]);router[_0xb89f('0x8')](_0xb89f('0xe'),auth[_0xb89f('0x9')](),controller[_0xb89f('0xf')]);router['post']('/',auth[_0xb89f('0x9')](),controller[_0xb89f('0x10')]);router[_0xb89f('0x11')](_0xb89f('0x12'),auth[_0xb89f('0x9')](),controller[_0xb89f('0x13')]);router['post'](_0xb89f('0xe'),auth[_0xb89f('0x9')](),controller[_0xb89f('0x14')]);router[_0xb89f('0x15')](_0xb89f('0xa'),auth[_0xb89f('0x9')](),controller[_0xb89f('0x16')]);router['delete'](_0xb89f('0xa'),auth[_0xb89f('0x9')](),controller[_0xb89f('0x17')]);router[_0xb89f('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0xb89f('0x19')]);router[_0xb89f('0x18')](_0xb89f('0xe'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xb89f('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 226a9b8..2c92097 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 _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 +var _0x3329=['roundrobin','sequelize','STRING','name','rrmemory','beepall'];(function(_0x43c816,_0x951a48){var _0x418ed3=function(_0x52ebdf){while(--_0x52ebdf){_0x43c816['push'](_0x43c816['shift']());}};_0x418ed3(++_0x951a48);}(_0x3329,0x139));var _0x9332=function(_0x2baaf0,_0x41d3ee){_0x2baaf0=_0x2baaf0-0x0;var _0x13a12e=_0x3329[_0x2baaf0];return _0x13a12e;};'use strict';var Sequelize=require(_0x9332('0x0'));module['exports']={'name':{'type':Sequelize[_0x9332('0x1')],'unique':_0x9332('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9332('0x3'),_0x9332('0x4'),_0x9332('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index d30bd17..5e189af 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 _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 +var _0x3eea=['createdAt','getTeams','addTeams','Team','User','Agents','online','voicePause','interface','flatMap','transaction','forEach','emit','userSmsQueue:save','removeTeams','findAll','ids','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','register','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','index','map','rawAttributes','type','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','SmsQueue','rows','catch','show','params','intersection','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserSmsQueue','fields','SmsQueueId','findAndCountAll','agent','format','%s/%s','SIP','smsPause'];(function(_0x7eaf3b,_0x30447e){var _0x3e6565=function(_0x25d3af){while(--_0x25d3af){_0x7eaf3b['push'](_0x7eaf3b['shift']());}};_0x3e6565(++_0x30447e);}(_0x3eea,0x1ca));var _0xa3ee=function(_0xb0d68e,_0x38758c){_0xb0d68e=_0xb0d68e-0x0;var _0x1f51b8=_0x3eea[_0xb0d68e];return _0x1f51b8;};'use strict';var pdf=require(_0xa3ee('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa3ee('0x1'));var zipdir=require(_0xa3ee('0x2'));var jsonpatch=require(_0xa3ee('0x3'));var rp=require(_0xa3ee('0x4'));var moment=require(_0xa3ee('0x5'));var BPromise=require(_0xa3ee('0x6'));var Mustache=require(_0xa3ee('0x7'));var util=require(_0xa3ee('0x8'));var path=require(_0xa3ee('0x9'));var sox=require(_0xa3ee('0xa'));var csv=require(_0xa3ee('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa3ee('0xc'));var crypto=require('crypto');var jsforce=require(_0xa3ee('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa3ee('0xb'));var querystring=require('querystring');var Papa=require(_0xa3ee('0xe'));var Redis=require('ioredis');var authService=require(_0xa3ee('0xf'));var qs=require(_0xa3ee('0x10'));var as=require(_0xa3ee('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3ee('0x12'))(_0xa3ee('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa3ee('0x14'));var db=require(_0xa3ee('0x15'))['db'];config[_0xa3ee('0x16')]=_[_0xa3ee('0x17')](config['redis'],{'host':_0xa3ee('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa3ee('0x16')]));require(_0xa3ee('0x19'))[_0xa3ee('0x1a')](socket);function respondWithStatusCode(_0x150e20,_0x527c59){_0x527c59=_0x527c59||0xcc;return function(_0x2a82e5){if(_0x2a82e5){return _0x150e20[_0xa3ee('0x1b')](_0x527c59);}return _0x150e20['status'](_0x527c59)['end']();};}function respondWithResult(_0x4b2c66,_0x40decb){_0x40decb=_0x40decb||0xc8;return function(_0x7277cd){if(_0x7277cd){return _0x4b2c66[_0xa3ee('0x1c')](_0x40decb)[_0xa3ee('0x1d')](_0x7277cd);}};}function respondWithFilteredResult(_0x4cc8bb,_0x4735b7){return function(_0x40ffdb){if(_0x40ffdb){var _0x339758=_0x40ffdb[_0xa3ee('0x1e')],_0x299b1e=_0x4735b7[_0xa3ee('0x1f')],_0xfab13e=_0x4735b7[_0xa3ee('0x1f')]+_0x4735b7[_0xa3ee('0x20')],_0x4aac0e;if(_0xfab13e>=_0x339758){_0xfab13e=_0x339758;_0x4aac0e=0xc8;}else{_0x4aac0e=0xce;}_0x4cc8bb[_0xa3ee('0x1c')](_0x4aac0e);return _0x4cc8bb[_0xa3ee('0x21')]('Content-Range',_0x299b1e+'-'+_0xfab13e+'/'+_0x339758)[_0xa3ee('0x1d')](_0x40ffdb);}return null;};}function patchUpdates(_0x446971){return function(_0x4b8445){try{jsonpatch[_0xa3ee('0x22')](_0x4b8445,_0x446971,!![]);}catch(_0x4e7f32){return BPromise[_0xa3ee('0x23')](_0x4e7f32);}return _0x4b8445[_0xa3ee('0x24')]();};}function saveUpdates(_0x1d3022,_0x1bd196){return function(_0x60b899){if(_0x60b899){return _0x60b899[_0xa3ee('0x25')](_0x1d3022)[_0xa3ee('0x26')](function(_0x12108e){return _0x12108e;});}return null;};}function removeEntity(_0x5ae0a1,_0x3aa81d){return function(_0x5b682b){if(_0x5b682b){return _0x5b682b[_0xa3ee('0x27')]()[_0xa3ee('0x26')](function(){var _0x157071=_0x5b682b[_0xa3ee('0x28')]({'plain':!![]});var _0x2c48db='SmsQueues';return db[_0xa3ee('0x29')][_0xa3ee('0x27')]({'where':{'type':_0x2c48db,'resourceId':_0x157071['id']}})[_0xa3ee('0x26')](function(){return _0x5b682b;});})[_0xa3ee('0x26')](function(){_0x5ae0a1[_0xa3ee('0x1c')](0xcc)[_0xa3ee('0x2a')]();});}};}function handleEntityNotFound(_0x443507,_0x30b12b){return function(_0xea54fe){if(!_0xea54fe){_0x443507[_0xa3ee('0x1b')](0x194);}return _0xea54fe;};}function handleError(_0x59c6f9,_0x5ba571){_0x5ba571=_0x5ba571||0x1f4;return function(_0x4abf49){logger[_0xa3ee('0x2b')](_0x4abf49['stack']);if(_0x4abf49[_0xa3ee('0x2c')]){delete _0x4abf49[_0xa3ee('0x2c')];}_0x59c6f9[_0xa3ee('0x1c')](_0x5ba571)[_0xa3ee('0x2d')](_0x4abf49);};}exports[_0xa3ee('0x2e')]=function(_0x14547d,_0x30ba4e){var _0x1dd03b={},_0x120d81={},_0x2cc835={'count':0x0,'rows':[]};var _0x4b717a=_[_0xa3ee('0x2f')](db['SmsQueue'][_0xa3ee('0x30')],function(_0x332d61){return{'name':_0x332d61['fieldName'],'type':_0x332d61[_0xa3ee('0x31')]['key']};});_0x120d81[_0xa3ee('0x32')]=_['map'](_0x4b717a,_0xa3ee('0x2c'));_0x120d81[_0xa3ee('0x33')]=_[_0xa3ee('0x34')](_0x14547d[_0xa3ee('0x33')]);_0x120d81[_0xa3ee('0x35')]=_['intersection'](_0x120d81[_0xa3ee('0x32')],_0x120d81[_0xa3ee('0x33')]);_0x1dd03b[_0xa3ee('0x36')]=_['intersection'](_0x120d81[_0xa3ee('0x32')],qs['fields'](_0x14547d[_0xa3ee('0x33')]['fields']));_0x1dd03b[_0xa3ee('0x36')]=_0x1dd03b['attributes'][_0xa3ee('0x37')]?_0x1dd03b[_0xa3ee('0x36')]:_0x120d81[_0xa3ee('0x32')];if(!_0x14547d[_0xa3ee('0x33')][_0xa3ee('0x38')](_0xa3ee('0x39'))){_0x1dd03b[_0xa3ee('0x20')]=qs[_0xa3ee('0x20')](_0x14547d[_0xa3ee('0x33')][_0xa3ee('0x20')]);_0x1dd03b[_0xa3ee('0x1f')]=qs[_0xa3ee('0x1f')](_0x14547d[_0xa3ee('0x33')]['offset']);}_0x1dd03b[_0xa3ee('0x3a')]=qs[_0xa3ee('0x3b')](_0x14547d[_0xa3ee('0x33')][_0xa3ee('0x3b')]);_0x1dd03b['where']=qs[_0xa3ee('0x35')](_[_0xa3ee('0x3c')](_0x14547d[_0xa3ee('0x33')],_0x120d81['filters']),_0x4b717a);if(_0x14547d[_0xa3ee('0x33')][_0xa3ee('0x3d')]){_0x1dd03b['where']=_[_0xa3ee('0x3e')](_0x1dd03b[_0xa3ee('0x3f')],{'$or':_['map'](_0x4b717a,function(_0x2a8e02){if(_0x2a8e02[_0xa3ee('0x31')]!==_0xa3ee('0x40')){var _0x2c8873={};_0x2c8873[_0x2a8e02[_0xa3ee('0x2c')]]={'$like':'%'+_0x14547d[_0xa3ee('0x33')][_0xa3ee('0x3d')]+'%'};return _0x2c8873;}})});}_0x1dd03b=_[_0xa3ee('0x3e')]({},_0x1dd03b,_0x14547d[_0xa3ee('0x41')]);var _0x2df069={'where':_0x1dd03b[_0xa3ee('0x3f')]};return db['SmsQueue']['count'](_0x2df069)['then'](function(_0x45aeec){_0x2cc835[_0xa3ee('0x1e')]=_0x45aeec;if(_0x14547d['query'][_0xa3ee('0x42')]){_0x1dd03b[_0xa3ee('0x43')]=[{'all':!![]}];}return db[_0xa3ee('0x44')]['findAll'](_0x1dd03b);})[_0xa3ee('0x26')](function(_0x559cc1){_0x2cc835[_0xa3ee('0x45')]=_0x559cc1;return _0x2cc835;})[_0xa3ee('0x26')](respondWithFilteredResult(_0x30ba4e,_0x1dd03b))[_0xa3ee('0x46')](handleError(_0x30ba4e,null));};exports[_0xa3ee('0x47')]=function(_0x1a8535,_0x413b4d){var _0x3dd243={'raw':!![],'where':{'id':_0x1a8535[_0xa3ee('0x48')]['id']}},_0x9875c0={};_0x9875c0[_0xa3ee('0x32')]=_[_0xa3ee('0x34')](db[_0xa3ee('0x44')][_0xa3ee('0x30')]);_0x9875c0[_0xa3ee('0x33')]=_[_0xa3ee('0x34')](_0x1a8535[_0xa3ee('0x33')]);_0x9875c0[_0xa3ee('0x35')]=_[_0xa3ee('0x49')](_0x9875c0['model'],_0x9875c0[_0xa3ee('0x33')]);_0x3dd243[_0xa3ee('0x36')]=_[_0xa3ee('0x49')](_0x9875c0[_0xa3ee('0x32')],qs['fields'](_0x1a8535[_0xa3ee('0x33')]['fields']));_0x3dd243[_0xa3ee('0x36')]=_0x3dd243[_0xa3ee('0x36')][_0xa3ee('0x37')]?_0x3dd243[_0xa3ee('0x36')]:_0x9875c0[_0xa3ee('0x32')];if(_0x1a8535[_0xa3ee('0x33')][_0xa3ee('0x42')]){_0x3dd243[_0xa3ee('0x43')]=[{'all':!![]}];}_0x3dd243=_[_0xa3ee('0x3e')]({},_0x3dd243,_0x1a8535[_0xa3ee('0x41')]);return db['SmsQueue'][_0xa3ee('0x4a')](_0x3dd243)['then'](handleEntityNotFound(_0x413b4d,null))['then'](respondWithResult(_0x413b4d,null))[_0xa3ee('0x46')](handleError(_0x413b4d,null));};exports[_0xa3ee('0x4b')]=function(_0x45029f,_0x1ec479){return db[_0xa3ee('0x44')][_0xa3ee('0x4b')](_0x45029f[_0xa3ee('0x4c')],{})['then'](function(_0x2d67f7){var _0x3ba287=_0x45029f['user'][_0xa3ee('0x28')]({'plain':!![]});if(!_0x3ba287)throw new Error(_0xa3ee('0x4d'));if(_0x3ba287[_0xa3ee('0x4e')]==='user'){var _0x587a1a=_0x2d67f7[_0xa3ee('0x28')]({'plain':!![]});var _0x345b5b=_0xa3ee('0x4f');return db[_0xa3ee('0x50')][_0xa3ee('0x4a')]({'where':{'name':_0x345b5b,'userProfileId':_0x3ba287['userProfileId']},'raw':!![]})['then'](function(_0x15b55e){if(_0x15b55e&&_0x15b55e[_0xa3ee('0x51')]===0x0){return db['UserProfileResource'][_0xa3ee('0x4b')]({'name':_0x587a1a[_0xa3ee('0x2c')],'resourceId':_0x587a1a['id'],'type':_0x15b55e[_0xa3ee('0x2c')],'sectionId':_0x15b55e['id']},{})['then'](function(){return _0x2d67f7;});}else{return _0x2d67f7;}})['catch'](function(_0x2388f7){logger['error'](_0xa3ee('0x52'),_0x2388f7);throw _0x2388f7;});}return _0x2d67f7;})[_0xa3ee('0x26')](respondWithResult(_0x1ec479,0xc9))['catch'](handleError(_0x1ec479,null));};exports[_0xa3ee('0x25')]=function(_0xf7b378,_0x25e34d){if(_0xf7b378['body']['id']){delete _0xf7b378[_0xa3ee('0x4c')]['id'];}return db[_0xa3ee('0x44')]['find']({'where':{'id':_0xf7b378[_0xa3ee('0x48')]['id']}})[_0xa3ee('0x26')](handleEntityNotFound(_0x25e34d,null))[_0xa3ee('0x26')](saveUpdates(_0xf7b378['body'],null))['then'](respondWithResult(_0x25e34d,null))[_0xa3ee('0x46')](handleError(_0x25e34d,null));};exports[_0xa3ee('0x27')]=function(_0x4a1a2f,_0x1f9913){return db[_0xa3ee('0x44')]['find']({'where':{'id':_0x4a1a2f['params']['id']}})[_0xa3ee('0x26')](handleEntityNotFound(_0x1f9913,null))[_0xa3ee('0x26')](removeEntity(_0x1f9913,null))[_0xa3ee('0x46')](handleError(_0x1f9913,null));};exports['describe']=function(_0x11fb6e,_0x1f401d){return db[_0xa3ee('0x44')][_0xa3ee('0x53')]()[_0xa3ee('0x26')](respondWithResult(_0x1f401d,null))[_0xa3ee('0x46')](handleError(_0x1f401d,null));};exports['getMembers']=function(_0x10f508,_0x2517ec,_0x4d09b4){var _0x374e1d={'raw':!![],'where':{}},_0x41536a={},_0x19fb7e;return db[_0xa3ee('0x44')][_0xa3ee('0x54')]({'where':{'id':_0x10f508[_0xa3ee('0x48')]['id']}})['then'](handleEntityNotFound(_0x2517ec,null))[_0xa3ee('0x26')](function(_0x17d06d){if(_0x17d06d){_0x19fb7e=_0x17d06d[_0xa3ee('0x28')]({'plain':!![]});_0x41536a['model']=_[_0xa3ee('0x34')](db[_0xa3ee('0x55')]['rawAttributes']);_0x41536a['query']=_['keys'](_0x10f508['query']);_0x41536a[_0xa3ee('0x35')]=_[_0xa3ee('0x49')](_0x41536a[_0xa3ee('0x32')],_0x41536a[_0xa3ee('0x33')]);_0x374e1d[_0xa3ee('0x36')]=_[_0xa3ee('0x49')](_0x41536a[_0xa3ee('0x32')],qs['fields'](_0x10f508[_0xa3ee('0x33')][_0xa3ee('0x56')]));_0x374e1d[_0xa3ee('0x36')]=_0x374e1d[_0xa3ee('0x36')][_0xa3ee('0x37')]?_0x374e1d['attributes']:_0x41536a['model'];if(!_0x10f508[_0xa3ee('0x33')][_0xa3ee('0x38')](_0xa3ee('0x39'))){_0x374e1d[_0xa3ee('0x20')]=qs[_0xa3ee('0x20')](_0x10f508[_0xa3ee('0x33')][_0xa3ee('0x20')]);_0x374e1d[_0xa3ee('0x1f')]=qs[_0xa3ee('0x1f')](_0x10f508[_0xa3ee('0x33')][_0xa3ee('0x1f')]);}_0x374e1d[_0xa3ee('0x3a')]=qs[_0xa3ee('0x3b')](_0x10f508[_0xa3ee('0x33')][_0xa3ee('0x3b')]);_0x374e1d['where']=qs[_0xa3ee('0x35')](_['pick'](_0x10f508['query'],_0x41536a[_0xa3ee('0x35')]));_0x374e1d['where'][_0xa3ee('0x57')]=_0x17d06d['id'];if(_0x10f508[_0xa3ee('0x33')][_0xa3ee('0x3d')]){_0x374e1d[_0xa3ee('0x3f')]=_['merge'](_0x374e1d[_0xa3ee('0x3f')],{'$or':_[_0xa3ee('0x2f')](_0x374e1d[_0xa3ee('0x36')],function(_0x370e3e){var _0x479123={};_0x479123[_0x370e3e]={'$like':'%'+_0x10f508[_0xa3ee('0x33')][_0xa3ee('0x3d')]+'%'};return _0x479123;})});}_0x374e1d=_['merge']({},_0x374e1d,_0x10f508[_0xa3ee('0x41')]);return db['UserSmsQueue']['findAll'](_0x374e1d);}})[_0xa3ee('0x26')](function(_0x4870a3){if(_0x4870a3){return db['User'][_0xa3ee('0x58')]({'where':{'id':_['map'](_0x4870a3,'UserId'),'role':_0xa3ee('0x59')},'attributes':['id',_0xa3ee('0x2c'),'smsPause','updatedAt','createdAt']});}})[_0xa3ee('0x26')](function(_0x133e58){if(_0x133e58){return{'count':_0x133e58[_0xa3ee('0x1e')],'rows':_[_0xa3ee('0x2f')](_0x133e58[_0xa3ee('0x45')],function(_0x1b7ff6){return{'membername':_0x1b7ff6['name'],'UserId':_0x1b7ff6['id'],'queue_name':_0x19fb7e['name'],'SmsQueueId':_0x19fb7e['id'],'interface':util[_0xa3ee('0x5a')](_0xa3ee('0x5b'),_0xa3ee('0x5c'),_0x1b7ff6['name']),'penalty':0x0,'paused':_0x1b7ff6[_0xa3ee('0x5d')],'createdAt':_0x1b7ff6[_0xa3ee('0x5e')],'updatedAt':_0x1b7ff6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa3ee('0x26')](respondWithFilteredResult(_0x2517ec,_0x374e1d))[_0xa3ee('0x46')](handleError(_0x2517ec,null));};exports[_0xa3ee('0x5f')]=function(_0x2ad745,_0x117c3e,_0x58a7db){var _0x39c495={};var _0x432b8a={};var _0x9d9915;var _0x37e1c2;return db[_0xa3ee('0x44')][_0xa3ee('0x54')]({'where':{'id':_0x2ad745[_0xa3ee('0x48')]['id']}})[_0xa3ee('0x26')](handleEntityNotFound(_0x117c3e,null))[_0xa3ee('0x26')](function(_0x5e51fa){if(_0x5e51fa){_0x9d9915=_0x5e51fa;_0x432b8a['model']=_[_0xa3ee('0x34')](db['Team'][_0xa3ee('0x30')]);_0x432b8a[_0xa3ee('0x33')]=_[_0xa3ee('0x34')](_0x2ad745[_0xa3ee('0x33')]);_0x432b8a['filters']=_[_0xa3ee('0x49')](_0x432b8a[_0xa3ee('0x32')],_0x432b8a[_0xa3ee('0x33')]);_0x39c495[_0xa3ee('0x36')]=_[_0xa3ee('0x49')](_0x432b8a['model'],qs[_0xa3ee('0x56')](_0x2ad745[_0xa3ee('0x33')][_0xa3ee('0x56')]));_0x39c495['attributes']=_0x39c495[_0xa3ee('0x36')]['length']?_0x39c495[_0xa3ee('0x36')]:_0x432b8a['model'];_0x39c495[_0xa3ee('0x3a')]=qs[_0xa3ee('0x3b')](_0x2ad745[_0xa3ee('0x33')][_0xa3ee('0x3b')]);_0x39c495['where']=qs[_0xa3ee('0x35')](_[_0xa3ee('0x3c')](_0x2ad745['query'],_0x432b8a[_0xa3ee('0x35')]));if(_0x2ad745[_0xa3ee('0x33')][_0xa3ee('0x3d')]){_0x39c495[_0xa3ee('0x3f')]=_[_0xa3ee('0x3e')](_0x39c495['where'],{'$or':_[_0xa3ee('0x2f')](_0x39c495[_0xa3ee('0x36')],function(_0x55a6b7){var _0x2535ef={};_0x2535ef[_0x55a6b7]={'$like':'%'+_0x2ad745[_0xa3ee('0x33')][_0xa3ee('0x3d')]+'%'};return _0x2535ef;})});}_0x39c495=_[_0xa3ee('0x3e')]({},_0x39c495,_0x2ad745[_0xa3ee('0x41')]);return _0x9d9915[_0xa3ee('0x5f')](_0x39c495);}})[_0xa3ee('0x26')](function(_0x329e32){if(_0x329e32){_0x37e1c2=_0x329e32[_0xa3ee('0x37')];if(!_0x2ad745[_0xa3ee('0x33')]['hasOwnProperty'](_0xa3ee('0x39'))){_0x39c495[_0xa3ee('0x20')]=qs[_0xa3ee('0x20')](_0x2ad745['query'][_0xa3ee('0x20')]);_0x39c495['offset']=qs[_0xa3ee('0x1f')](_0x2ad745[_0xa3ee('0x33')]['offset']);}return _0x9d9915[_0xa3ee('0x5f')](_0x39c495);}})[_0xa3ee('0x26')](function(_0x55a333){if(_0x55a333){return _0x55a333?{'count':_0x37e1c2,'rows':_0x55a333}:null;}})[_0xa3ee('0x26')](respondWithResult(_0x117c3e,null))[_0xa3ee('0x46')](handleError(_0x117c3e,null));};exports[_0xa3ee('0x60')]=function(_0x27cf3f,_0xc43c3,_0x3395b8){var _0x4c6a41=_0x27cf3f['body']['ids'];return db[_0xa3ee('0x61')]['findAll']({'where':{'id':_0x4c6a41},'attributes':['id'],'include':[{'model':db[_0xa3ee('0x62')],'as':_0xa3ee('0x63'),'attributes':['id',_0xa3ee('0x2c'),_0xa3ee('0x64'),_0xa3ee('0x65'),_0xa3ee('0x66')],'raw':!![]}]})[_0xa3ee('0x26')](function(_0xea3d66){if(_0xea3d66){var _0x473bfc=_[_0xa3ee('0x67')](_0xea3d66,function(_0x1787bc){var _0x98482f=_0x1787bc[_0xa3ee('0x28')]({'plain':!![]});return _0x98482f[_0xa3ee('0x63')];});return db[_0xa3ee('0x44')][_0xa3ee('0x4a')]({'where':{'id':_0x27cf3f[_0xa3ee('0x48')]['id']}})[_0xa3ee('0x26')](function(_0x229832){return db['sequelize'][_0xa3ee('0x68')](function(_0x42cff2){return _0x229832[_0xa3ee('0x60')](_0x4c6a41,{'transaction':_0x42cff2})['then'](function(){return BPromise['each'](_0x473bfc,function(_0xc83f50){return db[_0xa3ee('0x55')]['findOrCreate']({'where':{'UserId':_0xc83f50['id'],'SmsQueueId':_0x27cf3f['params']['id']},'transaction':_0x42cff2});});})[_0xa3ee('0x26')](function(){_0x473bfc[_0xa3ee('0x69')](function(_0x212ed0){socket[_0xa3ee('0x6a')](_0xa3ee('0x6b'),{'UserId':_0x212ed0['id'],'SmsQueueId':_0x229832['id']});});});});});}})[_0xa3ee('0x26')](respondWithStatusCode(_0xc43c3,null))[_0xa3ee('0x46')](handleError(_0xc43c3,null));};exports[_0xa3ee('0x6c')]=function(_0x34ab5b,_0x3e6657,_0x312e28){return db[_0xa3ee('0x61')][_0xa3ee('0x6d')]({'where':{'id':_0x34ab5b['query'][_0xa3ee('0x6e')]},'attributes':['id'],'include':[{'model':db[_0xa3ee('0x62')],'as':_0xa3ee('0x63'),'attributes':['id'],'raw':!![]}]})[_0xa3ee('0x26')](handleEntityNotFound(_0x3e6657,null))[_0xa3ee('0x26')](function(_0x31475a){var _0x4cc5e5=_['map'](_0x31475a,'id');var _0x1f9fda=[];var _0x3bbaa0=[];var _0xdc8b7a=squel['select']();_0xdc8b7a[_0xa3ee('0x6f')]('tq.TeamId')[_0xa3ee('0x70')](_0xa3ee('0x71'),'tq')[_0xa3ee('0x72')](_0xa3ee('0x73'),'ut',_0xa3ee('0x74'))[_0xa3ee('0x3f')](_0xa3ee('0x75'),_0x34ab5b[_0xa3ee('0x48')]['id']);for(var _0x116de1=0x0;_0x116de1<_0x31475a[_0xa3ee('0x37')];_0x116de1+=0x1){let _0x5bdca6=_0x31475a[_0x116de1];for(var _0x4f50df=0x0;_0x4f50df<_0x5bdca6['Agents'][_0xa3ee('0x37')];_0x4f50df+=0x1){let _0x51c231=_0x5bdca6[_0xa3ee('0x63')][_0x4f50df];var _0x2c1261=_0xdc8b7a[_0xa3ee('0x76')]();_0x2c1261[_0xa3ee('0x3f')](_0xa3ee('0x77'),_0x51c231['id']);_0x3bbaa0[_0xa3ee('0x78')](db[_0xa3ee('0x79')][_0xa3ee('0x33')](_0x2c1261[_0xa3ee('0x7a')](),{'type':db['sequelize']['QueryTypes'][_0xa3ee('0x7b')]})[_0xa3ee('0x26')](function(_0x2c4959){if(_0x2c4959[_0xa3ee('0x37')]===0x1){return _0x51c231['id'];}else{var _0x119f26=_[_0xa3ee('0x7c')](_['map'](_0x2c4959,_0xa3ee('0x7d')),function(_0x390006){return _[_0xa3ee('0x7e')](_0x4cc5e5,_0x390006);});if(_0x119f26){return _0x51c231['id'];}}}));}}return BPromise[_0xa3ee('0x7f')](_0x3bbaa0)[_0xa3ee('0x26')](function(_0x1d01fc){_0x1f9fda=_(_0x1f9fda)[_0xa3ee('0x80')](_0x1d01fc)[_0xa3ee('0x81')]()[_0xa3ee('0x82')]();return db[_0xa3ee('0x44')]['find']({'where':{'id':_0x34ab5b[_0xa3ee('0x48')]['id']}})[_0xa3ee('0x26')](function(_0x40fa1a){return db[_0xa3ee('0x79')][_0xa3ee('0x68')](function(_0x156541){return _0x40fa1a['removeTeams'](_0x34ab5b['query']['ids'],{'transaction':_0x156541})['then'](function(){if(!_['isEmpty'](_0x1f9fda)){return _0x40fa1a[_0xa3ee('0x83')](_0x1f9fda,{'transaction':_0x156541});}})['then'](function(){_0x1f9fda[_0xa3ee('0x69')](function(_0x550f98){socket[_0xa3ee('0x6a')](_0xa3ee('0x84'),{'UserId':_0x550f98,'SmsQueueId':_0x40fa1a['id']});});});});});});})[_0xa3ee('0x26')](respondWithStatusCode(_0x3e6657,null))[_0xa3ee('0x46')](handleError(_0x3e6657,null));};exports[_0xa3ee('0x85')]=function(_0x20e97f,_0x151bc2,_0x8169ec){return db[_0xa3ee('0x44')][_0xa3ee('0x4a')]({'where':{'id':_0x20e97f[_0xa3ee('0x48')]['id']}})[_0xa3ee('0x26')](handleEntityNotFound(_0x151bc2,null))['then'](function(_0xe93682){if(_0xe93682){return _0xe93682[_0xa3ee('0x85')](_0x20e97f[_0xa3ee('0x4c')][_0xa3ee('0x6e')],_[_0xa3ee('0x86')](_0x20e97f[_0xa3ee('0x4c')],[_0xa3ee('0x6e'),'id'])||{})[_0xa3ee('0x87')](function(_0x241870){for(var _0x31c6d7=0x0;_0x31c6d7<_0x20e97f[_0xa3ee('0x4c')][_0xa3ee('0x6e')][_0xa3ee('0x37')];_0x31c6d7+=0x1){socket[_0xa3ee('0x6a')](_0xa3ee('0x6b'),{'UserId':_0x20e97f[_0xa3ee('0x4c')]['ids'][_0x31c6d7],'SmsQueueId':_0x20e97f['params']['id']});}return _0x241870;});}})['then'](respondWithResult(_0x151bc2,null))[_0xa3ee('0x46')](handleError(_0x151bc2,null));};exports['removeAgents']=function(_0x3f91f8,_0x11c0ce,_0x27c19d){return db[_0xa3ee('0x44')][_0xa3ee('0x4a')]({'where':{'id':_0x3f91f8[_0xa3ee('0x48')]['id']}})[_0xa3ee('0x26')](handleEntityNotFound(_0x11c0ce,null))[_0xa3ee('0x26')](function(_0x75e9db){if(_0x75e9db){return _0x75e9db[_0xa3ee('0x83')](_0x3f91f8['query'][_0xa3ee('0x6e')])[_0xa3ee('0x26')](function(){if(_[_0xa3ee('0x88')](_0x3f91f8['query'][_0xa3ee('0x6e')])){for(var _0x15ec1f=0x0;_0x15ec1f<_0x3f91f8['query'][_0xa3ee('0x6e')][_0xa3ee('0x37')];_0x15ec1f+=0x1){socket['emit'](_0xa3ee('0x84'),{'UserId':Number(_0x3f91f8['query'][_0xa3ee('0x6e')][_0x15ec1f]),'SmsQueueId':Number(_0x3f91f8[_0xa3ee('0x48')]['id'])});}}else{socket['emit'](_0xa3ee('0x84'),{'UserId':Number(_0x3f91f8['query'][_0xa3ee('0x6e')]),'SmsQueueId':Number(_0x3f91f8[_0xa3ee('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x11c0ce,null))[_0xa3ee('0x46')](handleError(_0x11c0ce,null));};exports[_0xa3ee('0x89')]=function(_0x2fd26d,_0x25ff19,_0x426e4c){var _0x58b19a={};var _0x56b103={};var _0x49b0fe;var _0x384f1b;return db[_0xa3ee('0x44')][_0xa3ee('0x54')]({'where':{'id':_0x2fd26d['params']['id']}})[_0xa3ee('0x26')](handleEntityNotFound(_0x25ff19,null))[_0xa3ee('0x26')](function(_0x1a76c1){if(_0x1a76c1){_0x49b0fe=_0x1a76c1;_0x56b103[_0xa3ee('0x32')]=_['keys'](db['User'][_0xa3ee('0x30')]);_0x56b103['query']=_[_0xa3ee('0x34')](_0x2fd26d[_0xa3ee('0x33')]);_0x56b103[_0xa3ee('0x35')]=_[_0xa3ee('0x49')](_0x56b103[_0xa3ee('0x32')],_0x56b103[_0xa3ee('0x33')]);_0x58b19a[_0xa3ee('0x36')]=_[_0xa3ee('0x49')](_0x56b103[_0xa3ee('0x32')],qs[_0xa3ee('0x56')](_0x2fd26d[_0xa3ee('0x33')][_0xa3ee('0x56')]));_0x58b19a[_0xa3ee('0x36')]=_0x58b19a[_0xa3ee('0x36')][_0xa3ee('0x37')]?_0x58b19a[_0xa3ee('0x36')]:_0x56b103[_0xa3ee('0x32')];_0x58b19a['order']=qs[_0xa3ee('0x3b')](_0x2fd26d[_0xa3ee('0x33')][_0xa3ee('0x3b')]);_0x58b19a['where']=qs[_0xa3ee('0x35')](_[_0xa3ee('0x3c')](_0x2fd26d['query'],_0x56b103['filters']));if(_0x2fd26d[_0xa3ee('0x33')][_0xa3ee('0x3d')]){_0x58b19a['where']=_['merge'](_0x58b19a['where'],{'$or':_['map'](_0x58b19a[_0xa3ee('0x36')],function(_0x29a88c){var _0x2afc1f={};_0x2afc1f[_0x29a88c]={'$like':'%'+_0x2fd26d[_0xa3ee('0x33')][_0xa3ee('0x3d')]+'%'};return _0x2afc1f;})});}_0x58b19a=_[_0xa3ee('0x3e')]({},_0x58b19a,_0x2fd26d[_0xa3ee('0x41')]);return _0x49b0fe[_0xa3ee('0x89')](_0x58b19a);}})[_0xa3ee('0x26')](function(_0x2d5fe9){if(_0x2d5fe9){_0x384f1b=_0x2d5fe9[_0xa3ee('0x37')];if(!_0x2fd26d[_0xa3ee('0x33')][_0xa3ee('0x38')](_0xa3ee('0x39'))){_0x58b19a[_0xa3ee('0x20')]=qs[_0xa3ee('0x20')](_0x2fd26d['query'][_0xa3ee('0x20')]);_0x58b19a[_0xa3ee('0x1f')]=qs[_0xa3ee('0x1f')](_0x2fd26d[_0xa3ee('0x33')]['offset']);}return _0x49b0fe[_0xa3ee('0x89')](_0x58b19a);}})[_0xa3ee('0x26')](function(_0x470c46){if(_0x470c46){return _0x470c46?{'count':_0x384f1b,'rows':_0x470c46}:null;}})[_0xa3ee('0x26')](respondWithResult(_0x25ff19,null))[_0xa3ee('0x46')](handleError(_0x25ff19,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 9ca3bac..403a6e7 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 _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 +var _0x9722=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','SmsQueue','setMaxListeners','save'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x9722,0x140));var _0x2972=function(_0x5313dd,_0x5d6a84){_0x5313dd=_0x5313dd-0x0;var _0x23aa4c=_0x9722[_0x5313dd];return _0x23aa4c;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x2972('0x0'))['db'][_0x2972('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x2972('0x2')](0x0);var events={'afterCreate':_0x2972('0x3'),'afterUpdate':_0x2972('0x4'),'afterDestroy':_0x2972('0x5')};function emitEvent(_0x4f83de){return function(_0x515d60,_0x48f8f6,_0x45d27d){SmsQueueEvents[_0x2972('0x6')](_0x4f83de+':'+_0x515d60['id'],_0x515d60);SmsQueueEvents[_0x2972('0x6')](_0x4f83de,_0x515d60);_0x45d27d(null);};}for(var e in events){if(events[_0x2972('0x7')](e)){var event=events[e];SmsQueue[_0x2972('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 90ee1dc..c45b468 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 _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 +var _0x07e5=['api','bluebird','request-promise','./smsQueue.attributes','exports','define','SmsQueue','lodash','util','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x07e5,0x133));var _0x507e=function(_0x479d3d,_0x32d023){_0x479d3d=_0x479d3d-0x0;var _0x3e614d=_0x07e5[_0x479d3d];return _0x3e614d;};'use strict';var _=require(_0x507e('0x0'));var util=require(_0x507e('0x1'));var logger=require(_0x507e('0x2'))(_0x507e('0x3'));var moment=require('moment');var BPromise=require(_0x507e('0x4'));var rp=require(_0x507e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x507e('0x6'));module[_0x507e('0x7')]=function(_0x263540,_0x2b423b){return _0x263540[_0x507e('0x8')](_0x507e('0x9'),attributes,{'tableName':'sms_queues','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 6f61527..17cc010 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 _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 +var _0x6dc7=['options','where','attributes','limit','include','map','model','ShowSmsQueue','find','raw','lodash','util','bluebird','randomstring','ioredis','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetSmsQueue','findAll'];(function(_0x244454,_0x14d478){var _0x1c8eb4=function(_0x43063f){while(--_0x43063f){_0x244454['push'](_0x244454['shift']());}};_0x1c8eb4(++_0x14d478);}(_0x6dc7,0x1ac));var _0x76dc=function(_0x383158,_0x415e43){_0x383158=_0x383158-0x0;var _0x507985=_0x6dc7[_0x383158];return _0x507985;};'use strict';var _=require(_0x76dc('0x0'));var util=require(_0x76dc('0x1'));var moment=require('moment');var BPromise=require(_0x76dc('0x2'));var rs=require(_0x76dc('0x3'));var fs=require('fs');var Redis=require(_0x76dc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x76dc('0x5'));var client=jayson[_0x76dc('0x6')][_0x76dc('0x7')]({'port':0x232a});config['redis']=_[_0x76dc('0x8')](config[_0x76dc('0x9')],{'host':_0x76dc('0xa'),'port':0x18eb});var socket=require(_0x76dc('0xb'))(new Redis(config[_0x76dc('0x9')]));require(_0x76dc('0xc'))[_0x76dc('0xd')](socket);function respondWithRpcPromise(_0x5ae3ad,_0x2df73a,_0x39dcff){return new BPromise(function(_0xfdc6a0,_0xe325f1){return client[_0x76dc('0xe')](_0x5ae3ad,_0x39dcff)[_0x76dc('0xf')](function(_0x533fc4){logger[_0x76dc('0x10')](_0x76dc('0x11'),_0x2df73a,'request\x20sent');logger[_0x76dc('0x12')](_0x76dc('0x13'),_0x2df73a,_0x76dc('0x14'),JSON[_0x76dc('0x15')](_0x533fc4));if(_0x533fc4[_0x76dc('0x16')]){if(_0x533fc4['error']['code']===0x1f4){logger[_0x76dc('0x16')](_0x76dc('0x11'),_0x2df73a,_0x533fc4['error'][_0x76dc('0x17')]);return _0xe325f1(_0x533fc4['error']['message']);}logger[_0x76dc('0x16')](_0x76dc('0x11'),_0x2df73a,_0x533fc4['error'][_0x76dc('0x17')]);return _0xfdc6a0(_0x533fc4[_0x76dc('0x16')][_0x76dc('0x17')]);}else{logger[_0x76dc('0x10')](_0x76dc('0x11'),_0x2df73a,'request\x20sent');_0xfdc6a0(_0x533fc4[_0x76dc('0x18')][_0x76dc('0x17')]);}})[_0x76dc('0x19')](function(_0x530dbb){logger['error'](_0x76dc('0x11'),_0x2df73a,_0x530dbb);_0xe325f1(_0x530dbb);});});}exports[_0x76dc('0x1a')]=function(_0x380efa){var _0x54c688=this;return new Promise(function(_0x33d68d,_0x3fb499){return db['SmsQueue'][_0x76dc('0x1b')]({'raw':_0x380efa['options']?_0x380efa[_0x76dc('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x380efa[_0x76dc('0x1c')]?_0x380efa[_0x76dc('0x1c')][_0x76dc('0x1d')]||null:null,'attributes':_0x380efa[_0x76dc('0x1c')]?_0x380efa[_0x76dc('0x1c')][_0x76dc('0x1e')]||null:null,'limit':_0x380efa[_0x76dc('0x1c')]?_0x380efa[_0x76dc('0x1c')][_0x76dc('0x1f')]||null:null,'include':_0x380efa['options']?_0x380efa[_0x76dc('0x1c')][_0x76dc('0x20')]?_[_0x76dc('0x21')](_0x380efa[_0x76dc('0x1c')][_0x76dc('0x20')],function(_0x2ff07a){return{'model':db[_0x2ff07a[_0x76dc('0x22')]],'as':_0x2ff07a['as'],'attributes':_0x2ff07a['attributes'],'include':_0x2ff07a[_0x76dc('0x20')]?_[_0x76dc('0x21')](_0x2ff07a['include'],function(_0x57c4e4){return{'model':db[_0x57c4e4['model']],'as':_0x57c4e4['as'],'attributes':_0x57c4e4[_0x76dc('0x1e')],'include':_0x57c4e4[_0x76dc('0x20')]?_['map'](_0x57c4e4[_0x76dc('0x20')],function(_0xd677a6){return{'model':db[_0xd677a6[_0x76dc('0x22')]],'as':_0xd677a6['as'],'attributes':_0xd677a6[_0x76dc('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x76dc('0xf')](function(_0x3d82f4){logger['info'](_0x76dc('0x1a'),_0x380efa);logger[_0x76dc('0x12')]('GetSmsQueue',_0x380efa,JSON[_0x76dc('0x15')](_0x3d82f4));_0x33d68d(_0x3d82f4);})['catch'](function(_0x5e43d9){logger[_0x76dc('0x16')](_0x76dc('0x1a'),_0x5e43d9['message'],_0x380efa);_0x3fb499(_0x54c688['error'](0x1f4,_0x5e43d9['message']));});});};exports[_0x76dc('0x23')]=function(_0x1056b3){var _0xbcf171=this;return new Promise(function(_0xa21692,_0x1442bb){return db['SmsQueue'][_0x76dc('0x24')]({'raw':_0x1056b3[_0x76dc('0x1c')]?_0x1056b3[_0x76dc('0x1c')][_0x76dc('0x25')]===undefined?!![]:![]:!![],'where':_0x1056b3[_0x76dc('0x1c')]?_0x1056b3[_0x76dc('0x1c')][_0x76dc('0x1d')]||null:null,'attributes':_0x1056b3[_0x76dc('0x1c')]?_0x1056b3['options']['attributes']||null:null,'include':_0x1056b3[_0x76dc('0x1c')]?_0x1056b3['options'][_0x76dc('0x20')]?_[_0x76dc('0x21')](_0x1056b3['options']['include'],function(_0x3474e5){return{'model':db[_0x3474e5[_0x76dc('0x22')]],'as':_0x3474e5['as'],'attributes':_0x3474e5[_0x76dc('0x1e')],'include':_0x3474e5[_0x76dc('0x20')]?_['map'](_0x3474e5['include'],function(_0x5c16ef){return{'model':db[_0x5c16ef['model']],'as':_0x5c16ef['as'],'attributes':_0x5c16ef[_0x76dc('0x1e')],'include':_0x5c16ef[_0x76dc('0x20')]?_[_0x76dc('0x21')](_0x5c16ef[_0x76dc('0x20')],function(_0x40412d){return{'model':db[_0x40412d['model']],'as':_0x40412d['as'],'attributes':_0x40412d['attributes']};}):[]};}):[]};}):[]:[]})[_0x76dc('0xf')](function(_0x133807){logger['info']('ShowSmsQueue',_0x1056b3);logger[_0x76dc('0x12')](_0x76dc('0x23'),_0x1056b3,JSON[_0x76dc('0x15')](_0x133807));_0xa21692(_0x133807);})[_0x76dc('0x19')](function(_0x503c83){logger[_0x76dc('0x16')](_0x76dc('0x23'),_0x503c83[_0x76dc('0x17')],_0x1056b3);_0x1442bb(_0xbcf171[_0x76dc('0x16')](0x1f4,_0x503c83['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 0ff0af2..9134a58 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 _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 +var _0xc533=['register','length','smsQueue:','./smsQueue.events','update','emit'];(function(_0x37cede,_0x391a5b){var _0x1bfc35=function(_0x479fdb){while(--_0x479fdb){_0x37cede['push'](_0x37cede['shift']());}};_0x1bfc35(++_0x391a5b);}(_0xc533,0x1d1));var _0x3c53=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xc533[_0x485b5a];return _0xd2b34d;};'use strict';var SmsQueueEvents=require(_0x3c53('0x0'));var events=['save','remove',_0x3c53('0x1')];function createListener(_0x1b5443,_0x1424f2){return function(_0x267d10){_0x1424f2[_0x3c53('0x2')](_0x1b5443,_0x267d10);};}function removeListener(_0x38d36b,_0x41b327){return function(){SmsQueueEvents['removeListener'](_0x38d36b,_0x41b327);};}exports[_0x3c53('0x3')]=function(_0x3790b9){for(var _0x3fdf22=0x0,_0x5696f6=events[_0x3c53('0x4')];_0x3fdf22<_0x5696f6;_0x3fdf22++){var _0x1c8375=events[_0x3fdf22];var _0x1bfdcb=createListener(_0x3c53('0x5')+_0x1c8375,_0x3790b9);SmsQueueEvents['on'](_0x1c8375,_0x1bfdcb);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index a8ceff2..92e9850 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 _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 +var _0x460c=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update'];(function(_0x2f1f08,_0x158f35){var _0x32f365=function(_0x2cc60e){while(--_0x2cc60e){_0x2f1f08['push'](_0x2f1f08['shift']());}};_0x32f365(++_0x158f35);}(_0x460c,0xf4));var _0xc460=function(_0x371955,_0x28bbc8){_0x371955=_0x371955-0x0;var _0x2046dc=_0x460c[_0x371955];return _0x2046dc;};'use strict';var multer=require(_0xc460('0x0'));var util=require(_0xc460('0x1'));var path=require(_0xc460('0x2'));var timeout=require(_0xc460('0x3'));var express=require(_0xc460('0x4'));var router=express[_0xc460('0x5')]();var auth=require(_0xc460('0x6'));var interaction=require(_0xc460('0x7'));var config=require(_0xc460('0x8'));var controller=require(_0xc460('0x9'));router[_0xc460('0xa')]('/',auth[_0xc460('0xb')](),controller[_0xc460('0xc')]);router[_0xc460('0xa')](_0xc460('0xd'),auth[_0xc460('0xb')](),controller[_0xc460('0xe')]);router[_0xc460('0xa')](_0xc460('0xf'),auth[_0xc460('0xb')](),controller['show']);router[_0xc460('0x10')]('/',auth['isAuthenticated'](),controller[_0xc460('0x11')]);router[_0xc460('0x12')](_0xc460('0xf'),auth[_0xc460('0xb')](),controller[_0xc460('0x13')]);router[_0xc460('0x14')]('/:id',auth[_0xc460('0xb')](),controller['destroy']);module[_0xc460('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index c593f2e..272cfc1 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 _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 +var _0x4fc2=['DATE','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4fc2,0xe5));var _0x24fc=function(_0x1bd19f,_0x51cf4d){_0x1bd19f=_0x1bd19f-0x0;var _0x4d25c4=_0x4fc2[_0x1bd19f];return _0x4d25c4;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x24fc('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x24fc('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x24fc('0x2')]},'acceptAt':{'type':Sequelize[_0x24fc('0x2')]},'exitAt':{'type':Sequelize[_0x24fc('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index ee08920..6182d42 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 _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 +var _0xcdd9=['reject','update','destroy','then','end','sendStatus','name','send','index','map','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','SmsQueueReport','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','json','count','offset','limit','status','Content-Range','apply'];(function(_0x2f30e7,_0x1f88d3){var _0x3ab5c8=function(_0x1289be){while(--_0x1289be){_0x2f30e7['push'](_0x2f30e7['shift']());}};_0x3ab5c8(++_0x1f88d3);}(_0xcdd9,0x19c));var _0x9cdd=function(_0x25be63,_0x4b335e){_0x25be63=_0x25be63-0x0;var _0x4daaa8=_0xcdd9[_0x25be63];return _0x4daaa8;};'use strict';var pdf=require(_0x9cdd('0x0'));var emlformat=require(_0x9cdd('0x1'));var rimraf=require(_0x9cdd('0x2'));var zipdir=require(_0x9cdd('0x3'));var jsonpatch=require(_0x9cdd('0x4'));var rp=require(_0x9cdd('0x5'));var moment=require(_0x9cdd('0x6'));var BPromise=require(_0x9cdd('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9cdd('0x8'));var csv=require(_0x9cdd('0x9'));var ejs=require(_0x9cdd('0xa'));var fs=require('fs');var _=require(_0x9cdd('0xb'));var squel=require(_0x9cdd('0xc'));var crypto=require(_0x9cdd('0xd'));var jsforce=require(_0x9cdd('0xe'));var deskjs=require(_0x9cdd('0xf'));var toCsv=require(_0x9cdd('0x9'));var querystring=require(_0x9cdd('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9cdd('0x11'));var qs=require(_0x9cdd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9cdd('0x13'));var logger=require(_0x9cdd('0x14'))(_0x9cdd('0x15'));var utils=require(_0x9cdd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9cdd('0x17'));var db=require(_0x9cdd('0x18'))['db'];function respondWithStatusCode(_0x3a3cf4,_0x3d124c){_0x3d124c=_0x3d124c||0xcc;return function(_0x2c7266){if(_0x2c7266){return _0x3a3cf4['sendStatus'](_0x3d124c);}return _0x3a3cf4['status'](_0x3d124c)['end']();};}function respondWithResult(_0x4ba5d0,_0x1f300b){_0x1f300b=_0x1f300b||0xc8;return function(_0x45146f){if(_0x45146f){return _0x4ba5d0['status'](_0x1f300b)[_0x9cdd('0x19')](_0x45146f);}};}function respondWithFilteredResult(_0x9d9d26,_0x8ed13e){return function(_0x4e84b6){if(_0x4e84b6){var _0xd31307=_0x4e84b6[_0x9cdd('0x1a')],_0x52c71d=_0x8ed13e[_0x9cdd('0x1b')],_0x195a1f=_0x8ed13e[_0x9cdd('0x1b')]+_0x8ed13e[_0x9cdd('0x1c')],_0x3cf0f0;if(_0x195a1f>=_0xd31307){_0x195a1f=_0xd31307;_0x3cf0f0=0xc8;}else{_0x3cf0f0=0xce;}_0x9d9d26[_0x9cdd('0x1d')](_0x3cf0f0);return _0x9d9d26['set'](_0x9cdd('0x1e'),_0x52c71d+'-'+_0x195a1f+'/'+_0xd31307)['json'](_0x4e84b6);}return null;};}function patchUpdates(_0x2c10a1){return function(_0x40a146){try{jsonpatch[_0x9cdd('0x1f')](_0x40a146,_0x2c10a1,!![]);}catch(_0x346170){return BPromise[_0x9cdd('0x20')](_0x346170);}return _0x40a146['save']();};}function saveUpdates(_0x162ae,_0x3256ce){return function(_0x3bb3c2){if(_0x3bb3c2){return _0x3bb3c2[_0x9cdd('0x21')](_0x162ae)['then'](function(_0x4d2aeb){return _0x4d2aeb;});}return null;};}function removeEntity(_0x2fce82,_0x2d4649){return function(_0x1de090){if(_0x1de090){return _0x1de090[_0x9cdd('0x22')]()[_0x9cdd('0x23')](function(){_0x2fce82[_0x9cdd('0x1d')](0xcc)[_0x9cdd('0x24')]();});}};}function handleEntityNotFound(_0x4eee08,_0x3418b5){return function(_0x16097d){if(!_0x16097d){_0x4eee08[_0x9cdd('0x25')](0x194);}return _0x16097d;};}function handleError(_0x440c8b,_0x85da3d){_0x85da3d=_0x85da3d||0x1f4;return function(_0x1be1ed){logger['error'](_0x1be1ed['stack']);if(_0x1be1ed[_0x9cdd('0x26')]){delete _0x1be1ed[_0x9cdd('0x26')];}_0x440c8b[_0x9cdd('0x1d')](_0x85da3d)[_0x9cdd('0x27')](_0x1be1ed);};}exports[_0x9cdd('0x28')]=function(_0x4507f6,_0x1d3e5c){var _0x1ddc77={},_0x46d7ef={},_0x4dcc45={'count':0x0,'rows':[]};var _0x62db7e=_[_0x9cdd('0x29')](db['SmsQueueReport'][_0x9cdd('0x2a')],function(_0x543eb6){return{'name':_0x543eb6['fieldName'],'type':_0x543eb6['type'][_0x9cdd('0x2b')]};});_0x46d7ef[_0x9cdd('0x2c')]=_[_0x9cdd('0x29')](_0x62db7e,_0x9cdd('0x26'));_0x46d7ef[_0x9cdd('0x2d')]=_['keys'](_0x4507f6['query']);_0x46d7ef[_0x9cdd('0x2e')]=_[_0x9cdd('0x2f')](_0x46d7ef[_0x9cdd('0x2c')],_0x46d7ef[_0x9cdd('0x2d')]);_0x1ddc77[_0x9cdd('0x30')]=_[_0x9cdd('0x2f')](_0x46d7ef['model'],qs[_0x9cdd('0x31')](_0x4507f6['query'][_0x9cdd('0x31')]));_0x1ddc77[_0x9cdd('0x30')]=_0x1ddc77['attributes'][_0x9cdd('0x32')]?_0x1ddc77[_0x9cdd('0x30')]:_0x46d7ef['model'];if(!_0x4507f6[_0x9cdd('0x2d')][_0x9cdd('0x33')](_0x9cdd('0x34'))){_0x1ddc77['limit']=qs[_0x9cdd('0x1c')](_0x4507f6[_0x9cdd('0x2d')][_0x9cdd('0x1c')]);_0x1ddc77[_0x9cdd('0x1b')]=qs[_0x9cdd('0x1b')](_0x4507f6['query'][_0x9cdd('0x1b')]);}_0x1ddc77['order']=qs['sort'](_0x4507f6['query'][_0x9cdd('0x35')]);_0x1ddc77[_0x9cdd('0x36')]=qs[_0x9cdd('0x2e')](_[_0x9cdd('0x37')](_0x4507f6[_0x9cdd('0x2d')],_0x46d7ef[_0x9cdd('0x2e')]),_0x62db7e);if(_0x4507f6[_0x9cdd('0x2d')][_0x9cdd('0x38')]){_0x1ddc77[_0x9cdd('0x36')]=_[_0x9cdd('0x39')](_0x1ddc77[_0x9cdd('0x36')],{'$or':_['map'](_0x62db7e,function(_0x491be6){if(_0x491be6[_0x9cdd('0x3a')]!==_0x9cdd('0x3b')){var _0x466c2e={};_0x466c2e[_0x491be6['name']]={'$like':'%'+_0x4507f6['query'][_0x9cdd('0x38')]+'%'};return _0x466c2e;}})});}_0x1ddc77=_[_0x9cdd('0x39')]({},_0x1ddc77,_0x4507f6['options']);var _0x4ce93a={'where':_0x1ddc77[_0x9cdd('0x36')]};return db[_0x9cdd('0x3c')][_0x9cdd('0x1a')](_0x4ce93a)[_0x9cdd('0x23')](function(_0x55a073){_0x4dcc45[_0x9cdd('0x1a')]=_0x55a073;if(_0x4507f6['query']['includeAll']){_0x1ddc77[_0x9cdd('0x3d')]=[{'all':!![]}];}return db[_0x9cdd('0x3c')][_0x9cdd('0x3e')](_0x1ddc77);})[_0x9cdd('0x23')](function(_0x140a74){_0x4dcc45[_0x9cdd('0x3f')]=_0x140a74;return _0x4dcc45;})['then'](respondWithFilteredResult(_0x1d3e5c,_0x1ddc77))[_0x9cdd('0x40')](handleError(_0x1d3e5c,null));};exports[_0x9cdd('0x41')]=function(_0x120814,_0x149972){var _0x43ed28={'raw':!![],'where':{'id':_0x120814[_0x9cdd('0x42')]['id']}},_0x427cf8={};_0x427cf8[_0x9cdd('0x2c')]=_[_0x9cdd('0x43')](db[_0x9cdd('0x3c')][_0x9cdd('0x2a')]);_0x427cf8['query']=_[_0x9cdd('0x43')](_0x120814[_0x9cdd('0x2d')]);_0x427cf8[_0x9cdd('0x2e')]=_['intersection'](_0x427cf8[_0x9cdd('0x2c')],_0x427cf8[_0x9cdd('0x2d')]);_0x43ed28[_0x9cdd('0x30')]=_[_0x9cdd('0x2f')](_0x427cf8[_0x9cdd('0x2c')],qs[_0x9cdd('0x31')](_0x120814[_0x9cdd('0x2d')][_0x9cdd('0x31')]));_0x43ed28[_0x9cdd('0x30')]=_0x43ed28[_0x9cdd('0x30')][_0x9cdd('0x32')]?_0x43ed28[_0x9cdd('0x30')]:_0x427cf8['model'];if(_0x120814[_0x9cdd('0x2d')][_0x9cdd('0x44')]){_0x43ed28[_0x9cdd('0x3d')]=[{'all':!![]}];}_0x43ed28=_['merge']({},_0x43ed28,_0x120814[_0x9cdd('0x45')]);return db[_0x9cdd('0x3c')][_0x9cdd('0x46')](_0x43ed28)[_0x9cdd('0x23')](handleEntityNotFound(_0x149972,null))['then'](respondWithResult(_0x149972,null))[_0x9cdd('0x40')](handleError(_0x149972,null));};exports[_0x9cdd('0x47')]=function(_0x226704,_0x3c6bc3){return db[_0x9cdd('0x3c')][_0x9cdd('0x47')](_0x226704[_0x9cdd('0x48')],{})['then'](respondWithResult(_0x3c6bc3,0xc9))[_0x9cdd('0x40')](handleError(_0x3c6bc3,null));};exports[_0x9cdd('0x21')]=function(_0x2635d1,_0x33d597){if(_0x2635d1['body']['id']){delete _0x2635d1['body']['id'];}return db[_0x9cdd('0x3c')][_0x9cdd('0x46')]({'where':{'id':_0x2635d1[_0x9cdd('0x42')]['id']}})[_0x9cdd('0x23')](handleEntityNotFound(_0x33d597,null))['then'](saveUpdates(_0x2635d1['body'],null))[_0x9cdd('0x23')](respondWithResult(_0x33d597,null))[_0x9cdd('0x40')](handleError(_0x33d597,null));};exports[_0x9cdd('0x22')]=function(_0x43ac38,_0x3c5eee){return db[_0x9cdd('0x3c')][_0x9cdd('0x46')]({'where':{'id':_0x43ac38[_0x9cdd('0x42')]['id']}})[_0x9cdd('0x23')](handleEntityNotFound(_0x3c5eee,null))['then'](removeEntity(_0x3c5eee,null))[_0x9cdd('0x40')](handleError(_0x3c5eee,null));};exports[_0x9cdd('0x49')]=function(_0x333540,_0x5a3362){return db['SmsQueueReport'][_0x9cdd('0x49')]()[_0x9cdd('0x23')](respondWithResult(_0x5a3362,null))[_0x9cdd('0x40')](handleError(_0x5a3362,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index f48fdd9..33a5c88 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 _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 +var _0x6898=['SmsQueueReport','report_sms_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','exports','define'];(function(_0x4a7ad5,_0x4244a1){var _0x5df916=function(_0x2c4fe9){while(--_0x2c4fe9){_0x4a7ad5['push'](_0x4a7ad5['shift']());}};_0x5df916(++_0x4244a1);}(_0x6898,0x11b));var _0x8689=function(_0x22e6b7,_0x287fc6){_0x22e6b7=_0x22e6b7-0x0;var _0x3b8e07=_0x6898[_0x22e6b7];return _0x3b8e07;};'use strict';var _=require(_0x8689('0x0'));var util=require('util');var logger=require(_0x8689('0x1'))(_0x8689('0x2'));var moment=require(_0x8689('0x3'));var BPromise=require(_0x8689('0x4'));var rp=require(_0x8689('0x5'));var fs=require('fs');var path=require(_0x8689('0x6'));var rimraf=require(_0x8689('0x7'));var config=require('../../config/environment');var attributes=require(_0x8689('0x8'));module[_0x8689('0x9')]=function(_0x2c723e,_0x4e776d){return _0x2c723e[_0x8689('0xa')](_0x8689('0xb'),attributes,{'tableName':_0x8689('0xc'),'paranoid':![],'indexes':[{'name':_0x8689('0xd'),'fields':[_0x8689('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 6c26c7f..3fa5aff 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 _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 +var _0x52b3=['debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','stringify','UpdateSmsQueueReport','update','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x5ae836,_0x971d2){var _0xb37a03=function(_0x32851d){while(--_0x32851d){_0x5ae836['push'](_0x5ae836['shift']());}};_0xb37a03(++_0x971d2);}(_0x52b3,0x7b));var _0x352b=function(_0x598c44,_0x26a8fe){_0x598c44=_0x598c44-0x0;var _0x56c4af=_0x52b3[_0x598c44];return _0x56c4af;};'use strict';var _=require(_0x352b('0x0'));var util=require('util');var moment=require(_0x352b('0x1'));var BPromise=require(_0x352b('0x2'));var rs=require(_0x352b('0x3'));var fs=require('fs');var Redis=require(_0x352b('0x4'));var db=require(_0x352b('0x5'))['db'];var utils=require(_0x352b('0x6'));var logger=require(_0x352b('0x7'))(_0x352b('0x8'));var config=require(_0x352b('0x9'));var jayson=require(_0x352b('0xa'));var client=jayson[_0x352b('0xb')][_0x352b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3321ab,_0x19d470,_0x207c3f){return new BPromise(function(_0x3b9209,_0x2c5d4c){return client[_0x352b('0xd')](_0x3321ab,_0x207c3f)[_0x352b('0xe')](function(_0x2d1ab7){logger['info'](_0x352b('0xf'),_0x19d470,_0x352b('0x10'));logger[_0x352b('0x11')](_0x352b('0x12'),_0x19d470,_0x352b('0x10'),JSON['stringify'](_0x2d1ab7));if(_0x2d1ab7[_0x352b('0x13')]){if(_0x2d1ab7['error'][_0x352b('0x14')]===0x1f4){logger[_0x352b('0x13')](_0x352b('0xf'),_0x19d470,_0x2d1ab7[_0x352b('0x13')][_0x352b('0x15')]);return _0x2c5d4c(_0x2d1ab7[_0x352b('0x13')][_0x352b('0x15')]);}logger[_0x352b('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x19d470,_0x2d1ab7[_0x352b('0x13')][_0x352b('0x15')]);return _0x3b9209(_0x2d1ab7[_0x352b('0x13')][_0x352b('0x15')]);}else{logger[_0x352b('0x16')](_0x352b('0xf'),_0x19d470,_0x352b('0x10'));_0x3b9209(_0x2d1ab7[_0x352b('0x17')][_0x352b('0x15')]);}})[_0x352b('0x18')](function(_0x18ad8f){logger['error'](_0x352b('0xf'),_0x19d470,_0x18ad8f);_0x2c5d4c(_0x18ad8f);});});}exports[_0x352b('0x19')]=function(_0x2bccaf){var _0x4ac268=this;return new Promise(function(_0x371b8d,_0x489e63){return db[_0x352b('0x1a')]['create'](_0x2bccaf[_0x352b('0x1b')],{'raw':_0x2bccaf[_0x352b('0x1c')]?_0x2bccaf['options'][_0x352b('0x1d')]===undefined?!![]:![]:!![]})[_0x352b('0xe')](function(_0x28f58a){logger['info']('CreateSmsQueueReport',_0x2bccaf);logger[_0x352b('0x11')](_0x352b('0x19'),_0x2bccaf,JSON[_0x352b('0x1e')](_0x28f58a));_0x371b8d(_0x28f58a);})[_0x352b('0x18')](function(_0x94e855){logger[_0x352b('0x13')](_0x352b('0x19'),_0x94e855[_0x352b('0x15')],_0x2bccaf);_0x489e63(_0x4ac268[_0x352b('0x13')](0x1f4,_0x94e855[_0x352b('0x15')]));});});};exports[_0x352b('0x1f')]=function(_0x4e3632){var _0x91f9f=this;return new Promise(function(_0x3bdc6c,_0x41579b){return db['SmsQueueReport'][_0x352b('0x20')](_0x4e3632[_0x352b('0x1b')],{'raw':_0x4e3632[_0x352b('0x1c')]?_0x4e3632['options'][_0x352b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e3632[_0x352b('0x1c')]?_0x4e3632[_0x352b('0x1c')][_0x352b('0x21')]||null:null,'attributes':_0x4e3632[_0x352b('0x1c')]?_0x4e3632[_0x352b('0x1c')]['attributes']||null:null,'limit':_0x4e3632['options']?_0x4e3632[_0x352b('0x1c')][_0x352b('0x22')]||null:null})[_0x352b('0xe')](function(_0x412da3){logger['info']('UpdateSmsQueueReport',_0x4e3632);logger[_0x352b('0x11')]('UpdateSmsQueueReport',_0x4e3632,JSON[_0x352b('0x1e')](_0x412da3));_0x3bdc6c(_0x412da3);})['catch'](function(_0x2031ce){logger[_0x352b('0x13')]('UpdateSmsQueueReport',_0x2031ce['message'],_0x4e3632);_0x41579b(_0x91f9f[_0x352b('0x13')](0x1f4,_0x2031ce[_0x352b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 38e1034..f7074ab 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 _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 +var _0x34b7=['/:id','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe'];(function(_0x144c04,_0x253bb0){var _0x11b816=function(_0x20da5b){while(--_0x20da5b){_0x144c04['push'](_0x144c04['shift']());}};_0x11b816(++_0x253bb0);}(_0x34b7,0x196));var _0x734b=function(_0x5cfb92,_0x5797e6){_0x5cfb92=_0x5cfb92-0x0;var _0x1cd7c2=_0x34b7[_0x5cfb92];return _0x1cd7c2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var auth=require(_0x734b('0x4'));var interaction=require(_0x734b('0x5'));var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router[_0x734b('0x6')]('/',auth[_0x734b('0x7')](),controller[_0x734b('0x8')]);router[_0x734b('0x6')](_0x734b('0x9'),auth[_0x734b('0x7')](),controller['describe']);router[_0x734b('0x6')](_0x734b('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x734b('0x7')](),controller['create']);router[_0x734b('0xb')](_0x734b('0xa'),auth[_0x734b('0x7')](),controller[_0x734b('0xc')]);router[_0x734b('0xd')](_0x734b('0xa'),auth[_0x734b('0x7')](),controller[_0x734b('0xe')]);module[_0x734b('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 26753b1..986a780 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 _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 +var _0x0716=['exports','STRING','ENUM','account','queue','DATE','NOW','moment','sequelize'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0716,0xa0));var _0x6071=function(_0x2375e1,_0x3d125a){_0x2375e1=_0x2375e1-0x0;var _0x2ccc7d=_0x0716[_0x2375e1];return _0x2ccc7d;};'use strict';var moment=require(_0x6071('0x0'));var Sequelize=require(_0x6071('0x1'));module[_0x6071('0x2')]={'uniqueid':{'type':Sequelize[_0x6071('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x6071('0x4')](_0x6071('0x5'),'agent','queue'),'allowNull':![],'defaultValue':_0x6071('0x6')},'transferredAt':{'type':Sequelize[_0x6071('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6071('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index a74b8de..738a307 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 _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 +var _0x9de3=['sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','count','limit','set','Content-Range','apply','update','then','sendStatus','error','name','send','map','SmsTransferReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order'];(function(_0x3cf3fc,_0x499ca9){var _0x4eaa2d=function(_0x79b294){while(--_0x79b294){_0x3cf3fc['push'](_0x3cf3fc['shift']());}};_0x4eaa2d(++_0x499ca9);}(_0x9de3,0xea));var _0x39de=function(_0x1f4880,_0x91d6fd){_0x1f4880=_0x1f4880-0x0;var _0x319b72=_0x9de3[_0x1f4880];return _0x319b72;};'use strict';var pdf=require(_0x39de('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x39de('0x1'));var zipdir=require(_0x39de('0x2'));var jsonpatch=require(_0x39de('0x3'));var rp=require('request-promise');var moment=require(_0x39de('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x39de('0x5'));var util=require(_0x39de('0x6'));var path=require(_0x39de('0x7'));var sox=require(_0x39de('0x8'));var csv=require('to-csv');var ejs=require(_0x39de('0x9'));var fs=require('fs');var _=require(_0x39de('0xa'));var squel=require(_0x39de('0xb'));var crypto=require(_0x39de('0xc'));var jsforce=require(_0x39de('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x39de('0xe'));var Redis=require(_0x39de('0xf'));var authService=require(_0x39de('0x10'));var qs=require(_0x39de('0x11'));var as=require(_0x39de('0x12'));var hardwareService=require(_0x39de('0x13'));var logger=require(_0x39de('0x14'))(_0x39de('0x15'));var utils=require('../../config/utils');var config=require(_0x39de('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bd0f0,_0x35061b){_0x35061b=_0x35061b||0xcc;return function(_0x32d610){if(_0x32d610){return _0x2bd0f0['sendStatus'](_0x35061b);}return _0x2bd0f0[_0x39de('0x17')](_0x35061b)[_0x39de('0x18')]();};}function respondWithResult(_0x1318d8,_0x905132){_0x905132=_0x905132||0xc8;return function(_0x38fe3b){if(_0x38fe3b){return _0x1318d8[_0x39de('0x17')](_0x905132)[_0x39de('0x19')](_0x38fe3b);}};}function respondWithFilteredResult(_0x25ca17,_0xaff589){return function(_0x316fdb){if(_0x316fdb){var _0x4c56df=_0x316fdb[_0x39de('0x1a')],_0x1f36e0=_0xaff589['offset'],_0x1b5daa=_0xaff589['offset']+_0xaff589[_0x39de('0x1b')],_0x20bd18;if(_0x1b5daa>=_0x4c56df){_0x1b5daa=_0x4c56df;_0x20bd18=0xc8;}else{_0x20bd18=0xce;}_0x25ca17['status'](_0x20bd18);return _0x25ca17[_0x39de('0x1c')](_0x39de('0x1d'),_0x1f36e0+'-'+_0x1b5daa+'/'+_0x4c56df)['json'](_0x316fdb);}return null;};}function patchUpdates(_0x410995){return function(_0x5dcb96){try{jsonpatch[_0x39de('0x1e')](_0x5dcb96,_0x410995,!![]);}catch(_0x250553){return BPromise['reject'](_0x250553);}return _0x5dcb96['save']();};}function saveUpdates(_0xab6f89,_0x5e4ab2){return function(_0x552590){if(_0x552590){return _0x552590[_0x39de('0x1f')](_0xab6f89)[_0x39de('0x20')](function(_0xbcf67c){return _0xbcf67c;});}return null;};}function removeEntity(_0x292dda,_0x400d62){return function(_0x10c0fc){if(_0x10c0fc){return _0x10c0fc['destroy']()[_0x39de('0x20')](function(){_0x292dda[_0x39de('0x17')](0xcc)[_0x39de('0x18')]();});}};}function handleEntityNotFound(_0x578eaa,_0x372564){return function(_0x483d49){if(!_0x483d49){_0x578eaa[_0x39de('0x21')](0x194);}return _0x483d49;};}function handleError(_0x102c5b,_0x30c3e3){_0x30c3e3=_0x30c3e3||0x1f4;return function(_0x39d01a){logger[_0x39de('0x22')](_0x39d01a['stack']);if(_0x39d01a[_0x39de('0x23')]){delete _0x39d01a[_0x39de('0x23')];}_0x102c5b[_0x39de('0x17')](_0x30c3e3)[_0x39de('0x24')](_0x39d01a);};}exports['index']=function(_0x3fd91a,_0x59e64f){var _0x4c11b3={},_0x17d876={},_0x1d3b79={'count':0x0,'rows':[]};var _0xfd80c8=_[_0x39de('0x25')](db[_0x39de('0x26')]['rawAttributes'],function(_0x352060){return{'name':_0x352060[_0x39de('0x27')],'type':_0x352060[_0x39de('0x28')][_0x39de('0x29')]};});_0x17d876[_0x39de('0x2a')]=_[_0x39de('0x25')](_0xfd80c8,_0x39de('0x23'));_0x17d876['query']=_[_0x39de('0x2b')](_0x3fd91a[_0x39de('0x2c')]);_0x17d876[_0x39de('0x2d')]=_[_0x39de('0x2e')](_0x17d876['model'],_0x17d876[_0x39de('0x2c')]);_0x4c11b3[_0x39de('0x2f')]=_[_0x39de('0x2e')](_0x17d876[_0x39de('0x2a')],qs['fields'](_0x3fd91a[_0x39de('0x2c')][_0x39de('0x30')]));_0x4c11b3[_0x39de('0x2f')]=_0x4c11b3[_0x39de('0x2f')][_0x39de('0x31')]?_0x4c11b3['attributes']:_0x17d876['model'];if(!_0x3fd91a[_0x39de('0x2c')][_0x39de('0x32')](_0x39de('0x33'))){_0x4c11b3[_0x39de('0x1b')]=qs['limit'](_0x3fd91a[_0x39de('0x2c')]['limit']);_0x4c11b3[_0x39de('0x34')]=qs[_0x39de('0x34')](_0x3fd91a[_0x39de('0x2c')]['offset']);}_0x4c11b3[_0x39de('0x35')]=qs[_0x39de('0x36')](_0x3fd91a[_0x39de('0x2c')][_0x39de('0x36')]);_0x4c11b3[_0x39de('0x37')]=qs[_0x39de('0x2d')](_[_0x39de('0x38')](_0x3fd91a[_0x39de('0x2c')],_0x17d876[_0x39de('0x2d')]),_0xfd80c8);if(_0x3fd91a['query'][_0x39de('0x39')]){_0x4c11b3[_0x39de('0x37')]=_[_0x39de('0x3a')](_0x4c11b3[_0x39de('0x37')],{'$or':_[_0x39de('0x25')](_0xfd80c8,function(_0x4ca613){if(_0x4ca613[_0x39de('0x28')]!=='VIRTUAL'){var _0x10c6c3={};_0x10c6c3[_0x4ca613[_0x39de('0x23')]]={'$like':'%'+_0x3fd91a[_0x39de('0x2c')][_0x39de('0x39')]+'%'};return _0x10c6c3;}})});}_0x4c11b3=_[_0x39de('0x3a')]({},_0x4c11b3,_0x3fd91a[_0x39de('0x3b')]);var _0x2fdfd0={'where':_0x4c11b3[_0x39de('0x37')]};return db[_0x39de('0x26')]['count'](_0x2fdfd0)[_0x39de('0x20')](function(_0x3dd32d){_0x1d3b79[_0x39de('0x1a')]=_0x3dd32d;if(_0x3fd91a['query'][_0x39de('0x3c')]){_0x4c11b3[_0x39de('0x3d')]=[{'all':!![]}];}return db[_0x39de('0x26')][_0x39de('0x3e')](_0x4c11b3);})['then'](function(_0x4b21d9){_0x1d3b79[_0x39de('0x3f')]=_0x4b21d9;return _0x1d3b79;})[_0x39de('0x20')](respondWithFilteredResult(_0x59e64f,_0x4c11b3))[_0x39de('0x40')](handleError(_0x59e64f,null));};exports[_0x39de('0x41')]=function(_0x482084,_0x71c4b6){var _0x2565aa={'raw':!![],'where':{'id':_0x482084[_0x39de('0x42')]['id']}},_0x432ef5={};_0x432ef5[_0x39de('0x2a')]=_[_0x39de('0x2b')](db[_0x39de('0x26')][_0x39de('0x43')]);_0x432ef5['query']=_[_0x39de('0x2b')](_0x482084[_0x39de('0x2c')]);_0x432ef5[_0x39de('0x2d')]=_['intersection'](_0x432ef5[_0x39de('0x2a')],_0x432ef5[_0x39de('0x2c')]);_0x2565aa[_0x39de('0x2f')]=_['intersection'](_0x432ef5[_0x39de('0x2a')],qs[_0x39de('0x30')](_0x482084[_0x39de('0x2c')]['fields']));_0x2565aa[_0x39de('0x2f')]=_0x2565aa[_0x39de('0x2f')][_0x39de('0x31')]?_0x2565aa[_0x39de('0x2f')]:_0x432ef5['model'];if(_0x482084[_0x39de('0x2c')][_0x39de('0x3c')]){_0x2565aa['include']=[{'all':!![]}];}_0x2565aa=_['merge']({},_0x2565aa,_0x482084['options']);return db[_0x39de('0x26')][_0x39de('0x44')](_0x2565aa)[_0x39de('0x20')](handleEntityNotFound(_0x71c4b6,null))[_0x39de('0x20')](respondWithResult(_0x71c4b6,null))[_0x39de('0x40')](handleError(_0x71c4b6,null));};exports[_0x39de('0x45')]=function(_0x53c640,_0x278e68){return db[_0x39de('0x26')][_0x39de('0x45')](_0x53c640['body'],{})[_0x39de('0x20')](respondWithResult(_0x278e68,0xc9))[_0x39de('0x40')](handleError(_0x278e68,null));};exports['update']=function(_0x5ee1a6,_0x3dd0a3){if(_0x5ee1a6[_0x39de('0x46')]['id']){delete _0x5ee1a6['body']['id'];}return db[_0x39de('0x26')][_0x39de('0x44')]({'where':{'id':_0x5ee1a6['params']['id']}})[_0x39de('0x20')](handleEntityNotFound(_0x3dd0a3,null))[_0x39de('0x20')](saveUpdates(_0x5ee1a6[_0x39de('0x46')],null))[_0x39de('0x20')](respondWithResult(_0x3dd0a3,null))[_0x39de('0x40')](handleError(_0x3dd0a3,null));};exports['destroy']=function(_0x18abca,_0x3c9fd9){return db['SmsTransferReport'][_0x39de('0x44')]({'where':{'id':_0x18abca[_0x39de('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c9fd9,null))['then'](removeEntity(_0x3c9fd9,null))[_0x39de('0x40')](handleError(_0x3c9fd9,null));};exports['describe']=function(_0xfacb66,_0x49025f){return db[_0x39de('0x26')][_0x39de('0x47')]()[_0x39de('0x20')](respondWithResult(_0x49025f,null))['catch'](handleError(_0x49025f,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index a348996..0370c96 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 _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 +var _0xadb5=['exports','define','SmsTransferReport','report_sms_transfer','uniqueid','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2d042c,_0x25b1ec){var _0x61b7bc=function(_0x468aa5){while(--_0x468aa5){_0x2d042c['push'](_0x2d042c['shift']());}};_0x61b7bc(++_0x25b1ec);}(_0xadb5,0xad));var _0x5adb=function(_0x40d2fc,_0x423de7){_0x40d2fc=_0x40d2fc-0x0;var _0x547724=_0xadb5[_0x40d2fc];return _0x547724;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[{'name':_0x5adb('0xb'),'fields':[_0x5adb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index fd605fe..16f42ad 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 _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 +var _0xabd8=['SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\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','http','request','then','info'];(function(_0x4a4c78,_0x13d5b7){var _0xd58f32=function(_0x32cc8e){while(--_0x32cc8e){_0x4a4c78['push'](_0x4a4c78['shift']());}};_0xd58f32(++_0x13d5b7);}(_0xabd8,0x14f));var _0x8abd=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xabd8[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0x8abd('0x0'));var util=require(_0x8abd('0x1'));var moment=require(_0x8abd('0x2'));var BPromise=require(_0x8abd('0x3'));var rs=require(_0x8abd('0x4'));var fs=require('fs');var Redis=require(_0x8abd('0x5'));var db=require(_0x8abd('0x6'))['db'];var utils=require(_0x8abd('0x7'));var logger=require(_0x8abd('0x8'))('rpc');var config=require(_0x8abd('0x9'));var jayson=require(_0x8abd('0xa'));var client=jayson['client'][_0x8abd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x401004,_0x179f47,_0x22b1a5){return new BPromise(function(_0x5d6598,_0x3dbfd4){return client[_0x8abd('0xc')](_0x401004,_0x22b1a5)[_0x8abd('0xd')](function(_0x4b8913){logger[_0x8abd('0xe')](_0x8abd('0xf'),_0x179f47,_0x8abd('0x10'));logger[_0x8abd('0x11')](_0x8abd('0x12'),_0x179f47,_0x8abd('0x10'),JSON[_0x8abd('0x13')](_0x4b8913));if(_0x4b8913[_0x8abd('0x14')]){if(_0x4b8913['error'][_0x8abd('0x15')]===0x1f4){logger[_0x8abd('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x179f47,_0x4b8913[_0x8abd('0x14')][_0x8abd('0x16')]);return _0x3dbfd4(_0x4b8913[_0x8abd('0x14')][_0x8abd('0x16')]);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x179f47,_0x4b8913['error'][_0x8abd('0x16')]);return _0x5d6598(_0x4b8913[_0x8abd('0x14')][_0x8abd('0x16')]);}else{logger[_0x8abd('0xe')](_0x8abd('0xf'),_0x179f47,_0x8abd('0x10'));_0x5d6598(_0x4b8913[_0x8abd('0x17')][_0x8abd('0x16')]);}})[_0x8abd('0x18')](function(_0x440bcc){logger[_0x8abd('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x179f47,_0x440bcc);_0x3dbfd4(_0x440bcc);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index a7e461d..fb18deb 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 _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 +var _0xb87a=['put','update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','now','post','single','file','create'];(function(_0x4e54a0,_0x285242){var _0x5ca2dd=function(_0x356538){while(--_0x356538){_0x4e54a0['push'](_0x4e54a0['shift']());}};_0x5ca2dd(++_0x285242);}(_0xb87a,0xe4));var _0xab87=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xb87a[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require('multer');var util=require(_0xab87('0x0'));var path=require('path');var timeout=require(_0xab87('0x1'));var express=require(_0xab87('0x2'));var router=express[_0xab87('0x3')]();var auth=require(_0xab87('0x4'));var interaction=require(_0xab87('0x5'));var config=require(_0xab87('0x6'));var controller=require(_0xab87('0x7'));router['get']('/',auth[_0xab87('0x8')](),controller[_0xab87('0x9')]);router[_0xab87('0xa')](_0xab87('0xb'),auth[_0xab87('0x8')](),controller[_0xab87('0xc')]);router[_0xab87('0xa')](_0xab87('0xd'),auth[_0xab87('0x8')](),controller[_0xab87('0xe')]);var upload=multer({'storage':multer[_0xab87('0xf')]({'destination':function(_0x3949cb,_0x1e5af2,_0x57ce7e){_0x57ce7e(null,path['join'](config[_0xab87('0x10')],_0xab87('0x11')));},'filename':function(_0x13df38,_0x324de6,_0x4387d0){_0x324de6[_0xab87('0x12')]=_0x324de6['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4387d0(null,util[_0xab87('0x13')](_0xab87('0x14'),path[_0xab87('0x15')](_0x324de6[_0xab87('0x12')],path[_0xab87('0x16')](_0x324de6[_0xab87('0x12')])),Date[_0xab87('0x17')](),path[_0xab87('0x16')](_0x324de6[_0xab87('0x12')])));}})});router[_0xab87('0x18')]('/',upload[_0xab87('0x19')](_0xab87('0x1a')),controller[_0xab87('0x1b')]);router[_0xab87('0x1c')](_0xab87('0xb'),auth[_0xab87('0x8')](),controller[_0xab87('0x1d')]);router[_0xab87('0x1e')](_0xab87('0xb'),auth['isAuthenticated'](),controller['delete']);module[_0xab87('0x1f')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 86ab4e6..34ab102 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 _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 +var _0x3a3e=['BIGINT','FLOAT','INTEGER','exports','STRING'];(function(_0x4471b3,_0x511a9f){var _0x386593=function(_0x1057e2){while(--_0x1057e2){_0x4471b3['push'](_0x4471b3['shift']());}};_0x386593(++_0x511a9f);}(_0x3a3e,0x1f2));var _0xe3a3=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x3a3e[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require('sequelize');module[_0xe3a3('0x0')]={'name':{'type':Sequelize[_0xe3a3('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xe3a3('0x1')]},'display_name':{'type':Sequelize[_0xe3a3('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xe3a3('0x1')]},'original_format':{'type':Sequelize[_0xe3a3('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xe3a3('0x2')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xe3a3('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xe3a3('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xe3a3('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index aa832d5..a1f0905 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 _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 +var _0xcc5b=['show','params','rawAttributes','include','find','download','converted_format','existsSync','join','save_name','Sequelize','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','create','basename','file','originalname','extname','filename','substring','server/files/sounds/original','root','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','wav','error','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','body','userProfileId','role','user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','original_format','html-pdf','eml-format','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','Sounds','end','sendStatus','name','send','index','map','Sound','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch'];(function(_0x35daf5,_0x1cb0a8){var _0x9151e=function(_0x3c5cec){while(--_0x3c5cec){_0x35daf5['push'](_0x35daf5['shift']());}};_0x9151e(++_0x1cb0a8);}(_0xcc5b,0x1aa));var _0xbcc5=function(_0x12f054,_0x508c2d){_0x12f054=_0x12f054-0x0;var _0x36f9f3=_0xcc5b[_0x12f054];return _0x36f9f3;};'use strict';var pdf=require(_0xbcc5('0x0'));var emlformat=require(_0xbcc5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbcc5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbcc5('0x3'));var util=require(_0xbcc5('0x4'));var path=require(_0xbcc5('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbcc5('0x6'));var fs=require('fs');var _=require(_0xbcc5('0x7'));var squel=require('squel');var crypto=require(_0xbcc5('0x8'));var jsforce=require(_0xbcc5('0x9'));var deskjs=require(_0xbcc5('0xa'));var toCsv=require(_0xbcc5('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbcc5('0xc'));var authService=require(_0xbcc5('0xd'));var qs=require(_0xbcc5('0xe'));var as=require(_0xbcc5('0xf'));var hardwareService=require(_0xbcc5('0x10'));var logger=require(_0xbcc5('0x11'))(_0xbcc5('0x12'));var utils=require('../../config/utils');var config=require(_0xbcc5('0x13'));var licenseUtil=require(_0xbcc5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x499700,_0x3af35a){_0x3af35a=_0x3af35a||0xcc;return function(_0x5b7ee4){if(_0x5b7ee4){return _0x499700['sendStatus'](_0x3af35a);}return _0x499700['status'](_0x3af35a)['end']();};}function respondWithResult(_0x4e60c0,_0x4a0ed5){_0x4a0ed5=_0x4a0ed5||0xc8;return function(_0x11654b){if(_0x11654b){return _0x4e60c0[_0xbcc5('0x15')](_0x4a0ed5)[_0xbcc5('0x16')](_0x11654b);}};}function respondWithFilteredResult(_0x27cadf,_0x4fc1fb){return function(_0x3557e4){if(_0x3557e4){var _0x2e08c8=_0x3557e4[_0xbcc5('0x17')],_0x35c03c=_0x4fc1fb[_0xbcc5('0x18')],_0x36773e=_0x4fc1fb[_0xbcc5('0x18')]+_0x4fc1fb[_0xbcc5('0x19')],_0xfc4722;if(_0x36773e>=_0x2e08c8){_0x36773e=_0x2e08c8;_0xfc4722=0xc8;}else{_0xfc4722=0xce;}_0x27cadf[_0xbcc5('0x15')](_0xfc4722);return _0x27cadf[_0xbcc5('0x1a')]('Content-Range',_0x35c03c+'-'+_0x36773e+'/'+_0x2e08c8)[_0xbcc5('0x16')](_0x3557e4);}return null;};}function patchUpdates(_0x50baa4){return function(_0x128d0a){try{jsonpatch[_0xbcc5('0x1b')](_0x128d0a,_0x50baa4,!![]);}catch(_0x31e86b){return BPromise[_0xbcc5('0x1c')](_0x31e86b);}return _0x128d0a[_0xbcc5('0x1d')]();};}function saveUpdates(_0x30b77,_0x5238cb){return function(_0x4d55cc){if(_0x4d55cc){return _0x4d55cc[_0xbcc5('0x1e')](_0x30b77)[_0xbcc5('0x1f')](function(_0x42bb38){return _0x42bb38;});}return null;};}function removeEntity(_0x5431f2,_0x875bf6){return function(_0x1acfe9){if(_0x1acfe9){return _0x1acfe9[_0xbcc5('0x20')]()['then'](function(){var _0x3bf0c8=_0x1acfe9[_0xbcc5('0x21')]({'plain':!![]});var _0x17ba72=_0xbcc5('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x17ba72,'resourceId':_0x3bf0c8['id']}})['then'](function(){return _0x1acfe9;});})['then'](function(){_0x5431f2[_0xbcc5('0x15')](0xcc)[_0xbcc5('0x23')]();});}};}function handleEntityNotFound(_0x33a093,_0x2a148f){return function(_0x1d27cf){if(!_0x1d27cf){_0x33a093[_0xbcc5('0x24')](0x194);}return _0x1d27cf;};}function handleError(_0x4d9681,_0x48c62a){_0x48c62a=_0x48c62a||0x1f4;return function(_0x388e0c){logger['error'](_0x388e0c['stack']);if(_0x388e0c['name']){delete _0x388e0c[_0xbcc5('0x25')];}_0x4d9681[_0xbcc5('0x15')](_0x48c62a)[_0xbcc5('0x26')](_0x388e0c);};}exports[_0xbcc5('0x27')]=function(_0x173556,_0x7dec22){var _0x50b293={},_0xf8006c={},_0x13af19={'count':0x0,'rows':[]};var _0x21e662=_[_0xbcc5('0x28')](db[_0xbcc5('0x29')]['rawAttributes'],function(_0x4f8f71){return{'name':_0x4f8f71[_0xbcc5('0x2a')],'type':_0x4f8f71[_0xbcc5('0x2b')][_0xbcc5('0x2c')]};});_0xf8006c[_0xbcc5('0x2d')]=_[_0xbcc5('0x28')](_0x21e662,_0xbcc5('0x25'));_0xf8006c[_0xbcc5('0x2e')]=_[_0xbcc5('0x2f')](_0x173556[_0xbcc5('0x2e')]);_0xf8006c[_0xbcc5('0x30')]=_['intersection'](_0xf8006c[_0xbcc5('0x2d')],_0xf8006c[_0xbcc5('0x2e')]);_0x50b293['attributes']=_[_0xbcc5('0x31')](_0xf8006c['model'],qs['fields'](_0x173556[_0xbcc5('0x2e')][_0xbcc5('0x32')]));_0x50b293[_0xbcc5('0x33')]=_0x50b293[_0xbcc5('0x33')][_0xbcc5('0x34')]?_0x50b293[_0xbcc5('0x33')]:_0xf8006c[_0xbcc5('0x2d')];if(!_0x173556[_0xbcc5('0x2e')][_0xbcc5('0x35')](_0xbcc5('0x36'))){_0x50b293['limit']=qs[_0xbcc5('0x19')](_0x173556[_0xbcc5('0x2e')][_0xbcc5('0x19')]);_0x50b293[_0xbcc5('0x18')]=qs['offset'](_0x173556['query'][_0xbcc5('0x18')]);}_0x50b293[_0xbcc5('0x37')]=qs[_0xbcc5('0x38')](_0x173556[_0xbcc5('0x2e')]['sort']);_0x50b293[_0xbcc5('0x39')]=qs[_0xbcc5('0x30')](_[_0xbcc5('0x3a')](_0x173556[_0xbcc5('0x2e')],_0xf8006c[_0xbcc5('0x30')]),_0x21e662);if(_0x173556[_0xbcc5('0x2e')][_0xbcc5('0x3b')]){_0x50b293[_0xbcc5('0x39')]=_[_0xbcc5('0x3c')](_0x50b293[_0xbcc5('0x39')],{'$or':_[_0xbcc5('0x28')](_0x21e662,function(_0x40d9fa){if(_0x40d9fa[_0xbcc5('0x2b')]!=='VIRTUAL'){var _0x562d06={};_0x562d06[_0x40d9fa[_0xbcc5('0x25')]]={'$like':'%'+_0x173556[_0xbcc5('0x2e')][_0xbcc5('0x3b')]+'%'};return _0x562d06;}})});}_0x50b293=_['merge']({},_0x50b293,_0x173556[_0xbcc5('0x3d')]);var _0x37040d={'where':_0x50b293[_0xbcc5('0x39')]};return db[_0xbcc5('0x29')]['count'](_0x37040d)[_0xbcc5('0x1f')](function(_0x240a74){_0x13af19[_0xbcc5('0x17')]=_0x240a74;if(_0x173556['query'][_0xbcc5('0x3e')]){_0x50b293['include']=[{'all':!![]}];}return db['Sound'][_0xbcc5('0x3f')](_0x50b293);})[_0xbcc5('0x1f')](function(_0x5011f9){_0x13af19[_0xbcc5('0x40')]=_0x5011f9;return _0x13af19;})[_0xbcc5('0x1f')](respondWithFilteredResult(_0x7dec22,_0x50b293))[_0xbcc5('0x41')](handleError(_0x7dec22,null));};exports[_0xbcc5('0x42')]=function(_0x3144ef,_0x388bb4){var _0x3c8ac8={'raw':!![],'where':{'id':_0x3144ef[_0xbcc5('0x43')]['id']}},_0x7e330f={};_0x7e330f['model']=_[_0xbcc5('0x2f')](db[_0xbcc5('0x29')][_0xbcc5('0x44')]);_0x7e330f[_0xbcc5('0x2e')]=_[_0xbcc5('0x2f')](_0x3144ef[_0xbcc5('0x2e')]);_0x7e330f['filters']=_[_0xbcc5('0x31')](_0x7e330f[_0xbcc5('0x2d')],_0x7e330f[_0xbcc5('0x2e')]);_0x3c8ac8[_0xbcc5('0x33')]=_[_0xbcc5('0x31')](_0x7e330f['model'],qs['fields'](_0x3144ef['query'][_0xbcc5('0x32')]));_0x3c8ac8[_0xbcc5('0x33')]=_0x3c8ac8[_0xbcc5('0x33')][_0xbcc5('0x34')]?_0x3c8ac8[_0xbcc5('0x33')]:_0x7e330f[_0xbcc5('0x2d')];if(_0x3144ef[_0xbcc5('0x2e')][_0xbcc5('0x3e')]){_0x3c8ac8[_0xbcc5('0x45')]=[{'all':!![]}];}_0x3c8ac8=_[_0xbcc5('0x3c')]({},_0x3c8ac8,_0x3144ef[_0xbcc5('0x3d')]);return db[_0xbcc5('0x29')][_0xbcc5('0x46')](_0x3c8ac8)[_0xbcc5('0x1f')](handleEntityNotFound(_0x388bb4,null))['then'](respondWithResult(_0x388bb4,null))[_0xbcc5('0x41')](handleError(_0x388bb4,null));};exports[_0xbcc5('0x47')]=function(_0x5049d1,_0x5aa128,_0x280508){return db[_0xbcc5('0x29')][_0xbcc5('0x46')]({'where':{'id':_0x5049d1['params']['id']},'attributes':[_0xbcc5('0x25'),'save_name',_0xbcc5('0x48')],'raw':!![]})[_0xbcc5('0x1f')](handleEntityNotFound(_0x5aa128,null))[_0xbcc5('0x1f')](function(_0x3ffab2){if(_0x3ffab2){if(!fs[_0xbcc5('0x49')](path[_0xbcc5('0x4a')](config['root'],'server/files/sounds/converted',_0x3ffab2[_0xbcc5('0x4b')]+'.'+_0x3ffab2['converted_format']))){throw new db[(_0xbcc5('0x4c'))][(_0xbcc5('0x4d'))](_0xbcc5('0x4e'));}return _0x5aa128[_0xbcc5('0x47')](path[_0xbcc5('0x4a')](config['root'],_0xbcc5('0x4f'),util[_0xbcc5('0x50')](_0xbcc5('0x51'),_0x3ffab2[_0xbcc5('0x4b')],_0x3ffab2['converted_format'])),util[_0xbcc5('0x50')](_0xbcc5('0x51'),_0x3ffab2['name'],_0x3ffab2[_0xbcc5('0x48')]));}return null;})[_0xbcc5('0x41')](handleError(_0x5aa128,null));};exports[_0xbcc5('0x52')]=function(_0x509647,_0x4fe93a,_0x26c798){var _0x494e45={'name':path[_0xbcc5('0x53')](_0x509647[_0xbcc5('0x54')][_0xbcc5('0x55')],path['extname'](_0x509647[_0xbcc5('0x54')][_0xbcc5('0x55')])),'save_name':path[_0xbcc5('0x53')](_0x509647[_0xbcc5('0x54')]['filename'],path[_0xbcc5('0x56')](_0x509647[_0xbcc5('0x54')][_0xbcc5('0x57')])),'original_format':path[_0xbcc5('0x56')](_0x509647['file'][_0xbcc5('0x55')])[_0xbcc5('0x58')](0x1),'converted_format':'wav'};var _0x5a5ecd=path['join'](config['root'],_0xbcc5('0x59'),_0x509647[_0xbcc5('0x54')][_0xbcc5('0x57')]);var _0x1a341a=path[_0xbcc5('0x4a')](config[_0xbcc5('0x5a')],_0xbcc5('0x4f'),util[_0xbcc5('0x50')](_0xbcc5('0x51'),path[_0xbcc5('0x53')](_0x509647[_0xbcc5('0x54')][_0xbcc5('0x57')],path[_0xbcc5('0x56')](_0x509647['file'][_0xbcc5('0x57')])),_0x494e45['converted_format']));logger[_0xbcc5('0x5b')](_0xbcc5('0x5c'),_0x5a5ecd);logger[_0xbcc5('0x5b')]('Sound\x20upload\x20destination:\x20%s',_0x1a341a);try{fs[_0xbcc5('0x5d')](_0x5a5ecd,parseInt(_0xbcc5('0x5e'),0x8));var _0x4c03e5=sox[_0xbcc5('0x5f')](_0x5a5ecd,_0x1a341a,{'sampleRate':0x1f40,'format':_0xbcc5('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4c03e5['on'](_0xbcc5('0x61'),function(_0x2071ee){fs[_0xbcc5('0x62')](_0x5a5ecd);_0x4fe93a[_0xbcc5('0x15')](0x1f4)[_0xbcc5('0x26')](_0x2071ee);});_0x4c03e5['on'](_0xbcc5('0x63'),function(_0x4bea2c){_0x494e45['original_duration']=isNaN(_0x4bea2c[_0xbcc5('0x64')])?null:_0x4bea2c['duration']*0x3e8;_0x494e45[_0xbcc5('0x65')]=isNaN(_0x4bea2c[_0xbcc5('0x66')])?null:_0x4bea2c['sampleCount'];_0x494e45[_0xbcc5('0x67')]=isNaN(_0x4bea2c['channelCount'])?null:_0x4bea2c[_0xbcc5('0x68')];_0x494e45['original_bitRate']=isNaN(_0x4bea2c[_0xbcc5('0x69')])?null:_0x4bea2c[_0xbcc5('0x69')];_0x494e45[_0xbcc5('0x6a')]=isNaN(_0x4bea2c[_0xbcc5('0x6b')])?null:_0x4bea2c[_0xbcc5('0x6b')];});_0x4c03e5['on'](_0xbcc5('0x6c'),function(_0x145653){_0x494e45[_0xbcc5('0x6d')]=isNaN(_0x145653['duration'])?null:_0x145653[_0xbcc5('0x64')]*0x3e8;_0x494e45[_0xbcc5('0x6e')]=isNaN(_0x145653['sampleCount'])?null:_0x145653[_0xbcc5('0x66')];_0x494e45[_0xbcc5('0x6f')]=isNaN(_0x145653[_0xbcc5('0x68')])?null:_0x145653[_0xbcc5('0x68')];_0x494e45[_0xbcc5('0x70')]=isNaN(_0x145653[_0xbcc5('0x69')])?null:_0x145653['bitRate'];_0x494e45['converted_sampleRate']=isNaN(_0x145653[_0xbcc5('0x6b')])?null:_0x145653['sampleRate'];});_0x4c03e5['on'](_0xbcc5('0x23'),function(){fs[_0xbcc5('0x5d')](_0x1a341a,parseInt(_0xbcc5('0x5e'),0x8));return db[_0xbcc5('0x29')][_0xbcc5('0x52')](_0x494e45)[_0xbcc5('0x1f')](function(_0x3e485a){var _0x4aa869={'role':_0x509647[_0xbcc5('0x71')]['role'],'userProfileId':_0x509647['body'][_0xbcc5('0x72')]};if(!_0x4aa869)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4aa869[_0xbcc5('0x73')]===_0xbcc5('0x74')){var _0x1a99cc=_0x3e485a[_0xbcc5('0x21')]({'plain':!![]});return db['UserProfileSection'][_0xbcc5('0x46')]({'where':{'name':_0xbcc5('0x22'),'userProfileId':_0x4aa869[_0xbcc5('0x72')]},'raw':!![]})[_0xbcc5('0x1f')](function(_0x54f90b){if(_0x54f90b&&_0x54f90b[_0xbcc5('0x75')]===0x0){return db[_0xbcc5('0x76')][_0xbcc5('0x52')]({'name':_0x1a99cc[_0xbcc5('0x25')],'resourceId':_0x1a99cc['id'],'type':_0x54f90b['name'],'sectionId':_0x54f90b['id']},{})[_0xbcc5('0x1f')](function(){return _0x3e485a;});}else{return _0x3e485a;}})[_0xbcc5('0x41')](function(_0x23d4f9){logger[_0xbcc5('0x61')](_0xbcc5('0x77'),_0x23d4f9);throw _0x23d4f9;});}return _0x3e485a;})[_0xbcc5('0x1f')](respondWithResult(_0x4fe93a,null))[_0xbcc5('0x41')](handleError(_0x4fe93a,null));});_0x4c03e5['start']();}catch(_0x578b9f){_0x4fe93a[_0xbcc5('0x15')](0x1f4)['send'](_0x578b9f);}};exports[_0xbcc5('0x1e')]=function(_0x3ea500,_0x597238,_0x56905d){return db[_0xbcc5('0x29')]['find']({'where':{'id':_0x3ea500[_0xbcc5('0x43')]['id']}})[_0xbcc5('0x1f')](handleEntityNotFound(_0x597238,null))[_0xbcc5('0x1f')](saveUpdates(_['pick'](_0x3ea500[_0xbcc5('0x71')],['name',_0xbcc5('0x78')]),null))[_0xbcc5('0x1f')](respondWithResult(_0x597238,null))[_0xbcc5('0x41')](handleError(_0x597238,null));};exports[_0xbcc5('0x79')]=function(_0x472e4a,_0x3dc4f8,_0x3ff0b3){return db[_0xbcc5('0x29')]['find']({'where':{'id':_0x472e4a[_0xbcc5('0x43')]['id']}})['then'](function(_0x403fb0){if(_0x403fb0){return _0x403fb0[_0xbcc5('0x20')]();}})['then'](function(_0x13886c){var _0x80c3e3=path[_0xbcc5('0x4a')](config[_0xbcc5('0x5a')],'server/files/sounds/original',util[_0xbcc5('0x50')](_0xbcc5('0x51'),_0x13886c[_0xbcc5('0x4b')],_0x13886c[_0xbcc5('0x7a')]));var _0xd1ba48=path[_0xbcc5('0x4a')](config[_0xbcc5('0x5a')],_0xbcc5('0x4f'),util[_0xbcc5('0x50')](_0xbcc5('0x51'),_0x13886c[_0xbcc5('0x4b')],_0x13886c[_0xbcc5('0x48')]));fs['unlinkSync'](_0x80c3e3);fs[_0xbcc5('0x62')](_0xd1ba48);return _0x13886c;})['then'](function(_0x51aa42){if(_0x51aa42){return _0x3dc4f8['status'](0xcc)[_0xbcc5('0x23')]();}})[_0xbcc5('0x1f')](handleEntityNotFound(_0x3dc4f8,null))[_0xbcc5('0x41')](handleError(_0x3dc4f8,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 40e622c..111a700 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 _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 +var _0x3aa7=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','tools_sounds','lodash','util','../../config/logger'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x3aa7,0x8d));var _0x73aa=function(_0xc6cd4d,_0x4a4388){_0xc6cd4d=_0xc6cd4d-0x0;var _0x1fe3b2=_0x3aa7[_0xc6cd4d];return _0x1fe3b2;};'use strict';var _=require(_0x73aa('0x0'));var util=require(_0x73aa('0x1'));var logger=require(_0x73aa('0x2'))(_0x73aa('0x3'));var moment=require(_0x73aa('0x4'));var BPromise=require(_0x73aa('0x5'));var rp=require(_0x73aa('0x6'));var fs=require('fs');var path=require(_0x73aa('0x7'));var rimraf=require('rimraf');var config=require(_0x73aa('0x8'));var attributes=require('./sound.attributes');module[_0x73aa('0x9')]=function(_0x11f3a5,_0x4167f7){return _0x11f3a5[_0x73aa('0xa')]('Sound',attributes,{'tableName':_0x73aa('0xb'),'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 1ca140e..ece24b5 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 _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 +var _0x941e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','error','code','Sound,\x20%s,\x20%s','message','result','Sound','find','options','attributes','include','model','map','stringify','catch','lodash','util','moment','bluebird'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0x941e,0x15c));var _0xe941=function(_0x1599dd,_0x3e1f58){_0x1599dd=_0x1599dd-0x0;var _0x424844=_0x941e[_0x1599dd];return _0x424844;};'use strict';var _=require(_0xe941('0x0'));var util=require(_0xe941('0x1'));var moment=require(_0xe941('0x2'));var BPromise=require(_0xe941('0x3'));var rs=require(_0xe941('0x4'));var fs=require('fs');var Redis=require(_0xe941('0x5'));var db=require(_0xe941('0x6'))['db'];var utils=require(_0xe941('0x7'));var logger=require(_0xe941('0x8'))(_0xe941('0x9'));var config=require(_0xe941('0xa'));var jayson=require(_0xe941('0xb'));var client=jayson[_0xe941('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22e064,_0xbede6d,_0x433d53){return new BPromise(function(_0x2f6663,_0x39a5fb){return client[_0xe941('0xd')](_0x22e064,_0x433d53)[_0xe941('0xe')](function(_0x59972b){logger[_0xe941('0xf')]('Sound,\x20%s,\x20%s',_0xbede6d,_0xe941('0x10'));logger[_0xe941('0x11')]('Sound,\x20%s,\x20%s,\x20%s',_0xbede6d,'request\x20sent',JSON['stringify'](_0x59972b));if(_0x59972b[_0xe941('0x12')]){if(_0x59972b[_0xe941('0x12')][_0xe941('0x13')]===0x1f4){logger[_0xe941('0x12')](_0xe941('0x14'),_0xbede6d,_0x59972b['error']['message']);return _0x39a5fb(_0x59972b[_0xe941('0x12')][_0xe941('0x15')]);}logger[_0xe941('0x12')](_0xe941('0x14'),_0xbede6d,_0x59972b[_0xe941('0x12')][_0xe941('0x15')]);return _0x2f6663(_0x59972b['error'][_0xe941('0x15')]);}else{logger[_0xe941('0xf')](_0xe941('0x14'),_0xbede6d,_0xe941('0x10'));_0x2f6663(_0x59972b[_0xe941('0x16')][_0xe941('0x15')]);}})['catch'](function(_0x1c6bc1){logger[_0xe941('0x12')](_0xe941('0x14'),_0xbede6d,_0x1c6bc1);_0x39a5fb(_0x1c6bc1);});});}exports['ShowSound']=function(_0x11899e){var _0x151061=this;return new Promise(function(_0x43e934,_0x163c3){return db[_0xe941('0x17')][_0xe941('0x18')]({'raw':_0x11899e[_0xe941('0x19')]?_0x11899e[_0xe941('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x11899e[_0xe941('0x19')]?_0x11899e[_0xe941('0x19')]['where']||null:null,'attributes':_0x11899e[_0xe941('0x19')]?_0x11899e['options'][_0xe941('0x1a')]||null:null,'include':_0x11899e[_0xe941('0x19')]?_0x11899e[_0xe941('0x19')]['include']?_['map'](_0x11899e[_0xe941('0x19')][_0xe941('0x1b')],function(_0x517676){return{'model':db[_0x517676[_0xe941('0x1c')]],'as':_0x517676['as'],'attributes':_0x517676[_0xe941('0x1a')],'include':_0x517676[_0xe941('0x1b')]?_[_0xe941('0x1d')](_0x517676['include'],function(_0x34607f){return{'model':db[_0x34607f['model']],'as':_0x34607f['as'],'attributes':_0x34607f['attributes'],'include':_0x34607f['include']?_[_0xe941('0x1d')](_0x34607f['include'],function(_0x275017){return{'model':db[_0x275017[_0xe941('0x1c')]],'as':_0x275017['as'],'attributes':_0x275017[_0xe941('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa6a045){logger[_0xe941('0xf')]('ShowSound',_0x11899e);logger[_0xe941('0x11')]('ShowSound',_0x11899e,JSON[_0xe941('0x1e')](_0xa6a045));_0x43e934(_0xa6a045);})[_0xe941('0x1f')](function(_0x4abf78){logger['error']('ShowSound',_0x4abf78['message'],_0x11899e);_0x163c3(_0x151061[_0xe941('0x12')](0x1f4,_0x4abf78['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 8529232..89c56fd 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 _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 +var _0x1e20=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports'];(function(_0x512e72,_0x49ffe1){var _0x143086=function(_0x1d3921){while(--_0x1d3921){_0x512e72['push'](_0x512e72['shift']());}};_0x143086(++_0x49ffe1);}(_0x1e20,0x120));var _0x01e2=function(_0xf520ff,_0x2a7d91){_0xf520ff=_0xf520ff-0x0;var _0x9b098a=_0x1e20[_0xf520ff];return _0x9b098a;};'use strict';var multer=require(_0x01e2('0x0'));var util=require(_0x01e2('0x1'));var path=require(_0x01e2('0x2'));var timeout=require(_0x01e2('0x3'));var express=require(_0x01e2('0x4'));var router=express['Router']();var auth=require(_0x01e2('0x5'));var interaction=require(_0x01e2('0x6'));var config=require('../../config/environment');var controller=require(_0x01e2('0x7'));router[_0x01e2('0x8')]('/',auth[_0x01e2('0x9')](),controller[_0x01e2('0xa')]);router[_0x01e2('0x8')](_0x01e2('0xb'),auth[_0x01e2('0x9')](),controller['show']);router[_0x01e2('0xc')]('/',auth['isAuthenticated'](),controller[_0x01e2('0xd')]);router[_0x01e2('0xe')](_0x01e2('0xb'),auth[_0x01e2('0x9')](),controller[_0x01e2('0xf')]);router['delete'](_0x01e2('0xb'),auth['isAuthenticated'](),controller[_0x01e2('0x10')]);module[_0x01e2('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index d5c0ff4..444cf75 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 _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 +var _0x1cb9=['TEXT','medium','ENUM','out','sequelize','STRING'];(function(_0x5a2340,_0x44b72c){var _0xdc5a04=function(_0x17a20f){while(--_0x17a20f){_0x5a2340['push'](_0x5a2340['shift']());}};_0xdc5a04(++_0x44b72c);}(_0x1cb9,0x14e));var _0x91cb=function(_0x54b9f3,_0x3d72c5){_0x54b9f3=_0x54b9f3-0x0;var _0x1728d5=_0x1cb9[_0x54b9f3];return _0x1728d5;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x91cb('0x1')]},'body':{'type':Sequelize[_0x91cb('0x2')](_0x91cb('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x91cb('0x4')]('in','out'),'defaultValue':_0x91cb('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x91cb('0x1')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 1b41c5d..8bc5b7f 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 _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 +var _0xcbb8=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','SquareMessage','includeAll','findAll','rows','catch','show','params','intersection','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x5a8848,_0x3210a9){var _0x2deed1=function(_0x36e6f4){while(--_0x36e6f4){_0x5a8848['push'](_0x5a8848['shift']());}};_0x2deed1(++_0x3210a9);}(_0xcbb8,0x1eb));var _0x8cbb=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xcbb8[_0x2a6809];return _0x11c371;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8cbb('0x0'));var rimraf=require(_0x8cbb('0x1'));var zipdir=require(_0x8cbb('0x2'));var jsonpatch=require(_0x8cbb('0x3'));var rp=require('request-promise');var moment=require(_0x8cbb('0x4'));var BPromise=require(_0x8cbb('0x5'));var Mustache=require(_0x8cbb('0x6'));var util=require(_0x8cbb('0x7'));var path=require(_0x8cbb('0x8'));var sox=require(_0x8cbb('0x9'));var csv=require(_0x8cbb('0xa'));var ejs=require(_0x8cbb('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8cbb('0xc'));var deskjs=require(_0x8cbb('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8cbb('0xe'));var Papa=require(_0x8cbb('0xf'));var Redis=require('ioredis');var authService=require(_0x8cbb('0x10'));var qs=require(_0x8cbb('0x11'));var as=require(_0x8cbb('0x12'));var hardwareService=require(_0x8cbb('0x13'));var logger=require(_0x8cbb('0x14'))(_0x8cbb('0x15'));var utils=require(_0x8cbb('0x16'));var config=require(_0x8cbb('0x17'));var licenseUtil=require(_0x8cbb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23ab0c,_0x44d47c){_0x44d47c=_0x44d47c||0xcc;return function(_0x21e263){if(_0x21e263){return _0x23ab0c[_0x8cbb('0x19')](_0x44d47c);}return _0x23ab0c['status'](_0x44d47c)['end']();};}function respondWithResult(_0x436540,_0x8f4f37){_0x8f4f37=_0x8f4f37||0xc8;return function(_0x3169e0){if(_0x3169e0){return _0x436540[_0x8cbb('0x1a')](_0x8f4f37)[_0x8cbb('0x1b')](_0x3169e0);}};}function respondWithFilteredResult(_0x1a7765,_0x5addbc){return function(_0x4086ca){if(_0x4086ca){var _0x2426b5=_0x4086ca[_0x8cbb('0x1c')],_0x1f1dd6=_0x5addbc[_0x8cbb('0x1d')],_0x49b1a7=_0x5addbc['offset']+_0x5addbc[_0x8cbb('0x1e')],_0xbfc80f;if(_0x49b1a7>=_0x2426b5){_0x49b1a7=_0x2426b5;_0xbfc80f=0xc8;}else{_0xbfc80f=0xce;}_0x1a7765[_0x8cbb('0x1a')](_0xbfc80f);return _0x1a7765[_0x8cbb('0x1f')]('Content-Range',_0x1f1dd6+'-'+_0x49b1a7+'/'+_0x2426b5)[_0x8cbb('0x1b')](_0x4086ca);}return null;};}function patchUpdates(_0x1ca247){return function(_0x5a8559){try{jsonpatch[_0x8cbb('0x20')](_0x5a8559,_0x1ca247,!![]);}catch(_0x43d737){return BPromise[_0x8cbb('0x21')](_0x43d737);}return _0x5a8559[_0x8cbb('0x22')]();};}function saveUpdates(_0x5efd42,_0x3e9e28){return function(_0x371738){if(_0x371738){return _0x371738['update'](_0x5efd42)[_0x8cbb('0x23')](function(_0x5d94b9){return _0x5d94b9;});}return null;};}function removeEntity(_0x34ad69,_0x5db172){return function(_0x55c2b9){if(_0x55c2b9){return _0x55c2b9[_0x8cbb('0x24')]()[_0x8cbb('0x23')](function(){_0x34ad69[_0x8cbb('0x1a')](0xcc)[_0x8cbb('0x25')]();});}};}function handleEntityNotFound(_0x4526f8,_0x247d65){return function(_0xdd97ef){if(!_0xdd97ef){_0x4526f8[_0x8cbb('0x19')](0x194);}return _0xdd97ef;};}function handleError(_0x161854,_0x266f1a){_0x266f1a=_0x266f1a||0x1f4;return function(_0x22cf5f){logger[_0x8cbb('0x26')](_0x22cf5f['stack']);if(_0x22cf5f[_0x8cbb('0x27')]){delete _0x22cf5f[_0x8cbb('0x27')];}_0x161854['status'](_0x266f1a)[_0x8cbb('0x28')](_0x22cf5f);};}exports[_0x8cbb('0x29')]=function(_0x5eb40e,_0x560b6a){var _0x5620fa={},_0x21f46a={},_0x4b2201={'count':0x0,'rows':[]};var _0x13ab9a=_[_0x8cbb('0x2a')](db['SquareMessage'][_0x8cbb('0x2b')],function(_0x3b1b96){return{'name':_0x3b1b96[_0x8cbb('0x2c')],'type':_0x3b1b96['type'][_0x8cbb('0x2d')]};});_0x21f46a['model']=_[_0x8cbb('0x2a')](_0x13ab9a,_0x8cbb('0x27'));_0x21f46a[_0x8cbb('0x2e')]=_[_0x8cbb('0x2f')](_0x5eb40e[_0x8cbb('0x2e')]);_0x21f46a[_0x8cbb('0x30')]=_['intersection'](_0x21f46a[_0x8cbb('0x31')],_0x21f46a[_0x8cbb('0x2e')]);_0x5620fa[_0x8cbb('0x32')]=_['intersection'](_0x21f46a[_0x8cbb('0x31')],qs[_0x8cbb('0x33')](_0x5eb40e[_0x8cbb('0x2e')]['fields']));_0x5620fa[_0x8cbb('0x32')]=_0x5620fa[_0x8cbb('0x32')][_0x8cbb('0x34')]?_0x5620fa[_0x8cbb('0x32')]:_0x21f46a[_0x8cbb('0x31')];if(!_0x5eb40e['query'][_0x8cbb('0x35')](_0x8cbb('0x36'))){_0x5620fa['limit']=qs[_0x8cbb('0x1e')](_0x5eb40e[_0x8cbb('0x2e')][_0x8cbb('0x1e')]);_0x5620fa[_0x8cbb('0x1d')]=qs[_0x8cbb('0x1d')](_0x5eb40e[_0x8cbb('0x2e')][_0x8cbb('0x1d')]);}_0x5620fa[_0x8cbb('0x37')]=qs[_0x8cbb('0x38')](_0x5eb40e[_0x8cbb('0x2e')][_0x8cbb('0x38')]);_0x5620fa[_0x8cbb('0x39')]=qs[_0x8cbb('0x30')](_['pick'](_0x5eb40e['query'],_0x21f46a[_0x8cbb('0x30')]),_0x13ab9a);if(_0x5eb40e['query']['filter']){_0x5620fa['where']=_[_0x8cbb('0x3a')](_0x5620fa[_0x8cbb('0x39')],{'$or':_[_0x8cbb('0x2a')](_0x13ab9a,function(_0x130c27){if(_0x130c27['type']!=='VIRTUAL'){var _0x566b51={};_0x566b51[_0x130c27[_0x8cbb('0x27')]]={'$like':'%'+_0x5eb40e[_0x8cbb('0x2e')][_0x8cbb('0x3b')]+'%'};return _0x566b51;}})});}_0x5620fa=_[_0x8cbb('0x3a')]({},_0x5620fa,_0x5eb40e[_0x8cbb('0x3c')]);var _0x22bda1={'where':_0x5620fa[_0x8cbb('0x39')]};return db[_0x8cbb('0x3d')][_0x8cbb('0x1c')](_0x22bda1)['then'](function(_0x3df19b){_0x4b2201[_0x8cbb('0x1c')]=_0x3df19b;if(_0x5eb40e[_0x8cbb('0x2e')][_0x8cbb('0x3e')]){_0x5620fa['include']=[{'all':!![]}];}return db[_0x8cbb('0x3d')][_0x8cbb('0x3f')](_0x5620fa);})[_0x8cbb('0x23')](function(_0x1bcc84){_0x4b2201[_0x8cbb('0x40')]=_0x1bcc84;return _0x4b2201;})[_0x8cbb('0x23')](respondWithFilteredResult(_0x560b6a,_0x5620fa))[_0x8cbb('0x41')](handleError(_0x560b6a,null));};exports[_0x8cbb('0x42')]=function(_0x36625c,_0x45fe1a){var _0x333a1b={'raw':!![],'where':{'id':_0x36625c[_0x8cbb('0x43')]['id']}},_0x19b3b0={};_0x19b3b0[_0x8cbb('0x31')]=_['keys'](db[_0x8cbb('0x3d')][_0x8cbb('0x2b')]);_0x19b3b0['query']=_[_0x8cbb('0x2f')](_0x36625c[_0x8cbb('0x2e')]);_0x19b3b0[_0x8cbb('0x30')]=_[_0x8cbb('0x44')](_0x19b3b0['model'],_0x19b3b0[_0x8cbb('0x2e')]);_0x333a1b[_0x8cbb('0x32')]=_[_0x8cbb('0x44')](_0x19b3b0[_0x8cbb('0x31')],qs[_0x8cbb('0x33')](_0x36625c[_0x8cbb('0x2e')][_0x8cbb('0x33')]));_0x333a1b[_0x8cbb('0x32')]=_0x333a1b[_0x8cbb('0x32')][_0x8cbb('0x34')]?_0x333a1b[_0x8cbb('0x32')]:_0x19b3b0[_0x8cbb('0x31')];if(_0x36625c[_0x8cbb('0x2e')][_0x8cbb('0x3e')]){_0x333a1b['include']=[{'all':!![]}];}_0x333a1b=_[_0x8cbb('0x3a')]({},_0x333a1b,_0x36625c[_0x8cbb('0x3c')]);return db[_0x8cbb('0x3d')][_0x8cbb('0x45')](_0x333a1b)[_0x8cbb('0x23')](handleEntityNotFound(_0x45fe1a,null))[_0x8cbb('0x23')](respondWithResult(_0x45fe1a,null))['catch'](handleError(_0x45fe1a,null));};exports[_0x8cbb('0x46')]=function(_0x11d54c,_0x4d4559){return db[_0x8cbb('0x3d')][_0x8cbb('0x46')](_0x11d54c[_0x8cbb('0x47')],{})[_0x8cbb('0x23')](respondWithResult(_0x4d4559,0xc9))['catch'](handleError(_0x4d4559,null));};exports[_0x8cbb('0x48')]=function(_0x460ad6,_0x4f1bdf){if(_0x460ad6['body']['id']){delete _0x460ad6[_0x8cbb('0x47')]['id'];}return db[_0x8cbb('0x3d')][_0x8cbb('0x45')]({'where':{'id':_0x460ad6[_0x8cbb('0x43')]['id']}})['then'](handleEntityNotFound(_0x4f1bdf,null))[_0x8cbb('0x23')](saveUpdates(_0x460ad6[_0x8cbb('0x47')],null))['then'](respondWithResult(_0x4f1bdf,null))['catch'](handleError(_0x4f1bdf,null));};exports[_0x8cbb('0x24')]=function(_0x5c8b4b,_0x10a4b2){return db[_0x8cbb('0x3d')]['find']({'where':{'id':_0x5c8b4b['params']['id']}})[_0x8cbb('0x23')](handleEntityNotFound(_0x10a4b2,null))[_0x8cbb('0x23')](removeEntity(_0x10a4b2,null))[_0x8cbb('0x41')](handleError(_0x10a4b2,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 3ba9c82..26dd945 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 _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 +var _0x8964=['api','moment','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','util'];(function(_0x218d5c,_0x58d566){var _0x388244=function(_0x321703){while(--_0x321703){_0x218d5c['push'](_0x218d5c['shift']());}};_0x388244(++_0x58d566);}(_0x8964,0xc5));var _0x4896=function(_0x1cd4d5,_0x40bd09){_0x1cd4d5=_0x1cd4d5-0x0;var _0x348028=_0x8964[_0x1cd4d5];return _0x348028;};'use strict';var _=require('lodash');var util=require(_0x4896('0x0'));var logger=require('../../config/logger')(_0x4896('0x1'));var moment=require(_0x4896('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4896('0x3'));var rimraf=require(_0x4896('0x4'));var config=require(_0x4896('0x5'));var attributes=require(_0x4896('0x6'));module[_0x4896('0x7')]=function(_0x439ab4,_0x24d5e1){return _0x439ab4[_0x4896('0x8')](_0x4896('0x9'),attributes,{'tableName':_0x4896('0xa'),'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 99943c5..2eb5e6c 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(_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 +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(_0x4210e1,_0x16471d){var _0x32bab2=function(_0x4f41e1){while(--_0x4f41e1){_0x4210e1['push'](_0x4210e1['shift']());}};_0x32bab2(++_0x16471d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 8b682bb..e7cfc81 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 _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 +var _0x80eb=['show','/:id/test','test','post','create','put','/:id','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated'];(function(_0x433397,_0x1660c1){var _0x3119dc=function(_0x41bfcf){while(--_0x41bfcf){_0x433397['push'](_0x433397['shift']());}};_0x3119dc(++_0x1660c1);}(_0x80eb,0x1ae));var _0xb80e=function(_0x871f5b,_0x4d3987){_0x871f5b=_0x871f5b-0x0;var _0x25d1fa=_0x80eb[_0x871f5b];return _0x25d1fa;};'use strict';var multer=require(_0xb80e('0x0'));var util=require(_0xb80e('0x1'));var path=require(_0xb80e('0x2'));var timeout=require('connect-timeout');var express=require(_0xb80e('0x3'));var router=express[_0xb80e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb80e('0x5'));var config=require(_0xb80e('0x6'));var controller=require(_0xb80e('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb80e('0x8')]('/:id',auth[_0xb80e('0x9')](),controller[_0xb80e('0xa')]);router['get'](_0xb80e('0xb'),auth[_0xb80e('0x9')](),timeout('15s'),controller[_0xb80e('0xc')]);router[_0xb80e('0xd')]('/',auth[_0xb80e('0x9')](),controller[_0xb80e('0xe')]);router[_0xb80e('0xf')](_0xb80e('0x10'),auth['isAuthenticated'](),controller[_0xb80e('0x11')]);router[_0xb80e('0x12')]('/:id',auth[_0xb80e('0x9')](),controller['destroy']);module[_0xb80e('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 628a67f..d9737b6 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 _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 +var _0x256c=['name','sequelize','exports','STRING'];(function(_0xc652b9,_0x3e59d4){var _0x48a8f6=function(_0x41ffa3){while(--_0x41ffa3){_0xc652b9['push'](_0xc652b9['shift']());}};_0x48a8f6(++_0x3e59d4);}(_0x256c,0x95));var _0xc256=function(_0x139d64,_0x1d5b10){_0x139d64=_0x139d64-0x0;var _0x5df7c0=_0x256c[_0x139d64];return _0x5df7c0;};'use strict';var Sequelize=require(_0xc256('0x0'));module[_0xc256('0x1')]={'name':{'type':Sequelize[_0xc256('0x2')],'unique':_0xc256('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc256('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 6df7189..b674e1e 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 _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 +var _0x51b9=['nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','update','params','dsn','openSync','closeSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','json','apply','save','then','get','ODBC','UserProfileResource','destroy','error','name','send','index','map','SquareOdbc','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x2b1389,_0x1a40f7){var _0x398996=function(_0x379434){while(--_0x379434){_0x2b1389['push'](_0x2b1389['shift']());}};_0x398996(++_0x1a40f7);}(_0x51b9,0x17d));var _0x951b=function(_0x42711a,_0x50df0d){_0x42711a=_0x42711a-0x0;var _0x5d912a=_0x51b9[_0x42711a];return _0x5d912a;};'use strict';var pdf=require(_0x951b('0x0'));var emlformat=require(_0x951b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x951b('0x2'));var jsonpatch=require(_0x951b('0x3'));var rp=require(_0x951b('0x4'));var moment=require(_0x951b('0x5'));var BPromise=require(_0x951b('0x6'));var Mustache=require(_0x951b('0x7'));var util=require(_0x951b('0x8'));var path=require(_0x951b('0x9'));var sox=require('sox');var csv=require(_0x951b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x951b('0xb'));var squel=require(_0x951b('0xc'));var crypto=require(_0x951b('0xd'));var jsforce=require(_0x951b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x951b('0xa'));var querystring=require(_0x951b('0xf'));var Papa=require(_0x951b('0x10'));var Redis=require(_0x951b('0x11'));var authService=require(_0x951b('0x12'));var qs=require(_0x951b('0x13'));var as=require(_0x951b('0x14'));var hardwareService=require(_0x951b('0x15'));var logger=require(_0x951b('0x16'))(_0x951b('0x17'));var utils=require(_0x951b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x951b('0x19'));var db=require(_0x951b('0x1a'))['db'];function respondWithStatusCode(_0x47cbcd,_0x476426){_0x476426=_0x476426||0xcc;return function(_0x1d300b){if(_0x1d300b){return _0x47cbcd[_0x951b('0x1b')](_0x476426);}return _0x47cbcd[_0x951b('0x1c')](_0x476426)[_0x951b('0x1d')]();};}function respondWithResult(_0x321591,_0x554926){_0x554926=_0x554926||0xc8;return function(_0x896040){if(_0x896040){return _0x321591[_0x951b('0x1c')](_0x554926)['json'](_0x896040);}};}function respondWithFilteredResult(_0x2fe48d,_0x2aba42){return function(_0x129fdf){if(_0x129fdf){var _0xe5a59d=_0x129fdf[_0x951b('0x1e')],_0x4b0ad6=_0x2aba42['offset'],_0x4aa600=_0x2aba42[_0x951b('0x1f')]+_0x2aba42['limit'],_0x20d162;if(_0x4aa600>=_0xe5a59d){_0x4aa600=_0xe5a59d;_0x20d162=0xc8;}else{_0x20d162=0xce;}_0x2fe48d[_0x951b('0x1c')](_0x20d162);return _0x2fe48d['set'](_0x951b('0x20'),_0x4b0ad6+'-'+_0x4aa600+'/'+_0xe5a59d)[_0x951b('0x21')](_0x129fdf);}return null;};}function patchUpdates(_0x26933b){return function(_0xc242f4){try{jsonpatch[_0x951b('0x22')](_0xc242f4,_0x26933b,!![]);}catch(_0x1ee11d){return BPromise['reject'](_0x1ee11d);}return _0xc242f4[_0x951b('0x23')]();};}function saveUpdates(_0x143647,_0x29938d){return function(_0x2261b6){if(_0x2261b6){return _0x2261b6['update'](_0x143647)[_0x951b('0x24')](function(_0x2fbeca){return _0x2fbeca;});}return null;};}function removeEntity(_0x58429d,_0x4d3c08){return function(_0x29370b){if(_0x29370b){return _0x29370b['destroy']()[_0x951b('0x24')](function(){var _0x4a20cb=_0x29370b[_0x951b('0x25')]({'plain':!![]});var _0x67df4=_0x951b('0x26');return db[_0x951b('0x27')][_0x951b('0x28')]({'where':{'type':_0x67df4,'resourceId':_0x4a20cb['id']}})['then'](function(){return _0x29370b;});})[_0x951b('0x24')](function(){_0x58429d['status'](0xcc)[_0x951b('0x1d')]();});}};}function handleEntityNotFound(_0x42f670,_0x33e424){return function(_0x5c28db){if(!_0x5c28db){_0x42f670[_0x951b('0x1b')](0x194);}return _0x5c28db;};}function handleError(_0x2271fd,_0x4563b2){_0x4563b2=_0x4563b2||0x1f4;return function(_0x5191c8){logger[_0x951b('0x29')](_0x5191c8['stack']);if(_0x5191c8[_0x951b('0x2a')]){delete _0x5191c8[_0x951b('0x2a')];}_0x2271fd[_0x951b('0x1c')](_0x4563b2)[_0x951b('0x2b')](_0x5191c8);};}exports[_0x951b('0x2c')]=function(_0x1aa0fb,_0x290159){var _0x28d830={},_0x44886e={},_0x41c458={'count':0x0,'rows':[]};var _0x361e36=_[_0x951b('0x2d')](db[_0x951b('0x2e')]['rawAttributes'],function(_0x2b46fd){return{'name':_0x2b46fd[_0x951b('0x2f')],'type':_0x2b46fd[_0x951b('0x30')][_0x951b('0x31')]};});_0x44886e[_0x951b('0x32')]=_[_0x951b('0x2d')](_0x361e36,_0x951b('0x2a'));_0x44886e[_0x951b('0x33')]=_[_0x951b('0x34')](_0x1aa0fb[_0x951b('0x33')]);_0x44886e[_0x951b('0x35')]=_[_0x951b('0x36')](_0x44886e[_0x951b('0x32')],_0x44886e['query']);_0x28d830[_0x951b('0x37')]=_[_0x951b('0x36')](_0x44886e[_0x951b('0x32')],qs[_0x951b('0x38')](_0x1aa0fb[_0x951b('0x33')][_0x951b('0x38')]));_0x28d830[_0x951b('0x37')]=_0x28d830[_0x951b('0x37')][_0x951b('0x39')]?_0x28d830['attributes']:_0x44886e[_0x951b('0x32')];if(!_0x1aa0fb['query'][_0x951b('0x3a')](_0x951b('0x3b'))){_0x28d830[_0x951b('0x3c')]=qs[_0x951b('0x3c')](_0x1aa0fb['query'][_0x951b('0x3c')]);_0x28d830[_0x951b('0x1f')]=qs[_0x951b('0x1f')](_0x1aa0fb[_0x951b('0x33')][_0x951b('0x1f')]);}_0x28d830[_0x951b('0x3d')]=qs[_0x951b('0x3e')](_0x1aa0fb[_0x951b('0x33')]['sort']);_0x28d830[_0x951b('0x3f')]=qs[_0x951b('0x35')](_[_0x951b('0x40')](_0x1aa0fb['query'],_0x44886e[_0x951b('0x35')]),_0x361e36);if(_0x1aa0fb['query'][_0x951b('0x41')]){_0x28d830[_0x951b('0x3f')]=_[_0x951b('0x42')](_0x28d830[_0x951b('0x3f')],{'$or':_[_0x951b('0x2d')](_0x361e36,function(_0x48e1b8){if(_0x48e1b8[_0x951b('0x30')]!==_0x951b('0x43')){var _0x3e496b={};_0x3e496b[_0x48e1b8[_0x951b('0x2a')]]={'$like':'%'+_0x1aa0fb['query'][_0x951b('0x41')]+'%'};return _0x3e496b;}})});}_0x28d830=_[_0x951b('0x42')]({},_0x28d830,_0x1aa0fb[_0x951b('0x44')]);var _0x4ca61d={'where':_0x28d830[_0x951b('0x3f')]};return db[_0x951b('0x2e')]['count'](_0x4ca61d)[_0x951b('0x24')](function(_0x525f66){_0x41c458[_0x951b('0x1e')]=_0x525f66;if(_0x1aa0fb[_0x951b('0x33')][_0x951b('0x45')]){_0x28d830['include']=[{'all':!![]}];}return db[_0x951b('0x2e')][_0x951b('0x46')](_0x28d830);})[_0x951b('0x24')](function(_0x3b0b0f){_0x41c458[_0x951b('0x47')]=_0x3b0b0f;return _0x41c458;})[_0x951b('0x24')](respondWithFilteredResult(_0x290159,_0x28d830))['catch'](handleError(_0x290159,null));};exports[_0x951b('0x48')]=function(_0x10ac21,_0x4e6ccb){var _0x5e0b17={'raw':!![],'where':{'id':_0x10ac21['params']['id']}},_0x1c8dc6={};_0x1c8dc6[_0x951b('0x32')]=_[_0x951b('0x34')](db['SquareOdbc']['rawAttributes']);_0x1c8dc6[_0x951b('0x33')]=_[_0x951b('0x34')](_0x10ac21[_0x951b('0x33')]);_0x1c8dc6[_0x951b('0x35')]=_[_0x951b('0x36')](_0x1c8dc6['model'],_0x1c8dc6['query']);_0x5e0b17['attributes']=_['intersection'](_0x1c8dc6[_0x951b('0x32')],qs[_0x951b('0x38')](_0x10ac21[_0x951b('0x33')]['fields']));_0x5e0b17[_0x951b('0x37')]=_0x5e0b17[_0x951b('0x37')]['length']?_0x5e0b17['attributes']:_0x1c8dc6[_0x951b('0x32')];if(_0x10ac21[_0x951b('0x33')]['includeAll']){_0x5e0b17[_0x951b('0x49')]=[{'all':!![]}];}_0x5e0b17=_[_0x951b('0x42')]({},_0x5e0b17,_0x10ac21[_0x951b('0x44')]);return db[_0x951b('0x2e')]['find'](_0x5e0b17)[_0x951b('0x24')](handleEntityNotFound(_0x4e6ccb,null))[_0x951b('0x24')](respondWithResult(_0x4e6ccb,null))[_0x951b('0x4a')](handleError(_0x4e6ccb,null));};exports[_0x951b('0x4b')]=function(_0x5e6d3f,_0x19109f){return db[_0x951b('0x2e')][_0x951b('0x4b')](_0x5e6d3f[_0x951b('0x4c')],{})[_0x951b('0x24')](function(_0x27ad16){var _0x56cd53=_0x5e6d3f[_0x951b('0x4d')]['get']({'plain':!![]});if(!_0x56cd53)throw new Error(_0x951b('0x4e'));if(_0x56cd53[_0x951b('0x4f')]===_0x951b('0x4d')){var _0x12b02a=_0x27ad16[_0x951b('0x25')]({'plain':!![]});var _0x5c1fd1=_0x951b('0x26');return db[_0x951b('0x50')][_0x951b('0x51')]({'where':{'name':_0x5c1fd1,'userProfileId':_0x56cd53['userProfileId']},'raw':!![]})[_0x951b('0x24')](function(_0x268441){if(_0x268441&&_0x268441[_0x951b('0x52')]===0x0){return db[_0x951b('0x27')][_0x951b('0x4b')]({'name':_0x12b02a[_0x951b('0x2a')],'resourceId':_0x12b02a['id'],'type':_0x268441[_0x951b('0x2a')],'sectionId':_0x268441['id']},{})[_0x951b('0x24')](function(){return _0x27ad16;});}else{return _0x27ad16;}})[_0x951b('0x4a')](function(_0x500422){logger[_0x951b('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x500422);throw _0x500422;});}return _0x27ad16;})['then'](respondWithResult(_0x19109f,0xc9))['catch'](handleError(_0x19109f,null));};exports[_0x951b('0x53')]=function(_0x2fe9e8,_0x536ffd){if(_0x2fe9e8[_0x951b('0x4c')]['id']){delete _0x2fe9e8[_0x951b('0x4c')]['id'];}return db[_0x951b('0x2e')][_0x951b('0x51')]({'where':{'id':_0x2fe9e8[_0x951b('0x54')]['id']}})[_0x951b('0x24')](handleEntityNotFound(_0x536ffd,null))[_0x951b('0x24')](saveUpdates(_0x2fe9e8[_0x951b('0x4c')],null))[_0x951b('0x24')](respondWithResult(_0x536ffd,null))[_0x951b('0x4a')](handleError(_0x536ffd,null));};exports[_0x951b('0x28')]=function(_0xcdd8a3,_0x1e8135){return db[_0x951b('0x2e')][_0x951b('0x51')]({'where':{'id':_0xcdd8a3[_0x951b('0x54')]['id']}})[_0x951b('0x24')](handleEntityNotFound(_0x1e8135,null))[_0x951b('0x24')](removeEntity(_0x1e8135,null))['catch'](handleError(_0x1e8135,null));};exports['test']=function(_0x1fa38a,_0x57f8e7,_0x19bd4f){var _0x32bd42;return db['SquareOdbc']['find']({'where':{'id':_0x1fa38a[_0x951b('0x54')]['id']},'attributes':['id',_0x951b('0x55')]})['then'](handleEntityNotFound(_0x57f8e7,null))[_0x951b('0x24')](function(_0x35488e){if(_0x35488e){var _0x12f050=require('odbc')();_0x12f050[_0x951b('0x56')](_0x35488e[_0x951b('0x55')]);_0x12f050[_0x951b('0x57')]();return _0x35488e;}})[_0x951b('0x24')](respondWithResult(_0x57f8e7,null))[_0x951b('0x4a')](handleError(_0x57f8e7,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index e59bc5a..bf2c7fa 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 _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 +var _0x17a7=['exports','define','SquareOdbc','square_odbc','api','moment','bluebird','request-promise','rimraf','./squareOdbc.attributes'];(function(_0x11616c,_0x26252e){var _0x11f4bf=function(_0x185c9a){while(--_0x185c9a){_0x11616c['push'](_0x11616c['shift']());}};_0x11f4bf(++_0x26252e);}(_0x17a7,0xc2));var _0x717a=function(_0x4f5d03,_0x2a2ce8){_0x4f5d03=_0x4f5d03-0x0;var _0x44b91a=_0x17a7[_0x4f5d03];return _0x44b91a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x717a('0x0'));var moment=require(_0x717a('0x1'));var BPromise=require(_0x717a('0x2'));var rp=require(_0x717a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x717a('0x4'));var config=require('../../config/environment');var attributes=require(_0x717a('0x5'));module[_0x717a('0x6')]=function(_0x4dd8c3,_0x232539){return _0x4dd8c3[_0x717a('0x7')](_0x717a('0x8'),attributes,{'tableName':_0x717a('0x9'),'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 e4c3225..8f3775b 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 _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 +var _0x7217=['where','attributes','map','include','model','ShowSquareOdbc','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw'];(function(_0x314e6d,_0x671d5a){var _0x92117f=function(_0x350e2a){while(--_0x350e2a){_0x314e6d['push'](_0x314e6d['shift']());}};_0x92117f(++_0x671d5a);}(_0x7217,0x19e));var _0x7721=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x7217[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowSquareOdbc']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowSquareOdbc',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index c9522c7..78466cd 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 _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 +var _0x856d=['/:id','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','/:id/users','post','addUsers','put','delete'];(function(_0x215735,_0x5e3eca){var _0x3aee2b=function(_0x2bdb40){while(--_0x2bdb40){_0x215735['push'](_0x215735['shift']());}};_0x3aee2b(++_0x5e3eca);}(_0x856d,0x180));var _0xd856=function(_0x54efb6,_0x78e231){_0x54efb6=_0x54efb6-0x0;var _0x40fc6e=_0x856d[_0x54efb6];return _0x40fc6e;};'use strict';var multer=require(_0xd856('0x0'));var util=require(_0xd856('0x1'));var path=require(_0xd856('0x2'));var timeout=require(_0xd856('0x3'));var express=require(_0xd856('0x4'));var router=express[_0xd856('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd856('0x6'));var config=require(_0xd856('0x7'));var controller=require('./squareProject.controller');router['get']('/',auth[_0xd856('0x8')](),controller['index']);router[_0xd856('0x9')]('/:id',auth[_0xd856('0x8')](),controller[_0xd856('0xa')]);router[_0xd856('0x9')](_0xd856('0xb'),auth[_0xd856('0x8')](),controller['getUsers']);router[_0xd856('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd856('0xc')]('/:id/users',auth[_0xd856('0x8')](),controller[_0xd856('0xd')]);router[_0xd856('0xe')]('/:id',auth[_0xd856('0x8')](),controller['update']);router[_0xd856('0xf')](_0xd856('0x10'),auth[_0xd856('0x8')](),controller[_0xd856('0x11')]);router['delete']('/:id/users',auth[_0xd856('0x8')](),controller[_0xd856('0x12')]);module[_0xd856('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 117c471..d967787 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 _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 +var _0xc902=['sequelize','exports','STRING','name','TEXT','long','getDataValue','preproduction','BLOB','production','utf8','DATE'];(function(_0x422262,_0x5ca5fc){var _0x5902e1=function(_0x2eec7e){while(--_0x2eec7e){_0x422262['push'](_0x422262['shift']());}};_0x5902e1(++_0x5ca5fc);}(_0xc902,0x15c));var _0x2c90=function(_0x127f98,_0x3583e2){_0x127f98=_0x127f98-0x0;var _0x2b33d7=_0xc902[_0x127f98];return _0x2b33d7;};'use strict';var Sequelize=require(_0x2c90('0x0'));module[_0x2c90('0x1')]={'name':{'type':Sequelize[_0x2c90('0x2')],'unique':_0x2c90('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2c90('0x2')]},'notes':{'type':Sequelize[_0x2c90('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x2c90('0x5')),'get':function(){if(this[_0x2c90('0x6')](_0x2c90('0x7'))){return this[_0x2c90('0x6')](_0x2c90('0x7'))['toString']('utf8');}}},'production':{'type':Sequelize[_0x2c90('0x8')](_0x2c90('0x5')),'get':function(){if(this[_0x2c90('0x6')](_0x2c90('0x9'))){return this[_0x2c90('0x6')]('production')['toString'](_0x2c90('0xa'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x2c90('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index aa0d70c..4e9932c 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 _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 +var _0x9a57=['find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','order','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','error','name','send','index','SquareProject','rawAttributes','fieldName','type','model','query','keys','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','map','includeAll','include','findAll','catch','show','params','intersection','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SquareProjects','UserProfileSection'];(function(_0x233d72,_0x54a0dd){var _0x2e6a0f=function(_0xda39df){while(--_0xda39df){_0x233d72['push'](_0x233d72['shift']());}};_0x2e6a0f(++_0x54a0dd);}(_0x9a57,0x12e));var _0x79a5=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9a57[_0x8c43de];return _0xa6591b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x79a5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x79a5('0x1'));var rp=require(_0x79a5('0x2'));var moment=require(_0x79a5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x79a5('0x4'));var util=require(_0x79a5('0x5'));var path=require(_0x79a5('0x6'));var sox=require(_0x79a5('0x7'));var csv=require(_0x79a5('0x8'));var ejs=require(_0x79a5('0x9'));var fs=require('fs');var _=require(_0x79a5('0xa'));var squel=require(_0x79a5('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x79a5('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x79a5('0xd'));var Redis=require(_0x79a5('0xe'));var authService=require(_0x79a5('0xf'));var qs=require(_0x79a5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x79a5('0x11'));var logger=require(_0x79a5('0x12'))(_0x79a5('0x13'));var utils=require(_0x79a5('0x14'));var config=require(_0x79a5('0x15'));var licenseUtil=require(_0x79a5('0x16'));var db=require(_0x79a5('0x17'))['db'];config['redis']=_[_0x79a5('0x18')](config[_0x79a5('0x19')],{'host':_0x79a5('0x1a'),'port':0x18eb});var socket=require(_0x79a5('0x1b'))(new Redis(config['redis']));require(_0x79a5('0x1c'))[_0x79a5('0x1d')](socket);function respondWithStatusCode(_0xef5d9d,_0x363934){_0x363934=_0x363934||0xcc;return function(_0x436b3f){if(_0x436b3f){return _0xef5d9d[_0x79a5('0x1e')](_0x363934);}return _0xef5d9d['status'](_0x363934)[_0x79a5('0x1f')]();};}function respondWithResult(_0x7a2925,_0x278bba){_0x278bba=_0x278bba||0xc8;return function(_0xa20e21){if(_0xa20e21){return _0x7a2925[_0x79a5('0x20')](_0x278bba)[_0x79a5('0x21')](_0xa20e21);}};}function respondWithFilteredResult(_0x752ba5,_0x217a1c){return function(_0x198f9f){if(_0x198f9f){var _0x32cbc7=_0x198f9f[_0x79a5('0x22')],_0x5ed6ee=_0x217a1c['offset'],_0x5e4017=_0x217a1c[_0x79a5('0x23')]+_0x217a1c[_0x79a5('0x24')],_0x260c20;if(_0x5e4017>=_0x32cbc7){_0x5e4017=_0x32cbc7;_0x260c20=0xc8;}else{_0x260c20=0xce;}_0x752ba5[_0x79a5('0x20')](_0x260c20);return _0x752ba5[_0x79a5('0x25')](_0x79a5('0x26'),_0x5ed6ee+'-'+_0x5e4017+'/'+_0x32cbc7)['json'](_0x198f9f);}return null;};}function patchUpdates(_0x3cf943){return function(_0x340341){try{jsonpatch[_0x79a5('0x27')](_0x340341,_0x3cf943,!![]);}catch(_0x3e7e7c){return BPromise[_0x79a5('0x28')](_0x3e7e7c);}return _0x340341[_0x79a5('0x29')]();};}function saveUpdates(_0x228040,_0x14cf8d){return function(_0x564f96){if(_0x564f96){return _0x564f96['update'](_0x228040)[_0x79a5('0x2a')](function(_0x2af5cb){return _0x2af5cb;});}return null;};}function removeEntity(_0x15ad61,_0x469717){return function(_0x4b071d){if(_0x4b071d){return _0x4b071d['destroy']()[_0x79a5('0x2a')](function(){var _0x40618f=_0x4b071d[_0x79a5('0x2b')]({'plain':!![]});var _0x2ddc3a='SquareProjects';return db[_0x79a5('0x2c')][_0x79a5('0x2d')]({'where':{'type':_0x2ddc3a,'resourceId':_0x40618f['id']}})[_0x79a5('0x2a')](function(){return _0x4b071d;});})[_0x79a5('0x2a')](function(){_0x15ad61['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b2310,_0x4aac7c){return function(_0x31231b){if(!_0x31231b){_0x5b2310[_0x79a5('0x1e')](0x194);}return _0x31231b;};}function handleError(_0x4569a2,_0xccab04){_0xccab04=_0xccab04||0x1f4;return function(_0x494c50){logger[_0x79a5('0x2e')](_0x494c50['stack']);if(_0x494c50[_0x79a5('0x2f')]){delete _0x494c50[_0x79a5('0x2f')];}_0x4569a2['status'](_0xccab04)[_0x79a5('0x30')](_0x494c50);};}exports[_0x79a5('0x31')]=function(_0x5817e4,_0x1c42ce){var _0x2435d4={},_0x53517d={},_0x24d265={'count':0x0,'rows':[]};var _0x401ff0=_['map'](db[_0x79a5('0x32')][_0x79a5('0x33')],function(_0x2a26ff){return{'name':_0x2a26ff[_0x79a5('0x34')],'type':_0x2a26ff[_0x79a5('0x35')]['key']};});_0x53517d[_0x79a5('0x36')]=_['map'](_0x401ff0,'name');_0x53517d[_0x79a5('0x37')]=_[_0x79a5('0x38')](_0x5817e4['query']);_0x53517d['filters']=_['intersection'](_0x53517d[_0x79a5('0x36')],_0x53517d[_0x79a5('0x37')]);_0x2435d4[_0x79a5('0x39')]=_['intersection'](_0x53517d[_0x79a5('0x36')],qs['fields'](_0x5817e4['query'][_0x79a5('0x3a')]));_0x2435d4[_0x79a5('0x39')]=_0x2435d4[_0x79a5('0x39')]['length']?_0x2435d4[_0x79a5('0x39')]:_0x53517d[_0x79a5('0x36')];if(!_0x5817e4[_0x79a5('0x37')][_0x79a5('0x3b')](_0x79a5('0x3c'))){_0x2435d4[_0x79a5('0x24')]=qs[_0x79a5('0x24')](_0x5817e4['query'][_0x79a5('0x24')]);_0x2435d4[_0x79a5('0x23')]=qs[_0x79a5('0x23')](_0x5817e4[_0x79a5('0x37')][_0x79a5('0x23')]);}_0x2435d4['order']=qs[_0x79a5('0x3d')](_0x5817e4['query'][_0x79a5('0x3d')]);_0x2435d4[_0x79a5('0x3e')]=qs['filters'](_['pick'](_0x5817e4['query'],_0x53517d[_0x79a5('0x3f')]),_0x401ff0);if(_0x5817e4['query'][_0x79a5('0x40')]){_0x2435d4[_0x79a5('0x3e')]=_[_0x79a5('0x41')](_0x2435d4[_0x79a5('0x3e')],{'$or':_[_0x79a5('0x42')](_0x401ff0,function(_0x5a2a67){if(_0x5a2a67[_0x79a5('0x35')]!=='VIRTUAL'){var _0x540944={};_0x540944[_0x5a2a67['name']]={'$like':'%'+_0x5817e4[_0x79a5('0x37')][_0x79a5('0x40')]+'%'};return _0x540944;}})});}_0x2435d4=_['merge']({},_0x2435d4,_0x5817e4['options']);var _0x957e6={'where':_0x2435d4[_0x79a5('0x3e')]};return db[_0x79a5('0x32')][_0x79a5('0x22')](_0x957e6)[_0x79a5('0x2a')](function(_0x1ea5b9){_0x24d265[_0x79a5('0x22')]=_0x1ea5b9;if(_0x5817e4[_0x79a5('0x37')][_0x79a5('0x43')]){_0x2435d4[_0x79a5('0x44')]=[{'all':!![]}];}return db['SquareProject'][_0x79a5('0x45')](_0x2435d4);})[_0x79a5('0x2a')](function(_0x12d9a2){_0x24d265['rows']=_0x12d9a2;return _0x24d265;})[_0x79a5('0x2a')](respondWithFilteredResult(_0x1c42ce,_0x2435d4))[_0x79a5('0x46')](handleError(_0x1c42ce,null));};exports[_0x79a5('0x47')]=function(_0x3f79a4,_0x39f835){var _0x20d598={'raw':![],'where':{'id':_0x3f79a4[_0x79a5('0x48')]['id']}},_0x19dcb8={};_0x19dcb8['model']=_[_0x79a5('0x38')](db['SquareProject']['rawAttributes']);_0x19dcb8[_0x79a5('0x37')]=_['keys'](_0x3f79a4[_0x79a5('0x37')]);_0x19dcb8['filters']=_[_0x79a5('0x49')](_0x19dcb8[_0x79a5('0x36')],_0x19dcb8[_0x79a5('0x37')]);_0x20d598[_0x79a5('0x39')]=_['intersection'](_0x19dcb8['model'],qs[_0x79a5('0x3a')](_0x3f79a4[_0x79a5('0x37')]['fields']));_0x20d598[_0x79a5('0x39')]=_0x20d598[_0x79a5('0x39')][_0x79a5('0x4a')]?_0x20d598[_0x79a5('0x39')]:_0x19dcb8[_0x79a5('0x36')];if(_0x3f79a4[_0x79a5('0x37')]['includeAll']){_0x20d598[_0x79a5('0x44')]=[{'all':!![]}];}_0x20d598=_[_0x79a5('0x41')]({},_0x20d598,_0x3f79a4[_0x79a5('0x4b')]);return db[_0x79a5('0x32')]['find'](_0x20d598)[_0x79a5('0x2a')](handleEntityNotFound(_0x39f835,null))[_0x79a5('0x2a')](respondWithResult(_0x39f835,null))[_0x79a5('0x46')](handleError(_0x39f835,null));};exports[_0x79a5('0x4c')]=function(_0x5d2a1e,_0x565e17){return db[_0x79a5('0x32')]['create'](_0x5d2a1e[_0x79a5('0x4d')],{})[_0x79a5('0x2a')](function(_0x4d0310){var _0x5c6a39=_0x5d2a1e[_0x79a5('0x4e')][_0x79a5('0x2b')]({'plain':!![]});if(!_0x5c6a39)throw new Error(_0x79a5('0x4f'));if(_0x5c6a39['role']===_0x79a5('0x4e')){var _0x246cd6=_0x4d0310[_0x79a5('0x2b')]({'plain':!![]});var _0x5d423d=_0x79a5('0x50');return db[_0x79a5('0x51')][_0x79a5('0x52')]({'where':{'name':_0x5d423d,'userProfileId':_0x5c6a39[_0x79a5('0x53')]},'raw':!![]})[_0x79a5('0x2a')](function(_0x588577){if(_0x588577&&_0x588577[_0x79a5('0x54')]===0x0){return db[_0x79a5('0x2c')][_0x79a5('0x4c')]({'name':_0x246cd6['name'],'resourceId':_0x246cd6['id'],'type':_0x588577['name'],'sectionId':_0x588577['id']},{})[_0x79a5('0x2a')](function(){return _0x4d0310;});}else{return _0x4d0310;}})['catch'](function(_0x4b0609){logger[_0x79a5('0x2e')](_0x79a5('0x55'),_0x4b0609);throw _0x4b0609;});}return _0x4d0310;})['then'](respondWithResult(_0x565e17,0xc9))[_0x79a5('0x46')](handleError(_0x565e17,null));};exports[_0x79a5('0x56')]=function(_0x23b3a8,_0x37d132){if(_0x23b3a8[_0x79a5('0x4d')]['id']){delete _0x23b3a8[_0x79a5('0x4d')]['id'];}return db[_0x79a5('0x32')][_0x79a5('0x52')]({'where':{'id':_0x23b3a8['params']['id']}})[_0x79a5('0x2a')](handleEntityNotFound(_0x37d132,null))[_0x79a5('0x2a')](saveUpdates(_0x23b3a8[_0x79a5('0x4d')],null))[_0x79a5('0x2a')](respondWithResult(_0x37d132,null))['catch'](handleError(_0x37d132,null));};exports[_0x79a5('0x2d')]=function(_0x1d4b97,_0x46e226){return db['SquareProject'][_0x79a5('0x52')]({'where':{'id':_0x1d4b97['params']['id']}})[_0x79a5('0x2a')](handleEntityNotFound(_0x46e226,null))[_0x79a5('0x2a')](removeEntity(_0x46e226,null))[_0x79a5('0x46')](handleError(_0x46e226,null));};exports[_0x79a5('0x57')]=function(_0x37f01c,_0x182dcd,_0x3db615){return db['SquareProject'][_0x79a5('0x52')]({'where':{'id':_0x37f01c[_0x79a5('0x48')]['id']}})[_0x79a5('0x2a')](handleEntityNotFound(_0x182dcd,null))[_0x79a5('0x2a')](function(_0x46d4b5){if(_0x46d4b5){return _0x46d4b5[_0x79a5('0x57')](_0x37f01c[_0x79a5('0x4d')][_0x79a5('0x58')],_['omit'](_0x37f01c[_0x79a5('0x4d')],[_0x79a5('0x58'),'id'])||{});}})[_0x79a5('0x2a')](respondWithResult(_0x182dcd,null))[_0x79a5('0x46')](handleError(_0x182dcd,null));};exports[_0x79a5('0x59')]=function(_0x22a47d,_0x4f1c96,_0x23df65){return db[_0x79a5('0x32')]['find']({'where':{'id':_0x22a47d[_0x79a5('0x48')]['id']}})['then'](handleEntityNotFound(_0x4f1c96,null))[_0x79a5('0x2a')](function(_0x31196f){if(_0x31196f){return _0x31196f[_0x79a5('0x59')](_0x22a47d['query'][_0x79a5('0x58')])[_0x79a5('0x2a')](function(){if(_[_0x79a5('0x5a')](_0x22a47d[_0x79a5('0x37')][_0x79a5('0x58')])){for(var _0xe07f28=0x0;_0xe07f28<_0x22a47d[_0x79a5('0x37')][_0x79a5('0x58')][_0x79a5('0x4a')];_0xe07f28+=0x1){socket[_0x79a5('0x5b')](_0x79a5('0x5c'),{'UserId':Number(_0x22a47d[_0x79a5('0x37')][_0x79a5('0x58')][_0xe07f28]),'SquareProjectId':Number(_0x22a47d[_0x79a5('0x48')]['id'])});}}else{socket[_0x79a5('0x5b')](_0x79a5('0x5c'),{'UserId':Number(_0x22a47d[_0x79a5('0x37')][_0x79a5('0x58')]),'SquareProjectId':Number(_0x22a47d[_0x79a5('0x48')]['id'])});}});}})[_0x79a5('0x2a')](respondWithStatusCode(_0x4f1c96,null))[_0x79a5('0x46')](handleError(_0x4f1c96,null));};exports[_0x79a5('0x5d')]=function(_0x118267,_0x58d933,_0x9147e0){var _0x41bd39={};var _0x9183c8={};var _0x2c3880;var _0x4e3fee;return db[_0x79a5('0x32')][_0x79a5('0x5e')]({'where':{'id':_0x118267[_0x79a5('0x48')]['id']}})[_0x79a5('0x2a')](handleEntityNotFound(_0x58d933,null))[_0x79a5('0x2a')](function(_0x1a7b3e){if(_0x1a7b3e){_0x2c3880=_0x1a7b3e;_0x9183c8[_0x79a5('0x36')]=_[_0x79a5('0x38')](db['User']['rawAttributes']);_0x9183c8[_0x79a5('0x37')]=_[_0x79a5('0x38')](_0x118267[_0x79a5('0x37')]);_0x9183c8[_0x79a5('0x3f')]=_[_0x79a5('0x49')](_0x9183c8[_0x79a5('0x36')],_0x9183c8[_0x79a5('0x37')]);_0x41bd39[_0x79a5('0x39')]=_[_0x79a5('0x49')](_0x9183c8[_0x79a5('0x36')],qs[_0x79a5('0x3a')](_0x118267[_0x79a5('0x37')][_0x79a5('0x3a')]));_0x41bd39[_0x79a5('0x39')]=_0x41bd39['attributes'][_0x79a5('0x4a')]?_0x41bd39['attributes']:_0x9183c8[_0x79a5('0x36')];_0x41bd39[_0x79a5('0x5f')]=qs[_0x79a5('0x3d')](_0x118267[_0x79a5('0x37')]['sort']);_0x41bd39[_0x79a5('0x3e')]=qs['filters'](_['pick'](_0x118267[_0x79a5('0x37')],_0x9183c8[_0x79a5('0x3f')]));if(_0x118267[_0x79a5('0x37')][_0x79a5('0x40')]){_0x41bd39['where']=_[_0x79a5('0x41')](_0x41bd39[_0x79a5('0x3e')],{'$or':_[_0x79a5('0x42')](_0x41bd39[_0x79a5('0x39')],function(_0x4807b6){var _0x18ba84={};_0x18ba84[_0x4807b6]={'$like':'%'+_0x118267[_0x79a5('0x37')]['filter']+'%'};return _0x18ba84;})});}_0x41bd39=_[_0x79a5('0x41')]({},_0x41bd39,_0x118267['options']);return _0x2c3880['getUsers'](_0x41bd39);}})['then'](function(_0x32c69a){if(_0x32c69a){_0x4e3fee=_0x32c69a['length'];if(!_0x118267[_0x79a5('0x37')][_0x79a5('0x3b')](_0x79a5('0x3c'))){_0x41bd39[_0x79a5('0x24')]=qs[_0x79a5('0x24')](_0x118267[_0x79a5('0x37')][_0x79a5('0x24')]);_0x41bd39[_0x79a5('0x23')]=qs[_0x79a5('0x23')](_0x118267[_0x79a5('0x37')][_0x79a5('0x23')]);}return _0x2c3880[_0x79a5('0x5d')](_0x41bd39);}})[_0x79a5('0x2a')](function(_0x531905){if(_0x531905){return _0x531905?{'count':_0x4e3fee,'rows':_0x531905}:null;}})[_0x79a5('0x2a')](respondWithResult(_0x58d933,null))['catch'](handleError(_0x58d933,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 22eaa99..d3f6d13 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 _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 +var _0x45d1=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1c205a,_0x5c1f4e){var _0x58d7a0=function(_0x5d1f62){while(--_0x5d1f62){_0x1c205a['push'](_0x1c205a['shift']());}};_0x58d7a0(++_0x5c1f4e);}(_0x45d1,0x1cb));var _0x145d=function(_0x304c47,_0x4e0e20){_0x304c47=_0x304c47-0x0;var _0x2dbd2c=_0x45d1[_0x304c47];return _0x2dbd2c;};'use strict';var EventEmitter=require(_0x145d('0x0'));var SquareProject=require(_0x145d('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x145d('0x2')](0x0);var events={'afterCreate':_0x145d('0x3'),'afterUpdate':'update','afterDestroy':_0x145d('0x4')};function emitEvent(_0x55eb4e){return function(_0x3076c2,_0x327cd3,_0x407d84){SquareProjectEvents[_0x145d('0x5')](_0x55eb4e+':'+_0x3076c2['id'],_0x3076c2);SquareProjectEvents[_0x145d('0x5')](_0x55eb4e,_0x3076c2);_0x407d84(null);};}for(var e in events){if(events[_0x145d('0x6')](e)){var event=events[e];SquareProject[_0x145d('0x7')](e,emitEvent(event));}}module[_0x145d('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 1d8da66..99512e8 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 _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 +var _0x28a2=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareProject.attributes','exports','define','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','lodash','util'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x228a('0x0'));var util=require(_0x228a('0x1'));var logger=require(_0x228a('0x2'))(_0x228a('0x3'));var moment=require(_0x228a('0x4'));var BPromise=require(_0x228a('0x5'));var rp=require(_0x228a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x228a('0x7'));var config=require('../../config/environment');var attributes=require(_0x228a('0x8'));module[_0x228a('0x9')]=function(_0x17727b,_0xf86d1d){return _0x17727b[_0x228a('0xa')]('SquareProject',attributes,{'tableName':_0x228a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x7767ab,_0x105317,_0x20494b){if(_0x7767ab['changed'](_0x228a('0xc'))){_0x7767ab[_0x228a('0xd')]=moment()[_0x228a('0xe')](_0x228a('0xf'));}if(_0x7767ab[_0x228a('0x10')](_0x228a('0x11'))){_0x7767ab[_0x228a('0x12')]=moment()[_0x228a('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x20494b(null,_0x7767ab);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 9f7efcc..3b6bdc1 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 _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 +var _0x265c=['include','map','model','ShowSquareProject','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','socket.io-emitter','register','request','then','info','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareProject,\x20%s,\x20%s','message','result','catch','options','where','attributes'];(function(_0x5d1c41,_0x1cc0e3){var _0x17f9a4=function(_0x1666a3){while(--_0x1666a3){_0x5d1c41['push'](_0x5d1c41['shift']());}};_0x17f9a4(++_0x1cc0e3);}(_0x265c,0x88));var _0xc265=function(_0x128d8e,_0xdf3c7b){_0x128d8e=_0x128d8e-0x0;var _0x5a1306=_0x265c[_0x128d8e];return _0x5a1306;};'use strict';var _=require(_0xc265('0x0'));var util=require(_0xc265('0x1'));var moment=require('moment');var BPromise=require(_0xc265('0x2'));var rs=require(_0xc265('0x3'));var fs=require('fs');var Redis=require(_0xc265('0x4'));var db=require(_0xc265('0x5'))['db'];var utils=require(_0xc265('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc265('0x7'));var jayson=require(_0xc265('0x8'));var client=jayson[_0xc265('0x9')]['http']({'port':0x232a});config[_0xc265('0xa')]=_['defaults'](config[_0xc265('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc265('0xb'))(new Redis(config[_0xc265('0xa')]));require('./squareProject.socket')[_0xc265('0xc')](socket);function respondWithRpcPromise(_0x270a9f,_0x1d0976,_0x54a3b2){return new BPromise(function(_0x51e2e9,_0x39b41b){return client[_0xc265('0xd')](_0x270a9f,_0x54a3b2)[_0xc265('0xe')](function(_0x3b9fb8){logger[_0xc265('0xf')]('SquareProject,\x20%s,\x20%s',_0x1d0976,_0xc265('0x10'));logger[_0xc265('0x11')](_0xc265('0x12'),_0x1d0976,_0xc265('0x10'),JSON[_0xc265('0x13')](_0x3b9fb8));if(_0x3b9fb8['error']){if(_0x3b9fb8[_0xc265('0x14')][_0xc265('0x15')]===0x1f4){logger[_0xc265('0x14')](_0xc265('0x16'),_0x1d0976,_0x3b9fb8[_0xc265('0x14')][_0xc265('0x17')]);return _0x39b41b(_0x3b9fb8['error'][_0xc265('0x17')]);}logger[_0xc265('0x14')](_0xc265('0x16'),_0x1d0976,_0x3b9fb8['error'][_0xc265('0x17')]);return _0x51e2e9(_0x3b9fb8[_0xc265('0x14')]['message']);}else{logger[_0xc265('0xf')](_0xc265('0x16'),_0x1d0976,_0xc265('0x10'));_0x51e2e9(_0x3b9fb8[_0xc265('0x18')][_0xc265('0x17')]);}})[_0xc265('0x19')](function(_0x26b55f){logger['error'](_0xc265('0x16'),_0x1d0976,_0x26b55f);_0x39b41b(_0x26b55f);});});}exports['ShowSquareProject']=function(_0x59f45b){var _0x5d6981=this;return new Promise(function(_0x5f29e0,_0x3a26d8){return db['SquareProject']['find']({'raw':_0x59f45b['options']?_0x59f45b[_0xc265('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x59f45b[_0xc265('0x1a')]?_0x59f45b[_0xc265('0x1a')][_0xc265('0x1b')]||null:null,'attributes':_0x59f45b[_0xc265('0x1a')]?_0x59f45b[_0xc265('0x1a')][_0xc265('0x1c')]||null:null,'include':_0x59f45b[_0xc265('0x1a')]?_0x59f45b[_0xc265('0x1a')][_0xc265('0x1d')]?_[_0xc265('0x1e')](_0x59f45b[_0xc265('0x1a')]['include'],function(_0x343914){return{'model':db[_0x343914[_0xc265('0x1f')]],'as':_0x343914['as'],'attributes':_0x343914[_0xc265('0x1c')],'include':_0x343914[_0xc265('0x1d')]?_[_0xc265('0x1e')](_0x343914[_0xc265('0x1d')],function(_0x478d11){return{'model':db[_0x478d11['model']],'as':_0x478d11['as'],'attributes':_0x478d11['attributes'],'include':_0x478d11[_0xc265('0x1d')]?_[_0xc265('0x1e')](_0x478d11[_0xc265('0x1d')],function(_0x3b5ee8){return{'model':db[_0x3b5ee8[_0xc265('0x1f')]],'as':_0x3b5ee8['as'],'attributes':_0x3b5ee8[_0xc265('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ca064){logger[_0xc265('0xf')]('ShowSquareProject',_0x59f45b);logger[_0xc265('0x11')](_0xc265('0x20'),_0x59f45b,JSON['stringify'](_0x4ca064));_0x5f29e0(_0x4ca064);})[_0xc265('0x19')](function(_0x39e6ad){logger[_0xc265('0x14')](_0xc265('0x20'),_0x39e6ad['message'],_0x59f45b);_0x3a26d8(_0x5d6981[_0xc265('0x14')](0x1f4,_0x39e6ad['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index dc95756..d419be2 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 _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 +var _0x187d=['./squareProject.events','remove','update','emit','removeListener','length','squareProject:'];(function(_0x473826,_0x343007){var _0x11fcbd=function(_0x44a6cf){while(--_0x44a6cf){_0x473826['push'](_0x473826['shift']());}};_0x11fcbd(++_0x343007);}(_0x187d,0x93));var _0xd187=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x187d[_0x4c7fb5];return _0x2e10ac;};'use strict';var SquareProjectEvents=require(_0xd187('0x0'));var events=['save',_0xd187('0x1'),_0xd187('0x2')];function createListener(_0x44d5f6,_0x1cb41f){return function(_0x18498b){_0x1cb41f[_0xd187('0x3')](_0x44d5f6,_0x18498b);};}function removeListener(_0x58622a,_0x28fa0b){return function(){SquareProjectEvents[_0xd187('0x4')](_0x58622a,_0x28fa0b);};}exports['register']=function(_0x1d2533){for(var _0x58ee7=0x0,_0x444a60=events[_0xd187('0x5')];_0x58ee7<_0x444a60;_0x58ee7++){var _0x28ce2f=events[_0x58ee7];var _0x2d6992=createListener(_0xd187('0x6')+_0x28ce2f,_0x1d2533);SquareProjectEvents['on'](_0x28ce2f,_0x2d6992);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index b10493c..5d1b828 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 _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 +var _0x0fb8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','download','post','isAuthenticated','create','put','/:id','update','delete','/:id/delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0fb8,0x10d));var _0x80fb=function(_0x1de9d4,_0x3940c4){_0x1de9d4=_0x1de9d4-0x0;var _0xe52a0b=_0x0fb8[_0x1de9d4];return _0xe52a0b;};'use strict';var multer=require(_0x80fb('0x0'));var util=require(_0x80fb('0x1'));var path=require(_0x80fb('0x2'));var timeout=require(_0x80fb('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x80fb('0x4'));var interaction=require(_0x80fb('0x5'));var config=require(_0x80fb('0x6'));var controller=require(_0x80fb('0x7'));router[_0x80fb('0x8')]('/',auth['isAuthenticated'](),controller[_0x80fb('0x9')]);router[_0x80fb('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x80fb('0xa')]);router[_0x80fb('0xb')]('/',auth[_0x80fb('0xc')](),controller[_0x80fb('0xd')]);router[_0x80fb('0xe')](_0x80fb('0xf'),auth[_0x80fb('0xc')](),controller[_0x80fb('0x10')]);router[_0x80fb('0x11')](_0x80fb('0x12'),auth[_0x80fb('0xc')](),controller[_0x80fb('0x13')]);module[_0x80fb('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index a8cc99f..4df36e7 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 _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 +var _0x8c2e=['STRING','VIRTUAL','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0x414f67,_0x861aed){var _0x338537=function(_0x4696fd){while(--_0x4696fd){_0x414f67['push'](_0x414f67['shift']());}};_0x338537(++_0x861aed);}(_0x8c2e,0x17f));var _0xe8c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c2e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe8c2('0x0'));module[_0xe8c2('0x1')]={'uniqueid':{'type':Sequelize[_0xe8c2('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe8c2('0x2')]},'context':{'type':Sequelize[_0xe8c2('0x2')]},'extension':{'type':Sequelize[_0xe8c2('0x2')]},'priority':{'type':Sequelize[_0xe8c2('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xe8c2('0x2')]},'projectName':{'type':Sequelize[_0xe8c2('0x2')]},'saveName':{'type':Sequelize[_0xe8c2('0x2')]},'filename':{'type':Sequelize[_0xe8c2('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xe8c2('0x3')],'get':function(){var _0x5b8b1c='';var _0x1db8a6=this['getDataValue'](_0xe8c2('0x4'));if(_0x1db8a6){_0x5b8b1c=_0x1db8a6[_0xe8c2('0x5')](_0x1db8a6[_0xe8c2('0x6')]('.'));}return _0x5b8b1c;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 76ca320..79074fa 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 _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 +var _0x3bbd=['offset','limit','reject','save','update','then','destroy','error','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','catch','body','download','../../components/encryptor','uniqueid','savePath','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count'];(function(_0x174d77,_0x420cec){var _0x3f2328=function(_0x5368c1){while(--_0x5368c1){_0x174d77['push'](_0x174d77['shift']());}};_0x3f2328(++_0x420cec);}(_0x3bbd,0x1b2));var _0xd3bb=function(_0x54dc49,_0x39e070){_0x54dc49=_0x54dc49-0x0;var _0x3b18a5=_0x3bbd[_0x54dc49];return _0x3b18a5;};'use strict';var pdf=require(_0xd3bb('0x0'));var emlformat=require(_0xd3bb('0x1'));var rimraf=require(_0xd3bb('0x2'));var zipdir=require(_0xd3bb('0x3'));var jsonpatch=require(_0xd3bb('0x4'));var rp=require(_0xd3bb('0x5'));var moment=require(_0xd3bb('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd3bb('0x7'));var sox=require('sox');var csv=require(_0xd3bb('0x8'));var ejs=require(_0xd3bb('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd3bb('0xa'));var crypto=require(_0xd3bb('0xb'));var jsforce=require(_0xd3bb('0xc'));var deskjs=require(_0xd3bb('0xd'));var toCsv=require(_0xd3bb('0x8'));var querystring=require(_0xd3bb('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd3bb('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd3bb('0x10'));var hardwareService=require(_0xd3bb('0x11'));var logger=require(_0xd3bb('0x12'))('api');var utils=require(_0xd3bb('0x13'));var config=require(_0xd3bb('0x14'));var licenseUtil=require(_0xd3bb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19fa07,_0x194c28){_0x194c28=_0x194c28||0xcc;return function(_0x1753f8){if(_0x1753f8){return _0x19fa07[_0xd3bb('0x16')](_0x194c28);}return _0x19fa07[_0xd3bb('0x17')](_0x194c28)['end']();};}function respondWithResult(_0x1dca8e,_0x18ff16){_0x18ff16=_0x18ff16||0xc8;return function(_0x17639f){if(_0x17639f){return _0x1dca8e[_0xd3bb('0x17')](_0x18ff16)[_0xd3bb('0x18')](_0x17639f);}};}function respondWithFilteredResult(_0x1fb239,_0x588d44){return function(_0x223fc6){if(_0x223fc6){var _0x4a08fc=_0x223fc6[_0xd3bb('0x19')],_0x4b0ddd=_0x588d44[_0xd3bb('0x1a')],_0x5b7c78=_0x588d44['offset']+_0x588d44[_0xd3bb('0x1b')],_0x3da3e8;if(_0x5b7c78>=_0x4a08fc){_0x5b7c78=_0x4a08fc;_0x3da3e8=0xc8;}else{_0x3da3e8=0xce;}_0x1fb239[_0xd3bb('0x17')](_0x3da3e8);return _0x1fb239['set']('Content-Range',_0x4b0ddd+'-'+_0x5b7c78+'/'+_0x4a08fc)['json'](_0x223fc6);}return null;};}function patchUpdates(_0x17951e){return function(_0x40ab11){try{jsonpatch['apply'](_0x40ab11,_0x17951e,!![]);}catch(_0x5381b2){return BPromise[_0xd3bb('0x1c')](_0x5381b2);}return _0x40ab11[_0xd3bb('0x1d')]();};}function saveUpdates(_0x2e7701,_0x494b7c){return function(_0x1edcfa){if(_0x1edcfa){return _0x1edcfa[_0xd3bb('0x1e')](_0x2e7701)[_0xd3bb('0x1f')](function(_0x33f22b){return _0x33f22b;});}return null;};}function removeEntity(_0x49ad60,_0x274cc8){return function(_0x15557b){if(_0x15557b){return _0x15557b[_0xd3bb('0x20')]()[_0xd3bb('0x1f')](function(){_0x49ad60[_0xd3bb('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf49f2,_0x220354){return function(_0x299f90){if(!_0x299f90){_0xf49f2['sendStatus'](0x194);}return _0x299f90;};}function handleError(_0x26880e,_0x1717bd){_0x1717bd=_0x1717bd||0x1f4;return function(_0x5c1f53){logger[_0xd3bb('0x21')](_0x5c1f53['stack']);if(_0x5c1f53[_0xd3bb('0x22')]){delete _0x5c1f53['name'];}_0x26880e[_0xd3bb('0x17')](_0x1717bd)[_0xd3bb('0x23')](_0x5c1f53);};}exports[_0xd3bb('0x24')]=function(_0x11f4d0,_0x32ae40){var _0x12def0={},_0x30e92b={},_0x223f47={'count':0x0,'rows':[]};var _0x43ad61=_[_0xd3bb('0x25')](db[_0xd3bb('0x26')][_0xd3bb('0x27')],function(_0x1cabe6){return{'name':_0x1cabe6[_0xd3bb('0x28')],'type':_0x1cabe6[_0xd3bb('0x29')][_0xd3bb('0x2a')]};});_0x30e92b[_0xd3bb('0x2b')]=_['map'](_0x43ad61,_0xd3bb('0x22'));_0x30e92b[_0xd3bb('0x2c')]=_[_0xd3bb('0x2d')](_0x11f4d0[_0xd3bb('0x2c')]);_0x30e92b['filters']=_[_0xd3bb('0x2e')](_0x30e92b[_0xd3bb('0x2b')],_0x30e92b[_0xd3bb('0x2c')]);_0x12def0[_0xd3bb('0x2f')]=_['intersection'](_0x30e92b[_0xd3bb('0x2b')],qs['fields'](_0x11f4d0['query'][_0xd3bb('0x30')]));_0x12def0[_0xd3bb('0x2f')]=_0x12def0[_0xd3bb('0x2f')][_0xd3bb('0x31')]?_0x12def0[_0xd3bb('0x2f')]:_0x30e92b[_0xd3bb('0x2b')];if(!_0x11f4d0[_0xd3bb('0x2c')][_0xd3bb('0x32')](_0xd3bb('0x33'))){_0x12def0['limit']=qs[_0xd3bb('0x1b')](_0x11f4d0[_0xd3bb('0x2c')][_0xd3bb('0x1b')]);_0x12def0[_0xd3bb('0x1a')]=qs[_0xd3bb('0x1a')](_0x11f4d0['query'][_0xd3bb('0x1a')]);}_0x12def0[_0xd3bb('0x34')]=qs[_0xd3bb('0x35')](_0x11f4d0[_0xd3bb('0x2c')][_0xd3bb('0x35')]);_0x12def0[_0xd3bb('0x36')]=qs[_0xd3bb('0x37')](_[_0xd3bb('0x38')](_0x11f4d0[_0xd3bb('0x2c')],_0x30e92b['filters']),_0x43ad61);if(_0x11f4d0['query'][_0xd3bb('0x39')]){_0x12def0[_0xd3bb('0x36')]=_[_0xd3bb('0x3a')](_0x12def0[_0xd3bb('0x36')],{'$or':_[_0xd3bb('0x25')](_0x43ad61,function(_0x509478){if(_0x509478[_0xd3bb('0x29')]!==_0xd3bb('0x3b')){var _0x30336c={};_0x30336c[_0x509478[_0xd3bb('0x22')]]={'$like':'%'+_0x11f4d0[_0xd3bb('0x2c')][_0xd3bb('0x39')]+'%'};return _0x30336c;}})});}_0x12def0=_[_0xd3bb('0x3a')]({},_0x12def0,_0x11f4d0[_0xd3bb('0x3c')]);var _0x593b51={'where':_0x12def0['where']};return db[_0xd3bb('0x26')][_0xd3bb('0x19')](_0x593b51)[_0xd3bb('0x1f')](function(_0x223b7f){_0x223f47[_0xd3bb('0x19')]=_0x223b7f;if(_0x11f4d0['query'][_0xd3bb('0x3d')]){_0x12def0[_0xd3bb('0x3e')]=[{'all':!![]}];}return db['SquareRecording'][_0xd3bb('0x3f')](_0x12def0);})['then'](function(_0x391d08){_0x223f47[_0xd3bb('0x40')]=_0x391d08;return _0x223f47;})[_0xd3bb('0x1f')](respondWithFilteredResult(_0x32ae40,_0x12def0))['catch'](handleError(_0x32ae40,null));};exports[_0xd3bb('0x41')]=function(_0x2b2480,_0x373229){var _0x1d805f={'raw':!![],'where':{'id':_0x2b2480[_0xd3bb('0x42')]['id']}},_0x3b5977={};_0x3b5977[_0xd3bb('0x2b')]=_[_0xd3bb('0x2d')](db['SquareRecording']['rawAttributes']);_0x3b5977[_0xd3bb('0x2c')]=_[_0xd3bb('0x2d')](_0x2b2480[_0xd3bb('0x2c')]);_0x3b5977[_0xd3bb('0x37')]=_[_0xd3bb('0x2e')](_0x3b5977[_0xd3bb('0x2b')],_0x3b5977['query']);_0x1d805f[_0xd3bb('0x2f')]=_[_0xd3bb('0x2e')](_0x3b5977[_0xd3bb('0x2b')],qs[_0xd3bb('0x30')](_0x2b2480[_0xd3bb('0x2c')]['fields']));_0x1d805f[_0xd3bb('0x2f')]=_0x1d805f[_0xd3bb('0x2f')][_0xd3bb('0x31')]?_0x1d805f[_0xd3bb('0x2f')]:_0x3b5977['model'];if(_0x2b2480[_0xd3bb('0x2c')][_0xd3bb('0x3d')]){_0x1d805f[_0xd3bb('0x3e')]=[{'all':!![]}];}_0x1d805f=_[_0xd3bb('0x3a')]({},_0x1d805f,_0x2b2480[_0xd3bb('0x3c')]);return db[_0xd3bb('0x26')][_0xd3bb('0x43')](_0x1d805f)['then'](handleEntityNotFound(_0x373229,null))[_0xd3bb('0x1f')](respondWithResult(_0x373229,null))['catch'](handleError(_0x373229,null));};exports['create']=function(_0x153c9c,_0x225449){return db[_0xd3bb('0x26')][_0xd3bb('0x44')](_0x153c9c['body'],{})[_0xd3bb('0x1f')](respondWithResult(_0x225449,0xc9))[_0xd3bb('0x45')](handleError(_0x225449,null));};exports[_0xd3bb('0x1e')]=function(_0x1e27fd,_0x587744){if(_0x1e27fd[_0xd3bb('0x46')]['id']){delete _0x1e27fd[_0xd3bb('0x46')]['id'];}return db[_0xd3bb('0x26')][_0xd3bb('0x43')]({'where':{'id':_0x1e27fd[_0xd3bb('0x42')]['id']}})['then'](handleEntityNotFound(_0x587744,null))[_0xd3bb('0x1f')](saveUpdates(_0x1e27fd[_0xd3bb('0x46')],null))['then'](respondWithResult(_0x587744,null))['catch'](handleError(_0x587744,null));};exports[_0xd3bb('0x47')]=function(_0x2ffdf3,_0x3bd987,_0x2b4621){var _0xe20efc=require(_0xd3bb('0x48'));var _0x2fec92=![];var _0x51fd68={};if(_0x2ffdf3[_0xd3bb('0x2c')][_0xd3bb('0x29')]&&_0x2ffdf3['query'][_0xd3bb('0x29')]==='uniqueid'){_0x51fd68[_0xd3bb('0x49')]=_0x2ffdf3['params']['id'];}else{_0x51fd68['id']=_0x2ffdf3[_0xd3bb('0x42')]['id'];}return db[_0xd3bb('0x26')][_0xd3bb('0x43')]({'where':_0x51fd68,'attributes':['id',_0xd3bb('0x4a'),'filename'],'raw':!![]})[_0xd3bb('0x1f')](handleEntityNotFound(_0x3bd987,null))['then'](function(_0x254b40){if(_0x254b40){var _0x1965d8=_0x254b40[_0xd3bb('0x4a')];var _0x37f5e3=util['format']('%s.cypher',_0x1965d8);if(fs['existsSync'](_0x37f5e3)){_0x2fec92=!![];return _0xe20efc['decryptFile'](_0x37f5e3,_0x1965d8,config[_0xd3bb('0x4b')][_0xd3bb('0x4c')])[_0xd3bb('0x1f')](function(){return _0x254b40;});}return _0x254b40;}})[_0xd3bb('0x1f')](function(_0x7495c3){if(_0x7495c3){var _0x5d16a5=_0x7495c3[_0xd3bb('0x4a')];if(!fs['existsSync'](_0x5d16a5)){throw new db[(_0xd3bb('0x4d'))][(_0xd3bb('0x4e'))](_0xd3bb('0x4f'));}if(_0x7495c3[_0xd3bb('0x50')]){return _0x3bd987['download'](_0x5d16a5,_0x7495c3['filename']+path[_0xd3bb('0x51')](_0x5d16a5),function(){if(_0x2fec92){fs['unlink'](_0x5d16a5);}});}else{return _0x3bd987[_0xd3bb('0x47')](_0x5d16a5,function(_0x5215da){if(_0x2fec92){fs[_0xd3bb('0x52')](_0x5d16a5);}});}}})[_0xd3bb('0x45')](function(_0x5d382e){if(_0x5d382e[_0xd3bb('0x53')]==='SquareRecording\x20not\x20found'){_0x3bd987[_0xd3bb('0x17')](0x194)[_0xd3bb('0x23')](_0xd3bb('0x54'));}else{return handleError(_0x3bd987,null);}});};exports[_0xd3bb('0x20')]=function(_0x3d4cf5,_0x33c091){return db['SquareRecording'][_0xd3bb('0x43')]({'where':{'id':_0x3d4cf5[_0xd3bb('0x42')]['id']}})[_0xd3bb('0x1f')](function(_0x578187){if(!_0x578187)throw new ReferenceError('Entity\x20not\x20found');return _0x578187;})[_0xd3bb('0x1f')](function(_0x534020){var _0x29f9e7=_0x534020[_0xd3bb('0x4a')];logger[_0xd3bb('0x55')](_0xd3bb('0x56'),_0x29f9e7);if(!_[_0xd3bb('0x57')](_0x534020[_0xd3bb('0x4a')])&&fs['existsSync'](_0x29f9e7)){logger['info'](_0xd3bb('0x58')+_0x29f9e7+_0xd3bb('0x59'));fs['unlinkSync'](_0x29f9e7);}_0x29f9e7=_0x29f9e7+_0xd3bb('0x5a');if(!_['isNil'](_0x534020['savePath'])&&fs['existsSync'](_0x29f9e7)){logger[_0xd3bb('0x55')](_0xd3bb('0x58')+_0x29f9e7+_0xd3bb('0x59'));fs[_0xd3bb('0x5b')](_0x29f9e7);}return _0x534020;})[_0xd3bb('0x1f')](function(_0x4aebc3){if(!_0x4aebc3)throw new InternalError();return _0x4aebc3[_0xd3bb('0x20')]();})[_0xd3bb('0x1f')](function(){_0x33c091['status'](0xcc)['end']();})[_0xd3bb('0x45')](handleError(_0x33c091,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 800ac76..18ad1ed 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 _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 +var _0x65c9=['bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings','lodash','util','api','moment'];(function(_0x153b36,_0x265eda){var _0x38b194=function(_0x2a4797){while(--_0x2a4797){_0x153b36['push'](_0x153b36['shift']());}};_0x38b194(++_0x265eda);}(_0x65c9,0x182));var _0x965c=function(_0x4a53a0,_0x5c92f4){_0x4a53a0=_0x4a53a0-0x0;var _0x1dbb57=_0x65c9[_0x4a53a0];return _0x1dbb57;};'use strict';var _=require(_0x965c('0x0'));var util=require(_0x965c('0x1'));var logger=require('../../config/logger')(_0x965c('0x2'));var moment=require(_0x965c('0x3'));var BPromise=require(_0x965c('0x4'));var rp=require(_0x965c('0x5'));var fs=require('fs');var path=require(_0x965c('0x6'));var rimraf=require(_0x965c('0x7'));var config=require(_0x965c('0x8'));var attributes=require(_0x965c('0x9'));module[_0x965c('0xa')]=function(_0xbda9ee,_0xb9c834){return _0xbda9ee[_0x965c('0xb')]('SquareRecording',attributes,{'tableName':_0x965c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 9761f64..f687f8e 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 _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 +var _0xe5ec=['client','http','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','SquareRecording,\x20%s,\x20%s','CreateSquareRecording','SquareRecording','create','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x373daf,_0x18b9a8){var _0x1fa416=function(_0x1c40b8){while(--_0x1c40b8){_0x373daf['push'](_0x373daf['shift']());}};_0x1fa416(++_0x18b9a8);}(_0xe5ec,0x85));var _0xce5e=function(_0x1d5972,_0x161cd5){_0x1d5972=_0x1d5972-0x0;var _0x370829=_0xe5ec[_0x1d5972];return _0x370829;};'use strict';var _=require(_0xce5e('0x0'));var util=require(_0xce5e('0x1'));var moment=require(_0xce5e('0x2'));var BPromise=require(_0xce5e('0x3'));var rs=require(_0xce5e('0x4'));var fs=require('fs');var Redis=require(_0xce5e('0x5'));var db=require(_0xce5e('0x6'))['db'];var utils=require(_0xce5e('0x7'));var logger=require(_0xce5e('0x8'))(_0xce5e('0x9'));var config=require(_0xce5e('0xa'));var jayson=require(_0xce5e('0xb'));var client=jayson[_0xce5e('0xc')][_0xce5e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x22c802,_0x83fd71,_0xb8aa44){return new BPromise(function(_0x1b88ae,_0x5bc144){return client['request'](_0x22c802,_0xb8aa44)[_0xce5e('0xe')](function(_0x5990c3){logger[_0xce5e('0xf')]('SquareRecording,\x20%s,\x20%s',_0x83fd71,_0xce5e('0x10'));logger[_0xce5e('0x11')](_0xce5e('0x12'),_0x83fd71,'request\x20sent',JSON[_0xce5e('0x13')](_0x5990c3));if(_0x5990c3[_0xce5e('0x14')]){if(_0x5990c3[_0xce5e('0x14')]['code']===0x1f4){logger[_0xce5e('0x14')]('SquareRecording,\x20%s,\x20%s',_0x83fd71,_0x5990c3[_0xce5e('0x14')][_0xce5e('0x15')]);return _0x5bc144(_0x5990c3[_0xce5e('0x14')][_0xce5e('0x15')]);}logger[_0xce5e('0x14')](_0xce5e('0x16'),_0x83fd71,_0x5990c3[_0xce5e('0x14')][_0xce5e('0x15')]);return _0x1b88ae(_0x5990c3['error'][_0xce5e('0x15')]);}else{logger[_0xce5e('0xf')](_0xce5e('0x16'),_0x83fd71,_0xce5e('0x10'));_0x1b88ae(_0x5990c3['result']['message']);}})['catch'](function(_0x229287){logger[_0xce5e('0x14')](_0xce5e('0x16'),_0x83fd71,_0x229287);_0x5bc144(_0x229287);});});}exports[_0xce5e('0x17')]=function(_0x4edd47){var _0x16478f=this;return new Promise(function(_0x4f4480,_0xe141b){return db[_0xce5e('0x18')][_0xce5e('0x19')](_0x4edd47['body'],{'raw':_0x4edd47['options']?_0x4edd47[_0xce5e('0x1a')][_0xce5e('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3838ed){logger['info']('CreateSquareRecording',_0x4edd47);logger[_0xce5e('0x11')](_0xce5e('0x17'),_0x4edd47,JSON[_0xce5e('0x13')](_0x3838ed));_0x4f4480(_0x3838ed);})[_0xce5e('0x1c')](function(_0x5d99cd){logger[_0xce5e('0x14')](_0xce5e('0x17'),_0x5d99cd[_0xce5e('0x15')],_0x4edd47);_0xe141b(_0x16478f[_0xce5e('0x14')](0x1f4,_0x5d99cd['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 1fdd2a3..1ad2852 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 _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 +var _0xe020=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','isAuthenticated','get','/describe','describe','/:id','post','create','put','update','exports','multer','util','connect-timeout','express'];(function(_0x419c37,_0x547f85){var _0x42b6f5=function(_0x4eedd7){while(--_0x4eedd7){_0x419c37['push'](_0x419c37['shift']());}};_0x42b6f5(++_0x547f85);}(_0xe020,0x119));var _0x0e02=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xe020[_0x5f309e];return _0x487b5e;};'use strict';var multer=require(_0x0e02('0x0'));var util=require(_0x0e02('0x1'));var path=require('path');var timeout=require(_0x0e02('0x2'));var express=require(_0x0e02('0x3'));var router=express[_0x0e02('0x4')]();var auth=require(_0x0e02('0x5'));var interaction=require(_0x0e02('0x6'));var config=require(_0x0e02('0x7'));var controller=require(_0x0e02('0x8'));router['get']('/',auth[_0x0e02('0x9')](),controller['index']);router[_0x0e02('0xa')](_0x0e02('0xb'),auth[_0x0e02('0x9')](),controller[_0x0e02('0xc')]);router['get'](_0x0e02('0xd'),auth[_0x0e02('0x9')](),controller['show']);router[_0x0e02('0xe')]('/',auth[_0x0e02('0x9')](),controller[_0x0e02('0xf')]);router[_0x0e02('0x10')]('/:id',auth[_0x0e02('0x9')](),controller[_0x0e02('0x11')]);router['delete'](_0x0e02('0xd'),auth[_0x0e02('0x9')](),controller['destroy']);module[_0x0e02('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 c794a62..b6403c2 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 _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 +var _0xc7e2=['STRING','DATE','exports'];(function(_0x270d12,_0x2d189f){var _0x510b61=function(_0x48685b){while(--_0x48685b){_0x270d12['push'](_0x270d12['shift']());}};_0x510b61(++_0x2d189f);}(_0xc7e2,0x143));var _0x2c7e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7e2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x2c7e('0x0')]={'network':{'type':Sequelize[_0x2c7e('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x2c7e('0x1')]},'channel':{'type':Sequelize[_0x2c7e('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2c7e('0x1')]},'uniqueid':{'type':Sequelize[_0x2c7e('0x1')]},'version':{'type':Sequelize[_0x2c7e('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2c7e('0x1')]},'callingpres':{'type':Sequelize[_0x2c7e('0x1')]},'callingani2':{'type':Sequelize[_0x2c7e('0x1')]},'callington':{'type':Sequelize[_0x2c7e('0x1')]},'callingtns':{'type':Sequelize[_0x2c7e('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x2c7e('0x1')]},'context':{'type':Sequelize[_0x2c7e('0x1')]},'extension':{'type':Sequelize[_0x2c7e('0x1')]},'priority':{'type':Sequelize[_0x2c7e('0x1')]},'enhanced':{'type':Sequelize[_0x2c7e('0x1')]},'accountcode':{'type':Sequelize[_0x2c7e('0x1')]},'threadid':{'type':Sequelize[_0x2c7e('0x1')]},'project_name':{'type':Sequelize[_0x2c7e('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x2c7e('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 3fd46e3..83b3b1a 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 _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 +var _0x9e8a=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','limit','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','SquareReport','includeAll','include','rows','catch','params','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x337ef8,_0x3971ab){var _0x585b75=function(_0x3827a8){while(--_0x3827a8){_0x337ef8['push'](_0x337ef8['shift']());}};_0x585b75(++_0x3971ab);}(_0x9e8a,0x112));var _0xa9e8=function(_0x3a5a8d,_0x22dac9){_0x3a5a8d=_0x3a5a8d-0x0;var _0x1b94b7=_0x9e8a[_0x3a5a8d];return _0x1b94b7;};'use strict';var pdf=require(_0xa9e8('0x0'));var emlformat=require(_0xa9e8('0x1'));var rimraf=require(_0xa9e8('0x2'));var zipdir=require(_0xa9e8('0x3'));var jsonpatch=require(_0xa9e8('0x4'));var rp=require(_0xa9e8('0x5'));var moment=require(_0xa9e8('0x6'));var BPromise=require(_0xa9e8('0x7'));var Mustache=require(_0xa9e8('0x8'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa9e8('0x9'));var fs=require('fs');var _=require(_0xa9e8('0xa'));var squel=require(_0xa9e8('0xb'));var crypto=require(_0xa9e8('0xc'));var jsforce=require(_0xa9e8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa9e8('0xe'));var querystring=require(_0xa9e8('0xf'));var Papa=require(_0xa9e8('0x10'));var Redis=require(_0xa9e8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa9e8('0x12'));var as=require(_0xa9e8('0x13'));var hardwareService=require(_0xa9e8('0x14'));var logger=require(_0xa9e8('0x15'))('api');var utils=require(_0xa9e8('0x16'));var config=require(_0xa9e8('0x17'));var licenseUtil=require(_0xa9e8('0x18'));var db=require(_0xa9e8('0x19'))['db'];function respondWithStatusCode(_0x42cee1,_0x328918){_0x328918=_0x328918||0xcc;return function(_0xa982d){if(_0xa982d){return _0x42cee1[_0xa9e8('0x1a')](_0x328918);}return _0x42cee1['status'](_0x328918)[_0xa9e8('0x1b')]();};}function respondWithResult(_0x5e2cbf,_0x514de0){_0x514de0=_0x514de0||0xc8;return function(_0x56ddfb){if(_0x56ddfb){return _0x5e2cbf['status'](_0x514de0)['json'](_0x56ddfb);}};}function respondWithFilteredResult(_0x391969,_0x62ee19){return function(_0x185068){if(_0x185068){var _0x403645=_0x185068[_0xa9e8('0x1c')],_0x1c3c3f=_0x62ee19['offset'],_0x2dfef7=_0x62ee19['offset']+_0x62ee19['limit'],_0x541831;if(_0x2dfef7>=_0x403645){_0x2dfef7=_0x403645;_0x541831=0xc8;}else{_0x541831=0xce;}_0x391969[_0xa9e8('0x1d')](_0x541831);return _0x391969[_0xa9e8('0x1e')](_0xa9e8('0x1f'),_0x1c3c3f+'-'+_0x2dfef7+'/'+_0x403645)['json'](_0x185068);}return null;};}function patchUpdates(_0xc5bde9){return function(_0x29b91b){try{jsonpatch[_0xa9e8('0x20')](_0x29b91b,_0xc5bde9,!![]);}catch(_0x322287){return BPromise[_0xa9e8('0x21')](_0x322287);}return _0x29b91b[_0xa9e8('0x22')]();};}function saveUpdates(_0x266d07,_0x25a5d5){return function(_0x1ee38b){if(_0x1ee38b){return _0x1ee38b[_0xa9e8('0x23')](_0x266d07)[_0xa9e8('0x24')](function(_0x4f3964){return _0x4f3964;});}return null;};}function removeEntity(_0x51ee03,_0x40b9ea){return function(_0x6b6fab){if(_0x6b6fab){return _0x6b6fab[_0xa9e8('0x25')]()[_0xa9e8('0x24')](function(){_0x51ee03[_0xa9e8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x74fe20,_0x561a40){return function(_0x1f2acd){if(!_0x1f2acd){_0x74fe20[_0xa9e8('0x1a')](0x194);}return _0x1f2acd;};}function handleError(_0x1739f7,_0x2950cd){_0x2950cd=_0x2950cd||0x1f4;return function(_0xc015c5){logger[_0xa9e8('0x26')](_0xc015c5['stack']);if(_0xc015c5[_0xa9e8('0x27')]){delete _0xc015c5['name'];}_0x1739f7[_0xa9e8('0x1d')](_0x2950cd)[_0xa9e8('0x28')](_0xc015c5);};}exports['index']=function(_0x23b33a,_0x55d0ec){var _0x3a206f={},_0x240029={},_0x76ea32={'count':0x0,'rows':[]};var _0x5c40e6=_[_0xa9e8('0x29')](db['SquareReport'][_0xa9e8('0x2a')],function(_0x3e6c63){return{'name':_0x3e6c63[_0xa9e8('0x2b')],'type':_0x3e6c63[_0xa9e8('0x2c')]['key']};});_0x240029[_0xa9e8('0x2d')]=_[_0xa9e8('0x29')](_0x5c40e6,_0xa9e8('0x27'));_0x240029['query']=_[_0xa9e8('0x2e')](_0x23b33a['query']);_0x240029[_0xa9e8('0x2f')]=_[_0xa9e8('0x30')](_0x240029[_0xa9e8('0x2d')],_0x240029[_0xa9e8('0x31')]);_0x3a206f[_0xa9e8('0x32')]=_[_0xa9e8('0x30')](_0x240029[_0xa9e8('0x2d')],qs[_0xa9e8('0x33')](_0x23b33a[_0xa9e8('0x31')][_0xa9e8('0x33')]));_0x3a206f[_0xa9e8('0x32')]=_0x3a206f[_0xa9e8('0x32')][_0xa9e8('0x34')]?_0x3a206f['attributes']:_0x240029[_0xa9e8('0x2d')];if(!_0x23b33a[_0xa9e8('0x31')][_0xa9e8('0x35')]('nolimit')){_0x3a206f['limit']=qs[_0xa9e8('0x36')](_0x23b33a[_0xa9e8('0x31')][_0xa9e8('0x36')]);_0x3a206f[_0xa9e8('0x37')]=qs[_0xa9e8('0x37')](_0x23b33a[_0xa9e8('0x31')][_0xa9e8('0x37')]);}_0x3a206f[_0xa9e8('0x38')]=qs[_0xa9e8('0x39')](_0x23b33a[_0xa9e8('0x31')][_0xa9e8('0x39')]);_0x3a206f[_0xa9e8('0x3a')]=qs[_0xa9e8('0x2f')](_[_0xa9e8('0x3b')](_0x23b33a[_0xa9e8('0x31')],_0x240029[_0xa9e8('0x2f')]),_0x5c40e6);if(_0x23b33a[_0xa9e8('0x31')][_0xa9e8('0x3c')]){_0x3a206f[_0xa9e8('0x3a')]=_['merge'](_0x3a206f['where'],{'$or':_[_0xa9e8('0x29')](_0x5c40e6,function(_0x4b64b7){if(_0x4b64b7[_0xa9e8('0x2c')]!==_0xa9e8('0x3d')){var _0x1d2dc4={};_0x1d2dc4[_0x4b64b7[_0xa9e8('0x27')]]={'$like':'%'+_0x23b33a[_0xa9e8('0x31')]['filter']+'%'};return _0x1d2dc4;}})});}_0x3a206f=_[_0xa9e8('0x3e')]({},_0x3a206f,_0x23b33a[_0xa9e8('0x3f')]);var _0x2c03ba={'where':_0x3a206f[_0xa9e8('0x3a')]};return db[_0xa9e8('0x40')][_0xa9e8('0x1c')](_0x2c03ba)[_0xa9e8('0x24')](function(_0xc8be58){_0x76ea32[_0xa9e8('0x1c')]=_0xc8be58;if(_0x23b33a[_0xa9e8('0x31')][_0xa9e8('0x41')]){_0x3a206f[_0xa9e8('0x42')]=[{'all':!![]}];}return db[_0xa9e8('0x40')]['findAll'](_0x3a206f);})[_0xa9e8('0x24')](function(_0x38c83d){_0x76ea32[_0xa9e8('0x43')]=_0x38c83d;return _0x76ea32;})[_0xa9e8('0x24')](respondWithFilteredResult(_0x55d0ec,_0x3a206f))[_0xa9e8('0x44')](handleError(_0x55d0ec,null));};exports['show']=function(_0x544a11,_0x4c08e4){var _0x3cf18a={'raw':!![],'where':{'id':_0x544a11[_0xa9e8('0x45')]['id']}},_0x149327={};_0x149327[_0xa9e8('0x2d')]=_['keys'](db[_0xa9e8('0x40')][_0xa9e8('0x2a')]);_0x149327[_0xa9e8('0x31')]=_[_0xa9e8('0x2e')](_0x544a11[_0xa9e8('0x31')]);_0x149327[_0xa9e8('0x2f')]=_[_0xa9e8('0x30')](_0x149327[_0xa9e8('0x2d')],_0x149327[_0xa9e8('0x31')]);_0x3cf18a['attributes']=_['intersection'](_0x149327[_0xa9e8('0x2d')],qs['fields'](_0x544a11['query'][_0xa9e8('0x33')]));_0x3cf18a['attributes']=_0x3cf18a[_0xa9e8('0x32')][_0xa9e8('0x34')]?_0x3cf18a[_0xa9e8('0x32')]:_0x149327['model'];if(_0x544a11[_0xa9e8('0x31')][_0xa9e8('0x41')]){_0x3cf18a[_0xa9e8('0x42')]=[{'all':!![]}];}_0x3cf18a=_['merge']({},_0x3cf18a,_0x544a11[_0xa9e8('0x3f')]);return db[_0xa9e8('0x40')]['find'](_0x3cf18a)[_0xa9e8('0x24')](handleEntityNotFound(_0x4c08e4,null))['then'](respondWithResult(_0x4c08e4,null))['catch'](handleError(_0x4c08e4,null));};exports[_0xa9e8('0x46')]=function(_0x4299ab,_0x26f10e){return db[_0xa9e8('0x40')][_0xa9e8('0x46')](_0x4299ab[_0xa9e8('0x47')],{})['then'](respondWithResult(_0x26f10e,0xc9))[_0xa9e8('0x44')](handleError(_0x26f10e,null));};exports[_0xa9e8('0x23')]=function(_0x1890f1,_0x38d2f1){if(_0x1890f1[_0xa9e8('0x47')]['id']){delete _0x1890f1[_0xa9e8('0x47')]['id'];}return db[_0xa9e8('0x40')][_0xa9e8('0x48')]({'where':{'id':_0x1890f1[_0xa9e8('0x45')]['id']}})[_0xa9e8('0x24')](handleEntityNotFound(_0x38d2f1,null))[_0xa9e8('0x24')](saveUpdates(_0x1890f1[_0xa9e8('0x47')],null))[_0xa9e8('0x24')](respondWithResult(_0x38d2f1,null))[_0xa9e8('0x44')](handleError(_0x38d2f1,null));};exports[_0xa9e8('0x25')]=function(_0x2299f8,_0x2457ee){return db[_0xa9e8('0x40')][_0xa9e8('0x48')]({'where':{'id':_0x2299f8[_0xa9e8('0x45')]['id']}})['then'](handleEntityNotFound(_0x2457ee,null))[_0xa9e8('0x24')](removeEntity(_0x2457ee,null))[_0xa9e8('0x44')](handleError(_0x2457ee,null));};exports[_0xa9e8('0x49')]=function(_0x2526cc,_0x541c09){return db[_0xa9e8('0x40')][_0xa9e8('0x49')]()[_0xa9e8('0x24')](respondWithResult(_0x541c09,null))[_0xa9e8('0x44')](handleError(_0x541c09,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index b4af41e..78559b8 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 _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 +var _0x1907=['uid_pname','project_name','leaveAt','util','../../config/logger','api','moment','request-promise','path','rimraf','./squareReport.attributes','exports','define','report_square'];(function(_0x18af13,_0x1a0693){var _0x37a567=function(_0x2e42e3){while(--_0x2e42e3){_0x18af13['push'](_0x18af13['shift']());}};_0x37a567(++_0x1a0693);}(_0x1907,0x1df));var _0x7190=function(_0x107e40,_0x653f6f){_0x107e40=_0x107e40-0x0;var _0x346736=_0x1907[_0x107e40];return _0x346736;};'use strict';var _=require('lodash');var util=require(_0x7190('0x0'));var logger=require(_0x7190('0x1'))(_0x7190('0x2'));var moment=require(_0x7190('0x3'));var BPromise=require('bluebird');var rp=require(_0x7190('0x4'));var fs=require('fs');var path=require(_0x7190('0x5'));var rimraf=require(_0x7190('0x6'));var config=require('../../config/environment');var attributes=require(_0x7190('0x7'));module[_0x7190('0x8')]=function(_0x26270a,_0x5c464d){return _0x26270a[_0x7190('0x9')]('SquareReport',attributes,{'tableName':_0x7190('0xa'),'paranoid':![],'indexes':[{'name':_0x7190('0xb'),'fields':['uniqueid',_0x7190('0xc')]},{'name':_0x7190('0xd'),'fields':[_0x7190('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 03ca4f5..5fd0de9 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 _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 +var _0xd6d6=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','body','options','raw','then','CreateSquareReport','UpdateSquareReport','SquareReport','update','where','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x2651f8,_0x2a46bb){_0x2651f8=_0x2651f8-0x0;var _0x5ec767=_0xd6d6[_0x2651f8];return _0x5ec767;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var BPromise=require(_0x6d6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6d('0x4'));var db=require(_0x6d6d('0x5'))['db'];var utils=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var config=require(_0x6d6d('0x9'));var jayson=require(_0x6d6d('0xa'));var client=jayson['client'][_0x6d6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bf731,_0x44f83d,_0x18f824){return new BPromise(function(_0xd49f57,_0x408f88){return client[_0x6d6d('0xc')](_0x1bf731,_0x18f824)['then'](function(_0x51dd38){logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,_0x6d6d('0xf'));logger[_0x6d6d('0x10')](_0x6d6d('0x11'),_0x44f83d,'request\x20sent',JSON[_0x6d6d('0x12')](_0x51dd38));if(_0x51dd38[_0x6d6d('0x13')]){if(_0x51dd38['error']['code']===0x1f4){logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);return _0x408f88(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38['error'][_0x6d6d('0x14')]);return _0xd49f57(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}else{logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,'request\x20sent');_0xd49f57(_0x51dd38[_0x6d6d('0x15')]['message']);}})[_0x6d6d('0x16')](function(_0x2cbc86){logger[_0x6d6d('0x13')]('SquareReport,\x20%s,\x20%s',_0x44f83d,_0x2cbc86);_0x408f88(_0x2cbc86);});});}exports['CreateSquareReport']=function(_0x9e1e18){var _0x1a75d8=this;return new Promise(function(_0x2b59d4,_0x2c5314){return db['SquareReport']['create'](_0x9e1e18[_0x6d6d('0x17')],{'raw':_0x9e1e18['options']?_0x9e1e18[_0x6d6d('0x18')][_0x6d6d('0x19')]===undefined?!![]:![]:!![]})[_0x6d6d('0x1a')](function(_0x450352){logger[_0x6d6d('0xd')](_0x6d6d('0x1b'),_0x9e1e18);logger[_0x6d6d('0x10')](_0x6d6d('0x1b'),_0x9e1e18,JSON[_0x6d6d('0x12')](_0x450352));_0x2b59d4(_0x450352);})[_0x6d6d('0x16')](function(_0x24b10d){logger[_0x6d6d('0x13')](_0x6d6d('0x1b'),_0x24b10d[_0x6d6d('0x14')],_0x9e1e18);_0x2c5314(_0x1a75d8[_0x6d6d('0x13')](0x1f4,_0x24b10d[_0x6d6d('0x14')]));});});};exports[_0x6d6d('0x1c')]=function(_0x583b10){var _0x3b73e5=this;return new Promise(function(_0x2dcb9c,_0x99f7d6){return db[_0x6d6d('0x1d')][_0x6d6d('0x1e')](_0x583b10[_0x6d6d('0x17')],{'raw':_0x583b10['options']?_0x583b10[_0x6d6d('0x18')][_0x6d6d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x583b10[_0x6d6d('0x18')]?_0x583b10[_0x6d6d('0x18')][_0x6d6d('0x1f')]||null:null,'attributes':_0x583b10[_0x6d6d('0x18')]?_0x583b10[_0x6d6d('0x18')]['attributes']||null:null,'limit':_0x583b10[_0x6d6d('0x18')]?_0x583b10[_0x6d6d('0x18')]['limit']||null:null})['then'](function(_0x3edcce){logger[_0x6d6d('0xd')](_0x6d6d('0x1c'),_0x583b10);logger['debug'](_0x6d6d('0x1c'),_0x583b10,JSON[_0x6d6d('0x12')](_0x3edcce));_0x2dcb9c(_0x3edcce);})[_0x6d6d('0x16')](function(_0x1c8340){logger[_0x6d6d('0x13')](_0x6d6d('0x1c'),_0x1c8340[_0x6d6d('0x14')],_0x583b10);_0x99f7d6(_0x3b73e5[_0x6d6d('0x13')](0x1f4,_0x1c8340[_0x6d6d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 8e2c99e..6bbc8cd 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 _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 +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(_0x53727c,_0x50b9e7){var _0x1346ef=function(_0xf2102e){while(--_0xf2102e){_0x53727c['push'](_0x53727c['shift']());}};_0x1346ef(++_0x50b9e7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x20ee16,_0x3d0700){_0x20ee16=_0x20ee16-0x0;var _0x428f43=_0x5f2f[_0x20ee16];return _0x428f43;};'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 16521a0..5642531 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 _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 +var _0xe110=['sequelize','STRING','TEXT'];(function(_0x3a7272,_0x2e51da){var _0x23d3e7=function(_0x2068a8){while(--_0x2068a8){_0x3a7272['push'](_0x3a7272['shift']());}};_0x23d3e7(++_0x2e51da);}(_0xe110,0x16b));var _0x0e11=function(_0x2f0811,_0x589ce){_0x2f0811=_0x2f0811-0x0;var _0x18ff83=_0xe110[_0x2f0811];return _0x18ff83;};'use strict';var Sequelize=require(_0x0e11('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0e11('0x1')]},'node':{'type':Sequelize[_0x0e11('0x1')]},'application':{'type':Sequelize[_0x0e11('0x1')]},'data':{'type':Sequelize[_0x0e11('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0e11('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 3e4971e..6dc38ea 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 _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 +var _0xcb22=['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','sendStatus','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','sort','pick','filters','filter','merge','where','VIRTUAL','includeAll','rows','catch','params','options','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x5435df,_0x52c37a){var _0x320c1c=function(_0x2fc6fd){while(--_0x2fc6fd){_0x5435df['push'](_0x5435df['shift']());}};_0x320c1c(++_0x52c37a);}(_0xcb22,0xc8));var _0x2cb2=function(_0x314cd1,_0x33679e){_0x314cd1=_0x314cd1-0x0;var _0x2a0846=_0xcb22[_0x314cd1];return _0x2a0846;};'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(){_0x2c1831[_0x2cb2('0x19')](0xcc)[_0x2cb2('0x1a')]();});}};}function handleEntityNotFound(_0x3f43bd,_0x1365f8){return function(_0x3fd947){if(!_0x3fd947){_0x3f43bd[_0x2cb2('0x22')](0x194);}return _0x3fd947;};}function handleError(_0x1e19be,_0x512dc2){_0x512dc2=_0x512dc2||0x1f4;return function(_0x1c217c){logger[_0x2cb2('0x23')](_0x1c217c[_0x2cb2('0x24')]);if(_0x1c217c[_0x2cb2('0x25')]){delete _0x1c217c[_0x2cb2('0x25')];}_0x1e19be[_0x2cb2('0x19')](_0x512dc2)[_0x2cb2('0x26')](_0x1c217c);};}exports[_0x2cb2('0x27')]=function(_0x779ae3,_0x4e4eff){var _0x46db09={},_0x4f5192={},_0x279bd2={'count':0x0,'rows':[]};var _0x2625de=_[_0x2cb2('0x28')](db[_0x2cb2('0x29')][_0x2cb2('0x2a')],function(_0x200067){return{'name':_0x200067[_0x2cb2('0x2b')],'type':_0x200067[_0x2cb2('0x2c')][_0x2cb2('0x2d')]};});_0x4f5192['model']=_['map'](_0x2625de,_0x2cb2('0x25'));_0x4f5192['query']=_[_0x2cb2('0x2e')](_0x779ae3['query']);_0x4f5192['filters']=_[_0x2cb2('0x2f')](_0x4f5192[_0x2cb2('0x30')],_0x4f5192[_0x2cb2('0x31')]);_0x46db09[_0x2cb2('0x32')]=_[_0x2cb2('0x2f')](_0x4f5192[_0x2cb2('0x30')],qs[_0x2cb2('0x33')](_0x779ae3[_0x2cb2('0x31')][_0x2cb2('0x33')]));_0x46db09['attributes']=_0x46db09[_0x2cb2('0x32')][_0x2cb2('0x34')]?_0x46db09['attributes']:_0x4f5192[_0x2cb2('0x30')];if(!_0x779ae3[_0x2cb2('0x31')][_0x2cb2('0x35')]('nolimit')){_0x46db09['limit']=qs[_0x2cb2('0x1d')](_0x779ae3[_0x2cb2('0x31')][_0x2cb2('0x1d')]);_0x46db09['offset']=qs[_0x2cb2('0x1c')](_0x779ae3[_0x2cb2('0x31')]['offset']);}_0x46db09['order']=qs[_0x2cb2('0x36')](_0x779ae3[_0x2cb2('0x31')][_0x2cb2('0x36')]);_0x46db09['where']=qs['filters'](_[_0x2cb2('0x37')](_0x779ae3[_0x2cb2('0x31')],_0x4f5192[_0x2cb2('0x38')]),_0x2625de);if(_0x779ae3[_0x2cb2('0x31')][_0x2cb2('0x39')]){_0x46db09['where']=_[_0x2cb2('0x3a')](_0x46db09[_0x2cb2('0x3b')],{'$or':_[_0x2cb2('0x28')](_0x2625de,function(_0x4af179){if(_0x4af179['type']!==_0x2cb2('0x3c')){var _0x328494={};_0x328494[_0x4af179[_0x2cb2('0x25')]]={'$like':'%'+_0x779ae3[_0x2cb2('0x31')][_0x2cb2('0x39')]+'%'};return _0x328494;}})});}_0x46db09=_[_0x2cb2('0x3a')]({},_0x46db09,_0x779ae3['options']);var _0x41adac={'where':_0x46db09[_0x2cb2('0x3b')]};return db[_0x2cb2('0x29')][_0x2cb2('0x1b')](_0x41adac)[_0x2cb2('0x21')](function(_0x15dd90){_0x279bd2[_0x2cb2('0x1b')]=_0x15dd90;if(_0x779ae3[_0x2cb2('0x31')][_0x2cb2('0x3d')]){_0x46db09['include']=[{'all':!![]}];}return db[_0x2cb2('0x29')]['findAll'](_0x46db09);})[_0x2cb2('0x21')](function(_0x48b59f){_0x279bd2[_0x2cb2('0x3e')]=_0x48b59f;return _0x279bd2;})[_0x2cb2('0x21')](respondWithFilteredResult(_0x4e4eff,_0x46db09))[_0x2cb2('0x3f')](handleError(_0x4e4eff,null));};exports['show']=function(_0x2e4135,_0x39a6ff){var _0x113957={'raw':!![],'where':{'id':_0x2e4135[_0x2cb2('0x40')]['id']}},_0x44e3aa={};_0x44e3aa[_0x2cb2('0x30')]=_[_0x2cb2('0x2e')](db[_0x2cb2('0x29')][_0x2cb2('0x2a')]);_0x44e3aa['query']=_[_0x2cb2('0x2e')](_0x2e4135[_0x2cb2('0x31')]);_0x44e3aa['filters']=_['intersection'](_0x44e3aa[_0x2cb2('0x30')],_0x44e3aa[_0x2cb2('0x31')]);_0x113957['attributes']=_[_0x2cb2('0x2f')](_0x44e3aa[_0x2cb2('0x30')],qs['fields'](_0x2e4135['query'][_0x2cb2('0x33')]));_0x113957[_0x2cb2('0x32')]=_0x113957['attributes'][_0x2cb2('0x34')]?_0x113957[_0x2cb2('0x32')]:_0x44e3aa['model'];if(_0x2e4135['query']['includeAll']){_0x113957['include']=[{'all':!![]}];}_0x113957=_[_0x2cb2('0x3a')]({},_0x113957,_0x2e4135[_0x2cb2('0x41')]);return db['SquareDetailsReport'][_0x2cb2('0x42')](_0x113957)[_0x2cb2('0x21')](handleEntityNotFound(_0x39a6ff,null))[_0x2cb2('0x21')](respondWithResult(_0x39a6ff,null))[_0x2cb2('0x3f')](handleError(_0x39a6ff,null));};exports[_0x2cb2('0x43')]=function(_0x49f83f,_0x27d883){return db['SquareDetailsReport']['create'](_0x49f83f['body'],{})['then'](respondWithResult(_0x27d883,0xc9))[_0x2cb2('0x3f')](handleError(_0x27d883,null));};exports[_0x2cb2('0x20')]=function(_0x71d263,_0x2a49d8){if(_0x71d263['body']['id']){delete _0x71d263[_0x2cb2('0x44')]['id'];}return db[_0x2cb2('0x29')][_0x2cb2('0x42')]({'where':{'id':_0x71d263[_0x2cb2('0x40')]['id']}})['then'](handleEntityNotFound(_0x2a49d8,null))[_0x2cb2('0x21')](saveUpdates(_0x71d263[_0x2cb2('0x44')],null))['then'](respondWithResult(_0x2a49d8,null))['catch'](handleError(_0x2a49d8,null));};exports[_0x2cb2('0x45')]=function(_0x1f050c,_0x3ccca1){return db[_0x2cb2('0x29')]['find']({'where':{'id':_0x1f050c['params']['id']}})[_0x2cb2('0x21')](handleEntityNotFound(_0x3ccca1,null))[_0x2cb2('0x21')](removeEntity(_0x3ccca1,null))[_0x2cb2('0x3f')](handleError(_0x3ccca1,null));};exports[_0x2cb2('0x46')]=function(_0x112d98,_0x235c62){return db[_0x2cb2('0x29')][_0x2cb2('0x46')]()[_0x2cb2('0x21')](respondWithResult(_0x235c62,null))[_0x2cb2('0x3f')](handleError(_0x235c62,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index a7cdace..cc85026 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 _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 +var _0xee3c=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x554292,_0x82948a){var _0x3dd555=function(_0xab7590){while(--_0xab7590){_0x554292['push'](_0x554292['shift']());}};_0x3dd555(++_0x82948a);}(_0xee3c,0x14a));var _0xcee3=function(_0x3ce6b9,_0x68396c){_0x3ce6b9=_0x3ce6b9-0x0;var _0x3312e8=_0xee3c[_0x3ce6b9];return _0x3312e8;};'use strict';var _=require(_0xcee3('0x0'));var util=require(_0xcee3('0x1'));var logger=require(_0xcee3('0x2'))(_0xcee3('0x3'));var moment=require(_0xcee3('0x4'));var BPromise=require(_0xcee3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcee3('0x6'));var config=require(_0xcee3('0x7'));var attributes=require(_0xcee3('0x8'));module[_0xcee3('0x9')]=function(_0x9350f3,_0x44e46f){return _0x9350f3[_0xcee3('0xa')](_0xcee3('0xb'),attributes,{'tableName':_0xcee3('0xc'),'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 0d264ca..8ef18de 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 _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 +var _0x2f45=['CreateSquareDetailsReport','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','create','body','options'];(function(_0x31d268,_0x4f5f5a){var _0x563a2c=function(_0xe828f2){while(--_0xe828f2){_0x31d268['push'](_0x31d268['shift']());}};_0x563a2c(++_0x4f5f5a);}(_0x2f45,0xe3));var _0x52f4=function(_0x481778,_0x3591a2){_0x481778=_0x481778-0x0;var _0x180616=_0x2f45[_0x481778];return _0x180616;};'use strict';var _=require(_0x52f4('0x0'));var util=require(_0x52f4('0x1'));var moment=require(_0x52f4('0x2'));var BPromise=require('bluebird');var rs=require(_0x52f4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x52f4('0x4'))['db'];var utils=require(_0x52f4('0x5'));var logger=require(_0x52f4('0x6'))(_0x52f4('0x7'));var config=require(_0x52f4('0x8'));var jayson=require(_0x52f4('0x9'));var client=jayson[_0x52f4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5729a9,_0x270da6,_0x11afd6){return new BPromise(function(_0x51dacf,_0x1e8cdc){return client[_0x52f4('0xb')](_0x5729a9,_0x11afd6)['then'](function(_0x5609f0){logger['info'](_0x52f4('0xc'),_0x270da6,_0x52f4('0xd'));logger['debug'](_0x52f4('0xe'),_0x270da6,_0x52f4('0xd'),JSON[_0x52f4('0xf')](_0x5609f0));if(_0x5609f0[_0x52f4('0x10')]){if(_0x5609f0[_0x52f4('0x10')]['code']===0x1f4){logger[_0x52f4('0x10')](_0x52f4('0xc'),_0x270da6,_0x5609f0[_0x52f4('0x10')]['message']);return _0x1e8cdc(_0x5609f0[_0x52f4('0x10')][_0x52f4('0x11')]);}logger[_0x52f4('0x10')](_0x52f4('0xc'),_0x270da6,_0x5609f0[_0x52f4('0x10')]['message']);return _0x51dacf(_0x5609f0[_0x52f4('0x10')][_0x52f4('0x11')]);}else{logger[_0x52f4('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x270da6,_0x52f4('0xd'));_0x51dacf(_0x5609f0[_0x52f4('0x13')]['message']);}})['catch'](function(_0x2bda61){logger[_0x52f4('0x10')](_0x52f4('0xc'),_0x270da6,_0x2bda61);_0x1e8cdc(_0x2bda61);});});}exports['CreateSquareDetailsReport']=function(_0xfb095a){var _0x3ebf76=this;return new Promise(function(_0x9e82e8,_0xf0e0ad){return db['SquareDetailsReport'][_0x52f4('0x14')](_0xfb095a[_0x52f4('0x15')],{'raw':_0xfb095a[_0x52f4('0x16')]?_0xfb095a[_0x52f4('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x44eed4){logger[_0x52f4('0x12')](_0x52f4('0x17'),_0xfb095a);logger[_0x52f4('0x18')](_0x52f4('0x17'),_0xfb095a,JSON[_0x52f4('0xf')](_0x44eed4));_0x9e82e8(_0x44eed4);})['catch'](function(_0x545162){logger[_0x52f4('0x10')](_0x52f4('0x17'),_0x545162['message'],_0xfb095a);_0xf0e0ad(_0x3ebf76[_0x52f4('0x10')](0x1f4,_0x545162[_0x52f4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index e5a635e..5d452f1 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 _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 +var _0xe5fe=['/process/:pid/kill','killProcess','exports','express','./system.controller','get','isAuthenticated','index'];(function(_0x53c09e,_0x39d3b7){var _0x5630ef=function(_0x2c6f98){while(--_0x2c6f98){_0x53c09e['push'](_0x53c09e['shift']());}};_0x5630ef(++_0x39d3b7);}(_0xe5fe,0x93));var _0xee5f=function(_0x1033bd,_0x562ad5){_0x1033bd=_0x1033bd-0x0;var _0x360ab0=_0xe5fe[_0x1033bd];return _0x360ab0;};'use strict';var express=require(_0xee5f('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xee5f('0x1'));router[_0xee5f('0x2')]('/',auth[_0xee5f('0x3')](),controller[_0xee5f('0x4')]);router['get'](_0xee5f('0x5'),auth[_0xee5f('0x3')](),controller[_0xee5f('0x6')]);module[_0xee5f('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 015878d..00754d5 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 _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 +var _0x889e=['child_process','../../config/logger','util','bluebird','lodash','error','name','status','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation'];(function(_0x34a62a,_0xad7cc2){var _0x3a3ecf=function(_0x37fbe6){while(--_0x37fbe6){_0x34a62a['push'](_0x34a62a['shift']());}};_0x3a3ecf(++_0xad7cc2);}(_0x889e,0x77));var _0xe889=function(_0x2f0be3,_0x5e18c1){_0x2f0be3=_0x2f0be3-0x0;var _0x2eb9f1=_0x889e[_0x2f0be3];return _0x2eb9f1;};'use strict';var info=require(_0xe889('0x0'));var exec=require(_0xe889('0x1'))['exec'];var logger=require(_0xe889('0x2'))('api');var util=require(_0xe889('0x3'));var BPromise=require(_0xe889('0x4'));var _=require(_0xe889('0x5'));function handleError(_0x3a638f,_0x459c41,_0x5acbcd){_0x459c41=_0x459c41||0x1f4;return function(_0x3c7a62){logger[_0xe889('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x5acbcd,_0x459c41,util['inspect'](_0x3c7a62,{'showHidden':![],'depth':null}));delete _0x3c7a62[_0xe889('0x7')];_0x3a638f[_0xe889('0x8')](_0x459c41)['send'](_0x3c7a62);};}exports['index']=function(_0x4ccc1e,_0x278601){return info[_0xe889('0x9')]()[_0xe889('0xa')](function(_0x416df2){return _0x278601[_0xe889('0x8')](0xc8)[_0xe889('0xb')](_0x416df2);})[_0xe889('0xc')](function(_0x1a1cdf){return _0x278601[_0xe889('0x8')](0x1f4)[_0xe889('0xb')](_0x1a1cdf);});};exports[_0xe889('0xd')]=function(_0x3eaaa3,_0x493dda){var _0x19b3a5=[_0xe889('0xe')];return new BPromise(function(_0x3b52a1,_0x1b808b){return exec(util[_0xe889('0xf')](_0xe889('0x10'),_0x3eaaa3[_0xe889('0x11')][_0xe889('0x12')]),function(_0x480f13,_0x36dc1f,_0x277b67){if(_0x480f13){return _0x1b808b(_0x480f13);}return _0x3b52a1(_0x36dc1f);});})[_0xe889('0xa')](function(_0x5db1f2){var _0x3546d4=![];var _0x3cc520=_0x5db1f2[_0xe889('0x13')](/\n/);for(var _0x54a0de=0x0,_0x1c32d8=_0x19b3a5[_0xe889('0x14')];_0x54a0de<_0x1c32d8,_0x3546d4===![];_0x54a0de+=0x1){if(_0x5db1f2['indexOf'](_0x19b3a5[_0x54a0de])>=0x0){_0x3546d4=!![];}}if(!_0x3546d4){throw new Error(util[_0xe889('0xf')](_0xe889('0x15'),_0x3eaaa3['params']['pid']));}process['kill'](_0x3eaaa3[_0xe889('0x11')][_0xe889('0x12')],_0xe889('0x16'));return _0x493dda[_0xe889('0x8')](0xc8)[_0xe889('0xb')]({'message':util[_0xe889('0xf')](_0xe889('0x17'),_0x3eaaa3[_0xe889('0x11')][_0xe889('0x12')])});})[_0xe889('0xc')](handleError(_0x493dda,null,_0xe889('0xd')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index f2f0250..b0cc8fa 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 _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 +var _0xcb91=['post','create','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x16aaef,_0x410651){_0x16aaef=_0x16aaef-0x0;var _0x1c82ef=_0xcb91[_0x16aaef];return _0x1c82ef;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./tag.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0xa')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0xb')]);router['put']('/:id',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xc')]);router[_0x1cb9('0xd')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller['destroy']);module[_0x1cb9('0xe')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 30ab184..ada5783 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 _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 +var _0x5c00=['STRING','sequelize','exports'];(function(_0x303221,_0x254ba3){var _0x43acd5=function(_0x17f12d){while(--_0x17f12d){_0x303221['push'](_0x303221['shift']());}};_0x43acd5(++_0x254ba3);}(_0x5c00,0x17e));var _0x05c0=function(_0x42ddf8,_0x264fc9){_0x42ddf8=_0x42ddf8-0x0;var _0x558152=_0x5c00[_0x42ddf8];return _0x558152;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'name':{'type':Sequelize[_0x05c0('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x05c0('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x05c0('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index e2f7417..7e8ee8f 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 _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 +var _0x29b5=['params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','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/license/util','sendStatus','status','json','offset','limit','set','Content-Range','apply','destroy','then','get','Tags','UserProfileResource','end','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show'];(function(_0x497fbe,_0x3fed8c){var _0x5a10c1=function(_0x36c2e6){while(--_0x36c2e6){_0x497fbe['push'](_0x497fbe['shift']());}};_0x5a10c1(++_0x3fed8c);}(_0x29b5,0xa2));var _0x529b=function(_0xacfdde,_0x2b85a5){_0xacfdde=_0xacfdde-0x0;var _0x3b0882=_0x29b5[_0xacfdde];return _0x3b0882;};'use strict';var pdf=require(_0x529b('0x0'));var emlformat=require(_0x529b('0x1'));var rimraf=require(_0x529b('0x2'));var zipdir=require(_0x529b('0x3'));var jsonpatch=require(_0x529b('0x4'));var rp=require(_0x529b('0x5'));var moment=require(_0x529b('0x6'));var BPromise=require(_0x529b('0x7'));var Mustache=require(_0x529b('0x8'));var util=require('util');var path=require(_0x529b('0x9'));var sox=require(_0x529b('0xa'));var csv=require('to-csv');var ejs=require(_0x529b('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x529b('0xc'));var crypto=require(_0x529b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x529b('0xe'));var toCsv=require(_0x529b('0xf'));var querystring=require(_0x529b('0x10'));var Papa=require(_0x529b('0x11'));var Redis=require(_0x529b('0x12'));var authService=require(_0x529b('0x13'));var qs=require(_0x529b('0x14'));var as=require(_0x529b('0x15'));var hardwareService=require(_0x529b('0x16'));var logger=require(_0x529b('0x17'))(_0x529b('0x18'));var utils=require(_0x529b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x529b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b3e9d,_0x454440){_0x454440=_0x454440||0xcc;return function(_0x428df9){if(_0x428df9){return _0x1b3e9d[_0x529b('0x1b')](_0x454440);}return _0x1b3e9d['status'](_0x454440)['end']();};}function respondWithResult(_0x166a67,_0x46d769){_0x46d769=_0x46d769||0xc8;return function(_0x3e8c27){if(_0x3e8c27){return _0x166a67[_0x529b('0x1c')](_0x46d769)[_0x529b('0x1d')](_0x3e8c27);}};}function respondWithFilteredResult(_0x14e8e0,_0x4e2e04){return function(_0x52e02d){if(_0x52e02d){var _0x48112f=_0x52e02d['count'],_0x57a682=_0x4e2e04[_0x529b('0x1e')],_0x2c2294=_0x4e2e04['offset']+_0x4e2e04[_0x529b('0x1f')],_0x1a8304;if(_0x2c2294>=_0x48112f){_0x2c2294=_0x48112f;_0x1a8304=0xc8;}else{_0x1a8304=0xce;}_0x14e8e0[_0x529b('0x1c')](_0x1a8304);return _0x14e8e0[_0x529b('0x20')](_0x529b('0x21'),_0x57a682+'-'+_0x2c2294+'/'+_0x48112f)[_0x529b('0x1d')](_0x52e02d);}return null;};}function patchUpdates(_0x216bfa){return function(_0x3ed79d){try{jsonpatch[_0x529b('0x22')](_0x3ed79d,_0x216bfa,!![]);}catch(_0x59dbdd){return BPromise['reject'](_0x59dbdd);}return _0x3ed79d['save']();};}function saveUpdates(_0x52a17c,_0x377c76){return function(_0x518892){if(_0x518892){return _0x518892['update'](_0x52a17c)['then'](function(_0x371333){return _0x371333;});}return null;};}function removeEntity(_0x1b6647,_0x56c2a1){return function(_0x3888b1){if(_0x3888b1){return _0x3888b1[_0x529b('0x23')]()[_0x529b('0x24')](function(){var _0x37aa33=_0x3888b1[_0x529b('0x25')]({'plain':!![]});var _0x2af19c=_0x529b('0x26');return db[_0x529b('0x27')]['destroy']({'where':{'type':_0x2af19c,'resourceId':_0x37aa33['id']}})[_0x529b('0x24')](function(){return _0x3888b1;});})['then'](function(){_0x1b6647[_0x529b('0x1c')](0xcc)[_0x529b('0x28')]();});}};}function handleEntityNotFound(_0x7da3f1,_0x167e96){return function(_0x30fd29){if(!_0x30fd29){_0x7da3f1[_0x529b('0x1b')](0x194);}return _0x30fd29;};}function handleError(_0x400020,_0x30233b){_0x30233b=_0x30233b||0x1f4;return function(_0x382142){logger['error'](_0x382142['stack']);if(_0x382142[_0x529b('0x29')]){delete _0x382142['name'];}_0x400020[_0x529b('0x1c')](_0x30233b)[_0x529b('0x2a')](_0x382142);};}exports[_0x529b('0x2b')]=function(_0x514a58,_0x36fae2){var _0x553c25={},_0x4933cc={},_0x4c46f6={'count':0x0,'rows':[]};var _0x1fc79d=_[_0x529b('0x2c')](db[_0x529b('0x2d')][_0x529b('0x2e')],function(_0x519f77){return{'name':_0x519f77[_0x529b('0x2f')],'type':_0x519f77[_0x529b('0x30')][_0x529b('0x31')]};});_0x4933cc[_0x529b('0x32')]=_['map'](_0x1fc79d,_0x529b('0x29'));_0x4933cc['query']=_[_0x529b('0x33')](_0x514a58[_0x529b('0x34')]);_0x4933cc[_0x529b('0x35')]=_[_0x529b('0x36')](_0x4933cc['model'],_0x4933cc['query']);_0x553c25[_0x529b('0x37')]=_[_0x529b('0x36')](_0x4933cc[_0x529b('0x32')],qs['fields'](_0x514a58[_0x529b('0x34')][_0x529b('0x38')]));_0x553c25['attributes']=_0x553c25[_0x529b('0x37')]['length']?_0x553c25[_0x529b('0x37')]:_0x4933cc['model'];if(!_0x514a58['query'][_0x529b('0x39')](_0x529b('0x3a'))){_0x553c25[_0x529b('0x1f')]=qs[_0x529b('0x1f')](_0x514a58[_0x529b('0x34')][_0x529b('0x1f')]);_0x553c25[_0x529b('0x1e')]=qs['offset'](_0x514a58['query'][_0x529b('0x1e')]);}_0x553c25[_0x529b('0x3b')]=qs[_0x529b('0x3c')](_0x514a58['query']['sort']);_0x553c25['where']=qs[_0x529b('0x35')](_[_0x529b('0x3d')](_0x514a58['query'],_0x4933cc[_0x529b('0x35')]),_0x1fc79d);if(_0x514a58[_0x529b('0x34')][_0x529b('0x3e')]){_0x553c25[_0x529b('0x3f')]=_[_0x529b('0x40')](_0x553c25[_0x529b('0x3f')],{'$or':_[_0x529b('0x2c')](_0x1fc79d,function(_0x2a1e32){if(_0x2a1e32[_0x529b('0x30')]!==_0x529b('0x41')){var _0x4c25e3={};_0x4c25e3[_0x2a1e32[_0x529b('0x29')]]={'$like':'%'+_0x514a58[_0x529b('0x34')][_0x529b('0x3e')]+'%'};return _0x4c25e3;}})});}_0x553c25=_[_0x529b('0x40')]({},_0x553c25,_0x514a58[_0x529b('0x42')]);var _0x5d59af={'where':_0x553c25[_0x529b('0x3f')]};return db['Tag']['count'](_0x5d59af)['then'](function(_0x555006){_0x4c46f6['count']=_0x555006;if(_0x514a58[_0x529b('0x34')][_0x529b('0x43')]){_0x553c25[_0x529b('0x44')]=[{'all':!![]}];}return db[_0x529b('0x2d')]['findAll'](_0x553c25);})[_0x529b('0x24')](function(_0xd44a13){_0x4c46f6[_0x529b('0x45')]=_0xd44a13;return _0x4c46f6;})[_0x529b('0x24')](respondWithFilteredResult(_0x36fae2,_0x553c25))[_0x529b('0x46')](handleError(_0x36fae2,null));};exports[_0x529b('0x47')]=function(_0x190c28,_0xfca9a1){var _0x54366a={'raw':!![],'where':{'id':_0x190c28[_0x529b('0x48')]['id']}},_0x567287={};_0x567287[_0x529b('0x32')]=_['keys'](db[_0x529b('0x2d')][_0x529b('0x2e')]);_0x567287[_0x529b('0x34')]=_[_0x529b('0x33')](_0x190c28[_0x529b('0x34')]);_0x567287['filters']=_[_0x529b('0x36')](_0x567287['model'],_0x567287[_0x529b('0x34')]);_0x54366a[_0x529b('0x37')]=_[_0x529b('0x36')](_0x567287[_0x529b('0x32')],qs[_0x529b('0x38')](_0x190c28[_0x529b('0x34')][_0x529b('0x38')]));_0x54366a[_0x529b('0x37')]=_0x54366a[_0x529b('0x37')]['length']?_0x54366a['attributes']:_0x567287[_0x529b('0x32')];if(_0x190c28[_0x529b('0x34')][_0x529b('0x43')]){_0x54366a[_0x529b('0x44')]=[{'all':!![]}];}_0x54366a=_['merge']({},_0x54366a,_0x190c28[_0x529b('0x42')]);return db[_0x529b('0x2d')]['find'](_0x54366a)[_0x529b('0x24')](handleEntityNotFound(_0xfca9a1,null))['then'](respondWithResult(_0xfca9a1,null))[_0x529b('0x46')](handleError(_0xfca9a1,null));};exports[_0x529b('0x49')]=function(_0x1c3ef8,_0x32f6b5){return db['Tag'][_0x529b('0x49')](_0x1c3ef8[_0x529b('0x4a')],{})[_0x529b('0x24')](function(_0x5acbb2){var _0x5b63b2=_0x1c3ef8[_0x529b('0x4b')][_0x529b('0x25')]({'plain':!![]});if(!_0x5b63b2)throw new Error(_0x529b('0x4c'));if(_0x5b63b2['role']===_0x529b('0x4b')){var _0x5b4341=_0x5acbb2[_0x529b('0x25')]({'plain':!![]});var _0x518388=_0x529b('0x26');return db['UserProfileSection'][_0x529b('0x4d')]({'where':{'name':_0x518388,'userProfileId':_0x5b63b2['userProfileId']},'raw':!![]})[_0x529b('0x24')](function(_0xa26d69){if(_0xa26d69&&_0xa26d69['autoAssociation']===0x0){return db[_0x529b('0x27')][_0x529b('0x49')]({'name':_0x5b4341[_0x529b('0x29')],'resourceId':_0x5b4341['id'],'type':_0xa26d69[_0x529b('0x29')],'sectionId':_0xa26d69['id']},{})[_0x529b('0x24')](function(){return _0x5acbb2;});}else{return _0x5acbb2;}})[_0x529b('0x46')](function(_0x230784){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x230784);throw _0x230784;});}return _0x5acbb2;})[_0x529b('0x24')](respondWithResult(_0x32f6b5,0xc9))[_0x529b('0x46')](handleError(_0x32f6b5,null));};exports['update']=function(_0x2ad05e,_0x3be953){if(_0x2ad05e[_0x529b('0x4a')]['id']){delete _0x2ad05e[_0x529b('0x4a')]['id'];}return db[_0x529b('0x2d')][_0x529b('0x4d')]({'where':{'id':_0x2ad05e[_0x529b('0x48')]['id']}})[_0x529b('0x24')](handleEntityNotFound(_0x3be953,null))['then'](saveUpdates(_0x2ad05e['body'],null))[_0x529b('0x24')](respondWithResult(_0x3be953,null))['catch'](handleError(_0x3be953,null));};exports[_0x529b('0x23')]=function(_0x1e9cf1,_0xc701db){return db[_0x529b('0x2d')][_0x529b('0x4d')]({'where':{'id':_0x1e9cf1['params']['id']}})[_0x529b('0x24')](handleEntityNotFound(_0xc701db,null))['then'](removeEntity(_0xc701db,null))[_0x529b('0x46')](handleError(_0xc701db,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index f83a81d..14eb12d 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 _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 +var _0x3a6d=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x3a6d,0x196));var _0xd3a6=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x3a6d[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var logger=require(_0xd3a6('0x2'))(_0xd3a6('0x3'));var moment=require(_0xd3a6('0x4'));var BPromise=require('bluebird');var rp=require(_0xd3a6('0x5'));var fs=require('fs');var path=require(_0xd3a6('0x6'));var rimraf=require(_0xd3a6('0x7'));var config=require(_0xd3a6('0x8'));var attributes=require(_0xd3a6('0x9'));module[_0xd3a6('0xa')]=function(_0x292432,_0x496461){return _0x292432[_0xd3a6('0xb')](_0xd3a6('0xc'),attributes,{'tableName':_0xd3a6('0xd'),'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 f25f8b9..bc7d31a 100644 --- a/server/api/tag/tag.rpc.js +++ b/server/api/tag/tag.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bc6=['../../config/environment','client','http','request','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','result','lodash','util','moment','../../config/utils','rpc'];(function(_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 +var _0xf45e=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message'];(function(_0x47a5fc,_0x4649ca){var _0x26e3d2=function(_0x1d1dd1){while(--_0x1d1dd1){_0x47a5fc['push'](_0x47a5fc['shift']());}};_0x26e3d2(++_0x4649ca);}(_0xf45e,0x115));var _0xef45=function(_0x101d1b,_0x3d5ecc){_0x101d1b=_0x101d1b-0x0;var _0x56cf71=_0xf45e[_0x101d1b];return _0x56cf71;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var moment=require(_0xef45('0x1'));var BPromise=require('bluebird');var rs=require(_0xef45('0x2'));var fs=require('fs');var Redis=require(_0xef45('0x3'));var db=require(_0xef45('0x4'))['db'];var utils=require(_0xef45('0x5'));var logger=require(_0xef45('0x6'))(_0xef45('0x7'));var config=require(_0xef45('0x8'));var jayson=require(_0xef45('0x9'));var client=jayson[_0xef45('0xa')][_0xef45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f2e92,_0x3303ad,_0x1a68c4){return new BPromise(function(_0x1e0def,_0x268ef6){return client[_0xef45('0xc')](_0x2f2e92,_0x1a68c4)[_0xef45('0xd')](function(_0x158a0b){logger[_0xef45('0xe')]('Tag,\x20%s,\x20%s',_0x3303ad,_0xef45('0xf'));logger[_0xef45('0x10')](_0xef45('0x11'),_0x3303ad,_0xef45('0xf'),JSON[_0xef45('0x12')](_0x158a0b));if(_0x158a0b[_0xef45('0x13')]){if(_0x158a0b['error'][_0xef45('0x14')]===0x1f4){logger[_0xef45('0x13')](_0xef45('0x15'),_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x268ef6(_0x158a0b['error']['message']);}logger[_0xef45('0x13')]('Tag,\x20%s,\x20%s',_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x1e0def(_0x158a0b[_0xef45('0x13')]['message']);}else{logger['info'](_0xef45('0x15'),_0x3303ad,'request\x20sent');_0x1e0def(_0x158a0b[_0xef45('0x17')][_0xef45('0x16')]);}})[_0xef45('0x18')](function(_0x3f40e5){logger['error']('Tag,\x20%s,\x20%s',_0x3303ad,_0x3f40e5);_0x268ef6(_0x3f40e5);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 14fc61e..d8e7d06 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 _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 +var _0x7965=['isAuthenticated','index','/:id/queues','getAgents','post','addQueues','/:id/users','addAgents','put','/:id','destroy','delete','removeQueues','removeAgents','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller'];(function(_0x175ad3,_0x173c72){var _0x11f580=function(_0x1b6078){while(--_0x1b6078){_0x175ad3['push'](_0x175ad3['shift']());}};_0x11f580(++_0x173c72);}(_0x7965,0x12c));var _0x5796=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0x7965[_0x40dd56];return _0x4f850f;};'use strict';var multer=require(_0x5796('0x0'));var util=require('util');var path=require(_0x5796('0x1'));var timeout=require('connect-timeout');var express=require(_0x5796('0x2'));var router=express[_0x5796('0x3')]();var auth=require(_0x5796('0x4'));var interaction=require(_0x5796('0x5'));var config=require(_0x5796('0x6'));var controller=require(_0x5796('0x7'));router['get']('/',auth[_0x5796('0x8')](),controller[_0x5796('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x5796('0xa'),auth['isAuthenticated'](),controller['getQueues']);router['get']('/:id/users',auth[_0x5796('0x8')](),controller[_0x5796('0xb')]);router[_0x5796('0xc')]('/',auth[_0x5796('0x8')](),controller['create']);router[_0x5796('0xc')](_0x5796('0xa'),auth['isAuthenticated'](),controller[_0x5796('0xd')]);router['post'](_0x5796('0xe'),auth[_0x5796('0x8')](),controller[_0x5796('0xf')]);router[_0x5796('0x10')]('/:id',auth[_0x5796('0x8')](),controller['update']);router['delete'](_0x5796('0x11'),auth[_0x5796('0x8')](),controller[_0x5796('0x12')]);router[_0x5796('0x13')](_0x5796('0xa'),auth[_0x5796('0x8')](),controller[_0x5796('0x14')]);router[_0x5796('0x13')](_0x5796('0xe'),auth[_0x5796('0x8')](),controller[_0x5796('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index b87b95a..47dc3a0 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 _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 +var _0x0106=['exports','STRING','name','sequelize'];(function(_0x4d7671,_0x26bd46){var _0x5f1a6d=function(_0x1b3b82){while(--_0x1b3b82){_0x4d7671['push'](_0x4d7671['shift']());}};_0x5f1a6d(++_0x26bd46);}(_0x0106,0x73));var _0x6010=function(_0x13d5c1,_0x6fd929){_0x13d5c1=_0x13d5c1-0x0;var _0x152477=_0x0106[_0x13d5c1];return _0x152477;};'use strict';var Sequelize=require(_0x6010('0x0'));module[_0x6010('0x1')]={'name':{'type':Sequelize[_0x6010('0x2')],'allowNull':![],'unique':_0x6010('0x3')},'description':{'type':Sequelize[_0x6010('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 1a5154a..d82aa7b 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 _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 +var _0xba8a=['Mail','Sms','Fax','Whatsapp','addAgents','voicePause','interface','each','filter','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','omit','emit','removeAgents','voice','mail','sms','fax','whatsapp','getAgents','User','html-pdf','zip-dir','request-promise','moment','mustache','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./team.socket','register','status','end','json','offset','limit','Content-Range','apply','update','then','Teams','destroy','error','name','send','index','map','Team','rawAttributes','type','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','options','count','include','findAll','rows','show','params','includeAll','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','catch','body','channel','isValidChannel','ValidationError','Unknown\x20channel','Queue','length','order','capitalize','toLowerCase','Queues','addQueues','findOne','Sequelize','add','ids','Chat'];(function(_0x3f152b,_0x435cdf){var _0x49dc6e=function(_0x59a0b8){while(--_0x59a0b8){_0x3f152b['push'](_0x3f152b['shift']());}};_0x49dc6e(++_0x435cdf);}(_0xba8a,0x1e8));var _0xaba8=function(_0x1a637c,_0x245b0c){_0x1a637c=_0x1a637c-0x0;var _0x113850=_0xba8a[_0x1a637c];return _0x113850;};'use strict';var pdf=require(_0xaba8('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaba8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaba8('0x2'));var moment=require(_0xaba8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaba8('0x4'));var util=require('util');var path=require(_0xaba8('0x5'));var sox=require(_0xaba8('0x6'));var csv=require('to-csv');var ejs=require(_0xaba8('0x7'));var fs=require('fs');var _=require(_0xaba8('0x8'));var squel=require(_0xaba8('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaba8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaba8('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaba8('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaba8('0xd'))(_0xaba8('0xe'));var utils=require(_0xaba8('0xf'));var config=require(_0xaba8('0x10'));var licenseUtil=require(_0xaba8('0x11'));var db=require(_0xaba8('0x12'))['db'];config[_0xaba8('0x13')]=_[_0xaba8('0x14')](config['redis'],{'host':_0xaba8('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaba8('0x13')]));require(_0xaba8('0x16'))[_0xaba8('0x17')](socket);function respondWithStatusCode(_0x55eb9c,_0x11f532){_0x11f532=_0x11f532||0xcc;return function(_0x4f293b){if(_0x4f293b){return _0x55eb9c['sendStatus'](_0x11f532);}return _0x55eb9c[_0xaba8('0x18')](_0x11f532)[_0xaba8('0x19')]();};}function respondWithResult(_0x1f399b,_0x311b8f){_0x311b8f=_0x311b8f||0xc8;return function(_0x37612c){if(_0x37612c){return _0x1f399b[_0xaba8('0x18')](_0x311b8f)[_0xaba8('0x1a')](_0x37612c);}};}function respondWithFilteredResult(_0x33708d,_0x51aadf){return function(_0x384ca2){if(_0x384ca2){var _0x354669=_0x384ca2['count'],_0x5b1c17=_0x51aadf[_0xaba8('0x1b')],_0x18f32a=_0x51aadf[_0xaba8('0x1b')]+_0x51aadf[_0xaba8('0x1c')],_0x14469b;if(_0x18f32a>=_0x354669){_0x18f32a=_0x354669;_0x14469b=0xc8;}else{_0x14469b=0xce;}_0x33708d[_0xaba8('0x18')](_0x14469b);return _0x33708d['set'](_0xaba8('0x1d'),_0x5b1c17+'-'+_0x18f32a+'/'+_0x354669)['json'](_0x384ca2);}return null;};}function patchUpdates(_0x40833e){return function(_0x30b328){try{jsonpatch[_0xaba8('0x1e')](_0x30b328,_0x40833e,!![]);}catch(_0x16d117){return BPromise['reject'](_0x16d117);}return _0x30b328['save']();};}function saveUpdates(_0x36f9d6,_0x1e0384){return function(_0x2cda03){if(_0x2cda03){return _0x2cda03[_0xaba8('0x1f')](_0x36f9d6)[_0xaba8('0x20')](function(_0x15ad4c){return _0x15ad4c;});}return null;};}function removeEntity(_0x47bbdb,_0x58212c){return function(_0x19f310){if(_0x19f310){return _0x19f310['destroy']()['then'](function(){var _0x45d5b6=_0x19f310['get']({'plain':!![]});var _0x39892c=_0xaba8('0x21');return db['UserProfileResource'][_0xaba8('0x22')]({'where':{'type':_0x39892c,'resourceId':_0x45d5b6['id']}})[_0xaba8('0x20')](function(){return _0x19f310;});})[_0xaba8('0x20')](function(){_0x47bbdb[_0xaba8('0x18')](0xcc)[_0xaba8('0x19')]();});}};}function handleEntityNotFound(_0xe70791,_0x39a1b4){return function(_0xca8559){if(!_0xca8559){_0xe70791['sendStatus'](0x194);}return _0xca8559;};}function handleError(_0x1ef6a0,_0x4954a7){_0x4954a7=_0x4954a7||0x1f4;return function(_0x623e9a){logger[_0xaba8('0x23')](_0x623e9a['stack']);if(_0x623e9a[_0xaba8('0x24')]){delete _0x623e9a[_0xaba8('0x24')];}_0x1ef6a0['status'](_0x4954a7)[_0xaba8('0x25')](_0x623e9a);};}exports[_0xaba8('0x26')]=function(_0x400983,_0x319a10){var _0x3b00d0={},_0x147821={},_0x1489d7={'count':0x0,'rows':[]};var _0xc14e09=_[_0xaba8('0x27')](db[_0xaba8('0x28')][_0xaba8('0x29')],function(_0x4a7b4e){return{'name':_0x4a7b4e['fieldName'],'type':_0x4a7b4e[_0xaba8('0x2a')]['key']};});_0x147821['model']=_[_0xaba8('0x27')](_0xc14e09,_0xaba8('0x24'));_0x147821[_0xaba8('0x2b')]=_[_0xaba8('0x2c')](_0x400983['query']);_0x147821['filters']=_[_0xaba8('0x2d')](_0x147821[_0xaba8('0x2e')],_0x147821[_0xaba8('0x2b')]);_0x3b00d0['attributes']=_[_0xaba8('0x2d')](_0x147821[_0xaba8('0x2e')],qs['fields'](_0x400983[_0xaba8('0x2b')][_0xaba8('0x2f')]));_0x3b00d0[_0xaba8('0x30')]=_0x3b00d0['attributes']['length']?_0x3b00d0[_0xaba8('0x30')]:_0x147821['model'];if(!_0x400983[_0xaba8('0x2b')][_0xaba8('0x31')](_0xaba8('0x32'))){_0x3b00d0['limit']=qs[_0xaba8('0x1c')](_0x400983[_0xaba8('0x2b')][_0xaba8('0x1c')]);_0x3b00d0['offset']=qs[_0xaba8('0x1b')](_0x400983[_0xaba8('0x2b')][_0xaba8('0x1b')]);}_0x3b00d0['order']=qs[_0xaba8('0x33')](_0x400983[_0xaba8('0x2b')][_0xaba8('0x33')]);_0x3b00d0[_0xaba8('0x34')]=qs[_0xaba8('0x35')](_[_0xaba8('0x36')](_0x400983['query'],_0x147821[_0xaba8('0x35')]),_0xc14e09);if(_0x400983[_0xaba8('0x2b')]['filter']){_0x3b00d0[_0xaba8('0x34')]=_[_0xaba8('0x37')](_0x3b00d0['where'],{'$or':_[_0xaba8('0x27')](_0xc14e09,function(_0xd247ee){if(_0xd247ee[_0xaba8('0x2a')]!==_0xaba8('0x38')){var _0x3a688f={};_0x3a688f[_0xd247ee['name']]={'$like':'%'+_0x400983[_0xaba8('0x2b')]['filter']+'%'};return _0x3a688f;}})});}_0x3b00d0=_[_0xaba8('0x37')]({},_0x3b00d0,_0x400983[_0xaba8('0x39')]);var _0x4b319e={'where':_0x3b00d0['where']};return db[_0xaba8('0x28')][_0xaba8('0x3a')](_0x4b319e)['then'](function(_0x3c1da5){_0x1489d7['count']=_0x3c1da5;if(_0x400983[_0xaba8('0x2b')]['includeAll']){_0x3b00d0[_0xaba8('0x3b')]=[{'all':!![]}];}return db[_0xaba8('0x28')][_0xaba8('0x3c')](_0x3b00d0);})[_0xaba8('0x20')](function(_0x4b0247){_0x1489d7[_0xaba8('0x3d')]=_0x4b0247;return _0x1489d7;})[_0xaba8('0x20')](respondWithFilteredResult(_0x319a10,_0x3b00d0))['catch'](handleError(_0x319a10,null));};exports[_0xaba8('0x3e')]=function(_0x35c9ba,_0x56d86a){var _0x30c457={'raw':![],'where':{'id':_0x35c9ba[_0xaba8('0x3f')]['id']}},_0x479653={};_0x479653[_0xaba8('0x2e')]=_[_0xaba8('0x2c')](db[_0xaba8('0x28')][_0xaba8('0x29')]);_0x479653[_0xaba8('0x2b')]=_[_0xaba8('0x2c')](_0x35c9ba[_0xaba8('0x2b')]);_0x479653[_0xaba8('0x35')]=_[_0xaba8('0x2d')](_0x479653[_0xaba8('0x2e')],_0x479653[_0xaba8('0x2b')]);_0x30c457['attributes']=_[_0xaba8('0x2d')](_0x479653[_0xaba8('0x2e')],qs[_0xaba8('0x2f')](_0x35c9ba[_0xaba8('0x2b')]['fields']));_0x30c457['attributes']=_0x30c457[_0xaba8('0x30')]['length']?_0x30c457['attributes']:_0x479653[_0xaba8('0x2e')];if(_0x35c9ba[_0xaba8('0x2b')][_0xaba8('0x40')]){_0x30c457[_0xaba8('0x3b')]=[{'all':!![]}];}_0x30c457=_[_0xaba8('0x37')]({},_0x30c457,_0x35c9ba[_0xaba8('0x39')]);return db[_0xaba8('0x28')][_0xaba8('0x41')](_0x30c457)['then'](handleEntityNotFound(_0x56d86a,null))[_0xaba8('0x20')](respondWithResult(_0x56d86a,null))['catch'](handleError(_0x56d86a,null));};exports[_0xaba8('0x42')]=function(_0x4c7745,_0x3a96dd){return db['Team'][_0xaba8('0x42')](_0x4c7745['body'],{})[_0xaba8('0x20')](function(_0x1078e1){var _0x28613d=_0x4c7745['user'][_0xaba8('0x43')]({'plain':!![]});if(!_0x28613d)throw new Error(_0xaba8('0x44'));if(_0x28613d[_0xaba8('0x45')]===_0xaba8('0x46')){var _0x293243=_0x1078e1[_0xaba8('0x43')]({'plain':!![]});var _0x217d34=_0xaba8('0x21');return db['UserProfileSection'][_0xaba8('0x41')]({'where':{'name':_0x217d34,'userProfileId':_0x28613d[_0xaba8('0x47')]},'raw':!![]})[_0xaba8('0x20')](function(_0x54fba3){if(_0x54fba3&&_0x54fba3[_0xaba8('0x48')]===0x0){return db[_0xaba8('0x49')][_0xaba8('0x42')]({'name':_0x293243['name'],'resourceId':_0x293243['id'],'type':_0x54fba3['name'],'sectionId':_0x54fba3['id']},{})[_0xaba8('0x20')](function(){return _0x1078e1;});}else{return _0x1078e1;}})[_0xaba8('0x4a')](function(_0x16ead6){logger[_0xaba8('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16ead6);throw _0x16ead6;});}return _0x1078e1;})[_0xaba8('0x20')](respondWithResult(_0x3a96dd,0xc9))[_0xaba8('0x4a')](handleError(_0x3a96dd,null));};exports['update']=function(_0x141a1e,_0x2d3d46){if(_0x141a1e[_0xaba8('0x4b')]['id']){delete _0x141a1e[_0xaba8('0x4b')]['id'];}return db['Team']['find']({'where':{'id':_0x141a1e['params']['id']}})[_0xaba8('0x20')](handleEntityNotFound(_0x2d3d46,null))[_0xaba8('0x20')](saveUpdates(_0x141a1e[_0xaba8('0x4b')],null))[_0xaba8('0x20')](respondWithResult(_0x2d3d46,null))['catch'](handleError(_0x2d3d46,null));};exports[_0xaba8('0x22')]=function(_0x38efe0,_0x4ae579){return db[_0xaba8('0x28')][_0xaba8('0x41')]({'where':{'id':_0x38efe0[_0xaba8('0x3f')]['id']}})[_0xaba8('0x20')](handleEntityNotFound(_0x4ae579,null))[_0xaba8('0x20')](removeEntity(_0x4ae579,null))[_0xaba8('0x4a')](handleError(_0x4ae579,null));};exports['getQueues']=function(_0xc72d2c,_0x20342f,_0x2d553f){return db[_0xaba8('0x28')]['findOne']({'where':{'id':_0xc72d2c[_0xaba8('0x3f')]['id']}})[_0xaba8('0x20')](handleEntityNotFound(_0x20342f,null))[_0xaba8('0x20')](function(_0x3bd530){if(!_0xc72d2c[_0xaba8('0x2b')][_0xaba8('0x4c')]||!utils[_0xaba8('0x4d')](_0xc72d2c[_0xaba8('0x2b')][_0xaba8('0x4c')])){throw new db['Sequelize'][(_0xaba8('0x4e'))](_0xaba8('0x4f'));}var _0x52ac25={};var _0x3b7766={};_0x3b7766['model']=_[_0xaba8('0x2c')](db[_['capitalize'](_0xc72d2c['query']['channel']['toLowerCase']())+_0xaba8('0x50')]['rawAttributes']);_0x3b7766[_0xaba8('0x2b')]=_[_0xaba8('0x2c')](_0xc72d2c[_0xaba8('0x2b')]);_0x3b7766[_0xaba8('0x35')]=_[_0xaba8('0x2d')](_0x3b7766[_0xaba8('0x2e')],_0x3b7766[_0xaba8('0x2b')]);_0x52ac25['attributes']=_[_0xaba8('0x2d')](_0x3b7766[_0xaba8('0x2e')],qs['fields'](_0xc72d2c[_0xaba8('0x2b')]['fields']));_0x52ac25['attributes']=_0x52ac25[_0xaba8('0x30')][_0xaba8('0x51')]?_0x52ac25['attributes']:_0x3b7766[_0xaba8('0x2e')];_0x52ac25[_0xaba8('0x1c')]=qs[_0xaba8('0x1c')](_0xc72d2c[_0xaba8('0x2b')]['limit']);_0x52ac25[_0xaba8('0x1b')]=qs[_0xaba8('0x1b')](_0xc72d2c[_0xaba8('0x2b')][_0xaba8('0x1b')]);_0x52ac25[_0xaba8('0x52')]=qs['sort'](_0xc72d2c[_0xaba8('0x2b')][_0xaba8('0x33')]);_0x52ac25[_0xaba8('0x34')]=qs['filters'](_['pick'](_0xc72d2c[_0xaba8('0x2b')],_0x3b7766[_0xaba8('0x35')]));_0x52ac25=_[_0xaba8('0x37')]({},_0x52ac25,_0xc72d2c['options']);return _0x3bd530[_0xaba8('0x43')+_[_0xaba8('0x53')](_0xc72d2c[_0xaba8('0x2b')][_0xaba8('0x4c')][_0xaba8('0x54')]())+_0xaba8('0x55')](_0x52ac25);})[_0xaba8('0x20')](respondWithResult(_0x20342f,null))[_0xaba8('0x4a')](handleError(_0x20342f,null));};exports[_0xaba8('0x56')]=function(_0x156eae,_0x4496ce,_0x423f1b){return db[_0xaba8('0x28')][_0xaba8('0x57')]({'where':{'id':_0x156eae['params']['id']}})[_0xaba8('0x20')](function(_0x31cce7){if(_0x31cce7){if(!_0x156eae[_0xaba8('0x4b')][_0xaba8('0x4c')]||!utils[_0xaba8('0x4d')](_0x156eae[_0xaba8('0x4b')][_0xaba8('0x4c')])){throw new db[(_0xaba8('0x58'))]['ValidationError'](_0xaba8('0x4f'));}return _0x31cce7[_0xaba8('0x59')+_[_0xaba8('0x53')](_0x156eae[_0xaba8('0x4b')][_0xaba8('0x4c')]['toLowerCase']())+_0xaba8('0x55')](_0x156eae[_0xaba8('0x4b')][_0xaba8('0x5a')]);}return null;})[_0xaba8('0x20')](handleEntityNotFound(_0x4496ce,null))[_0xaba8('0x20')](respondWithStatusCode(_0x4496ce,null))[_0xaba8('0x4a')](handleError(_0x4496ce,null));};exports['removeQueues']=function(_0x50b839,_0x4c2069,_0x2f862b){return db['Team'][_0xaba8('0x57')]({'where':{'id':_0x50b839[_0xaba8('0x3f')]['id']}})['then'](function(_0x21d671){if(_0x21d671){if(!_0x50b839['query'][_0xaba8('0x4c')]||!utils['isValidChannel'](_0x50b839['query']['channel'])){throw new db[(_0xaba8('0x58'))][(_0xaba8('0x4e'))](_0xaba8('0x4f'));}return _0x21d671['remove'+_['capitalize'](_0x50b839['query'][_0xaba8('0x4c')]['toLowerCase']())+_0xaba8('0x55')](_0x50b839[_0xaba8('0x2b')][_0xaba8('0x5a')]);}return null;})['then'](handleEntityNotFound(_0x4c2069,null))[_0xaba8('0x20')](respondWithStatusCode(_0x4c2069,null))[_0xaba8('0x4a')](handleError(_0x4c2069,null));};exports['addAgents']=function(_0x482bc0,_0x536d27,_0x5f5173){return db['Team'][_0xaba8('0x41')]({'where':{'id':_0x482bc0[_0xaba8('0x3f')]['id']}})[_0xaba8('0x20')](handleEntityNotFound(_0x536d27,null))['then'](function(_0x176c76){if(_0x176c76){var _0x80d7c=['Voice',_0xaba8('0x5b'),_0xaba8('0x5c'),_0xaba8('0x5d'),_0xaba8('0x5e'),'Openchannel',_0xaba8('0x5f')];return BPromise['each'](_0x80d7c,function(_0x24ef5f){return _0x176c76['get'+_0x24ef5f+_0xaba8('0x55')]({'attributes':['id','name']})[_0xaba8('0x20')](function(_0x32015a){return BPromise['each'](_0x32015a,function(_0x2ef9ce){return _0x2ef9ce[_0xaba8('0x60')](_0x482bc0['body'][_0xaba8('0x5a')])['then'](function(){if(_0x24ef5f==='Voice'){return db['User'][_0xaba8('0x3c')]({'where':{'id':_0x482bc0[_0xaba8('0x4b')][_0xaba8('0x5a')]},'attributes':['id',_0xaba8('0x24'),'online',_0xaba8('0x61'),_0xaba8('0x62')],'raw':!![]})[_0xaba8('0x20')](function(_0x3b2896){return BPromise[_0xaba8('0x63')](_[_0xaba8('0x64')](_0x3b2896,{'online':0x1}),function(_0x5e83b7){return db[_0xaba8('0x65')][_0xaba8('0x66')]({'membername':_0x5e83b7[_0xaba8('0x24')],'UserId':_0x5e83b7['id'],'queue_name':_0x2ef9ce['name'],'VoiceQueueId':_0x2ef9ce['id'],'interface':_[_0xaba8('0x67')](_0x5e83b7[_0xaba8('0x62')])?util[_0xaba8('0x68')](_0xaba8('0x69'),_0x5e83b7[_0xaba8('0x24')]):_0x5e83b7[_0xaba8('0x62')],'paused':_0x5e83b7[_0xaba8('0x61')]||![],'penalty':0x0});});});}});});})[_0xaba8('0x20')](function(){return _0x176c76;});})['then'](function(){return _0x176c76;});}})[_0xaba8('0x20')](function(_0x3d59d7){if(_0x3d59d7){return _0x3d59d7[_0xaba8('0x60')](_0x482bc0['body']['ids'],_[_0xaba8('0x6a')](_0x482bc0[_0xaba8('0x4b')],[_0xaba8('0x5a'),'id'])||{})['spread'](function(_0x5790d8){for(var _0x2dc51c=0x0;_0x2dc51c<_0x482bc0[_0xaba8('0x4b')][_0xaba8('0x5a')][_0xaba8('0x51')];_0x2dc51c+=0x1){socket[_0xaba8('0x6b')]('userTeam:save',{'UserId':_0x482bc0['body'][_0xaba8('0x5a')][_0x2dc51c],'TeamId':_0x482bc0[_0xaba8('0x3f')]['id']});}return _0x5790d8;});}})[_0xaba8('0x20')](respondWithResult(_0x536d27,null))['catch'](handleError(_0x536d27,null));};exports[_0xaba8('0x6c')]=function(_0x5250ed,_0x4d18aa,_0x4798b9){return db[_0xaba8('0x28')][_0xaba8('0x41')]({'where':{'id':_0x5250ed[_0xaba8('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4d18aa,null))[_0xaba8('0x20')](function(_0x4acefe){if(_0x4acefe){return BPromise[_0xaba8('0x63')]([_0xaba8('0x6d'),'chat',_0xaba8('0x6e'),_0xaba8('0x6f'),_0xaba8('0x70'),'openchannel',_0xaba8('0x71')],function(_0x5d9137){return _0x4acefe[_0xaba8('0x43')+_[_0xaba8('0x53')](_0x5d9137)+_0xaba8('0x55')]({'attributes':['id',_0xaba8('0x24')]})[_0xaba8('0x20')](function(_0x31dcb7){return BPromise[_0xaba8('0x63')](_0x31dcb7,function(_0xc25eb3){return _0xc25eb3['removeAgents'](_0x5250ed[_0xaba8('0x2b')][_0xaba8('0x5a')])[_0xaba8('0x20')](function(){if(_0x5d9137===_0xaba8('0x6d')){return db[_0xaba8('0x65')][_0xaba8('0x22')]({'where':{'VoiceQueueId':_0xc25eb3['id'],'UserId':_0x5250ed['query'][_0xaba8('0x5a')]}});}});});})['then'](function(){return _0x4acefe;});})[_0xaba8('0x20')](function(){return _0x4acefe;});}})[_0xaba8('0x20')](function(_0x534bd4){if(_0x534bd4){return _0x534bd4[_0xaba8('0x6c')](_0x5250ed[_0xaba8('0x2b')]['ids'])[_0xaba8('0x20')](function(){if(_['isArray'](_0x5250ed[_0xaba8('0x2b')]['ids'])){for(var _0x109a1a=0x0;_0x109a1a<_0x5250ed[_0xaba8('0x2b')][_0xaba8('0x5a')][_0xaba8('0x51')];_0x109a1a+=0x1){socket[_0xaba8('0x6b')]('userTeam:remove',{'UserId':Number(_0x5250ed[_0xaba8('0x2b')]['ids'][_0x109a1a]),'TeamId':Number(_0x5250ed[_0xaba8('0x3f')]['id'])});}}else{socket[_0xaba8('0x6b')]('userTeam:remove',{'UserId':Number(_0x5250ed[_0xaba8('0x2b')][_0xaba8('0x5a')]),'TeamId':Number(_0x5250ed['params']['id'])});}});}})[_0xaba8('0x20')](respondWithStatusCode(_0x4d18aa,null))[_0xaba8('0x4a')](handleError(_0x4d18aa,null));};exports[_0xaba8('0x72')]=function(_0x1b5f98,_0xfeaef,_0x9dc49d){var _0x1b3044={};var _0x323387={};var _0x2ab9cb;var _0x3ef83c;return db[_0xaba8('0x28')]['findOne']({'where':{'id':_0x1b5f98[_0xaba8('0x3f')]['id']}})['then'](handleEntityNotFound(_0xfeaef,null))['then'](function(_0x43df35){if(_0x43df35){_0x2ab9cb=_0x43df35;_0x323387[_0xaba8('0x2e')]=_[_0xaba8('0x2c')](db[_0xaba8('0x73')][_0xaba8('0x29')]);_0x323387[_0xaba8('0x2b')]=_[_0xaba8('0x2c')](_0x1b5f98[_0xaba8('0x2b')]);_0x323387[_0xaba8('0x35')]=_[_0xaba8('0x2d')](_0x323387[_0xaba8('0x2e')],_0x323387[_0xaba8('0x2b')]);_0x1b3044[_0xaba8('0x30')]=_[_0xaba8('0x2d')](_0x323387[_0xaba8('0x2e')],qs['fields'](_0x1b5f98[_0xaba8('0x2b')][_0xaba8('0x2f')]));_0x1b3044[_0xaba8('0x30')]=_0x1b3044[_0xaba8('0x30')]['length']?_0x1b3044[_0xaba8('0x30')]:_0x323387[_0xaba8('0x2e')];_0x1b3044[_0xaba8('0x52')]=qs[_0xaba8('0x33')](_0x1b5f98[_0xaba8('0x2b')][_0xaba8('0x33')]);_0x1b3044[_0xaba8('0x34')]=qs[_0xaba8('0x35')](_['pick'](_0x1b5f98['query'],_0x323387['filters']));if(_0x1b5f98[_0xaba8('0x2b')][_0xaba8('0x64')]){_0x1b3044['where']=_[_0xaba8('0x37')](_0x1b3044[_0xaba8('0x34')],{'$or':_['map'](_0x1b3044[_0xaba8('0x30')],function(_0x3fa28b){var _0x5746ed={};_0x5746ed[_0x3fa28b]={'$like':'%'+_0x1b5f98[_0xaba8('0x2b')][_0xaba8('0x64')]+'%'};return _0x5746ed;})});}_0x1b3044=_[_0xaba8('0x37')]({},_0x1b3044,_0x1b5f98['options']);return _0x2ab9cb[_0xaba8('0x72')](_0x1b3044);}})[_0xaba8('0x20')](function(_0x2cad09){if(_0x2cad09){_0x3ef83c=_0x2cad09[_0xaba8('0x51')];if(!_0x1b5f98[_0xaba8('0x2b')]['hasOwnProperty'](_0xaba8('0x32'))){_0x1b3044['limit']=qs['limit'](_0x1b5f98[_0xaba8('0x2b')]['limit']);_0x1b3044[_0xaba8('0x1b')]=qs['offset'](_0x1b5f98[_0xaba8('0x2b')][_0xaba8('0x1b')]);}return _0x2ab9cb['getAgents'](_0x1b3044);}})['then'](function(_0x298c69){if(_0x298c69){return _0x298c69?{'count':_0x3ef83c,'rows':_0x298c69}:null;}})[_0xaba8('0x20')](respondWithResult(_0xfeaef,null))[_0xaba8('0x4a')](handleError(_0xfeaef,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 69aa1e8..b93f093 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 _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 +var _0x86e7=['../../mysqldb','Team','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x4379e1,_0x751b8b){var _0x1d490a=function(_0x22b464){while(--_0x22b464){_0x4379e1['push'](_0x4379e1['shift']());}};_0x1d490a(++_0x751b8b);}(_0x86e7,0xfb));var _0x786e=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x86e7[_0x3ce2c4];return _0x4047c1;};'use strict';var EventEmitter=require(_0x786e('0x0'));var Team=require(_0x786e('0x1'))['db'][_0x786e('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x786e('0x3')](0x0);var events={'afterCreate':_0x786e('0x4'),'afterUpdate':_0x786e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x41f651){return function(_0x192762,_0x25c41c,_0x578a10){TeamEvents[_0x786e('0x6')](_0x41f651+':'+_0x192762['id'],_0x192762);TeamEvents[_0x786e('0x6')](_0x41f651,_0x192762);_0x578a10(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x786e('0x7')](e,emitEvent(event));}}module[_0x786e('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 2b26104..faceada 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 _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 +var _0x513f=['lodash','util','../../config/logger','api','moment','bluebird','path','./team.attributes','exports','define','Team','teams'];(function(_0x2af689,_0x25b2bf){var _0x105b05=function(_0x4870f2){while(--_0x4870f2){_0x2af689['push'](_0x2af689['shift']());}};_0x105b05(++_0x25b2bf);}(_0x513f,0xc0));var _0xf513=function(_0x343b86,_0x570a2e){_0x343b86=_0x343b86-0x0;var _0x18ec41=_0x513f[_0x343b86];return _0x18ec41;};'use strict';var _=require(_0xf513('0x0'));var util=require(_0xf513('0x1'));var logger=require(_0xf513('0x2'))(_0xf513('0x3'));var moment=require(_0xf513('0x4'));var BPromise=require(_0xf513('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf513('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf513('0x7'));module[_0xf513('0x8')]=function(_0x32c77e,_0x461dcc){return _0x32c77e[_0xf513('0x9')](_0xf513('0xa'),attributes,{'tableName':_0xf513('0xb'),'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 682d4c3..6a122dc 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 _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 +var _0x1b18=['message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x1f5fa9,_0x5cec46){var _0x3cb6e0=function(_0x5f0b49){while(--_0x5f0b49){_0x1f5fa9['push'](_0x1f5fa9['shift']());}};_0x3cb6e0(++_0x5cec46);}(_0x1b18,0xc9));var _0x81b1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1b18[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x81b1('0x0'));var util=require(_0x81b1('0x1'));var moment=require(_0x81b1('0x2'));var BPromise=require(_0x81b1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x81b1('0x4'));var db=require(_0x81b1('0x5'))['db'];var utils=require(_0x81b1('0x6'));var logger=require(_0x81b1('0x7'))(_0x81b1('0x8'));var config=require(_0x81b1('0x9'));var jayson=require(_0x81b1('0xa'));var client=jayson['client'][_0x81b1('0xb')]({'port':0x232a});config[_0x81b1('0xc')]=_[_0x81b1('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x81b1('0xe'))(new Redis(config[_0x81b1('0xc')]));require(_0x81b1('0xf'))['register'](socket);function respondWithRpcPromise(_0x218101,_0x26b01c,_0x58a74c){return new BPromise(function(_0x5b2242,_0x580858){return client[_0x81b1('0x10')](_0x218101,_0x58a74c)[_0x81b1('0x11')](function(_0x11f19d){logger[_0x81b1('0x12')](_0x81b1('0x13'),_0x26b01c,_0x81b1('0x14'));logger[_0x81b1('0x15')]('Team,\x20%s,\x20%s,\x20%s',_0x26b01c,_0x81b1('0x14'),JSON['stringify'](_0x11f19d));if(_0x11f19d[_0x81b1('0x16')]){if(_0x11f19d[_0x81b1('0x16')][_0x81b1('0x17')]===0x1f4){logger[_0x81b1('0x16')](_0x81b1('0x13'),_0x26b01c,_0x11f19d[_0x81b1('0x16')][_0x81b1('0x18')]);return _0x580858(_0x11f19d[_0x81b1('0x16')]['message']);}logger[_0x81b1('0x16')](_0x81b1('0x13'),_0x26b01c,_0x11f19d[_0x81b1('0x16')][_0x81b1('0x18')]);return _0x5b2242(_0x11f19d[_0x81b1('0x16')][_0x81b1('0x18')]);}else{logger[_0x81b1('0x12')](_0x81b1('0x13'),_0x26b01c,_0x81b1('0x14'));_0x5b2242(_0x11f19d['result'][_0x81b1('0x18')]);}})['catch'](function(_0x1de85a){logger[_0x81b1('0x16')](_0x81b1('0x13'),_0x26b01c,_0x1de85a);_0x580858(_0x1de85a);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index f5ca4c0..5acce92 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 _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 +var _0x06ae=['length','save','remove','update','emit'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0x06ae,0x16e));var _0xe06a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x06ae[_0xa464c9];return _0x3d73c4;};'use strict';var TeamEvents=require('./team.events');var events=[_0xe06a('0x0'),_0xe06a('0x1'),_0xe06a('0x2')];function createListener(_0x2f7d69,_0xbfddd7){return function(_0x145ff8){_0xbfddd7[_0xe06a('0x3')](_0x2f7d69,_0x145ff8);};}function removeListener(_0x1d695f,_0x1e7706){return function(){TeamEvents['removeListener'](_0x1d695f,_0x1e7706);};}exports['register']=function(_0x50e6cf){for(var _0x1df79f=0x0,_0x745f79=events[_0xe06a('0x4')];_0x1df79f<_0x745f79;_0x1df79f++){var _0x3dfa60=events[_0x1df79f];var _0x1ea66c=createListener('team:'+_0x3dfa60,_0x50e6cf);TeamEvents['on'](_0x3dfa60,_0x1ea66c);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index d562912..ecf1ecc 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 _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 +var _0xf895=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./template.controller','isAuthenticated','get','/:id','post','create'];(function(_0xcd4c5b,_0x2152b6){var _0x17d55e=function(_0x4ec8db){while(--_0x4ec8db){_0xcd4c5b['push'](_0xcd4c5b['shift']());}};_0x17d55e(++_0x2152b6);}(_0xf895,0x1e1));var _0x5f89=function(_0x1bf29f,_0x33cb02){_0x1bf29f=_0x1bf29f-0x0;var _0x4aa579=_0xf895[_0x1bf29f];return _0x4aa579;};'use strict';var multer=require(_0x5f89('0x0'));var util=require('util');var path=require(_0x5f89('0x1'));var timeout=require(_0x5f89('0x2'));var express=require(_0x5f89('0x3'));var router=express['Router']();var auth=require(_0x5f89('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5f89('0x5'));var controller=require(_0x5f89('0x6'));router['get']('/',auth[_0x5f89('0x7')](),controller['index']);router[_0x5f89('0x8')](_0x5f89('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x5f89('0xa')]('/',auth[_0x5f89('0x7')](),controller[_0x5f89('0xb')]);router[_0x5f89('0xc')]('/:id',auth[_0x5f89('0x7')](),controller[_0x5f89('0xd')]);router[_0x5f89('0xe')](_0x5f89('0x9'),auth[_0x5f89('0x7')](),controller[_0x5f89('0xf')]);module[_0x5f89('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index d41b0ad..3bb25d9 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 _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 +var _0x33a8=['STRING','TEXT','exports'];(function(_0x40cbbc,_0x56a82f){var _0x9c166d=function(_0x14fd0f){while(--_0x14fd0f){_0x40cbbc['push'](_0x40cbbc['shift']());}};_0x9c166d(++_0x56a82f);}(_0x33a8,0x1a0));var _0x833a=function(_0x26939f,_0x135815){_0x26939f=_0x26939f-0x0;var _0x3197dd=_0x33a8[_0x26939f];return _0x3197dd;};'use strict';var Sequelize=require('sequelize');module[_0x833a('0x0')]={'name':{'type':Sequelize[_0x833a('0x1')]},'description':{'type':Sequelize[_0x833a('0x1')]},'html':{'type':Sequelize[_0x833a('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 06a05cc..5fefabf 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 _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 +var _0x7a54=['fields','attributes','nolimit','order','sort','where','filters','pick','merge','options','count','includeAll','include','findAll','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Template','rawAttributes','type','key','model','map','keys','query','intersection'];(function(_0x7e3412,_0x2656be){var _0x395335=function(_0x44f719){while(--_0x44f719){_0x7e3412['push'](_0x7e3412['shift']());}};_0x395335(++_0x2656be);}(_0x7a54,0x106));var _0x47a5=function(_0x4c1d0a,_0x3e5fe4){_0x4c1d0a=_0x4c1d0a-0x0;var _0xeb2217=_0x7a54[_0x4c1d0a];return _0xeb2217;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=_0x11faf5['count'],_0x2a2cbb=_0x362359[_0x47a5('0x1a')],_0x1ef44c=_0x362359['offset']+_0x362359['limit'],_0x574af6;if(_0x1ef44c>=_0x3b001e){_0x1ef44c=_0x3b001e;_0x574af6=0xc8;}else{_0x574af6=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x574af6);return _0x4e99a8[_0x47a5('0x1b')](_0x47a5('0x1c'),_0x2a2cbb+'-'+_0x1ef44c+'/'+_0x3b001e)[_0x47a5('0x19')](_0x11faf5);}return null;};}function patchUpdates(_0x477b1d){return function(_0x12b98e){try{jsonpatch[_0x47a5('0x1d')](_0x12b98e,_0x477b1d,!![]);}catch(_0xe3c618){return BPromise[_0x47a5('0x1e')](_0xe3c618);}return _0x12b98e['save']();};}function saveUpdates(_0x1570bc,_0xf160ba){return function(_0x47cf3c){if(_0x47cf3c){return _0x47cf3c[_0x47a5('0x1f')](_0x1570bc)[_0x47a5('0x20')](function(_0x36874d){return _0x36874d;});}return null;};}function removeEntity(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x21')]()[_0x47a5('0x20')](function(){var _0x5ef1b1=_0x2f142b[_0x47a5('0x22')]({'plain':!![]});var _0x385687='Templates';return db[_0x47a5('0x23')][_0x47a5('0x21')]({'where':{'type':_0x385687,'resourceId':_0x5ef1b1['id']}})[_0x47a5('0x20')](function(){return _0x2f142b;});})[_0x47a5('0x20')](function(){_0x4c5910[_0x47a5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53078a,_0x136745){return function(_0x5686db){if(!_0x5686db){_0x53078a[_0x47a5('0x16')](0x194);}return _0x5686db;};}function handleError(_0x5b6c4e,_0x23cb77){_0x23cb77=_0x23cb77||0x1f4;return function(_0x378208){logger[_0x47a5('0x24')](_0x378208[_0x47a5('0x25')]);if(_0x378208[_0x47a5('0x26')]){delete _0x378208[_0x47a5('0x26')];}_0x5b6c4e[_0x47a5('0x17')](_0x23cb77)[_0x47a5('0x27')](_0x378208);};}exports[_0x47a5('0x28')]=function(_0x361bfa,_0x1127f8){var _0x11a4fa={},_0x3ad507={},_0x528582={'count':0x0,'rows':[]};var _0x243210=_['map'](db[_0x47a5('0x29')][_0x47a5('0x2a')],function(_0x16901f){return{'name':_0x16901f['fieldName'],'type':_0x16901f[_0x47a5('0x2b')][_0x47a5('0x2c')]};});_0x3ad507[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x243210,'name');_0x3ad507['query']=_[_0x47a5('0x2f')](_0x361bfa[_0x47a5('0x30')]);_0x3ad507['filters']=_['intersection'](_0x3ad507[_0x47a5('0x2d')],_0x3ad507[_0x47a5('0x30')]);_0x11a4fa['attributes']=_[_0x47a5('0x31')](_0x3ad507['model'],qs[_0x47a5('0x32')](_0x361bfa[_0x47a5('0x30')]['fields']));_0x11a4fa['attributes']=_0x11a4fa[_0x47a5('0x33')]['length']?_0x11a4fa[_0x47a5('0x33')]:_0x3ad507[_0x47a5('0x2d')];if(!_0x361bfa[_0x47a5('0x30')]['hasOwnProperty'](_0x47a5('0x34'))){_0x11a4fa['limit']=qs['limit'](_0x361bfa[_0x47a5('0x30')]['limit']);_0x11a4fa[_0x47a5('0x1a')]=qs['offset'](_0x361bfa[_0x47a5('0x30')][_0x47a5('0x1a')]);}_0x11a4fa[_0x47a5('0x35')]=qs[_0x47a5('0x36')](_0x361bfa[_0x47a5('0x30')][_0x47a5('0x36')]);_0x11a4fa[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_[_0x47a5('0x39')](_0x361bfa['query'],_0x3ad507[_0x47a5('0x38')]),_0x243210);if(_0x361bfa[_0x47a5('0x30')]['filter']){_0x11a4fa[_0x47a5('0x37')]=_[_0x47a5('0x3a')](_0x11a4fa[_0x47a5('0x37')],{'$or':_['map'](_0x243210,function(_0x101f70){if(_0x101f70[_0x47a5('0x2b')]!=='VIRTUAL'){var _0x2ebba0={};_0x2ebba0[_0x101f70[_0x47a5('0x26')]]={'$like':'%'+_0x361bfa['query']['filter']+'%'};return _0x2ebba0;}})});}_0x11a4fa=_['merge']({},_0x11a4fa,_0x361bfa[_0x47a5('0x3b')]);var _0x5c569e={'where':_0x11a4fa[_0x47a5('0x37')]};return db[_0x47a5('0x29')][_0x47a5('0x3c')](_0x5c569e)[_0x47a5('0x20')](function(_0x1b2c80){_0x528582[_0x47a5('0x3c')]=_0x1b2c80;if(_0x361bfa[_0x47a5('0x30')][_0x47a5('0x3d')]){_0x11a4fa[_0x47a5('0x3e')]=[{'all':!![]}];}return db[_0x47a5('0x29')][_0x47a5('0x3f')](_0x11a4fa);})[_0x47a5('0x20')](function(_0x23d6d8){_0x528582['rows']=_0x23d6d8;return _0x528582;})[_0x47a5('0x20')](respondWithFilteredResult(_0x1127f8,_0x11a4fa))[_0x47a5('0x40')](handleError(_0x1127f8,null));};exports[_0x47a5('0x41')]=function(_0x23bd8d,_0x586f4f){var _0x7de536={'raw':!![],'where':{'id':_0x23bd8d['params']['id']}},_0x528ef3={};_0x528ef3['model']=_['keys'](db[_0x47a5('0x29')]['rawAttributes']);_0x528ef3[_0x47a5('0x30')]=_[_0x47a5('0x2f')](_0x23bd8d[_0x47a5('0x30')]);_0x528ef3['filters']=_[_0x47a5('0x31')](_0x528ef3[_0x47a5('0x2d')],_0x528ef3['query']);_0x7de536['attributes']=_[_0x47a5('0x31')](_0x528ef3['model'],qs[_0x47a5('0x32')](_0x23bd8d[_0x47a5('0x30')][_0x47a5('0x32')]));_0x7de536[_0x47a5('0x33')]=_0x7de536[_0x47a5('0x33')][_0x47a5('0x42')]?_0x7de536[_0x47a5('0x33')]:_0x528ef3[_0x47a5('0x2d')];if(_0x23bd8d[_0x47a5('0x30')][_0x47a5('0x3d')]){_0x7de536[_0x47a5('0x3e')]=[{'all':!![]}];}_0x7de536=_[_0x47a5('0x3a')]({},_0x7de536,_0x23bd8d[_0x47a5('0x3b')]);return db[_0x47a5('0x29')][_0x47a5('0x43')](_0x7de536)[_0x47a5('0x20')](handleEntityNotFound(_0x586f4f,null))['then'](respondWithResult(_0x586f4f,null))[_0x47a5('0x40')](handleError(_0x586f4f,null));};exports[_0x47a5('0x44')]=function(_0x49eab1,_0x52b3a8){return db[_0x47a5('0x29')]['create'](_0x49eab1[_0x47a5('0x45')],{})[_0x47a5('0x20')](function(_0x54c35f){var _0x4f62d3=_0x49eab1[_0x47a5('0x46')]['get']({'plain':!![]});if(!_0x4f62d3)throw new Error(_0x47a5('0x47'));if(_0x4f62d3[_0x47a5('0x48')]===_0x47a5('0x46')){var _0x3e12a7=_0x54c35f[_0x47a5('0x22')]({'plain':!![]});var _0x26acd2=_0x47a5('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x26acd2,'userProfileId':_0x4f62d3[_0x47a5('0x4a')]},'raw':!![]})[_0x47a5('0x20')](function(_0x1163e3){if(_0x1163e3&&_0x1163e3[_0x47a5('0x4b')]===0x0){return db[_0x47a5('0x23')][_0x47a5('0x44')]({'name':_0x3e12a7[_0x47a5('0x26')],'resourceId':_0x3e12a7['id'],'type':_0x1163e3['name'],'sectionId':_0x1163e3['id']},{})[_0x47a5('0x20')](function(){return _0x54c35f;});}else{return _0x54c35f;}})[_0x47a5('0x40')](function(_0x5f6a){logger['error'](_0x47a5('0x4c'),_0x5f6a);throw _0x5f6a;});}return _0x54c35f;})['then'](respondWithResult(_0x52b3a8,0xc9))[_0x47a5('0x40')](handleError(_0x52b3a8,null));};exports[_0x47a5('0x1f')]=function(_0x46e90b,_0xf03bd5){if(_0x46e90b['body']['id']){delete _0x46e90b[_0x47a5('0x45')]['id'];}return db[_0x47a5('0x29')][_0x47a5('0x43')]({'where':{'id':_0x46e90b[_0x47a5('0x4d')]['id']}})[_0x47a5('0x20')](handleEntityNotFound(_0xf03bd5,null))[_0x47a5('0x20')](saveUpdates(_0x46e90b[_0x47a5('0x45')],null))['then'](respondWithResult(_0xf03bd5,null))[_0x47a5('0x40')](handleError(_0xf03bd5,null));};exports[_0x47a5('0x21')]=function(_0x187d7e,_0x8da9fb){return db[_0x47a5('0x29')][_0x47a5('0x43')]({'where':{'id':_0x187d7e['params']['id']}})[_0x47a5('0x20')](handleEntityNotFound(_0x8da9fb,null))[_0x47a5('0x20')](removeEntity(_0x8da9fb,null))[_0x47a5('0x40')](handleError(_0x8da9fb,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index c2570d7..23db06d 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 _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 +var _0xa1b1=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','util'];(function(_0x293254,_0x5477d3){var _0x30e808=function(_0x5a99fb){while(--_0x5a99fb){_0x293254['push'](_0x293254['shift']());}};_0x30e808(++_0x5477d3);}(_0xa1b1,0x187));var _0x1a1b=function(_0x3520a3,_0x585b4e){_0x3520a3=_0x3520a3-0x0;var _0x266257=_0xa1b1[_0x3520a3];return _0x266257;};'use strict';var _=require('lodash');var util=require(_0x1a1b('0x0'));var logger=require(_0x1a1b('0x1'))(_0x1a1b('0x2'));var moment=require(_0x1a1b('0x3'));var BPromise=require(_0x1a1b('0x4'));var rp=require(_0x1a1b('0x5'));var fs=require('fs');var path=require(_0x1a1b('0x6'));var rimraf=require(_0x1a1b('0x7'));var config=require(_0x1a1b('0x8'));var attributes=require(_0x1a1b('0x9'));module[_0x1a1b('0xa')]=function(_0x266bad,_0x20f6d0){return _0x266bad[_0x1a1b('0xb')](_0x1a1b('0xc'),attributes,{'tableName':_0x1a1b('0xd'),'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 52a92dc..2d01351 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 _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 +var _0x18af=['request','then','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','info','Template,\x20%s,\x20%s','result','catch','GetTemplate','options','raw','where','attributes','limit','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x51eafa,_0x26ac6d){var _0x12b345=function(_0x513ef5){while(--_0x513ef5){_0x51eafa['push'](_0x51eafa['shift']());}};_0x12b345(++_0x26ac6d);}(_0x18af,0x16a));var _0xf18a=function(_0xb86674,_0x50e4ef){_0xb86674=_0xb86674-0x0;var _0x39db0c=_0x18af[_0xb86674];return _0x39db0c;};'use strict';var _=require(_0xf18a('0x0'));var util=require(_0xf18a('0x1'));var moment=require(_0xf18a('0x2'));var BPromise=require(_0xf18a('0x3'));var rs=require(_0xf18a('0x4'));var fs=require('fs');var Redis=require(_0xf18a('0x5'));var db=require(_0xf18a('0x6'))['db'];var utils=require(_0xf18a('0x7'));var logger=require(_0xf18a('0x8'))('rpc');var config=require(_0xf18a('0x9'));var jayson=require(_0xf18a('0xa'));var client=jayson[_0xf18a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x351dce,_0x3f242d,_0x605b3c){return new BPromise(function(_0xd4ca35,_0x51660c){return client[_0xf18a('0xc')](_0x351dce,_0x605b3c)[_0xf18a('0xd')](function(_0x11110d){logger['info']('Template,\x20%s,\x20%s',_0x3f242d,_0xf18a('0xe'));logger[_0xf18a('0xf')](_0xf18a('0x10'),_0x3f242d,_0xf18a('0xe'),JSON['stringify'](_0x11110d));if(_0x11110d[_0xf18a('0x11')]){if(_0x11110d[_0xf18a('0x11')][_0xf18a('0x12')]===0x1f4){logger[_0xf18a('0x11')]('Template,\x20%s,\x20%s',_0x3f242d,_0x11110d[_0xf18a('0x11')][_0xf18a('0x13')]);return _0x51660c(_0x11110d['error']['message']);}logger[_0xf18a('0x11')]('Template,\x20%s,\x20%s',_0x3f242d,_0x11110d[_0xf18a('0x11')][_0xf18a('0x13')]);return _0xd4ca35(_0x11110d['error'][_0xf18a('0x13')]);}else{logger[_0xf18a('0x14')](_0xf18a('0x15'),_0x3f242d,_0xf18a('0xe'));_0xd4ca35(_0x11110d[_0xf18a('0x16')][_0xf18a('0x13')]);}})[_0xf18a('0x17')](function(_0x202f99){logger[_0xf18a('0x11')](_0xf18a('0x15'),_0x3f242d,_0x202f99);_0x51660c(_0x202f99);});});}exports[_0xf18a('0x18')]=function(_0x53ffac){var _0x53daaf=this;return new Promise(function(_0x41c850,_0x770a02){return db['Template']['findAll']({'raw':_0x53ffac['options']?_0x53ffac[_0xf18a('0x19')][_0xf18a('0x1a')]===undefined?!![]:![]:!![],'where':_0x53ffac[_0xf18a('0x19')]?_0x53ffac[_0xf18a('0x19')][_0xf18a('0x1b')]||null:null,'attributes':_0x53ffac[_0xf18a('0x19')]?_0x53ffac[_0xf18a('0x19')][_0xf18a('0x1c')]||null:null,'limit':_0x53ffac[_0xf18a('0x19')]?_0x53ffac[_0xf18a('0x19')][_0xf18a('0x1d')]||null:null,'include':_0x53ffac[_0xf18a('0x19')]?_0x53ffac[_0xf18a('0x19')][_0xf18a('0x1e')]?_[_0xf18a('0x1f')](_0x53ffac[_0xf18a('0x19')][_0xf18a('0x1e')],function(_0x71c7c6){return{'model':db[_0x71c7c6['model']],'as':_0x71c7c6['as'],'attributes':_0x71c7c6[_0xf18a('0x1c')],'include':_0x71c7c6[_0xf18a('0x1e')]?_[_0xf18a('0x1f')](_0x71c7c6[_0xf18a('0x1e')],function(_0x1dc3e3){return{'model':db[_0x1dc3e3[_0xf18a('0x20')]],'as':_0x1dc3e3['as'],'attributes':_0x1dc3e3[_0xf18a('0x1c')],'include':_0x1dc3e3['include']?_[_0xf18a('0x1f')](_0x1dc3e3[_0xf18a('0x1e')],function(_0x49d263){return{'model':db[_0x49d263[_0xf18a('0x20')]],'as':_0x49d263['as'],'attributes':_0x49d263[_0xf18a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf18a('0xd')](function(_0x533bba){logger['info']('GetTemplate',_0x53ffac);logger[_0xf18a('0xf')](_0xf18a('0x18'),_0x53ffac,JSON[_0xf18a('0x21')](_0x533bba));_0x41c850(_0x533bba);})[_0xf18a('0x17')](function(_0x4443a4){logger['error'](_0xf18a('0x18'),_0x4443a4[_0xf18a('0x13')],_0x53ffac);_0x770a02(_0x53daaf['error'](0x1f4,_0x4443a4['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 837d5c2..996758c 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 _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 +var _0xe8ae=['isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getActions','create','post','addAnyCondition','/:id/actions','addAction','put','update','delete','exports','multer','util','path','express','../../components/auth/service','./trigger.controller','get'];(function(_0x313916,_0x2b721b){var _0x2c2d44=function(_0x8802e6){while(--_0x8802e6){_0x313916['push'](_0x313916['shift']());}};_0x2c2d44(++_0x2b721b);}(_0xe8ae,0x152));var _0xee8a=function(_0x428506,_0xb4a965){_0x428506=_0x428506-0x0;var _0x2c4596=_0xe8ae[_0x428506];return _0x2c4596;};'use strict';var multer=require(_0xee8a('0x0'));var util=require(_0xee8a('0x1'));var path=require(_0xee8a('0x2'));var timeout=require('connect-timeout');var express=require(_0xee8a('0x3'));var router=express['Router']();var auth=require(_0xee8a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xee8a('0x5'));router[_0xee8a('0x6')]('/',auth[_0xee8a('0x7')](),controller['index']);router[_0xee8a('0x6')](_0xee8a('0x8'),auth[_0xee8a('0x7')](),controller[_0xee8a('0x9')]);router[_0xee8a('0x6')](_0xee8a('0xa'),auth[_0xee8a('0x7')](),controller[_0xee8a('0xb')]);router['get'](_0xee8a('0xc'),auth[_0xee8a('0x7')](),controller['getAnyConditions']);router['get']('/:id/actions',auth[_0xee8a('0x7')](),controller[_0xee8a('0xd')]);router['post']('/',auth[_0xee8a('0x7')](),controller[_0xee8a('0xe')]);router['post'](_0xee8a('0xa'),auth[_0xee8a('0x7')](),controller['addAllCondition']);router[_0xee8a('0xf')](_0xee8a('0xc'),auth[_0xee8a('0x7')](),controller[_0xee8a('0x10')]);router[_0xee8a('0xf')](_0xee8a('0x11'),auth['isAuthenticated'](),controller[_0xee8a('0x12')]);router[_0xee8a('0x13')]('/:id',auth[_0xee8a('0x7')](),controller[_0xee8a('0x14')]);router[_0xee8a('0x15')](_0xee8a('0x8'),auth[_0xee8a('0x7')](),controller['destroy']);module[_0xee8a('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 017a208..3396e29 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 _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 +var _0x2e29=['exports','STRING','BOOLEAN','sequelize'];(function(_0x1e38bd,_0xc29d61){var _0x533bd9=function(_0x3d4a21){while(--_0x3d4a21){_0x1e38bd['push'](_0x1e38bd['shift']());}};_0x533bd9(++_0xc29d61);}(_0x2e29,0x8f));var _0x92e2=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x2e29[_0x1a36a5];return _0x746243;};'use strict';var Sequelize=require(_0x92e2('0x0'));module[_0x92e2('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x92e2('0x2')]},'description':{'type':Sequelize[_0x92e2('0x2')]},'status':{'type':Sequelize[_0x92e2('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 7c578c7..d550ce8 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 _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 +var _0xf3ff=['bluebird','util','path','sox','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../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','reject','save','update','then','get','UserProfileResource','error','stack','name','send','map','Trigger','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','length','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','destroy','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','hasOwnProperty','getAnyConditions','addAction','Action','getActions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x44686e,_0x6b649d){var _0x552916=function(_0x53522d){while(--_0x53522d){_0x44686e['push'](_0x44686e['shift']());}};_0x552916(++_0x6b649d);}(_0xf3ff,0xae));var _0xff3f=function(_0x176d17,_0x5eb048){_0x176d17=_0x176d17-0x0;var _0x2e4a0b=_0xf3ff[_0x176d17];return _0x2e4a0b;};'use strict';var pdf=require(_0xff3f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xff3f('0x1'));var zipdir=require(_0xff3f('0x2'));var jsonpatch=require(_0xff3f('0x3'));var rp=require(_0xff3f('0x4'));var moment=require(_0xff3f('0x5'));var BPromise=require(_0xff3f('0x6'));var Mustache=require('mustache');var util=require(_0xff3f('0x7'));var path=require(_0xff3f('0x8'));var sox=require(_0xff3f('0x9'));var csv=require('to-csv');var ejs=require(_0xff3f('0xa'));var fs=require('fs');var _=require(_0xff3f('0xb'));var squel=require('squel');var crypto=require(_0xff3f('0xc'));var jsforce=require(_0xff3f('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xff3f('0xe'));var Redis=require('ioredis');var authService=require(_0xff3f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xff3f('0x10'));var hardwareService=require(_0xff3f('0x11'));var logger=require(_0xff3f('0x12'))(_0xff3f('0x13'));var utils=require(_0xff3f('0x14'));var config=require(_0xff3f('0x15'));var licenseUtil=require(_0xff3f('0x16'));var db=require(_0xff3f('0x17'))['db'];function respondWithStatusCode(_0x24a3c8,_0x2b5d15){_0x2b5d15=_0x2b5d15||0xcc;return function(_0x59fe19){if(_0x59fe19){return _0x24a3c8['sendStatus'](_0x2b5d15);}return _0x24a3c8[_0xff3f('0x18')](_0x2b5d15)[_0xff3f('0x19')]();};}function respondWithResult(_0x32f887,_0x4b3409){_0x4b3409=_0x4b3409||0xc8;return function(_0x54b52c){if(_0x54b52c){return _0x32f887[_0xff3f('0x18')](_0x4b3409)['json'](_0x54b52c);}};}function respondWithFilteredResult(_0x5ae3af,_0x2a7c79){return function(_0x95d895){if(_0x95d895){var _0x54e2a5=_0x95d895['count'],_0x195bea=_0x2a7c79[_0xff3f('0x1a')],_0x50225e=_0x2a7c79[_0xff3f('0x1a')]+_0x2a7c79[_0xff3f('0x1b')],_0x129647;if(_0x50225e>=_0x54e2a5){_0x50225e=_0x54e2a5;_0x129647=0xc8;}else{_0x129647=0xce;}_0x5ae3af['status'](_0x129647);return _0x5ae3af[_0xff3f('0x1c')](_0xff3f('0x1d'),_0x195bea+'-'+_0x50225e+'/'+_0x54e2a5)['json'](_0x95d895);}return null;};}function patchUpdates(_0x2d1d09){return function(_0x3a220b){try{jsonpatch[_0xff3f('0x1e')](_0x3a220b,_0x2d1d09,!![]);}catch(_0x2a0322){return BPromise[_0xff3f('0x1f')](_0x2a0322);}return _0x3a220b[_0xff3f('0x20')]();};}function saveUpdates(_0x2ffd20,_0xfd9c46){return function(_0x79a72e){if(_0x79a72e){return _0x79a72e[_0xff3f('0x21')](_0x2ffd20)[_0xff3f('0x22')](function(_0x28abcb){return _0x28abcb;});}return null;};}function removeEntity(_0x2daed4,_0x396044){return function(_0x52986f){if(_0x52986f){return _0x52986f['destroy']()[_0xff3f('0x22')](function(){var _0x53fbeb=_0x52986f[_0xff3f('0x23')]({'plain':!![]});var _0x2bbbb2='Triggers';return db[_0xff3f('0x24')]['destroy']({'where':{'type':_0x2bbbb2,'resourceId':_0x53fbeb['id']}})[_0xff3f('0x22')](function(){return _0x52986f;});})['then'](function(){_0x2daed4[_0xff3f('0x18')](0xcc)[_0xff3f('0x19')]();});}};}function handleEntityNotFound(_0x21cb5d,_0x2f3c83){return function(_0x44fb87){if(!_0x44fb87){_0x21cb5d['sendStatus'](0x194);}return _0x44fb87;};}function handleError(_0x579659,_0x32addc){_0x32addc=_0x32addc||0x1f4;return function(_0x4721f9){logger[_0xff3f('0x25')](_0x4721f9[_0xff3f('0x26')]);if(_0x4721f9[_0xff3f('0x27')]){delete _0x4721f9['name'];}_0x579659[_0xff3f('0x18')](_0x32addc)[_0xff3f('0x28')](_0x4721f9);};}exports['index']=function(_0x1f6d2a,_0x33a849){var _0x27a253={},_0xe269e6={},_0x3bdbfa={'count':0x0,'rows':[]};var _0x14ea17=_[_0xff3f('0x29')](db[_0xff3f('0x2a')][_0xff3f('0x2b')],function(_0x183922){return{'name':_0x183922['fieldName'],'type':_0x183922[_0xff3f('0x2c')]['key']};});_0xe269e6[_0xff3f('0x2d')]=_[_0xff3f('0x29')](_0x14ea17,_0xff3f('0x27'));_0xe269e6[_0xff3f('0x2e')]=_[_0xff3f('0x2f')](_0x1f6d2a[_0xff3f('0x2e')]);_0xe269e6[_0xff3f('0x30')]=_[_0xff3f('0x31')](_0xe269e6['model'],_0xe269e6['query']);_0x27a253[_0xff3f('0x32')]=_[_0xff3f('0x31')](_0xe269e6[_0xff3f('0x2d')],qs[_0xff3f('0x33')](_0x1f6d2a['query'][_0xff3f('0x33')]));_0x27a253[_0xff3f('0x32')]=_0x27a253[_0xff3f('0x32')]['length']?_0x27a253[_0xff3f('0x32')]:_0xe269e6[_0xff3f('0x2d')];if(!_0x1f6d2a[_0xff3f('0x2e')]['hasOwnProperty'](_0xff3f('0x34'))){_0x27a253['limit']=qs[_0xff3f('0x1b')](_0x1f6d2a[_0xff3f('0x2e')][_0xff3f('0x1b')]);_0x27a253[_0xff3f('0x1a')]=qs[_0xff3f('0x1a')](_0x1f6d2a['query']['offset']);}_0x27a253[_0xff3f('0x35')]=qs['sort'](_0x1f6d2a[_0xff3f('0x2e')][_0xff3f('0x36')]);_0x27a253[_0xff3f('0x37')]=qs[_0xff3f('0x30')](_[_0xff3f('0x38')](_0x1f6d2a[_0xff3f('0x2e')],_0xe269e6[_0xff3f('0x30')]),_0x14ea17);if(_0x1f6d2a[_0xff3f('0x2e')][_0xff3f('0x39')]){_0x27a253[_0xff3f('0x37')]=_[_0xff3f('0x3a')](_0x27a253[_0xff3f('0x37')],{'$or':_['map'](_0x14ea17,function(_0x48198a){if(_0x48198a['type']!==_0xff3f('0x3b')){var _0x4d63b8={};_0x4d63b8[_0x48198a['name']]={'$like':'%'+_0x1f6d2a[_0xff3f('0x2e')]['filter']+'%'};return _0x4d63b8;}})});}_0x27a253=_[_0xff3f('0x3a')]({},_0x27a253,_0x1f6d2a[_0xff3f('0x3c')]);var _0x383c95={'where':_0x27a253[_0xff3f('0x37')]};return db[_0xff3f('0x2a')][_0xff3f('0x3d')](_0x383c95)[_0xff3f('0x22')](function(_0x32ac31){_0x3bdbfa[_0xff3f('0x3d')]=_0x32ac31;if(_0x1f6d2a[_0xff3f('0x2e')][_0xff3f('0x3e')]){_0x27a253[_0xff3f('0x3f')]=[{'all':!![]}];}return db[_0xff3f('0x2a')]['findAll'](_0x27a253);})['then'](function(_0x47c13d){_0x3bdbfa[_0xff3f('0x40')]=_0x47c13d;return _0x3bdbfa;})[_0xff3f('0x22')](respondWithFilteredResult(_0x33a849,_0x27a253))['catch'](handleError(_0x33a849,null));};exports[_0xff3f('0x41')]=function(_0x27bd47,_0x1e57e8){var _0x83bde8={'raw':![],'where':{'id':_0x27bd47[_0xff3f('0x42')]['id']}},_0x49f05f={};_0x49f05f[_0xff3f('0x2d')]=_[_0xff3f('0x2f')](db[_0xff3f('0x2a')][_0xff3f('0x2b')]);_0x49f05f[_0xff3f('0x2e')]=_[_0xff3f('0x2f')](_0x27bd47[_0xff3f('0x2e')]);_0x49f05f['filters']=_[_0xff3f('0x31')](_0x49f05f['model'],_0x49f05f[_0xff3f('0x2e')]);_0x83bde8[_0xff3f('0x32')]=_['intersection'](_0x49f05f[_0xff3f('0x2d')],qs['fields'](_0x27bd47[_0xff3f('0x2e')]['fields']));_0x83bde8[_0xff3f('0x32')]=_0x83bde8[_0xff3f('0x32')][_0xff3f('0x43')]?_0x83bde8[_0xff3f('0x32')]:_0x49f05f[_0xff3f('0x2d')];if(_0x27bd47[_0xff3f('0x2e')]['includeAll']){_0x83bde8['include']=[{'all':!![]}];}_0x83bde8=_[_0xff3f('0x3a')]({},_0x83bde8,_0x27bd47[_0xff3f('0x3c')]);return db['Trigger'][_0xff3f('0x44')](_0x83bde8)[_0xff3f('0x22')](handleEntityNotFound(_0x1e57e8,null))['then'](respondWithResult(_0x1e57e8,null))[_0xff3f('0x45')](handleError(_0x1e57e8,null));};exports['create']=function(_0x58dff5,_0x3ba0c7){return db[_0xff3f('0x2a')][_0xff3f('0x46')](_0x58dff5['body'],{})[_0xff3f('0x22')](function(_0x4af5a0){var _0xec21bf=_0x58dff5[_0xff3f('0x47')][_0xff3f('0x23')]({'plain':!![]});if(!_0xec21bf)throw new Error(_0xff3f('0x48'));if(_0xec21bf[_0xff3f('0x49')]===_0xff3f('0x47')){var _0x52df1b=_0x4af5a0[_0xff3f('0x23')]({'plain':!![]});var _0x41265e='Triggers';return db[_0xff3f('0x4a')][_0xff3f('0x44')]({'where':{'name':_0x41265e,'userProfileId':_0xec21bf[_0xff3f('0x4b')]},'raw':!![]})[_0xff3f('0x22')](function(_0x319435){if(_0x319435&&_0x319435[_0xff3f('0x4c')]===0x0){return db[_0xff3f('0x24')][_0xff3f('0x46')]({'name':_0x52df1b[_0xff3f('0x27')],'resourceId':_0x52df1b['id'],'type':_0x319435[_0xff3f('0x27')],'sectionId':_0x319435['id']},{})['then'](function(){return _0x4af5a0;});}else{return _0x4af5a0;}})[_0xff3f('0x45')](function(_0x3de785){logger[_0xff3f('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3de785);throw _0x3de785;});}return _0x4af5a0;})[_0xff3f('0x22')](respondWithResult(_0x3ba0c7,0xc9))[_0xff3f('0x45')](handleError(_0x3ba0c7,null));};exports[_0xff3f('0x21')]=function(_0xf09e40,_0x554dc3){if(_0xf09e40['body']['id']){delete _0xf09e40[_0xff3f('0x4d')]['id'];}return db['Trigger'][_0xff3f('0x44')]({'where':{'id':_0xf09e40['params']['id']}})['then'](handleEntityNotFound(_0x554dc3,null))['then'](saveUpdates(_0xf09e40[_0xff3f('0x4d')],null))[_0xff3f('0x22')](respondWithResult(_0x554dc3,null))[_0xff3f('0x45')](handleError(_0x554dc3,null));};exports[_0xff3f('0x4e')]=function(_0x5cd12d,_0x582ec9){return db['Trigger']['find']({'where':{'id':_0x5cd12d[_0xff3f('0x42')]['id']}})['then'](handleEntityNotFound(_0x582ec9,null))[_0xff3f('0x22')](removeEntity(_0x582ec9,null))['catch'](handleError(_0x582ec9,null));};exports[_0xff3f('0x4f')]=function(_0x3c20b3,_0x3b0f6b,_0x30f326){if(_0x3c20b3[_0xff3f('0x4d')]['id']){delete _0x3c20b3[_0xff3f('0x4d')]['id'];}return db['Trigger']['find']({'where':{'id':_0x3c20b3[_0xff3f('0x42')]['id']}})[_0xff3f('0x22')](handleEntityNotFound(_0x3b0f6b,null))['then'](function(_0x4583d9){if(_0x4583d9){_0x3c20b3[_0xff3f('0x4d')][_0xff3f('0x50')]=_0x4583d9['id'];return db[_0xff3f('0x51')][_0xff3f('0x46')](_0x3c20b3[_0xff3f('0x4d')]);}})[_0xff3f('0x22')](respondWithResult(_0x3b0f6b,null))['catch'](handleError(_0x3b0f6b,null));};exports[_0xff3f('0x52')]=function(_0x5f22e0,_0x5d2c37,_0x673bf){if(_0x5f22e0[_0xff3f('0x4d')]['id']){delete _0x5f22e0[_0xff3f('0x4d')]['id'];}return db['Trigger']['find']({'where':{'id':_0x5f22e0[_0xff3f('0x42')]['id']}})[_0xff3f('0x22')](handleEntityNotFound(_0x5d2c37,null))[_0xff3f('0x22')](function(_0x2771bd){if(_0x2771bd){_0x5f22e0[_0xff3f('0x4d')]['TriggerAnyId']=_0x2771bd['id'];return db[_0xff3f('0x51')]['create'](_0x5f22e0['body']);}})[_0xff3f('0x22')](respondWithResult(_0x5d2c37,null))['catch'](handleError(_0x5d2c37,null));};exports[_0xff3f('0x53')]=function(_0x4af2ed,_0x1a0a2e,_0x13455c){var _0x5c663f={};var _0x35dcf8={};var _0x18f840;var _0x26c8fc;return db[_0xff3f('0x2a')][_0xff3f('0x54')]({'where':{'id':_0x4af2ed[_0xff3f('0x42')]['id']}})['then'](handleEntityNotFound(_0x1a0a2e,null))[_0xff3f('0x22')](function(_0xe05a77){if(_0xe05a77){_0x18f840=_0xe05a77;_0x35dcf8['model']=_['keys'](db[_0xff3f('0x51')][_0xff3f('0x2b')]);_0x35dcf8[_0xff3f('0x2e')]=_[_0xff3f('0x2f')](_0x4af2ed['query']);_0x35dcf8[_0xff3f('0x30')]=_[_0xff3f('0x31')](_0x35dcf8[_0xff3f('0x2d')],_0x35dcf8[_0xff3f('0x2e')]);_0x5c663f['attributes']=_['intersection'](_0x35dcf8[_0xff3f('0x2d')],qs['fields'](_0x4af2ed['query'][_0xff3f('0x33')]));_0x5c663f[_0xff3f('0x32')]=_0x5c663f[_0xff3f('0x32')][_0xff3f('0x43')]?_0x5c663f[_0xff3f('0x32')]:_0x35dcf8[_0xff3f('0x2d')];_0x5c663f[_0xff3f('0x35')]=qs[_0xff3f('0x36')](_0x4af2ed[_0xff3f('0x2e')][_0xff3f('0x36')]);_0x5c663f[_0xff3f('0x37')]=qs[_0xff3f('0x30')](_['pick'](_0x4af2ed[_0xff3f('0x2e')],_0x35dcf8[_0xff3f('0x30')]));if(_0x4af2ed[_0xff3f('0x2e')][_0xff3f('0x39')]){_0x5c663f['where']=_[_0xff3f('0x3a')](_0x5c663f[_0xff3f('0x37')],{'$or':_[_0xff3f('0x29')](_0x5c663f[_0xff3f('0x32')],function(_0x9b3acc){var _0x3086c9={};_0x3086c9[_0x9b3acc]={'$like':'%'+_0x4af2ed[_0xff3f('0x2e')][_0xff3f('0x39')]+'%'};return _0x3086c9;})});}_0x5c663f=_[_0xff3f('0x3a')]({},_0x5c663f,_0x4af2ed[_0xff3f('0x3c')]);return _0x18f840['getAllConditions'](_0x5c663f);}})[_0xff3f('0x22')](function(_0x105a5f){if(_0x105a5f){_0x26c8fc=_0x105a5f[_0xff3f('0x43')];if(!_0x4af2ed[_0xff3f('0x2e')][_0xff3f('0x55')](_0xff3f('0x34'))){_0x5c663f[_0xff3f('0x1b')]=qs[_0xff3f('0x1b')](_0x4af2ed['query'][_0xff3f('0x1b')]);_0x5c663f['offset']=qs[_0xff3f('0x1a')](_0x4af2ed[_0xff3f('0x2e')]['offset']);}return _0x18f840['getAllConditions'](_0x5c663f);}})[_0xff3f('0x22')](function(_0x34fb05){if(_0x34fb05){return _0x34fb05?{'count':_0x26c8fc,'rows':_0x34fb05}:null;}})[_0xff3f('0x22')](respondWithResult(_0x1a0a2e,null))[_0xff3f('0x45')](handleError(_0x1a0a2e,null));};exports[_0xff3f('0x56')]=function(_0x2397af,_0x3aa63a,_0x1c5713){var _0x4b69a1={};var _0x51f258={};var _0x200301;var _0x457e1e;return db[_0xff3f('0x2a')]['findOne']({'where':{'id':_0x2397af['params']['id']}})[_0xff3f('0x22')](handleEntityNotFound(_0x3aa63a,null))[_0xff3f('0x22')](function(_0x196a14){if(_0x196a14){_0x200301=_0x196a14;_0x51f258[_0xff3f('0x2d')]=_['keys'](db[_0xff3f('0x51')]['rawAttributes']);_0x51f258['query']=_['keys'](_0x2397af[_0xff3f('0x2e')]);_0x51f258[_0xff3f('0x30')]=_['intersection'](_0x51f258[_0xff3f('0x2d')],_0x51f258[_0xff3f('0x2e')]);_0x4b69a1['attributes']=_[_0xff3f('0x31')](_0x51f258[_0xff3f('0x2d')],qs[_0xff3f('0x33')](_0x2397af['query'][_0xff3f('0x33')]));_0x4b69a1[_0xff3f('0x32')]=_0x4b69a1['attributes'][_0xff3f('0x43')]?_0x4b69a1['attributes']:_0x51f258['model'];_0x4b69a1[_0xff3f('0x35')]=qs[_0xff3f('0x36')](_0x2397af[_0xff3f('0x2e')]['sort']);_0x4b69a1[_0xff3f('0x37')]=qs['filters'](_[_0xff3f('0x38')](_0x2397af['query'],_0x51f258[_0xff3f('0x30')]));if(_0x2397af[_0xff3f('0x2e')][_0xff3f('0x39')]){_0x4b69a1['where']=_[_0xff3f('0x3a')](_0x4b69a1[_0xff3f('0x37')],{'$or':_['map'](_0x4b69a1[_0xff3f('0x32')],function(_0x201edb){var _0x4a251f={};_0x4a251f[_0x201edb]={'$like':'%'+_0x2397af[_0xff3f('0x2e')][_0xff3f('0x39')]+'%'};return _0x4a251f;})});}_0x4b69a1=_[_0xff3f('0x3a')]({},_0x4b69a1,_0x2397af[_0xff3f('0x3c')]);return _0x200301[_0xff3f('0x56')](_0x4b69a1);}})[_0xff3f('0x22')](function(_0x4868b9){if(_0x4868b9){_0x457e1e=_0x4868b9[_0xff3f('0x43')];if(!_0x2397af[_0xff3f('0x2e')][_0xff3f('0x55')](_0xff3f('0x34'))){_0x4b69a1[_0xff3f('0x1b')]=qs[_0xff3f('0x1b')](_0x2397af[_0xff3f('0x2e')][_0xff3f('0x1b')]);_0x4b69a1[_0xff3f('0x1a')]=qs['offset'](_0x2397af['query'][_0xff3f('0x1a')]);}return _0x200301[_0xff3f('0x56')](_0x4b69a1);}})[_0xff3f('0x22')](function(_0x103f0a){if(_0x103f0a){return _0x103f0a?{'count':_0x457e1e,'rows':_0x103f0a}:null;}})[_0xff3f('0x22')](respondWithResult(_0x3aa63a,null))[_0xff3f('0x45')](handleError(_0x3aa63a,null));};exports[_0xff3f('0x57')]=function(_0x49222b,_0x1758d7,_0x1907e5){if(_0x49222b[_0xff3f('0x4d')]['id']){delete _0x49222b[_0xff3f('0x4d')]['id'];}return db['Trigger'][_0xff3f('0x44')]({'where':{'id':_0x49222b[_0xff3f('0x42')]['id']}})[_0xff3f('0x22')](handleEntityNotFound(_0x1758d7,null))['then'](function(_0x575591){if(_0x575591){_0x49222b[_0xff3f('0x4d')]['TriggerId']=_0x575591['id'];return db[_0xff3f('0x58')][_0xff3f('0x46')](_0x49222b['body']);}})['then'](respondWithResult(_0x1758d7,null))[_0xff3f('0x45')](handleError(_0x1758d7,null));};exports['getActions']=function(_0x5d6181,_0x4fcb06,_0xb2bca2){var _0x55c481={};var _0x5dac01={};var _0x58147f;var _0x876f68;return db[_0xff3f('0x2a')]['findOne']({'where':{'id':_0x5d6181[_0xff3f('0x42')]['id']}})[_0xff3f('0x22')](handleEntityNotFound(_0x4fcb06,null))[_0xff3f('0x22')](function(_0x3e38f8){if(_0x3e38f8){_0x58147f=_0x3e38f8;_0x5dac01[_0xff3f('0x2d')]=_[_0xff3f('0x2f')](db[_0xff3f('0x58')][_0xff3f('0x2b')]);_0x5dac01[_0xff3f('0x2e')]=_[_0xff3f('0x2f')](_0x5d6181[_0xff3f('0x2e')]);_0x5dac01['filters']=_[_0xff3f('0x31')](_0x5dac01[_0xff3f('0x2d')],_0x5dac01[_0xff3f('0x2e')]);_0x55c481[_0xff3f('0x32')]=_[_0xff3f('0x31')](_0x5dac01[_0xff3f('0x2d')],qs[_0xff3f('0x33')](_0x5d6181[_0xff3f('0x2e')][_0xff3f('0x33')]));_0x55c481[_0xff3f('0x32')]=_0x55c481[_0xff3f('0x32')][_0xff3f('0x43')]?_0x55c481['attributes']:_0x5dac01[_0xff3f('0x2d')];_0x55c481[_0xff3f('0x35')]=qs['sort'](_0x5d6181[_0xff3f('0x2e')][_0xff3f('0x36')]);_0x55c481['where']=qs[_0xff3f('0x30')](_[_0xff3f('0x38')](_0x5d6181[_0xff3f('0x2e')],_0x5dac01[_0xff3f('0x30')]));if(_0x5d6181[_0xff3f('0x2e')][_0xff3f('0x39')]){_0x55c481[_0xff3f('0x37')]=_[_0xff3f('0x3a')](_0x55c481['where'],{'$or':_['map'](_0x55c481[_0xff3f('0x32')],function(_0x1b08d8){var _0x47a709={};_0x47a709[_0x1b08d8]={'$like':'%'+_0x5d6181['query'][_0xff3f('0x39')]+'%'};return _0x47a709;})});}_0x55c481=_[_0xff3f('0x3a')]({},_0x55c481,_0x5d6181[_0xff3f('0x3c')]);return _0x58147f[_0xff3f('0x59')](_0x55c481);}})[_0xff3f('0x22')](function(_0x47a809){if(_0x47a809){_0x876f68=_0x47a809[_0xff3f('0x43')];if(!_0x5d6181[_0xff3f('0x2e')][_0xff3f('0x55')](_0xff3f('0x34'))){_0x55c481[_0xff3f('0x1b')]=qs[_0xff3f('0x1b')](_0x5d6181[_0xff3f('0x2e')][_0xff3f('0x1b')]);_0x55c481[_0xff3f('0x1a')]=qs[_0xff3f('0x1a')](_0x5d6181[_0xff3f('0x2e')][_0xff3f('0x1a')]);}return _0x58147f[_0xff3f('0x59')](_0x55c481);}})[_0xff3f('0x22')](function(_0x45aeec){if(_0x45aeec){return _0x45aeec?{'count':_0x876f68,'rows':_0x45aeec}:null;}})[_0xff3f('0x22')](respondWithResult(_0x4fcb06,null))[_0xff3f('0x45')](handleError(_0x4fcb06,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index e913be9..656b84c 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 _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 +var _0x1173=['exports','define','Trigger','tools_triggers','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./trigger.attributes'];(function(_0x4b6ccc,_0x146dc3){var _0x15e250=function(_0xef70d5){while(--_0xef70d5){_0x4b6ccc['push'](_0x4b6ccc['shift']());}};_0x15e250(++_0x146dc3);}(_0x1173,0x138));var _0x3117=function(_0x427094,_0x412378){_0x427094=_0x427094-0x0;var _0x24f773=_0x1173[_0x427094];return _0x24f773;};'use strict';var _=require('lodash');var util=require(_0x3117('0x0'));var logger=require(_0x3117('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3117('0x2'));var rp=require(_0x3117('0x3'));var fs=require('fs');var path=require(_0x3117('0x4'));var rimraf=require('rimraf');var config=require(_0x3117('0x5'));var attributes=require(_0x3117('0x6'));module[_0x3117('0x7')]=function(_0x32e084,_0x3a38b){return _0x32e084[_0x3117('0x8')](_0x3117('0x9'),attributes,{'tableName':_0x3117('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 13a75c7..6ba8dc3 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 _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 +var _0x1c9a=['limit','include','map','attributes','model','ShowTrigger','find','where','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','raw'];(function(_0x5b80a9,_0x42a5e0){var _0x268eba=function(_0x39e065){while(--_0x39e065){_0x5b80a9['push'](_0x5b80a9['shift']());}};_0x268eba(++_0x42a5e0);}(_0x1c9a,0x98));var _0xa1c9=function(_0x51d824,_0x121043){_0x51d824=_0x51d824-0x0;var _0x125cfc=_0x1c9a[_0x51d824];return _0x125cfc;};'use strict';var _=require(_0xa1c9('0x0'));var util=require('util');var moment=require(_0xa1c9('0x1'));var BPromise=require('bluebird');var rs=require(_0xa1c9('0x2'));var fs=require('fs');var Redis=require(_0xa1c9('0x3'));var db=require(_0xa1c9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1c9('0x5'))(_0xa1c9('0x6'));var config=require(_0xa1c9('0x7'));var jayson=require(_0xa1c9('0x8'));var client=jayson['client'][_0xa1c9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5448f2,_0x222624,_0x463c9c){return new BPromise(function(_0x3f07c2,_0x5059df){return client[_0xa1c9('0xa')](_0x5448f2,_0x463c9c)[_0xa1c9('0xb')](function(_0x24136d){logger[_0xa1c9('0xc')]('Trigger,\x20%s,\x20%s',_0x222624,_0xa1c9('0xd'));logger[_0xa1c9('0xe')](_0xa1c9('0xf'),_0x222624,_0xa1c9('0xd'),JSON[_0xa1c9('0x10')](_0x24136d));if(_0x24136d[_0xa1c9('0x11')]){if(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x12')]===0x1f4){logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x222624,_0x24136d['error'][_0xa1c9('0x14')]);return _0x5059df(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x14')]);}logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x222624,_0x24136d['error'][_0xa1c9('0x14')]);return _0x3f07c2(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x14')]);}else{logger[_0xa1c9('0xc')](_0xa1c9('0x13'),_0x222624,_0xa1c9('0xd'));_0x3f07c2(_0x24136d[_0xa1c9('0x15')][_0xa1c9('0x14')]);}})[_0xa1c9('0x16')](function(_0x373f5d){logger['error'](_0xa1c9('0x13'),_0x222624,_0x373f5d);_0x5059df(_0x373f5d);});});}exports[_0xa1c9('0x17')]=function(_0x224ae4){var _0x50db9b=this;return new Promise(function(_0x2fb81e,_0x5ab911){return db[_0xa1c9('0x18')][_0xa1c9('0x19')]({'raw':_0x224ae4[_0xa1c9('0x1a')]?_0x224ae4['options'][_0xa1c9('0x1b')]===undefined?!![]:![]:!![],'where':_0x224ae4[_0xa1c9('0x1a')]?_0x224ae4[_0xa1c9('0x1a')]['where']||null:null,'attributes':_0x224ae4[_0xa1c9('0x1a')]?_0x224ae4[_0xa1c9('0x1a')]['attributes']||null:null,'limit':_0x224ae4[_0xa1c9('0x1a')]?_0x224ae4[_0xa1c9('0x1a')][_0xa1c9('0x1c')]||null:null,'include':_0x224ae4['options']?_0x224ae4[_0xa1c9('0x1a')][_0xa1c9('0x1d')]?_[_0xa1c9('0x1e')](_0x224ae4[_0xa1c9('0x1a')][_0xa1c9('0x1d')],function(_0x4a0a0c){return{'model':db[_0x4a0a0c['model']],'as':_0x4a0a0c['as'],'attributes':_0x4a0a0c[_0xa1c9('0x1f')],'include':_0x4a0a0c['include']?_[_0xa1c9('0x1e')](_0x4a0a0c[_0xa1c9('0x1d')],function(_0x1c6f37){return{'model':db[_0x1c6f37[_0xa1c9('0x20')]],'as':_0x1c6f37['as'],'attributes':_0x1c6f37[_0xa1c9('0x1f')],'include':_0x1c6f37['include']?_[_0xa1c9('0x1e')](_0x1c6f37[_0xa1c9('0x1d')],function(_0x20cbe1){return{'model':db[_0x20cbe1['model']],'as':_0x20cbe1['as'],'attributes':_0x20cbe1[_0xa1c9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa1c9('0xb')](function(_0x1ca443){logger['info'](_0xa1c9('0x17'),_0x224ae4);logger[_0xa1c9('0xe')]('GetTrigger',_0x224ae4,JSON[_0xa1c9('0x10')](_0x1ca443));_0x2fb81e(_0x1ca443);})['catch'](function(_0xdf6d0c){logger[_0xa1c9('0x11')](_0xa1c9('0x17'),_0xdf6d0c[_0xa1c9('0x14')],_0x224ae4);_0x5ab911(_0x50db9b[_0xa1c9('0x11')](0x1f4,_0xdf6d0c[_0xa1c9('0x14')]));});});};exports[_0xa1c9('0x21')]=function(_0x58b900){var _0x5648b8=this;return new Promise(function(_0x4d23cd,_0x1c7038){return db[_0xa1c9('0x18')][_0xa1c9('0x22')]({'raw':_0x58b900[_0xa1c9('0x1a')]?_0x58b900[_0xa1c9('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x58b900['options']?_0x58b900['options'][_0xa1c9('0x23')]||null:null,'attributes':_0x58b900[_0xa1c9('0x1a')]?_0x58b900[_0xa1c9('0x1a')][_0xa1c9('0x1f')]||null:null,'include':_0x58b900[_0xa1c9('0x1a')]?_0x58b900[_0xa1c9('0x1a')][_0xa1c9('0x1d')]?_['map'](_0x58b900[_0xa1c9('0x1a')]['include'],function(_0x1b8707){return{'model':db[_0x1b8707['model']],'as':_0x1b8707['as'],'attributes':_0x1b8707[_0xa1c9('0x1f')],'include':_0x1b8707[_0xa1c9('0x1d')]?_[_0xa1c9('0x1e')](_0x1b8707['include'],function(_0x39818f){return{'model':db[_0x39818f[_0xa1c9('0x20')]],'as':_0x39818f['as'],'attributes':_0x39818f[_0xa1c9('0x1f')],'include':_0x39818f[_0xa1c9('0x1d')]?_['map'](_0x39818f['include'],function(_0x1f1612){return{'model':db[_0x1f1612[_0xa1c9('0x20')]],'as':_0x1f1612['as'],'attributes':_0x1f1612[_0xa1c9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa1c9('0xb')](function(_0x1c0cce){logger[_0xa1c9('0xc')](_0xa1c9('0x21'),_0x58b900);logger[_0xa1c9('0xe')](_0xa1c9('0x21'),_0x58b900,JSON[_0xa1c9('0x10')](_0x1c0cce));_0x4d23cd(_0x1c0cce);})['catch'](function(_0x3e6ec0){logger[_0xa1c9('0x11')](_0xa1c9('0x21'),_0x3e6ec0[_0xa1c9('0x14')],_0x58b900);_0x1c7038(_0x5648b8[_0xa1c9('0x11')](0x1f4,_0x3e6ec0[_0xa1c9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index aa6a360..1d6bd7c 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 _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 +var _0xe14d=['index','show','post','/:id/clone','clone','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated'];(function(_0x2b8baf,_0x289508){var _0x5501a6=function(_0x1dd64f){while(--_0x1dd64f){_0x2b8baf['push'](_0x2b8baf['shift']());}};_0x5501a6(++_0x289508);}(_0xe14d,0x1ee));var _0xde14=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xe14d[_0x55f8b4];return _0x2475f9;};'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')]('/:id',auth['isAuthenticated'](),controller[_0xde14('0xb')]);router[_0xde14('0xc')](_0xde14('0xd'),auth[_0xde14('0x9')](),controller[_0xde14('0xe')]);router[_0xde14('0xc')]('/',auth[_0xde14('0x9')](),controller[_0xde14('0xf')]);router['put'](_0xde14('0x10'),auth[_0xde14('0x9')](),controller[_0xde14('0x11')]);router[_0xde14('0x12')](_0xde14('0x10'),auth[_0xde14('0x9')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 5fd1131..8ee5633 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 _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 +var _0xb740=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','INTEGER','\x22\x22\x20<>','refuse','uac','uas','pai','fingerprint','certificate','active','actpass','sequelize','exports','STRING','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','udp','setDataValue','transport','getDataValue','split','rfc2833','info','shortinfo','inband','yes','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow'];(function(_0x493d82,_0x9fb603){var _0x12ccf0=function(_0x392fd0){while(--_0x392fd0){_0x493d82['push'](_0x493d82['shift']());}};_0x12ccf0(++_0x9fb603);}(_0xb740,0x187));var _0x0b74=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb740[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0b74('0x0'));module[_0x0b74('0x1')]={'name':{'type':Sequelize[_0x0b74('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x4'),'user',_0x0b74('0x5')),'allowNull':![],'defaultValue':_0x0b74('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0b74('0x6')},'callingpres':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x7'),_0x0b74('0x8'),'ALLOWED_FAILED_SCREEN',_0x0b74('0x9'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0x0b74('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x0b74('0x2')]},'remotesecret':{'type':Sequelize[_0x0b74('0x2')]},'transport':{'type':Sequelize[_0x0b74('0x2')],'defaultValue':_0x0b74('0xa'),'set':function(_0x5c0346){this[_0x0b74('0xb')](_0x0b74('0xc'),_0x5c0346?_0x5c0346['join'](','):null);},'get':function(){return this[_0x0b74('0xd')](_0x0b74('0xc'))?this['getDataValue'](_0x0b74('0xc'))[_0x0b74('0xe')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x0b74('0xf'),_0x0b74('0x10'),_0x0b74('0x11'),_0x0b74('0x12'),'auto'),'defaultValue':_0x0b74('0xf')},'directmedia':{'type':Sequelize['ENUM'](_0x0b74('0x13'),'no','nonat',_0x0b74('0x14'),_0x0b74('0x15')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0b74('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x0b74('0x2')]},'nat':{'type':Sequelize[_0x0b74('0x2')],'defaultValue':_0x0b74('0x16'),'set':function(_0x25e744){this[_0x0b74('0xb')](_0x0b74('0x17'),_0x25e744?_0x25e744[_0x0b74('0x18')](','):null);},'get':function(){return this[_0x0b74('0xd')](_0x0b74('0x17'))?this[_0x0b74('0xd')]('nat')['split'](','):null;},'comment':_0x0b74('0x19')},'callgroup':{'type':Sequelize[_0x0b74('0x2')]},'namedcallgroup':{'type':Sequelize[_0x0b74('0x2')]},'pickupgroup':{'type':Sequelize[_0x0b74('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x0b74('0x2')]},'language':{'type':Sequelize[_0x0b74('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0b74('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x0b74('0x2')],'defaultValue':_0x0b74('0x1a')},'allow':{'type':Sequelize[_0x0b74('0x2')],'allowNull':![],'defaultValue':_0x0b74('0x1b'),'set':function(_0x249e50){this['setDataValue'](_0x0b74('0x1c'),_0x249e50?_0x249e50[_0x0b74('0x18')](';'):_0x0b74('0x1b'));},'get':function(){return this[_0x0b74('0xd')]('allow')?this[_0x0b74('0xd')](_0x0b74('0x1c'))[_0x0b74('0xe')](';'):null;},'comment':_0x0b74('0x1d')},'autoframing':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x13'),'no')},'insecure':{'type':Sequelize[_0x0b74('0x2')],'defaultValue':_0x0b74('0x1e'),'set':function(_0x254090){this[_0x0b74('0xb')](_0x0b74('0x1f'),_0x254090?_0x254090[_0x0b74('0x18')](','):null);},'get':function(){return this[_0x0b74('0xd')](_0x0b74('0x1f'))?this[_0x0b74('0xd')]('insecure')[_0x0b74('0xe')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x0b74('0x13'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0b74('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0b74('0x3')]('yes','no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x0b74('0x13'),'no')},'useclientcode':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x13'),'no')},'accountcode':{'type':Sequelize[_0x0b74('0x20')](0xb)},'setvar':{'type':Sequelize[_0x0b74('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x0b74('0x21')},'amaflags':{'type':Sequelize[_0x0b74('0x2')]},'callcounter':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x13'),'no'),'defaultValue':_0x0b74('0x13')},'busylevel':{'type':Sequelize[_0x0b74('0x20')](0xb)},'allowoverlap':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x13'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x13'),'no')},'ignoresdpversion':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x13'),'no')},'subscribecontext':{'type':Sequelize[_0x0b74('0x2')]},'template':{'type':Sequelize[_0x0b74('0x2')]},'videosupport':{'type':Sequelize[_0x0b74('0x3')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x13'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x0b74('0x3')]('accept',_0x0b74('0x22'),'originate')},'session_expires':{'type':Sequelize[_0x0b74('0x20')](0xb)},'session_minse':{'type':Sequelize[_0x0b74('0x20')](0xb)},'session_refresher':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x23'),'uas'),'defaultValue':_0x0b74('0x24')},'t38pt_usertpsource':{'type':Sequelize[_0x0b74('0x2')]},'regexten':{'type':Sequelize[_0x0b74('0x2')]},'fromdomain':{'type':Sequelize[_0x0b74('0x2')]},'fromuser':{'type':Sequelize[_0x0b74('0x2')]},'port':{'type':Sequelize[_0x0b74('0x20')](0x5)},'qualify':{'type':Sequelize[_0x0b74('0x3')]('yes','no'),'defaultValue':_0x0b74('0x13')},'keepalive':{'type':Sequelize[_0x0b74('0x20')](0xb)},'defaultip':{'type':Sequelize[_0x0b74('0x2')]},'defaultuser':{'type':Sequelize[_0x0b74('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x0b74('0x20')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x0b74('0x20')](0xb)},'sendrpid':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x13'),'no',_0x0b74('0x25')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0b74('0x2')]},'callbackextension':{'type':Sequelize[_0x0b74('0x2')]},'timert1':{'type':Sequelize[_0x0b74('0x20')](0xb)},'timerb':{'type':Sequelize[_0x0b74('0x20')](0xb)},'qualifyfreq':{'type':Sequelize[_0x0b74('0x20')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x0b74('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x0b74('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x0b74('0x20')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x0b74('0x13'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0b74('0x3')]('yes','no')},'force_avp':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x13'),'no')},'icesupport':{'type':Sequelize[_0x0b74('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x0b74('0x13'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x0b74('0x13'),'no',_0x0b74('0x26'),_0x0b74('0x27'))},'dtlsrekey':{'type':Sequelize[_0x0b74('0x20')](0xb)},'dtlscertfile':{'type':Sequelize[_0x0b74('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x0b74('0x2')]},'dtlscipher':{'type':Sequelize[_0x0b74('0x2')]},'dtlscafile':{'type':Sequelize[_0x0b74('0x2')]},'dtlscapath':{'type':Sequelize[_0x0b74('0x2')]},'dtlssetup':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x28'),'passive',_0x0b74('0x29')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0b74('0x2')]},'usereqphone':{'type':Sequelize[_0x0b74('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x0b74('0x2')]},'recordofffeature':{'type':Sequelize[_0x0b74('0x2')]},'call_limit':{'type':Sequelize[_0x0b74('0x20')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x13'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x0b74('0x13'),'no')},'vmexten':{'type':Sequelize[_0x0b74('0x2')]},'mohinterpret':{'type':Sequelize[_0x0b74('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0b74('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x0b74('0x3')]('yes','no','nonat',_0x0b74('0x14'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x0b74('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x0b74('0x2')],'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 2b1e967..defa3e2 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 _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 +var _0x4339=['order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','fields','include','find','omit','createdAt','body','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','chan_sip.so','server/files/templates/registry.ejs','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','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','Trunks','sendStatus','stack','name','send','index','map','Trunk','fieldName','key','query','filters','model','attributes','intersection','length','hasOwnProperty','nolimit'];(function(_0x50a004,_0x193d84){var _0x5e9992=function(_0x3c8c37){while(--_0x3c8c37){_0x50a004['push'](_0x50a004['shift']());}};_0x5e9992(++_0x193d84);}(_0x4339,0x186));var _0x9433=function(_0x5aca4c,_0x4add68){_0x5aca4c=_0x5aca4c-0x0;var _0x496604=_0x4339[_0x5aca4c];return _0x496604;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9433('0x0'));var rimraf=require(_0x9433('0x1'));var zipdir=require(_0x9433('0x2'));var jsonpatch=require(_0x9433('0x3'));var rp=require(_0x9433('0x4'));var moment=require(_0x9433('0x5'));var BPromise=require(_0x9433('0x6'));var Mustache=require(_0x9433('0x7'));var util=require(_0x9433('0x8'));var path=require(_0x9433('0x9'));var sox=require(_0x9433('0xa'));var csv=require('to-csv');var ejs=require(_0x9433('0xb'));var fs=require('fs');var _=require(_0x9433('0xc'));var squel=require(_0x9433('0xd'));var crypto=require(_0x9433('0xe'));var jsforce=require(_0x9433('0xf'));var deskjs=require(_0x9433('0x10'));var toCsv=require(_0x9433('0x11'));var querystring=require(_0x9433('0x12'));var Papa=require(_0x9433('0x13'));var Redis=require(_0x9433('0x14'));var authService=require(_0x9433('0x15'));var qs=require(_0x9433('0x16'));var as=require(_0x9433('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9433('0x18'))(_0x9433('0x19'));var utils=require(_0x9433('0x1a'));var config=require(_0x9433('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x9433('0x1c'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x9433('0x1d')][_0x9433('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x396c15,_0x3afa7f,_0x17ff9b,_0x5aff68){return new BPromise(function(_0x3034ad,_0x146520){var _0xd3ad63=_0x5aff68||client;return _0xd3ad63[_0x9433('0x1f')](_0x396c15,_0x17ff9b)['then'](function(_0x309260){logger[_0x9433('0x20')](_0x9433('0x21'),_0x3afa7f,_0x9433('0x22'));logger[_0x9433('0x23')](_0x9433('0x24'),_0x3afa7f,'request\x20sent',JSON[_0x9433('0x25')](_0x309260));if(_0x309260[_0x9433('0x26')]){if(_0x309260['error'][_0x9433('0x27')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x3afa7f,_0x309260['error'][_0x9433('0x28')]);return _0x146520(_0x309260[_0x9433('0x26')][_0x9433('0x28')]);}logger[_0x9433('0x26')](_0x9433('0x21'),_0x3afa7f,_0x309260[_0x9433('0x26')][_0x9433('0x28')]);return _0x3034ad(_0x309260[_0x9433('0x26')][_0x9433('0x28')]);}else{logger[_0x9433('0x20')](_0x9433('0x21'),_0x3afa7f,_0x9433('0x22'));_0x3034ad(_0x309260[_0x9433('0x29')][_0x9433('0x28')]);}})['catch'](function(_0x81316e){logger[_0x9433('0x26')](_0x9433('0x21'),_0x3afa7f,_0x81316e);_0x146520(_0x81316e);});});}function respondWithStatusCode(_0x17dea0,_0x357a02){_0x357a02=_0x357a02||0xcc;return function(_0x549b77){if(_0x549b77){return _0x17dea0['sendStatus'](_0x357a02);}return _0x17dea0[_0x9433('0x2a')](_0x357a02)[_0x9433('0x2b')]();};}function respondWithResult(_0x1798fd,_0x62963b){_0x62963b=_0x62963b||0xc8;return function(_0xbcc2c6){if(_0xbcc2c6){return _0x1798fd[_0x9433('0x2a')](_0x62963b)[_0x9433('0x2c')](_0xbcc2c6);}};}function respondWithFilteredResult(_0x5243b6,_0x5bb4b6){return function(_0x3fc7c9){if(_0x3fc7c9){var _0x2ac8bb=_0x3fc7c9[_0x9433('0x2d')],_0x1c1688=_0x5bb4b6[_0x9433('0x2e')],_0x388afd=_0x5bb4b6[_0x9433('0x2e')]+_0x5bb4b6[_0x9433('0x2f')],_0x560cbd;if(_0x388afd>=_0x2ac8bb){_0x388afd=_0x2ac8bb;_0x560cbd=0xc8;}else{_0x560cbd=0xce;}_0x5243b6['status'](_0x560cbd);return _0x5243b6['set'](_0x9433('0x30'),_0x1c1688+'-'+_0x388afd+'/'+_0x2ac8bb)[_0x9433('0x2c')](_0x3fc7c9);}return null;};}function patchUpdates(_0x452363){return function(_0x22c994){try{jsonpatch[_0x9433('0x31')](_0x22c994,_0x452363,!![]);}catch(_0x35743b){return BPromise[_0x9433('0x32')](_0x35743b);}return _0x22c994[_0x9433('0x33')]();};}function saveUpdates(_0xddefeb,_0x461e68){return function(_0x417fc6){if(_0x417fc6){return _0x417fc6[_0x9433('0x34')](_0xddefeb)['then'](function(_0x55ad47){return _0x55ad47;});}return null;};}function removeEntity(_0x2cdc05,_0x569b8c){return function(_0x41cd07){if(_0x41cd07){return _0x41cd07[_0x9433('0x35')]()[_0x9433('0x36')](function(){var _0x460ea3=_0x41cd07[_0x9433('0x37')]({'plain':!![]});var _0x34ad87=_0x9433('0x38');return db['UserProfileResource'][_0x9433('0x35')]({'where':{'type':_0x34ad87,'resourceId':_0x460ea3['id']}})['then'](function(){return _0x41cd07;});})[_0x9433('0x36')](function(){_0x2cdc05[_0x9433('0x2a')](0xcc)[_0x9433('0x2b')]();});}};}function handleEntityNotFound(_0x2c9a31,_0x225f74){return function(_0x435470){if(!_0x435470){_0x2c9a31[_0x9433('0x39')](0x194);}return _0x435470;};}function handleError(_0x552432,_0x9ac48d){_0x9ac48d=_0x9ac48d||0x1f4;return function(_0x2cd12b){logger[_0x9433('0x26')](_0x2cd12b[_0x9433('0x3a')]);if(_0x2cd12b[_0x9433('0x3b')]){delete _0x2cd12b[_0x9433('0x3b')];}_0x552432['status'](_0x9ac48d)[_0x9433('0x3c')](_0x2cd12b);};}exports[_0x9433('0x3d')]=function(_0x45c768,_0x479398){var _0x2ad9c9={},_0x3c7cee={},_0x6a82ae={'count':0x0,'rows':[]};var _0x487b76=_[_0x9433('0x3e')](db[_0x9433('0x3f')]['rawAttributes'],function(_0x13fb3d){return{'name':_0x13fb3d[_0x9433('0x40')],'type':_0x13fb3d['type'][_0x9433('0x41')]};});_0x3c7cee['model']=_[_0x9433('0x3e')](_0x487b76,_0x9433('0x3b'));_0x3c7cee[_0x9433('0x42')]=_['keys'](_0x45c768['query']);_0x3c7cee[_0x9433('0x43')]=_['intersection'](_0x3c7cee[_0x9433('0x44')],_0x3c7cee['query']);_0x2ad9c9[_0x9433('0x45')]=_[_0x9433('0x46')](_0x3c7cee[_0x9433('0x44')],qs['fields'](_0x45c768['query']['fields']));_0x2ad9c9[_0x9433('0x45')]=_0x2ad9c9['attributes'][_0x9433('0x47')]?_0x2ad9c9[_0x9433('0x45')]:_0x3c7cee[_0x9433('0x44')];if(!_0x45c768['query'][_0x9433('0x48')](_0x9433('0x49'))){_0x2ad9c9[_0x9433('0x2f')]=qs[_0x9433('0x2f')](_0x45c768[_0x9433('0x42')][_0x9433('0x2f')]);_0x2ad9c9[_0x9433('0x2e')]=qs['offset'](_0x45c768[_0x9433('0x42')][_0x9433('0x2e')]);}_0x2ad9c9[_0x9433('0x4a')]=qs['sort'](_0x45c768[_0x9433('0x42')][_0x9433('0x4b')]);_0x2ad9c9[_0x9433('0x4c')]=qs['filters'](_['pick'](_0x45c768['query'],_0x3c7cee['filters']),_0x487b76);if(_0x45c768[_0x9433('0x42')][_0x9433('0x4d')]){_0x2ad9c9[_0x9433('0x4c')]=_[_0x9433('0x4e')](_0x2ad9c9[_0x9433('0x4c')],{'$or':_[_0x9433('0x3e')](_0x487b76,function(_0x346cb5){if(_0x346cb5[_0x9433('0x4f')]!==_0x9433('0x50')){var _0x4e93b6={};_0x4e93b6[_0x346cb5['name']]={'$like':'%'+_0x45c768[_0x9433('0x42')][_0x9433('0x4d')]+'%'};return _0x4e93b6;}})});}_0x2ad9c9=_['merge']({},_0x2ad9c9,_0x45c768[_0x9433('0x51')]);var _0x4e9d0d={'where':_0x2ad9c9[_0x9433('0x4c')]};return db[_0x9433('0x3f')][_0x9433('0x2d')](_0x4e9d0d)[_0x9433('0x36')](function(_0x19e761){_0x6a82ae[_0x9433('0x2d')]=_0x19e761;if(_0x45c768[_0x9433('0x42')][_0x9433('0x52')]){_0x2ad9c9['include']=[{'all':!![]}];}return db['Trunk'][_0x9433('0x53')](_0x2ad9c9);})['then'](function(_0x1f773b){_0x6a82ae[_0x9433('0x54')]=_0x1f773b;return _0x6a82ae;})[_0x9433('0x36')](respondWithFilteredResult(_0x479398,_0x2ad9c9))[_0x9433('0x55')](handleError(_0x479398,null));};exports['show']=function(_0x35f93b,_0x5c3440){var _0x2aa40f={'raw':![],'where':{'id':_0x35f93b[_0x9433('0x56')]['id']}},_0x35f8c6={};_0x35f8c6[_0x9433('0x44')]=_[_0x9433('0x57')](db['Trunk'][_0x9433('0x58')]);_0x35f8c6[_0x9433('0x42')]=_[_0x9433('0x57')](_0x35f93b[_0x9433('0x42')]);_0x35f8c6[_0x9433('0x43')]=_[_0x9433('0x46')](_0x35f8c6['model'],_0x35f8c6[_0x9433('0x42')]);_0x2aa40f[_0x9433('0x45')]=_[_0x9433('0x46')](_0x35f8c6[_0x9433('0x44')],qs[_0x9433('0x59')](_0x35f93b[_0x9433('0x42')][_0x9433('0x59')]));_0x2aa40f[_0x9433('0x45')]=_0x2aa40f[_0x9433('0x45')][_0x9433('0x47')]?_0x2aa40f['attributes']:_0x35f8c6['model'];if(_0x35f93b[_0x9433('0x42')][_0x9433('0x52')]){_0x2aa40f[_0x9433('0x5a')]=[{'all':!![]}];}_0x2aa40f=_[_0x9433('0x4e')]({},_0x2aa40f,_0x35f93b[_0x9433('0x51')]);return db[_0x9433('0x3f')]['find'](_0x2aa40f)[_0x9433('0x36')](handleEntityNotFound(_0x5c3440,null))[_0x9433('0x36')](respondWithResult(_0x5c3440,null))[_0x9433('0x55')](handleError(_0x5c3440,null));};exports['clone']=function(_0xe67a10,_0x3031c5){var _0x3a71a5={'where':{'id':_0xe67a10[_0x9433('0x56')]['id']}},_0x255091={};_0x255091[_0x9433('0x44')]=_['keys'](db['Trunk'][_0x9433('0x58')]);_0x3a71a5[_0x9433('0x45')]=_[_0x9433('0x46')](_0x255091['model'],qs['fields'](_0xe67a10['query']['fields']));_0x3a71a5[_0x9433('0x45')]=_0x3a71a5[_0x9433('0x45')][_0x9433('0x47')]?_0x3a71a5[_0x9433('0x45')]:_0x255091['model'];if(_0xe67a10[_0x9433('0x42')][_0x9433('0x52')]){_0x3a71a5[_0x9433('0x5a')]=[{'all':!![]}];}_0x3a71a5=_['merge']({},_0x3a71a5,_0xe67a10[_0x9433('0x51')]);return db['Trunk'][_0x9433('0x5b')](_0x3a71a5)[_0x9433('0x36')](handleEntityNotFound(_0x3031c5,null))[_0x9433('0x36')](function(_0x3aa803){if(_0x3aa803){var _0x92421c=_0x3aa803[_0x9433('0x37')]({'plain':!![]});_0x92421c=qs[_0x9433('0x5c')](_0x92421c,['id',_0x9433('0x5d'),'updatedAt']);_0xe67a10[_0x9433('0x5e')]=_[_0x9433('0x5c')](_0xe67a10['body'],['id','createdAt','updatedAt']);return db['Trunk'][_0x9433('0x5f')](_[_0x9433('0x4e')](_0x92421c,_0xe67a10[_0x9433('0x5e')]),{'include':_0xe67a10[_0x9433('0x42')][_0x9433('0x52')]?[{'all':!![]}]:undefined})[_0x9433('0x36')](function(_0x2043ec){var _0x4724a5=_0xe67a10['user'][_0x9433('0x37')]({'plain':!![]});if(!_0x4724a5)throw new Error(_0x9433('0x60'));if(_0x4724a5['role']===_0x9433('0x61')){var _0x4b9ae4=_0x2043ec['get']({'plain':!![]});var _0x52fb93=_0x9433('0x38');return db[_0x9433('0x62')]['find']({'where':{'name':_0x52fb93,'userProfileId':_0x4724a5[_0x9433('0x63')]},'raw':!![]})[_0x9433('0x36')](function(_0x308c26){if(_0x308c26&&_0x308c26[_0x9433('0x64')]===0x0){return db[_0x9433('0x65')][_0x9433('0x5f')]({'name':_0x4b9ae4['name'],'resourceId':_0x4b9ae4['id'],'type':_0x308c26[_0x9433('0x3b')],'sectionId':_0x308c26['id']},{})[_0x9433('0x36')](function(){return _0x2043ec;});}else{return _0x2043ec;}})[_0x9433('0x55')](function(_0x26a844){logger[_0x9433('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26a844);throw _0x26a844;});}return _0x2043ec;});}})['then'](respondWithResult(_0x3031c5,0xc9))[_0x9433('0x55')](handleError(_0x3031c5,null));};exports[_0x9433('0x5f')]=function(_0x5a5408,_0xabb804,_0x4a1416){var _0x10aae6;return db[_0x9433('0x3f')][_0x9433('0x5f')](_0x5a5408[_0x9433('0x5e')],{'raw':!![]})[_0x9433('0x36')](function(_0x4d1db3){_0x10aae6=_0x4d1db3;return db[_0x9433('0x3f')][_0x9433('0x53')]({'raw':!![]});})[_0x9433('0x36')](function(_0x4e4445){var _0x2c9078=fs[_0x9433('0x66')](path[_0x9433('0x67')](config[_0x9433('0x68')],_0x9433('0x69')),_0x9433('0x6a'));var _0x24d2af=fs[_0x9433('0x66')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0x9433('0x6a'));var _0x1e5630=ejs[_0x9433('0x6b')](_0x2c9078,{'trunks':_0x4e4445||[]});fs[_0x9433('0x6c')](_0x9433('0x6d'),_0x1e5630);if(_0x10aae6[_0x9433('0x6e')]){var _0x18aec7=ejs[_0x9433('0x6b')](_0x24d2af,{'trunks':_0x4e4445||[]});fs[_0x9433('0x6c')](_0x9433('0x6f'),_0x18aec7);}})[_0x9433('0x36')](function(){return respondWithRpcPromise(_0x9433('0x70'),_0x9433('0x5f'),{'module':'chan_sip.so'});})['then'](function(){var _0x4b9706=_0x5a5408[_0x9433('0x61')]['get']({'plain':!![]});if(!_0x4b9706)throw new Error(_0x9433('0x60'));if(_0x4b9706['role']===_0x9433('0x61')){var _0x2be0ca=_0x10aae6[_0x9433('0x37')]({'plain':!![]});return db[_0x9433('0x62')][_0x9433('0x5b')]({'where':{'name':'Trunks','userProfileId':_0x4b9706[_0x9433('0x63')]},'raw':!![]})[_0x9433('0x36')](function(_0x4b3513){if(_0x4b3513&&_0x4b3513[_0x9433('0x64')]===0x0){return db[_0x9433('0x65')][_0x9433('0x5f')]({'name':_0x2be0ca[_0x9433('0x3b')],'resourceId':_0x2be0ca['id'],'type':_0x4b3513[_0x9433('0x3b')],'sectionId':_0x4b3513['id']},{})[_0x9433('0x36')](function(){return _0x10aae6;});}else{return _0x10aae6;}})[_0x9433('0x55')](function(_0x2fa927){logger['error'](_0x9433('0x71'),_0x2fa927);throw _0x2fa927;});}return _0x10aae6;})[_0x9433('0x36')](respondWithResult(_0xabb804,0xc9))[_0x9433('0x55')](handleError(_0xabb804,null));};exports[_0x9433('0x34')]=function(_0x2c66f6,_0x2bd0b2,_0x50498c){var _0x33ed26;return db[_0x9433('0x3f')]['find']({'where':{'id':_0x2c66f6[_0x9433('0x56')]['id']}})[_0x9433('0x36')](handleEntityNotFound(_0x2bd0b2,null))[_0x9433('0x36')](saveUpdates(_0x2c66f6[_0x9433('0x5e')],null))['then'](function(_0x294d21){if(_0x294d21){_0x33ed26=_0x294d21;return db[_0x9433('0x3f')][_0x9433('0x53')]({'raw':!![]});}})[_0x9433('0x36')](function(_0x1bb596){if(_0x1bb596){var _0x4508ea=fs[_0x9433('0x66')](path['join'](config[_0x9433('0x68')],_0x9433('0x69')),'utf8');var _0x4e5f07=fs['readFileSync'](path['join'](config[_0x9433('0x68')],'server/files/templates/registry.ejs'),'utf8');var _0x3d7a46=ejs[_0x9433('0x6b')](_0x4508ea,{'trunks':_0x1bb596||[]});fs[_0x9433('0x6c')]('/etc/asterisk/sip_xcally_trunks.conf',_0x3d7a46);var _0x44563a=ejs[_0x9433('0x6b')](_0x4e5f07,{'trunks':_0x1bb596||[]});fs[_0x9433('0x6c')](_0x9433('0x6f'),_0x44563a);return respondWithRpcPromise(_0x9433('0x70'),_0x9433('0x34'),{'module':_0x9433('0x72')});}return null;})[_0x9433('0x36')](function(_0x1f583d){if(_0x1f583d){return _0x33ed26;}})['then'](respondWithResult(_0x2bd0b2,null))[_0x9433('0x55')](handleError(_0x2bd0b2,null));};exports['destroy']=function(_0x104ade,_0x5ca96e,_0x5343bd){var _0x4b2420;return db[_0x9433('0x3f')]['find']({'where':{'id':_0x104ade['params']['id']}})['then'](handleEntityNotFound(_0x5ca96e,null))[_0x9433('0x36')](removeEntity(_0x5ca96e,null))[_0x9433('0x36')](function(){return db[_0x9433('0x3f')][_0x9433('0x53')]({'raw':!![]});})[_0x9433('0x36')](function(_0x4838c2){var _0x4d1035=fs[_0x9433('0x66')](path[_0x9433('0x67')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0xcfb498=fs[_0x9433('0x66')](path['join'](config[_0x9433('0x68')],_0x9433('0x73')),_0x9433('0x6a'));var _0x34ff7f=ejs[_0x9433('0x6b')](_0x4d1035,{'trunks':_0x4838c2});var _0x3da0bf=ejs[_0x9433('0x6b')](_0xcfb498,{'trunks':_0x4838c2});fs[_0x9433('0x6c')](_0x9433('0x6d'),_0x34ff7f);fs[_0x9433('0x6c')]('/etc/asterisk/sip_xcally_registers.conf',_0x3da0bf);return respondWithRpcPromise(_0x9433('0x70'),_0x9433('0x35'),{'module':'chan_sip.so'});})[_0x9433('0x55')](handleError(_0x5ca96e,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 49b20f9..d926461 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 _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 +var _0x69f7=['define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./trunk.attributes'];(function(_0x24355a,_0x401e18){var _0x5df365=function(_0x3a6fa7){while(--_0x3a6fa7){_0x24355a['push'](_0x24355a['shift']());}};_0x5df365(++_0x401e18);}(_0x69f7,0x87));var _0x769f=function(_0x54988e,_0x3d6599){_0x54988e=_0x54988e-0x0;var _0x51821e=_0x69f7[_0x54988e];return _0x51821e;};'use strict';var _=require(_0x769f('0x0'));var util=require(_0x769f('0x1'));var logger=require(_0x769f('0x2'))(_0x769f('0x3'));var moment=require(_0x769f('0x4'));var BPromise=require(_0x769f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x769f('0x6'));var rimraf=require('rimraf');var config=require(_0x769f('0x7'));var attributes=require(_0x769f('0x8'));module['exports']=function(_0x55258f,_0x45544d){return _0x55258f[_0x769f('0x9')](_0x769f('0xa'),attributes,{'tableName':_0x769f('0xb'),'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 094d6d7..2d31315 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(_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 +var _0x5f2f=['map','include','model','attributes','then','ShowTrunk','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetTrunk','Trunk','findAll','options','raw','limit'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2c9040,_0x39fb32){_0x2c9040=_0x2c9040-0x0;var _0x829717=_0x5f2f[_0x2c9040];return _0x829717;};'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')]('Trunk,\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);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')]({'raw':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options']['where']||null:null,'attributes':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['attributes']||null:null,'limit':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1c')]||null:null,'include':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['include']?_[_0xf5f2('0x1d')](_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x2833fe){return{'model':db[_0x2833fe[_0xf5f2('0x1f')]],'as':_0x2833fe['as'],'attributes':_0x2833fe['attributes'],'include':_0x2833fe['include']?_[_0xf5f2('0x1d')](_0x2833fe[_0xf5f2('0x1e')],function(_0x13da6f){return{'model':db[_0x13da6f[_0xf5f2('0x1f')]],'as':_0x13da6f['as'],'attributes':_0x13da6f[_0xf5f2('0x20')],'include':_0x13da6f[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x13da6f[_0xf5f2('0x1e')],function(_0x294414){return{'model':db[_0x294414['model']],'as':_0x294414['as'],'attributes':_0x294414[_0xf5f2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x375ca8){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')]('GetTrunk',_0x20fccd,JSON['stringify'](_0x375ca8));_0x4ff59b(_0x375ca8);})[_0xf5f2('0x16')](function(_0x14c829){logger[_0xf5f2('0x11')]('GetTrunk',_0x14c829['message'],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x14c829[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x22')]=function(_0x153924){var _0x1b381e=this;return new Promise(function(_0x54c0c8,_0x52e959){return db[_0xf5f2('0x18')]['find']({'raw':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x23')]||null:null,'attributes':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x20')]||null:null,'include':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x1408b9){return{'model':db[_0x1408b9[_0xf5f2('0x1f')]],'as':_0x1408b9['as'],'attributes':_0x1408b9[_0xf5f2('0x20')],'include':_0x1408b9['include']?_[_0xf5f2('0x1d')](_0x1408b9[_0xf5f2('0x1e')],function(_0x55989d){return{'model':db[_0x55989d[_0xf5f2('0x1f')]],'as':_0x55989d['as'],'attributes':_0x55989d['attributes'],'include':_0x55989d[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x55989d[_0xf5f2('0x1e')],function(_0x2e3cca){return{'model':db[_0x2e3cca['model']],'as':_0x2e3cca['as'],'attributes':_0x2e3cca['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x46ad4a){logger[_0xf5f2('0xd')]('ShowTrunk',_0x153924);logger[_0xf5f2('0xf')]('ShowTrunk',_0x153924,JSON[_0xf5f2('0x10')](_0x46ad4a));_0x54c0c8(_0x46ad4a);})['catch'](function(_0x46f464){logger[_0xf5f2('0x11')]('ShowTrunk',_0x46f464[_0xf5f2('0x13')],_0x153924);_0x52e959(_0x1b381e[_0xf5f2('0x11')](0x1f4,_0x46f464[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 775ad27..3a93447 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 _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 +var _0x48d3=['logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addSmsAccounts','addChatWebsites','addSquareProjects','createApiKey','/:id','update','put','/:id/password','changePassword','delete','removeTeams','/:id/chat_interactions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSquareProjects','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','/describe','get','/whoami','whoami','show','getAvatar','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/:id/contacts','create','/create_many','join','root','server/files/images/','format','now','originalname','/:id/avatar','single','addAvatar'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x48d3,0x90));var _0x348d=function(_0x39c999,_0x1968b8){_0x39c999=_0x39c999-0x0;var _0x2044f=_0x48d3[_0x39c999];return _0x2044f;};'use strict';var multer=require(_0x348d('0x0'));var util=require(_0x348d('0x1'));var path=require(_0x348d('0x2'));var timeout=require(_0x348d('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x348d('0x4'));var config=require(_0x348d('0x5'));var controller=require(_0x348d('0x6'));router['get']('/',auth[_0x348d('0x7')](),controller[_0x348d('0x8')]);router['get'](_0x348d('0x9'),auth[_0x348d('0x7')](),controller['describe']);router[_0x348d('0xa')](_0x348d('0xb'),auth[_0x348d('0x7')](),controller[_0x348d('0xc')]);router['get']('/:id',auth[_0x348d('0x7')](),controller[_0x348d('0xd')]);router[_0x348d('0xa')]('/:id/avatar',controller[_0x348d('0xe')]);router['get']('/:id/contacts',auth['isAuthenticated'](),controller[_0x348d('0xf')]);router['get'](_0x348d('0x10'),auth[_0x348d('0x7')](),controller[_0x348d('0x11')]);router[_0x348d('0xa')](_0x348d('0x12'),auth[_0x348d('0x7')](),controller[_0x348d('0x13')]);router[_0x348d('0xa')](_0x348d('0x14'),auth['isAuthenticated'](),controller['getGroups']);router[_0x348d('0xa')](_0x348d('0x15'),auth[_0x348d('0x7')](),controller[_0x348d('0x16')]);router[_0x348d('0xa')](_0x348d('0x17'),auth[_0x348d('0x7')](),controller[_0x348d('0x18')]);router['get'](_0x348d('0x19'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x348d('0xa')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x348d('0x1a')]);router['get'](_0x348d('0x1b'),auth['isAuthenticated'](),controller[_0x348d('0x1c')]);router[_0x348d('0xa')](_0x348d('0x1d'),auth[_0x348d('0x7')](),controller[_0x348d('0x1e')]);router[_0x348d('0xa')](_0x348d('0x1f'),auth[_0x348d('0x7')](),controller[_0x348d('0x20')]);router[_0x348d('0xa')](_0x348d('0x21'),auth[_0x348d('0x7')](),controller[_0x348d('0x22')]);router[_0x348d('0xa')](_0x348d('0x23'),auth[_0x348d('0x7')](),controller[_0x348d('0x24')]);router[_0x348d('0xa')]('/:id/lists',auth[_0x348d('0x7')](),controller[_0x348d('0x25')]);router[_0x348d('0xa')](_0x348d('0x26'),auth[_0x348d('0x7')](),controller['getAgents']);router[_0x348d('0xa')](_0x348d('0x27'),auth[_0x348d('0x7')](),controller[_0x348d('0x28')]);router[_0x348d('0xa')]('/:id/fax_accounts',auth[_0x348d('0x7')](),controller[_0x348d('0x29')]);router['get']('/:id/mail_accounts',auth[_0x348d('0x7')](),controller[_0x348d('0x2a')]);router['get'](_0x348d('0x2b'),auth[_0x348d('0x7')](),controller[_0x348d('0x2c')]);router[_0x348d('0xa')](_0x348d('0x2d'),auth[_0x348d('0x7')](),controller[_0x348d('0x2e')]);router[_0x348d('0xa')](_0x348d('0x2f'),auth[_0x348d('0x7')](),controller[_0x348d('0x30')]);router[_0x348d('0xa')](_0x348d('0x31'),auth['isAuthenticated'](),controller[_0x348d('0x32')]);router[_0x348d('0xa')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x348d('0x33')]);router[_0x348d('0xa')](_0x348d('0x34'),auth[_0x348d('0x7')](),controller[_0x348d('0x35')]);router['get'](_0x348d('0x36'),auth[_0x348d('0x7')](),controller['getApiKey']);router[_0x348d('0x37')](_0x348d('0x38'),auth['isAuthenticated'](),controller['addContacts']);router[_0x348d('0x37')]('/',auth[_0x348d('0x7')](),controller[_0x348d('0x39')]);router[_0x348d('0x37')](_0x348d('0x3a'),auth[_0x348d('0x7')](),controller['bulkCreate']);router['post'](_0x348d('0x10'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x109741,_0x4be5c6,_0x4632a3){_0x4632a3(null,path[_0x348d('0x3b')](config[_0x348d('0x3c')],_0x348d('0x3d')));},'filename':function(_0x4eb852,_0x3291cc,_0x5a2b23){_0x5a2b23(null,util[_0x348d('0x3e')]('%s-%s',Date[_0x348d('0x3f')](),_0x3291cc[_0x348d('0x40')]));}})});router['post'](_0x348d('0x41'),upload[_0x348d('0x42')]('file'),controller[_0x348d('0x43')]);router[_0x348d('0x37')]('/:id/login',auth[_0x348d('0x7')](),controller['login']);router[_0x348d('0x37')]('/:id/logout',auth[_0x348d('0x7')](),controller[_0x348d('0x44')]);router[_0x348d('0x37')](_0x348d('0x45'),auth[_0x348d('0x7')](),controller[_0x348d('0x46')]);router[_0x348d('0x37')](_0x348d('0x47'),auth['isAuthenticated'](),controller[_0x348d('0x48')]);router['post'](_0x348d('0x23'),auth[_0x348d('0x7')](),controller[_0x348d('0x49')]);router[_0x348d('0x37')]('/:id/chat_interactions',auth[_0x348d('0x7')](),controller[_0x348d('0x4a')]);router['post'](_0x348d('0x4b'),auth[_0x348d('0x7')](),controller['addMailInteractions']);router['post']('/:id/fax_interactions',auth[_0x348d('0x7')](),controller[_0x348d('0x4c')]);router[_0x348d('0x37')](_0x348d('0x4d'),auth[_0x348d('0x7')](),controller[_0x348d('0x4e')]);router[_0x348d('0x37')](_0x348d('0x4f'),auth[_0x348d('0x7')](),controller[_0x348d('0x50')]);router[_0x348d('0x37')](_0x348d('0x51'),auth[_0x348d('0x7')](),controller[_0x348d('0x52')]);router['post'](_0x348d('0x53'),auth[_0x348d('0x7')](),controller[_0x348d('0x54')]);router[_0x348d('0x37')](_0x348d('0x55'),auth['isAuthenticated'](),controller[_0x348d('0x56')]);router[_0x348d('0x37')](_0x348d('0x2b'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0x348d('0x37')](_0x348d('0x2d'),auth[_0x348d('0x7')](),controller[_0x348d('0x57')]);router['post'](_0x348d('0x2f'),auth[_0x348d('0x7')](),controller[_0x348d('0x58')]);router[_0x348d('0x37')](_0x348d('0x31'),auth[_0x348d('0x7')](),controller['addWhatsappAccounts']);router['post']('/:id/square_projects',auth[_0x348d('0x7')](),controller[_0x348d('0x59')]);router['post'](_0x348d('0x36'),auth['isAuthenticated'](),controller[_0x348d('0x5a')]);router['put'](_0x348d('0x5b'),auth[_0x348d('0x7')](),controller[_0x348d('0x5c')]);router[_0x348d('0x5d')](_0x348d('0x5e'),auth['isAuthenticated'](),controller[_0x348d('0x5f')]);router[_0x348d('0x60')]('/:id/queues',auth[_0x348d('0x7')](),controller['removeQueues']);router[_0x348d('0x60')](_0x348d('0x23'),auth['isAuthenticated'](),controller[_0x348d('0x61')]);router['delete'](_0x348d('0x5b'),auth[_0x348d('0x7')](),controller['destroy']);router[_0x348d('0x60')](_0x348d('0x62'),auth[_0x348d('0x7')](),controller['removeChatInteractions']);router[_0x348d('0x60')](_0x348d('0x4b'),auth[_0x348d('0x7')](),controller[_0x348d('0x63')]);router[_0x348d('0x60')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x348d('0x64')]);router['delete']('/:id/sms_interactions',auth[_0x348d('0x7')](),controller['removeSmsInteractions']);router[_0x348d('0x60')](_0x348d('0x4f'),auth[_0x348d('0x7')](),controller[_0x348d('0x65')]);router[_0x348d('0x60')](_0x348d('0x51'),auth[_0x348d('0x7')](),controller['removeWhatsappInteractions']);router[_0x348d('0x60')](_0x348d('0x53'),auth[_0x348d('0x7')](),controller[_0x348d('0x66')]);router['delete'](_0x348d('0x55'),auth[_0x348d('0x7')](),controller['removeMailAccounts']);router[_0x348d('0x60')](_0x348d('0x2b'),auth[_0x348d('0x7')](),controller[_0x348d('0x67')]);router[_0x348d('0x60')](_0x348d('0x2d'),auth[_0x348d('0x7')](),controller['removeSmsAccounts']);router['delete']('/:id/chat_websites',auth['isAuthenticated'](),controller['removeChatWebsites']);router['delete']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0x348d('0x60')]('/:id/square_projects',auth[_0x348d('0x7')](),controller[_0x348d('0x68')]);router[_0x348d('0x60')](_0x348d('0x36'),auth[_0x348d('0x7')](),controller['removeApiKey']);module[_0x348d('0x69')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index b0b2005..18defb6 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 _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 +var _0x01e0=['from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','insecure','never','\x22\x22\x20<>','accept','refuse','originate','uac','uas','certificate','active','passive','update,nonat','showWebBar','isArray','udp','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','/etc/pki/tls/certs/motion.crt','TEXT','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','toLowerCase','ENUM','admin','user','local','accountcode','format','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','friend','peer'];(function(_0x101d25,_0x33dbba){var _0x586671=function(_0x2d7f63){while(--_0x2d7f63){_0x101d25['push'](_0x101d25['shift']());}};_0x586671(++_0x33dbba);}(_0x01e0,0x96));var _0x001e=function(_0x53e35e,_0x114a69){_0x53e35e=_0x53e35e-0x0;var _0xaaaa6a=_0x01e0[_0x53e35e];return _0xaaaa6a;};'use strict';var Sequelize=require(_0x001e('0x0'));var moment=require(_0x001e('0x1'));var util=require(_0x001e('0x2'));var _=require(_0x001e('0x3'));module[_0x001e('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x001e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x51aca1){this['setDataValue']('name',_0x51aca1);this[_0x001e('0x6')](_0x001e('0x7'),_0x51aca1);},'comment':_0x001e('0x8')},'fullname':{'type':Sequelize[_0x001e('0x9')],'allowNull':![],'set':function(_0x4faea7){this[_0x001e('0x6')](_0x001e('0xa'),_0x4faea7);this[_0x001e('0x6')](_0x001e('0xb'),util['format'](_0x001e('0xc'),_0x4faea7,this[_0x001e('0xd')](_0x001e('0xe'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x001e('0x9')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x1959ed){if(_0x1959ed){this[_0x001e('0x6')]('email',_0x1959ed[_0x001e('0xf')]());}}},'role':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x11'),_0x001e('0x12'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x001e('0x9')],'defaultValue':_0x001e('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x001e('0xe'),'set':function(_0x13e8df){this[_0x001e('0x6')]('internal',_0x13e8df);this[_0x001e('0x6')](_0x001e('0x14'),_0x13e8df);this[_0x001e('0x6')]('callerid',util[_0x001e('0x15')](_0x001e('0xc'),this[_0x001e('0xd')](_0x001e('0xa')),_0x13e8df));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x001e('0x9')]},'mobile':{'type':Sequelize[_0x001e('0x9')]},'address':{'type':Sequelize[_0x001e('0x9')]},'zipcode':{'type':Sequelize[_0x001e('0x9')]},'userpic':{'type':Sequelize[_0x001e('0x9')]},'city':{'type':Sequelize[_0x001e('0x9')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x001e('0x17')]},'voicePause':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x001e('0x18')},'lastPauseAt':{'type':Sequelize[_0x001e('0x17')]},'chatCapacity':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x001e('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x001e('0x19')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x001e('0x19')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x1a'),_0x001e('0x12'),_0x001e('0x1b')),'allowNull':!![],'defaultValue':_0x001e('0x1a')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x001e('0x1c')},'callingpres':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x1d'),_0x001e('0x1e'),_0x001e('0x1f'),_0x001e('0x20'),_0x001e('0x21'),_0x001e('0x22'),_0x001e('0x23'),_0x001e('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'permit':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'secret':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'transport':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![],'defaultValue':'udp','set':function(_0x13005f){this[_0x001e('0x6')]('transport',_0x13005f?_0x13005f['join'](','):null);},'get':function(){return this[_0x001e('0xd')](_0x001e('0x25'))?this[_0x001e('0xd')](_0x001e('0x25'))[_0x001e('0x26')](','):null;},'comment':_0x001e('0x27')},'dtmfmode':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x28'),'info',_0x001e('0x29'),'inband',_0x001e('0x2a')),'allowNull':!![],'defaultValue':_0x001e('0x28')},'directmedia':{'type':Sequelize['ENUM'](_0x001e('0x2b'),'no',_0x001e('0x2c'),_0x001e('0x2d'),_0x001e('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x001e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'nat':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![],'defaultValue':_0x001e('0x2f'),'set':function(_0x227c93){this[_0x001e('0x6')](_0x001e('0x30'),_0x227c93?_0x227c93[_0x001e('0x31')](','):null);},'get':function(){return this[_0x001e('0xd')](_0x001e('0x30'))?this[_0x001e('0xd')]('nat')[_0x001e('0x26')](','):null;},'comment':_0x001e('0x32')},'callgroup':{'type':Sequelize[_0x001e('0x9')]},'namedcallgroup':{'type':Sequelize[_0x001e('0x9')]},'pickupgroup':{'type':Sequelize[_0x001e('0x9')]},'namedpickupgroup':{'type':Sequelize[_0x001e('0x9')]},'language':{'type':Sequelize[_0x001e('0x9')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x001e('0x9')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x001e('0x33')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x8357b6){this['setDataValue'](_0x001e('0x34'),_0x8357b6?_0x8357b6[_0x001e('0x31')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x001e('0xd')]('allow')?this[_0x001e('0xd')](_0x001e('0x34'))[_0x001e('0x26')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![],'set':function(_0x4a82d3){this[_0x001e('0x6')](_0x001e('0x35'),_0x4a82d3?_0x4a82d3[_0x001e('0x31')](','):null);},'get':function(){return this[_0x001e('0xd')]('insecure')?this['getDataValue']('insecure')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x001e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no',_0x001e('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![],'defaultValue':_0x001e('0x37')},'amaflags':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x001e('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x001e('0x2b')},'busylevel':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x001e('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'template':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x001e('0x2b'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x38'),_0x001e('0x39'),_0x001e('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x001e('0x3b'),_0x001e('0x3c')),'allowNull':!![],'defaultValue':_0x001e('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x001e('0x2b')},'keepalive':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x001e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x001e('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x001e('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no','fingerprint',_0x001e('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x001e('0x3e'),_0x001e('0x3f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x001e('0x10')]('yes','no',_0x001e('0x2c'),'update',_0x001e('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x001e('0x9')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x001e('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x001e('0x9')]},'showWebBar':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x0,'set':function(_0x511f65){this['setDataValue'](_0x001e('0x41'),_0x511f65);var _0x2fb3d2=this['get']({'plain':!![]});switch(_0x511f65){case 0x0:case 0x1:var _0x554d2e=_0x2fb3d2[_0x001e('0x25')]?_[_0x001e('0x42')](_0x2fb3d2[_0x001e('0x25')])?_0x2fb3d2[_0x001e('0x25')][_0x001e('0x31')]():_0x2fb3d2['transport']:_0x001e('0x43');if(_0x554d2e==='wss'){_0x554d2e=_0x001e('0x43');}this['setDataValue'](_0x001e('0x25'),_0x554d2e);this[_0x001e('0x6')]('encryption','no');this['setDataValue'](_0x001e('0x44'),null);this[_0x001e('0x6')](_0x001e('0x45'),null);this[_0x001e('0x6')](_0x001e('0x46'),null);this[_0x001e('0x6')](_0x001e('0x47'),null);this['setDataValue'](_0x001e('0x48'),null);this[_0x001e('0x6')](_0x001e('0x49'),null);this[_0x001e('0x6')](_0x001e('0x4a'),null);this[_0x001e('0x6')](_0x001e('0x4b'),null);this[_0x001e('0x6')](_0x001e('0x4c'),'no');break;case 0x2:this['setDataValue'](_0x001e('0x25'),_0x001e('0x4d'));this[_0x001e('0x6')]('encryption',_0x001e('0x2b'));this[_0x001e('0x6')](_0x001e('0x44'),'yes');this[_0x001e('0x6')](_0x001e('0x45'),'yes');this[_0x001e('0x6')]('icesupport',_0x001e('0x2b'));this[_0x001e('0x6')]('dtlsenable',_0x001e('0x2b'));this[_0x001e('0x6')](_0x001e('0x48'),'no');this['setDataValue']('dtlssetup','actpass');this[_0x001e('0x6')]('dtlscertfile',_0x2fb3d2[_0x001e('0x4a')]||_0x001e('0x4e'));this[_0x001e('0x6')](_0x001e('0x4b'),_0x2fb3d2['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0x001e('0x6')](_0x001e('0x4c'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x001e('0x4f')],'set':function(_0x5a09e2){this[_0x001e('0x6')]('permissions',_0x5a09e2?_0x5a09e2[_0x001e('0x31')](','):[]);},'get':function(){return this[_0x001e('0xd')](_0x001e('0x50'))?_[_0x001e('0x51')](this[_0x001e('0xd')](_0x001e('0x50'))[_0x001e('0x26')](','),function(_0x44a444){return parseInt(_0x44a444,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x001e('0x9')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x001e('0x9')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x001e('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x001e('0x9')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x001e('0x9')]},'phoneBarEnableJaws':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x001e('0xd')]('phoneBarEnableScreenRecordingByAgent')?this[_0x001e('0xd')](_0x001e('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x001e('0x9')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![],'set':function(_0xe28dcd){if(typeof _0xe28dcd===_0x001e('0x53')){var _0x1935e0=_0xe28dcd==='1'?!![]:_0xe28dcd==='0'?![]:_0xe28dcd===_0x001e('0x54')?!![]:_0xe28dcd===_0x001e('0x55')?![]:![];this[_0x001e('0x6')](_0x001e('0x56'),_0x1935e0);}else{this[_0x001e('0x6')]('screenrecording',_0xe28dcd);}}},'blocked':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![],'set':function(_0x4ada42){this[_0x001e('0x6')]('blocked',_0x4ada42);if(_0x4ada42===!![]){this[_0x001e('0x6')](_0x001e('0x57'),moment());this[_0x001e('0x6')](_0x001e('0x58'),0x0);}else{this[_0x001e('0x6')](_0x001e('0x57'),null);}}},'blockedAt':{'type':Sequelize[_0x001e('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x001e('0x16')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 70c4e8b..28ded2c 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 _0x00ee=['fax','sms','whatsapp','openchannel','manual','set','%s%s','Pause','getTeams','Team','addTeams','setDataValue','Voice','getChatQueues','Chat','getMailQueues','getSmsQueues','Sms','getWhatsappQueues','getOpenchannelQueues','Openchannel','flatten','addAgent','online','getDataValue','removeTeams','getVoiceQueues','Mail','Whatsapp','getFaxQueues','removeAgent','Queue:remove','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$lt','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','firstName','lastName','Contact','VoiceQueue','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','client','http','request','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','offset','limit','Content-Range','json','reject','save','then','destroy','role','user','Telephones','telephone','filter','ignore','map','value','includes','find','UserProfileResource','stack','name','send','index','User','rawAttributes','fieldName','type','key','model','salt','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','sequelize','lower','col','options','count','includeAll','include','rows','show','params','differenceBy','password','intersection','update','body','describe','addContacts','ids','omit','internal','Setting','securePassword','validatePasswordPattern','max','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','length','from','voicemail','mailbox','VoiceMail','fullname','agent','permissions','101','102','110','106','107','108','100','111','114','create','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','push','all','each','findAll','isEmpty','Agents','compact','oldPassword','newPassword','Sequelize','authenticate','ValidationError','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','toLowerCase','Queues','penalty','spread','capitalize','emit','Queue:save','voice','get','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','channel','remove','QueueId','userpic','filename','getAvatar','join','server/files/images/logos/default_profile.png','download','existsSync','root','server/files/images/','CmContact','order','getContacts','CmList','Tags','color','tag','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','remoteAddress','socket','connection','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','concat','LOGININPAUSE','isMiddleware','resolve','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','openchannelPause','smsPause','whatsapppause','lastPauseAt','QueuePause','mail','chat'];(function(_0x465f40,_0x1bce48){var _0x3d61cd=function(_0x4e1f6c){while(--_0x4e1f6c){_0x465f40['push'](_0x465f40['shift']());}};_0x3d61cd(++_0x1bce48);}(_0x00ee,0x1e6));var _0xe00e=function(_0x16ea87,_0x378d8b){_0x16ea87=_0x16ea87-0x0;var _0x6e7b1c=_0x00ee[_0x16ea87];return _0x6e7b1c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe00e('0x0'));var rimraf=require(_0xe00e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe00e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe00e('0x3'));var util=require(_0xe00e('0x4'));var path=require(_0xe00e('0x5'));var sox=require(_0xe00e('0x6'));var csv=require(_0xe00e('0x7'));var ejs=require(_0xe00e('0x8'));var fs=require('fs');var _=require(_0xe00e('0x9'));var squel=require(_0xe00e('0xa'));var crypto=require(_0xe00e('0xb'));var jsforce=require(_0xe00e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe00e('0x7'));var querystring=require(_0xe00e('0xd'));var Papa=require('papaparse');var Redis=require(_0xe00e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe00e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe00e('0x10'));var logger=require(_0xe00e('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xe00e('0x12'));var licenseUtil=require(_0xe00e('0x13'));var db=require(_0xe00e('0x14'))['db'];config[_0xe00e('0x15')]=_[_0xe00e('0x16')](config[_0xe00e('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xe00e('0x17'))(new Redis(config[_0xe00e('0x15')]));require('./user.socket')[_0xe00e('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe00e('0x19')][_0xe00e('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2ad59d,_0x51ce43,_0x3d29c9,_0x1cabcf){return new BPromise(function(_0x1d0b9a,_0x926c55){var _0x49c015=_0x1cabcf||client;return _0x49c015[_0xe00e('0x1b')](_0x2ad59d,_0x3d29c9)['then'](function(_0x439a9c){logger[_0xe00e('0x1c')](_0xe00e('0x1d'),_0x51ce43,'request\x20sent');logger[_0xe00e('0x1e')](_0xe00e('0x1f'),_0x51ce43,_0xe00e('0x20'),JSON[_0xe00e('0x21')](_0x439a9c));if(_0x439a9c[_0xe00e('0x22')]){if(_0x439a9c[_0xe00e('0x22')][_0xe00e('0x23')]===0x1f4){logger['error'](_0xe00e('0x1d'),_0x51ce43,_0x439a9c[_0xe00e('0x22')][_0xe00e('0x24')]);return _0x926c55(_0x439a9c[_0xe00e('0x22')][_0xe00e('0x24')]);}logger[_0xe00e('0x22')](_0xe00e('0x1d'),_0x51ce43,_0x439a9c[_0xe00e('0x22')]['message']);return _0x1d0b9a(_0x439a9c[_0xe00e('0x22')][_0xe00e('0x24')]);}else{logger['info'](_0xe00e('0x1d'),_0x51ce43,_0xe00e('0x20'));_0x1d0b9a(_0x439a9c['result'][_0xe00e('0x24')]);}})[_0xe00e('0x25')](function(_0x5a48f5){logger[_0xe00e('0x22')](_0xe00e('0x1d'),_0x51ce43,_0x5a48f5);_0x926c55(_0x5a48f5);});});}function respondWithStatusCode(_0x21e23e,_0x6da188){_0x6da188=_0x6da188||0xcc;return function(_0x239aa6){if(_0x239aa6){return _0x21e23e[_0xe00e('0x26')](_0x6da188);}return _0x21e23e[_0xe00e('0x27')](_0x6da188)[_0xe00e('0x28')]();};}function respondWithResult(_0x1eaa7e,_0x27b069){_0x27b069=_0x27b069||0xc8;return function(_0x31c1a5){if(_0x31c1a5){return _0x1eaa7e[_0xe00e('0x27')](_0x27b069)['json'](_0x31c1a5);}};}function respondWithFilteredResult(_0x10551e,_0x2149bf){return function(_0x38d8eb){if(_0x38d8eb){var _0x114a21=_0x38d8eb['count'],_0x275adb=_0x2149bf[_0xe00e('0x29')],_0x26c22f=_0x2149bf['offset']+_0x2149bf[_0xe00e('0x2a')],_0x12445f;if(_0x26c22f>=_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')]=_0x1ddfe1){_0x138d67=_0x1ddfe1;_0x4de463=0xc8;}else{_0x4de463=0xce;}_0x5a8ed6[_0x9ba3('0x30')](_0x4de463);return _0x5a8ed6[_0x9ba3('0x35')](_0x9ba3('0x36'),_0x142c0a+'-'+_0x138d67+'/'+_0x1ddfe1)[_0x9ba3('0x32')](_0x2e8f04);}return null;};}function patchUpdates(_0x232a31){return function(_0x582b99){try{jsonpatch['apply'](_0x582b99,_0x232a31,!![]);}catch(_0x3f2d1f){return BPromise[_0x9ba3('0x37')](_0x3f2d1f);}return _0x582b99['save']();};}function saveUpdates(_0x44a023,_0x357ca9){return function(_0x383c11){if(_0x383c11){return _0x383c11[_0x9ba3('0x38')](_0x44a023)[_0x9ba3('0x24')](function(_0xf48b43){return _0xf48b43;});}return null;};}function removeEntity(_0x59c12a,_0x512179){return function(_0x44f528){if(_0x44f528){return _0x44f528[_0x9ba3('0x39')]()[_0x9ba3('0x24')](function(){var _0x1b3306=_0x44f528['get']({'plain':!![]});if(_0x1b3306[_0x9ba3('0x3a')]===_0x9ba3('0x3b'))return;var _0x1cd6d0=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x9ba3('0x3c'),'value':_0x9ba3('0x3d'),'ignore':![]},{'name':_0x9ba3('0x3e'),'value':_0x9ba3('0x3f'),'ignore':![]}];var _0x39fc4b=_(_0x1cd6d0)[_0x9ba3('0x40')]('ignore')[_0x9ba3('0x41')](_0x9ba3('0x42'))['value']();if(_[_0x9ba3('0x43')](_0x39fc4b,_0x1b3306[_0x9ba3('0x3a')])){return;}var _0x1e20f9=_[_0x9ba3('0x44')](_0x1cd6d0,[_0x9ba3('0x42'),_0x1b3306[_0x9ba3('0x3a')]])[_0x9ba3('0x45')];return db['UserProfileResource'][_0x9ba3('0x39')]({'where':{'type':_0x1e20f9,'resourceId':_0x1b3306['id']}})[_0x9ba3('0x24')](function(){return _0x44f528;});})[_0x9ba3('0x24')](function(){_0x59c12a[_0x9ba3('0x30')](0xcc)[_0x9ba3('0x31')]();});}};}function handleEntityNotFound(_0x4f6b20,_0x4577eb){return function(_0x1a0d70){if(!_0x1a0d70){_0x4f6b20[_0x9ba3('0x2f')](0x194);}return _0x1a0d70;};}function handleError(_0x41357d,_0x43e7f1){_0x43e7f1=_0x43e7f1||0x1f4;return function(_0xd64eba){logger[_0x9ba3('0x2b')](_0xd64eba['stack']);if(_0xd64eba[_0x9ba3('0x45')]){delete _0xd64eba[_0x9ba3('0x45')];}_0x41357d[_0x9ba3('0x30')](_0x43e7f1)[_0x9ba3('0x46')](_0xd64eba);};}exports[_0x9ba3('0x47')]=function(_0x8f9b1b,_0x3bd02c){var _0x950d0={},_0x478c16={},_0x3b7234={'count':0x0,'rows':[]};var _0x5e083f=_[_0x9ba3('0x41')](db[_0x9ba3('0x48')]['rawAttributes'],function(_0x50292c){return{'name':_0x50292c[_0x9ba3('0x49')],'type':_0x50292c['type'][_0x9ba3('0x4a')]};});_0x478c16[_0x9ba3('0x4b')]=_[_0x9ba3('0x4c')](_[_0x9ba3('0x41')](_0x5e083f,'name'),[_0x9ba3('0x4d'),'salt']);_0x478c16['query']=_[_0x9ba3('0x4e')](_0x8f9b1b[_0x9ba3('0x4f')]);_0x478c16['filters']=_[_0x9ba3('0x50')](_0x478c16[_0x9ba3('0x4b')],_0x478c16[_0x9ba3('0x4f')]);_0x950d0['attributes']=_[_0x9ba3('0x50')](_0x478c16[_0x9ba3('0x4b')],qs[_0x9ba3('0x51')](_0x8f9b1b[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x950d0[_0x9ba3('0x52')]=_0x950d0[_0x9ba3('0x52')][_0x9ba3('0x53')]?_0x950d0['attributes']:_0x478c16[_0x9ba3('0x4b')];if(!_0x8f9b1b['query'][_0x9ba3('0x54')](_0x9ba3('0x55'))){_0x950d0[_0x9ba3('0x34')]=qs[_0x9ba3('0x34')](_0x8f9b1b[_0x9ba3('0x4f')]['limit']);_0x950d0[_0x9ba3('0x56')]=qs[_0x9ba3('0x56')](_0x8f9b1b[_0x9ba3('0x4f')][_0x9ba3('0x56')]);}_0x950d0['order']=qs['sort'](_0x8f9b1b[_0x9ba3('0x4f')]['sort']);_0x950d0['where']=qs['filters'](_[_0x9ba3('0x57')](_0x8f9b1b[_0x9ba3('0x4f')],_0x478c16[_0x9ba3('0x58')]),_0x5e083f);if(_0x8f9b1b[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x950d0['where']=_[_0x9ba3('0x59')](_0x950d0['where'],{'$or':_[_0x9ba3('0x41')](_0x5e083f,function(_0x24f178){if(_0x24f178['type']!==_0x9ba3('0x5a')){return db[_0x9ba3('0x5b')][_0x9ba3('0x5c')](db[_0x9ba3('0x5b')]['fn'](_0x9ba3('0x5d'),db['sequelize'][_0x9ba3('0x5e')](_0x24f178[_0x9ba3('0x45')])),{'$like':db[_0x9ba3('0x5b')]['fn'](_0x9ba3('0x5d'),'%'+_0x8f9b1b[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%')});}})});}_0x950d0=_['merge']({},_0x950d0,_0x8f9b1b[_0x9ba3('0x5f')]);var _0x260d16={'where':_0x950d0[_0x9ba3('0x5c')]};return db['User'][_0x9ba3('0x33')](_0x260d16)[_0x9ba3('0x24')](function(_0x535760){_0x3b7234[_0x9ba3('0x33')]=_0x535760;if(_0x8f9b1b[_0x9ba3('0x4f')]['includeAll']){_0x950d0['include']=[{'all':!![]}];}return db[_0x9ba3('0x48')][_0x9ba3('0x60')](_0x950d0);})[_0x9ba3('0x24')](function(_0xb58652){_0x3b7234[_0x9ba3('0x61')]=_0xb58652;return _0x3b7234;})[_0x9ba3('0x24')](respondWithFilteredResult(_0x3bd02c,_0x950d0))[_0x9ba3('0x62')](handleError(_0x3bd02c,null));};exports[_0x9ba3('0x63')]=function(_0x2bdc30,_0x13e502){var _0x45b83d={'raw':![],'where':{'id':_0x2bdc30[_0x9ba3('0x64')]['id']}},_0x32b307={};_0x32b307['model']=_[_0x9ba3('0x4c')](_[_0x9ba3('0x4e')](db['User'][_0x9ba3('0x65')]),['password',_0x9ba3('0x66')]);_0x32b307[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0x2bdc30[_0x9ba3('0x4f')]);_0x32b307[_0x9ba3('0x58')]=_['intersection'](_0x32b307[_0x9ba3('0x4b')],_0x32b307[_0x9ba3('0x4f')]);_0x45b83d[_0x9ba3('0x52')]=_[_0x9ba3('0x50')](_0x32b307[_0x9ba3('0x4b')],qs[_0x9ba3('0x51')](_0x2bdc30[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x45b83d[_0x9ba3('0x52')]=_0x45b83d[_0x9ba3('0x52')][_0x9ba3('0x53')]?_0x45b83d['attributes']:_0x32b307[_0x9ba3('0x4b')];if(_0x2bdc30[_0x9ba3('0x4f')][_0x9ba3('0x67')]){_0x45b83d['include']=[{'all':!![]}];}_0x45b83d=_[_0x9ba3('0x59')]({},_0x45b83d,_0x2bdc30[_0x9ba3('0x5f')]);return db[_0x9ba3('0x48')][_0x9ba3('0x44')](_0x45b83d)[_0x9ba3('0x24')](handleEntityNotFound(_0x13e502,null))['then'](respondWithResult(_0x13e502,null))[_0x9ba3('0x62')](handleError(_0x13e502,null));};exports['update']=function(_0x537ced,_0x11e484){if(_0x537ced[_0x9ba3('0x68')]['id']){delete _0x537ced[_0x9ba3('0x68')]['id'];}delete _0x537ced[_0x9ba3('0x68')][_0x9ba3('0x3a')];return db['User'][_0x9ba3('0x44')]({'where':{'id':_0x537ced[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x11e484,null))['then'](saveUpdates(_0x537ced['body'],null))[_0x9ba3('0x24')](respondWithResult(_0x11e484,null))[_0x9ba3('0x62')](handleError(_0x11e484,null));};exports[_0x9ba3('0x69')]=function(_0x17e682,_0x14a470){return db['User']['describe']()[_0x9ba3('0x24')](respondWithResult(_0x14a470,null))['catch'](handleError(_0x14a470,null));};exports['addContacts']=function(_0x486999,_0x297a7e,_0x33e55c){return db['User'][_0x9ba3('0x44')]({'where':{'id':_0x486999['params']['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x297a7e,null))[_0x9ba3('0x24')](function(_0x379da8){if(_0x379da8){return _0x379da8['addContacts'](_0x486999[_0x9ba3('0x68')][_0x9ba3('0x6a')],_['omit'](_0x486999[_0x9ba3('0x68')],[_0x9ba3('0x6a'),'id'])||{});}})[_0x9ba3('0x24')](respondWithResult(_0x297a7e,null))['catch'](handleError(_0x297a7e,null));};function validateUser(_0x461051){return new BPromise(function(_0x496b08,_0xae51a9){if(_0x461051[_0x9ba3('0x6b')])return _0x496b08(_0x461051);return db[_0x9ba3('0x6c')][_0x9ba3('0x6d')](0x1)[_0x9ba3('0x24')](function(_0x3463d0){if(_0x3463d0[_0x9ba3('0x6e')])authService['validatePasswordPattern'](_0x461051[_0x9ba3('0x4d')]);db[_0x9ba3('0x48')][_0x9ba3('0x6f')](_0x9ba3('0x6b'))[_0x9ba3('0x24')](function(_0x3680eb){if(_[_0x9ba3('0x70')](_0x3680eb)){_0x461051['internal']=_0x3463d0['min_internal']||0x1;return;}if(_[_0x9ba3('0x70')](_0x3463d0[_0x9ba3('0x71')])||_0x3463d0[_0x9ba3('0x71')]===_0x3680eb){_0x461051[_0x9ba3('0x6b')]=_0x3680eb+0x1;return;}if(_0x3463d0['min_internal']>_0x3680eb){_0x461051[_0x9ba3('0x6b')]=_0x3463d0[_0x9ba3('0x71')];return;}return db[_0x9ba3('0x5b')]['query'](_0x9ba3('0x72'),{'type':db[_0x9ba3('0x5b')][_0x9ba3('0x73')][_0x9ba3('0x74')]})['then'](function(_0x6cd3c1){if(_0x6cd3c1&&_0x6cd3c1['length']){for(var _0x20d68=0x0,_0x31c9e1=_0x6cd3c1[_0x9ba3('0x53')];_0x20d68<_0x31c9e1&&_[_0x9ba3('0x70')](_0x461051['internal']);_0x20d68++){if(_0x3463d0['min_internal']<=_0x6cd3c1[_0x20d68][_0x9ba3('0x75')]){_0x461051[_0x9ba3('0x6b')]=_0x6cd3c1[_0x20d68][_0x9ba3('0x75')];}else if(_0x3463d0[_0x9ba3('0x71')]>_0x6cd3c1[_0x20d68][_0x9ba3('0x75')]&&_0x3463d0['min_internal']<=_0x6cd3c1[_0x20d68]['to']){_0x461051[_0x9ba3('0x6b')]=_0x3463d0['min_internal'];}}}if(_[_0x9ba3('0x70')](_0x461051[_0x9ba3('0x6b')])){_0x461051[_0x9ba3('0x6b')]=_0x3680eb+0x1;}return _0x496b08(_0x461051);});});})[_0x9ba3('0x62')](function(_0x29fab3){_0xae51a9(_0x29fab3);});});}function updateUser(_0x521e74){return new BPromise(function(_0xd9f941,_0x172cc7){try{if(_0x521e74['voicemail']){_0x521e74[_0x9ba3('0x76')]=_0x521e74[_0x9ba3('0x6b')];_0x521e74[_0x9ba3('0x77')]={'mailbox':_0x521e74[_0x9ba3('0x6b')],'password':_0x521e74[_0x9ba3('0x4d')],'fullname':_0x521e74[_0x9ba3('0x78')],'email':_0x521e74['email']};}if(_0x521e74[_0x9ba3('0x3a')]===_0x9ba3('0x3d')){if(!_0x521e74[_0x9ba3('0x79')])_0x521e74[_0x9ba3('0x79')]=[_0x9ba3('0x7a'),_0x9ba3('0x7b'),_0x9ba3('0x7c'),_0x9ba3('0x7d'),_0x9ba3('0x7e'),'104',_0x9ba3('0x7f'),_0x9ba3('0x80'),_0x9ba3('0x81'),_0x9ba3('0x82'),'109',_0x9ba3('0x83'),_0x9ba3('0x84'),_0x9ba3('0x85')];}_0xd9f941(_0x521e74);}catch(_0x10bf90){_0x172cc7(_0x10bf90);}});}exports['create']=function(_0x39a1f7,_0xe70e2b){if(_0x39a1f7[_0x9ba3('0x86')][_0x9ba3('0x3a')]===_0x9ba3('0x3d'))throw new Error(_0x9ba3('0x87'));if(_0x39a1f7[_0x9ba3('0x68')][_0x9ba3('0x3a')]===_0x9ba3('0x86')&&_0x39a1f7[_0x9ba3('0x86')]['role']!==_0x9ba3('0x3b')){throw new Error(_0x9ba3('0x88'));}if(_0x39a1f7[_0x9ba3('0x68')][_0x9ba3('0x3a')]===_0x9ba3('0x3b')&&_0x39a1f7[_0x9ba3('0x86')][_0x9ba3('0x3a')]!=='admin'){throw new Error(_0x9ba3('0x89'));}return licenseUtil[_0x9ba3('0x8a')]([_0x39a1f7[_0x9ba3('0x68')]])['then'](function(){return validateUser(_0x39a1f7[_0x9ba3('0x68')]);})[_0x9ba3('0x24')](function(_0x5d43ee){return updateUser(_0x5d43ee)['then'](function(_0x29f20c){if(_0x29f20c[_0x9ba3('0x3a')]==='admin'){_0x29f20c[_0x9ba3('0x8b')]=_0x39a1f7[_0x9ba3('0x86')]['settingsEnabled'];delete _0x29f20c[_0x9ba3('0x8c')];}return _0x29f20c;});})[_0x9ba3('0x24')](function(_0x11b715){return db['User'][_0x9ba3('0x8d')](_0x11b715,{'include':[{'model':db[_0x9ba3('0x77')],'as':_0x9ba3('0x77')}]});})[_0x9ba3('0x24')](function(_0x3253b7){if(_0x39a1f7['body'][_0x9ba3('0x3a')]===_0x9ba3('0x86'))return _0x3253b7;if(_0x39a1f7[_0x9ba3('0x86')][_0x9ba3('0x3a')]!==_0x9ba3('0x86'))return _0x3253b7;return db[_0x9ba3('0x8e')]['find']({'where':{'name':_0x3253b7[_0x9ba3('0x3a')]===_0x9ba3('0x3d')?_0x9ba3('0x3c'):_0x9ba3('0x3e'),'userProfileId':_0x39a1f7[_0x9ba3('0x86')][_0x9ba3('0x8c')]},'raw':!![]})[_0x9ba3('0x24')](function(_0x36f014){if(!_0x36f014||_0x36f014['autoAssociation']!=0x0)return _0x3253b7;return db['UserProfileResource'][_0x9ba3('0x8d')]({'name':_0x3253b7['name'],'resourceId':_0x3253b7['id'],'type':_0x36f014[_0x9ba3('0x45')],'sectionId':_0x36f014['id']},{})[_0x9ba3('0x24')](function(){return _0x3253b7;});})['catch'](function(_0x1731d1){logger[_0x9ba3('0x2b')](_0x9ba3('0x8f'),_0x1731d1);throw _0x1731d1;});})[_0x9ba3('0x24')](respondWithResult(_0xe70e2b,0xc9))['catch'](handleError(_0xe70e2b,null));};exports[_0x9ba3('0x90')]=function(_0x1ed63d,_0x3bf9c6){var _0x51ad80=_0x1ed63d[_0x9ba3('0x68')];var _0x571dff=[];if(_0x1ed63d['user'][_0x9ba3('0x3a')]===_0x9ba3('0x3d'))throw new Error(_0x9ba3('0x87'));if(_[_0x9ba3('0x91')](_0x51ad80,[_0x9ba3('0x3a'),'user'])&&_0x1ed63d[_0x9ba3('0x86')][_0x9ba3('0x3a')]!=='admin'){throw new Error(_0x9ba3('0x88'));}if(_[_0x9ba3('0x91')](_0x51ad80,[_0x9ba3('0x3a'),'admin'])&&_0x1ed63d['user']['role']!=='admin'){throw new Error(_0x9ba3('0x92'));}return licenseUtil[_0x9ba3('0x8a')](_0x51ad80)[_0x9ba3('0x24')](function(){return validateUser(_0x51ad80[0x0]);})[_0x9ba3('0x24')](function(){for(var _0x38df5a=0x1;_0x38df5a<_0x51ad80[_0x9ba3('0x53')];_0x38df5a++){var _0x7da61e=_0x51ad80[_0x38df5a-0x1][_0x9ba3('0x6b')];if(!_0x51ad80[_0x38df5a]['internal'])_0x51ad80[_0x38df5a][_0x9ba3('0x6b')]=_0x7da61e+0x1;_0x571dff[_0x9ba3('0x93')](validateUser(_0x51ad80[_0x38df5a]));}return BPromise[_0x9ba3('0x94')](_0x571dff);})[_0x9ba3('0x24')](function(){_0x571dff=[];for(var _0x481d6d=0x0;_0x481d6d<_0x51ad80[_0x9ba3('0x53')];_0x481d6d++){_0x571dff['push'](updateUser(_0x51ad80[_0x481d6d]));}return BPromise['all'](_0x571dff);})[_0x9ba3('0x24')](function(){return BPromise[_0x9ba3('0x95')](_0x51ad80,function(_0x3d1f65){return db[_0x9ba3('0x48')][_0x9ba3('0x8d')](_0x3d1f65,{'include':[{'model':db[_0x9ba3('0x77')],'as':_0x9ba3('0x77')}]})['then'](function(_0x23ad27){_0x3d1f65['id']=_0x23ad27['id'];return _0x3d1f65;});});})[_0x9ba3('0x24')](function(_0x2492b8){if(_0x1ed63d[_0x9ba3('0x68')][_0x9ba3('0x3a')]===_0x9ba3('0x86'))return _0x2492b8;if(_0x1ed63d['user'][_0x9ba3('0x3a')]!==_0x9ba3('0x86'))return _0x2492b8;var _0x13542c=_['some'](_0x2492b8,function(_0xe9326c){return _0xe9326c['role']===_0x9ba3('0x3d')||_0xe9326c[_0x9ba3('0x3a')]===_0x9ba3('0x3f');});if(!_0x13542c)return _0x2492b8;return db[_0x9ba3('0x8e')][_0x9ba3('0x60')]({'where':{'name':{'$or':[_0x9ba3('0x3c'),_0x9ba3('0x3e')]},'userProfileId':_0x1ed63d[_0x9ba3('0x86')][_0x9ba3('0x8c')]},'raw':!![]})[_0x9ba3('0x24')](function(_0x231684){if(_['isEmpty'](_0x231684)||!_['some'](_0x231684,['autoAssociation',0x0]))return _0x2492b8;_0x571dff=[];var _0x245e3e=_(_0x231684)[_0x9ba3('0x41')](function(_0x406924){if(_0x406924[_0x9ba3('0x96')]===0x1)return;return _0x406924['name']===_0x9ba3('0x3c')?'agent':_0x9ba3('0x3f');})[_0x9ba3('0x97')]()[_0x9ba3('0x42')]();for(var _0x4bcded=0x0;_0x4bcded<_0x2492b8[_0x9ba3('0x53')];_0x4bcded++){if(!_[_0x9ba3('0x43')](_0x245e3e,_0x2492b8[_0x4bcded]['role']))return;var _0x130a95=_0x2492b8[_0x4bcded][_0x9ba3('0x3a')]==='agent'?'Agents':'Telephones';_0x571dff[_0x9ba3('0x93')](db['UserProfileResource'][_0x9ba3('0x8d')]({'name':_0x2492b8[_0x4bcded][_0x9ba3('0x45')],'resourceId':_0x2492b8[_0x4bcded]['id'],'type':_0x130a95,'sectionId':_['find'](_0x231684,[_0x9ba3('0x45'),_0x130a95])['id']},{}));}return BPromise['all'](_0x571dff);})['then'](respondWithResult(_0x3bf9c6,0xc9))[_0x9ba3('0x62')](handleError(_0x3bf9c6,null));});};exports[_0x9ba3('0x98')]=function(_0x330ffd,_0x4c7a4a,_0x387300){if(_0x330ffd[_0x9ba3('0x68')]['id']){delete _0x330ffd[_0x9ba3('0x68')]['id'];}return db['User']['find']({'where':{'id':_0x330ffd['params']['id']}})[_0x9ba3('0x24')](function(_0x730303){if(!_0x730303)return null;if(_0x730303['id']===_0x330ffd[_0x9ba3('0x86')]['id']){if(!_0x330ffd[_0x9ba3('0x68')][_0x9ba3('0x99')]||!_0x330ffd['body'][_0x9ba3('0x9a')]){throw new db['Sequelize'][(_0x9ba3('0x9b'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x730303['authenticate'](_0x330ffd[_0x9ba3('0x68')][_0x9ba3('0x99')])){throw new db['Sequelize'][(_0x9ba3('0x9b'))]('Wrong\x20credentials');}if(_0x330ffd[_0x9ba3('0x68')][_0x9ba3('0x99')]===_0x330ffd[_0x9ba3('0x68')]['newPassword']){throw new db[(_0x9ba3('0x9c'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x330ffd[_0x9ba3('0x86')][_0x9ba3('0x3a')]==='admin'){if(!_0x330ffd['body']['newPassword']){throw new db[(_0x9ba3('0x9c'))]['ValidationError'](_0x9ba3('0x9d'));}}else if(_0x330ffd[_0x9ba3('0x86')][_0x9ba3('0x3a')]==='user'){if(!_0x330ffd[_0x9ba3('0x68')][_0x9ba3('0x9a')]){throw new db[(_0x9ba3('0x9c'))][(_0x9ba3('0x9b'))](_0x9ba3('0x9d'));}if(_0x730303[_0x9ba3('0x3a')]!==_0x9ba3('0x3d')){throw new db['Sequelize']['ValidationError'](_0x9ba3('0x87'));}}else{throw new db['Sequelize'][(_0x9ba3('0x9b'))](_0x9ba3('0x87'));}return _0x730303;})[_0x9ba3('0x24')](handleEntityNotFound(_0x4c7a4a,null))[_0x9ba3('0x24')](function(_0x39cb39){return db['Setting'][_0x9ba3('0x9e')]({'attributes':['id',_0x9ba3('0x6e'),_0x9ba3('0x9f'),_0x9ba3('0xa0')]})['then'](function(_0x3895c0){if(_0x3895c0['securePassword'])authService[_0x9ba3('0xa1')](_0x330ffd[_0x9ba3('0x68')]['newPassword']);if(!_0x3895c0[_0x9ba3('0x9f')]||!_0x39cb39[_0x9ba3('0xa2')])return _0x39cb39;authService[_0x9ba3('0xa3')](_0x330ffd[_0x9ba3('0x68')][_0x9ba3('0x9a')],_0x39cb39[_0x9ba3('0xa2')],_0x3895c0[_0x9ba3('0xa0')]);return _0x39cb39;})[_0x9ba3('0x24')](saveUpdates({'password':_0x330ffd['body'][_0x9ba3('0x9a')],'passwordResetAt':_0x330ffd['user']['id']==_0x330ffd[_0x9ba3('0x64')]['id']?moment():null,'previousPasswords':authService[_0x9ba3('0xa4')](_0x330ffd[_0x9ba3('0x68')][_0x9ba3('0x9a')],_0x39cb39['previousPasswords'])},null));})[_0x9ba3('0x24')](respondWithResult(_0x4c7a4a,null))['catch'](handleError(_0x4c7a4a,null));};exports[_0x9ba3('0xa5')]=function(_0x4dfeca,_0x45ed7e,_0x5f07a7){var _0x26a8d3=_0x4dfeca[_0x9ba3('0x68')][_0x9ba3('0xa6')];return db['User'][_0x9ba3('0x44')]({'where':{'id':_0x4dfeca[_0x9ba3('0x64')]['id']},'attributes':['id',_0x9ba3('0x45'),_0x9ba3('0x3a'),'online',_0x9ba3('0xa7'),_0x9ba3('0xa8'),_0x9ba3('0xa9')]})['then'](handleEntityNotFound(_0x45ed7e,null))[_0x9ba3('0x24')](function(_0xe30b8b){if(_0xe30b8b){if(!utils[_0x9ba3('0xaa')](_0x26a8d3)){throw new db[(_0x9ba3('0x9c'))][(_0x9ba3('0x9b'))](_0x9ba3('0xab'));}return _0xe30b8b[_0x9ba3('0xac')+_['capitalize'](_0x26a8d3['toLowerCase']())+_0x9ba3('0xad')](_0x4dfeca[_0x9ba3('0x68')]['ids'],{'penalty':_0x4dfeca['body'][_0x9ba3('0xae')]||0x0})[_0x9ba3('0xaf')](function(_0x12fbdf){for(var _0x25cfbd=0x0;_0x25cfbd<_0x4dfeca[_0x9ba3('0x68')]['ids'][_0x9ba3('0x53')];_0x25cfbd+=0x1){var _0x33a343={'UserId':_0x4dfeca[_0x9ba3('0x64')]['id']};_0x33a343[_['capitalize'](_0x26a8d3[_0x9ba3('0xb0')]())+_0x9ba3('0xb1')]=_0x4dfeca[_0x9ba3('0x68')]['ids'][_0x25cfbd];socket[_0x9ba3('0xb2')](_0x9ba3('0x86')+_[_0x9ba3('0xb3')](_0x26a8d3[_0x9ba3('0xb0')]())+_0x9ba3('0xb4'),_0x33a343);}return _0x12fbdf;})[_0x9ba3('0x24')](function(){if(_0x26a8d3===_0x9ba3('0xb5')){return db[_0x9ba3('0xb6')][_0x9ba3('0x60')]({'where':{'id':_0x4dfeca[_0x9ba3('0x68')][_0x9ba3('0x6a')]||[]},'raw':!![],'attributes':['id',_0x9ba3('0x45')]});}})[_0x9ba3('0x24')](function(_0x149631){var _0x385077=_0xe30b8b['get']({'plain':!![]});var _0x42ab58=[];if(_0x26a8d3===_0x9ba3('0xb5')&&_0x385077[_0x9ba3('0x3a')]===_0x9ba3('0x3d')&&_0x385077[_0x9ba3('0xb7')]){for(var _0x1f1006=0x0;_0x1f1006<_0x149631['length'];_0x1f1006+=0x1){_0x42ab58[_0x9ba3('0x93')]({'membername':_0x385077[_0x9ba3('0x45')],'UserId':_0x385077['id'],'queue_name':_0x149631[_0x1f1006][_0x9ba3('0x45')],'VoiceQueueId':_0x149631[_0x1f1006]['id'],'interface':_[_0x9ba3('0x70')](_0x385077['interface'])?util[_0x9ba3('0xb8')](_0x9ba3('0xb9'),_0x385077[_0x9ba3('0x45')]):_0x385077['interface'],'paused':_0x385077['voicePause']||![],'penalty':_0x4dfeca[_0x9ba3('0x68')][_0x9ba3('0xae')]||0x0});}return BPromise['each'](_0x42ab58,function(_0x2eb2be){return db['UserVoiceQueueRt'][_0x9ba3('0xba')](_0x2eb2be);});}return _0xe30b8b;});}})[_0x9ba3('0x24')](respondWithStatusCode(_0x45ed7e,null))[_0x9ba3('0x62')](handleError(_0x45ed7e,null));};exports[_0x9ba3('0xbb')]=function(_0x32840b,_0x2da0ae,_0x3e38d6){var _0x10270f;return db[_0x9ba3('0x48')]['find']({'where':{'id':_0x32840b['params']['id']},'attributes':['id',_0x9ba3('0x45'),_0x9ba3('0x3a')]})[_0x9ba3('0x24')](handleEntityNotFound(_0x2da0ae,null))[_0x9ba3('0x24')](function(_0x2a2f7a){if(_0x2a2f7a){_0x10270f=_0x2a2f7a;if(!_0x32840b['query'][_0x9ba3('0xa6')]||!utils[_0x9ba3('0xaa')](_0x32840b[_0x9ba3('0x4f')][_0x9ba3('0xa6')])){throw new db[(_0x9ba3('0x9c'))][(_0x9ba3('0x9b'))](_0x9ba3('0xab'));}return _0x2a2f7a[_0x9ba3('0xbc')+_[_0x9ba3('0xb3')](_0x32840b['query']['channel'][_0x9ba3('0xb0')]())+'Queues'](_0x32840b['query'][_0x9ba3('0x6a')]);}})['then'](function(_0x11aa8f){for(var _0x1e88f2=0x0;_0x1e88f2<_0x32840b['query']['ids']['length'];_0x1e88f2+=0x1){var _0xbd65e7={'UserId':_0x32840b['params']['id']};_0xbd65e7[_['capitalize'](_0x32840b[_0x9ba3('0x4f')][_0x9ba3('0xa6')][_0x9ba3('0xb0')]())+_0x9ba3('0xb1')]=_0x32840b['query'][_0x9ba3('0x6a')][_0x1e88f2];socket[_0x9ba3('0xb2')](_0x9ba3('0x86')+_['capitalize'](_0x32840b[_0x9ba3('0x4f')][_0x9ba3('0xa6')][_0x9ba3('0xb0')]())+_0x9ba3('0xbd'),_0xbd65e7);}return _0x11aa8f;})[_0x9ba3('0x24')](function(){if(_0x32840b[_0x9ba3('0x4f')][_0x9ba3('0xa6')]===_0x9ba3('0xb5')){return db['UserVoiceQueueRt'][_0x9ba3('0x39')]({'where':{'UserId':_0x32840b['params']['id'],'VoiceQueueId':_0x32840b[_0x9ba3('0x4f')][_0x9ba3('0x6a')]},'individualHooks':!![]})['then'](function(){return _0x10270f;});}return _0x10270f;})['then'](respondWithStatusCode(_0x2da0ae,null))[_0x9ba3('0x62')](handleError(_0x2da0ae,null));};exports['addAvatar']=function(_0x4e0f08,_0x3b6fd7,_0x8f910a){_0x4e0f08['body'][_0x9ba3('0xbe')]=_0x4e0f08['file'][_0x9ba3('0xbf')];return db[_0x9ba3('0x48')]['find']({'where':{'id':_0x4e0f08[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x3b6fd7,null))['then'](saveUpdates(_0x4e0f08['body'],null))[_0x9ba3('0x24')](respondWithResult(_0x3b6fd7,null))[_0x9ba3('0x62')](handleError(_0x3b6fd7,null));};exports[_0x9ba3('0xc0')]=function(_0x11a2fa,_0x3dc02f,_0x4481e9){var _0x1e2e4c=path['join'](config[_0x9ba3('0xc1')],'server/files/images/logos/default_profile.png');return db[_0x9ba3('0x48')][_0x9ba3('0x44')]({'where':{'id':_0x11a2fa[_0x9ba3('0x64')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x3dc02f,null))[_0x9ba3('0x24')](function(_0x2c6b71){if(_0x2c6b71){if(_[_0x9ba3('0x70')](_0x2c6b71[_0x9ba3('0xbe')])){return _0x3dc02f[_0x9ba3('0xc2')](_0x1e2e4c);}else{if(!fs[_0x9ba3('0xc3')](path[_0x9ba3('0xc4')](config[_0x9ba3('0xc1')],_0x9ba3('0xc5'),_0x2c6b71[_0x9ba3('0xbe')]))){return _0x3dc02f['download'](_0x1e2e4c);}return _0x3dc02f[_0x9ba3('0xc2')](path[_0x9ba3('0xc4')](config[_0x9ba3('0xc1')],_0x9ba3('0xc5'),_0x2c6b71[_0x9ba3('0xbe')]));}}})[_0x9ba3('0x62')](handleError(_0x3dc02f,null));};exports[_0x9ba3('0xc6')]=function(_0x5d6ded,_0x1d9f0b,_0x352b77){var _0x5b75b3={};var _0x2883a3={};var _0xdc9837;var _0x20ff2c;return db[_0x9ba3('0x48')][_0x9ba3('0x9e')]({'where':{'id':_0x5d6ded[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x1d9f0b,null))[_0x9ba3('0x24')](function(_0x178945){if(_0x178945){_0xdc9837=_0x178945;_0x2883a3[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db['CmContact'][_0x9ba3('0x65')]);_0x2883a3[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0x5d6ded[_0x9ba3('0x4f')]);_0x2883a3[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x2883a3[_0x9ba3('0x4b')],_0x2883a3[_0x9ba3('0x4f')]);_0x5b75b3['attributes']=_[_0x9ba3('0x50')](_0x2883a3['model'],qs[_0x9ba3('0x51')](_0x5d6ded[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x5b75b3[_0x9ba3('0x52')]=_0x5b75b3[_0x9ba3('0x52')][_0x9ba3('0x53')]?_0x5b75b3[_0x9ba3('0x52')]:_0x2883a3[_0x9ba3('0x4b')];_0x5b75b3['order']=qs[_0x9ba3('0xc7')](_0x5d6ded[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x5b75b3[_0x9ba3('0x5c')]=qs[_0x9ba3('0x58')](_['pick'](_0x5d6ded[_0x9ba3('0x4f')],_0x2883a3[_0x9ba3('0x58')]));if(_0x5d6ded[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x5b75b3[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x5b75b3[_0x9ba3('0x5c')],{'$or':_['map'](_0x5b75b3['attributes'],function(_0x1b2abd){var _0x5466ff={};_0x5466ff[_0x1b2abd]={'$like':'%'+_0x5d6ded[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x5466ff;})});}_0x5b75b3=_[_0x9ba3('0x59')]({},_0x5b75b3,_0x5d6ded[_0x9ba3('0x5f')]);return _0xdc9837[_0x9ba3('0xc6')](_0x5b75b3);}})[_0x9ba3('0x24')](function(_0x533f09){if(_0x533f09){_0x20ff2c=_0x533f09[_0x9ba3('0x53')];if(_0x5d6ded[_0x9ba3('0x4f')][_0x9ba3('0x54')](_0x9ba3('0x67'))){_0x5b75b3[_0x9ba3('0xc8')]=[{'model':db['CmList'],'as':_0x9ba3('0xc9'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x9ba3('0x45'),_0x9ba3('0xca')],'where':_0x5d6ded[_0x9ba3('0x4f')][_0x9ba3('0xcb')]?{'id':_0x5d6ded['query'][_0x9ba3('0xcb')]}:undefined,'required':_0x5d6ded[_0x9ba3('0x4f')][_0x9ba3('0xcb')]?!![]:![]}];}if(!_0x5d6ded[_0x9ba3('0x4f')][_0x9ba3('0x54')]('nolimit')){_0x5b75b3[_0x9ba3('0x34')]=qs['limit'](_0x5d6ded[_0x9ba3('0x4f')][_0x9ba3('0x34')]);_0x5b75b3[_0x9ba3('0x56')]=qs[_0x9ba3('0x56')](_0x5d6ded[_0x9ba3('0x4f')][_0x9ba3('0x56')]);}return _0xdc9837[_0x9ba3('0xc6')](_0x5b75b3);}})[_0x9ba3('0x24')](function(_0x5db44f){if(_0x5db44f){return _0x5db44f?{'count':_0x20ff2c,'rows':_0x5db44f}:null;}})['then'](respondWithResult(_0x1d9f0b,null))[_0x9ba3('0x62')](handleError(_0x1d9f0b,null));};exports['getQueues']=function(_0x484399,_0xa5d6fc,_0x476b58){var _0x13f917;var _0x5f0a9e;var _0x499e7d={};var _0x51097b;return db['User'][_0x9ba3('0x9e')]({'where':{'id':_0x484399[_0x9ba3('0x64')]['id']},'attributes':['id',_0x9ba3('0x45'),_0x9ba3('0x3a')]})[_0x9ba3('0x24')](handleEntityNotFound(_0xa5d6fc,null))[_0x9ba3('0x24')](function(_0x1aa5f6){if(!utils['isValidChannel'](_0x484399[_0x9ba3('0x4f')][_0x9ba3('0xa6')])){throw new db[(_0x9ba3('0x9c'))][(_0x9ba3('0x9b'))](_0x9ba3('0xab'));}_0x13f917=_0x1aa5f6;var _0x5a7063={};_0x5a7063[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db[_['capitalize'](_0x484399['query'][_0x9ba3('0xa6')])+'Queue'][_0x9ba3('0x65')]);_0x5a7063[_0x9ba3('0x4f')]=_['keys'](_0x484399['query']);_0x5a7063[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x5a7063['model'],_0x5a7063['query']);_0x499e7d[_0x9ba3('0x52')]=_[_0x9ba3('0x50')](_0x5a7063['model'],qs[_0x9ba3('0x51')](_0x484399[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x499e7d[_0x9ba3('0x52')]=_0x499e7d['attributes'][_0x9ba3('0x53')]?_0x499e7d['attributes']:_0x5a7063[_0x9ba3('0x4b')];_0x499e7d[_0x9ba3('0xcc')]=qs[_0x9ba3('0xc7')](_0x484399[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x499e7d[_0x9ba3('0x5c')]=qs[_0x9ba3('0x58')](_[_0x9ba3('0x57')](_0x484399[_0x9ba3('0x4f')],_0x5a7063[_0x9ba3('0x58')]));if(_0x484399[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x499e7d[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x499e7d[_0x9ba3('0x5c')],{'$or':_[_0x9ba3('0x41')](_0x499e7d['attributes'],function(_0x1afd3b){var _0x4cee6d={};_0x4cee6d[_0x1afd3b]={'$like':'%'+_0x484399[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x4cee6d;})});}_0x499e7d=_[_0x9ba3('0x59')]({},_0x499e7d,_0x484399[_0x9ba3('0x5f')]);switch(_0x13f917[_0x9ba3('0x3a')]){case _0x9ba3('0x3b'):return db[_[_0x9ba3('0xb3')](_0x484399[_0x9ba3('0x4f')][_0x9ba3('0xa6')])+_0x9ba3('0xcd')]['findAll'](_0x499e7d);case _0x9ba3('0x86'):case'agent':return _0x13f917[_0x9ba3('0xce')+_['capitalize'](_0x484399[_0x9ba3('0x4f')]['channel'])+'Queues'](_0x499e7d);default:throw new db[(_0x9ba3('0x9c'))][(_0x9ba3('0x9b'))](_0x9ba3('0xcf'));}})['then'](function(_0x31ed2a){_0x51097b=_0x31ed2a[_0x9ba3('0x53')];if(!_0x484399[_0x9ba3('0x4f')][_0x9ba3('0x54')](_0x9ba3('0x55'))){_0x499e7d[_0x9ba3('0x34')]=qs['limit'](_0x484399['query'][_0x9ba3('0x34')]);_0x499e7d[_0x9ba3('0x56')]=qs[_0x9ba3('0x56')](_0x484399[_0x9ba3('0x4f')][_0x9ba3('0x56')]);}switch(_0x13f917[_0x9ba3('0x3a')]){case _0x9ba3('0x3b'):return db[_[_0x9ba3('0xb3')](_0x484399[_0x9ba3('0x4f')][_0x9ba3('0xa6')])+_0x9ba3('0xcd')][_0x9ba3('0x60')](_0x499e7d);case _0x9ba3('0x86'):case'agent':return _0x13f917[_0x9ba3('0xce')+_['capitalize'](_0x484399['query'][_0x9ba3('0xa6')])+_0x9ba3('0xad')](_0x499e7d);}})['then'](function(_0x5f168b){return{'count':_0x51097b,'rows':_0x5f168b};})[_0x9ba3('0x24')](respondWithResult(_0xa5d6fc,null))['catch'](handleError(_0xa5d6fc,null));};exports[_0x9ba3('0xd0')]=function(_0x38dea7,_0x5a1554,_0x3b0df8){var _0x25d9f2={};var _0x4c116e={};var _0x34615a;var _0x251003;return db[_0x9ba3('0x48')]['findOne']({'where':{'id':_0x38dea7[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x5a1554,null))[_0x9ba3('0x24')](function(_0x312618){if(_0x312618){_0x34615a=_0x312618;_0x4c116e[_0x9ba3('0x4b')]=_['keys'](db[_0x9ba3('0xd1')][_0x9ba3('0x65')]);_0x4c116e[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0x38dea7[_0x9ba3('0x4f')]);_0x4c116e[_0x9ba3('0x58')]=_['intersection'](_0x4c116e[_0x9ba3('0x4b')],_0x4c116e[_0x9ba3('0x4f')]);_0x25d9f2['attributes']=_[_0x9ba3('0x50')](_0x4c116e[_0x9ba3('0x4b')],qs[_0x9ba3('0x51')](_0x38dea7['query'][_0x9ba3('0x51')]));_0x25d9f2[_0x9ba3('0x52')]=_0x25d9f2[_0x9ba3('0x52')][_0x9ba3('0x53')]?_0x25d9f2[_0x9ba3('0x52')]:_0x4c116e[_0x9ba3('0x4b')];_0x25d9f2[_0x9ba3('0xcc')]=qs[_0x9ba3('0xc7')](_0x38dea7[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x25d9f2['where']=qs[_0x9ba3('0x58')](_[_0x9ba3('0x57')](_0x38dea7[_0x9ba3('0x4f')],_0x4c116e[_0x9ba3('0x58')]));if(_0x38dea7[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x25d9f2['where']=_[_0x9ba3('0x59')](_0x25d9f2[_0x9ba3('0x5c')],{'$or':_[_0x9ba3('0x41')](_0x25d9f2[_0x9ba3('0x52')],function(_0x4ece09){var _0x357ba7={};_0x357ba7[_0x4ece09]={'$like':'%'+_0x38dea7[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x357ba7;})});}_0x25d9f2=_[_0x9ba3('0x59')]({},_0x25d9f2,_0x38dea7['options']);return _0x34615a['getVoiceQueuesRt'](_0x25d9f2);}})[_0x9ba3('0x24')](function(_0x52c078){if(_0x52c078){_0x251003=_0x52c078[_0x9ba3('0x53')];if(!_0x38dea7[_0x9ba3('0x4f')][_0x9ba3('0x54')](_0x9ba3('0x55'))){_0x25d9f2[_0x9ba3('0x34')]=qs[_0x9ba3('0x34')](_0x38dea7[_0x9ba3('0x4f')][_0x9ba3('0x34')]);_0x25d9f2[_0x9ba3('0x56')]=qs[_0x9ba3('0x56')](_0x38dea7[_0x9ba3('0x4f')][_0x9ba3('0x56')]);}return _0x34615a[_0x9ba3('0xd0')](_0x25d9f2);}})[_0x9ba3('0x24')](function(_0x3145bd){if(_0x3145bd){return _0x3145bd?{'count':_0x251003,'rows':_0x3145bd}:null;}})[_0x9ba3('0x24')](respondWithResult(_0x5a1554,null))['catch'](handleError(_0x5a1554,null));};exports[_0x9ba3('0xd2')]=function(_0x4b1c06,_0xe2d1f2,_0x2aff40){var _0x397282={};var _0x53e2a9={};var _0x507197;var _0x212929;return db['User'][_0x9ba3('0x9e')]({'where':{'id':_0x4b1c06[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0xe2d1f2,null))[_0x9ba3('0x24')](function(_0x54b0d2){if(_0x54b0d2){_0x507197=_0x54b0d2;_0x53e2a9[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db[_0x9ba3('0xd3')][_0x9ba3('0x65')]);_0x53e2a9[_0x9ba3('0x4f')]=_['keys'](_0x4b1c06[_0x9ba3('0x4f')]);_0x53e2a9[_0x9ba3('0x58')]=_['intersection'](_0x53e2a9['model'],_0x53e2a9['query']);_0x397282[_0x9ba3('0x52')]=_['intersection'](_0x53e2a9[_0x9ba3('0x4b')],qs['fields'](_0x4b1c06[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x397282['attributes']=_0x397282[_0x9ba3('0x52')][_0x9ba3('0x53')]?_0x397282[_0x9ba3('0x52')]:_0x53e2a9[_0x9ba3('0x4b')];_0x397282[_0x9ba3('0xcc')]=qs[_0x9ba3('0xc7')](_0x4b1c06[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x397282[_0x9ba3('0x5c')]=qs[_0x9ba3('0x58')](_[_0x9ba3('0x57')](_0x4b1c06['query'],_0x53e2a9[_0x9ba3('0x58')]));if(_0x4b1c06[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x397282[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x397282['where'],{'$or':_[_0x9ba3('0x41')](_0x397282[_0x9ba3('0x52')],function(_0x3a6b35){var _0x113cf8={};_0x113cf8[_0x3a6b35]={'$like':'%'+_0x4b1c06['query']['filter']+'%'};return _0x113cf8;})});}_0x397282=_['merge']({},_0x397282,_0x4b1c06[_0x9ba3('0x5f')]);return _0x507197[_0x9ba3('0xd2')](_0x397282);}})[_0x9ba3('0x24')](function(_0x3c0936){if(_0x3c0936){_0x212929=_0x3c0936[_0x9ba3('0x53')];if(!_0x4b1c06[_0x9ba3('0x4f')][_0x9ba3('0x54')]('nolimit')){_0x397282[_0x9ba3('0x34')]=qs[_0x9ba3('0x34')](_0x4b1c06[_0x9ba3('0x4f')][_0x9ba3('0x34')]);_0x397282[_0x9ba3('0x56')]=qs[_0x9ba3('0x56')](_0x4b1c06[_0x9ba3('0x4f')]['offset']);}return _0x507197[_0x9ba3('0xd2')](_0x397282);}})[_0x9ba3('0x24')](function(_0x29b830){if(_0x29b830){return _0x29b830?{'count':_0x212929,'rows':_0x29b830}:null;}})['then'](respondWithResult(_0xe2d1f2,null))[_0x9ba3('0x62')](handleError(_0xe2d1f2,null));};exports['getRecordings']=function(_0x5aebf0,_0x51ffa4,_0xc7ca0e){var _0x1b521e={'raw':!![],'where':{}};var _0x4aacb0={};var _0x112035={'count':0x0,'rows':[]};return db[_0x9ba3('0x48')][_0x9ba3('0x9e')]({'where':{'id':_0x5aebf0[_0x9ba3('0x64')]['id']}})['then'](handleEntityNotFound(_0x51ffa4,null))[_0x9ba3('0x24')](function(_0x146ff2){if(_0x146ff2){_0x4aacb0[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db[_0x9ba3('0xd4')][_0x9ba3('0x65')]);_0x4aacb0[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0x5aebf0[_0x9ba3('0x4f')]);_0x4aacb0[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x4aacb0[_0x9ba3('0x4b')],_0x4aacb0[_0x9ba3('0x4f')]);_0x1b521e['attributes']=_['intersection'](_0x4aacb0['model'],qs[_0x9ba3('0x51')](_0x5aebf0[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x1b521e[_0x9ba3('0x52')]=_0x1b521e['attributes'][_0x9ba3('0x53')]?_0x1b521e[_0x9ba3('0x52')]:_0x4aacb0[_0x9ba3('0x4b')];if(!_0x5aebf0['query'][_0x9ba3('0x54')](_0x9ba3('0x55'))){_0x1b521e[_0x9ba3('0x34')]=qs[_0x9ba3('0x34')](_0x5aebf0[_0x9ba3('0x4f')][_0x9ba3('0x34')]);_0x1b521e[_0x9ba3('0x56')]=qs[_0x9ba3('0x56')](_0x5aebf0['query']['offset']);}_0x1b521e[_0x9ba3('0xcc')]=qs[_0x9ba3('0xc7')](_0x5aebf0[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x1b521e[_0x9ba3('0x5c')]=qs[_0x9ba3('0x58')](_[_0x9ba3('0x57')](_0x5aebf0[_0x9ba3('0x4f')],_0x4aacb0[_0x9ba3('0x58')]));_0x1b521e[_0x9ba3('0x5c')][_0x9ba3('0xd5')]=_0x146ff2['id'];if(_0x5aebf0[_0x9ba3('0x4f')]['filter']){_0x1b521e[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x1b521e[_0x9ba3('0x5c')],{'$or':_[_0x9ba3('0x41')](_0x1b521e[_0x9ba3('0x52')],function(_0x3e647c){var _0x59481f={};_0x59481f[_0x3e647c]={'$like':'%'+_0x5aebf0[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x59481f;})});}_0x1b521e=_[_0x9ba3('0x59')]({},_0x1b521e,_0x5aebf0['options']);return db['VoiceRecording']['count']({'where':_0x1b521e[_0x9ba3('0x5c')]})['then'](function(_0x19b48c){_0x112035[_0x9ba3('0x33')]=_0x19b48c;if(_0x5aebf0['query']['includeAll']){_0x1b521e[_0x9ba3('0xc8')]=[{'all':!![]}];}return db[_0x9ba3('0xd4')][_0x9ba3('0x60')](_0x1b521e);})[_0x9ba3('0x24')](function(_0x1c69ac){_0x112035['rows']=_0x1c69ac;return _0x112035;});}})['then'](respondWithFilteredResult(_0x51ffa4,_0x1b521e))[_0x9ba3('0x62')](handleError(_0x51ffa4,null));};exports[_0x9ba3('0xd6')]=function(_0x5938e8,_0x387ccb,_0x26aed0){var _0x4f0b3f={'raw':!![],'where':{}};var _0x5359f7={};var _0x50cbfa={'count':0x0,'rows':[]};return db[_0x9ba3('0x48')][_0x9ba3('0x9e')]({'where':{'id':_0x5938e8[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x387ccb,null))[_0x9ba3('0x24')](function(_0x1097ca){if(_0x1097ca){_0x5359f7[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db[_0x9ba3('0xd7')][_0x9ba3('0x65')]);_0x5359f7[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0x5938e8[_0x9ba3('0x4f')]);_0x5359f7[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x5359f7[_0x9ba3('0x4b')],_0x5359f7[_0x9ba3('0x4f')]);_0x4f0b3f[_0x9ba3('0x52')]=_[_0x9ba3('0x50')](_0x5359f7['model'],qs[_0x9ba3('0x51')](_0x5938e8[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x4f0b3f[_0x9ba3('0x52')]=_0x4f0b3f[_0x9ba3('0x52')]['length']?_0x4f0b3f['attributes']:_0x5359f7[_0x9ba3('0x4b')];if(!_0x5938e8[_0x9ba3('0x4f')]['hasOwnProperty'](_0x9ba3('0x55'))){_0x4f0b3f[_0x9ba3('0x34')]=qs[_0x9ba3('0x34')](_0x5938e8[_0x9ba3('0x4f')][_0x9ba3('0x34')]);_0x4f0b3f[_0x9ba3('0x56')]=qs[_0x9ba3('0x56')](_0x5938e8[_0x9ba3('0x4f')][_0x9ba3('0x56')]);}_0x4f0b3f[_0x9ba3('0xcc')]=qs[_0x9ba3('0xc7')](_0x5938e8[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x4f0b3f['where']=qs['filters'](_[_0x9ba3('0x57')](_0x5938e8['query'],_0x5359f7[_0x9ba3('0x58')]));_0x4f0b3f['where'][_0x9ba3('0xd5')]=_0x1097ca['id'];if(_0x5938e8[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x4f0b3f[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x4f0b3f[_0x9ba3('0x5c')],{'$or':_['map'](_0x4f0b3f['attributes'],function(_0x3931af){var _0x2da35f={};_0x2da35f[_0x3931af]={'$like':'%'+_0x5938e8[_0x9ba3('0x4f')]['filter']+'%'};return _0x2da35f;})});}_0x4f0b3f=_['merge']({},_0x4f0b3f,_0x5938e8[_0x9ba3('0x5f')]);return db[_0x9ba3('0xd7')][_0x9ba3('0x33')]({'where':_0x4f0b3f[_0x9ba3('0x5c')]})['then'](function(_0x20f12e){_0x50cbfa[_0x9ba3('0x33')]=_0x20f12e;if(_0x5938e8[_0x9ba3('0x4f')][_0x9ba3('0x67')]){_0x4f0b3f[_0x9ba3('0xc8')]=[{'all':!![]}];}return db[_0x9ba3('0xd7')]['findAll'](_0x4f0b3f);})['then'](function(_0x36ea5b){_0x50cbfa[_0x9ba3('0x61')]=_0x36ea5b;return _0x50cbfa;});}})[_0x9ba3('0x24')](respondWithFilteredResult(_0x387ccb,_0x4f0b3f))['catch'](handleError(_0x387ccb,null));};exports['getChatInteractions']=function(_0x29651b,_0x341294,_0x39addb){var _0x4f238f={};var _0x525c2b={};var _0xf07836;var _0x5f3227;return db['User'][_0x9ba3('0x9e')]({'where':{'id':_0x29651b[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x341294,null))['then'](function(_0x21dbf7){if(_0x21dbf7){_0xf07836=_0x21dbf7;_0x525c2b['model']=_['keys'](db['ChatInteraction'][_0x9ba3('0x65')]);_0x525c2b[_0x9ba3('0x4f')]=_['keys'](_0x29651b[_0x9ba3('0x4f')]);_0x525c2b[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x525c2b['model'],_0x525c2b[_0x9ba3('0x4f')]);_0x4f238f['attributes']=_[_0x9ba3('0x50')](_0x525c2b[_0x9ba3('0x4b')],qs[_0x9ba3('0x51')](_0x29651b[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x4f238f[_0x9ba3('0x52')]=_0x4f238f['attributes']['length']?_0x4f238f[_0x9ba3('0x52')]:_0x525c2b['model'];_0x4f238f['order']=qs[_0x9ba3('0xc7')](_0x29651b[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x4f238f[_0x9ba3('0x5c')]=qs['filters'](_[_0x9ba3('0x57')](_0x29651b[_0x9ba3('0x4f')],_0x525c2b[_0x9ba3('0x58')]));if(_0x29651b[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x4f238f[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x4f238f[_0x9ba3('0x5c')],{'$or':_['map'](_0x4f238f['attributes'],function(_0xfb2108){var _0x4cd62d={};_0x4cd62d[_0xfb2108]={'$like':'%'+_0x29651b[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x4cd62d;})});}_0x4f238f=_[_0x9ba3('0x59')]({},_0x4f238f,_0x29651b[_0x9ba3('0x5f')]);return _0xf07836[_0x9ba3('0xd8')](_0x4f238f);}})[_0x9ba3('0x24')](function(_0x47e34a){if(_0x47e34a){_0x5f3227=_0x47e34a['length'];if(!_0x29651b['query'][_0x9ba3('0x54')]('nolimit')){_0x4f238f[_0x9ba3('0x34')]=qs[_0x9ba3('0x34')](_0x29651b[_0x9ba3('0x4f')][_0x9ba3('0x34')]);_0x4f238f[_0x9ba3('0x56')]=qs[_0x9ba3('0x56')](_0x29651b['query'][_0x9ba3('0x56')]);}return _0xf07836['getChatInteractions'](_0x4f238f);}})[_0x9ba3('0x24')](function(_0x1a25f3){if(_0x1a25f3){return _0x1a25f3?{'count':_0x5f3227,'rows':_0x1a25f3}:null;}})[_0x9ba3('0x24')](respondWithResult(_0x341294,null))[_0x9ba3('0x62')](handleError(_0x341294,null));};exports[_0x9ba3('0xd9')]=function(_0x2ca227,_0x817823,_0xc903b9){var _0x586152={};var _0x229ae9={};var _0x4abbdf;var _0x2231b5;return db[_0x9ba3('0x48')]['findOne']({'where':{'id':_0x2ca227[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x817823,null))[_0x9ba3('0x24')](function(_0x359459){if(_0x359459){_0x4abbdf=_0x359459;_0x229ae9[_0x9ba3('0x4b')]=_['keys'](db[_0x9ba3('0xda')]['rawAttributes']);_0x229ae9[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0x2ca227[_0x9ba3('0x4f')]);_0x229ae9[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x229ae9[_0x9ba3('0x4b')],_0x229ae9['query']);_0x586152['attributes']=_[_0x9ba3('0x50')](_0x229ae9[_0x9ba3('0x4b')],qs[_0x9ba3('0x51')](_0x2ca227[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x586152[_0x9ba3('0x52')]=_0x586152['attributes'][_0x9ba3('0x53')]?_0x586152[_0x9ba3('0x52')]:_0x229ae9[_0x9ba3('0x4b')];_0x586152[_0x9ba3('0xcc')]=qs[_0x9ba3('0xc7')](_0x2ca227[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x586152['where']=qs[_0x9ba3('0x58')](_[_0x9ba3('0x57')](_0x2ca227[_0x9ba3('0x4f')],_0x229ae9[_0x9ba3('0x58')]));if(_0x2ca227['query'][_0x9ba3('0x40')]){_0x586152[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x586152[_0x9ba3('0x5c')],{'$or':_['map'](_0x586152[_0x9ba3('0x52')],function(_0x133e3c){var _0x461061={};_0x461061[_0x133e3c]={'$like':'%'+_0x2ca227[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x461061;})});}_0x586152=_[_0x9ba3('0x59')]({},_0x586152,_0x2ca227[_0x9ba3('0x5f')]);return _0x4abbdf[_0x9ba3('0xd9')](_0x586152);}})[_0x9ba3('0x24')](function(_0x8895e4){if(_0x8895e4){_0x2231b5=_0x8895e4[_0x9ba3('0x53')];if(!_0x2ca227[_0x9ba3('0x4f')][_0x9ba3('0x54')](_0x9ba3('0x55'))){_0x586152[_0x9ba3('0x34')]=qs[_0x9ba3('0x34')](_0x2ca227[_0x9ba3('0x4f')][_0x9ba3('0x34')]);_0x586152['offset']=qs[_0x9ba3('0x56')](_0x2ca227[_0x9ba3('0x4f')]['offset']);}return _0x4abbdf[_0x9ba3('0xd9')](_0x586152);}})[_0x9ba3('0x24')](function(_0x26bba2){if(_0x26bba2){return _0x26bba2?{'count':_0x2231b5,'rows':_0x26bba2}:null;}})[_0x9ba3('0x24')](respondWithResult(_0x817823,null))['catch'](handleError(_0x817823,null));};exports['getMailInteractions']=function(_0x4da137,_0x48fe63,_0x385cca){var _0x152a0d={'raw':!![],'where':{}};var _0x514121={};var _0x231b0a={'count':0x0,'rows':[]};return db['User'][_0x9ba3('0x9e')]({'where':{'id':_0x4da137['params']['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x48fe63,null))[_0x9ba3('0x24')](function(_0x508547){if(_0x508547){_0x514121[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db[_0x9ba3('0xdb')][_0x9ba3('0x65')]);_0x514121[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0x4da137['query']);_0x514121[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x514121['model'],_0x514121[_0x9ba3('0x4f')]);_0x152a0d[_0x9ba3('0x52')]=_[_0x9ba3('0x50')](_0x514121[_0x9ba3('0x4b')],qs[_0x9ba3('0x51')](_0x4da137[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x152a0d['attributes']=_0x152a0d[_0x9ba3('0x52')][_0x9ba3('0x53')]?_0x152a0d[_0x9ba3('0x52')]:_0x514121[_0x9ba3('0x4b')];if(!_0x4da137[_0x9ba3('0x4f')][_0x9ba3('0x54')](_0x9ba3('0x55'))){_0x152a0d['limit']=qs[_0x9ba3('0x34')](_0x4da137[_0x9ba3('0x4f')][_0x9ba3('0x34')]);_0x152a0d['offset']=qs[_0x9ba3('0x56')](_0x4da137[_0x9ba3('0x4f')][_0x9ba3('0x56')]);}_0x152a0d[_0x9ba3('0xcc')]=qs['sort'](_0x4da137[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x152a0d['where']=qs[_0x9ba3('0x58')](_[_0x9ba3('0x57')](_0x4da137[_0x9ba3('0x4f')],_0x514121[_0x9ba3('0x58')]));_0x152a0d[_0x9ba3('0x5c')][_0x9ba3('0xd5')]=_0x508547['id'];if(_0x4da137[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x152a0d[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x152a0d[_0x9ba3('0x5c')],{'$or':_[_0x9ba3('0x41')](_0x152a0d['attributes'],function(_0x2b11e0){var _0x5d3935={};_0x5d3935[_0x2b11e0]={'$like':'%'+_0x4da137[_0x9ba3('0x4f')]['filter']+'%'};return _0x5d3935;})});}_0x152a0d=_[_0x9ba3('0x59')]({},_0x152a0d,_0x4da137[_0x9ba3('0x5f')]);return db['MailInteraction'][_0x9ba3('0x33')]({'where':_0x152a0d[_0x9ba3('0x5c')]})[_0x9ba3('0x24')](function(_0x10e112){_0x231b0a[_0x9ba3('0x33')]=_0x10e112;if(_0x4da137[_0x9ba3('0x4f')]['includeAll']){_0x152a0d[_0x9ba3('0xc8')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x152a0d);})[_0x9ba3('0x24')](function(_0x30f54c){_0x231b0a['rows']=_0x30f54c;return _0x231b0a;});}})[_0x9ba3('0x24')](respondWithFilteredResult(_0x48fe63,_0x152a0d))['catch'](handleError(_0x48fe63,null));};exports[_0x9ba3('0xdc')]=function(_0x20d81b,_0x4364c2,_0x3d6240){var _0x2936ba={};var _0x38552a={};var _0x1e4c0e;var _0x278517;return db[_0x9ba3('0x48')][_0x9ba3('0x9e')]({'where':{'id':_0x20d81b[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x4364c2,null))[_0x9ba3('0x24')](function(_0x24dc01){if(_0x24dc01){_0x1e4c0e=_0x24dc01;_0x38552a[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db[_0x9ba3('0xdd')]['rawAttributes']);_0x38552a['query']=_[_0x9ba3('0x4e')](_0x20d81b[_0x9ba3('0x4f')]);_0x38552a[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x38552a[_0x9ba3('0x4b')],_0x38552a['query']);_0x2936ba['attributes']=_[_0x9ba3('0x50')](_0x38552a[_0x9ba3('0x4b')],qs['fields'](_0x20d81b[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x2936ba['attributes']=_0x2936ba['attributes'][_0x9ba3('0x53')]?_0x2936ba[_0x9ba3('0x52')]:_0x38552a['model'];_0x2936ba[_0x9ba3('0xcc')]=qs[_0x9ba3('0xc7')](_0x20d81b[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x2936ba[_0x9ba3('0x5c')]=qs[_0x9ba3('0x58')](_['pick'](_0x20d81b[_0x9ba3('0x4f')],_0x38552a[_0x9ba3('0x58')]));if(_0x20d81b[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x2936ba[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x2936ba[_0x9ba3('0x5c')],{'$or':_[_0x9ba3('0x41')](_0x2936ba[_0x9ba3('0x52')],function(_0x205d5a){var _0xd21fc9={};_0xd21fc9[_0x205d5a]={'$like':'%'+_0x20d81b[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0xd21fc9;})});}_0x2936ba=_[_0x9ba3('0x59')]({},_0x2936ba,_0x20d81b['options']);return _0x1e4c0e[_0x9ba3('0xdc')](_0x2936ba);}})[_0x9ba3('0x24')](function(_0x5d1821){if(_0x5d1821){_0x278517=_0x5d1821[_0x9ba3('0x53')];if(!_0x20d81b[_0x9ba3('0x4f')][_0x9ba3('0x54')](_0x9ba3('0x55'))){_0x2936ba[_0x9ba3('0x34')]=qs[_0x9ba3('0x34')](_0x20d81b[_0x9ba3('0x4f')][_0x9ba3('0x34')]);_0x2936ba[_0x9ba3('0x56')]=qs[_0x9ba3('0x56')](_0x20d81b[_0x9ba3('0x4f')][_0x9ba3('0x56')]);}return _0x1e4c0e['getSmsInteractions'](_0x2936ba);}})[_0x9ba3('0x24')](function(_0x4d10e7){if(_0x4d10e7){return _0x4d10e7?{'count':_0x278517,'rows':_0x4d10e7}:null;}})[_0x9ba3('0x24')](respondWithResult(_0x4364c2,null))['catch'](handleError(_0x4364c2,null));};exports['getFaxInteractions']=function(_0x2d0378,_0x3a0439,_0x29af3a){var _0x41d720={};var _0x68ae63={};var _0x1443d1;var _0x14bcb0;return db[_0x9ba3('0x48')]['findOne']({'where':{'id':_0x2d0378[_0x9ba3('0x64')]['id']}})['then'](handleEntityNotFound(_0x3a0439,null))[_0x9ba3('0x24')](function(_0x4f37a8){if(_0x4f37a8){_0x1443d1=_0x4f37a8;_0x68ae63[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db[_0x9ba3('0xde')][_0x9ba3('0x65')]);_0x68ae63['query']=_[_0x9ba3('0x4e')](_0x2d0378[_0x9ba3('0x4f')]);_0x68ae63[_0x9ba3('0x58')]=_['intersection'](_0x68ae63[_0x9ba3('0x4b')],_0x68ae63['query']);_0x41d720[_0x9ba3('0x52')]=_[_0x9ba3('0x50')](_0x68ae63[_0x9ba3('0x4b')],qs[_0x9ba3('0x51')](_0x2d0378[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x41d720[_0x9ba3('0x52')]=_0x41d720[_0x9ba3('0x52')][_0x9ba3('0x53')]?_0x41d720['attributes']:_0x68ae63[_0x9ba3('0x4b')];_0x41d720['order']=qs[_0x9ba3('0xc7')](_0x2d0378[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x41d720['where']=qs[_0x9ba3('0x58')](_[_0x9ba3('0x57')](_0x2d0378[_0x9ba3('0x4f')],_0x68ae63[_0x9ba3('0x58')]));if(_0x2d0378[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x41d720[_0x9ba3('0x5c')]=_['merge'](_0x41d720[_0x9ba3('0x5c')],{'$or':_[_0x9ba3('0x41')](_0x41d720[_0x9ba3('0x52')],function(_0x402ed5){var _0x3ed308={};_0x3ed308[_0x402ed5]={'$like':'%'+_0x2d0378[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x3ed308;})});}_0x41d720=_[_0x9ba3('0x59')]({},_0x41d720,_0x2d0378[_0x9ba3('0x5f')]);return _0x1443d1[_0x9ba3('0xdf')](_0x41d720);}})[_0x9ba3('0x24')](function(_0x59e341){if(_0x59e341){_0x14bcb0=_0x59e341['length'];if(!_0x2d0378['query'][_0x9ba3('0x54')](_0x9ba3('0x55'))){_0x41d720[_0x9ba3('0x34')]=qs[_0x9ba3('0x34')](_0x2d0378['query'][_0x9ba3('0x34')]);_0x41d720[_0x9ba3('0x56')]=qs['offset'](_0x2d0378['query'][_0x9ba3('0x56')]);}return _0x1443d1[_0x9ba3('0xdf')](_0x41d720);}})[_0x9ba3('0x24')](function(_0x5b588a){if(_0x5b588a){return _0x5b588a?{'count':_0x14bcb0,'rows':_0x5b588a}:null;}})[_0x9ba3('0x24')](respondWithResult(_0x3a0439,null))['catch'](handleError(_0x3a0439,null));};exports[_0x9ba3('0xe0')]=function(_0x5aa68b,_0x43ec19,_0x2d4879){var _0x3ade01={};var _0x36cc8e={};var _0x18a401;var _0x498903;return db[_0x9ba3('0x48')][_0x9ba3('0x9e')]({'where':{'id':_0x5aa68b[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x43ec19,null))[_0x9ba3('0x24')](function(_0x561064){if(_0x561064){_0x18a401=_0x561064;_0x36cc8e[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db[_0x9ba3('0xe1')][_0x9ba3('0x65')]);_0x36cc8e[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0x5aa68b[_0x9ba3('0x4f')]);_0x36cc8e['filters']=_[_0x9ba3('0x50')](_0x36cc8e[_0x9ba3('0x4b')],_0x36cc8e[_0x9ba3('0x4f')]);_0x3ade01[_0x9ba3('0x52')]=_['intersection'](_0x36cc8e['model'],qs[_0x9ba3('0x51')](_0x5aa68b[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x3ade01[_0x9ba3('0x52')]=_0x3ade01[_0x9ba3('0x52')][_0x9ba3('0x53')]?_0x3ade01[_0x9ba3('0x52')]:_0x36cc8e['model'];_0x3ade01[_0x9ba3('0xcc')]=qs['sort'](_0x5aa68b[_0x9ba3('0x4f')]['sort']);_0x3ade01[_0x9ba3('0x5c')]=qs[_0x9ba3('0x58')](_[_0x9ba3('0x57')](_0x5aa68b['query'],_0x36cc8e[_0x9ba3('0x58')]));if(_0x5aa68b['query'][_0x9ba3('0x40')]){_0x3ade01[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x3ade01[_0x9ba3('0x5c')],{'$or':_[_0x9ba3('0x41')](_0x3ade01[_0x9ba3('0x52')],function(_0xa4c955){var _0x4c5ecc={};_0x4c5ecc[_0xa4c955]={'$like':'%'+_0x5aa68b[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x4c5ecc;})});}_0x3ade01=_[_0x9ba3('0x59')]({},_0x3ade01,_0x5aa68b['options']);return _0x18a401[_0x9ba3('0xe0')](_0x3ade01);}})[_0x9ba3('0x24')](function(_0x49ceb){if(_0x49ceb){_0x498903=_0x49ceb['length'];if(!_0x5aa68b[_0x9ba3('0x4f')]['hasOwnProperty'](_0x9ba3('0x55'))){_0x3ade01[_0x9ba3('0x34')]=qs[_0x9ba3('0x34')](_0x5aa68b[_0x9ba3('0x4f')]['limit']);_0x3ade01[_0x9ba3('0x56')]=qs[_0x9ba3('0x56')](_0x5aa68b['query'][_0x9ba3('0x56')]);}return _0x18a401['getWhatsappInteractions'](_0x3ade01);}})[_0x9ba3('0x24')](function(_0x5655d1){if(_0x5655d1){return _0x5655d1?{'count':_0x498903,'rows':_0x5655d1}:null;}})['then'](respondWithResult(_0x43ec19,null))[_0x9ba3('0x62')](handleError(_0x43ec19,null));};exports[_0x9ba3('0xe2')]=function(_0x3d78ec,_0x5daf67,_0x3f9300){var _0x19122f;var _0x46136d;var _0xe3e710;var _0x328d39=!_['isNil'](_0x3d78ec[_0x9ba3('0x64')]['id'])?_0x3d78ec['params']['id']:!_[_0x9ba3('0x70')](_0x3d78ec[_0x9ba3('0x86')]['id'])?_0x3d78ec[_0x9ba3('0x86')]['id']:null;return db[_0x9ba3('0x48')][_0x9ba3('0x44')]({'where':{'id':_0x328d39,'role':{'$or':[_0x9ba3('0x3b'),'user',_0x9ba3('0x3d')]}},'attributes':['id',_0x9ba3('0x45'),'phone',_0x9ba3('0xe3'),_0x9ba3('0x3a'),_0x9ba3('0x6b'),_0x9ba3('0xa7')]})[_0x9ba3('0x24')](function(_0x48ceca){if(_0x48ceca){if(_0x48ceca[_0x9ba3('0x3a')]===_0x9ba3('0x3d')){_0x19122f=_0x48ceca;if(_0x3d78ec[_0x9ba3('0x68')][_0x9ba3('0xa9')]){_0xe3e710=util[_0x9ba3('0xb8')](_0x9ba3('0xe4'),_0x19122f[_0x3d78ec[_0x9ba3('0x68')]['interface']]);}else if(_0x3d78ec[_0x9ba3('0x68')]['intrf']){_0xe3e710=util[_0x9ba3('0xb8')](_0x9ba3('0xb9'),_0x3d78ec[_0x9ba3('0x68')][_0x9ba3('0xe5')]);}else{_0xe3e710=util[_0x9ba3('0xb8')](_0x9ba3('0xb9'),_0x19122f[_0x9ba3('0x45')]);}socket['to'](util['format'](_0x9ba3('0xe6'),_0x19122f[_0x9ba3('0x45')]))[_0x9ba3('0xb2')](_0x9ba3('0xe7'),{'ip':_0x3d78ec['headers']['x-forwarded-for']||_0x3d78ec[_0x9ba3('0xe8')]['remoteAddress']||_0x3d78ec[_0x9ba3('0xe9')]['remoteAddress']||_0x3d78ec['connection'][_0x9ba3('0xe9')][_0x9ba3('0xea')]});return db[_0x9ba3('0xd1')][_0x9ba3('0x39')]({'where':{'membername':_0x19122f['name']},'individualHooks':!![]});}}else{throw new db[(_0x9ba3('0x9c'))][(_0x9ba3('0x9b'))](_0x9ba3('0xeb'));}})[_0x9ba3('0x24')](function(){if(_0x19122f){return _0x19122f[_0x9ba3('0xec')]({'raw':!![]});}})[_0x9ba3('0x24')](function(_0x5c2c0c){if(_0x19122f){var _0x3c5eb7=[];if(_0x5c2c0c){_0x46136d=_0x5c2c0c;if(_0x46136d['length']){for(var _0x592c12=0x0;_0x592c12<_0x46136d[_0x9ba3('0x53')];_0x592c12++){_0x3c5eb7[_0x9ba3('0x93')]({'membername':_0x19122f[_0x9ba3('0x45')],'UserId':_0x19122f['id'],'queue_name':_0x46136d[_0x592c12]['name'],'VoiceQueueId':_0x46136d[_0x592c12]['id'],'interface':_0xe3e710,'paused':_0x19122f[_0x9ba3('0xa7')]||![],'penalty':_0x46136d[_0x592c12][_0x9ba3('0xed')]||0x0});}return BPromise[_0x9ba3('0x95')](_0x3c5eb7,function(_0x3d75ce){return db[_0x9ba3('0xd1')][_0x9ba3('0xba')](_0x3d75ce);});}}}})[_0x9ba3('0x24')](function(){if(_0x19122f){return db[_0x9ba3('0xee')]['findAll']({'where':{'membername':_0x19122f[_0x9ba3('0x45')],'exitAt':null}});}})[_0x9ba3('0x24')](function(_0x174b19){if(_0x19122f){var _0x146689=[];_0x174b19['forEach'](function(_0x415e2d){_0x146689['push'](_0x415e2d[_0x9ba3('0x38')]({'exitAt':moment()[_0x9ba3('0xb8')](_0x9ba3('0xef'))}));});return BPromise[_0x9ba3('0x94')](_0x146689);}})[_0x9ba3('0x24')](function(){if(_0x19122f){var _0x4d4256=[];var _0x212daf=[];var _0x51eebd=utils[_0x9ba3('0xf0')]();var _0x2af678={'membername':_0x19122f[_0x9ba3('0x45')],'interface':_0xe3e710,'enterAt':moment()['format'](_0x9ba3('0xef')),'role':_0x19122f[_0x9ba3('0x3a')],'internal':_0x19122f[_0x9ba3('0x6b')]};_0x51eebd[_0x9ba3('0xf1')](function(_0x53b603){_0x4d4256[_0x9ba3('0x93')](_['merge']({'channel':_0x53b603,'type':_0x9ba3('0xf2'),'data1':_0x3d78ec['body']['device'],'data2':_0xe3e710},_0x2af678));if(_0x19122f[_0x9ba3('0xa7')]){_0x212daf[_0x9ba3('0x93')](_[_0x9ba3('0x59')]({'channel':_0x53b603,'type':_0x9ba3('0xf3'),'data1':_0x9ba3('0xf4')},_0x2af678));}});return db['MemberReport'][_0x9ba3('0x90')](_0x4d4256[_0x9ba3('0xf5')](_0x212daf),{'individualHooks':!![]});}})['then'](function(){if(_0x19122f){return _0x19122f[_0x9ba3('0x38')]({'online':!![],'lastLoginAt':moment()['format'](_0x9ba3('0xef')),'voicePause':_0x19122f[_0x9ba3('0xa7')]||![],'mailPause':_0x19122f[_0x9ba3('0xa7')]||![],'chatPause':_0x19122f[_0x9ba3('0xa7')]||![],'faxPause':_0x19122f['loginInPause']||![],'smsPause':_0x19122f[_0x9ba3('0xa7')]||![],'openchannelPause':_0x19122f[_0x9ba3('0xa7')]||![],'whatsappPause':_0x19122f[_0x9ba3('0xa7')]||![],'pauseType':_0x19122f[_0x9ba3('0xa7')]?'LOGININPAUSE':null,'interface':_0xe3e710,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x461e2b){if(_0x3d78ec[_0x9ba3('0xf6')]){return _0x3f9300();}else{return BPromise['resolve'](_0x461e2b)['then'](respondWithResult(_0x5daf67,null));}})[_0x9ba3('0x62')](handleError(_0x5daf67,null));};exports[_0x9ba3('0xf7')]=function(_0x1f8e4c,_0x444323,_0x2562fc){var _0xd3770;return db[_0x9ba3('0x48')]['find']({'where':{'id':_0x1f8e4c[_0x9ba3('0x64')]['id'],'role':'agent'},'attributes':['id',_0x9ba3('0x45'),_0x9ba3('0x3a')]})[_0x9ba3('0x24')](handleEntityNotFound(_0x444323,null))['then'](function(_0x23e183){if(_0x23e183){_0xd3770=_0x23e183;return db[_0x9ba3('0xd1')][_0x9ba3('0x39')]({'where':{'membername':_0xd3770['name']},'individualHooks':!![]});}})[_0x9ba3('0x24')](function(){return db[_0x9ba3('0xee')]['findAll']({'where':{'membername':_0xd3770[_0x9ba3('0x45')],'exitAt':null}});})[_0x9ba3('0x24')](function(_0x55e657){var _0xe733a4=[];_0x55e657['forEach'](function(_0x1c8eeb){_0xe733a4[_0x9ba3('0x93')](_0x1c8eeb['update']({'exitAt':moment()[_0x9ba3('0xb8')](_0x9ba3('0xef'))}));});return BPromise['all'](_0xe733a4);})[_0x9ba3('0x24')](function(){return _0xd3770[_0x9ba3('0x38')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x444323,null))[_0x9ba3('0x62')](handleError(_0x444323,null));};exports[_0x9ba3('0xf8')]=function(_0x3840c6,_0x3748a7,_0x14ea3c){var _0x166f24;return db[_0x9ba3('0xd1')][_0x9ba3('0x38')]({'paused':0x1},{'where':{'UserId':_0x3840c6[_0x9ba3('0x64')]['id']},'individualHooks':!![]})[_0x9ba3('0x24')](function(){return db[_0x9ba3('0x48')][_0x9ba3('0x44')]({'where':{'id':_0x3840c6[_0x9ba3('0x64')]['id'],'role':_0x9ba3('0x3d')},'attributes':['id','name',_0x9ba3('0x3a'),_0x9ba3('0x6b'),_0x9ba3('0xa9')]});})['then'](handleEntityNotFound(_0x3748a7,null))['then'](function(_0x29ef93){if(_0x29ef93){_0x166f24=_0x29ef93;return respondWithRpcPromise(_0x9ba3('0xf9'),_0x9ba3('0xf8'),{'id':_0x166f24['id'],'name':_0x166f24[_0x9ba3('0x45')],'pause':!![]});}})[_0x9ba3('0x24')](function(){if(_0x166f24){return db[_0x9ba3('0xee')][_0x9ba3('0x60')]({'where':{'membername':_0x166f24[_0x9ba3('0x45')],'type':_0x9ba3('0xf3'),'exitAt':null}});}})[_0x9ba3('0x24')](function(_0x444581){if(_0x444581['length']){var _0x41502f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x42c796=0x0,_0x435078=_0x444581[_0x9ba3('0x53')];_0x42c796<_0x435078;_0x42c796++){_0x444581[_0x42c796][_0x9ba3('0xfa')]({'exitAt':_0x41502f});}}})[_0x9ba3('0x24')](function(){var _0x138b6f=[];var _0x3928ce=utils[_0x9ba3('0xf0')]();_0x3928ce[_0x9ba3('0xf1')](function(_0x23f122){_0x138b6f[_0x9ba3('0x93')]({'channel':_0x23f122,'membername':_0x166f24[_0x9ba3('0x45')],'interface':_[_0x9ba3('0x70')](_0x166f24['interface'])?util[_0x9ba3('0xb8')](_0x9ba3('0xb9'),_0x166f24[_0x9ba3('0x45')]):_0x166f24[_0x9ba3('0xa9')],'type':_0x9ba3('0xf3'),'enterAt':moment()['format'](_0x9ba3('0xef')),'data1':_0x3840c6[_0x9ba3('0x68')][_0x9ba3('0xfb')]||_0x9ba3('0xfc'),'role':_0x166f24[_0x9ba3('0x3a')],'internal':_0x166f24['internal']});});return db[_0x9ba3('0xee')]['bulkCreate'](_0x138b6f,{'individualHooks':!![]});})[_0x9ba3('0x24')](function(){return _0x166f24['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3840c6['body'][_0x9ba3('0xfb')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x9ba3('0xb8')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x3748a7,null))[_0x9ba3('0x62')](handleError(_0x3748a7,null));};exports[_0x9ba3('0xfd')]=function(_0x563993,_0x4b44c9,_0x53c0a3){var _0x524430;return db[_0x9ba3('0x48')]['find']({'where':{'id':_0x563993['params']['id']},'attributes':['id',_0x9ba3('0x45'),_0x9ba3('0x3a'),_0x9ba3('0xa8'),_0x9ba3('0xfe'),_0x9ba3('0xff'),_0x9ba3('0x100'),'openchannelPause',_0x9ba3('0x101'),_0x9ba3('0x102'),_0x9ba3('0x103'),_0x9ba3('0x104')]})[_0x9ba3('0x24')](handleEntityNotFound(_0x4b44c9,null))[_0x9ba3('0x24')](function(_0x2992ad){if(_0x2992ad){_0x524430=_0x2992ad;if(_0x563993[_0x9ba3('0x68')]['channel']&&!utils[_0x9ba3('0xaa')](_0x563993[_0x9ba3('0x68')][_0x9ba3('0xa6')])){throw new db[(_0x9ba3('0x9c'))]['ValidationError']('Unknown\x20channel');}switch(_0x563993[_0x9ba3('0x68')][_0x9ba3('0xa6')]){case _0x9ba3('0xb5'):return respondWithRpcPromise(_0x9ba3('0xf9'),_0x9ba3('0xfd'),{'id':_0x524430['id'],'name':_0x524430[_0x9ba3('0x45')],'pause':![]})['then'](function(){return db[_0x9ba3('0xd1')][_0x9ba3('0x38')]({'paused':0x0},{'where':{'UserId':_0x524430['id']},'individualHooks':!![]});})[_0x9ba3('0x24')](function(){return db['MemberReport'][_0x9ba3('0x44')]({'where':{'channel':_0x563993[_0x9ba3('0x68')][_0x9ba3('0xa6')],'membername':_0x524430[_0x9ba3('0x45')],'type':'PAUSE','exitAt':null}});})[_0x9ba3('0x24')](function(_0x18e242){if(_0x18e242){return _0x18e242[_0x9ba3('0x38')]({'exitAt':moment()['format'](_0x9ba3('0xef')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x9ba3('0x24')](function(){return _0x524430[_0x9ba3('0x38')]({'voicePause':![]});});case _0x9ba3('0x105'):case _0x9ba3('0x106'):case _0x9ba3('0x107'):case _0x9ba3('0x108'):case _0x9ba3('0x109'):case _0x9ba3('0x10a'):return db[_0x9ba3('0xee')][_0x9ba3('0x44')]({'where':{'channel':_0x563993[_0x9ba3('0x68')][_0x9ba3('0xa6')],'membername':_0x524430[_0x9ba3('0x45')],'type':_0x9ba3('0xf3'),'exitAt':null}})[_0x9ba3('0x24')](function(_0xe76cf7){if(_0xe76cf7){return _0xe76cf7[_0x9ba3('0x38')]({'exitAt':moment()[_0x9ba3('0xb8')](_0x9ba3('0xef')),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){var _0x4becbe={};_['set'](_0x4becbe,util[_0x9ba3('0xb8')](_0x9ba3('0x10b'),_0x563993['body'][_0x9ba3('0xa6')],'Pause'),![]);return _0x524430[_0x9ba3('0x38')](_0x4becbe);});default:return respondWithRpcPromise(_0x9ba3('0xf9'),_0x9ba3('0xfd'),{'id':_0x524430['id'],'name':_0x524430['name'],'pause':![]})[_0x9ba3('0x24')](function(){return db[_0x9ba3('0xd1')][_0x9ba3('0x38')]({'paused':0x0},{'where':{'UserId':_0x524430['id']}});})[_0x9ba3('0x24')](function(){return db[_0x9ba3('0xee')][_0x9ba3('0x60')]({'where':{'membername':_0x524430['name'],'type':_0x9ba3('0xf3'),'exitAt':null}});})['then'](function(_0x1371ca){var _0x386c8d=[];_0x1371ca[_0x9ba3('0xf1')](function(_0x564ca4){_0x386c8d[_0x9ba3('0x93')](_0x564ca4[_0x9ba3('0x38')]({'exitAt':moment()['format'](_0x9ba3('0xef')),'data2':_0x9ba3('0x10c')}));});return BPromise['all'](_0x386c8d);})[_0x9ba3('0x24')](function(){return _0x524430[_0x9ba3('0x38')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x9ba3('0x24')](respondWithResult(_0x4b44c9,null))['catch'](handleError(_0x4b44c9,null));};exports['getTeams']=function(_0xe4ab9a,_0x43f686,_0xea8452){var _0x2b15ec={};var _0x4ed469={};var _0x3cfd0e;var _0x2eab40;return db['User'][_0x9ba3('0x9e')]({'where':{'id':_0xe4ab9a[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x43f686,null))['then'](function(_0x3cb565){if(_0x3cb565){_0x3cfd0e=_0x3cb565;_0x4ed469[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db['Team'][_0x9ba3('0x65')]);_0x4ed469[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0xe4ab9a[_0x9ba3('0x4f')]);_0x4ed469[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x4ed469[_0x9ba3('0x4b')],_0x4ed469[_0x9ba3('0x4f')]);_0x2b15ec[_0x9ba3('0x52')]=_[_0x9ba3('0x50')](_0x4ed469['model'],qs['fields'](_0xe4ab9a[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x2b15ec[_0x9ba3('0x52')]=_0x2b15ec['attributes']['length']?_0x2b15ec[_0x9ba3('0x52')]:_0x4ed469['model'];_0x2b15ec[_0x9ba3('0xcc')]=qs[_0x9ba3('0xc7')](_0xe4ab9a[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x2b15ec[_0x9ba3('0x5c')]=qs[_0x9ba3('0x58')](_['pick'](_0xe4ab9a[_0x9ba3('0x4f')],_0x4ed469[_0x9ba3('0x58')]));if(_0xe4ab9a[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x2b15ec[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x2b15ec[_0x9ba3('0x5c')],{'$or':_[_0x9ba3('0x41')](_0x2b15ec['attributes'],function(_0x13d348){var _0x103715={};_0x103715[_0x13d348]={'$like':'%'+_0xe4ab9a[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x103715;})});}_0x2b15ec=_[_0x9ba3('0x59')]({},_0x2b15ec,_0xe4ab9a[_0x9ba3('0x5f')]);return _0x3cfd0e[_0x9ba3('0x10d')](_0x2b15ec);}})[_0x9ba3('0x24')](function(_0x454e0f){if(_0x454e0f){_0x2eab40=_0x454e0f['length'];if(!_0xe4ab9a[_0x9ba3('0x4f')][_0x9ba3('0x54')](_0x9ba3('0x55'))){_0x2b15ec['limit']=qs['limit'](_0xe4ab9a[_0x9ba3('0x4f')]['limit']);_0x2b15ec[_0x9ba3('0x56')]=qs['offset'](_0xe4ab9a[_0x9ba3('0x4f')][_0x9ba3('0x56')]);}return _0x3cfd0e[_0x9ba3('0x10d')](_0x2b15ec);}})[_0x9ba3('0x24')](function(_0x575a89){if(_0x575a89){return _0x575a89?{'count':_0x2eab40,'rows':_0x575a89}:null;}})[_0x9ba3('0x24')](respondWithResult(_0x43f686,null))[_0x9ba3('0x62')](handleError(_0x43f686,null));};exports[_0x9ba3('0x10e')]=function(_0xfce4e3,_0x5a7393){return db['User'][_0x9ba3('0x44')]({'where':{'id':_0xfce4e3['params']['id']}})['then'](handleEntityNotFound(_0x5a7393,null))[_0x9ba3('0x24')](function(_0x489afb){if(_0x489afb){var _0x47e3ac=_0x489afb[_0x9ba3('0xce')]({'plain':!![]});return _0x489afb[_0x9ba3('0x10e')](_0xfce4e3[_0x9ba3('0x68')][_0x9ba3('0x6a')],_[_0x9ba3('0x10f')](_0xfce4e3[_0x9ba3('0x68')],[_0x9ba3('0x6a'),'id'])||{})[_0x9ba3('0x24')](function(){for(var _0x3ce492=0x0;_0x3ce492<_0xfce4e3['body'][_0x9ba3('0x6a')]['length'];_0x3ce492++){var _0x35e479=[];db[_0x9ba3('0x110')][_0x9ba3('0x9e')]({'where':{'id':_0xfce4e3[_0x9ba3('0x68')][_0x9ba3('0x6a')][_0x3ce492]}})[_0x9ba3('0x24')](function(_0x5c237e){_0x35e479[_0x9ba3('0x93')](_0x5c237e['getVoiceQueues']()[_0x9ba3('0x24')](function(_0x1703e6){for(var _0x22d6d5=0x0;_0x22d6d5<_0x1703e6[_0x9ba3('0x53')];_0x22d6d5++){_0x1703e6[_0x22d6d5][_0x9ba3('0x111')]('channel',_0x9ba3('0x112'));}return _0x1703e6;}));_0x35e479[_0x9ba3('0x93')](_0x5c237e['getChatQueues']()[_0x9ba3('0x24')](function(_0x5d0e01){for(var _0x1ebbc7=0x0;_0x1ebbc7<_0x5d0e01[_0x9ba3('0x53')];_0x1ebbc7++){_0x5d0e01[_0x1ebbc7][_0x9ba3('0x111')](_0x9ba3('0xa6'),_0x9ba3('0x113'));}return _0x5d0e01;}));_0x35e479[_0x9ba3('0x93')](_0x5c237e[_0x9ba3('0x114')]()[_0x9ba3('0x24')](function(_0x311f61){for(var _0x12fd9d=0x0;_0x12fd9d<_0x311f61[_0x9ba3('0x53')];_0x12fd9d++){_0x311f61[_0x12fd9d]['setDataValue'](_0x9ba3('0xa6'),'Mail');}return _0x311f61;}));_0x35e479['push'](_0x5c237e['getSmsQueues']()[_0x9ba3('0x24')](function(_0x58be5c){for(var _0x3ded7e=0x0;_0x3ded7e<_0x58be5c['length'];_0x3ded7e++){_0x58be5c[_0x3ded7e]['setDataValue'](_0x9ba3('0xa6'),_0x9ba3('0x115'));}return _0x58be5c;}));_0x35e479[_0x9ba3('0x93')](_0x5c237e['getWhatsappQueues']()[_0x9ba3('0x24')](function(_0x2a9b3f){for(var _0x8d158f=0x0;_0x8d158f<_0x2a9b3f[_0x9ba3('0x53')];_0x8d158f++){_0x2a9b3f[_0x8d158f][_0x9ba3('0x111')](_0x9ba3('0xa6'),_0x9ba3('0x116'));}return _0x2a9b3f;}));_0x35e479[_0x9ba3('0x93')](_0x5c237e[_0x9ba3('0x117')]()[_0x9ba3('0x24')](function(_0x4cd4f8){for(var _0x5e9f1c=0x0;_0x5e9f1c<_0x4cd4f8[_0x9ba3('0x53')];_0x5e9f1c++){_0x4cd4f8[_0x5e9f1c][_0x9ba3('0x111')](_0x9ba3('0xa6'),_0x9ba3('0x118'));}return _0x4cd4f8;}));_0x35e479[_0x9ba3('0x93')](_0x5c237e[_0x9ba3('0x119')]()[_0x9ba3('0x24')](function(_0x4b6674){for(var _0x100bcc=0x0;_0x100bcc<_0x4b6674['length'];_0x100bcc++){_0x4b6674[_0x100bcc][_0x9ba3('0x111')](_0x9ba3('0xa6'),_0x9ba3('0x11a'));}return _0x4b6674;}));return BPromise[_0x9ba3('0x94')](_0x35e479);})[_0x9ba3('0x24')](function(_0x53ea32){var _0x2ac94b=_[_0x9ba3('0x11b')](_0x53ea32);_0x35e479=[];return db['sequelize'][_0x9ba3('0x11c')](function(_0x505647){for(var _0x5c7c28=0x0;_0x5c7c28<_0x2ac94b[_0x9ba3('0x53')];_0x5c7c28++){_0x35e479['push'](_0x2ac94b[_0x5c7c28][_0x9ba3('0x11d')](_0x47e3ac['id']),{'transaction':_0x505647});}return BPromise[_0x9ba3('0x94')](_0x35e479)[_0x9ba3('0x24')](function(){if(_0x47e3ac[_0x9ba3('0xb7')]){return BPromise[_0x9ba3('0x95')](_[_0x9ba3('0x40')](_0x2ac94b,function(_0x5b02f4){return _0x5b02f4[_0x9ba3('0x11e')](_0x9ba3('0xa6'))==='Voice';}),function(_0x57c559){return db[_0x9ba3('0xd1')][_0x9ba3('0xba')]({'membername':_0x47e3ac[_0x9ba3('0x45')],'UserId':_0x47e3ac['id'],'queue_name':_0x57c559[_0x9ba3('0x45')],'VoiceQueueId':_0x57c559['id'],'interface':_['isNil'](_0x47e3ac[_0x9ba3('0xa9')])?util[_0x9ba3('0xb8')](_0x9ba3('0xb9'),_0x47e3ac[_0x9ba3('0x45')]):_0x47e3ac[_0x9ba3('0xa9')],'paused':_0x47e3ac[_0x9ba3('0xa8')]||![],'penalty':_0x47e3ac['penalty']},{'transaction':_0x505647});});}else{return;}})[_0x9ba3('0x24')](function(){for(var _0x16d499=0x0;_0x16d499<_0x2ac94b[_0x9ba3('0x53')];_0x16d499++){var _0x421660=_0x2ac94b[_0x16d499][_0x9ba3('0x11e')]('channel');var _0x88b7c6=_0x421660+_0x9ba3('0xb1');socket[_0x9ba3('0xb2')](_0x9ba3('0x86')+_0x421660+_0x9ba3('0xb4'),{'UserId':_0x47e3ac['id'],['queueField']:_0x2ac94b[_0x16d499]['id']});}});});});}});}})[_0x9ba3('0x24')](respondWithStatusCode(_0x5a7393,null))[_0x9ba3('0x62')](handleError(_0x5a7393,null));};exports[_0x9ba3('0x11f')]=function(_0x3b0702,_0x3539ba){return db['User'][_0x9ba3('0x9e')]({'where':{'id':_0x3b0702[_0x9ba3('0x64')]['id']}})['then'](handleEntityNotFound(_0x3539ba,null))[_0x9ba3('0x24')](function(_0xcef132){if(_0xcef132){var _0x2f07fb=_0xcef132[_0x9ba3('0xce')]({'plain':!![]});var _0x356d46=_0x3b0702[_0x9ba3('0x4f')][_0x9ba3('0x6a')];return _0xcef132[_0x9ba3('0x11f')](_0x356d46)[_0x9ba3('0x24')](function(){for(var _0x10c0a2=0x0;_0x10c0a2<_0x356d46[_0x9ba3('0x53')];_0x10c0a2++){var _0x48a300=[];db[_0x9ba3('0x110')][_0x9ba3('0x9e')]({'where':{'id':_0x356d46[_0x10c0a2]}})[_0x9ba3('0x24')](function(_0x550ccd){_0x48a300[_0x9ba3('0x93')](_0x550ccd[_0x9ba3('0xec')]()[_0x9ba3('0x24')](function(_0x52ecf6){for(var _0x5cd4b1=0x0;_0x5cd4b1<_0x52ecf6[_0x9ba3('0x53')];_0x5cd4b1++){_0x52ecf6[_0x5cd4b1][_0x9ba3('0x111')]('channel',_0x9ba3('0x112'));}return _0x52ecf6;}));_0x48a300[_0x9ba3('0x93')](_0x550ccd[_0x9ba3('0x120')]()[_0x9ba3('0x24')](function(_0x2df0c0){for(var _0x525816=0x0;_0x525816<_0x2df0c0['length'];_0x525816++){_0x2df0c0[_0x525816][_0x9ba3('0x111')](_0x9ba3('0xa6'),_0x9ba3('0x113'));}return _0x2df0c0;}));_0x48a300[_0x9ba3('0x93')](_0x550ccd['getMailQueues']()[_0x9ba3('0x24')](function(_0x340348){for(var _0x56ebdd=0x0;_0x56ebdd<_0x340348['length'];_0x56ebdd++){_0x340348[_0x56ebdd][_0x9ba3('0x111')](_0x9ba3('0xa6'),_0x9ba3('0x121'));}return _0x340348;}));_0x48a300['push'](_0x550ccd['getSmsQueues']()['then'](function(_0x54f0b1){for(var _0x5c56d1=0x0;_0x5c56d1<_0x54f0b1[_0x9ba3('0x53')];_0x5c56d1++){_0x54f0b1[_0x5c56d1][_0x9ba3('0x111')](_0x9ba3('0xa6'),_0x9ba3('0x115'));}return _0x54f0b1;}));_0x48a300[_0x9ba3('0x93')](_0x550ccd['getWhatsappQueues']()[_0x9ba3('0x24')](function(_0x1470cb){for(var _0x5919fc=0x0;_0x5919fc<_0x1470cb[_0x9ba3('0x53')];_0x5919fc++){_0x1470cb[_0x5919fc][_0x9ba3('0x111')](_0x9ba3('0xa6'),'Whatsapp');}return _0x1470cb;}));_0x48a300['push'](_0x550ccd[_0x9ba3('0x117')]()[_0x9ba3('0x24')](function(_0x4935d0){for(var _0x209d3b=0x0;_0x209d3b<_0x4935d0[_0x9ba3('0x53')];_0x209d3b++){_0x4935d0[_0x209d3b][_0x9ba3('0x111')](_0x9ba3('0xa6'),'Fax');}return _0x4935d0;}));_0x48a300[_0x9ba3('0x93')](_0x550ccd['getOpenchannelQueues']()[_0x9ba3('0x24')](function(_0x5693e6){for(var _0x49d692=0x0;_0x49d692<_0x5693e6['length'];_0x49d692++){_0x5693e6[_0x49d692][_0x9ba3('0x111')](_0x9ba3('0xa6'),'Openchannel');}return _0x5693e6;}));return BPromise[_0x9ba3('0x94')](_0x48a300);})[_0x9ba3('0x24')](function(_0x4db678){var _0x408ff1=_[_0x9ba3('0x11b')](_0x4db678);_0x48a300=[];return db['sequelize'][_0x9ba3('0x11c')](function(_0x2f6841){for(var _0x281a57=0x0;_0x281a57<_0x408ff1[_0x9ba3('0x53')];_0x281a57++){_0x48a300[_0x9ba3('0x93')](_0x408ff1[_0x281a57][_0x9ba3('0x122')](_0x2f07fb['id']),{'transaction':_0x2f6841});}return BPromise[_0x9ba3('0x94')](_0x48a300)[_0x9ba3('0x24')](function(){if(_0x2f07fb['online']){return BPromise[_0x9ba3('0x95')](_['filter'](_0x408ff1,function(_0xd8cd38){return _0xd8cd38[_0x9ba3('0x11e')](_0x9ba3('0xa6'))===_0x9ba3('0x112');}),function(_0x3d86ea){return db[_0x9ba3('0xd1')][_0x9ba3('0x39')]({'where':{'VoiceQueueId':_0x3d86ea['id'],'UserId':_0x2f07fb['id']},'transaction':_0x2f6841});});}else{return;}})[_0x9ba3('0x24')](function(){for(var _0x2f3e53=0x0;_0x2f3e53<_0x408ff1[_0x9ba3('0x53')];_0x2f3e53++){var _0xcb82f=_0x408ff1[_0x2f3e53][_0x9ba3('0x11e')]('channel');var _0x336a58=_0xcb82f+_0x9ba3('0xb1');socket[_0x9ba3('0xb2')](_0x9ba3('0x86')+_0xcb82f+_0x9ba3('0xbd'),{'UserId':_0x2f07fb['id'],['queueField']:_0x408ff1[_0x2f3e53]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x3539ba,null))['catch'](handleError(_0x3539ba,null));};exports['getLists']=function(_0x2e026e,_0x258b20,_0x2807a7){var _0x47be17={};var _0x20d3b7={};var _0x219378;var _0x53882a;return db[_0x9ba3('0x48')][_0x9ba3('0x9e')]({'where':{'id':_0x2e026e[_0x9ba3('0x64')]['id']}})['then'](handleEntityNotFound(_0x258b20,null))[_0x9ba3('0x24')](function(_0xa01a35){if(_0xa01a35){_0x219378=_0xa01a35;_0x20d3b7[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db[_0x9ba3('0x123')][_0x9ba3('0x65')]);_0x20d3b7[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0x2e026e[_0x9ba3('0x4f')]);_0x20d3b7[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x20d3b7[_0x9ba3('0x4b')],_0x20d3b7['query']);_0x47be17[_0x9ba3('0x52')]=_[_0x9ba3('0x50')](_0x20d3b7['model'],qs[_0x9ba3('0x51')](_0x2e026e[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x47be17[_0x9ba3('0x52')]=_0x47be17[_0x9ba3('0x52')]['length']?_0x47be17[_0x9ba3('0x52')]:_0x20d3b7[_0x9ba3('0x4b')];_0x47be17[_0x9ba3('0xcc')]=qs['sort'](_0x2e026e[_0x9ba3('0x4f')]['sort']);_0x47be17[_0x9ba3('0x5c')]=qs[_0x9ba3('0x58')](_[_0x9ba3('0x57')](_0x2e026e['query'],_0x20d3b7[_0x9ba3('0x58')]));if(_0x2e026e[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x47be17[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x47be17[_0x9ba3('0x5c')],{'$or':_[_0x9ba3('0x41')](_0x47be17['attributes'],function(_0x13fd4f){var _0x254135={};_0x254135[_0x13fd4f]={'$like':'%'+_0x2e026e[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x254135;})});}_0x47be17=_[_0x9ba3('0x59')]({},_0x47be17,_0x2e026e['options']);return _0x219378[_0x9ba3('0x124')](_0x47be17);}})[_0x9ba3('0x24')](function(_0x38ea14){if(_0x38ea14){_0x53882a=_0x38ea14['length'];if(!_0x2e026e[_0x9ba3('0x4f')]['hasOwnProperty'](_0x9ba3('0x55'))){_0x47be17['limit']=qs[_0x9ba3('0x34')](_0x2e026e[_0x9ba3('0x4f')][_0x9ba3('0x34')]);_0x47be17['offset']=qs[_0x9ba3('0x56')](_0x2e026e[_0x9ba3('0x4f')][_0x9ba3('0x56')]);}return _0x219378[_0x9ba3('0x124')](_0x47be17);}})['then'](function(_0x5ccd0e){if(_0x5ccd0e){return _0x5ccd0e?{'count':_0x53882a,'rows':_0x5ccd0e}:null;}})[_0x9ba3('0x24')](respondWithResult(_0x258b20,null))[_0x9ba3('0x62')](handleError(_0x258b20,null));};exports[_0x9ba3('0x125')]=function(_0x266046,_0x147d56,_0x536bf4){var _0x3d002e={};var _0x20d21b={};var _0x3cc433;var _0x17822c;return db['User']['findOne']({'where':{'id':_0x266046[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x147d56,null))['then'](function(_0x4cb17a){if(_0x4cb17a){_0x3cc433=_0x4cb17a;_0x20d21b['model']=_['keys'](db[_0x9ba3('0x48')]['rawAttributes']);_0x20d21b[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0x266046[_0x9ba3('0x4f')]);_0x20d21b[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x20d21b[_0x9ba3('0x4b')],_0x20d21b[_0x9ba3('0x4f')]);_0x3d002e['attributes']=_['intersection'](_0x20d21b['model'],qs[_0x9ba3('0x51')](_0x266046[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x3d002e[_0x9ba3('0x52')]=_0x3d002e[_0x9ba3('0x52')]['length']?_0x3d002e[_0x9ba3('0x52')]:_0x20d21b[_0x9ba3('0x4b')];_0x3d002e['order']=qs[_0x9ba3('0xc7')](_0x266046[_0x9ba3('0x4f')]['sort']);_0x3d002e[_0x9ba3('0x5c')]=qs[_0x9ba3('0x58')](_[_0x9ba3('0x57')](_0x266046[_0x9ba3('0x4f')],_0x20d21b[_0x9ba3('0x58')]));if(_0x266046[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x3d002e['where']=_[_0x9ba3('0x59')](_0x3d002e[_0x9ba3('0x5c')],{'$or':_[_0x9ba3('0x41')](_0x3d002e['attributes'],function(_0x4c2079){var _0x2d2969={};_0x2d2969[_0x4c2079]={'$like':'%'+_0x266046[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x2d2969;})});}_0x3d002e[_0x9ba3('0x4b')]=db['User'];_0x3d002e['as']='Agents';_0x3d002e=_[_0x9ba3('0x59')]({},_0x3d002e,_0x266046[_0x9ba3('0x5f')]);return _0x3cc433[_0x9ba3('0xec')]({'include':[_0x3d002e]});}})['then'](function(_0x14d49e){if(_0x14d49e){var _0x455a3f={},_0x419f76=[],_0x359810=0x0;for(var _0x2caa8b=0x0;_0x2caa8b<_0x14d49e[_0x9ba3('0x53')];_0x2caa8b+=0x1){for(var _0x45bd5f=0x0,_0x13b532;_0x45bd5f<_0x14d49e[_0x2caa8b]['Agents'][_0x9ba3('0x53')];_0x45bd5f+=0x1){_0x13b532=_0x14d49e[_0x2caa8b][_0x9ba3('0x3c')][_0x45bd5f][_0x9ba3('0xce')]({'plain':!![]});_0x455a3f[_0x13b532['id']]=_0x13b532;}}_0x455a3f=_[_0x9ba3('0x126')](_0x455a3f);for(var _0x5902c8=qs[_0x9ba3('0x56')](_0x266046[_0x9ba3('0x4f')][_0x9ba3('0x56')]);_0x5902c8<_0x455a3f[_0x9ba3('0x53')]&&_0x419f76[_0x9ba3('0x53')]=_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 +var _0x3495=['getVoiceQueues','UserVoiceQueue.penalty','all','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','localhost','redis','./user.socket','register','request','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetUser','options','raw','where','attributes','limit','map','include','model','then','catch','ShowUser','find','PauseUser','name','internal','update','MemberReport','findAll','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','length','getChannels','forEach','push','isNil','interface','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','UnpauseUser','User','findOne','channel','isValidChannel','Unknown\x20channel','voice','UserVoiceQueueRt','system','mail','fax','sms','openchannel','set','Pause','LoginUser','role','mobile','phone','loginInPause','agent','../../config/license/util','getLicense','agents','destroy'];(function(_0x1acdd7,_0x1b63d6){var _0x5eed04=function(_0x5d4335){while(--_0x5d4335){_0x1acdd7['push'](_0x1acdd7['shift']());}};_0x5eed04(++_0x1b63d6);}(_0x3495,0x1de));var _0x5349=function(_0x316a10,_0x3dab0d){_0x316a10=_0x316a10-0x0;var _0x487672=_0x3495[_0x316a10];return _0x487672;};'use strict';var _=require(_0x5349('0x0'));var util=require(_0x5349('0x1'));var moment=require(_0x5349('0x2'));var BPromise=require(_0x5349('0x3'));var rs=require(_0x5349('0x4'));var fs=require('fs');var Redis=require(_0x5349('0x5'));var db=require(_0x5349('0x6'))['db'];var utils=require(_0x5349('0x7'));var logger=require(_0x5349('0x8'))('rpc');var config=require(_0x5349('0x9'));var jayson=require(_0x5349('0xa'));var client=jayson['client'][_0x5349('0xb')]({'port':0x232a});config['redis']=_[_0x5349('0xc')](config['redis'],{'host':_0x5349('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5349('0xe')]));require(_0x5349('0xf'))[_0x5349('0x10')](socket);function respondWithRpcPromise(_0x23a1c7,_0x21bf91,_0x3a416e){return new BPromise(function(_0x35d425,_0x4bf160){return client[_0x5349('0x11')](_0x23a1c7,_0x3a416e)['then'](function(_0x2cbd83){logger[_0x5349('0x12')](_0x5349('0x13'),_0x21bf91,_0x5349('0x14'));logger[_0x5349('0x15')](_0x5349('0x16'),_0x21bf91,_0x5349('0x14'),JSON[_0x5349('0x17')](_0x2cbd83));if(_0x2cbd83[_0x5349('0x18')]){if(_0x2cbd83[_0x5349('0x18')]['code']===0x1f4){logger[_0x5349('0x18')](_0x5349('0x13'),_0x21bf91,_0x2cbd83['error'][_0x5349('0x19')]);return _0x4bf160(_0x2cbd83[_0x5349('0x18')][_0x5349('0x19')]);}logger['error']('User,\x20%s,\x20%s',_0x21bf91,_0x2cbd83['error'][_0x5349('0x19')]);return _0x35d425(_0x2cbd83['error'][_0x5349('0x19')]);}else{logger['info'](_0x5349('0x13'),_0x21bf91,_0x5349('0x14'));_0x35d425(_0x2cbd83[_0x5349('0x1a')][_0x5349('0x19')]);}})['catch'](function(_0x22d1ca){logger[_0x5349('0x18')](_0x5349('0x13'),_0x21bf91,_0x22d1ca);_0x4bf160(_0x22d1ca);});});}exports[_0x5349('0x1b')]=function(_0x4be827){var _0xeaab5a=this;return new Promise(function(_0x3594a4,_0x4f2cb6){return db['User']['findAll']({'raw':_0x4be827[_0x5349('0x1c')]?_0x4be827['options'][_0x5349('0x1d')]===undefined?!![]:![]:!![],'where':_0x4be827[_0x5349('0x1c')]?_0x4be827[_0x5349('0x1c')][_0x5349('0x1e')]||null:null,'attributes':_0x4be827[_0x5349('0x1c')]?_0x4be827[_0x5349('0x1c')][_0x5349('0x1f')]||null:null,'limit':_0x4be827[_0x5349('0x1c')]?_0x4be827[_0x5349('0x1c')][_0x5349('0x20')]||null:null,'include':_0x4be827[_0x5349('0x1c')]?_0x4be827[_0x5349('0x1c')]['include']?_[_0x5349('0x21')](_0x4be827[_0x5349('0x1c')][_0x5349('0x22')],function(_0x49435a){return{'model':db[_0x49435a[_0x5349('0x23')]],'as':_0x49435a['as'],'attributes':_0x49435a['attributes'],'include':_0x49435a[_0x5349('0x22')]?_[_0x5349('0x21')](_0x49435a[_0x5349('0x22')],function(_0x49153e){return{'model':db[_0x49153e[_0x5349('0x23')]],'as':_0x49153e['as'],'attributes':_0x49153e[_0x5349('0x1f')],'include':_0x49153e[_0x5349('0x22')]?_[_0x5349('0x21')](_0x49153e[_0x5349('0x22')],function(_0x16edcb){return{'model':db[_0x16edcb[_0x5349('0x23')]],'as':_0x16edcb['as'],'attributes':_0x16edcb[_0x5349('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5349('0x24')](function(_0x5b5d6c){logger[_0x5349('0x12')](_0x5349('0x1b'),_0x4be827);logger['debug'](_0x5349('0x1b'),_0x4be827,JSON['stringify'](_0x5b5d6c));_0x3594a4(_0x5b5d6c);})[_0x5349('0x25')](function(_0x262f62){logger[_0x5349('0x18')](_0x5349('0x1b'),_0x262f62[_0x5349('0x19')],_0x4be827);_0x4f2cb6(_0xeaab5a[_0x5349('0x18')](0x1f4,_0x262f62['message']));});});};exports[_0x5349('0x26')]=function(_0x3162c8){var _0xb0bc68=this;return new Promise(function(_0x2c24f4,_0x538814){return db['User'][_0x5349('0x27')]({'raw':_0x3162c8[_0x5349('0x1c')]?_0x3162c8[_0x5349('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3162c8[_0x5349('0x1c')]?_0x3162c8['options'][_0x5349('0x1e')]||null:null,'attributes':_0x3162c8[_0x5349('0x1c')]?_0x3162c8[_0x5349('0x1c')][_0x5349('0x1f')]||null:null,'include':_0x3162c8[_0x5349('0x1c')]?_0x3162c8[_0x5349('0x1c')]['include']?_['map'](_0x3162c8[_0x5349('0x1c')][_0x5349('0x22')],function(_0x1be201){return{'model':db[_0x1be201[_0x5349('0x23')]],'as':_0x1be201['as'],'attributes':_0x1be201[_0x5349('0x1f')],'include':_0x1be201[_0x5349('0x22')]?_[_0x5349('0x21')](_0x1be201['include'],function(_0x544557){return{'model':db[_0x544557[_0x5349('0x23')]],'as':_0x544557['as'],'attributes':_0x544557['attributes'],'include':_0x544557['include']?_[_0x5349('0x21')](_0x544557['include'],function(_0x18f881){return{'model':db[_0x18f881[_0x5349('0x23')]],'as':_0x18f881['as'],'attributes':_0x18f881[_0x5349('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd2376d){logger['info'](_0x5349('0x26'),_0x3162c8);logger[_0x5349('0x15')](_0x5349('0x26'),_0x3162c8,JSON['stringify'](_0xd2376d));_0x2c24f4(_0xd2376d);})['catch'](function(_0x5e5799){logger[_0x5349('0x18')](_0x5349('0x26'),_0x5e5799[_0x5349('0x19')],_0x3162c8);_0x538814(_0xb0bc68[_0x5349('0x18')](0x1f4,_0x5e5799[_0x5349('0x19')]));});});};exports[_0x5349('0x28')]=function(_0x50c506){var _0x52ab9d=this;return new Promise(function(_0x2bda71,_0x188014){var _0x160430;return db['User'][_0x5349('0x27')]({'where':_0x50c506[_0x5349('0x1c')][_0x5349('0x1e')]||{},'attributes':['id',_0x5349('0x29'),'role',_0x5349('0x2a'),'interface']})[_0x5349('0x24')](function(_0x196d68){if(_0x196d68){_0x160430=_0x196d68;return db['UserVoiceQueueRt'][_0x5349('0x2b')]({'paused':0x1},{'where':{'UserId':_0x160430['id']},'individualHooks':!![]});}})[_0x5349('0x24')](function(){if(_0x160430){return db[_0x5349('0x2c')][_0x5349('0x2d')]({'where':{'membername':_0x160430[_0x5349('0x29')],'type':_0x5349('0x2e'),'exitAt':null}});}})[_0x5349('0x24')](function(_0x4a8237){if(_0x160430){if(_0x4a8237&&_0x4a8237['length']){var _0x1b981c=moment()[_0x5349('0x2f')](_0x5349('0x30'));for(var _0x41cf4d=0x0,_0x5d589c=_0x4a8237[_0x5349('0x31')];_0x41cf4d<_0x5d589c;_0x41cf4d++){_0x4a8237[_0x41cf4d]['updateAttributes']({'exitAt':_0x1b981c});}}}})['then'](function(){if(_0x160430){var _0xde3ff2=[];var _0x42d359=utils[_0x5349('0x32')]();_0x42d359[_0x5349('0x33')](function(_0x4d7735){_0xde3ff2[_0x5349('0x34')]({'channel':_0x4d7735,'membername':_0x160430[_0x5349('0x29')],'interface':_[_0x5349('0x35')](_0x160430[_0x5349('0x36')])?util[_0x5349('0x2f')](_0x5349('0x37'),_0x160430[_0x5349('0x29')]):_0x160430[_0x5349('0x36')],'type':_0x5349('0x2e'),'enterAt':moment()[_0x5349('0x2f')](_0x5349('0x30')),'data1':_0x50c506[_0x5349('0x38')][_0x5349('0x39')]||_0x5349('0x3a'),'role':_0x160430['role'],'internal':_0x160430['internal'],'uniqueid':_0x50c506[_0x5349('0x38')][_0x5349('0x3b')]||null});});return db[_0x5349('0x2c')][_0x5349('0x3c')](_0xde3ff2,{'individualHooks':!![]});}})[_0x5349('0x24')](function(){if(_0x160430){return _0x160430[_0x5349('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x50c506['body'][_0x5349('0x39')]||_0x5349('0x3a'),'lastPauseAt':moment()[_0x5349('0x2f')](_0x5349('0x30'))});}})[_0x5349('0x24')](function(_0x1a5a2f){_0x2bda71(_0x1a5a2f);})['catch'](function(_0x38f383){_0x188014(_0x52ab9d['error'](0x1f4,_0x38f383[_0x5349('0x19')]));});});};exports[_0x5349('0x3d')]=function(_0x35ca92){var _0x3f4db2=this;return new Promise(function(_0x259701,_0x5ca5e7){var _0x3891fd;return db[_0x5349('0x3e')][_0x5349('0x3f')]({'where':_0x35ca92[_0x5349('0x1c')]['where']||{},'attributes':['id',_0x5349('0x29')]})[_0x5349('0x24')](function(_0x304c7f){if(_0x304c7f){_0x3891fd=_0x304c7f;if(_0x35ca92[_0x5349('0x38')][_0x5349('0x40')]&&!utils[_0x5349('0x41')](_0x35ca92[_0x5349('0x38')][_0x5349('0x40')])){throw new Error(_0x5349('0x42'));}switch(_0x35ca92[_0x5349('0x38')][_0x5349('0x40')]){case _0x5349('0x43'):return db[_0x5349('0x44')][_0x5349('0x2b')]({'paused':0x0},{'where':{'UserId':_0x3891fd['id']}})[_0x5349('0x24')](function(){return db[_0x5349('0x2c')][_0x5349('0x27')]({'where':{'channel':_0x35ca92[_0x5349('0x38')]['channel'],'membername':_0x3891fd[_0x5349('0x29')],'type':_0x5349('0x2e'),'exitAt':null}});})['then'](function(_0x5f09d6){if(_0x5f09d6){return _0x5f09d6[_0x5349('0x2b')]({'exitAt':moment()[_0x5349('0x2f')](_0x5349('0x30')),'data2':_0x5349('0x45')},{'individualHooks':!![]});}return null;})[_0x5349('0x24')](function(){return _0x3891fd[_0x5349('0x2b')]({'voicePause':![]});});case _0x5349('0x46'):case'chat':case _0x5349('0x47'):case _0x5349('0x48'):case _0x5349('0x49'):case'whatsapp':return db['MemberReport'][_0x5349('0x27')]({'where':{'channel':_0x35ca92[_0x5349('0x38')][_0x5349('0x40')],'membername':_0x3891fd[_0x5349('0x29')],'type':_0x5349('0x2e'),'exitAt':null}})[_0x5349('0x24')](function(_0xe4b289){return _0xe4b289[_0x5349('0x2b')]({'exitAt':moment()['format'](_0x5349('0x30')),'data2':'system'},{'individualHooks':!![]});})[_0x5349('0x24')](function(){var _0x2d3a20={};_[_0x5349('0x4a')](_0x2d3a20,util[_0x5349('0x2f')]('%s%s',_0x35ca92['body']['channel'],_0x5349('0x4b')),![]);return _0x3891fd['update'](_0x2d3a20);});default:return db[_0x5349('0x44')][_0x5349('0x2b')]({'paused':0x0},{'where':{'UserId':_0x3891fd['id']}})[_0x5349('0x24')](function(){return db[_0x5349('0x2c')][_0x5349('0x2d')]({'where':{'membername':_0x3891fd[_0x5349('0x29')],'type':'PAUSE','exitAt':null}});})[_0x5349('0x24')](function(_0x1936d4){var _0x16f6d3=[];_0x1936d4[_0x5349('0x33')](function(_0x41c717){_0x16f6d3['push'](_0x41c717[_0x5349('0x2b')]({'exitAt':moment()['format'](_0x5349('0x30')),'data2':'system'}));});return BPromise['all'](_0x16f6d3);})[_0x5349('0x24')](function(){return _0x3891fd[_0x5349('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x5349('0x24')](function(_0x11a5c5){_0x259701(_0x11a5c5);})[_0x5349('0x25')](function(_0x1c8222){_0x5ca5e7(_0x3f4db2[_0x5349('0x18')](0x1f4,_0x1c8222[_0x5349('0x19')]));});});};exports['LogoutUser']=function(_0x38511){var _0xbefe3a=this;return new Promise(function(_0x22c21d,_0x36f0ba){var _0x2bbe63;return db['User'][_0x5349('0x3f')]({'where':_0x38511['options'][_0x5349('0x1e')]||{},'attributes':['id',_0x5349('0x29')]})[_0x5349('0x24')](function(_0x49511a){if(_0x49511a){_0x2bbe63=_0x49511a;return db[_0x5349('0x44')]['destroy']({'where':{'membername':_0x2bbe63[_0x5349('0x29')]},'individualHooks':!![]});}})['then'](function(){if(_0x2bbe63){return db['MemberReport'][_0x5349('0x2d')]({'where':{'membername':_0x2bbe63[_0x5349('0x29')],'exitAt':null}});}})['then'](function(_0x12df01){if(_0x2bbe63){if(_0x12df01&&_0x12df01[_0x5349('0x31')]){var _0x3e5a25=[];_0x12df01['forEach'](function(_0x16ddc5){_0x3e5a25[_0x5349('0x34')](_0x16ddc5['update']({'exitAt':moment()['format'](_0x5349('0x30'))}));});return BPromise['all'](_0x3e5a25);}}})['then'](function(){if(_0x2bbe63){return _0x2bbe63['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x5349('0x24')](function(_0xffe718){_0x22c21d(_0xffe718);})[_0x5349('0x25')](function(_0x48a56e){_0x36f0ba(_0xbefe3a[_0x5349('0x18')](0x1f4,_0x48a56e[_0x5349('0x19')]));});});};exports[_0x5349('0x4c')]=function(_0x5812b0){var _0x5239da=this;return new Promise(function(_0x674054,_0x3331f6){var _0xba2400;var _0x3a2738;var _0x3b683c;var _0xa58477;return db[_0x5349('0x3e')][_0x5349('0x3f')]({'where':_0x5812b0[_0x5349('0x1c')][_0x5349('0x1e')]||{},'attributes':['id',_0x5349('0x29'),_0x5349('0x4d'),_0x5349('0x4e'),_0x5349('0x4f'),_0x5349('0x2a'),_0x5349('0x50'),_0x5349('0x36')]})['then'](function(_0x51f325){if(_0x51f325){_0xba2400=_0x51f325;_0xa58477=_0x5812b0[_0x5349('0x38')][_0x5349('0x36')]?_0x5812b0['body'][_0x5349('0x36')]:util[_0x5349('0x2f')](_0x5349('0x37'),_0xba2400['name']);return db['User']['count']({'where':{'role':_0x5349('0x51'),'online':!![],'id':{'$ne':_0xba2400['id']}}});}})['then'](function(_0x23fa0b){if(_0x23fa0b){_0x3b683c=_0x23fa0b;return require(_0x5349('0x52'))[_0x5349('0x53')]();}})[_0x5349('0x24')](function(_0x4569f9){if(_0x4569f9&&_0x4569f9[_0x5349('0x54')]&&_0x3b683c>=_0x4569f9[_0x5349('0x54')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x5349('0x24')](function(){if(_0xba2400){return db['UserVoiceQueueRt'][_0x5349('0x55')]({'where':{'membername':_0xba2400[_0x5349('0x29')]},'individualHooks':!![]});}})[_0x5349('0x24')](function(){if(_0xba2400){return _0xba2400[_0x5349('0x56')]({'raw':!![]});}})[_0x5349('0x24')](function(_0x44da7a){if(_0xba2400){if(_0x44da7a){var _0x3ffabf=[];_0x3a2738=_0x44da7a;if(_0x3a2738[_0x5349('0x31')]){for(var _0x5a58e1=0x0;_0x5a58e1<_0x3a2738['length'];_0x5a58e1++){_0x3ffabf[_0x5349('0x34')](db['UserVoiceQueueRt']['upsert']({'membername':_0xba2400['name'],'UserId':_0xba2400['id'],'queue_name':_0x3a2738[_0x5a58e1][_0x5349('0x29')],'VoiceQueueId':_0x3a2738[_0x5a58e1]['id'],'interface':_0xa58477,'paused':_0xba2400[_0x5349('0x50')]||![],'penalty':_0x3a2738[_0x5a58e1][_0x5349('0x57')]||0x0}));}return BPromise[_0x5349('0x58')](_0x3ffabf);}}}})[_0x5349('0x24')](function(){if(_0xba2400){return db[_0x5349('0x2c')][_0x5349('0x2d')]({'where':{'membername':_0xba2400[_0x5349('0x29')],'exitAt':null}});}})['then'](function(_0x5871b1){if(_0xba2400){if(_0x5871b1&&_0x5871b1[_0x5349('0x31')]){var _0x3a28ab=[];_0x5871b1['forEach'](function(_0x34bc2c){_0x3a28ab[_0x5349('0x34')](_0x34bc2c[_0x5349('0x2b')]({'exitAt':moment()[_0x5349('0x2f')](_0x5349('0x30'))}));});return BPromise[_0x5349('0x58')](_0x3a28ab);}}})['then'](function(_0x27f695){if(_0xba2400){var _0x5e39ff=[];var _0x3c4031=[];var _0x16fab6=utils[_0x5349('0x32')]();var _0x128b71={'membername':_0xba2400[_0x5349('0x29')],'interface':_0xa58477,'enterAt':moment()[_0x5349('0x2f')](_0x5349('0x30')),'role':_0xba2400['role'],'internal':_0xba2400[_0x5349('0x2a')]};_0x16fab6[_0x5349('0x33')](function(_0x3bc056){_0x5e39ff['push'](_[_0x5349('0x59')]({'channel':_0x3bc056,'type':_0x5349('0x5a'),'data1':_0x5349('0x5b'),'data2':_0xa58477},_0x128b71));if(_0xba2400['loginInPause']){_0x3c4031[_0x5349('0x34')](_[_0x5349('0x59')]({'channel':_0x3bc056,'type':_0x5349('0x2e'),'data1':_0x5349('0x5c')},_0x128b71));}});return db[_0x5349('0x2c')][_0x5349('0x3c')](_0x5e39ff[_0x5349('0x5d')](_0x3c4031),{'individualHooks':!![]});}})[_0x5349('0x24')](function(){if(_0xba2400){return _0xba2400[_0x5349('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x5349('0x2f')](_0x5349('0x30')),'voicePause':_0xba2400[_0x5349('0x50')]||![],'mailPause':_0xba2400[_0x5349('0x50')]||![],'chatPause':_0xba2400[_0x5349('0x50')]||![],'faxPause':_0xba2400['loginInPause']||![],'smsPause':_0xba2400[_0x5349('0x50')]||![],'openchannelPause':_0xba2400[_0x5349('0x50')]||![],'pauseType':_0xba2400[_0x5349('0x50')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0xa58477});}})[_0x5349('0x24')](function(_0x17ddf0){_0x674054(_0x17ddf0);})['catch'](function(_0x4eb212){_0x3331f6(_0x5239da[_0x5349('0x18')](0x1f4,_0x4eb212[_0x5349('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index c5bb7e9..069f8fe 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 _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 +var _0xe89b=['register','user:','save','remove','update','emit','removeListener'];(function(_0x49ee34,_0x489d34){var _0x13e172=function(_0x5d607e){while(--_0x5d607e){_0x49ee34['push'](_0x49ee34['shift']());}};_0x13e172(++_0x489d34);}(_0xe89b,0x64));var _0xbe89=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xe89b[_0x618414];return _0x21c19a;};'use strict';var UserEvents=require('./user.events');var events=[_0xbe89('0x0'),_0xbe89('0x1'),_0xbe89('0x2')];function createListener(_0x4806b7,_0x303692){return function(_0x303003){_0x303692[_0xbe89('0x3')](_0x4806b7,_0x303003);};}function removeListener(_0x164cf5,_0x510570){return function(){UserEvents[_0xbe89('0x4')](_0x164cf5,_0x510570);};}exports[_0xbe89('0x5')]=function(_0x343477){for(var _0x5c4d0e=0x0,_0x24283c=events['length'];_0x5c4d0e<_0x24283c;_0x5c4d0e++){var _0x196e51=events[_0x5c4d0e];var _0x412a06=createListener(_0xbe89('0x6')+_0x196e51,_0x343477);UserEvents['on'](_0x196e51,_0x412a06);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index f1fca28..8999b93 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 _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 +var _0xc89d=['multer','util','path','connect-timeout','../../components/auth/service','exports'];(function(_0x5953ca,_0x595eb4){var _0x3b60f4=function(_0x1ee6f7){while(--_0x1ee6f7){_0x5953ca['push'](_0x5953ca['shift']());}};_0x3b60f4(++_0x595eb4);}(_0xc89d,0x17a));var _0xdc89=function(_0x4c4ae8,_0x31cf2d){_0x4c4ae8=_0x4c4ae8-0x0;var _0x1b3a1c=_0xc89d[_0x4c4ae8];return _0x1b3a1c;};'use strict';var multer=require(_0xdc89('0x0'));var util=require(_0xdc89('0x1'));var path=require(_0xdc89('0x2'));var timeout=require(_0xdc89('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xdc89('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xdc89('0x5')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index c69886e..079855f 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 _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 +var _0xd8b0=['exports','sequelize'];(function(_0x10dcbe,_0x30d60d){var _0x294e6b=function(_0x5ff33b){while(--_0x5ff33b){_0x10dcbe['push'](_0x10dcbe['shift']());}};_0x294e6b(++_0x30d60d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 400bc5c..c6f732a 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 _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 +var _0x34bd=['../../config/environment','exports','UserChatQueue','user_has_chat_queues','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0x34bd,0x1d2));var _0xd34b=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x34bd[_0x1a72f3];return _0x57ef47;};'use strict';var _=require(_0xd34b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd34b('0x1'));var moment=require(_0xd34b('0x2'));var BPromise=require(_0xd34b('0x3'));var rp=require(_0xd34b('0x4'));var fs=require('fs');var path=require(_0xd34b('0x5'));var rimraf=require(_0xd34b('0x6'));var config=require(_0xd34b('0x7'));var attributes=require('./userChatQueue.attributes');module[_0xd34b('0x8')]=function(_0x5d161e,_0x4e6e94){return _0x5d161e['define'](_0xd34b('0x9'),attributes,{'tableName':_0xd34b('0xa'),'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 cd2b2e7..aea13c6 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 _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 +var _0x82a4=['stringify','error','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x585478,_0x45a6ef){var _0x3b1ea9=function(_0x4bf348){while(--_0x4bf348){_0x585478['push'](_0x585478['shift']());}};_0x3b1ea9(++_0x45a6ef);}(_0x82a4,0x17c));var _0x482a=function(_0x204c4e,_0x57f093){_0x204c4e=_0x204c4e-0x0;var _0x2c6733=_0x82a4[_0x204c4e];return _0x2c6733;};'use strict';var _=require(_0x482a('0x0'));var util=require(_0x482a('0x1'));var moment=require(_0x482a('0x2'));var BPromise=require(_0x482a('0x3'));var rs=require(_0x482a('0x4'));var fs=require('fs');var Redis=require(_0x482a('0x5'));var db=require(_0x482a('0x6'))['db'];var utils=require(_0x482a('0x7'));var logger=require(_0x482a('0x8'))('rpc');var config=require(_0x482a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x482a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a407f,_0x375244,_0x31f9a7){return new BPromise(function(_0x24ed5c,_0x36f141){return client['request'](_0x5a407f,_0x31f9a7)[_0x482a('0xb')](function(_0x5961b6){logger[_0x482a('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x375244,_0x482a('0xd'));logger[_0x482a('0xe')](_0x482a('0xf'),_0x375244,_0x482a('0xd'),JSON[_0x482a('0x10')](_0x5961b6));if(_0x5961b6['error']){if(_0x5961b6['error']['code']===0x1f4){logger[_0x482a('0x11')](_0x482a('0x12'),_0x375244,_0x5961b6[_0x482a('0x11')][_0x482a('0x13')]);return _0x36f141(_0x5961b6['error'][_0x482a('0x13')]);}logger['error'](_0x482a('0x12'),_0x375244,_0x5961b6['error'][_0x482a('0x13')]);return _0x24ed5c(_0x5961b6[_0x482a('0x11')]['message']);}else{logger[_0x482a('0xc')](_0x482a('0x12'),_0x375244,_0x482a('0xd'));_0x24ed5c(_0x5961b6[_0x482a('0x14')][_0x482a('0x13')]);}})[_0x482a('0x15')](function(_0x71aa21){logger['error'](_0x482a('0x12'),_0x375244,_0x71aa21);_0x36f141(_0x71aa21);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 98da7d3..6b260d8 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 _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 +var _0x474e=['express','Router','../../components/interaction/service','../../config/environment','multer','path','connect-timeout'];(function(_0x2209fd,_0x5422da){var _0x2c2241=function(_0x316cf7){while(--_0x316cf7){_0x2209fd['push'](_0x2209fd['shift']());}};_0x2c2241(++_0x5422da);}(_0x474e,0x17e));var _0xe474=function(_0x1eb74d,_0x301c40){_0x1eb74d=_0x1eb74d-0x0;var _0x439ae3=_0x474e[_0x1eb74d];return _0x439ae3;};'use strict';var multer=require(_0xe474('0x0'));var util=require('util');var path=require(_0xe474('0x1'));var timeout=require(_0xe474('0x2'));var express=require(_0xe474('0x3'));var router=express[_0xe474('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe474('0x5'));var config=require(_0xe474('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 cf9c953..f93d054 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 _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 +var _0x80ed=['INTEGER','STRING','sequelize'];(function(_0x2cfee1,_0x1f4678){var _0x3bd7ae=function(_0x2af38d){while(--_0x2af38d){_0x2cfee1['push'](_0x2cfee1['shift']());}};_0x3bd7ae(++_0x1f4678);}(_0x80ed,0x11c));var _0xd80e=function(_0x2662ea,_0x543a9b){_0x2662ea=_0x2662ea-0x0;var _0x5c1a53=_0x80ed[_0x2662ea];return _0x5c1a53;};'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 diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index d1b7e8d..478b853 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 _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 +var _0x39ca=['define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x39ca,0xb7));var _0xa39c=function(_0x3b711c,_0x4b22dc){_0x3b711c=_0x3b711c-0x0;var _0x2685f0=_0x39ca[_0x3b711c];return _0x2685f0;};'use strict';var _=require(_0xa39c('0x0'));var util=require(_0xa39c('0x1'));var logger=require(_0xa39c('0x2'))(_0xa39c('0x3'));var moment=require(_0xa39c('0x4'));var BPromise=require(_0xa39c('0x5'));var rp=require(_0xa39c('0x6'));var fs=require('fs');var path=require(_0xa39c('0x7'));var rimraf=require(_0xa39c('0x8'));var config=require(_0xa39c('0x9'));var attributes=require(_0xa39c('0xa'));module[_0xa39c('0xb')]=function(_0x26d6e5,_0x5e34cf){return _0x26d6e5[_0xa39c('0xc')](_0xa39c('0xd'),attributes,{'tableName':_0xa39c('0xe'),'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 48a3445..01fba25 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 _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 +var _0x6f12=['../../config/utils','../../config/logger','rpc','../../config/environment','client','info','UserFaxQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6f12,0x86));var _0x26f1=function(_0x53c866,_0x4e1b69){_0x53c866=_0x53c866-0x0;var _0x23d503=_0x6f12[_0x53c866];return _0x23d503;};'use strict';var _=require(_0x26f1('0x0'));var util=require('util');var moment=require(_0x26f1('0x1'));var BPromise=require(_0x26f1('0x2'));var rs=require(_0x26f1('0x3'));var fs=require('fs');var Redis=require(_0x26f1('0x4'));var db=require(_0x26f1('0x5'))['db'];var utils=require(_0x26f1('0x6'));var logger=require(_0x26f1('0x7'))(_0x26f1('0x8'));var config=require(_0x26f1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x26f1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa5c21d,_0x2da597,_0x5047d8){return new BPromise(function(_0x43f47d,_0x4883ad){return client['request'](_0xa5c21d,_0x5047d8)['then'](function(_0x245122){logger[_0x26f1('0xb')](_0x26f1('0xc'),_0x2da597,'request\x20sent');logger[_0x26f1('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x2da597,_0x26f1('0xe'),JSON[_0x26f1('0xf')](_0x245122));if(_0x245122['error']){if(_0x245122[_0x26f1('0x10')]['code']===0x1f4){logger[_0x26f1('0x10')](_0x26f1('0xc'),_0x2da597,_0x245122[_0x26f1('0x10')][_0x26f1('0x11')]);return _0x4883ad(_0x245122['error'][_0x26f1('0x11')]);}logger[_0x26f1('0x10')](_0x26f1('0xc'),_0x2da597,_0x245122[_0x26f1('0x10')][_0x26f1('0x11')]);return _0x43f47d(_0x245122[_0x26f1('0x10')]['message']);}else{logger['info'](_0x26f1('0xc'),_0x2da597,_0x26f1('0xe'));_0x43f47d(_0x245122[_0x26f1('0x12')][_0x26f1('0x11')]);}})[_0x26f1('0x13')](function(_0x16989){logger[_0x26f1('0x10')](_0x26f1('0xc'),_0x2da597,_0x16989);_0x4883ad(_0x16989);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 8d614ed..6fb2d60 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 _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 +var _0x4a9a=['Router','../../components/interaction/service','../../config/environment','util','path','express'];(function(_0x4f66ef,_0x3d47ef){var _0x34c6ec=function(_0x449aaf){while(--_0x449aaf){_0x4f66ef['push'](_0x4f66ef['shift']());}};_0x34c6ec(++_0x3d47ef);}(_0x4a9a,0x123));var _0xa4a9=function(_0x58a02f,_0x113e34){_0x58a02f=_0x58a02f-0x0;var _0x37c115=_0x4a9a[_0x58a02f];return _0x37c115;};'use strict';var multer=require('multer');var util=require(_0xa4a9('0x0'));var path=require(_0xa4a9('0x1'));var timeout=require('connect-timeout');var express=require(_0xa4a9('0x2'));var router=express[_0xa4a9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa4a9('0x4'));var config=require(_0xa4a9('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index e82f04c..a83b8f1 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 _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 +var _0xd8b0=['exports','sequelize'];(function(_0x19bdf5,_0x3a6395){var _0x140930=function(_0x1b1a19){while(--_0x1b1a19){_0x19bdf5['push'](_0x19bdf5['shift']());}};_0x140930(++_0x3a6395);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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 832ff54..c90501a 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 _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 +var _0x2032=['user_has_mail_queues','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0xd4dc58,_0x1638a0){var _0xba87f1=function(_0x1e62ee){while(--_0x1e62ee){_0xd4dc58['push'](_0xd4dc58['shift']());}};_0xba87f1(++_0x1638a0);}(_0x2032,0xd9));var _0x2203=function(_0x599556,_0x470f66){_0x599556=_0x599556-0x0;var _0x3f6182=_0x2032[_0x599556];return _0x3f6182;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 1392c70..c4b53b6 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 _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 +var _0x6bfc=['error','message','result','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x4f1820,_0x1a7a89){var _0x42ef0e=function(_0x2a9aa1){while(--_0x2a9aa1){_0x4f1820['push'](_0x4f1820['shift']());}};_0x42ef0e(++_0x1a7a89);}(_0x6bfc,0x159));var _0xc6bf=function(_0x2fc428,_0x1de237){_0x2fc428=_0x2fc428-0x0;var _0x4e53ef=_0x6bfc[_0x2fc428];return _0x4e53ef;};'use strict';var _=require('lodash');var util=require(_0xc6bf('0x0'));var moment=require(_0xc6bf('0x1'));var BPromise=require(_0xc6bf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6bf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc6bf('0x4'));var logger=require('../../config/logger')(_0xc6bf('0x5'));var config=require(_0xc6bf('0x6'));var jayson=require(_0xc6bf('0x7'));var client=jayson['client'][_0xc6bf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c9049,_0x47039a,_0x28d218){return new BPromise(function(_0x250311,_0x3b2815){return client[_0xc6bf('0x9')](_0x2c9049,_0x28d218)[_0xc6bf('0xa')](function(_0x52dac0){logger[_0xc6bf('0xb')](_0xc6bf('0xc'),_0x47039a,_0xc6bf('0xd'));logger[_0xc6bf('0xe')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x47039a,'request\x20sent',JSON[_0xc6bf('0xf')](_0x52dac0));if(_0x52dac0[_0xc6bf('0x10')]){if(_0x52dac0['error']['code']===0x1f4){logger[_0xc6bf('0x10')](_0xc6bf('0xc'),_0x47039a,_0x52dac0['error'][_0xc6bf('0x11')]);return _0x3b2815(_0x52dac0[_0xc6bf('0x10')][_0xc6bf('0x11')]);}logger[_0xc6bf('0x10')](_0xc6bf('0xc'),_0x47039a,_0x52dac0['error']['message']);return _0x250311(_0x52dac0[_0xc6bf('0x10')][_0xc6bf('0x11')]);}else{logger[_0xc6bf('0xb')](_0xc6bf('0xc'),_0x47039a,_0xc6bf('0xd'));_0x250311(_0x52dac0[_0xc6bf('0x12')][_0xc6bf('0x11')]);}})['catch'](function(_0x23498a){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x47039a,_0x23498a);_0x3b2815(_0x23498a);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index b05478a..093a3d7 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 _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 +var _0x3ee4=['../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3ee4,0x13a));var _0x43ee=function(_0x2e751f,_0x2cfb6d){_0x2e751f=_0x2e751f-0x0;var _0x2ec570=_0x3ee4[_0x2e751f];return _0x2ec570;};'use strict';var multer=require(_0x43ee('0x0'));var util=require('util');var path=require(_0x43ee('0x1'));var timeout=require(_0x43ee('0x2'));var express=require('express');var router=express[_0x43ee('0x3')]();var auth=require(_0x43ee('0x4'));var interaction=require(_0x43ee('0x5'));var config=require(_0x43ee('0x6'));var controller=require(_0x43ee('0x7'));router[_0x43ee('0x8')]('/',auth[_0x43ee('0x9')](),controller[_0x43ee('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 073f222..2488c03 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 _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 +var _0xe94b=['exports','TEXT','STRING'];(function(_0x152aa1,_0x307718){var _0x1bc01a=function(_0xd3211e){while(--_0xd3211e){_0x152aa1['push'](_0x152aa1['shift']());}};_0x1bc01a(++_0x307718);}(_0xe94b,0xea));var _0xbe94=function(_0x2e4a0f,_0x244837){_0x2e4a0f=_0x2e4a0f-0x0;var _0xea8d39=_0xe94b[_0x2e4a0f];return _0xea8d39;};'use strict';var Sequelize=require('sequelize');module[_0xbe94('0x0')]={'body':{'type':Sequelize[_0xbe94('0x1')]},'senderName':{'type':Sequelize[_0xbe94('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xbe94('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 61c0744..bd5aa1e 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 _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 +var _0x4d46=['hasOwnProperty','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','sequelize','transaction','UserNotification','forEach','recipient','emit','userNotification:send','catch','Template','findOne','startCase','model','union','ids','queue','push','all','flatten','getAgents','map','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','json','count','offset','limit','status','set','Content-Range','apply','reject','then','destroy','sendStatus','name','send','sendUserNotification','body','text'];(function(_0x5469d3,_0x56f223){var _0x30ab7e=function(_0x21231a){while(--_0x21231a){_0x5469d3['push'](_0x5469d3['shift']());}};_0x30ab7e(++_0x56f223);}(_0x4d46,0x1ad));var _0x64d4=function(_0xc498b3,_0x5610b4){_0xc498b3=_0xc498b3-0x0;var _0x1e2530=_0x4d46[_0xc498b3];return _0x1e2530;};'use strict';var pdf=require(_0x64d4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x64d4('0x1'));var zipdir=require(_0x64d4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x64d4('0x3'));var moment=require(_0x64d4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x64d4('0x5'));var util=require(_0x64d4('0x6'));var path=require(_0x64d4('0x7'));var sox=require(_0x64d4('0x8'));var csv=require(_0x64d4('0x9'));var ejs=require(_0x64d4('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x64d4('0xb'));var jsforce=require(_0x64d4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x64d4('0xd'));var Papa=require('papaparse');var Redis=require(_0x64d4('0xe'));var authService=require(_0x64d4('0xf'));var qs=require(_0x64d4('0x10'));var as=require(_0x64d4('0x11'));var hardwareService=require(_0x64d4('0x12'));var logger=require(_0x64d4('0x13'))(_0x64d4('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x64d4('0x15'));var db=require(_0x64d4('0x16'))['db'];config[_0x64d4('0x17')]=_[_0x64d4('0x18')](config['redis'],{'host':_0x64d4('0x19'),'port':0x18eb});var socket=require(_0x64d4('0x1a'))(new Redis(config[_0x64d4('0x17')]));require(_0x64d4('0x1b'))[_0x64d4('0x1c')](socket);function respondWithStatusCode(_0x19d2dd,_0x28f031){_0x28f031=_0x28f031||0xcc;return function(_0x41006e){if(_0x41006e){return _0x19d2dd['sendStatus'](_0x28f031);}return _0x19d2dd['status'](_0x28f031)['end']();};}function respondWithResult(_0x2de70a,_0x3bae9d){_0x3bae9d=_0x3bae9d||0xc8;return function(_0x43eae0){if(_0x43eae0){return _0x2de70a['status'](_0x3bae9d)[_0x64d4('0x1d')](_0x43eae0);}};}function respondWithFilteredResult(_0xf14e98,_0x23657f){return function(_0x69abef){if(_0x69abef){var _0x512390=_0x69abef[_0x64d4('0x1e')],_0x13b627=_0x23657f[_0x64d4('0x1f')],_0x2b4ded=_0x23657f[_0x64d4('0x1f')]+_0x23657f[_0x64d4('0x20')],_0x51cda5;if(_0x2b4ded>=_0x512390){_0x2b4ded=_0x512390;_0x51cda5=0xc8;}else{_0x51cda5=0xce;}_0xf14e98[_0x64d4('0x21')](_0x51cda5);return _0xf14e98[_0x64d4('0x22')](_0x64d4('0x23'),_0x13b627+'-'+_0x2b4ded+'/'+_0x512390)[_0x64d4('0x1d')](_0x69abef);}return null;};}function patchUpdates(_0x4d1f7d){return function(_0xd9dd17){try{jsonpatch[_0x64d4('0x24')](_0xd9dd17,_0x4d1f7d,!![]);}catch(_0x3f60f4){return BPromise[_0x64d4('0x25')](_0x3f60f4);}return _0xd9dd17['save']();};}function saveUpdates(_0x5b5fbe,_0x1f4ded){return function(_0xf74809){if(_0xf74809){return _0xf74809['update'](_0x5b5fbe)[_0x64d4('0x26')](function(_0x5586af){return _0x5586af;});}return null;};}function removeEntity(_0xa22c59,_0x2de663){return function(_0x23d26e){if(_0x23d26e){return _0x23d26e[_0x64d4('0x27')]()[_0x64d4('0x26')](function(){_0xa22c59['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40b984,_0x466d33){return function(_0x696241){if(!_0x696241){_0x40b984[_0x64d4('0x28')](0x194);}return _0x696241;};}function handleError(_0x2b9b0b,_0x4843d2){_0x4843d2=_0x4843d2||0x1f4;return function(_0x224e53){logger['error'](_0x224e53['stack']);if(_0x224e53[_0x64d4('0x29')]){delete _0x224e53[_0x64d4('0x29')];}_0x2b9b0b['status'](_0x4843d2)[_0x64d4('0x2a')](_0x224e53);};}exports[_0x64d4('0x2b')]=function(_0x476446,_0x50c101,_0x2309b9){if(!_0x476446[_0x64d4('0x2c')]['hasOwnProperty'](_0x64d4('0x2d'))&&!_0x476446[_0x64d4('0x2c')][_0x64d4('0x2e')](_0x64d4('0x2f'))){throw new db[(_0x64d4('0x30'))][(_0x64d4('0x31'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x476446[_0x64d4('0x2c')][_0x64d4('0x2e')](_0x64d4('0x2f'))&&!_0x476446[_0x64d4('0x2c')]['hasOwnProperty'](_0x64d4('0x32'))){throw new db[(_0x64d4('0x30'))][(_0x64d4('0x31'))](_0x64d4('0x33'));}if(!_0x476446[_0x64d4('0x2c')][_0x64d4('0x2e')]('recipients')){throw new db[(_0x64d4('0x30'))]['ValidationError'](_0x64d4('0x34'));}else{try{var _0x37f2b8=JSON[_0x64d4('0x35')](_0x476446['body'][_0x64d4('0x36')]);}catch(_0x1edb8d){logger[_0x64d4('0x37')](_0x1edb8d);throw new db[(_0x64d4('0x30'))]['ValidationError'](_0x64d4('0x38'));}var _0x3885dc=[_0x64d4('0x39'),_0x64d4('0x3a'),'mailqueue',_0x64d4('0x3b'),_0x64d4('0x3c'),_0x64d4('0x3d'),_0x64d4('0x3e'),_0x64d4('0x3f'),_0x64d4('0x40')];if(_[_0x64d4('0x41')](_0x37f2b8,function(_0x443c67){return!_[_0x64d4('0x42')](_0x3885dc,_0x443c67['model']['toLowerCase']());})){throw new db[(_0x64d4('0x30'))][(_0x64d4('0x31'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x3d36dc={};_0x3d36dc['senderName']=_0x476446[_0x64d4('0x2c')][_0x64d4('0x2e')](_0x64d4('0x43'))?_0x476446[_0x64d4('0x2c')][_0x64d4('0x43')]:_0x476446[_0x64d4('0x40')][_0x64d4('0x44')];_0x3d36dc[_0x64d4('0x45')]=_[_0x64d4('0x46')](_0x476446[_0x64d4('0x2c')][_0x64d4('0x45')])?null:_0x476446[_0x64d4('0x2c')]['recipientsDescription'];_0x3d36dc[_0x64d4('0x47')]=_0x476446[_0x64d4('0x2c')][_0x64d4('0x47')]||![];_0x3d36dc['SenderId']=_0x476446[_0x64d4('0x40')]['id'];return getContent(_0x476446[_0x64d4('0x2c')])['then'](function(_0x5cd56f){_0x3d36dc[_0x64d4('0x2c')]=_0x5cd56f;return getRecipients(_0x37f2b8);})[_0x64d4('0x26')](function(_0x38e1cf){_0x3d36dc[_0x64d4('0x48')]=_[_0x64d4('0x49')](_0x38e1cf)[_0x64d4('0x4a')](',');return db[_0x64d4('0x4b')][_0x64d4('0x4c')](function(_0x13ddcc){return db[_0x64d4('0x4d')]['create'](_0x3d36dc,{'raw':!![],'transaction':_0x13ddcc})[_0x64d4('0x26')](function(_0x1cc84e){var _0x3d8851={'sender':_0x3d36dc['senderName'],'description':_0x3d36dc[_0x64d4('0x45')],'content':_0x3d36dc[_0x64d4('0x2c')],'beep':_0x3d36dc[_0x64d4('0x47')]};_0x38e1cf[_0x64d4('0x4e')](function(_0x190854){_0x3d8851[_0x64d4('0x4f')]=_0x190854;socket[_0x64d4('0x50')](_0x64d4('0x51'),_0x3d8851);});return _0x1cc84e;});});})[_0x64d4('0x26')](respondWithResult(_0x50c101,0xc9))[_0x64d4('0x52')](handleError(_0x50c101,null));};function getContent(_0x41e0a8){return new BPromise(function(_0x27d00a,_0x479e7b){if(_0x41e0a8['text']){_0x27d00a(_0x41e0a8[_0x64d4('0x2d')]);return;}return db[_0x64d4('0x53')][_0x64d4('0x54')]({'attributes':['html'],'where':{'id':_0x41e0a8[_0x64d4('0x2f')]},'raw':!![]})[_0x64d4('0x26')](function(_0x556bb1){if(!_0x556bb1)throw new db['Sequelize'][(_0x64d4('0x31'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x205c48=Mustache['render'](_0x556bb1['html'],_0x41e0a8[_0x64d4('0x32')]);_0x27d00a(_0x205c48);})['catch'](function(_0x3dac1f){_0x479e7b(_0x3dac1f);});});}function getRecipients(_0x305458){return new BPromise(function(_0x50c65e,_0x348356){var _0xcbc33a=[];var _0x955cac=[];_0x305458['forEach'](function(_0x5c7c9){var _0x5d690f=_[_0x64d4('0x55')](_0x5c7c9[_0x64d4('0x56')]['toLowerCase']());if(_0x5d690f==='User'){_0xcbc33a=_[_0x64d4('0x57')](_0xcbc33a,_0x5c7c9[_0x64d4('0x58')]);}else{if(_[_0x64d4('0x42')](_0x5d690f,_0x64d4('0x59')))_0x5d690f=_0x5d690f['replace'](_0x64d4('0x59'),'Queue');_0x5c7c9['ids'][_0x64d4('0x4e')](function(_0xd75953){_0x955cac[_0x64d4('0x5a')](getAgents(_0x5d690f,_0xd75953));});}});return BPromise[_0x64d4('0x5b')](_0x955cac)[_0x64d4('0x26')](function(_0x203192){_0xcbc33a=_[_0x64d4('0x57')](_0xcbc33a,_[_0x64d4('0x5c')](_0x203192));_0x50c65e(_0xcbc33a);})[_0x64d4('0x52')](function(_0x4b1b31){_0x348356(_0x4b1b31);});});}function getAgents(_0x5aab5c,_0x915569){return new BPromise(function(_0x5c2fea,_0x36dff4){return db[_0x5aab5c][_0x64d4('0x54')]({'where':{'id':_0x915569}})['then'](function(_0xc8885d){return _0xc8885d[_0x64d4('0x5d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3072c5){var _0x2bebd7=_[_0x64d4('0x5e')](_0x3072c5,'id');_0x5c2fea(_0x2bebd7);});})[_0x64d4('0x52')](function(_0x9c21df){_0x36dff4(_0x9c21df);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index b283836..500b0bb 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 _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 +var _0x0fda=['hook','exports','events','UserNotification','setMaxListeners','save','update','remove','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x10dff0,_0x59de15){_0x10dff0=_0x10dff0-0x0;var _0x2f7d89=_0x0fda[_0x10dff0];return _0x2f7d89;};'use strict';var EventEmitter=require(_0xa0fd('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xa0fd('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xa0fd('0x2')](0x0);var events={'afterCreate':_0xa0fd('0x3'),'afterUpdate':_0xa0fd('0x4'),'afterDestroy':_0xa0fd('0x5')};function emitEvent(_0xd8e73a){return function(_0x13c734,_0x574fca,_0x4978fa){UserNotificationEvents[_0xa0fd('0x6')](_0xd8e73a+':'+_0x13c734['id'],_0x13c734);UserNotificationEvents['emit'](_0xd8e73a,_0x13c734);_0x4978fa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xa0fd('0x7')](e,emitEvent(event));}}module[_0xa0fd('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 9dc30be..44f4102 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 _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 +var _0x4fc2=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./userNotification.attributes','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x1691ad,_0x1cf04c){var _0x50cfc6=function(_0x304a29){while(--_0x304a29){_0x1691ad['push'](_0x1691ad['shift']());}};_0x50cfc6(++_0x1cf04c);}(_0x4fc2,0x111));var _0x24fc=function(_0x2f75ce,_0x229bf4){_0x2f75ce=_0x2f75ce-0x0;var _0x5f1f2d=_0x4fc2[_0x2f75ce];return _0x5f1f2d;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require('moment');var BPromise=require(_0x24fc('0x4'));var rp=require(_0x24fc('0x5'));var fs=require('fs');var path=require(_0x24fc('0x6'));var rimraf=require('rimraf');var config=require(_0x24fc('0x7'));var attributes=require(_0x24fc('0x8'));module['exports']=function(_0x26fcc6,_0x12d602){return _0x26fcc6['define'](_0x24fc('0x9'),attributes,{'tableName':_0x24fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x24fc('0xb'),'collate':_0x24fc('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 808c6db..7ec6cb3 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 _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 +var _0x2efb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird'];(function(_0x438adb,_0x4e56f4){var _0x13a473=function(_0x51ac3e){while(--_0x51ac3e){_0x438adb['push'](_0x438adb['shift']());}};_0x13a473(++_0x4e56f4);}(_0x2efb,0x102));var _0xb2ef=function(_0x3452e4,_0x18f3f0){_0x3452e4=_0x3452e4-0x0;var _0x4f62b5=_0x2efb[_0x3452e4];return _0x4f62b5;};'use strict';var _=require(_0xb2ef('0x0'));var util=require('util');var moment=require(_0xb2ef('0x1'));var BPromise=require(_0xb2ef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2ef('0x3'));var db=require(_0xb2ef('0x4'))['db'];var utils=require(_0xb2ef('0x5'));var logger=require(_0xb2ef('0x6'))(_0xb2ef('0x7'));var config=require(_0xb2ef('0x8'));var jayson=require(_0xb2ef('0x9'));var client=jayson[_0xb2ef('0xa')][_0xb2ef('0xb')]({'port':0x232a});config['redis']=_[_0xb2ef('0xc')](config[_0xb2ef('0xd')],{'host':_0xb2ef('0xe'),'port':0x18eb});var socket=require(_0xb2ef('0xf'))(new Redis(config[_0xb2ef('0xd')]));require('./userNotification.socket')[_0xb2ef('0x10')](socket);function respondWithRpcPromise(_0x11e654,_0x3eb071,_0x468589){return new BPromise(function(_0x368e0c,_0x1e3977){return client[_0xb2ef('0x11')](_0x11e654,_0x468589)[_0xb2ef('0x12')](function(_0x193be9){logger[_0xb2ef('0x13')](_0xb2ef('0x14'),_0x3eb071,_0xb2ef('0x15'));logger[_0xb2ef('0x16')](_0xb2ef('0x17'),_0x3eb071,_0xb2ef('0x15'),JSON[_0xb2ef('0x18')](_0x193be9));if(_0x193be9[_0xb2ef('0x19')]){if(_0x193be9[_0xb2ef('0x19')]['code']===0x1f4){logger[_0xb2ef('0x19')](_0xb2ef('0x14'),_0x3eb071,_0x193be9[_0xb2ef('0x19')][_0xb2ef('0x1a')]);return _0x1e3977(_0x193be9['error'][_0xb2ef('0x1a')]);}logger[_0xb2ef('0x19')](_0xb2ef('0x14'),_0x3eb071,_0x193be9[_0xb2ef('0x19')][_0xb2ef('0x1a')]);return _0x368e0c(_0x193be9[_0xb2ef('0x19')]['message']);}else{logger[_0xb2ef('0x13')](_0xb2ef('0x14'),_0x3eb071,_0xb2ef('0x15'));_0x368e0c(_0x193be9[_0xb2ef('0x1b')]['message']);}})[_0xb2ef('0x1c')](function(_0x2031b5){logger[_0xb2ef('0x19')](_0xb2ef('0x14'),_0x3eb071,_0x2031b5);_0x1e3977(_0x2031b5);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index b768b69..1232731 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 _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 +var _0x2e65=['remove','update','emit','removeListener','register','length','userNotification:','./userNotification.events','save'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x2e65,0x193));var _0x52e6=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0x2e65[_0x557fd2];return _0x1b54a2;};'use strict';var UserNotificationEvents=require(_0x52e6('0x0'));var events=[_0x52e6('0x1'),_0x52e6('0x2'),_0x52e6('0x3')];function createListener(_0xd7e693,_0x23aa21){return function(_0x1ab739){_0x23aa21[_0x52e6('0x4')](_0xd7e693,_0x1ab739);};}function removeListener(_0x47912f,_0x383919){return function(){UserNotificationEvents[_0x52e6('0x5')](_0x47912f,_0x383919);};}exports[_0x52e6('0x6')]=function(_0xe67caa){for(var _0x1cf6d2=0x0,_0x116651=events[_0x52e6('0x7')];_0x1cf6d2<_0x116651;_0x1cf6d2++){var _0x1401a3=events[_0x1cf6d2];var _0x27f270=createListener(_0x52e6('0x8')+_0x1401a3,_0xe67caa);UserNotificationEvents['on'](_0x1401a3,_0x27f270);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 54ebc08..a5436fb 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 _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 +var _0x89d8=['../../config/environment','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x14a34f,_0x250eec){var _0x32676c=function(_0x414e9e){while(--_0x414e9e){_0x14a34f['push'](_0x14a34f['shift']());}};_0x32676c(++_0x250eec);}(_0x89d8,0xfd));var _0x889d=function(_0x42be6a,_0xd81fd8){_0x42be6a=_0x42be6a-0x0;var _0x2d8d9d=_0x89d8[_0x42be6a];return _0x2d8d9d;};'use strict';var multer=require(_0x889d('0x0'));var util=require('util');var path=require(_0x889d('0x1'));var timeout=require(_0x889d('0x2'));var express=require(_0x889d('0x3'));var router=express['Router']();var auth=require(_0x889d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x889d('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 5548a30..5fa2696 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(_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 +var _0xd8b0=['exports','sequelize'];(function(_0x56ba8b,_0x5f0021){var _0x528ea2=function(_0x23fb86){while(--_0x23fb86){_0x56ba8b['push'](_0x56ba8b['shift']());}};_0x528ea2(++_0x5f0021);}(_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/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index f0d4579..1aa9e83 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 _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 +var _0xefaa=['UserOpenchannelQueue','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define'];(function(_0x449941,_0x5b7094){var _0x316d93=function(_0x537431){while(--_0x537431){_0x449941['push'](_0x449941['shift']());}};_0x316d93(++_0x5b7094);}(_0xefaa,0x182));var _0xaefa=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xefaa[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xaefa('0x0'));var util=require(_0xaefa('0x1'));var logger=require(_0xaefa('0x2'))(_0xaefa('0x3'));var moment=require(_0xaefa('0x4'));var BPromise=require('bluebird');var rp=require(_0xaefa('0x5'));var fs=require('fs');var path=require(_0xaefa('0x6'));var rimraf=require(_0xaefa('0x7'));var config=require('../../config/environment');var attributes=require('./userOpenchannelQueue.attributes');module[_0xaefa('0x8')]=function(_0x125164,_0x56a3e5){return _0x125164[_0xaefa('0x9')](_0xaefa('0xa'),attributes,{'tableName':'user_has_openchannel_queues','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 b667030..2ba0512 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 _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 +var _0x8770=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x431bb3,_0x11954e){var _0x5b798c=function(_0x566bf1){while(--_0x566bf1){_0x431bb3['push'](_0x431bb3['shift']());}};_0x5b798c(++_0x11954e);}(_0x8770,0x122));var _0x0877=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8770[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0877('0x0'));var util=require(_0x0877('0x1'));var moment=require(_0x0877('0x2'));var BPromise=require(_0x0877('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0877('0x4'));var db=require(_0x0877('0x5'))['db'];var utils=require(_0x0877('0x6'));var logger=require(_0x0877('0x7'))(_0x0877('0x8'));var config=require(_0x0877('0x9'));var jayson=require(_0x0877('0xa'));var client=jayson[_0x0877('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f221f,_0x4e92f5,_0x3c03e5){return new BPromise(function(_0x4d400e,_0x198cf1){return client['request'](_0x4f221f,_0x3c03e5)[_0x0877('0xc')](function(_0x472635){logger[_0x0877('0xd')](_0x0877('0xe'),_0x4e92f5,_0x0877('0xf'));logger['debug'](_0x0877('0x10'),_0x4e92f5,'request\x20sent',JSON['stringify'](_0x472635));if(_0x472635[_0x0877('0x11')]){if(_0x472635[_0x0877('0x11')][_0x0877('0x12')]===0x1f4){logger[_0x0877('0x11')](_0x0877('0xe'),_0x4e92f5,_0x472635['error'][_0x0877('0x13')]);return _0x198cf1(_0x472635[_0x0877('0x11')][_0x0877('0x13')]);}logger['error'](_0x0877('0xe'),_0x4e92f5,_0x472635[_0x0877('0x11')][_0x0877('0x13')]);return _0x4d400e(_0x472635['error'][_0x0877('0x13')]);}else{logger['info'](_0x0877('0xe'),_0x4e92f5,'request\x20sent');_0x4d400e(_0x472635[_0x0877('0x14')][_0x0877('0x13')]);}})['catch'](function(_0x3ff8b8){logger[_0x0877('0x11')](_0x0877('0xe'),_0x4e92f5,_0x3ff8b8);_0x198cf1(_0x3ff8b8);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index f9f350e..4195ef8 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 _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 +var _0x0d9b=['/:id/resources','getResources','post','create','/:id/clone','clone','addSections','put','update','delete','destroy','removeSections','removeResources','exports','path','connect-timeout','express','Router','../../components/interaction/service','./userProfile.controller','isAuthenticated','index','/describe','/:id','get','/:id/sections','getSections'];(function(_0x22e59d,_0x4ebf38){var _0x34adaa=function(_0x25a717){while(--_0x25a717){_0x22e59d['push'](_0x22e59d['shift']());}};_0x34adaa(++_0x4ebf38);}(_0x0d9b,0x1d9));var _0xb0d9=function(_0x54d8d7,_0x446e6f){_0x54d8d7=_0x54d8d7-0x0;var _0x150af6=_0x0d9b[_0x54d8d7];return _0x150af6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb0d9('0x0'));var timeout=require(_0xb0d9('0x1'));var express=require(_0xb0d9('0x2'));var router=express[_0xb0d9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb0d9('0x4'));var config=require('../../config/environment');var controller=require(_0xb0d9('0x5'));router['get']('/',auth[_0xb0d9('0x6')](),controller[_0xb0d9('0x7')]);router['get'](_0xb0d9('0x8'),auth[_0xb0d9('0x6')](),controller['describe']);router['get'](_0xb0d9('0x9'),auth[_0xb0d9('0x6')](),controller['show']);router[_0xb0d9('0xa')](_0xb0d9('0xb'),auth[_0xb0d9('0x6')](),controller[_0xb0d9('0xc')]);router[_0xb0d9('0xa')](_0xb0d9('0xd'),auth[_0xb0d9('0x6')](),controller[_0xb0d9('0xe')]);router[_0xb0d9('0xf')]('/',auth[_0xb0d9('0x6')](),controller[_0xb0d9('0x10')]);router[_0xb0d9('0xf')](_0xb0d9('0x11'),auth[_0xb0d9('0x6')](),controller[_0xb0d9('0x12')]);router[_0xb0d9('0xf')](_0xb0d9('0xb'),auth[_0xb0d9('0x6')](),controller[_0xb0d9('0x13')]);router[_0xb0d9('0xf')](_0xb0d9('0xd'),auth[_0xb0d9('0x6')](),controller['addResources']);router[_0xb0d9('0x14')](_0xb0d9('0x9'),auth[_0xb0d9('0x6')](),controller[_0xb0d9('0x15')]);router[_0xb0d9('0x16')]('/:id',auth[_0xb0d9('0x6')](),controller[_0xb0d9('0x17')]);router[_0xb0d9('0x16')](_0xb0d9('0xb'),auth['isAuthenticated'](),controller[_0xb0d9('0x18')]);router[_0xb0d9('0x16')](_0xb0d9('0xd'),auth[_0xb0d9('0x6')](),controller[_0xb0d9('0x19')]);module[_0xb0d9('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index bdeef2a..3f18322 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 _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 +var _0xebd0=['sequelize','exports','STRING','setDataValue','crudPermissions','join','getDataValue'];(function(_0x10a230,_0x448917){var _0x5c78e2=function(_0x27584c){while(--_0x27584c){_0x10a230['push'](_0x10a230['shift']());}};_0x5c78e2(++_0x448917);}(_0xebd0,0x149));var _0x0ebd=function(_0x1dda20,_0x1edfa6){_0x1dda20=_0x1dda20-0x0;var _0x5259e2=_0xebd0[_0x1dda20];return _0x5259e2;};'use strict';var Sequelize=require(_0x0ebd('0x0'));module[_0x0ebd('0x1')]={'name':{'type':Sequelize[_0x0ebd('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x0ebd('0x2')],'set':function(_0x1c0a1c){this[_0x0ebd('0x3')](_0x0ebd('0x4'),_0x1c0a1c?_0x1c0a1c[_0x0ebd('0x5')](''):[]);},'get':function(){return this[_0x0ebd('0x6')]('crudPermissions')?this[_0x0ebd('0x6')](_0x0ebd('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0ebd('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 80e359f..683d323 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 _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 +var _0x8db0=['tag','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','projects','contacts','Lists','ListId','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','voicemails','VoiceMail','VoiceRecording','Agents','User','agent','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','users','agents','telephones','role','admin','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','Pause','Schedule','tags','templates','Template','triggers','Trigger','Trunk','variables','plugins','extractedreports','AnalyticMetric','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','UserProfile','includeAll','findAll','rows','catch','show','params','rawAttributes','include','clone','omit','updatedAt','crudPermissions','body','createdAt','transaction','UserProfileSection','autoAssociation','UserProfileResource','Resources','create','find','describe','addSections','sectionId','userProfileId','push','get','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','forEach','resourceId','addResources','sequelize','bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','mergeResources','childModel','parentSections','all','ignore','pick','type','field','foreignKey','associatedResources','AnalyticExtractedReport','reportType','default','reportId','DefaultReports','custom','CmContact','Tag','Tags','color'];(function(_0x4f1717,_0x4920b6){var _0x504f18=function(_0x5a3e85){while(--_0x5a3e85){_0x4f1717['push'](_0x4f1717['shift']());}};_0x504f18(++_0x4920b6);}(_0x8db0,0x65));var _0x08db=function(_0x3a0863,_0x4cd5ef){_0x3a0863=_0x3a0863-0x0;var _0x85c557=_0x8db0[_0x3a0863];return _0x85c557;};'use strict';var pdf=require(_0x08db('0x0'));var emlformat=require(_0x08db('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x08db('0x2'));var jsonpatch=require(_0x08db('0x3'));var rp=require(_0x08db('0x4'));var moment=require('moment');var BPromise=require(_0x08db('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x08db('0x6'));var csv=require('to-csv');var ejs=require(_0x08db('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x08db('0x8'));var crypto=require(_0x08db('0x9'));var jsforce=require(_0x08db('0xa'));var deskjs=require(_0x08db('0xb'));var toCsv=require(_0x08db('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x08db('0xd'));var authService=require(_0x08db('0xe'));var qs=require(_0x08db('0xf'));var as=require(_0x08db('0x10'));var hardwareService=require(_0x08db('0x11'));var logger=require(_0x08db('0x12'))(_0x08db('0x13'));var utils=require(_0x08db('0x14'));var config=require(_0x08db('0x15'));var licenseUtil=require(_0x08db('0x16'));var db=require(_0x08db('0x17'))['db'];config[_0x08db('0x18')]=_[_0x08db('0x19')](config[_0x08db('0x18')],{'host':_0x08db('0x1a'),'port':0x18eb});var socket=require(_0x08db('0x1b'))(new Redis(config[_0x08db('0x18')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x541875,_0x1e05f3){_0x1e05f3=_0x1e05f3||0xcc;return function(_0x291cb6){if(_0x291cb6){return _0x541875[_0x08db('0x1c')](_0x1e05f3);}return _0x541875[_0x08db('0x1d')](_0x1e05f3)['end']();};}function respondWithResult(_0x13345a,_0x4eb1b5){_0x4eb1b5=_0x4eb1b5||0xc8;return function(_0x6395dc){if(_0x6395dc){return _0x13345a['status'](_0x4eb1b5)[_0x08db('0x1e')](_0x6395dc);}};}function respondWithFilteredResult(_0x1b9169,_0x593622){return function(_0x2a2351){if(_0x2a2351){var _0x16ca71=_0x2a2351[_0x08db('0x1f')],_0x28ceca=_0x593622[_0x08db('0x20')],_0x4c9830=_0x593622[_0x08db('0x20')]+_0x593622[_0x08db('0x21')],_0x21c282;if(_0x4c9830>=_0x16ca71){_0x4c9830=_0x16ca71;_0x21c282=0xc8;}else{_0x21c282=0xce;}_0x1b9169[_0x08db('0x1d')](_0x21c282);return _0x1b9169[_0x08db('0x22')](_0x08db('0x23'),_0x28ceca+'-'+_0x4c9830+'/'+_0x16ca71)[_0x08db('0x1e')](_0x2a2351);}return null;};}function patchUpdates(_0x3bd1fd){return function(_0x5ebd36){try{jsonpatch[_0x08db('0x24')](_0x5ebd36,_0x3bd1fd,!![]);}catch(_0x1b9302){return BPromise[_0x08db('0x25')](_0x1b9302);}return _0x5ebd36[_0x08db('0x26')]();};}function saveUpdates(_0x5d8b35,_0x4ed886){return function(_0x5db163){if(_0x5db163){return _0x5db163[_0x08db('0x27')](_0x5d8b35)[_0x08db('0x28')](function(_0x504a12){return _0x504a12;});}return null;};}function removeEntity(_0x49b072,_0x51c2c4){return function(_0x4c638e){if(_0x4c638e){return _0x4c638e[_0x08db('0x29')]()[_0x08db('0x28')](function(){_0x49b072[_0x08db('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a7702,_0x3c22e){return function(_0x4de740){if(!_0x4de740){_0x4a7702['sendStatus'](0x194);}return _0x4de740;};}function handleError(_0x1e9446,_0x50d65b){_0x50d65b=_0x50d65b||0x1f4;return function(_0x14c47f){logger[_0x08db('0x2a')](_0x14c47f[_0x08db('0x2b')]);if(_0x14c47f[_0x08db('0x2c')]){delete _0x14c47f[_0x08db('0x2c')];}_0x1e9446[_0x08db('0x1d')](_0x50d65b)[_0x08db('0x2d')](_0x14c47f);};}exports['index']=function(_0x40e0d2,_0xa2f2b6){var _0x45d7d8={},_0x168d44={},_0x1146f7={'count':0x0,'rows':[]};var _0xb4ffdd=_['map'](db['UserProfile']['rawAttributes'],function(_0x379bee){return{'name':_0x379bee['fieldName'],'type':_0x379bee['type'][_0x08db('0x2e')]};});_0x168d44[_0x08db('0x2f')]=_[_0x08db('0x30')](_0xb4ffdd,_0x08db('0x2c'));_0x168d44[_0x08db('0x31')]=_[_0x08db('0x32')](_0x40e0d2['query']);_0x168d44[_0x08db('0x33')]=_[_0x08db('0x34')](_0x168d44['model'],_0x168d44[_0x08db('0x31')]);_0x45d7d8[_0x08db('0x35')]=_[_0x08db('0x34')](_0x168d44['model'],qs[_0x08db('0x36')](_0x40e0d2['query'][_0x08db('0x36')]));_0x45d7d8[_0x08db('0x35')]=_0x45d7d8[_0x08db('0x35')][_0x08db('0x37')]?_0x45d7d8[_0x08db('0x35')]:_0x168d44[_0x08db('0x2f')];if(!_0x40e0d2[_0x08db('0x31')][_0x08db('0x38')](_0x08db('0x39'))){_0x45d7d8[_0x08db('0x21')]=qs['limit'](_0x40e0d2['query'][_0x08db('0x21')]);_0x45d7d8[_0x08db('0x20')]=qs[_0x08db('0x20')](_0x40e0d2[_0x08db('0x31')]['offset']);}_0x45d7d8['order']=qs[_0x08db('0x3a')](_0x40e0d2['query'][_0x08db('0x3a')]);_0x45d7d8['where']=qs[_0x08db('0x33')](_['pick'](_0x40e0d2[_0x08db('0x31')],_0x168d44['filters']),_0xb4ffdd);if(_0x40e0d2[_0x08db('0x31')][_0x08db('0x3b')]){_0x45d7d8[_0x08db('0x3c')]=_[_0x08db('0x3d')](_0x45d7d8[_0x08db('0x3c')],{'$or':_[_0x08db('0x30')](_0xb4ffdd,function(_0x23aae4){if(_0x23aae4['type']!==_0x08db('0x3e')){var _0x4a82b9={};_0x4a82b9[_0x23aae4[_0x08db('0x2c')]]={'$like':'%'+_0x40e0d2['query'][_0x08db('0x3b')]+'%'};return _0x4a82b9;}})});}_0x45d7d8=_[_0x08db('0x3d')]({},_0x45d7d8,_0x40e0d2[_0x08db('0x3f')]);var _0x12a13f={'where':_0x45d7d8[_0x08db('0x3c')]};return db[_0x08db('0x40')][_0x08db('0x1f')](_0x12a13f)[_0x08db('0x28')](function(_0x4dfb94){_0x1146f7[_0x08db('0x1f')]=_0x4dfb94;if(_0x40e0d2['query'][_0x08db('0x41')]){_0x45d7d8['include']=[{'all':!![]}];}return db[_0x08db('0x40')][_0x08db('0x42')](_0x45d7d8);})[_0x08db('0x28')](function(_0xf03cdc){_0x1146f7[_0x08db('0x43')]=_0xf03cdc;return _0x1146f7;})[_0x08db('0x28')](respondWithFilteredResult(_0xa2f2b6,_0x45d7d8))[_0x08db('0x44')](handleError(_0xa2f2b6,null));};exports[_0x08db('0x45')]=function(_0x1dcbd0,_0x19dd5c){var _0x39f6b4={'raw':![],'where':{'id':_0x1dcbd0[_0x08db('0x46')]['id']}},_0x4573b1={};_0x4573b1['model']=_[_0x08db('0x32')](db[_0x08db('0x40')][_0x08db('0x47')]);_0x4573b1[_0x08db('0x31')]=_[_0x08db('0x32')](_0x1dcbd0[_0x08db('0x31')]);_0x4573b1[_0x08db('0x33')]=_[_0x08db('0x34')](_0x4573b1[_0x08db('0x2f')],_0x4573b1[_0x08db('0x31')]);_0x39f6b4['attributes']=_[_0x08db('0x34')](_0x4573b1[_0x08db('0x2f')],qs[_0x08db('0x36')](_0x1dcbd0[_0x08db('0x31')][_0x08db('0x36')]));_0x39f6b4[_0x08db('0x35')]=_0x39f6b4[_0x08db('0x35')]['length']?_0x39f6b4[_0x08db('0x35')]:_0x4573b1[_0x08db('0x2f')];if(_0x1dcbd0[_0x08db('0x31')][_0x08db('0x41')]){_0x39f6b4[_0x08db('0x48')]=[{'all':!![]}];}_0x39f6b4=_[_0x08db('0x3d')]({},_0x39f6b4,_0x1dcbd0[_0x08db('0x3f')]);return db[_0x08db('0x40')]['find'](_0x39f6b4)[_0x08db('0x28')](handleEntityNotFound(_0x19dd5c,null))['then'](respondWithResult(_0x19dd5c,null))[_0x08db('0x44')](handleError(_0x19dd5c,null));};exports['create']=function(_0x3355bd,_0x25a45c){return db['UserProfile']['create'](_0x3355bd['body'],{})[_0x08db('0x28')](respondWithResult(_0x25a45c,0xc9))[_0x08db('0x44')](handleError(_0x25a45c,null));};exports[_0x08db('0x49')]=function(_0x7f4eaa,_0x5eacca){var _0x13a52a={'where':{'id':_0x7f4eaa[_0x08db('0x46')]['id']}},_0x16f88c={};_0x16f88c[_0x08db('0x2f')]=_['keys'](db['UserProfile'][_0x08db('0x47')]);_0x13a52a[_0x08db('0x35')]=_[_0x08db('0x34')](_0x16f88c['model'],qs['fields'](_0x7f4eaa['query']['fields']));_0x13a52a[_0x08db('0x35')]=_0x13a52a[_0x08db('0x35')]['length']?_0x13a52a['attributes']:_0x16f88c[_0x08db('0x2f')];if(_0x7f4eaa[_0x08db('0x31')]['includeAll']){_0x13a52a[_0x08db('0x48')]=[{'all':!![]}];}_0x13a52a=_[_0x08db('0x3d')]({},_0x13a52a,_0x7f4eaa[_0x08db('0x3f')]);return db[_0x08db('0x40')]['find'](_0x13a52a)[_0x08db('0x28')](handleEntityNotFound(_0x5eacca,null))[_0x08db('0x28')](function(_0x42eaa1){if(_0x42eaa1){var _0x32fc2b=_0x42eaa1['get']({'plain':!![]});_0x32fc2b=qs[_0x08db('0x4a')](_0x32fc2b,['id','createdAt',_0x08db('0x4b'),_0x08db('0x4c')]);_0x7f4eaa['body']=_[_0x08db('0x4a')](_0x7f4eaa[_0x08db('0x4d')],['id',_0x08db('0x4e'),_0x08db('0x4b')]);return db['sequelize'][_0x08db('0x4f')](function(_0x1670da){return db[_0x08db('0x40')]['create'](_[_0x08db('0x3d')](_0x32fc2b,_0x7f4eaa[_0x08db('0x4d')]),{'include':_0x7f4eaa['query'][_0x08db('0x41')]?[{'all':!![]}]:undefined,'transaction':_0x1670da})[_0x08db('0x28')](function(_0x3f6060){var _0x497ed5=_0x3f6060['get']({'plain':!![]});return db[_0x08db('0x50')][_0x08db('0x42')]({'where':{'userProfileId':_0x7f4eaa[_0x08db('0x46')]['id']},'raw':!![]})[_0x08db('0x28')](function(_0x52a2e1){if(_0x52a2e1){return BPromise['each'](_0x52a2e1,function(_0x4deca1){return new BPromise(function(_0x36fc85,_0x573cf7){if(_0x4deca1['autoAssociation']===null||_0x4deca1[_0x08db('0x51')]===0x1)_0x36fc85(null);return db[_0x08db('0x52')][_0x08db('0x42')]({'where':{'sectionId':_0x4deca1['id']},'raw':!![]})[_0x08db('0x28')](function(_0x278074){var _0x54ba94=_[_0x08db('0x30')](_0x278074,function(_0x57f8e8){return qs['omit'](_0x57f8e8,['id',_0x08db('0x4e'),_0x08db('0x4b'),'sectionId']);});_0x36fc85(_0x54ba94);})[_0x08db('0x44')](function(_0x272ada){_0x573cf7(_0x272ada);});})[_0x08db('0x28')](function(_0x5742f5){var _0x52827f=qs[_0x08db('0x4a')](_0x4deca1,['id','createdAt','updatedAt']);_0x52827f['userProfileId']=_0x497ed5['id'];if(_0x5742f5)_0x52827f[_0x08db('0x53')]=_0x5742f5;return _0x52827f;})[_0x08db('0x28')](function(_0x4a03fa){return db[_0x08db('0x50')][_0x08db('0x54')](_0x4a03fa,{'include':[{'model':db[_0x08db('0x52')],'as':'Resources'}],'raw':!![],'transaction':_0x1670da});});})[_0x08db('0x28')](function(){return _0x497ed5;});}});});});}})['then'](respondWithResult(_0x5eacca,0xc9))[_0x08db('0x44')](handleError(_0x5eacca,null));};exports[_0x08db('0x27')]=function(_0x359bcb,_0x2c1594){if(_0x359bcb['body']['id']){delete _0x359bcb[_0x08db('0x4d')]['id'];}return db[_0x08db('0x40')]['find']({'where':{'id':_0x359bcb[_0x08db('0x46')]['id']}})[_0x08db('0x28')](handleEntityNotFound(_0x2c1594,null))[_0x08db('0x28')](saveUpdates(_0x359bcb[_0x08db('0x4d')],null))['then'](respondWithResult(_0x2c1594,null))[_0x08db('0x44')](handleError(_0x2c1594,null));};exports['destroy']=function(_0x3d0f39,_0x371990){return db['UserProfile'][_0x08db('0x55')]({'where':{'id':_0x3d0f39[_0x08db('0x46')]['id']}})['then'](handleEntityNotFound(_0x371990,null))[_0x08db('0x28')](removeEntity(_0x371990,null))[_0x08db('0x44')](handleError(_0x371990,null));};exports['describe']=function(_0x16e510,_0xcdd618){return db[_0x08db('0x40')][_0x08db('0x56')]()[_0x08db('0x28')](respondWithResult(_0xcdd618,null))['catch'](handleError(_0xcdd618,null));};exports[_0x08db('0x57')]=function(_0x10da8c,_0x13eb95){var _0x283494=_0x10da8c['body'];return db[_0x08db('0x40')][_0x08db('0x55')]({'where':{'id':_0x10da8c[_0x08db('0x46')]['id']}})[_0x08db('0x28')](handleEntityNotFound(_0x13eb95,null))[_0x08db('0x28')](function(_0x5bc09a){if(_0x5bc09a){return db['sequelize']['transaction'](function(_0x429a9b){return db[_0x08db('0x50')][_0x08db('0x29')]({'where':{'userProfileId':_0x10da8c[_0x08db('0x46')]['id'],'sectionId':_[_0x08db('0x30')](_0x283494,function(_0x431629){return _0x431629[_0x08db('0x58')];})},'transaction':_0x429a9b})[_0x08db('0x28')](function(){var _0x2a1d51=_[_0x08db('0x30')](_0x283494,function(_0x47cfcd){_0x47cfcd[_0x08db('0x59')]=_0x10da8c[_0x08db('0x46')]['id'];return _0x47cfcd;});var _0xe49619=[];return BPromise['each'](_0x2a1d51,function(_0x2fdedd){return db['UserProfileSection'][_0x08db('0x54')](_0x2fdedd,{'include':[{'model':db[_0x08db('0x52')],'as':_0x08db('0x53')}],'raw':!![],'transaction':_0x429a9b})[_0x08db('0x28')](function(_0x48a346){_0xe49619[_0x08db('0x5a')](_0x48a346[_0x08db('0x5b')]({'plain':!![]}));});})['then'](function(){return _0xe49619;});});});}})[_0x08db('0x28')](function(_0x29170b){return _0x29170b;})['then'](respondWithResult(_0x13eb95,null))[_0x08db('0x44')](handleError(_0x13eb95,null));};exports[_0x08db('0x5c')]=function(_0x782a05,_0x33057a){var _0x1285ce;return db['UserProfile'][_0x08db('0x55')]({'where':{'id':_0x782a05[_0x08db('0x46')]['id']},'attributes':['id','name']})[_0x08db('0x28')](handleEntityNotFound(_0x33057a,null))[_0x08db('0x28')](function(_0x35da23){if(_0x35da23){_0x1285ce=_0x35da23;return db[_0x08db('0x50')][_0x08db('0x29')]({'where':{'userProfileId':_0x782a05[_0x08db('0x46')]['id'],'sectionId':_0x782a05[_0x08db('0x31')][_0x08db('0x5d')]}});}})[_0x08db('0x28')](function(){return _0x1285ce;})[_0x08db('0x28')](respondWithStatusCode(_0x33057a,null))[_0x08db('0x44')](handleError(_0x33057a,null));};exports[_0x08db('0x5e')]=function(_0x583a4f,_0x3f5479){var _0x315d37=[];var _0x311356=[];return db[_0x08db('0x50')][_0x08db('0x42')]({'where':{'userProfileId':_0x583a4f[_0x08db('0x46')]['id']},'raw':!![]})[_0x08db('0x28')](function(_0x5d61cc){_0x315d37=_['filter'](_0x5d61cc,function(_0x36c9d3){return _0x36c9d3[_0x08db('0x5f')]===0x1||_[_0x08db('0x60')]([0x3eb,0x709],_0x36c9d3[_0x08db('0x58')]);});if(!_[_0x08db('0x61')](_0x315d37)){return _[_0x08db('0x30')](_0x315d37,function(_0x3fbb7e){return _0x3fbb7e[_0x08db('0x58')];});}else{return;}})['then'](function(_0x1061c1){if(_0x1061c1)_0x311356=_0x1061c1;if(_[_0x08db('0x60')](_0x311356,0x64)){var _0x5187c2=_[_0x08db('0x55')](_0x315d37,{'sectionId':0x64});return hasDefaultDashboard(_0x5187c2)['then'](function(_0xf78a9d){return _[_0x08db('0x30')](_0x315d37,function(_0x6d5b5){if(_0x6d5b5[_0x08db('0x58')]===0x64){_0x6d5b5[_0x08db('0x62')]=_0xf78a9d;}return _0x6d5b5;});});}else{return;}})[_0x08db('0x28')](function(_0x47aed0){if(_0x47aed0)_0x315d37=_0x47aed0;if(_['includes'](_0x311356,0x3eb)){var _0x386bbb=_[_0x08db('0x55')](_0x315d37,{'sectionId':0x3eb});return getCustomDashboards(_0x386bbb)[_0x08db('0x28')](function(_0x1114a9){return _[_0x08db('0x30')](_0x315d37,function(_0x367d3d){if(_0x386bbb['enabled']){if(_0x367d3d[_0x08db('0x58')]===0x3eb){_0x367d3d['subsections']=_0x1114a9;}}else{if(_0x367d3d[_0x08db('0x58')]===0x64){_0x367d3d['subsections']=_0x1114a9;}}return _0x367d3d;});});}else{return;}})[_0x08db('0x28')](function(_0x389e6c){if(_0x389e6c)_0x315d37=_0x389e6c;if(_[_0x08db('0x60')](_0x311356,0x709)){var _0x37cc75=_['find'](_0x315d37,{'sectionId':0x709});return getPlugins(_0x37cc75)['then'](function(_0x518bfc){if(_0x37cc75[_0x08db('0x5f')]){return _[_0x08db('0x30')](_0x315d37,function(_0x2c5354){if(_0x2c5354[_0x08db('0x58')]===0x709){_0x2c5354[_0x08db('0x62')]=_0x518bfc;}return _0x2c5354;});}else{var _0x48ba4d={'sectionId':0x76c,'enabled':0x1,'subsections':_0x518bfc};var _0x3b484e=_[_0x08db('0x30')](_0x315d37);_0x3b484e['push'](_0x48ba4d);return _0x3b484e;}});}else{return;}})['then'](function(_0x36435a){if(_0x36435a)_0x315d37=_0x36435a;return _['filter'](_0x315d37,[_0x08db('0x5f'),0x1]);})[_0x08db('0x28')](respondWithResult(_0x3f5479,null))['catch'](handleError(_0x3f5479,null));};function hasDefaultDashboard(_0x5de081){var _0x36661d=[0x65];return new BPromise(function(_0x2ecd70,_0x5704ab){try{if(_0x5de081[_0x08db('0x51')]){_0x2ecd70(_0x36661d);}else{return db[_0x08db('0x52')][_0x08db('0x63')]({'where':{'sectionId':_0x5de081['id']},'raw':!![]})[_0x08db('0x28')](function(_0x1f66e1){_0x1f66e1?_0x2ecd70(_0x36661d):_0x2ecd70();});}}catch(_0x269d68){_0x5704ab(_0x269d68);}});}function getCustomDashboards(_0x199974){var _0x12584d=[];return new BPromise(function(_0x23ab99,_0x47f260){try{if(_0x199974[_0x08db('0x51')]){return db['Dashboard']['findAll']({'raw':!![]})['then'](function(_0x41593a){_0x41593a[_0x08db('0x64')](function(_0x4cd74d){_0x12584d[_0x08db('0x5a')](_0x4cd74d['id']+0x1869f);});_0x23ab99(_0x12584d);});}else{return db[_0x08db('0x52')][_0x08db('0x42')]({'where':{'sectionId':_0x199974['id']},'raw':!![]})['then'](function(_0x56a8e9){_0x56a8e9['forEach'](function(_0x14dfc2){_0x12584d[_0x08db('0x5a')](_0x14dfc2['resourceId']+0x1869f);});_0x23ab99(_0x12584d);});}}catch(_0x42ccff){_0x47f260(_0x42ccff);}});}function getPlugins(_0x22af97){var _0xa51c8c=[];return new BPromise(function(_0x1798a8,_0xc68fa8){try{if(_0x22af97[_0x08db('0x51')]){return db['Plugin'][_0x08db('0x42')]({'raw':!![]})[_0x08db('0x28')](function(_0x234ef9){_0x234ef9[_0x08db('0x64')](function(_0x3e7d86){_0xa51c8c['push'](_0x3e7d86['id']+0x15b38);});_0x1798a8(_0xa51c8c);});}else{return db[_0x08db('0x52')]['findAll']({'where':{'sectionId':_0x22af97['id']},'raw':!![]})[_0x08db('0x28')](function(_0x249a68){_0x249a68['forEach'](function(_0x1743f1){_0xa51c8c[_0x08db('0x5a')](_0x1743f1[_0x08db('0x65')]+0x15b38);});_0x1798a8(_0xa51c8c);});}}catch(_0xeab13c){_0xc68fa8(_0xeab13c);}});}exports[_0x08db('0x66')]=function(_0x40084b,_0x37ec22){return db[_0x08db('0x40')][_0x08db('0x55')]({'where':{'id':_0x40084b['params']['id']}})['then'](handleEntityNotFound(_0x37ec22,null))['then'](function(_0x3189d2){if(_0x3189d2){return db[_0x08db('0x67')][_0x08db('0x4f')](function(_0x4d9ee0){return db[_0x08db('0x50')]['findAll']({'where':{'userProfileId':_0x40084b[_0x08db('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0x08db('0x28')](function(_0xf9d78a){if(_0xf9d78a){return db[_0x08db('0x50')]['destroy']({'where':{'userProfileId':_0x40084b[_0x08db('0x46')]['id'],'id':_[_0x08db('0x30')](_0xf9d78a,function(_0x38929b){return _0x38929b['id'];})},'transaction':_0x4d9ee0});}})[_0x08db('0x28')](function(_0x471f8a){var _0x20b030=_[_0x08db('0x30')](_0x40084b['body'],function(_0x5d7f5d){_0x5d7f5d['userProfileId']=_0x40084b[_0x08db('0x46')]['id'];return _0x5d7f5d;});return db['UserProfileSection'][_0x08db('0x68')](_0x20b030,{'raw':!![],'transaction':_0x4d9ee0});})[_0x08db('0x28')](function(_0x34df58){var _0x28e822=_['filter'](_[_0x08db('0x30')](_0x34df58,function(_0x3d469e){return _0x3d469e[_0x08db('0x5b')]({'plain':!![]});}),{'includeAll':![]});if(_0x28e822){return db[_0x08db('0x50')][_0x08db('0x42')]({'where':{'userProfileId':_0x40084b[_0x08db('0x46')]['id'],'sectionId':_[_0x08db('0x30')](_0x28e822,function(_0x1be5d8){return _0x1be5d8[_0x08db('0x58')];})},'attributes':['id',_0x08db('0x58')],'raw':!![]})['then'](function(_0x4b7acf){var _0x539be0=_[_0x08db('0x30')](_0x40084b[_0x08db('0x4d')],function(_0x12023b){_0x12023b[_0x08db('0x59')]=_0x40084b[_0x08db('0x46')]['id'];return _0x12023b;});return db[_0x08db('0x52')][_0x08db('0x68')](_0x539be0,{'raw':!![],'transaction':_0x4d9ee0});});}})['catch'](handleError(_0x37ec22,null));});}})[_0x08db('0x28')](function(_0x3cdc83){var _0x42d2a7=_[_0x08db('0x30')](_0x3cdc83,function(_0x2e1630){return _0x2e1630[_0x08db('0x5b')]({'plain':!![]});});})[_0x08db('0x28')](respondWithResult(_0x37ec22,null))[_0x08db('0x44')](handleError(_0x37ec22,null));};exports[_0x08db('0x69')]=function(_0x4e4795,_0x185af0,_0x54f4f3){return db[_0x08db('0x40')][_0x08db('0x55')]({'where':{'id':_0x4e4795[_0x08db('0x46')]['id']}})['then'](handleEntityNotFound(_0x185af0,null))[_0x08db('0x28')](function(_0x395ff5){if(_0x395ff5){return _0x395ff5[_0x08db('0x69')](_0x4e4795[_0x08db('0x31')][_0x08db('0x5d')]);}})['then'](respondWithStatusCode(_0x185af0,null))['catch'](handleError(_0x185af0,null));};exports[_0x08db('0x6a')]=function(_0x5ec042,_0x16b350){var _0x5eb2ae={'raw':![],'where':{}};var _0x4aec68={};var _0x34d0b8={'count':0x0,'rows':[]};var _0x10543f=_0x5ec042[_0x08db('0x31')][_0x08db('0x6b')];if(typeof _0x10543f===_0x08db('0x6c')){throw new db[(_0x08db('0x6d'))][(_0x08db('0x6e'))]('Unknown\x20section');}var _0x5e5a61=_0x5ec042[_0x08db('0x31')][_0x08db('0x6f')]||![];var _0x48b7b4=getQueryModels(_0x10543f,_0x5e5a61);if(typeof _0x48b7b4[_0x08db('0x70')]==='undefined'){throw new db[(_0x08db('0x6d'))][(_0x08db('0x6e'))]('Invalid\x20section\x20\x27'+_0x10543f+'\x27');}var _0x477da4=[];if(!_[_0x08db('0x61')](_0x48b7b4[_0x08db('0x71')])){_0x477da4=_0x48b7b4[_0x08db('0x71')];}else{_0x477da4=[{'name':_0x10543f}];}return db[_0x08db('0x40')][_0x08db('0x63')]({'where':{'id':_0x5ec042[_0x08db('0x46')]['id']}})[_0x08db('0x28')](handleEntityNotFound(_0x16b350,null))[_0x08db('0x28')](function(_0xe08d20){if(_0xe08d20){var _0x356d7d=[];for(var _0x52fe46=0x0;_0x52fe46<_0x477da4[_0x08db('0x37')];_0x52fe46++){_0x356d7d['push'](db[_0x08db('0x50')]['findOne']({'where':{'userProfileId':_0xe08d20['id'],'name':_0x477da4[_0x52fe46][_0x08db('0x2c')]},'raw':!![]}));}return BPromise[_0x08db('0x72')](_0x356d7d);}})[_0x08db('0x28')](function(_0x2a162a){var _0x170f43=_['filter'](_0x2a162a,function(_0x528aa9){return _0x528aa9?_0x528aa9:undefined;});var _0x33a9bf=_[_0x08db('0x3b')](_0x477da4,[_0x08db('0x73'),!![]]);var _0x1c324c=_[_0x08db('0x61')](_0x170f43)&&_['isEmpty'](_0x33a9bf)?null:_['union'](_0x33a9bf,_0x170f43);if(_0x1c324c){var _0x3fcb22=[];for(var _0x59631e=0x0;_0x59631e<_0x1c324c[_0x08db('0x37')];_0x59631e++){var _0x100a04=_[_0x08db('0x55')](_0x477da4,function(_0x37e165){return _0x1c324c[_0x59631e]?_0x37e165[_0x08db('0x2c')]===_0x1c324c[_0x59631e][_0x08db('0x2c')]:null;});if(_0x100a04){if(_0x1c324c[_0x59631e][_0x08db('0x73')]){_0x3fcb22['push'](getAllResources(_0x48b7b4[_0x08db('0x70')],_0x1c324c[_0x59631e]));}else{if(!_0x1c324c[_0x59631e][_0x08db('0x51')]){_0x3fcb22['push'](getAllowedResources(_0x100a04,_0x1c324c[_0x59631e],_0x48b7b4[_0x08db('0x70')]));}else{if(_0x100a04[_0x08db('0x2f')]){_0x3fcb22['push'](getAllFilteredResources(_0x100a04,_0x1c324c[_0x59631e]));}}}}}return BPromise[_0x08db('0x72')](_0x3fcb22);}else{return null;}})[_0x08db('0x28')](function(_0x4fe0f6){var _0xabe7ae=_0x4fe0f6;var _0x49e0b7=null;if(_0xabe7ae){_0x49e0b7=_0xabe7ae[_0x08db('0x37')]===0x1?_0xabe7ae[0x0]:null;}if(_0x49e0b7||_0xabe7ae){var _0x205205=db[_0x48b7b4[_0x08db('0x70')]][_0x08db('0x47')];_0x4aec68['model']=_[_0x08db('0x32')](_0x205205);_0x4aec68['query']=_[_0x08db('0x32')](_0x5ec042['query']);_0x4aec68[_0x08db('0x33')]=_[_0x08db('0x34')](_0x4aec68['model'],_0x4aec68['query']);_0x5eb2ae[_0x08db('0x35')]=_[_0x08db('0x34')](_0x4aec68[_0x08db('0x2f')],qs[_0x08db('0x36')](_0x5ec042[_0x08db('0x31')][_0x08db('0x36')]));_0x5eb2ae[_0x08db('0x35')]=_0x5eb2ae['attributes'][_0x08db('0x37')]?_0x5eb2ae[_0x08db('0x35')]:_0x4aec68[_0x08db('0x2f')];if(!_0x5ec042['query']['hasOwnProperty'](_0x08db('0x39'))){_0x5eb2ae[_0x08db('0x21')]=qs[_0x08db('0x21')](_0x5ec042['query']['limit']);_0x5eb2ae[_0x08db('0x20')]=qs['offset'](_0x5ec042['query'][_0x08db('0x20')]);}_0x5eb2ae['order']=qs[_0x08db('0x3a')](_0x5ec042['query'][_0x08db('0x3a')]);_0x5eb2ae['where']=qs[_0x08db('0x33')](_[_0x08db('0x74')](_0x5ec042[_0x08db('0x31')],_0x4aec68[_0x08db('0x33')]));if(_0x5ec042[_0x08db('0x31')][_0x08db('0x3b')]){_0x5eb2ae[_0x08db('0x3c')]=_[_0x08db('0x3d')](_0x5eb2ae[_0x08db('0x3c')],{'$or':_[_0x08db('0x30')](_0x205205,function(_0x10d135){if(_0x10d135[_0x08db('0x75')][_0x08db('0x2e')]!==_0x08db('0x3e')){var _0x45bfd9={};_0x45bfd9[_0x10d135['field']]={'$like':'%'+_0x5ec042[_0x08db('0x31')]['filter']+'%'};return _0x45bfd9;}})});}var _0x5b1337=[];if(_0x49e0b7){var _0x19efa5=_[_0x08db('0x55')](_0x477da4,['name',_0x49e0b7[_0x08db('0x2c')]]);if(_0x19efa5[_0x08db('0x76')]){var _0xed682d={};if(_0x48b7b4[_0x08db('0x70')]==='AnalyticExtractedReport'){_0xed682d[_0x19efa5[_0x08db('0x77')]]=_[_0x08db('0x30')](_0x49e0b7[_0x08db('0x78')],'id');}else{_0xed682d[_0x19efa5[_0x08db('0x77')]]=_0x49e0b7[_0x08db('0x78')];}_0x5b1337[_0x08db('0x5a')](_0xed682d);}else{_0x5eb2ae['where']['id']=_0x49e0b7[_0x08db('0x78')];}}else{for(var _0x3c70a7=0x0;_0x3c70a7<_0xabe7ae[_0x08db('0x37')];_0x3c70a7++){var _0x19efa5=_['find'](_0x477da4,['name',_0xabe7ae[_0x3c70a7][_0x08db('0x2c')]]);if(_0x19efa5['field']){var _0xed682d={};_0xed682d[_0x19efa5[_0x08db('0x77')]]=_0xabe7ae[_0x3c70a7][_0x08db('0x78')];_0x5b1337[_0x08db('0x5a')](_0xed682d);}else{if(!_0x5eb2ae['where']['id'])_0x5eb2ae[_0x08db('0x3c')]['id']=[];_0xabe7ae[_0x3c70a7][_0x08db('0x78')][_0x08db('0x64')](function(_0x3eefda){_0x5eb2ae[_0x08db('0x3c')]['id'][_0x08db('0x5a')](_0x3eefda);});}}}if(!_[_0x08db('0x61')](_0x5b1337)){_0x5eb2ae[_0x08db('0x3c')]=_[_0x08db('0x3d')](_0x5eb2ae['where'],{'$and':{'$or':_0x5b1337}});}_0x5eb2ae=_[_0x08db('0x3d')]({},_0x5eb2ae,_0x5ec042[_0x08db('0x3f')]);if(_0x49e0b7&&!_0x49e0b7[_0x08db('0x51')]&&_0x48b7b4[_0x08db('0x70')]===_0x08db('0x79')){if(_0x5ec042[_0x08db('0x31')][_0x08db('0x41')]){_0x5eb2ae[_0x08db('0x48')]=[{'all':!![]}];}return db[_0x48b7b4['childModel']]['findAll'](_0x5eb2ae)[_0x08db('0x28')](function(_0xabeebb){var _0x406dbb=[];_0xabeebb[_0x08db('0x64')](function(_0x151452){var _0xa036b7;switch(_0x151452[_0x08db('0x7a')]){case _0x08db('0x7b'):_0xa036b7=_[_0x08db('0x55')](_0x49e0b7[_0x08db('0x78')],function(_0x4698c3){return _0x4698c3['id']===_0x151452[_0x08db('0x7c')]&&_0x4698c3[_0x08db('0x75')]===_0x08db('0x7d');});break;case _0x08db('0x7e'):_0xa036b7=_[_0x08db('0x55')](_0x49e0b7[_0x08db('0x78')],function(_0x17d722){return _0x17d722['id']===_0x151452['reportId']&&_0x17d722[_0x08db('0x75')]==='CustomReports';});break;}if(_0xa036b7)_0x406dbb[_0x08db('0x5a')](_0x151452);});_0x34d0b8['count']=_0x406dbb['length'];_0x34d0b8[_0x08db('0x43')]=_0x406dbb;return _0x34d0b8;});}else{return db[_0x48b7b4[_0x08db('0x70')]][_0x08db('0x1f')]({'where':_0x5eb2ae[_0x08db('0x3c')]})[_0x08db('0x28')](function(_0x1831e9){_0x34d0b8[_0x08db('0x1f')]=_0x1831e9;if(_0x5ec042['query'][_0x08db('0x41')]){if(_0x48b7b4['childModel']===_0x08db('0x7f')){_0x5eb2ae[_0x08db('0x48')]=[{'model':db[_0x08db('0x80')],'as':_0x08db('0x81'),'attributes':['id',_0x08db('0x2c'),_0x08db('0x82')],'required':_0x5ec042[_0x08db('0x31')][_0x08db('0x83')]?!![]:![]},{'model':db['Tag'],'as':'ThroughTags','attributes':['id',_0x08db('0x2c'),_0x08db('0x82')],'through':_0x5ec042[_0x08db('0x31')][_0x08db('0x83')]?{'attributes':[],'where':{'TagId':_0x5ec042[_0x08db('0x31')]['tag']||undefined}}:{},'required':_0x5ec042['query'][_0x08db('0x83')]?!![]:![]}];}else{_0x5eb2ae[_0x08db('0x48')]=[{'all':!![]}];}}return db[_0x48b7b4[_0x08db('0x70')]][_0x08db('0x42')](_0x5eb2ae);})['then'](function(_0x5ba8dc){_0x34d0b8[_0x08db('0x43')]=_0x5ba8dc;return _0x34d0b8;});}}else{return _0x34d0b8;}})[_0x08db('0x28')](respondWithFilteredResult(_0x16b350,_0x5eb2ae))[_0x08db('0x44')](handleError(_0x16b350,null));};function getAllResources(_0xfc5e8e,_0x207344){return new BPromise(function(_0x4d2714,_0xbf404a){if(_0x207344){var _0x32bb4a=_0x207344[_0x08db('0x3b')]?{[_0x207344[_0x08db('0x3b')][_0x08db('0x76')]]:_0x207344[_0x08db('0x3b')][_0x08db('0x84')]}:undefined;return db[_0xfc5e8e]['findAll']({'where':_0x32bb4a,'raw':!![]})[_0x08db('0x28')](function(_0x8c614d){_0x207344['associatedResources']=_[_0x08db('0x30')](_0x8c614d,'id');_0x4d2714(_0x207344);})[_0x08db('0x44')](function(_0x20047e){_0xbf404a(_0x20047e);});}else{_0x4d2714(null);}});}function getAllFilteredResources(_0x11d4ed,_0x46c4f0){return new BPromise(function(_0x914074,_0x1eaf1a){var _0x1831da=_0x11d4ed['filter']?{[_0x11d4ed['filter'][_0x08db('0x76')]]:_0x11d4ed[_0x08db('0x3b')]['value']}:undefined;return db[_0x11d4ed[_0x08db('0x2f')]][_0x08db('0x42')]({'where':_0x1831da,'raw':!![]})[_0x08db('0x28')](function(_0x10f238){_0x46c4f0['associatedResources']=_[_0x08db('0x30')](_0x10f238,function(_0x138376){return _0x138376[_0x08db('0x2c')];});_0x914074(_0x46c4f0);})['catch'](function(_0x576b10){_0x1eaf1a(_0x576b10);});});}function getAllowedResources(_0x46e8e6,_0x144a4c,_0x4a062d){return new BPromise(function(_0x405800,_0x12ce88){if(_0x144a4c){return db[_0x08db('0x52')]['findAll']({'where':{'sectionId':_0x144a4c['id']},'raw':!![]})[_0x08db('0x28')](function(_0x90a872){if(_0x46e8e6[_0x08db('0x76')]&&_0x46e8e6[_0x08db('0x76')]!=='id'){_0x144a4c[_0x08db('0x78')]=_[_0x08db('0x30')](_0x90a872,function(_0x3fa99f){return _0x3fa99f[_0x46e8e6['field']];});}else{if(_0x4a062d===_0x08db('0x79')){_0x144a4c[_0x08db('0x78')]=_[_0x08db('0x30')](_0x90a872,function(_0x86f212){return{'id':_0x86f212[_0x08db('0x65')],'type':_0x86f212['type']};});}else{_0x144a4c['associatedResources']=_[_0x08db('0x30')](_0x90a872,function(_0x318b76){return _0x318b76[_0x08db('0x65')];});}}_0x405800(_0x144a4c);})[_0x08db('0x44')](function(_0x21a351){_0x12ce88(_0x21a351);});}else{_0x405800(null);}});}function getQueryModels(_0x5cda8d,_0x562f7f){var _0x251f66=_0x5cda8d[_0x08db('0x85')]();var _0x1d3c0e={'childModel':undefined,'parentSections':[]};switch(_0x251f66){case _0x08db('0x86'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0x87');break;case _0x08db('0x88'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0x89');break;case _0x08db('0x8a'):_0x1d3c0e[_0x08db('0x70')]='SquareRecording';_0x1d3c0e[_0x08db('0x71')]=[{'name':'SquareProjects','field':_0x08db('0x2c'),'foreignKey':'projectName'}];break;case _0x08db('0x8b'):_0x1d3c0e[_0x08db('0x70')]='JscriptyProject';break;case _0x08db('0x8c'):_0x1d3c0e['childModel']='CmContact';_0x1d3c0e['parentSections']=[{'name':_0x08db('0x8d'),'field':'id','foreignKey':_0x08db('0x8e')}];break;case'lists':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0x8f');break;case'companies':_0x1d3c0e['childModel']=_0x08db('0x90');break;case _0x08db('0x91'):_0x1d3c0e['childModel']=_0x08db('0x92');break;case _0x08db('0x93'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0x94');break;case _0x08db('0x95'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0x96');break;case _0x08db('0x97'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0x98');break;case _0x08db('0x99'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0x9a');break;case _0x08db('0x9b'):case'internalroutes':case _0x08db('0x9c'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0x9d');break;case'contexts':_0x1d3c0e[_0x08db('0x70')]='VoiceContext';break;case _0x08db('0x9e'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0x9f');break;case'voicerecordings':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xa0');_0x1d3c0e[_0x08db('0x71')]=[{'name':_0x08db('0xa1'),'field':_0x08db('0x2c'),'foreignKey':'membername','model':_0x08db('0xa2'),'filter':{'field':'role','value':[_0x08db('0xa3')]}},{'name':_0x08db('0xa4'),'field':_0x08db('0x2c'),'foreignKey':_0x08db('0xa5'),'model':_0x08db('0xa2'),'filter':{'field':'role','value':[_0x08db('0xa6')]}},{'name':_0x08db('0xa7'),'field':_0x08db('0x2c'),'foreignKey':_0x08db('0xa8'),'model':_0x08db('0xa9'),'filter':{'field':'type','value':[_0x08db('0xaa')]}},{'name':'QueueCampaigns','field':_0x08db('0x2c'),'foreignKey':_0x08db('0xa8'),'model':_0x08db('0xa9'),'filter':{'field':_0x08db('0x75'),'value':[_0x08db('0xab')]}}];break;case _0x08db('0xac'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xad');break;case _0x08db('0xae'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xaf');break;case'voiceprefixes':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xb0');break;case _0x08db('0xb1'):_0x1d3c0e['childModel']=_0x08db('0xb2');break;case'mailqueues':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xb3');break;case _0x08db('0xb4'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xb5');break;case _0x08db('0xb6'):_0x1d3c0e['childModel']=_0x08db('0xb7');break;case _0x08db('0xb8'):_0x1d3c0e['childModel']=_0x08db('0xb9');break;case _0x08db('0xba'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xbb');break;case'smsqueues':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xbc');break;case _0x08db('0xbd'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xbe');break;case _0x08db('0xbf'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xc0');break;case _0x08db('0xc1'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xc2');break;case _0x08db('0xc3'):_0x1d3c0e[_0x08db('0x70')]='Team';break;case _0x08db('0xc4'):case _0x08db('0xc5'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xa9');if(_0x562f7f){_0x1d3c0e[_0x08db('0x71')]=[{'name':_0x08db('0xa7')},{'name':'QueueCampaigns'}];}break;case _0x08db('0xc6'):case _0x08db('0xc7'):case _0x08db('0xc8'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xa2');if(_0x562f7f){_0x1d3c0e[_0x08db('0x71')]=[{'name':'Users','filter':{'field':_0x08db('0xc9'),'value':[_0x08db('0xca'),'user']},'ignore':!![]},{'name':_0x08db('0xa1')},{'name':_0x08db('0xa4')}];}break;case _0x08db('0xcb'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xcc');break;case'salesforceaccounts':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xcd');break;case _0x08db('0xce'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xcf');break;case _0x08db('0xd0'):_0x1d3c0e[_0x08db('0x70')]='SugarcrmAccount';break;case'deskaccounts':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xd1');break;case _0x08db('0xd2'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xd3');break;case'vtigeraccounts':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xa2');break;case _0x08db('0xd4'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xd5');break;case _0x08db('0xd6'):_0x1d3c0e['childModel']=_0x08db('0xd7');break;case _0x08db('0xd8'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xd9');break;case'intervals':_0x1d3c0e['childModel']=_0x08db('0xda');break;case _0x08db('0xdb'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xdc');break;case'scheduler':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xdd');break;case'sounds':_0x1d3c0e[_0x08db('0x70')]='Sound';break;case _0x08db('0xde'):_0x1d3c0e['childModel']=_0x08db('0x80');break;case _0x08db('0xdf'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xe0');break;case _0x08db('0xe1'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xe2');break;case'trunks':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xe3');break;case _0x08db('0xe4'):_0x1d3c0e['childModel']='Variable';break;case _0x08db('0xe5'):_0x1d3c0e[_0x08db('0x70')]='Plugin';break;case _0x08db('0xe6'):_0x1d3c0e['childModel']=_0x08db('0x79');_0x1d3c0e[_0x08db('0x71')]=[{'name':'Reports','field':'id','foreignKey':_0x08db('0x7c')}];break;case'metrics':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xe7');break;case _0x08db('0xc1'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xc2');break;default:return _0x1d3c0e;}return _0x1d3c0e;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 9ae8ead..d600754 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 _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 +var _0xa337=['save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x59eddd,_0xb26fcc){var _0x27364f=function(_0x5d6b3a){while(--_0x5d6b3a){_0x59eddd['push'](_0x59eddd['shift']());}};_0x27364f(++_0xb26fcc);}(_0xa337,0x92));var _0x7a33=function(_0x1d87d9,_0x588dde){_0x1d87d9=_0x1d87d9-0x0;var _0xc7a600=_0xa337[_0x1d87d9];return _0xc7a600;};'use strict';var EventEmitter=require(_0x7a33('0x0'));var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7a33('0x1'),'afterUpdate':'update','afterDestroy':_0x7a33('0x2')};function emitEvent(_0x249e35){return function(_0x3af896,_0x2ce976,_0x4dd361){UserProfileEvents[_0x7a33('0x3')](_0x249e35+':'+_0x3af896['id'],_0x3af896);UserProfileEvents['emit'](_0x249e35,_0x3af896);_0x4dd361(null);};}for(var e in events){if(events[_0x7a33('0x4')](e)){var event=events[e];UserProfile[_0x7a33('0x5')](e,emitEvent(event));}}module[_0x7a33('0x6')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 2c9ed3d..437b448 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 _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 +var _0x6057=['moment','bluebird','path','rimraf','../../config/environment','./userProfile.attributes','exports','define','user_profiles','lodash','util','../../config/logger','api'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x6057,0x175));var _0x7605=function(_0x1a1b6e,_0x3a07a9){_0x1a1b6e=_0x1a1b6e-0x0;var _0x571e2c=_0x6057[_0x1a1b6e];return _0x571e2c;};'use strict';var _=require(_0x7605('0x0'));var util=require(_0x7605('0x1'));var logger=require(_0x7605('0x2'))(_0x7605('0x3'));var moment=require(_0x7605('0x4'));var BPromise=require(_0x7605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7605('0x6'));var rimraf=require(_0x7605('0x7'));var config=require(_0x7605('0x8'));var attributes=require(_0x7605('0x9'));module[_0x7605('0xa')]=function(_0x162fec,_0x4be189){return _0x162fec[_0x7605('0xb')]('UserProfile',attributes,{'tableName':_0x7605('0xc'),'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 c767947..1da05dd 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 _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 +var _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','./userProfile.socket','register','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring'];(function(_0x380168,_0x40546c){var _0x12e86d=function(_0x559ef7){while(--_0x559ef7){_0x380168['push'](_0x380168['shift']());}};_0x12e86d(++_0x40546c);}(_0xe14b,0x93));var _0xbe14=function(_0x56d952,_0x1ef93d){_0x56d952=_0x56d952-0x0;var _0x4fdd5a=_0xe14b[_0x56d952];return _0x4fdd5a;};'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});config[_0xbe14('0x9')]=_[_0xbe14('0xa')](config[_0xbe14('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbe14('0xb'))[_0xbe14('0xc')](socket);function respondWithRpcPromise(_0xd68cd7,_0x90b4f,_0x53c7ea){return new BPromise(function(_0x5b9fc6,_0x113243){return client[_0xbe14('0xd')](_0xd68cd7,_0x53c7ea)['then'](function(_0x254c3b){logger[_0xbe14('0xe')](_0xbe14('0xf'),_0x90b4f,_0xbe14('0x10'));logger[_0xbe14('0x11')](_0xbe14('0x12'),_0x90b4f,_0xbe14('0x10'),JSON[_0xbe14('0x13')](_0x254c3b));if(_0x254c3b[_0xbe14('0x14')]){if(_0x254c3b[_0xbe14('0x14')][_0xbe14('0x15')]===0x1f4){logger[_0xbe14('0x14')](_0xbe14('0xf'),_0x90b4f,_0x254c3b['error']['message']);return _0x113243(_0x254c3b[_0xbe14('0x14')][_0xbe14('0x16')]);}logger[_0xbe14('0x14')](_0xbe14('0xf'),_0x90b4f,_0x254c3b['error'][_0xbe14('0x16')]);return _0x5b9fc6(_0x254c3b[_0xbe14('0x14')][_0xbe14('0x16')]);}else{logger[_0xbe14('0xe')](_0xbe14('0xf'),_0x90b4f,_0xbe14('0x10'));_0x5b9fc6(_0x254c3b[_0xbe14('0x17')]['message']);}})[_0xbe14('0x18')](function(_0x456ca8){logger[_0xbe14('0x14')](_0xbe14('0xf'),_0x90b4f,_0x456ca8);_0x113243(_0x456ca8);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 22b0be5..f768e4d 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 _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 +var _0xfed7=['remove','update','emit','removeListener','userProfile:','./userProfile.events','save'];(function(_0x531318,_0x30f19f){var _0x11ab09=function(_0x1795d9){while(--_0x1795d9){_0x531318['push'](_0x531318['shift']());}};_0x11ab09(++_0x30f19f);}(_0xfed7,0x108));var _0x7fed=function(_0x3b594b,_0x5835c3){_0x3b594b=_0x3b594b-0x0;var _0x1ea5f8=_0xfed7[_0x3b594b];return _0x1ea5f8;};'use strict';var UserProfileEvents=require(_0x7fed('0x0'));var events=[_0x7fed('0x1'),_0x7fed('0x2'),_0x7fed('0x3')];function createListener(_0x1c1007,_0x1a31df){return function(_0x248700){_0x1a31df[_0x7fed('0x4')](_0x1c1007,_0x248700);};}function removeListener(_0x805974,_0x12094d){return function(){UserProfileEvents[_0x7fed('0x5')](_0x805974,_0x12094d);};}exports['register']=function(_0x1bbaa7){for(var _0x11d378=0x0,_0x41ea0f=events['length'];_0x11d378<_0x41ea0f;_0x11d378++){var _0x4e53a5=events[_0x11d378];var _0x475cb2=createListener(_0x7fed('0x6')+_0x4e53a5,_0x1bbaa7);UserProfileEvents['on'](_0x4e53a5,_0x475cb2);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index e4350b4..5834535 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 _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 +var _0x8d8f=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8d8f,0x13d));var _0xf8d8=function(_0x5587df,_0x2c6f07){_0x5587df=_0x5587df-0x0;var _0x384d01=_0x8d8f[_0x5587df];return _0x384d01;};'use strict';var multer=require(_0xf8d8('0x0'));var util=require(_0xf8d8('0x1'));var path=require(_0xf8d8('0x2'));var timeout=require(_0xf8d8('0x3'));var express=require(_0xf8d8('0x4'));var router=express[_0xf8d8('0x5')]();var auth=require(_0xf8d8('0x6'));var interaction=require(_0xf8d8('0x7'));var config=require(_0xf8d8('0x8'));var controller=require(_0xf8d8('0x9'));router[_0xf8d8('0xa')]('/',auth[_0xf8d8('0xb')](),controller['index']);router['get'](_0xf8d8('0xc'),auth['isAuthenticated'](),controller[_0xf8d8('0xd')]);router[_0xf8d8('0xa')](_0xf8d8('0xe'),auth[_0xf8d8('0xb')](),controller[_0xf8d8('0xf')]);router[_0xf8d8('0x10')]('/',auth[_0xf8d8('0xb')](),controller[_0xf8d8('0x11')]);router['put'](_0xf8d8('0xe'),auth[_0xf8d8('0xb')](),controller[_0xf8d8('0x12')]);router['delete'](_0xf8d8('0xe'),auth[_0xf8d8('0xb')](),controller[_0xf8d8('0x13')]);module[_0xf8d8('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 88aa5eb..437d650 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 _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 +var _0x7b47=['sequelize','exports','INTEGER','STRING'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7b47,0x1e8));var _0x77b4=function(_0x8424ab,_0x3283d5){_0x8424ab=_0x8424ab-0x0;var _0x23988a=_0x7b47[_0x8424ab];return _0x23988a;};'use strict';var Sequelize=require(_0x77b4('0x0'));module[_0x77b4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x77b4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x77b4('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 38967b3..583b1dc 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 _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 +var _0x7fbe=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','includeAll','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection'];(function(_0x1c3375,_0x29cf53){var _0x179181=function(_0xc0207c){while(--_0xc0207c){_0x1c3375['push'](_0x1c3375['shift']());}};_0x179181(++_0x29cf53);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5a184b,_0x457876){_0x5a184b=_0x5a184b-0x0;var _0x713964=_0x7fbe[_0x5a184b];return _0x713964;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe7fb('0x0'));var zipdir=require(_0xe7fb('0x1'));var jsonpatch=require(_0xe7fb('0x2'));var rp=require(_0xe7fb('0x3'));var moment=require(_0xe7fb('0x4'));var BPromise=require(_0xe7fb('0x5'));var Mustache=require(_0xe7fb('0x6'));var util=require(_0xe7fb('0x7'));var path=require(_0xe7fb('0x8'));var sox=require(_0xe7fb('0x9'));var csv=require(_0xe7fb('0xa'));var ejs=require(_0xe7fb('0xb'));var fs=require('fs');var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0xa'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=_0x559129['count'],_0x18d23c=_0xa76acf[_0xe7fb('0x1e')],_0x12603d=_0xa76acf['offset']+_0xa76acf[_0xe7fb('0x1f')],_0x17e8a8;if(_0x12603d>=_0x12fff6){_0x12603d=_0x12fff6;_0x17e8a8=0xc8;}else{_0x17e8a8=0xce;}_0x482f7d['status'](_0x17e8a8);return _0x482f7d[_0xe7fb('0x20')](_0xe7fb('0x21'),_0x18d23c+'-'+_0x12603d+'/'+_0x12fff6)[_0xe7fb('0x1d')](_0x559129);}return null;};}function patchUpdates(_0x182269){return function(_0x5df1a1){try{jsonpatch[_0xe7fb('0x22')](_0x5df1a1,_0x182269,!![]);}catch(_0x5d1c87){return BPromise[_0xe7fb('0x23')](_0x5d1c87);}return _0x5df1a1['save']();};}function saveUpdates(_0x15f7a4,_0x4ea664){return function(_0xa5af01){if(_0xa5af01){return _0xa5af01[_0xe7fb('0x24')](_0x15f7a4)['then'](function(_0x143eb6){return _0x143eb6;});}return null;};}function removeEntity(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')]()[_0xe7fb('0x26')](function(){_0x4742bd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52f08b,_0x35e4db){return function(_0x53c43a){if(!_0x53c43a){_0x52f08b['sendStatus'](0x194);}return _0x53c43a;};}function handleError(_0x4026b1,_0x32e8b2){_0x32e8b2=_0x32e8b2||0x1f4;return function(_0x2996ae){logger['error'](_0x2996ae[_0xe7fb('0x27')]);if(_0x2996ae[_0xe7fb('0x28')]){delete _0x2996ae[_0xe7fb('0x28')];}_0x4026b1[_0xe7fb('0x1c')](_0x32e8b2)[_0xe7fb('0x29')](_0x2996ae);};}exports[_0xe7fb('0x2a')]=function(_0x380130,_0x59e015){var _0x5df9f2={},_0x1086e6={},_0x3bdee9={'count':0x0,'rows':[]};var _0xead63=_['map'](db[_0xe7fb('0x2b')][_0xe7fb('0x2c')],function(_0xd3fffe){return{'name':_0xd3fffe[_0xe7fb('0x2d')],'type':_0xd3fffe[_0xe7fb('0x2e')][_0xe7fb('0x2f')]};});_0x1086e6[_0xe7fb('0x30')]=_[_0xe7fb('0x31')](_0xead63,'name');_0x1086e6[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x380130[_0xe7fb('0x32')]);_0x1086e6['filters']=_['intersection'](_0x1086e6[_0xe7fb('0x30')],_0x1086e6['query']);_0x5df9f2[_0xe7fb('0x34')]=_[_0xe7fb('0x35')](_0x1086e6[_0xe7fb('0x30')],qs[_0xe7fb('0x36')](_0x380130['query'][_0xe7fb('0x36')]));_0x5df9f2[_0xe7fb('0x34')]=_0x5df9f2[_0xe7fb('0x34')][_0xe7fb('0x37')]?_0x5df9f2[_0xe7fb('0x34')]:_0x1086e6['model'];if(!_0x380130[_0xe7fb('0x32')][_0xe7fb('0x38')](_0xe7fb('0x39'))){_0x5df9f2[_0xe7fb('0x1f')]=qs[_0xe7fb('0x1f')](_0x380130[_0xe7fb('0x32')][_0xe7fb('0x1f')]);_0x5df9f2[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x380130['query'][_0xe7fb('0x1e')]);}_0x5df9f2[_0xe7fb('0x3a')]=qs[_0xe7fb('0x3b')](_0x380130['query'][_0xe7fb('0x3b')]);_0x5df9f2[_0xe7fb('0x3c')]=qs[_0xe7fb('0x3d')](_[_0xe7fb('0x3e')](_0x380130[_0xe7fb('0x32')],_0x1086e6[_0xe7fb('0x3d')]),_0xead63);if(_0x380130[_0xe7fb('0x32')][_0xe7fb('0x3f')]){_0x5df9f2[_0xe7fb('0x3c')]=_[_0xe7fb('0x40')](_0x5df9f2[_0xe7fb('0x3c')],{'$or':_[_0xe7fb('0x31')](_0xead63,function(_0x1544f2){if(_0x1544f2[_0xe7fb('0x2e')]!==_0xe7fb('0x41')){var _0x41e2d1={};_0x41e2d1[_0x1544f2[_0xe7fb('0x28')]]={'$like':'%'+_0x380130[_0xe7fb('0x32')][_0xe7fb('0x3f')]+'%'};return _0x41e2d1;}})});}_0x5df9f2=_['merge']({},_0x5df9f2,_0x380130[_0xe7fb('0x42')]);var _0x23f9f9={'where':_0x5df9f2[_0xe7fb('0x3c')]};return db[_0xe7fb('0x2b')]['count'](_0x23f9f9)[_0xe7fb('0x26')](function(_0x186418){_0x3bdee9[_0xe7fb('0x43')]=_0x186418;if(_0x380130[_0xe7fb('0x32')]['includeAll']){_0x5df9f2[_0xe7fb('0x44')]=[{'all':!![]}];}return db[_0xe7fb('0x2b')][_0xe7fb('0x45')](_0x5df9f2);})[_0xe7fb('0x26')](function(_0x468d16){_0x3bdee9[_0xe7fb('0x46')]=_0x468d16;return _0x3bdee9;})['then'](respondWithFilteredResult(_0x59e015,_0x5df9f2))[_0xe7fb('0x47')](handleError(_0x59e015,null));};exports[_0xe7fb('0x48')]=function(_0x3a96cd,_0x4b263d){var _0x36a341={'raw':![],'where':{'id':_0x3a96cd['params']['id']}},_0x3a8c52={};_0x3a8c52['model']=_['keys'](db['UserProfileResource']['rawAttributes']);_0x3a8c52[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x3a96cd[_0xe7fb('0x32')]);_0x3a8c52['filters']=_[_0xe7fb('0x35')](_0x3a8c52['model'],_0x3a8c52[_0xe7fb('0x32')]);_0x36a341[_0xe7fb('0x34')]=_['intersection'](_0x3a8c52[_0xe7fb('0x30')],qs[_0xe7fb('0x36')](_0x3a96cd[_0xe7fb('0x32')][_0xe7fb('0x36')]));_0x36a341['attributes']=_0x36a341[_0xe7fb('0x34')][_0xe7fb('0x37')]?_0x36a341[_0xe7fb('0x34')]:_0x3a8c52['model'];if(_0x3a96cd[_0xe7fb('0x32')][_0xe7fb('0x49')]){_0x36a341[_0xe7fb('0x44')]=[{'all':!![]}];}_0x36a341=_[_0xe7fb('0x40')]({},_0x36a341,_0x3a96cd[_0xe7fb('0x42')]);return db['UserProfileResource'][_0xe7fb('0x4a')](_0x36a341)['then'](handleEntityNotFound(_0x4b263d,null))[_0xe7fb('0x26')](respondWithResult(_0x4b263d,null))[_0xe7fb('0x47')](handleError(_0x4b263d,null));};exports[_0xe7fb('0x4b')]=function(_0x1ecbfd,_0x15cec3){return db['UserProfileResource'][_0xe7fb('0x4b')](_0x1ecbfd['body'],{})['then'](respondWithResult(_0x15cec3,0xc9))[_0xe7fb('0x47')](handleError(_0x15cec3,null));};exports[_0xe7fb('0x24')]=function(_0x16327f,_0x589555){if(_0x16327f[_0xe7fb('0x4c')]['id']){delete _0x16327f[_0xe7fb('0x4c')]['id'];}return db['UserProfileResource']['find']({'where':{'id':_0x16327f[_0xe7fb('0x4d')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x589555,null))[_0xe7fb('0x26')](saveUpdates(_0x16327f[_0xe7fb('0x4c')],null))[_0xe7fb('0x26')](respondWithResult(_0x589555,null))[_0xe7fb('0x47')](handleError(_0x589555,null));};exports[_0xe7fb('0x25')]=function(_0x347177,_0x5cd8e3){return db[_0xe7fb('0x2b')]['find']({'where':{'id':_0x347177[_0xe7fb('0x4d')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x5cd8e3,null))['then'](removeEntity(_0x5cd8e3,null))[_0xe7fb('0x47')](handleError(_0x5cd8e3,null));};exports['describe']=function(_0x239c56,_0x484bd8){return db[_0xe7fb('0x2b')]['describe']()[_0xe7fb('0x26')](respondWithResult(_0x484bd8,null))['catch'](handleError(_0x484bd8,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index ed23861..6afaba5 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 _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 +var _0x48d3=['moment','request-promise','rimraf','../../config/environment','exports','define','UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash','util','../../config/logger','api'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x48d3,0x96));var _0x348d=function(_0x4f65d2,_0x51ce91){_0x4f65d2=_0x4f65d2-0x0;var _0x44c0db=_0x48d3[_0x4f65d2];return _0x44c0db;};'use strict';var _=require(_0x348d('0x0'));var util=require(_0x348d('0x1'));var logger=require(_0x348d('0x2'))(_0x348d('0x3'));var moment=require(_0x348d('0x4'));var BPromise=require('bluebird');var rp=require(_0x348d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x348d('0x6'));var config=require(_0x348d('0x7'));var attributes=require('./userProfileResource.attributes');module[_0x348d('0x8')]=function(_0x4212be,_0x52e2df){return _0x4212be[_0x348d('0x9')](_0x348d('0xa'),attributes,{'tableName':_0x348d('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x348d('0xc'),_0x348d('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 6600584..12ee385 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 _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 +var _0x812a=['result','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x403db1,_0x59018e){var _0x47c48f=function(_0x1b663c){while(--_0x1b663c){_0x403db1['push'](_0x403db1['shift']());}};_0x47c48f(++_0x59018e);}(_0x812a,0x1a6));var _0xa812=function(_0xf00c97,_0x45bbf9){_0xf00c97=_0xf00c97-0x0;var _0x252c31=_0x812a[_0xf00c97];return _0x252c31;};'use strict';var _=require(_0xa812('0x0'));var util=require(_0xa812('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa812('0x2'))['db'];var utils=require(_0xa812('0x3'));var logger=require(_0xa812('0x4'))('rpc');var config=require(_0xa812('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa812('0x6')][_0xa812('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xe94f14,_0x2a84c7,_0x40c20c){return new BPromise(function(_0xd0eb9a,_0x546cdb){return client[_0xa812('0x8')](_0xe94f14,_0x40c20c)[_0xa812('0x9')](function(_0x25c6f2){logger[_0xa812('0xa')](_0xa812('0xb'),_0x2a84c7,_0xa812('0xc'));logger[_0xa812('0xd')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x2a84c7,_0xa812('0xc'),JSON[_0xa812('0xe')](_0x25c6f2));if(_0x25c6f2[_0xa812('0xf')]){if(_0x25c6f2['error'][_0xa812('0x10')]===0x1f4){logger[_0xa812('0xf')](_0xa812('0xb'),_0x2a84c7,_0x25c6f2[_0xa812('0xf')][_0xa812('0x11')]);return _0x546cdb(_0x25c6f2[_0xa812('0xf')][_0xa812('0x11')]);}logger[_0xa812('0xf')](_0xa812('0xb'),_0x2a84c7,_0x25c6f2['error']['message']);return _0xd0eb9a(_0x25c6f2[_0xa812('0xf')][_0xa812('0x11')]);}else{logger[_0xa812('0xa')](_0xa812('0xb'),_0x2a84c7,_0xa812('0xc'));_0xd0eb9a(_0x25c6f2[_0xa812('0x12')][_0xa812('0x11')]);}})[_0xa812('0x13')](function(_0x10f33b){logger[_0xa812('0xf')](_0xa812('0xb'),_0x2a84c7,_0x10f33b);_0x546cdb(_0x10f33b);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 3d385c3..6d63ff1 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 _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 +var _0x3b43=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','exports','multer'];(function(_0x88df64,_0x4d860b){var _0x3c1ff6=function(_0x86425f){while(--_0x86425f){_0x88df64['push'](_0x88df64['shift']());}};_0x3c1ff6(++_0x4d860b);}(_0x3b43,0x71));var _0x33b4=function(_0x4dd721,_0x290e01){_0x4dd721=_0x4dd721-0x0;var _0x36de00=_0x3b43[_0x4dd721];return _0x36de00;};'use strict';var multer=require(_0x33b4('0x0'));var util=require(_0x33b4('0x1'));var path=require(_0x33b4('0x2'));var timeout=require(_0x33b4('0x3'));var express=require(_0x33b4('0x4'));var router=express[_0x33b4('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x33b4('0x6'));var config=require(_0x33b4('0x7'));var controller=require('./userProfileSection.controller');router[_0x33b4('0x8')]('/',auth['isAuthenticated'](),controller[_0x33b4('0x9')]);router['get'](_0x33b4('0xa'),auth[_0x33b4('0xb')](),controller[_0x33b4('0xc')]);router[_0x33b4('0x8')](_0x33b4('0xd'),auth[_0x33b4('0xb')](),controller[_0x33b4('0xe')]);router[_0x33b4('0xf')]('/',auth['isAuthenticated'](),controller[_0x33b4('0x10')]);router[_0x33b4('0x11')](_0x33b4('0xd'),auth[_0x33b4('0xb')](),controller['update']);router['delete'](_0x33b4('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x33b4('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index f7db2ea..f427ae6 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 _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 +var _0xa8ca=['crudPermissions','split','sequelize','STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue'];(function(_0x11b8a5,_0x2b56a0){var _0x1f64e8=function(_0x313be4){while(--_0x313be4){_0x11b8a5['push'](_0x11b8a5['shift']());}};_0x1f64e8(++_0x2b56a0);}(_0xa8ca,0x12b));var _0xaa8c=function(_0x590c21,_0x2b4ab5){_0x590c21=_0x590c21-0x0;var _0x29c088=_0xa8ca[_0x590c21];return _0x29c088;};'use strict';var Sequelize=require(_0xaa8c('0x0'));module['exports']={'name':{'type':Sequelize[_0xaa8c('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xaa8c('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xaa8c('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xaa8c('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xaa8c('0x1')],'set':function(_0x2c993f){this[_0xaa8c('0x4')]('crudPermissions',_0x2c993f?_0x2c993f[_0xaa8c('0x5')](''):[]);},'get':function(){return this[_0xaa8c('0x6')]('crudPermissions')?this['getDataValue'](_0xaa8c('0x7'))[_0xaa8c('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 086cb3c..bff3921 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 _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 +var _0xdcce=['merge','VIRTUAL','options','UserProfileSection','count','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','update','describe','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','offset','limit','set','Content-Range','json','apply','reject','then','destroy','error','name','send','index','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','where'];(function(_0x4dbe88,_0x2cd744){var _0x20d596=function(_0x52ed69){while(--_0x52ed69){_0x4dbe88['push'](_0x4dbe88['shift']());}};_0x20d596(++_0x2cd744);}(_0xdcce,0x1d2));var _0xedcc=function(_0x2c0c43,_0x54a06b){_0x2c0c43=_0x2c0c43-0x0;var _0x4a4525=_0xdcce[_0x2c0c43];return _0x4a4525;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xedcc('0x0'));var zipdir=require(_0xedcc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xedcc('0x2'));var moment=require(_0xedcc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xedcc('0x4'));var util=require(_0xedcc('0x5'));var path=require('path');var sox=require(_0xedcc('0x6'));var csv=require('to-csv');var ejs=require(_0xedcc('0x7'));var fs=require('fs');var _=require(_0xedcc('0x8'));var squel=require(_0xedcc('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xedcc('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xedcc('0xb'));var Redis=require(_0xedcc('0xc'));var authService=require(_0xedcc('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xedcc('0xe'))('api');var utils=require(_0xedcc('0xf'));var config=require(_0xedcc('0x10'));var licenseUtil=require(_0xedcc('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43dce7,_0x121ce9){_0x121ce9=_0x121ce9||0xcc;return function(_0xb88729){if(_0xb88729){return _0x43dce7['sendStatus'](_0x121ce9);}return _0x43dce7[_0xedcc('0x12')](_0x121ce9)['end']();};}function respondWithResult(_0x9f3817,_0x29cc1f){_0x29cc1f=_0x29cc1f||0xc8;return function(_0x3e05e6){if(_0x3e05e6){return _0x9f3817[_0xedcc('0x12')](_0x29cc1f)['json'](_0x3e05e6);}};}function respondWithFilteredResult(_0x30d6d1,_0x465517){return function(_0x363062){if(_0x363062){var _0x488ac1=_0x363062['count'],_0x3567cb=_0x465517[_0xedcc('0x13')],_0x518249=_0x465517[_0xedcc('0x13')]+_0x465517[_0xedcc('0x14')],_0xfef304;if(_0x518249>=_0x488ac1){_0x518249=_0x488ac1;_0xfef304=0xc8;}else{_0xfef304=0xce;}_0x30d6d1[_0xedcc('0x12')](_0xfef304);return _0x30d6d1[_0xedcc('0x15')](_0xedcc('0x16'),_0x3567cb+'-'+_0x518249+'/'+_0x488ac1)[_0xedcc('0x17')](_0x363062);}return null;};}function patchUpdates(_0xab868){return function(_0x4d5a37){try{jsonpatch[_0xedcc('0x18')](_0x4d5a37,_0xab868,!![]);}catch(_0x560e17){return BPromise[_0xedcc('0x19')](_0x560e17);}return _0x4d5a37['save']();};}function saveUpdates(_0x4d9baa,_0x257bac){return function(_0xdc82fa){if(_0xdc82fa){return _0xdc82fa['update'](_0x4d9baa)[_0xedcc('0x1a')](function(_0x230533){return _0x230533;});}return null;};}function removeEntity(_0x5adfed,_0x2d0981){return function(_0x227319){if(_0x227319){return _0x227319[_0xedcc('0x1b')]()[_0xedcc('0x1a')](function(){_0x5adfed[_0xedcc('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x572ad9,_0x4d10be){return function(_0x4590c4){if(!_0x4590c4){_0x572ad9['sendStatus'](0x194);}return _0x4590c4;};}function handleError(_0x401623,_0xbfadf5){_0xbfadf5=_0xbfadf5||0x1f4;return function(_0x37dcb2){logger[_0xedcc('0x1c')](_0x37dcb2['stack']);if(_0x37dcb2[_0xedcc('0x1d')]){delete _0x37dcb2['name'];}_0x401623['status'](_0xbfadf5)[_0xedcc('0x1e')](_0x37dcb2);};}exports[_0xedcc('0x1f')]=function(_0x42419c,_0x43d193){var _0x2c3b19={},_0x49d7f6={},_0x29f9e1={'count':0x0,'rows':[]};var _0x207b02=_['map'](db['UserProfileSection'][_0xedcc('0x20')],function(_0x595d39){return{'name':_0x595d39[_0xedcc('0x21')],'type':_0x595d39['type']['key']};});_0x49d7f6['model']=_[_0xedcc('0x22')](_0x207b02,_0xedcc('0x1d'));_0x49d7f6[_0xedcc('0x23')]=_[_0xedcc('0x24')](_0x42419c[_0xedcc('0x23')]);_0x49d7f6[_0xedcc('0x25')]=_[_0xedcc('0x26')](_0x49d7f6[_0xedcc('0x27')],_0x49d7f6['query']);_0x2c3b19[_0xedcc('0x28')]=_['intersection'](_0x49d7f6[_0xedcc('0x27')],qs['fields'](_0x42419c[_0xedcc('0x23')]['fields']));_0x2c3b19[_0xedcc('0x28')]=_0x2c3b19[_0xedcc('0x28')][_0xedcc('0x29')]?_0x2c3b19[_0xedcc('0x28')]:_0x49d7f6[_0xedcc('0x27')];if(!_0x42419c[_0xedcc('0x23')]['hasOwnProperty'](_0xedcc('0x2a'))){_0x2c3b19[_0xedcc('0x14')]=qs[_0xedcc('0x14')](_0x42419c[_0xedcc('0x23')][_0xedcc('0x14')]);_0x2c3b19[_0xedcc('0x13')]=qs['offset'](_0x42419c[_0xedcc('0x23')]['offset']);}_0x2c3b19[_0xedcc('0x2b')]=qs[_0xedcc('0x2c')](_0x42419c[_0xedcc('0x23')][_0xedcc('0x2c')]);_0x2c3b19[_0xedcc('0x2d')]=qs[_0xedcc('0x25')](_['pick'](_0x42419c[_0xedcc('0x23')],_0x49d7f6[_0xedcc('0x25')]),_0x207b02);if(_0x42419c[_0xedcc('0x23')]['filter']){_0x2c3b19[_0xedcc('0x2d')]=_[_0xedcc('0x2e')](_0x2c3b19[_0xedcc('0x2d')],{'$or':_['map'](_0x207b02,function(_0x1af615){if(_0x1af615['type']!==_0xedcc('0x2f')){var _0x51fde1={};_0x51fde1[_0x1af615['name']]={'$like':'%'+_0x42419c[_0xedcc('0x23')]['filter']+'%'};return _0x51fde1;}})});}_0x2c3b19=_[_0xedcc('0x2e')]({},_0x2c3b19,_0x42419c[_0xedcc('0x30')]);var _0x5e18eb={'where':_0x2c3b19[_0xedcc('0x2d')]};return db[_0xedcc('0x31')][_0xedcc('0x32')](_0x5e18eb)[_0xedcc('0x1a')](function(_0x18c3ab){_0x29f9e1[_0xedcc('0x32')]=_0x18c3ab;if(_0x42419c['query'][_0xedcc('0x33')]){_0x2c3b19[_0xedcc('0x34')]=[{'all':!![]}];}return db[_0xedcc('0x31')][_0xedcc('0x35')](_0x2c3b19);})[_0xedcc('0x1a')](function(_0x2039a6){_0x29f9e1[_0xedcc('0x36')]=_0x2039a6;return _0x29f9e1;})[_0xedcc('0x1a')](respondWithFilteredResult(_0x43d193,_0x2c3b19))[_0xedcc('0x37')](handleError(_0x43d193,null));};exports[_0xedcc('0x38')]=function(_0x4f6f60,_0x2fc3d3){var _0x2d64bd={'raw':![],'where':{'id':_0x4f6f60[_0xedcc('0x39')]['id']}},_0x521eb9={};_0x521eb9[_0xedcc('0x27')]=_['keys'](db['UserProfileSection'][_0xedcc('0x20')]);_0x521eb9[_0xedcc('0x23')]=_[_0xedcc('0x24')](_0x4f6f60['query']);_0x521eb9[_0xedcc('0x25')]=_[_0xedcc('0x26')](_0x521eb9[_0xedcc('0x27')],_0x521eb9[_0xedcc('0x23')]);_0x2d64bd[_0xedcc('0x28')]=_[_0xedcc('0x26')](_0x521eb9[_0xedcc('0x27')],qs[_0xedcc('0x3a')](_0x4f6f60[_0xedcc('0x23')]['fields']));_0x2d64bd[_0xedcc('0x28')]=_0x2d64bd[_0xedcc('0x28')][_0xedcc('0x29')]?_0x2d64bd['attributes']:_0x521eb9[_0xedcc('0x27')];if(_0x4f6f60[_0xedcc('0x23')][_0xedcc('0x33')]){_0x2d64bd[_0xedcc('0x34')]=[{'all':!![]}];}_0x2d64bd=_['merge']({},_0x2d64bd,_0x4f6f60[_0xedcc('0x30')]);return db[_0xedcc('0x31')][_0xedcc('0x3b')](_0x2d64bd)[_0xedcc('0x1a')](handleEntityNotFound(_0x2fc3d3,null))[_0xedcc('0x1a')](respondWithResult(_0x2fc3d3,null))[_0xedcc('0x37')](handleError(_0x2fc3d3,null));};exports['create']=function(_0x4da7f5,_0x3ef017){return db[_0xedcc('0x31')][_0xedcc('0x3c')](_0x4da7f5[_0xedcc('0x3d')],{})[_0xedcc('0x1a')](respondWithResult(_0x3ef017,0xc9))[_0xedcc('0x37')](handleError(_0x3ef017,null));};exports[_0xedcc('0x3e')]=function(_0x447b48,_0x544574){if(_0x447b48[_0xedcc('0x3d')]['id']){delete _0x447b48[_0xedcc('0x3d')]['id'];}return db[_0xedcc('0x31')][_0xedcc('0x3b')]({'where':{'id':_0x447b48[_0xedcc('0x39')]['id']}})[_0xedcc('0x1a')](handleEntityNotFound(_0x544574,null))[_0xedcc('0x1a')](saveUpdates(_0x447b48[_0xedcc('0x3d')],null))[_0xedcc('0x1a')](respondWithResult(_0x544574,null))[_0xedcc('0x37')](handleError(_0x544574,null));};exports[_0xedcc('0x1b')]=function(_0x5ab066,_0x55bd96){return db['UserProfileSection']['find']({'where':{'id':_0x5ab066[_0xedcc('0x39')]['id']}})['then'](handleEntityNotFound(_0x55bd96,null))[_0xedcc('0x1a')](removeEntity(_0x55bd96,null))['catch'](handleError(_0x55bd96,null));};exports[_0xedcc('0x3f')]=function(_0x375c6a,_0x59c0b4){return db['UserProfileSection'][_0xedcc('0x3f')]()['then'](respondWithResult(_0x59c0b4,null))[_0xedcc('0x37')](handleError(_0x59c0b4,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 08e7ea7..720d964 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 _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 +var _0x3e9e=['path','../../config/environment','./userProfileSection.attributes','define','compositeIndex','sectionId','userProfileId','util','api','bluebird'];(function(_0x28dce1,_0x14b05f){var _0x59a43a=function(_0x479c19){while(--_0x479c19){_0x28dce1['push'](_0x28dce1['shift']());}};_0x59a43a(++_0x14b05f);}(_0x3e9e,0x13d));var _0xe3e9=function(_0x9226e8,_0x1a57a3){_0x9226e8=_0x9226e8-0x0;var _0x1d3842=_0x3e9e[_0x9226e8];return _0x1d3842;};'use strict';var _=require('lodash');var util=require(_0xe3e9('0x0'));var logger=require('../../config/logger')(_0xe3e9('0x1'));var moment=require('moment');var BPromise=require(_0xe3e9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3e9('0x3'));var rimraf=require('rimraf');var config=require(_0xe3e9('0x4'));var attributes=require(_0xe3e9('0x5'));module['exports']=function(_0x50c4bd,_0x4c49af){return _0x50c4bd[_0xe3e9('0x6')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xe3e9('0x7'),'fields':[_0xe3e9('0x8'),_0xe3e9('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index ddf3230..f64fda8 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 _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 +var _0xcc48=['error','code','message','catch','UserProfileSection,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xcc48,0x10d));var _0x8cc4=function(_0xeeb156,_0x5392f4){_0xeeb156=_0xeeb156-0x0;var _0x4b7c74=_0xcc48[_0xeeb156];return _0x4b7c74;};'use strict';var _=require(_0x8cc4('0x0'));var util=require(_0x8cc4('0x1'));var moment=require(_0x8cc4('0x2'));var BPromise=require(_0x8cc4('0x3'));var rs=require(_0x8cc4('0x4'));var fs=require('fs');var Redis=require(_0x8cc4('0x5'));var db=require(_0x8cc4('0x6'))['db'];var utils=require(_0x8cc4('0x7'));var logger=require(_0x8cc4('0x8'))(_0x8cc4('0x9'));var config=require(_0x8cc4('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8cc4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e672b,_0x42579a,_0xa8e939){return new BPromise(function(_0x2c9ebc,_0x1a829c){return client[_0x8cc4('0xc')](_0x4e672b,_0xa8e939)['then'](function(_0x58b6ea){logger[_0x8cc4('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x42579a,_0x8cc4('0xe'));logger['debug'](_0x8cc4('0xf'),_0x42579a,_0x8cc4('0xe'),JSON[_0x8cc4('0x10')](_0x58b6ea));if(_0x58b6ea[_0x8cc4('0x11')]){if(_0x58b6ea[_0x8cc4('0x11')][_0x8cc4('0x12')]===0x1f4){logger[_0x8cc4('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x42579a,_0x58b6ea[_0x8cc4('0x11')][_0x8cc4('0x13')]);return _0x1a829c(_0x58b6ea['error'][_0x8cc4('0x13')]);}logger[_0x8cc4('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x42579a,_0x58b6ea[_0x8cc4('0x11')][_0x8cc4('0x13')]);return _0x2c9ebc(_0x58b6ea[_0x8cc4('0x11')][_0x8cc4('0x13')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x42579a,_0x8cc4('0xe'));_0x2c9ebc(_0x58b6ea['result']['message']);}})[_0x8cc4('0x14')](function(_0x5f5959){logger[_0x8cc4('0x11')](_0x8cc4('0x15'),_0x42579a,_0x5f5959);_0x1a829c(_0x5f5959);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 84af18c..e076431 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 _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 +var _0x1ff2=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x56bb8e,_0xb5ff1a){var _0x4629d0=function(_0x469e08){while(--_0x469e08){_0x56bb8e['push'](_0x56bb8e['shift']());}};_0x4629d0(++_0xb5ff1a);}(_0x1ff2,0x141));var _0x21ff=function(_0x3c796b,_0x157c7c){_0x3c796b=_0x3c796b-0x0;var _0x5154d4=_0x1ff2[_0x3c796b];return _0x5154d4;};'use strict';var multer=require(_0x21ff('0x0'));var util=require(_0x21ff('0x1'));var path=require(_0x21ff('0x2'));var timeout=require(_0x21ff('0x3'));var express=require(_0x21ff('0x4'));var router=express[_0x21ff('0x5')]();var auth=require(_0x21ff('0x6'));var interaction=require(_0x21ff('0x7'));var config=require(_0x21ff('0x8'));module[_0x21ff('0x9')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index b95d725..09dff86 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 _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 +var _0xd8b0=['exports','sequelize'];(function(_0x2fd8a7,_0x5db621){var _0x4bdc24=function(_0x30ef41){while(--_0x30ef41){_0x2fd8a7['push'](_0x2fd8a7['shift']());}};_0x4bdc24(++_0x5db621);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index c4f019e..58b7ede 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 _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 +var _0xa44e=['bluebird','request-promise','exports','define','UserSmsQueue','user_has_sms_queues','util','api','moment'];(function(_0x43471c,_0x528d23){var _0x5f27a4=function(_0x1fdcd3){while(--_0x1fdcd3){_0x43471c['push'](_0x43471c['shift']());}};_0x5f27a4(++_0x528d23);}(_0xa44e,0x189));var _0xea44=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa44e[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xea44('0x0'));var logger=require('../../config/logger')(_0xea44('0x1'));var moment=require(_0xea44('0x2'));var BPromise=require(_0xea44('0x3'));var rp=require(_0xea44('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0xea44('0x5')]=function(_0x51f9ba,_0x3a9824){return _0x51f9ba[_0xea44('0x6')](_0xea44('0x7'),attributes,{'tableName':_0xea44('0x8'),'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 7e5c6d8..cf2ae08 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 _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 +var _0x8be2=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0xca465b,_0x470663){var _0x3d988d=function(_0x2d2e1f){while(--_0x2d2e1f){_0xca465b['push'](_0xca465b['shift']());}};_0x3d988d(++_0x470663);}(_0x8be2,0x1b4));var _0x28be=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x8be2[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0x28be('0x0'));var util=require(_0x28be('0x1'));var moment=require(_0x28be('0x2'));var BPromise=require(_0x28be('0x3'));var rs=require(_0x28be('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x28be('0x5'))['db'];var utils=require(_0x28be('0x6'));var logger=require(_0x28be('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x28be('0x8'));var client=jayson[_0x28be('0x9')][_0x28be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17bd4d,_0x259899,_0x422891){return new BPromise(function(_0x5caff2,_0x2fa60c){return client[_0x28be('0xb')](_0x17bd4d,_0x422891)[_0x28be('0xc')](function(_0x44d9ae){logger[_0x28be('0xd')](_0x28be('0xe'),_0x259899,'request\x20sent');logger['debug'](_0x28be('0xf'),_0x259899,_0x28be('0x10'),JSON[_0x28be('0x11')](_0x44d9ae));if(_0x44d9ae['error']){if(_0x44d9ae[_0x28be('0x12')][_0x28be('0x13')]===0x1f4){logger[_0x28be('0x12')](_0x28be('0xe'),_0x259899,_0x44d9ae[_0x28be('0x12')][_0x28be('0x14')]);return _0x2fa60c(_0x44d9ae[_0x28be('0x12')][_0x28be('0x14')]);}logger[_0x28be('0x12')](_0x28be('0xe'),_0x259899,_0x44d9ae[_0x28be('0x12')][_0x28be('0x14')]);return _0x5caff2(_0x44d9ae[_0x28be('0x12')][_0x28be('0x14')]);}else{logger[_0x28be('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x259899,_0x28be('0x10'));_0x5caff2(_0x44d9ae[_0x28be('0x15')]['message']);}})[_0x28be('0x16')](function(_0x4af078){logger['error'](_0x28be('0xe'),_0x259899,_0x4af078);_0x2fa60c(_0x4af078);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index d3f2477..61c6bf2 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 _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 +var _0xae1e=['exports','util','path','Router','../../components/interaction/service','../../config/environment'];(function(_0x12be05,_0x264872){var _0x43f6df=function(_0x5cbcb5){while(--_0x5cbcb5){_0x12be05['push'](_0x12be05['shift']());}};_0x43f6df(++_0x264872);}(_0xae1e,0x151));var _0xeae1=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xae1e[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0xeae1('0x0'));var path=require(_0xeae1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xeae1('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xeae1('0x3'));var config=require(_0xeae1('0x4'));module[_0xeae1('0x5')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index e39b3c0..b96dfd5 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_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 +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x3d35c9,_0x23e44a){var _0x10f0f9=function(_0xe05eb2){while(--_0xe05eb2){_0x3d35c9['push'](_0x3d35c9['shift']());}};_0x10f0f9(++_0x23e44a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('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 5b2cd2a..0b8c021 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 _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 +var _0x425d=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0xfb2f46,_0x4f89df){var _0xcadef3=function(_0x1ae5c8){while(--_0x1ae5c8){_0xfb2f46['push'](_0xfb2f46['shift']());}};_0xcadef3(++_0x4f89df);}(_0x425d,0x1e0));var _0xd425=function(_0x27ec50,_0x1d8698){_0x27ec50=_0x27ec50-0x0;var _0x2da0f5=_0x425d[_0x27ec50];return _0x2da0f5;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var logger=require(_0xd425('0x1'))(_0xd425('0x2'));var moment=require(_0xd425('0x3'));var BPromise=require(_0xd425('0x4'));var rp=require(_0xd425('0x5'));var fs=require('fs');var path=require(_0xd425('0x6'));var rimraf=require(_0xd425('0x7'));var config=require('../../config/environment');var attributes=require(_0xd425('0x8'));module[_0xd425('0x9')]=function(_0xc4e080,_0x36866e){return _0xc4e080[_0xd425('0xa')](_0xd425('0xb'),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 9c89495..0dcebef 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 _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 +var _0xed4b=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','moment','bluebird'];(function(_0x3b2838,_0x3cd7b3){var _0x530b7d=function(_0x36782e){while(--_0x36782e){_0x3b2838['push'](_0x3b2838['shift']());}};_0x530b7d(++_0x3cd7b3);}(_0xed4b,0x12a));var _0xbed4=function(_0x136ffa,_0x49ef77){_0x136ffa=_0x136ffa-0x0;var _0x96647c=_0xed4b[_0x136ffa];return _0x96647c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbed4('0x0'));var BPromise=require(_0xbed4('0x1'));var rs=require(_0xbed4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbed4('0x3'))['db'];var utils=require(_0xbed4('0x4'));var logger=require('../../config/logger')(_0xbed4('0x5'));var config=require(_0xbed4('0x6'));var jayson=require(_0xbed4('0x7'));var client=jayson[_0xbed4('0x8')][_0xbed4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x404468,_0x4262e6,_0x2c010f){return new BPromise(function(_0x2d2719,_0x1e7007){return client[_0xbed4('0xa')](_0x404468,_0x2c010f)[_0xbed4('0xb')](function(_0x5b92fd){logger[_0xbed4('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x4262e6,_0xbed4('0xd'));logger['debug'](_0xbed4('0xe'),_0x4262e6,_0xbed4('0xd'),JSON['stringify'](_0x5b92fd));if(_0x5b92fd[_0xbed4('0xf')]){if(_0x5b92fd[_0xbed4('0xf')]['code']===0x1f4){logger['error'](_0xbed4('0x10'),_0x4262e6,_0x5b92fd[_0xbed4('0xf')]['message']);return _0x1e7007(_0x5b92fd[_0xbed4('0xf')][_0xbed4('0x11')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x4262e6,_0x5b92fd[_0xbed4('0xf')][_0xbed4('0x11')]);return _0x2d2719(_0x5b92fd[_0xbed4('0xf')][_0xbed4('0x11')]);}else{logger[_0xbed4('0xc')](_0xbed4('0x10'),_0x4262e6,'request\x20sent');_0x2d2719(_0x5b92fd[_0xbed4('0x12')]['message']);}})[_0xbed4('0x13')](function(_0x9c989b){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x4262e6,_0x9c989b);_0x1e7007(_0x9c989b);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index c1c3818..420ba2d 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 _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 +var _0xbf88=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x59a92e,_0x4af751){var _0x1c4ccb=function(_0x11ea0c){while(--_0x11ea0c){_0x59a92e['push'](_0x59a92e['shift']());}};_0x1c4ccb(++_0x4af751);}(_0xbf88,0x19e));var _0x8bf8=function(_0x3012e1,_0x30d750){_0x3012e1=_0x3012e1-0x0;var _0x501362=_0xbf88[_0x3012e1];return _0x501362;};'use strict';var multer=require(_0x8bf8('0x0'));var util=require(_0x8bf8('0x1'));var path=require(_0x8bf8('0x2'));var timeout=require(_0x8bf8('0x3'));var express=require(_0x8bf8('0x4'));var router=express[_0x8bf8('0x5')]();var auth=require(_0x8bf8('0x6'));var interaction=require(_0x8bf8('0x7'));var config=require(_0x8bf8('0x8'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 582cea1..c3f274b 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 _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 +var _0x5039=['INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface','sequelize','exports'];(function(_0x35af28,_0xa142f6){var _0x169538=function(_0x4da3c7){while(--_0x4da3c7){_0x35af28['push'](_0x35af28['shift']());}};_0x169538(++_0xa142f6);}(_0x5039,0xee));var _0x9503=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x5039[_0x53cf8e];return _0x459197;};'use strict';var Sequelize=require(_0x9503('0x0'));module[_0x9503('0x1')]={'uniqueid':{'type':Sequelize[_0x9503('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x9503('0x3')],'allowNull':![],'comment':_0x9503('0x4')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x9503('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x9503('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x9503('0x3')],'allowNull':![],'unique':_0x9503('0x5'),'comment':_0x9503('0x4')},'penalty':{'type':Sequelize[_0x9503('0x2')](0xb),'defaultValue':0x0,'comment':_0x9503('0x4')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x9503('0x4')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index df74f9c..ae0051d 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 _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 +var _0xc8a3=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','UserVoiceQueueRt'];(function(_0x5b8eb0,_0x5db23b){var _0xfe39d7=function(_0x122123){while(--_0x122123){_0x5b8eb0['push'](_0x5b8eb0['shift']());}};_0xfe39d7(++_0x5db23b);}(_0xc8a3,0x7c));var _0x3c8a=function(_0x5ae54d,_0x2fc130){_0x5ae54d=_0x5ae54d-0x0;var _0x33cbed=_0xc8a3[_0x5ae54d];return _0x33cbed;};'use strict';var EventEmitter=require(_0x3c8a('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x3c8a('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x3c8a('0x2')](0x0);var events={'afterCreate':_0x3c8a('0x3'),'afterUpdate':_0x3c8a('0x4'),'afterDestroy':_0x3c8a('0x5')};function emitEvent(_0x452f35){return function(_0x3a598f,_0x258c62,_0xe39a9d){UserVoiceQueueRtEvents[_0x3c8a('0x6')](_0x452f35+':'+_0x3a598f['id'],_0x3a598f);UserVoiceQueueRtEvents['emit'](_0x452f35,_0x3a598f);_0xe39a9d(null);};}for(var e in events){if(events[_0x3c8a('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x3c8a('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 4e20337..ab126eb 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 _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 +var _0x9856=['request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','util','../../config/logger','api'];(function(_0x38977c,_0x16b241){var _0x5cef84=function(_0x28ca51){while(--_0x28ca51){_0x38977c['push'](_0x38977c['shift']());}};_0x5cef84(++_0x16b241);}(_0x9856,0xb8));var _0x6985=function(_0x1104fc,_0x43f00a){_0x1104fc=_0x1104fc-0x0;var _0x21d63f=_0x9856[_0x1104fc];return _0x21d63f;};'use strict';var _=require('lodash');var util=require(_0x6985('0x0'));var logger=require(_0x6985('0x1'))(_0x6985('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6985('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6985('0x4'));var config=require(_0x6985('0x5'));var attributes=require(_0x6985('0x6'));module[_0x6985('0x7')]=function(_0x5dbf7e,_0x230d0c){return _0x5dbf7e[_0x6985('0x8')](_0x6985('0x9'),attributes,{'tableName':_0x6985('0xa'),'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 b55d590..1b412d8 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 _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 +var _0x3dc1=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','UserVoiceQueueRt','options','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','GetVoiceQueueRtPauses','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x27858b,_0x1b52bd){var _0x751c89=function(_0x4655b3){while(--_0x4655b3){_0x27858b['push'](_0x27858b['shift']());}};_0x751c89(++_0x1b52bd);}(_0x3dc1,0x124));var _0x13dc=function(_0xa80333,_0x42f695){_0xa80333=_0xa80333-0x0;var _0xe7b5c=_0x3dc1[_0xa80333];return _0xe7b5c;};'use strict';var _=require('lodash');var util=require(_0x13dc('0x0'));var moment=require('moment');var BPromise=require(_0x13dc('0x1'));var rs=require(_0x13dc('0x2'));var fs=require('fs');var Redis=require(_0x13dc('0x3'));var db=require(_0x13dc('0x4'))['db'];var utils=require(_0x13dc('0x5'));var logger=require(_0x13dc('0x6'))(_0x13dc('0x7'));var config=require(_0x13dc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x13dc('0x9')][_0x13dc('0xa')]({'port':0x232a});config[_0x13dc('0xb')]=_['defaults'](config['redis'],{'host':_0x13dc('0xc'),'port':0x18eb});var socket=require(_0x13dc('0xd'))(new Redis(config[_0x13dc('0xb')]));require(_0x13dc('0xe'))[_0x13dc('0xf')](socket);function respondWithRpcPromise(_0x7ea336,_0x540e84,_0x37e6f3){return new BPromise(function(_0x5c2c75,_0x212004){return client['request'](_0x7ea336,_0x37e6f3)['then'](function(_0x3ea6ba){logger[_0x13dc('0x10')](_0x13dc('0x11'),_0x540e84,'request\x20sent');logger[_0x13dc('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x540e84,_0x13dc('0x13'),JSON[_0x13dc('0x14')](_0x3ea6ba));if(_0x3ea6ba[_0x13dc('0x15')]){if(_0x3ea6ba[_0x13dc('0x15')]['code']===0x1f4){logger['error'](_0x13dc('0x11'),_0x540e84,_0x3ea6ba[_0x13dc('0x15')][_0x13dc('0x16')]);return _0x212004(_0x3ea6ba[_0x13dc('0x15')][_0x13dc('0x16')]);}logger[_0x13dc('0x15')](_0x13dc('0x11'),_0x540e84,_0x3ea6ba[_0x13dc('0x15')][_0x13dc('0x16')]);return _0x5c2c75(_0x3ea6ba[_0x13dc('0x15')][_0x13dc('0x16')]);}else{logger[_0x13dc('0x10')](_0x13dc('0x11'),_0x540e84,_0x13dc('0x13'));_0x5c2c75(_0x3ea6ba['result'][_0x13dc('0x16')]);}})[_0x13dc('0x17')](function(_0x5dcaa3){logger[_0x13dc('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x540e84,_0x5dcaa3);_0x212004(_0x5dcaa3);});});}exports['GetVoiceQueueRtPauses']=function(_0x4f1b8c){var _0xf76618=this;return new Promise(function(_0x368054,_0x3c2f8a){return db[_0x13dc('0x18')]['findAll']({'raw':_0x4f1b8c['options']?_0x4f1b8c[_0x13dc('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4f1b8c[_0x13dc('0x19')]?_0x4f1b8c[_0x13dc('0x19')]['where']||null:null,'attributes':[[db[_0x13dc('0x1a')]['fn'](_0x13dc('0x1b'),db[_0x13dc('0x1a')]['fn']('IF',db[_0x13dc('0x1a')][_0x13dc('0x1c')](_0x13dc('0x1d')))),_0x13dc('0x1e')]]})[_0x13dc('0x1f')](function(_0x3c47dc){logger[_0x13dc('0x10')]('GetVoiceQueueRtPauses',_0x4f1b8c);logger[_0x13dc('0x12')](_0x13dc('0x20'),_0x4f1b8c,JSON[_0x13dc('0x14')](_0x3c47dc));_0x368054(_0x3c47dc);})[_0x13dc('0x17')](function(_0x54b97c){logger['error'](_0x13dc('0x20'),_0x54b97c[_0x13dc('0x16')],_0x4f1b8c);_0x3c2f8a(_0xf76618[_0x13dc('0x15')](0x1f4,_0x54b97c[_0x13dc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 6997fee..8f4ee40 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 _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 +var _0xae99=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','length'];(function(_0x3fcc96,_0x1c65d4){var _0x5caa7a=function(_0x39962c){while(--_0x39962c){_0x3fcc96['push'](_0x3fcc96['shift']());}};_0x5caa7a(++_0x1c65d4);}(_0xae99,0x78));var _0x9ae9=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xae99[_0x5bd426];return _0x23a7eb;};'use strict';var UserVoiceQueueRtEvents=require(_0x9ae9('0x0'));var events=[_0x9ae9('0x1'),_0x9ae9('0x2'),_0x9ae9('0x3')];function createListener(_0x40c0b6,_0x282686){return function(_0x2720e5){_0x282686[_0x9ae9('0x4')](_0x40c0b6,_0x2720e5);};}function removeListener(_0x67c685,_0x2aaf17){return function(){UserVoiceQueueRtEvents['removeListener'](_0x67c685,_0x2aaf17);};}exports['register']=function(_0x49b5f4){for(var _0x2d73ea=0x0,_0x423b34=events[_0x9ae9('0x5')];_0x2d73ea<_0x423b34;_0x2d73ea++){var _0xddd1c7=events[_0x2d73ea];var _0x4a0ab3=createListener(_0x9ae9('0x6')+_0xddd1c7,_0x49b5f4);UserVoiceQueueRtEvents['on'](_0xddd1c7,_0x4a0ab3);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index d00f3b6..67365a8 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 _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 +var _0x05ae=['multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x2882a8,_0x57fe11){var _0x594432=function(_0x4a0b42){while(--_0x4a0b42){_0x2882a8['push'](_0x2882a8['shift']());}};_0x594432(++_0x57fe11);}(_0x05ae,0x150));var _0xe05a=function(_0x51a3c6,_0x471ad3){_0x51a3c6=_0x51a3c6-0x0;var _0x1bcda1=_0x05ae[_0x51a3c6];return _0x1bcda1;};'use strict';var multer=require(_0xe05a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe05a('0x1'));var express=require(_0xe05a('0x2'));var router=express['Router']();var auth=require(_0xe05a('0x3'));var interaction=require(_0xe05a('0x4'));var config=require(_0xe05a('0x5'));module[_0xe05a('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index f39433d..eac1960 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_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 +var _0xd8b0=['exports','sequelize'];(function(_0x204ce5,_0x46fb75){var _0x4f5a44=function(_0x55e0ac){while(--_0x55e0ac){_0x204ce5['push'](_0x204ce5['shift']());}};_0x4f5a44(++_0x46fb75);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 0e209ea..b56f732 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 _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 +var _0xe511=['bluebird','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','lodash','util','api'];(function(_0xd943d6,_0x4af118){var _0x3f05b1=function(_0x2d341d){while(--_0x2d341d){_0xd943d6['push'](_0xd943d6['shift']());}};_0x3f05b1(++_0x4af118);}(_0xe511,0x16f));var _0x1e51=function(_0x105e01,_0x199717){_0x105e01=_0x105e01-0x0;var _0x421f22=_0xe511[_0x105e01];return _0x421f22;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var logger=require('../../config/logger')(_0x1e51('0x2'));var moment=require('moment');var BPromise=require(_0x1e51('0x3'));var rp=require(_0x1e51('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var attributes=require(_0x1e51('0x7'));module[_0x1e51('0x8')]=function(_0x480cca,_0x26b22c){return _0x480cca[_0x1e51('0x9')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','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 0b15b10..8898bbb 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(_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 +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(_0x25f612,_0x37c9f9){var _0x172cc2=function(_0x2fc71c){while(--_0x2fc71c){_0x25f612['push'](_0x25f612['shift']());}};_0x172cc2(++_0x37c9f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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 1af8db6..c109eaa 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 _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 +var _0xc02d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xb60674,_0xa4e08a){var _0x2514a0=function(_0x5bfc26){while(--_0x5bfc26){_0xb60674['push'](_0xb60674['shift']());}};_0x2514a0(++_0xa4e08a);}(_0xc02d,0x160));var _0xdc02=function(_0x5a213d,_0x4ce201){_0x5a213d=_0x5a213d-0x0;var _0x214d26=_0xc02d[_0x5a213d];return _0x214d26;};'use strict';var multer=require(_0xdc02('0x0'));var util=require(_0xdc02('0x1'));var path=require(_0xdc02('0x2'));var timeout=require(_0xdc02('0x3'));var express=require(_0xdc02('0x4'));var router=express['Router']();var auth=require(_0xdc02('0x5'));var interaction=require(_0xdc02('0x6'));var config=require(_0xdc02('0x7'));var controller=require(_0xdc02('0x8'));router[_0xdc02('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xdc02('0xa')](),controller['show']);router[_0xdc02('0xb')]('/',auth['isAuthenticated'](),controller[_0xdc02('0xc')]);router[_0xdc02('0xd')]('/:id',auth[_0xdc02('0xa')](),controller['update']);router['delete'](_0xdc02('0xe'),auth['isAuthenticated'](),controller[_0xdc02('0xf')]);module[_0xdc02('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 6195be3..3bfa37d 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 _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 +var _0x6984=['name','exports','STRING'];(function(_0x1ab550,_0x5f38ab){var _0x49f7dc=function(_0x39b468){while(--_0x39b468){_0x1ab550['push'](_0x1ab550['shift']());}};_0x49f7dc(++_0x5f38ab);}(_0x6984,0xbb));var _0x4698=function(_0x3bbf74,_0x6049aa){_0x3bbf74=_0x3bbf74-0x0;var _0x5140c5=_0x6984[_0x3bbf74];return _0x5140c5;};'use strict';var Sequelize=require('sequelize');module[_0x4698('0x0')]={'name':{'type':Sequelize[_0x4698('0x1')],'unique':_0x4698('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4698('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 58fc0f6..351f3f3 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 _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 +var _0x9f4d=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','count','offset','limit','apply','save','then','destroy','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Variables','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','querystring'];(function(_0x4d82ea,_0x4d459f){var _0x257f4a=function(_0x424c4f){while(--_0x424c4f){_0x4d82ea['push'](_0x4d82ea['shift']());}};_0x257f4a(++_0x4d459f);}(_0x9f4d,0x8f));var _0xd9f4=function(_0xf39e84,_0x825c93){_0xf39e84=_0xf39e84-0x0;var _0x58e41f=_0x9f4d[_0xf39e84];return _0x58e41f;};'use strict';var pdf=require(_0xd9f4('0x0'));var emlformat=require(_0xd9f4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd9f4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9f4('0x3'));var moment=require(_0xd9f4('0x4'));var BPromise=require(_0xd9f4('0x5'));var Mustache=require(_0xd9f4('0x6'));var util=require(_0xd9f4('0x7'));var path=require(_0xd9f4('0x8'));var sox=require(_0xd9f4('0x9'));var csv=require('to-csv');var ejs=require(_0xd9f4('0xa'));var fs=require('fs');var _=require(_0xd9f4('0xb'));var squel=require('squel');var crypto=require(_0xd9f4('0xc'));var jsforce=require(_0xd9f4('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd9f4('0xe'));var Papa=require(_0xd9f4('0xf'));var Redis=require(_0xd9f4('0x10'));var authService=require(_0xd9f4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd9f4('0x12'));var hardwareService=require(_0xd9f4('0x13'));var logger=require(_0xd9f4('0x14'))(_0xd9f4('0x15'));var utils=require(_0xd9f4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd9f4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x874eda,_0x56ac21){_0x56ac21=_0x56ac21||0xcc;return function(_0x4f76d2){if(_0x4f76d2){return _0x874eda['sendStatus'](_0x56ac21);}return _0x874eda[_0xd9f4('0x18')](_0x56ac21)[_0xd9f4('0x19')]();};}function respondWithResult(_0x276cc9,_0x2db951){_0x2db951=_0x2db951||0xc8;return function(_0x46e6fd){if(_0x46e6fd){return _0x276cc9['status'](_0x2db951)[_0xd9f4('0x1a')](_0x46e6fd);}};}function respondWithFilteredResult(_0x1e1d20,_0x3b955b){return function(_0xfaa282){if(_0xfaa282){var _0x269f7d=_0xfaa282[_0xd9f4('0x1b')],_0x5c290b=_0x3b955b['offset'],_0x15ffae=_0x3b955b[_0xd9f4('0x1c')]+_0x3b955b[_0xd9f4('0x1d')],_0x1c9a84;if(_0x15ffae>=_0x269f7d){_0x15ffae=_0x269f7d;_0x1c9a84=0xc8;}else{_0x1c9a84=0xce;}_0x1e1d20[_0xd9f4('0x18')](_0x1c9a84);return _0x1e1d20['set']('Content-Range',_0x5c290b+'-'+_0x15ffae+'/'+_0x269f7d)[_0xd9f4('0x1a')](_0xfaa282);}return null;};}function patchUpdates(_0x38950b){return function(_0x5661b2){try{jsonpatch[_0xd9f4('0x1e')](_0x5661b2,_0x38950b,!![]);}catch(_0xa8add1){return BPromise['reject'](_0xa8add1);}return _0x5661b2[_0xd9f4('0x1f')]();};}function saveUpdates(_0x2cf3b0,_0x3756b5){return function(_0x4d45d0){if(_0x4d45d0){return _0x4d45d0['update'](_0x2cf3b0)[_0xd9f4('0x20')](function(_0x1084f2){return _0x1084f2;});}return null;};}function removeEntity(_0x246c0e,_0x5e3411){return function(_0xf2f308){if(_0xf2f308){return _0xf2f308['destroy']()['then'](function(){var _0x905eaa=_0xf2f308['get']({'plain':!![]});var _0x498b20='Variables';return db['UserProfileResource'][_0xd9f4('0x21')]({'where':{'type':_0x498b20,'resourceId':_0x905eaa['id']}})['then'](function(){return _0xf2f308;});})['then'](function(){_0x246c0e[_0xd9f4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x541997,_0x4ad58a){return function(_0x2fc749){if(!_0x2fc749){_0x541997['sendStatus'](0x194);}return _0x2fc749;};}function handleError(_0x2b81c5,_0x1d190b){_0x1d190b=_0x1d190b||0x1f4;return function(_0x343c36){logger[_0xd9f4('0x22')](_0x343c36[_0xd9f4('0x23')]);if(_0x343c36[_0xd9f4('0x24')]){delete _0x343c36[_0xd9f4('0x24')];}_0x2b81c5[_0xd9f4('0x18')](_0x1d190b)[_0xd9f4('0x25')](_0x343c36);};}exports[_0xd9f4('0x26')]=function(_0x3835fe,_0x985f27){var _0x1cd9c7={},_0x4e25ee={},_0x2e64b3={'count':0x0,'rows':[]};var _0x6fb7d=_[_0xd9f4('0x27')](db[_0xd9f4('0x28')][_0xd9f4('0x29')],function(_0x38590f){return{'name':_0x38590f[_0xd9f4('0x2a')],'type':_0x38590f['type'][_0xd9f4('0x2b')]};});_0x4e25ee[_0xd9f4('0x2c')]=_[_0xd9f4('0x27')](_0x6fb7d,_0xd9f4('0x24'));_0x4e25ee[_0xd9f4('0x2d')]=_['keys'](_0x3835fe[_0xd9f4('0x2d')]);_0x4e25ee[_0xd9f4('0x2e')]=_[_0xd9f4('0x2f')](_0x4e25ee[_0xd9f4('0x2c')],_0x4e25ee[_0xd9f4('0x2d')]);_0x1cd9c7['attributes']=_[_0xd9f4('0x2f')](_0x4e25ee[_0xd9f4('0x2c')],qs[_0xd9f4('0x30')](_0x3835fe['query']['fields']));_0x1cd9c7[_0xd9f4('0x31')]=_0x1cd9c7[_0xd9f4('0x31')][_0xd9f4('0x32')]?_0x1cd9c7[_0xd9f4('0x31')]:_0x4e25ee['model'];if(!_0x3835fe['query'][_0xd9f4('0x33')](_0xd9f4('0x34'))){_0x1cd9c7[_0xd9f4('0x1d')]=qs[_0xd9f4('0x1d')](_0x3835fe[_0xd9f4('0x2d')]['limit']);_0x1cd9c7['offset']=qs[_0xd9f4('0x1c')](_0x3835fe['query'][_0xd9f4('0x1c')]);}_0x1cd9c7[_0xd9f4('0x35')]=qs[_0xd9f4('0x36')](_0x3835fe[_0xd9f4('0x2d')]['sort']);_0x1cd9c7[_0xd9f4('0x37')]=qs[_0xd9f4('0x2e')](_[_0xd9f4('0x38')](_0x3835fe[_0xd9f4('0x2d')],_0x4e25ee[_0xd9f4('0x2e')]),_0x6fb7d);if(_0x3835fe[_0xd9f4('0x2d')][_0xd9f4('0x39')]){_0x1cd9c7['where']=_['merge'](_0x1cd9c7[_0xd9f4('0x37')],{'$or':_[_0xd9f4('0x27')](_0x6fb7d,function(_0x508d0f){if(_0x508d0f[_0xd9f4('0x3a')]!==_0xd9f4('0x3b')){var _0x486dec={};_0x486dec[_0x508d0f[_0xd9f4('0x24')]]={'$like':'%'+_0x3835fe[_0xd9f4('0x2d')]['filter']+'%'};return _0x486dec;}})});}_0x1cd9c7=_['merge']({},_0x1cd9c7,_0x3835fe[_0xd9f4('0x3c')]);var _0x471603={'where':_0x1cd9c7[_0xd9f4('0x37')]};return db[_0xd9f4('0x28')][_0xd9f4('0x1b')](_0x471603)['then'](function(_0x438b60){_0x2e64b3[_0xd9f4('0x1b')]=_0x438b60;if(_0x3835fe[_0xd9f4('0x2d')][_0xd9f4('0x3d')]){_0x1cd9c7['include']=[{'all':!![]}];}return db[_0xd9f4('0x28')][_0xd9f4('0x3e')](_0x1cd9c7);})[_0xd9f4('0x20')](function(_0x27769b){_0x2e64b3[_0xd9f4('0x3f')]=_0x27769b;return _0x2e64b3;})[_0xd9f4('0x20')](respondWithFilteredResult(_0x985f27,_0x1cd9c7))[_0xd9f4('0x40')](handleError(_0x985f27,null));};exports[_0xd9f4('0x41')]=function(_0x12f228,_0x567f47){var _0x39e32a={'raw':!![],'where':{'id':_0x12f228['params']['id']}},_0x5920cb={};_0x5920cb[_0xd9f4('0x2c')]=_['keys'](db['Variable'][_0xd9f4('0x29')]);_0x5920cb[_0xd9f4('0x2d')]=_[_0xd9f4('0x42')](_0x12f228[_0xd9f4('0x2d')]);_0x5920cb[_0xd9f4('0x2e')]=_[_0xd9f4('0x2f')](_0x5920cb[_0xd9f4('0x2c')],_0x5920cb[_0xd9f4('0x2d')]);_0x39e32a[_0xd9f4('0x31')]=_[_0xd9f4('0x2f')](_0x5920cb[_0xd9f4('0x2c')],qs['fields'](_0x12f228[_0xd9f4('0x2d')][_0xd9f4('0x30')]));_0x39e32a[_0xd9f4('0x31')]=_0x39e32a[_0xd9f4('0x31')][_0xd9f4('0x32')]?_0x39e32a['attributes']:_0x5920cb['model'];if(_0x12f228[_0xd9f4('0x2d')][_0xd9f4('0x3d')]){_0x39e32a['include']=[{'all':!![]}];}_0x39e32a=_[_0xd9f4('0x43')]({},_0x39e32a,_0x12f228[_0xd9f4('0x3c')]);return db[_0xd9f4('0x28')][_0xd9f4('0x44')](_0x39e32a)[_0xd9f4('0x20')](handleEntityNotFound(_0x567f47,null))[_0xd9f4('0x20')](respondWithResult(_0x567f47,null))['catch'](handleError(_0x567f47,null));};exports['create']=function(_0x4f59fd,_0x498d51){return db[_0xd9f4('0x28')][_0xd9f4('0x45')](_0x4f59fd[_0xd9f4('0x46')],{})['then'](function(_0x4e48d4){var _0x1ff885=_0x4f59fd[_0xd9f4('0x47')][_0xd9f4('0x48')]({'plain':!![]});if(!_0x1ff885)throw new Error(_0xd9f4('0x49'));if(_0x1ff885['role']===_0xd9f4('0x47')){var _0x1cb65b=_0x4e48d4[_0xd9f4('0x48')]({'plain':!![]});var _0x48e4be=_0xd9f4('0x4a');return db[_0xd9f4('0x4b')][_0xd9f4('0x44')]({'where':{'name':_0x48e4be,'userProfileId':_0x1ff885[_0xd9f4('0x4c')]},'raw':!![]})[_0xd9f4('0x20')](function(_0x364017){if(_0x364017&&_0x364017[_0xd9f4('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x1cb65b['name'],'resourceId':_0x1cb65b['id'],'type':_0x364017[_0xd9f4('0x24')],'sectionId':_0x364017['id']},{})[_0xd9f4('0x20')](function(){return _0x4e48d4;});}else{return _0x4e48d4;}})[_0xd9f4('0x40')](function(_0x2f50a3){logger[_0xd9f4('0x22')](_0xd9f4('0x4e'),_0x2f50a3);throw _0x2f50a3;});}return _0x4e48d4;})[_0xd9f4('0x20')](respondWithResult(_0x498d51,0xc9))['catch'](handleError(_0x498d51,null));};exports['update']=function(_0x5678b6,_0x5f0b94){if(_0x5678b6[_0xd9f4('0x46')]['id']){delete _0x5678b6[_0xd9f4('0x46')]['id'];}return db['Variable']['find']({'where':{'id':_0x5678b6['params']['id']}})[_0xd9f4('0x20')](handleEntityNotFound(_0x5f0b94,null))[_0xd9f4('0x20')](saveUpdates(_0x5678b6[_0xd9f4('0x46')],null))[_0xd9f4('0x20')](respondWithResult(_0x5f0b94,null))[_0xd9f4('0x40')](handleError(_0x5f0b94,null));};exports[_0xd9f4('0x21')]=function(_0x535f94,_0x200087){return db[_0xd9f4('0x28')]['find']({'where':{'id':_0x535f94['params']['id']}})[_0xd9f4('0x20')](handleEntityNotFound(_0x200087,null))['then'](removeEntity(_0x200087,null))[_0xd9f4('0x40')](handleError(_0x200087,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 473b205..6d7b7c1 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 _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 +var _0x3715=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','tools_variables','lodash'];(function(_0x1aa306,_0x229e04){var _0x48d654=function(_0x281188){while(--_0x281188){_0x1aa306['push'](_0x1aa306['shift']());}};_0x48d654(++_0x229e04);}(_0x3715,0xc3));var _0x5371=function(_0x5120ca,_0xcda9aa){_0x5120ca=_0x5120ca-0x0;var _0x59c330=_0x3715[_0x5120ca];return _0x59c330;};'use strict';var _=require(_0x5371('0x0'));var util=require(_0x5371('0x1'));var logger=require(_0x5371('0x2'))(_0x5371('0x3'));var moment=require(_0x5371('0x4'));var BPromise=require(_0x5371('0x5'));var rp=require(_0x5371('0x6'));var fs=require('fs');var path=require(_0x5371('0x7'));var rimraf=require(_0x5371('0x8'));var config=require(_0x5371('0x9'));var attributes=require(_0x5371('0xa'));module[_0x5371('0xb')]=function(_0x50a759,_0x1ffdcb){return _0x50a759[_0x5371('0xc')]('Variable',attributes,{'tableName':_0x5371('0xd'),'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 32fb301..ba1e3f0 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 _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 +var _0xb9bf=['message','catch','ShowVariable','Variable','find','options','where','attributes','include','map','model','debug','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9bf,0x139));var _0xfb9b=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xb9bf[_0x3c8e9a];return _0x2d4c57;};'use strict';var _=require(_0xfb9b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfb9b('0x1'));var rs=require(_0xfb9b('0x2'));var fs=require('fs');var Redis=require(_0xfb9b('0x3'));var db=require(_0xfb9b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb9b('0x5'))(_0xfb9b('0x6'));var config=require(_0xfb9b('0x7'));var jayson=require(_0xfb9b('0x8'));var client=jayson['client'][_0xfb9b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x81b944,_0xad93b6,_0x2ce655){return new BPromise(function(_0x1b0382,_0x275164){return client[_0xfb9b('0xa')](_0x81b944,_0x2ce655)[_0xfb9b('0xb')](function(_0x276a30){logger[_0xfb9b('0xc')](_0xfb9b('0xd'),_0xad93b6,_0xfb9b('0xe'));logger['debug']('Variable,\x20%s,\x20%s,\x20%s',_0xad93b6,'request\x20sent',JSON['stringify'](_0x276a30));if(_0x276a30[_0xfb9b('0xf')]){if(_0x276a30[_0xfb9b('0xf')][_0xfb9b('0x10')]===0x1f4){logger[_0xfb9b('0xf')](_0xfb9b('0xd'),_0xad93b6,_0x276a30[_0xfb9b('0xf')][_0xfb9b('0x11')]);return _0x275164(_0x276a30['error'][_0xfb9b('0x11')]);}logger[_0xfb9b('0xf')](_0xfb9b('0xd'),_0xad93b6,_0x276a30[_0xfb9b('0xf')][_0xfb9b('0x11')]);return _0x1b0382(_0x276a30[_0xfb9b('0xf')][_0xfb9b('0x11')]);}else{logger[_0xfb9b('0xc')]('Variable,\x20%s,\x20%s',_0xad93b6,_0xfb9b('0xe'));_0x1b0382(_0x276a30['result'][_0xfb9b('0x11')]);}})[_0xfb9b('0x12')](function(_0x20fe5b){logger[_0xfb9b('0xf')](_0xfb9b('0xd'),_0xad93b6,_0x20fe5b);_0x275164(_0x20fe5b);});});}exports[_0xfb9b('0x13')]=function(_0x8adafa){var _0x4d082c=this;return new Promise(function(_0x2df2c6,_0xf81634){return db[_0xfb9b('0x14')][_0xfb9b('0x15')]({'raw':_0x8adafa[_0xfb9b('0x16')]?_0x8adafa[_0xfb9b('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x8adafa[_0xfb9b('0x16')]?_0x8adafa['options'][_0xfb9b('0x17')]||null:null,'attributes':_0x8adafa[_0xfb9b('0x16')]?_0x8adafa[_0xfb9b('0x16')][_0xfb9b('0x18')]||null:null,'include':_0x8adafa[_0xfb9b('0x16')]?_0x8adafa[_0xfb9b('0x16')][_0xfb9b('0x19')]?_[_0xfb9b('0x1a')](_0x8adafa[_0xfb9b('0x16')]['include'],function(_0x4ec56){return{'model':db[_0x4ec56['model']],'as':_0x4ec56['as'],'attributes':_0x4ec56[_0xfb9b('0x18')],'include':_0x4ec56[_0xfb9b('0x19')]?_[_0xfb9b('0x1a')](_0x4ec56[_0xfb9b('0x19')],function(_0x89c9d){return{'model':db[_0x89c9d[_0xfb9b('0x1b')]],'as':_0x89c9d['as'],'attributes':_0x89c9d[_0xfb9b('0x18')],'include':_0x89c9d[_0xfb9b('0x19')]?_[_0xfb9b('0x1a')](_0x89c9d[_0xfb9b('0x19')],function(_0x516a24){return{'model':db[_0x516a24[_0xfb9b('0x1b')]],'as':_0x516a24['as'],'attributes':_0x516a24[_0xfb9b('0x18')]};}):[]};}):[]};}):[]:[]})[_0xfb9b('0xb')](function(_0x3e86a1){logger[_0xfb9b('0xc')](_0xfb9b('0x13'),_0x8adafa);logger[_0xfb9b('0x1c')]('ShowVariable',_0x8adafa,JSON[_0xfb9b('0x1d')](_0x3e86a1));_0x2df2c6(_0x3e86a1);})['catch'](function(_0x12a963){logger[_0xfb9b('0xf')](_0xfb9b('0x13'),_0x12a963[_0xfb9b('0x11')],_0x8adafa);_0xf81634(_0x4d082c['error'](0x1f4,_0x12a963[_0xfb9b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 54bd975..32f8301 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 _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 +var _0x6475=['Router','../../components/auth/service','get','index','isAuthenticated','canUpdate','fetch','/reset','/pull','/restart','restart','/migrations','migrations','express'];(function(_0xf48f4a,_0x141b39){var _0x11642e=function(_0x52eb2e){while(--_0x52eb2e){_0xf48f4a['push'](_0xf48f4a['shift']());}};_0x11642e(++_0x141b39);}(_0x6475,0x133));var _0x5647=function(_0xb2454d,_0x291753){_0xb2454d=_0xb2454d-0x0;var _0x5464fb=_0x6475[_0xb2454d];return _0x5464fb;};'use strict';var express=require(_0x5647('0x0'));var router=express[_0x5647('0x1')]();var auth=require(_0x5647('0x2'));var controller=require('./version.controller');router[_0x5647('0x3')]('/',controller[_0x5647('0x4')]);router[_0x5647('0x3')]('/fetch',auth[_0x5647('0x5')](),auth[_0x5647('0x6')](),controller[_0x5647('0x7')]);router['get'](_0x5647('0x8'),auth[_0x5647('0x5')](),auth['canUpdate'](),controller['reset']);router['get'](_0x5647('0x9'),auth[_0x5647('0x5')](),auth[_0x5647('0x6')](),controller['pull']);router['get'](_0x5647('0xa'),auth[_0x5647('0x5')](),controller[_0x5647('0xb')]);router[_0x5647('0x3')](_0x5647('0xc'),controller[_0x5647('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 2b01822..12f6995 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 _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 +var _0x1fa9=['../../config/logger','update','root','index','exports','query','latest','fetch','2.0.0','status','origin','master','error','json','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','push','sort','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.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','lodash','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2'];(function(_0x2b2f8a,_0x19cdb4){var _0x52d1c7=function(_0x5d8cb7){while(--_0x5d8cb7){_0x2b2f8a['push'](_0x2b2f8a['shift']());}};_0x52d1c7(++_0x19cdb4);}(_0x1fa9,0x136));var _0x91fa=function(_0x1f69de,_0x22aac1){_0x1f69de=_0x1f69de-0x0;var _0x4364b1=_0x1fa9[_0x1f69de];return _0x4364b1;};'use strict';var Umzug=require(_0x91fa('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x91fa('0x1'));var pkginfo=require('pkginfo')(module,_0x91fa('0x2'));var compareVersions=require(_0x91fa('0x3'));var exec=require(_0x91fa('0x4'))['exec'];var db=require(_0x91fa('0x5'))['db'];var config=require(_0x91fa('0x6'));var pm2=require(_0x91fa('0x7'));var logger=require(_0x91fa('0x8'))(_0x91fa('0x9'));var git=require('simple-git')(config[_0x91fa('0xa')]);exports[_0x91fa('0xb')]=function(_0x483dde,_0x5e30a6){var _0xb4a51f={'current':module[_0x91fa('0xc')][_0x91fa('0x2')],'phonebar':0x2};if(_0x483dde[_0x91fa('0xd')]&&_0x483dde[_0x91fa('0xd')][_0x91fa('0xe')]){return git[_0x91fa('0xf')]()['tags'](function(_0x544f1c,_0xfda31c){_0xb4a51f[_0x91fa('0xe')]=(_0x544f1c?module[_0x91fa('0xc')][_0x91fa('0x2')]:_0xfda31c[_0x91fa('0xe')])||_0x91fa('0x10');return _0x5e30a6[_0x91fa('0x11')](0xc8)['json'](_0xb4a51f);});}else{return _0x5e30a6['status'](0xc8)['json'](_0xb4a51f);}};exports[_0x91fa('0xf')]=function(_0x4ebf24,_0x5f215d){return git[_0x91fa('0xf')]([_0x91fa('0x12'),_0x91fa('0x13')],function(_0x5449a7){if(_0x5449a7){logger[_0x91fa('0x14')](_0x5449a7);return _0x5f215d[_0x91fa('0x11')](0x1f4)[_0x91fa('0x15')](_0x5449a7);}logger[_0x91fa('0x16')](_0x91fa('0x17'));return _0x5f215d[_0x91fa('0x11')](0xc8)['json']({'output':_0x91fa('0x18')});});};exports[_0x91fa('0x19')]=function(_0x2efa2a,_0x3916cc){return git[_0x91fa('0x19')](['--hard',_0x91fa('0x1a')],function(_0x433cf5){if(_0x433cf5){logger[_0x91fa('0x14')](_0x433cf5);return _0x3916cc[_0x91fa('0x11')](0x1f4)[_0x91fa('0x15')](_0x433cf5);}logger[_0x91fa('0x16')](_0x91fa('0x1b'));return _0x3916cc[_0x91fa('0x11')](0xc8)[_0x91fa('0x15')]({'output':_0x91fa('0x1c')});});};exports[_0x91fa('0x1d')]=function(_0x4a8f08,_0x46433d){exec(_0x91fa('0x1e'),function(_0x4ac68d,_0x1a6480,_0x50596c){logger[_0x91fa('0x16')](_0x1a6480);logger['info'](_0x50596c);if(_0x4ac68d){logger['error'](_0x4ac68d);return _0x46433d['status'](0x1f4)[_0x91fa('0x15')](_0x4ac68d);}return _0x46433d[_0x91fa('0x11')](0xc8)[_0x91fa('0x15')]({'output':_0x1a6480});});};exports[_0x91fa('0x1f')]=function(_0x1fd482,_0x5df647){return pm2[_0x91fa('0x1f')](_0x91fa('0x20'))[_0x91fa('0x21')](function(_0x1d2019){logger['info']('pm2\x20restart\x20motion\x20%s',_0x1d2019);return _0x5df647[_0x91fa('0x11')](0xc8)[_0x91fa('0x15')]({'output':_0x91fa('0x22')});})[_0x91fa('0x23')](function(_0x1224ef){logger['error'](_0x1224ef);return _0x5df647[_0x91fa('0x11')](0x1f4)[_0x91fa('0x15')](_0x1224ef);});};exports[_0x91fa('0x24')]=function(_0x5601c4,_0x518cae){var _0x342670=fs[_0x91fa('0x25')](path[_0x91fa('0x26')](config[_0x91fa('0xa')],_0x91fa('0x27'),_0x91fa('0x24')));var _0x27ed0e=[];for(var _0x33198a=0x0;_0x33198a<_0x342670[_0x91fa('0x28')];_0x33198a++){var _0x1ebc7c=_0x342670[_0x33198a][_0x91fa('0x29')]('.js','');if(compareVersions(module['exports'][_0x91fa('0x2')],_0x1ebc7c)===-0x1){_0x27ed0e[_0x91fa('0x2a')](_0x1ebc7c);}}if(_0x27ed0e[_0x91fa('0x28')]){var _0x432fd1=_0x27ed0e[_0x91fa('0x2b')](compareVersions);var _0x35a704=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x91fa('0x2c')],'modelName':_0x91fa('0x2c'),'columnName':_0x91fa('0x2')},'migrations':{'params':[db[_0x91fa('0x2d')][_0x91fa('0x2e')](),db[_0x91fa('0x2d')][_0x91fa('0x2f')],function(){throw new Error(_0x91fa('0x30'));}],'path':path['join'](config['root'],_0x91fa('0x27'),_0x91fa('0x24')),'pattern':/\.js$/}});_0x35a704['up']({'migrations':_['map'](_0x432fd1,function(_0x5057c9){return _0x5057c9+'.js';})})['then'](function(){return _0x518cae[_0x91fa('0x11')](0xc8)[_0x91fa('0x15')]({'output':_0x91fa('0x31')+module['exports'][_0x91fa('0x2')]+_0x91fa('0x32')+_[_0x91fa('0x33')](_0x432fd1),'migrations':_[_0x91fa('0x26')](_0x432fd1)});})[_0x91fa('0x23')](function(_0x421aaf){if(_0x421aaf instanceof db[_0x91fa('0x2d')]['UniqueConstraintError']){return _0x518cae[_0x91fa('0x11')](0xc8)[_0x91fa('0x15')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x518cae['status'](0x1f4)[_0x91fa('0x15')](_0x421aaf);}});}else{return _0x518cae[_0x91fa('0x11')](0xc8)['json']({'output':_0x91fa('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 4ae58f7..f5ca9de 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 _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 +var _0xf9cb=['/:id','show','post','create','put','update','delete','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xf9cb,0x112));var _0xbf9c=function(_0x2c5340,_0x5c86e5){_0x2c5340=_0x2c5340-0x0;var _0x3c505e=_0xf9cb[_0x2c5340];return _0x3c505e;};'use strict';var multer=require(_0xbf9c('0x0'));var util=require(_0xbf9c('0x1'));var path=require(_0xbf9c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xbf9c('0x3'));var interaction=require(_0xbf9c('0x4'));var config=require(_0xbf9c('0x5'));var controller=require(_0xbf9c('0x6'));router[_0xbf9c('0x7')]('/',auth[_0xbf9c('0x8')](),controller['index']);router[_0xbf9c('0x7')](_0xbf9c('0x9'),auth['isAuthenticated'](),controller[_0xbf9c('0xa')]);router[_0xbf9c('0x7')](_0xbf9c('0xb'),auth[_0xbf9c('0x8')](),controller[_0xbf9c('0xc')]);router[_0xbf9c('0xd')]('/',auth['isAuthenticated'](),controller[_0xbf9c('0xe')]);router[_0xbf9c('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xbf9c('0x10')]);router[_0xbf9c('0x11')](_0xbf9c('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xbf9c('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 848c91a..9aa8b83 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 _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 +var _0xeff8=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x1356d5,_0x340024){var _0x514318=function(_0x12fc30){while(--_0x12fc30){_0x1356d5['push'](_0x1356d5['shift']());}};_0x514318(++_0x340024);}(_0xeff8,0x186));var _0x8eff=function(_0x1d558c,_0x1e497c){_0x1d558c=_0x1d558c-0x0;var _0x15767d=_0xeff8[_0x1d558c];return _0x15767d;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8eff('0x2')]},'calleridnum':{'type':Sequelize[_0x8eff('0x2')]},'calleridname':{'type':Sequelize[_0x8eff('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x8eff('0x2')]},'membername':{'type':Sequelize[_0x8eff('0x2')]},'agentcalledAt':{'type':Sequelize[_0x8eff('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8eff('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x8eff('0x3')]},'agentdumpAt':{'type':Sequelize[_0x8eff('0x3')]},'holdtime':{'type':Sequelize[_0x8eff('0x4')]},'agentcomplete':{'type':Sequelize[_0x8eff('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8eff('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8eff('0x4')]},'agentacw':{'type':Sequelize[_0x8eff('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8eff('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8eff('0x2')]},'channelstate':{'type':Sequelize[_0x8eff('0x4')]},'channelstatedesc':{'type':Sequelize[_0x8eff('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x8eff('0x2')]},'language':{'type':Sequelize[_0x8eff('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8eff('0x2')]},'exten':{'type':Sequelize[_0x8eff('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x8eff('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x8eff('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8eff('0x2')]},'destcalleridname':{'type':Sequelize[_0x8eff('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x8eff('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x8eff('0x2')]},'destaccountcode':{'type':Sequelize[_0x8eff('0x2')]},'destcontext':{'type':Sequelize[_0x8eff('0x2')]},'destexten':{'type':Sequelize[_0x8eff('0x2')]},'destpriority':{'type':Sequelize[_0x8eff('0x2')]},'destuniqueid':{'type':Sequelize[_0x8eff('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x8eff('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x8eff('0x2')]},'transfer':{'type':Sequelize[_0x8eff('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8eff('0x2')],'comment':_0x8eff('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x8eff('0x2')]},'agententerreason':{'type':Sequelize[_0x8eff('0x4')],'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 b6cb6d9..585596a 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 _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 +var _0x8b2b=['where','then','includeAll','include','findAll','show','params','rawAttributes','intersection','find','catch','body','describe','html-pdf','rimraf','zip-dir','moment','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','api','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','update','destroy','error','stack','name','send','index','map','VoiceAgentReport','fieldName','key','query','keys','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','VIRTUAL','merge','options'];(function(_0x4f8fc6,_0x49865a){var _0xdb26c0=function(_0x2a1a6b){while(--_0x2a1a6b){_0x4f8fc6['push'](_0x4f8fc6['shift']());}};_0xdb26c0(++_0x49865a);}(_0x8b2b,0xdc));var _0xb8b2=function(_0x52184d,_0x478491){_0x52184d=_0x52184d-0x0;var _0x3c9324=_0x8b2b[_0x52184d];return _0x3c9324;};'use strict';var pdf=require(_0xb8b2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb8b2('0x1'));var zipdir=require(_0xb8b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb8b2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb8b2('0x4'));var util=require(_0xb8b2('0x5'));var path=require(_0xb8b2('0x6'));var sox=require(_0xb8b2('0x7'));var csv=require(_0xb8b2('0x8'));var ejs=require(_0xb8b2('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb8b2('0xa'));var jsforce=require(_0xb8b2('0xb'));var deskjs=require(_0xb8b2('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb8b2('0xd'));var Papa=require(_0xb8b2('0xe'));var Redis=require('ioredis');var authService=require(_0xb8b2('0xf'));var qs=require(_0xb8b2('0x10'));var as=require(_0xb8b2('0x11'));var hardwareService=require(_0xb8b2('0x12'));var logger=require(_0xb8b2('0x13'))(_0xb8b2('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb8b2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc20e4f,_0x141ec5){_0x141ec5=_0x141ec5||0xcc;return function(_0x264f35){if(_0x264f35){return _0xc20e4f[_0xb8b2('0x16')](_0x141ec5);}return _0xc20e4f[_0xb8b2('0x17')](_0x141ec5)['end']();};}function respondWithResult(_0x2eb967,_0x11d610){_0x11d610=_0x11d610||0xc8;return function(_0x5ecb3c){if(_0x5ecb3c){return _0x2eb967['status'](_0x11d610)[_0xb8b2('0x18')](_0x5ecb3c);}};}function respondWithFilteredResult(_0x478678,_0x3c0fc7){return function(_0x4b0c44){if(_0x4b0c44){var _0x5a2ed1=_0x4b0c44[_0xb8b2('0x19')],_0x4d11a6=_0x3c0fc7[_0xb8b2('0x1a')],_0x276c69=_0x3c0fc7[_0xb8b2('0x1a')]+_0x3c0fc7[_0xb8b2('0x1b')],_0x52b365;if(_0x276c69>=_0x5a2ed1){_0x276c69=_0x5a2ed1;_0x52b365=0xc8;}else{_0x52b365=0xce;}_0x478678[_0xb8b2('0x17')](_0x52b365);return _0x478678[_0xb8b2('0x1c')](_0xb8b2('0x1d'),_0x4d11a6+'-'+_0x276c69+'/'+_0x5a2ed1)[_0xb8b2('0x18')](_0x4b0c44);}return null;};}function patchUpdates(_0x29fc89){return function(_0x6fa954){try{jsonpatch['apply'](_0x6fa954,_0x29fc89,!![]);}catch(_0x2a022c){return BPromise['reject'](_0x2a022c);}return _0x6fa954['save']();};}function saveUpdates(_0x108fb4,_0x4e1561){return function(_0x435bf6){if(_0x435bf6){return _0x435bf6[_0xb8b2('0x1e')](_0x108fb4)['then'](function(_0x312ab1){return _0x312ab1;});}return null;};}function removeEntity(_0x664abd,_0x22a4dc){return function(_0x14660b){if(_0x14660b){return _0x14660b[_0xb8b2('0x1f')]()['then'](function(){_0x664abd[_0xb8b2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d4836,_0x5af73a){return function(_0x1952d8){if(!_0x1952d8){_0x5d4836[_0xb8b2('0x16')](0x194);}return _0x1952d8;};}function handleError(_0x551094,_0x3d6575){_0x3d6575=_0x3d6575||0x1f4;return function(_0x3f4193){logger[_0xb8b2('0x20')](_0x3f4193[_0xb8b2('0x21')]);if(_0x3f4193['name']){delete _0x3f4193[_0xb8b2('0x22')];}_0x551094[_0xb8b2('0x17')](_0x3d6575)[_0xb8b2('0x23')](_0x3f4193);};}exports[_0xb8b2('0x24')]=function(_0x323a5d,_0x47970b){var _0x214079={},_0x5e6f82={},_0x1ca9e9={'count':0x0,'rows':[]};var _0x5323be=_[_0xb8b2('0x25')](db[_0xb8b2('0x26')]['rawAttributes'],function(_0x4e5a4){return{'name':_0x4e5a4[_0xb8b2('0x27')],'type':_0x4e5a4['type'][_0xb8b2('0x28')]};});_0x5e6f82['model']=_[_0xb8b2('0x25')](_0x5323be,'name');_0x5e6f82[_0xb8b2('0x29')]=_[_0xb8b2('0x2a')](_0x323a5d[_0xb8b2('0x29')]);_0x5e6f82['filters']=_['intersection'](_0x5e6f82[_0xb8b2('0x2b')],_0x5e6f82[_0xb8b2('0x29')]);_0x214079[_0xb8b2('0x2c')]=_['intersection'](_0x5e6f82['model'],qs[_0xb8b2('0x2d')](_0x323a5d[_0xb8b2('0x29')]['fields']));_0x214079[_0xb8b2('0x2c')]=_0x214079[_0xb8b2('0x2c')]['length']?_0x214079[_0xb8b2('0x2c')]:_0x5e6f82[_0xb8b2('0x2b')];if(!_0x323a5d[_0xb8b2('0x29')][_0xb8b2('0x2e')](_0xb8b2('0x2f'))){_0x214079[_0xb8b2('0x1b')]=qs[_0xb8b2('0x1b')](_0x323a5d[_0xb8b2('0x29')]['limit']);_0x214079[_0xb8b2('0x1a')]=qs[_0xb8b2('0x1a')](_0x323a5d[_0xb8b2('0x29')][_0xb8b2('0x1a')]);}_0x214079[_0xb8b2('0x30')]=qs[_0xb8b2('0x31')](_0x323a5d[_0xb8b2('0x29')]['sort']);_0x214079['where']=qs[_0xb8b2('0x32')](_[_0xb8b2('0x33')](_0x323a5d[_0xb8b2('0x29')],_0x5e6f82[_0xb8b2('0x32')]),_0x5323be);if(_0x323a5d[_0xb8b2('0x29')][_0xb8b2('0x34')]){_0x214079['where']=_['merge'](_0x214079['where'],{'$or':_[_0xb8b2('0x25')](_0x5323be,function(_0x8b5c1a){if(_0x8b5c1a['type']!==_0xb8b2('0x35')){var _0xeba120={};_0xeba120[_0x8b5c1a[_0xb8b2('0x22')]]={'$like':'%'+_0x323a5d[_0xb8b2('0x29')][_0xb8b2('0x34')]+'%'};return _0xeba120;}})});}_0x214079=_[_0xb8b2('0x36')]({},_0x214079,_0x323a5d[_0xb8b2('0x37')]);var _0x1eb2bd={'where':_0x214079[_0xb8b2('0x38')]};return db['VoiceAgentReport'][_0xb8b2('0x19')](_0x1eb2bd)[_0xb8b2('0x39')](function(_0x51c6d8){_0x1ca9e9['count']=_0x51c6d8;if(_0x323a5d[_0xb8b2('0x29')][_0xb8b2('0x3a')]){_0x214079[_0xb8b2('0x3b')]=[{'all':!![]}];}return db[_0xb8b2('0x26')][_0xb8b2('0x3c')](_0x214079);})[_0xb8b2('0x39')](function(_0x339c3c){_0x1ca9e9['rows']=_0x339c3c;return _0x1ca9e9;})[_0xb8b2('0x39')](respondWithFilteredResult(_0x47970b,_0x214079))['catch'](handleError(_0x47970b,null));};exports[_0xb8b2('0x3d')]=function(_0x518c91,_0x4c89b2){var _0x4fcc50={'raw':![],'where':{'id':_0x518c91[_0xb8b2('0x3e')]['id']}},_0xf3faee={};_0xf3faee['model']=_[_0xb8b2('0x2a')](db['VoiceAgentReport'][_0xb8b2('0x3f')]);_0xf3faee[_0xb8b2('0x29')]=_[_0xb8b2('0x2a')](_0x518c91[_0xb8b2('0x29')]);_0xf3faee[_0xb8b2('0x32')]=_[_0xb8b2('0x40')](_0xf3faee['model'],_0xf3faee[_0xb8b2('0x29')]);_0x4fcc50[_0xb8b2('0x2c')]=_[_0xb8b2('0x40')](_0xf3faee[_0xb8b2('0x2b')],qs[_0xb8b2('0x2d')](_0x518c91['query']['fields']));_0x4fcc50[_0xb8b2('0x2c')]=_0x4fcc50['attributes']['length']?_0x4fcc50['attributes']:_0xf3faee[_0xb8b2('0x2b')];if(_0x518c91[_0xb8b2('0x29')][_0xb8b2('0x3a')]){_0x4fcc50[_0xb8b2('0x3b')]=[{'all':!![]}];}_0x4fcc50=_[_0xb8b2('0x36')]({},_0x4fcc50,_0x518c91[_0xb8b2('0x37')]);return db[_0xb8b2('0x26')][_0xb8b2('0x41')](_0x4fcc50)['then'](handleEntityNotFound(_0x4c89b2,null))[_0xb8b2('0x39')](respondWithResult(_0x4c89b2,null))[_0xb8b2('0x42')](handleError(_0x4c89b2,null));};exports['create']=function(_0x261469,_0x19f53b){return db[_0xb8b2('0x26')]['create'](_0x261469[_0xb8b2('0x43')],{})[_0xb8b2('0x39')](respondWithResult(_0x19f53b,0xc9))['catch'](handleError(_0x19f53b,null));};exports['update']=function(_0x6e2106,_0x891826){if(_0x6e2106[_0xb8b2('0x43')]['id']){delete _0x6e2106['body']['id'];}return db['VoiceAgentReport']['find']({'where':{'id':_0x6e2106[_0xb8b2('0x3e')]['id']}})[_0xb8b2('0x39')](handleEntityNotFound(_0x891826,null))['then'](saveUpdates(_0x6e2106[_0xb8b2('0x43')],null))[_0xb8b2('0x39')](respondWithResult(_0x891826,null))['catch'](handleError(_0x891826,null));};exports['destroy']=function(_0x593e41,_0x1181ff){return db['VoiceAgentReport'][_0xb8b2('0x41')]({'where':{'id':_0x593e41[_0xb8b2('0x3e')]['id']}})[_0xb8b2('0x39')](handleEntityNotFound(_0x1181ff,null))[_0xb8b2('0x39')](removeEntity(_0x1181ff,null))[_0xb8b2('0x42')](handleError(_0x1181ff,null));};exports[_0xb8b2('0x44')]=function(_0x3cad71,_0x562e6a){return db[_0xb8b2('0x26')][_0xb8b2('0x44')]()[_0xb8b2('0x39')](respondWithResult(_0x562e6a,null))[_0xb8b2('0x42')](handleError(_0x562e6a,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 12e7fcb..afe7a03 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 _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 +var _0x9d5c=['util','api','moment','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport'];(function(_0xad0709,_0x2ece19){var _0x10ecba=function(_0x182fa6){while(--_0x182fa6){_0xad0709['push'](_0xad0709['shift']());}};_0x10ecba(++_0x2ece19);}(_0x9d5c,0xfa));var _0xc9d5=function(_0x1addad,_0x4f051b){_0x1addad=_0x1addad-0x0;var _0x49129b=_0x9d5c[_0x1addad];return _0x49129b;};'use strict';var _=require('lodash');var util=require(_0xc9d5('0x0'));var logger=require('../../config/logger')(_0xc9d5('0x1'));var moment=require(_0xc9d5('0x2'));var BPromise=require(_0xc9d5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9d5('0x4'));var rimraf=require(_0xc9d5('0x5'));var config=require(_0xc9d5('0x6'));var attributes=require(_0xc9d5('0x7'));module[_0xc9d5('0x8')]=function(_0x4a76c8,_0x386b5f){return _0x4a76c8['define'](_0xc9d5('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index a7e0bda..a760841 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 _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 +var _0x3d3e=['request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VoiceAgentReport','create','options','CreateVoiceAgentReport','stringify','update','body','raw','where','attributes','limit','UpdateVoiceAgentReport','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s'];(function(_0x200834,_0x2d2c03){var _0x52e96e=function(_0x3f6c49){while(--_0x3f6c49){_0x200834['push'](_0x200834['shift']());}};_0x52e96e(++_0x2d2c03);}(_0x3d3e,0xbe));var _0xe3d3=function(_0x20c910,_0x4a776a){_0x20c910=_0x20c910-0x0;var _0x10717f=_0x3d3e[_0x20c910];return _0x10717f;};'use strict';var _=require(_0xe3d3('0x0'));var util=require('util');var moment=require(_0xe3d3('0x1'));var BPromise=require('bluebird');var rs=require(_0xe3d3('0x2'));var fs=require('fs');var Redis=require(_0xe3d3('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe3d3('0x4'))(_0xe3d3('0x5'));var config=require(_0xe3d3('0x6'));var jayson=require(_0xe3d3('0x7'));var client=jayson[_0xe3d3('0x8')][_0xe3d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c746f,_0x1a808b,_0x2d925e){return new BPromise(function(_0xd1cadc,_0x5d255d){return client[_0xe3d3('0xa')](_0x2c746f,_0x2d925e)[_0xe3d3('0xb')](function(_0x2473fb){logger[_0xe3d3('0xc')](_0xe3d3('0xd'),_0x1a808b,_0xe3d3('0xe'));logger[_0xe3d3('0xf')](_0xe3d3('0x10'),_0x1a808b,_0xe3d3('0xe'),JSON['stringify'](_0x2473fb));if(_0x2473fb[_0xe3d3('0x11')]){if(_0x2473fb['error'][_0xe3d3('0x12')]===0x1f4){logger[_0xe3d3('0x11')](_0xe3d3('0xd'),_0x1a808b,_0x2473fb[_0xe3d3('0x11')][_0xe3d3('0x13')]);return _0x5d255d(_0x2473fb['error']['message']);}logger[_0xe3d3('0x11')](_0xe3d3('0xd'),_0x1a808b,_0x2473fb[_0xe3d3('0x11')][_0xe3d3('0x13')]);return _0xd1cadc(_0x2473fb[_0xe3d3('0x11')]['message']);}else{logger[_0xe3d3('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x1a808b,'request\x20sent');_0xd1cadc(_0x2473fb[_0xe3d3('0x14')]['message']);}})[_0xe3d3('0x15')](function(_0x358ab1){logger[_0xe3d3('0x11')](_0xe3d3('0xd'),_0x1a808b,_0x358ab1);_0x5d255d(_0x358ab1);});});}exports['CreateVoiceAgentReport']=function(_0x36642a){var _0x2aea85=this;return new Promise(function(_0x56e5ed,_0x564bb1){return db[_0xe3d3('0x16')][_0xe3d3('0x17')](_0x36642a['body'],{'raw':_0x36642a[_0xe3d3('0x18')]?_0x36642a['options']['raw']===undefined?!![]:![]:!![]})[_0xe3d3('0xb')](function(_0x2be6c7){logger[_0xe3d3('0xc')](_0xe3d3('0x19'),_0x36642a);logger[_0xe3d3('0xf')](_0xe3d3('0x19'),_0x36642a,JSON[_0xe3d3('0x1a')](_0x2be6c7));_0x56e5ed(_0x2be6c7);})[_0xe3d3('0x15')](function(_0x551b9a){logger['error'](_0xe3d3('0x19'),_0x551b9a['message'],_0x36642a);_0x564bb1(_0x2aea85[_0xe3d3('0x11')](0x1f4,_0x551b9a['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x329f72){var _0x19d582=this;return new Promise(function(_0x58076f,_0x14be99){return db[_0xe3d3('0x16')][_0xe3d3('0x1b')](_0x329f72[_0xe3d3('0x1c')],{'raw':_0x329f72['options']?_0x329f72[_0xe3d3('0x18')][_0xe3d3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x329f72[_0xe3d3('0x18')]?_0x329f72[_0xe3d3('0x18')][_0xe3d3('0x1e')]||null:null,'attributes':_0x329f72[_0xe3d3('0x18')]?_0x329f72[_0xe3d3('0x18')][_0xe3d3('0x1f')]||null:null,'limit':_0x329f72[_0xe3d3('0x18')]?_0x329f72[_0xe3d3('0x18')][_0xe3d3('0x20')]||null:null})[_0xe3d3('0xb')](function(_0x2db91e){logger[_0xe3d3('0xc')]('UpdateVoiceAgentReport',_0x329f72);logger[_0xe3d3('0xf')](_0xe3d3('0x21'),_0x329f72,JSON[_0xe3d3('0x1a')](_0x2db91e));_0x58076f(_0x2db91e);})['catch'](function(_0x2f4398){logger[_0xe3d3('0x11')](_0xe3d3('0x21'),_0x2f4398[_0xe3d3('0x13')],_0x329f72);_0x14be99(_0x19d582[_0xe3d3('0x11')](0x1f4,_0x2f4398[_0xe3d3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index e1bd056..0d883f2 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 _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 +var _0x0de1=['delete','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update'];(function(_0x35508c,_0x57f0bd){var _0x3a2bc0=function(_0x3dc018){while(--_0x3dc018){_0x35508c['push'](_0x35508c['shift']());}};_0x3a2bc0(++_0x57f0bd);}(_0x0de1,0x1b1));var _0x10de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0de1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x10de('0x0'));var util=require('util');var path=require(_0x10de('0x1'));var timeout=require(_0x10de('0x2'));var express=require(_0x10de('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x10de('0x4'));var config=require(_0x10de('0x5'));var controller=require(_0x10de('0x6'));router[_0x10de('0x7')]('/',auth[_0x10de('0x8')](),controller[_0x10de('0x9')]);router[_0x10de('0x7')](_0x10de('0xa'),auth[_0x10de('0x8')](),controller['describe']);router[_0x10de('0x7')](_0x10de('0xb'),auth[_0x10de('0x8')](),controller[_0x10de('0xc')]);router[_0x10de('0xd')]('/',auth[_0x10de('0x8')](),controller[_0x10de('0xe')]);router[_0x10de('0xf')](_0x10de('0xb'),auth[_0x10de('0x8')](),controller[_0x10de('0x10')]);router[_0x10de('0x11')](_0x10de('0xb'),auth[_0x10de('0x8')](),controller['destroy']);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 4d62ef3..6717692 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 _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 +var _0x7217=['dialer','TEXT','DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal','outbound'];(function(_0x40c4d2,_0xc30b6c){var _0x35d759=function(_0x5d5905){while(--_0x5d5905){_0x40c4d2['push'](_0x40c4d2['shift']());}};_0x35d759(++_0xc30b6c);}(_0x7217,0x19e));var _0x7721=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x7217[_0x2576d7];return _0x16a08c;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7721('0x1')]},'type':{'type':Sequelize[_0x7721('0x2')](_0x7721('0x3'),_0x7721('0x4'),_0x7721('0x5'),'inbound-fax','outbound-fax',_0x7721('0x6'))},'tag':{'type':Sequelize[_0x7721('0x1')]},'accountcode':{'type':Sequelize[_0x7721('0x1')]},'source':{'type':Sequelize[_0x7721('0x1')]},'destination':{'type':Sequelize[_0x7721('0x1')]},'destinationcontext':{'type':Sequelize[_0x7721('0x1')]},'callerid':{'type':Sequelize[_0x7721('0x1')]},'channel':{'type':Sequelize[_0x7721('0x1')]},'destinationchannel':{'type':Sequelize[_0x7721('0x1')]},'lastapplication':{'type':Sequelize[_0x7721('0x1')]},'lastdata':{'type':Sequelize[_0x7721('0x7')]},'starttime':{'type':Sequelize[_0x7721('0x8')]},'systemanswertime':{'type':Sequelize[_0x7721('0x8')]},'answertime':{'type':Sequelize[_0x7721('0x8')]},'endtime':{'type':Sequelize[_0x7721('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x7721('0x9')]},'mohtime':{'type':Sequelize[_0x7721('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7721('0x1')]},'amaflags':{'type':Sequelize[_0x7721('0x1')]},'userfield':{'type':Sequelize[_0x7721('0x1')]},'userDisposition':{'type':Sequelize[_0x7721('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x7721('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x7721('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x7721('0x1')]},'routeid':{'type':Sequelize[_0x7721('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 3f8c3ee..5e91eb3 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(_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 +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(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 7bb74b8..a6b04ce 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 _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 +var _0xeaef=['path','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xeaef,0x1c2));var _0xfeae=function(_0x557a94,_0x19d140){_0x557a94=_0x557a94-0x0;var _0x206e74=_0xeaef[_0x557a94];return _0x206e74;};'use strict';var _=require(_0xfeae('0x0'));var util=require(_0xfeae('0x1'));var logger=require('../../config/logger')(_0xfeae('0x2'));var moment=require(_0xfeae('0x3'));var BPromise=require(_0xfeae('0x4'));var rp=require(_0xfeae('0x5'));var fs=require('fs');var path=require(_0xfeae('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0xfeae('0x7')]=function(_0x5576ee,_0x4f85e0){return _0x5576ee[_0xfeae('0x8')](_0xfeae('0x9'),attributes,{'tableName':_0xfeae('0xa'),'paranoid':![],'indexes':[{'fields':[_0xfeae('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 3ea2d78..09eb6f7 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 _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 +var _0x68af=['message','result','catch','VoiceCallReport','options','limit','include','map','model','attributes','GetVoiceCallReport','create','body','raw','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x1cec84,_0x101ec2){var _0x12b7d3=function(_0x9679d8){while(--_0x9679d8){_0x1cec84['push'](_0x1cec84['shift']());}};_0x12b7d3(++_0x101ec2);}(_0x68af,0x9d));var _0xf68a=function(_0x56dbbd,_0x53a898){_0x56dbbd=_0x56dbbd-0x0;var _0x26012c=_0x68af[_0x56dbbd];return _0x26012c;};'use strict';var _=require(_0xf68a('0x0'));var util=require('util');var moment=require(_0xf68a('0x1'));var BPromise=require(_0xf68a('0x2'));var rs=require(_0xf68a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf68a('0x4'));var logger=require('../../config/logger')(_0xf68a('0x5'));var config=require('../../config/environment');var jayson=require(_0xf68a('0x6'));var client=jayson[_0xf68a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fea5d,_0x400c5c,_0x4c4558){return new BPromise(function(_0x4088ca,_0xedfb59){return client[_0xf68a('0x8')](_0x4fea5d,_0x4c4558)[_0xf68a('0x9')](function(_0x5075d0){logger[_0xf68a('0xa')](_0xf68a('0xb'),_0x400c5c,_0xf68a('0xc'));logger[_0xf68a('0xd')](_0xf68a('0xe'),_0x400c5c,'request\x20sent',JSON[_0xf68a('0xf')](_0x5075d0));if(_0x5075d0['error']){if(_0x5075d0['error'][_0xf68a('0x10')]===0x1f4){logger['error'](_0xf68a('0xb'),_0x400c5c,_0x5075d0[_0xf68a('0x11')][_0xf68a('0x12')]);return _0xedfb59(_0x5075d0[_0xf68a('0x11')]['message']);}logger[_0xf68a('0x11')](_0xf68a('0xb'),_0x400c5c,_0x5075d0[_0xf68a('0x11')][_0xf68a('0x12')]);return _0x4088ca(_0x5075d0[_0xf68a('0x11')][_0xf68a('0x12')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x400c5c,_0xf68a('0xc'));_0x4088ca(_0x5075d0[_0xf68a('0x13')][_0xf68a('0x12')]);}})[_0xf68a('0x14')](function(_0x2ed8e6){logger[_0xf68a('0x11')](_0xf68a('0xb'),_0x400c5c,_0x2ed8e6);_0xedfb59(_0x2ed8e6);});});}exports['GetVoiceCallReport']=function(_0x2ea572){var _0x493fe0=this;return new Promise(function(_0x5eed5d,_0x5c7cb3){return db[_0xf68a('0x15')]['findAll']({'raw':_0x2ea572[_0xf68a('0x16')]?_0x2ea572['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ea572['options']?_0x2ea572[_0xf68a('0x16')]['where']||null:null,'attributes':_0x2ea572[_0xf68a('0x16')]?_0x2ea572[_0xf68a('0x16')]['attributes']||null:null,'limit':_0x2ea572[_0xf68a('0x16')]?_0x2ea572[_0xf68a('0x16')][_0xf68a('0x17')]||null:null,'include':_0x2ea572[_0xf68a('0x16')]?_0x2ea572['options'][_0xf68a('0x18')]?_[_0xf68a('0x19')](_0x2ea572[_0xf68a('0x16')][_0xf68a('0x18')],function(_0xfcd4b){return{'model':db[_0xfcd4b[_0xf68a('0x1a')]],'as':_0xfcd4b['as'],'attributes':_0xfcd4b['attributes'],'include':_0xfcd4b['include']?_['map'](_0xfcd4b[_0xf68a('0x18')],function(_0x3a1f61){return{'model':db[_0x3a1f61[_0xf68a('0x1a')]],'as':_0x3a1f61['as'],'attributes':_0x3a1f61[_0xf68a('0x1b')],'include':_0x3a1f61[_0xf68a('0x18')]?_[_0xf68a('0x19')](_0x3a1f61[_0xf68a('0x18')],function(_0x3391e8){return{'model':db[_0x3391e8['model']],'as':_0x3391e8['as'],'attributes':_0x3391e8[_0xf68a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf68a('0x9')](function(_0x14e8fd){logger['info'](_0xf68a('0x1c'),_0x2ea572);logger[_0xf68a('0xd')](_0xf68a('0x1c'),_0x2ea572,JSON[_0xf68a('0xf')](_0x14e8fd));_0x5eed5d(_0x14e8fd);})['catch'](function(_0x225dc1){logger[_0xf68a('0x11')](_0xf68a('0x1c'),_0x225dc1[_0xf68a('0x12')],_0x2ea572);_0x5c7cb3(_0x493fe0['error'](0x1f4,_0x225dc1[_0xf68a('0x12')]));});});};exports['CreateVoiceCallReport']=function(_0x26129f){var _0x35936b=this;return new Promise(function(_0x99c6f,_0x9bc60b){return db['VoiceCallReport'][_0xf68a('0x1d')](_0x26129f[_0xf68a('0x1e')],{'raw':_0x26129f[_0xf68a('0x16')]?_0x26129f[_0xf68a('0x16')][_0xf68a('0x1f')]===undefined?!![]:![]:!![]})[_0xf68a('0x9')](function(_0x816f1b){logger[_0xf68a('0xa')](_0xf68a('0x20'),_0x26129f);logger[_0xf68a('0xd')]('CreateVoiceCallReport',_0x26129f,JSON[_0xf68a('0xf')](_0x816f1b));_0x99c6f(_0x816f1b);})['catch'](function(_0x14ea63){logger['error'](_0xf68a('0x20'),_0x14ea63[_0xf68a('0x12')],_0x26129f);_0x9bc60b(_0x35936b[_0xf68a('0x11')](0x1f4,_0x14ea63[_0xf68a('0x12')]));});});};exports[_0xf68a('0x21')]=function(_0xedea0b){var _0x12e2af=this;return new Promise(function(_0xaaaab4,_0x322749){return db['VoiceCallReport'][_0xf68a('0x22')](_0xedea0b[_0xf68a('0x1e')],{'raw':_0xedea0b[_0xf68a('0x16')]?_0xedea0b[_0xf68a('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xedea0b[_0xf68a('0x16')]?_0xedea0b['options']['where']||null:null,'attributes':_0xedea0b[_0xf68a('0x16')]?_0xedea0b['options'][_0xf68a('0x1b')]||null:null,'limit':_0xedea0b[_0xf68a('0x16')]?_0xedea0b[_0xf68a('0x16')][_0xf68a('0x17')]||null:null})['then'](function(_0x2622e5){logger['info'](_0xf68a('0x21'),_0xedea0b);logger[_0xf68a('0xd')]('UpdateVoiceCallReport',_0xedea0b,JSON[_0xf68a('0xf')](_0x2622e5));_0xaaaab4(_0x2622e5);})['catch'](function(_0x27fba4){logger[_0xf68a('0x11')](_0xf68a('0x21'),_0x27fba4['message'],_0xedea0b);_0x322749(_0x12e2af[_0xf68a('0x11')](0x1f4,_0x27fba4['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index ebe20c2..ea44454 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 _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 +var _0xad30=['../../config/environment','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x17692c,_0x520d2c){var _0x12d1d0=function(_0x2493ef){while(--_0x2493ef){_0x17692c['push'](_0x17692c['shift']());}};_0x12d1d0(++_0x520d2c);}(_0xad30,0x82));var _0x0ad3=function(_0x189069,_0x356af3){_0x189069=_0x189069-0x0;var _0x557ef6=_0xad30[_0x189069];return _0x557ef6;};'use strict';var multer=require(_0x0ad3('0x0'));var util=require(_0x0ad3('0x1'));var path=require(_0x0ad3('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ad3('0x3'));var router=express['Router']();var auth=require(_0x0ad3('0x4'));var interaction=require(_0x0ad3('0x5'));var config=require(_0x0ad3('0x6'));var controller=require('./voiceChanSpy.controller');router[_0x0ad3('0x7')]('/',auth[_0x0ad3('0x8')](),controller[_0x0ad3('0x9')]);router[_0x0ad3('0x7')](_0x0ad3('0xa'),auth[_0x0ad3('0x8')](),controller['show']);router['post']('/',auth[_0x0ad3('0x8')](),controller[_0x0ad3('0xb')]);router[_0x0ad3('0xc')](_0x0ad3('0xa'),auth[_0x0ad3('0x8')](),controller[_0x0ad3('0xd')]);router[_0x0ad3('0xe')](_0x0ad3('0xa'),auth['isAuthenticated'](),controller[_0x0ad3('0xf')]);module[_0x0ad3('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index ce849b2..65144ad 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 _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 +var _0x1d5b=['STRING','name','setDataValue','join','getDataValue','options','split','BOOLEAN','sequelize','exports'];(function(_0x4f35ba,_0x2c07c3){var _0x28db05=function(_0x19298e){while(--_0x19298e){_0x4f35ba['push'](_0x4f35ba['shift']());}};_0x28db05(++_0x2c07c3);}(_0x1d5b,0xa8));var _0xb1d5=function(_0x86c352,_0x4c1b72){_0x86c352=_0x86c352-0x0;var _0x1a4086=_0x1d5b[_0x86c352];return _0x1a4086;};'use strict';var Sequelize=require(_0xb1d5('0x0'));module[_0xb1d5('0x1')]={'name':{'type':Sequelize[_0xb1d5('0x2')]},'prefix':{'type':Sequelize[_0xb1d5('0x2')],'unique':_0xb1d5('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xb1d5('0x2')],'set':function(_0x5acd5a){this[_0xb1d5('0x4')]('options',_0x5acd5a?_0x5acd5a[_0xb1d5('0x5')](''):[]);},'get':function(){return this[_0xb1d5('0x6')](_0xb1d5('0x7'))?this['getDataValue'](_0xb1d5('0x7'))[_0xb1d5('0x8')](''):[];}},'auth':{'type':Sequelize[_0xb1d5('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0xb1d5('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xb1d5('0x2')]},'description':{'type':Sequelize[_0xb1d5('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 4dcaaf2..3671da1 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 _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 +var _0xdb22=['destroy','get','UserProfileResource','then','end','error','stack','name','index','VoiceChanSpy','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','offset','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','create','body','user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','request-promise','moment','mustache','util','to-csv','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','count','limit','Content-Range'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xdb22,0x1d1));var _0x2db2=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdb22[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2db2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2db2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2db2('0x2'));var moment=require(_0x2db2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2db2('0x4'));var util=require(_0x2db2('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x2db2('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2db2('0x7'));var squel=require(_0x2db2('0x8'));var crypto=require('crypto');var jsforce=require(_0x2db2('0x9'));var deskjs=require(_0x2db2('0xa'));var toCsv=require(_0x2db2('0x6'));var querystring=require(_0x2db2('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2db2('0xc'));var qs=require(_0x2db2('0xd'));var as=require(_0x2db2('0xe'));var hardwareService=require(_0x2db2('0xf'));var logger=require(_0x2db2('0x10'))(_0x2db2('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2db2('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x132c74,_0x8752d6){_0x8752d6=_0x8752d6||0xcc;return function(_0xe73440){if(_0xe73440){return _0x132c74[_0x2db2('0x13')](_0x8752d6);}return _0x132c74['status'](_0x8752d6)['end']();};}function respondWithResult(_0x1dc16a,_0x1396a1){_0x1396a1=_0x1396a1||0xc8;return function(_0xf2bcd1){if(_0xf2bcd1){return _0x1dc16a[_0x2db2('0x14')](_0x1396a1)[_0x2db2('0x15')](_0xf2bcd1);}};}function respondWithFilteredResult(_0x24a655,_0x37af21){return function(_0x43ffcb){if(_0x43ffcb){var _0xb664c6=_0x43ffcb[_0x2db2('0x16')],_0xcd41d8=_0x37af21['offset'],_0x213c60=_0x37af21['offset']+_0x37af21[_0x2db2('0x17')],_0x2be77f;if(_0x213c60>=_0xb664c6){_0x213c60=_0xb664c6;_0x2be77f=0xc8;}else{_0x2be77f=0xce;}_0x24a655[_0x2db2('0x14')](_0x2be77f);return _0x24a655['set'](_0x2db2('0x18'),_0xcd41d8+'-'+_0x213c60+'/'+_0xb664c6)[_0x2db2('0x15')](_0x43ffcb);}return null;};}function patchUpdates(_0x40b325){return function(_0x293b11){try{jsonpatch['apply'](_0x293b11,_0x40b325,!![]);}catch(_0xfa330f){return BPromise['reject'](_0xfa330f);}return _0x293b11['save']();};}function saveUpdates(_0x241f7e,_0x336967){return function(_0x295b63){if(_0x295b63){return _0x295b63['update'](_0x241f7e)['then'](function(_0x592a8f){return _0x592a8f;});}return null;};}function removeEntity(_0x1ed23b,_0x477c21){return function(_0x144bbb){if(_0x144bbb){return _0x144bbb[_0x2db2('0x19')]()['then'](function(){var _0x4b22fd=_0x144bbb[_0x2db2('0x1a')]({'plain':!![]});var _0x4d1507='ChanSpies';return db[_0x2db2('0x1b')][_0x2db2('0x19')]({'where':{'type':_0x4d1507,'resourceId':_0x4b22fd['id']}})[_0x2db2('0x1c')](function(){return _0x144bbb;});})[_0x2db2('0x1c')](function(){_0x1ed23b[_0x2db2('0x14')](0xcc)[_0x2db2('0x1d')]();});}};}function handleEntityNotFound(_0x4cea0a,_0xb88a5e){return function(_0x5f3c30){if(!_0x5f3c30){_0x4cea0a[_0x2db2('0x13')](0x194);}return _0x5f3c30;};}function handleError(_0x56265e,_0x4e24d8){_0x4e24d8=_0x4e24d8||0x1f4;return function(_0x40394e){logger[_0x2db2('0x1e')](_0x40394e[_0x2db2('0x1f')]);if(_0x40394e[_0x2db2('0x20')]){delete _0x40394e[_0x2db2('0x20')];}_0x56265e[_0x2db2('0x14')](_0x4e24d8)['send'](_0x40394e);};}exports[_0x2db2('0x21')]=function(_0x178312,_0x5051b2){var _0x565008={},_0x34e4f2={},_0xaa49de={'count':0x0,'rows':[]};var _0x10bc6f=_['map'](db[_0x2db2('0x22')][_0x2db2('0x23')],function(_0x108fff){return{'name':_0x108fff[_0x2db2('0x24')],'type':_0x108fff[_0x2db2('0x25')]['key']};});_0x34e4f2[_0x2db2('0x26')]=_[_0x2db2('0x27')](_0x10bc6f,'name');_0x34e4f2[_0x2db2('0x28')]=_['keys'](_0x178312[_0x2db2('0x28')]);_0x34e4f2[_0x2db2('0x29')]=_[_0x2db2('0x2a')](_0x34e4f2[_0x2db2('0x26')],_0x34e4f2[_0x2db2('0x28')]);_0x565008[_0x2db2('0x2b')]=_[_0x2db2('0x2a')](_0x34e4f2[_0x2db2('0x26')],qs[_0x2db2('0x2c')](_0x178312[_0x2db2('0x28')]['fields']));_0x565008[_0x2db2('0x2b')]=_0x565008[_0x2db2('0x2b')][_0x2db2('0x2d')]?_0x565008['attributes']:_0x34e4f2[_0x2db2('0x26')];if(!_0x178312[_0x2db2('0x28')]['hasOwnProperty']('nolimit')){_0x565008[_0x2db2('0x17')]=qs['limit'](_0x178312[_0x2db2('0x28')]['limit']);_0x565008[_0x2db2('0x2e')]=qs[_0x2db2('0x2e')](_0x178312[_0x2db2('0x28')][_0x2db2('0x2e')]);}_0x565008[_0x2db2('0x2f')]=qs[_0x2db2('0x30')](_0x178312[_0x2db2('0x28')]['sort']);_0x565008[_0x2db2('0x31')]=qs['filters'](_[_0x2db2('0x32')](_0x178312['query'],_0x34e4f2[_0x2db2('0x29')]),_0x10bc6f);if(_0x178312[_0x2db2('0x28')]['filter']){_0x565008[_0x2db2('0x31')]=_[_0x2db2('0x33')](_0x565008[_0x2db2('0x31')],{'$or':_[_0x2db2('0x27')](_0x10bc6f,function(_0x25d582){if(_0x25d582['type']!==_0x2db2('0x34')){var _0x3418e7={};_0x3418e7[_0x25d582['name']]={'$like':'%'+_0x178312[_0x2db2('0x28')]['filter']+'%'};return _0x3418e7;}})});}_0x565008=_[_0x2db2('0x33')]({},_0x565008,_0x178312[_0x2db2('0x35')]);var _0x4af1b3={'where':_0x565008[_0x2db2('0x31')]};return db[_0x2db2('0x22')][_0x2db2('0x16')](_0x4af1b3)[_0x2db2('0x1c')](function(_0x400d41){_0xaa49de[_0x2db2('0x16')]=_0x400d41;if(_0x178312['query'][_0x2db2('0x36')]){_0x565008[_0x2db2('0x37')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x565008);})[_0x2db2('0x1c')](function(_0x199e70){_0xaa49de[_0x2db2('0x38')]=_0x199e70;return _0xaa49de;})[_0x2db2('0x1c')](respondWithFilteredResult(_0x5051b2,_0x565008))[_0x2db2('0x39')](handleError(_0x5051b2,null));};exports[_0x2db2('0x3a')]=function(_0x5705ca,_0x2f2493){var _0x4144ec={'raw':![],'where':{'id':_0x5705ca[_0x2db2('0x3b')]['id']}},_0x5d95a3={};_0x5d95a3[_0x2db2('0x26')]=_[_0x2db2('0x3c')](db['VoiceChanSpy']['rawAttributes']);_0x5d95a3[_0x2db2('0x28')]=_[_0x2db2('0x3c')](_0x5705ca['query']);_0x5d95a3[_0x2db2('0x29')]=_[_0x2db2('0x2a')](_0x5d95a3['model'],_0x5d95a3[_0x2db2('0x28')]);_0x4144ec[_0x2db2('0x2b')]=_[_0x2db2('0x2a')](_0x5d95a3[_0x2db2('0x26')],qs[_0x2db2('0x2c')](_0x5705ca['query'][_0x2db2('0x2c')]));_0x4144ec[_0x2db2('0x2b')]=_0x4144ec[_0x2db2('0x2b')][_0x2db2('0x2d')]?_0x4144ec['attributes']:_0x5d95a3[_0x2db2('0x26')];if(_0x5705ca[_0x2db2('0x28')][_0x2db2('0x36')]){_0x4144ec['include']=[{'all':!![]}];}_0x4144ec=_['merge']({},_0x4144ec,_0x5705ca[_0x2db2('0x35')]);return db[_0x2db2('0x22')]['find'](_0x4144ec)['then'](handleEntityNotFound(_0x2f2493,null))[_0x2db2('0x1c')](respondWithResult(_0x2f2493,null))[_0x2db2('0x39')](handleError(_0x2f2493,null));};exports[_0x2db2('0x3d')]=function(_0x522b82,_0x1875bf){return db[_0x2db2('0x22')][_0x2db2('0x3d')](_0x522b82[_0x2db2('0x3e')],{})[_0x2db2('0x1c')](function(_0x328fd1){var _0x5e5163=_0x522b82[_0x2db2('0x3f')][_0x2db2('0x1a')]({'plain':!![]});if(!_0x5e5163)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e5163[_0x2db2('0x40')]===_0x2db2('0x3f')){var _0x266618=_0x328fd1[_0x2db2('0x1a')]({'plain':!![]});var _0x25d16f='ChanSpies';return db['UserProfileSection'][_0x2db2('0x41')]({'where':{'name':_0x25d16f,'userProfileId':_0x5e5163[_0x2db2('0x42')]},'raw':!![]})['then'](function(_0x57c9d4){if(_0x57c9d4&&_0x57c9d4[_0x2db2('0x43')]===0x0){return db[_0x2db2('0x1b')][_0x2db2('0x3d')]({'name':_0x266618[_0x2db2('0x20')],'resourceId':_0x266618['id'],'type':_0x57c9d4['name'],'sectionId':_0x57c9d4['id']},{})[_0x2db2('0x1c')](function(){return _0x328fd1;});}else{return _0x328fd1;}})[_0x2db2('0x39')](function(_0x182797){logger[_0x2db2('0x1e')](_0x2db2('0x44'),_0x182797);throw _0x182797;});}return _0x328fd1;})[_0x2db2('0x1c')](respondWithResult(_0x1875bf,0xc9))[_0x2db2('0x39')](handleError(_0x1875bf,null));};exports[_0x2db2('0x45')]=function(_0x189bc4,_0x3dc74c){if(_0x189bc4[_0x2db2('0x3e')]['id']){delete _0x189bc4[_0x2db2('0x3e')]['id'];}return db[_0x2db2('0x22')][_0x2db2('0x41')]({'where':{'id':_0x189bc4[_0x2db2('0x3b')]['id']}})[_0x2db2('0x1c')](handleEntityNotFound(_0x3dc74c,null))[_0x2db2('0x1c')](saveUpdates(_0x189bc4[_0x2db2('0x3e')],null))[_0x2db2('0x1c')](respondWithResult(_0x3dc74c,null))[_0x2db2('0x39')](handleError(_0x3dc74c,null));};exports[_0x2db2('0x19')]=function(_0x1a04be,_0x507672){return db[_0x2db2('0x22')][_0x2db2('0x41')]({'where':{'id':_0x1a04be[_0x2db2('0x3b')]['id']}})[_0x2db2('0x1c')](handleEntityNotFound(_0x507672,null))[_0x2db2('0x1c')](removeEntity(_0x507672,null))['catch'](handleError(_0x507672,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 5d5d2a1..43cc6e1 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 _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 +var _0x380a=['destroy','lodash','util','bluebird','context','from-sip','format','push','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','auth','merge','Authenticate','password','SIP/%s,%s','name','join','StopMixMonitor','length','internal','concat','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate'];(function(_0x396e16,_0x77cec0){var _0x4db08f=function(_0x4fbec0){while(--_0x4fbec0){_0x396e16['push'](_0x396e16['shift']());}};_0x4db08f(++_0x77cec0);}(_0x380a,0x16c));var _0xa380=function(_0x24c135,_0xdb4450){_0x24c135=_0x24c135-0x0;var _0x290c66=_0x380a[_0x24c135];return _0x290c66;};'use strict';var _=require(_0xa380('0x0'));var util=require(_0xa380('0x1'));var BPromise=require(_0xa380('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x120792,_0x56b1d7,_0x4bb205){var _0xfb00ee=0x1;var _0x54a96f=[];var _0x57953d={'context':_0x56b1d7[_0xa380('0x3')]||_0xa380('0x4'),'exten':util[_0xa380('0x5')]('%s%s',_0x120792['prefix'],_0x4bb205),'type':'system','isApp':![],'ChanSpyId':_0x120792['id'],'UserId':_0x56b1d7['id']};_0x54a96f[_0xa380('0x6')](_['merge']({'app':'Set','appdata':util[_0xa380('0x5')](_0xa380('0x7'),_0xa380('0x8')),'priority':_0xfb00ee++},_0x57953d));if(_0x120792[_0xa380('0x9')]){_0x54a96f['push'](_['merge']({'app':'MixMonitor','appdata':util[_0xa380('0x5')](_0xa380('0xa'),_0x120792['recordingFormat']),'priority':_0xfb00ee++},_0x57953d));}if(_0x120792[_0xa380('0xb')]){_0x54a96f[_0xa380('0x6')](_[_0xa380('0xc')]({'app':_0xa380('0xd'),'appdata':_0x120792[_0xa380('0xe')],'priority':_0xfb00ee++},_0x57953d));}_0x54a96f[_0xa380('0x6')](_[_0xa380('0xc')]({'app':'ChanSpy','appdata':util[_0xa380('0x5')](_0xa380('0xf'),_0x56b1d7[_0xa380('0x10')],_0x120792['options']?_0x120792['options'][_0xa380('0x11')](''):''),'priority':_0xfb00ee++},_0x57953d));if(_0x120792[_0xa380('0x9')]){_0x54a96f[_0xa380('0x6')](_[_0xa380('0xc')]({'app':_0xa380('0x12'),'priority':_0xfb00ee++},_0x57953d));}return _0x54a96f;};var getChanSpyApplications=function(_0x3a713e,_0x4c0021){var _0x34dfa1=[];for(var _0x5cb63d=0x0,_0x286316=0x1;_0x5cb63d<_0x4c0021[_0xa380('0x13')];_0x5cb63d++,_0x286316=0x1){_0x34dfa1=_0x34dfa1['concat'](getUserApplications(_0x3a713e,_0x4c0021[_0x5cb63d],_0x4c0021[_0x5cb63d][_0xa380('0x14')]));if(_0x4c0021[_0x5cb63d][_0xa380('0x14')]!=_0x4c0021[_0x5cb63d][_0xa380('0x10')]){_0x34dfa1=_0x34dfa1[_0xa380('0x15')](getUserApplications(_0x3a713e,_0x4c0021[_0x5cb63d],_0x4c0021[_0x5cb63d]['name']));}}return _0x34dfa1;};var getChanSpyPromise=function(_0xe38bfa,_0x3779bc){return new BPromise(function(_0xc6e3ae,_0x926459){return _0xe38bfa['User']['findAll']({'attributes':['id','name',_0xa380('0x14')],'where':{'role':_0xa380('0x16'),'chanspy':!![]},'raw':!![]})['then'](function(_0x78cb1c){if(_0x78cb1c){return _0xc6e3ae(getChanSpyApplications(_0x3779bc,_0x78cb1c));}return _0xc6e3ae([]);})[_0xa380('0x17')](function(_0x9d2294){_0x926459(_0x9d2294);});});};module[_0xa380('0x18')]=function(_0x250acf,_0x16753e){var _0x43fe4b=_0x250acf[_0xa380('0x19')];return _0x250acf[_0xa380('0x1a')](_0xa380('0x1b'),attributes,{'tableName':_0xa380('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x23b05f,_0x2a3023,_0x5cc7f6){return getChanSpyPromise(_0x43fe4b,_0x23b05f)[_0xa380('0x1d')](function(_0x1d603c){if(_0x1d603c&&_0x1d603c[_0xa380('0x13')]){return _0x43fe4b[_0xa380('0x1e')][_0xa380('0x1f')](_0x1d603c);}})['then'](function(){_0x5cc7f6();})['catch'](function(_0x332a5b){_0x5cc7f6(_0x332a5b);});},'afterUpdate':function(_0x262017,_0xa0c142,_0xc80edd){return _0x43fe4b[_0xa380('0x1e')][_0xa380('0x20')]({'where':{'ChanSpyId':_0x262017['id']}})['then'](function(){return getChanSpyPromise(_0x43fe4b,_0x262017);})[_0xa380('0x1d')](function(_0x1dd99b){if(_0x1dd99b&&_0x1dd99b['length']){return _0x43fe4b[_0xa380('0x1e')][_0xa380('0x1f')](_0x1dd99b);}})[_0xa380('0x1d')](function(){_0xc80edd();})[_0xa380('0x17')](function(_0x215ac0){_0xc80edd(_0x215ac0);});},'afterDestroy':function(_0x215aad,_0x1fce2b,_0x3618f7){return _0x43fe4b[_0xa380('0x1e')][_0xa380('0x20')]({'where':{'ChanSpyId':_0x215aad['id']}})[_0xa380('0x1d')](function(){_0x3618f7();})[_0xa380('0x17')](function(_0x569225){_0x3618f7(_0x569225);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 6686df4..fa83d2f 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 _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 +var _0x2933=['lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x27f405,_0x1043e0){var _0x2e77c1=function(_0x4cdd4e){while(--_0x4cdd4e){_0x27f405['push'](_0x27f405['shift']());}};_0x2e77c1(++_0x1043e0);}(_0x2933,0xd2));var _0x3293=function(_0x39640e,_0x58cd55){_0x39640e=_0x39640e-0x0;var _0x2585d5=_0x2933[_0x39640e];return _0x2585d5;};'use strict';var _=require(_0x3293('0x0'));var util=require(_0x3293('0x1'));var moment=require(_0x3293('0x2'));var BPromise=require(_0x3293('0x3'));var rs=require(_0x3293('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3293('0x5'));var logger=require('../../config/logger')(_0x3293('0x6'));var config=require(_0x3293('0x7'));var jayson=require(_0x3293('0x8'));var client=jayson['client'][_0x3293('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52c903,_0x9aabe8,_0x2b10b8){return new BPromise(function(_0x558aff,_0x10444f){return client[_0x3293('0xa')](_0x52c903,_0x2b10b8)['then'](function(_0xfdfa5a){logger['info'](_0x3293('0xb'),_0x9aabe8,_0x3293('0xc'));logger[_0x3293('0xd')](_0x3293('0xe'),_0x9aabe8,_0x3293('0xc'),JSON[_0x3293('0xf')](_0xfdfa5a));if(_0xfdfa5a[_0x3293('0x10')]){if(_0xfdfa5a[_0x3293('0x10')][_0x3293('0x11')]===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x9aabe8,_0xfdfa5a[_0x3293('0x10')]['message']);return _0x10444f(_0xfdfa5a[_0x3293('0x10')][_0x3293('0x12')]);}logger[_0x3293('0x10')](_0x3293('0xb'),_0x9aabe8,_0xfdfa5a[_0x3293('0x10')][_0x3293('0x12')]);return _0x558aff(_0xfdfa5a[_0x3293('0x10')][_0x3293('0x12')]);}else{logger[_0x3293('0x13')](_0x3293('0xb'),_0x9aabe8,_0x3293('0xc'));_0x558aff(_0xfdfa5a[_0x3293('0x14')][_0x3293('0x12')]);}})['catch'](function(_0x20ee21){logger[_0x3293('0x10')](_0x3293('0xb'),_0x9aabe8,_0x20ee21);_0x10444f(_0x20ee21);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index fcca67f..f6d2c2c 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 _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 +var _0xb335=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5ca6b2,_0x24be32){var _0x2b92e2=function(_0x3c5853){while(--_0x3c5853){_0x5ca6b2['push'](_0x5ca6b2['shift']());}};_0x2b92e2(++_0x24be32);}(_0xb335,0x82));var _0x5b33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb335[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5b33('0x0'));var util=require(_0x5b33('0x1'));var path=require(_0x5b33('0x2'));var timeout=require(_0x5b33('0x3'));var express=require('express');var router=express[_0x5b33('0x4')]();var auth=require(_0x5b33('0x5'));var interaction=require(_0x5b33('0x6'));var config=require(_0x5b33('0x7'));var controller=require('./voiceContext.controller');router[_0x5b33('0x8')]('/',auth[_0x5b33('0x9')](),controller[_0x5b33('0xa')]);router[_0x5b33('0x8')](_0x5b33('0xb'),auth[_0x5b33('0x9')](),controller[_0x5b33('0xc')]);router[_0x5b33('0xd')]('/',auth[_0x5b33('0x9')](),controller['create']);router[_0x5b33('0xe')](_0x5b33('0xb'),auth[_0x5b33('0x9')](),controller[_0x5b33('0xf')]);router[_0x5b33('0x10')](_0x5b33('0xb'),auth[_0x5b33('0x9')](),controller[_0x5b33('0x11')]);module[_0x5b33('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index a50a7db..e6b79c3 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(_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 +var _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x34f393,_0x1273ba){var _0x334af7=function(_0x2775ca){while(--_0x2775ca){_0x34f393['push'](_0x34f393['shift']());}};_0x334af7(++_0x1273ba);}(_0x34e8,0x12c));var _0x834e=function(_0x1b383b,_0x2a403e){_0x1b383b=_0x1b383b-0x0;var _0x1fa32c=_0x34e8[_0x1b383b];return _0x1fa32c;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'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 b02265e..e55ee39 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 _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 +var _0x04b8=['VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','length','find','create','body','join','root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','render','readFileSync','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','request','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceContext,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Contexts','UserProfileResource','stack','name','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick'];(function(_0x387f62,_0x28b750){var _0x9687e2=function(_0x5ef352){while(--_0x5ef352){_0x387f62['push'](_0x387f62['shift']());}};_0x9687e2(++_0x28b750);}(_0x04b8,0x159));var _0x804b=function(_0x34a843,_0x38ebb0){_0x34a843=_0x34a843-0x0;var _0x55a829=_0x04b8[_0x34a843];return _0x55a829;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x804b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x804b('0x1'));var jsonpatch=require(_0x804b('0x2'));var rp=require('request-promise');var moment=require(_0x804b('0x3'));var BPromise=require(_0x804b('0x4'));var Mustache=require('mustache');var util=require(_0x804b('0x5'));var path=require(_0x804b('0x6'));var sox=require(_0x804b('0x7'));var csv=require('to-csv');var ejs=require(_0x804b('0x8'));var fs=require('fs');var _=require(_0x804b('0x9'));var squel=require(_0x804b('0xa'));var crypto=require('crypto');var jsforce=require(_0x804b('0xb'));var deskjs=require(_0x804b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x804b('0xd'));var Papa=require(_0x804b('0xe'));var Redis=require(_0x804b('0xf'));var authService=require(_0x804b('0x10'));var qs=require(_0x804b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x804b('0x12'));var logger=require(_0x804b('0x13'))(_0x804b('0x14'));var utils=require(_0x804b('0x15'));var config=require(_0x804b('0x16'));var licenseUtil=require(_0x804b('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x804b('0x18'));var client=jayson['client'][_0x804b('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3a2702,_0xfa2ddd,_0x1f915d,_0x581fbf){return new BPromise(function(_0x215825,_0x1b01a7){var _0x274bb8=_0x581fbf||client;return _0x274bb8[_0x804b('0x1a')](_0x3a2702,_0x1f915d)['then'](function(_0x2fd593){logger[_0x804b('0x1b')]('VoiceContext,\x20%s,\x20%s',_0xfa2ddd,_0x804b('0x1c'));logger['debug'](_0x804b('0x1d'),_0xfa2ddd,_0x804b('0x1c'),JSON[_0x804b('0x1e')](_0x2fd593));if(_0x2fd593[_0x804b('0x1f')]){if(_0x2fd593[_0x804b('0x1f')]['code']===0x1f4){logger[_0x804b('0x1f')]('VoiceContext,\x20%s,\x20%s',_0xfa2ddd,_0x2fd593[_0x804b('0x1f')][_0x804b('0x20')]);return _0x1b01a7(_0x2fd593[_0x804b('0x1f')][_0x804b('0x20')]);}logger['error'](_0x804b('0x21'),_0xfa2ddd,_0x2fd593[_0x804b('0x1f')][_0x804b('0x20')]);return _0x215825(_0x2fd593[_0x804b('0x1f')][_0x804b('0x20')]);}else{logger[_0x804b('0x1b')](_0x804b('0x21'),_0xfa2ddd,_0x804b('0x1c'));_0x215825(_0x2fd593[_0x804b('0x22')][_0x804b('0x20')]);}})[_0x804b('0x23')](function(_0x5a968b){logger[_0x804b('0x1f')](_0x804b('0x21'),_0xfa2ddd,_0x5a968b);_0x1b01a7(_0x5a968b);});});}function respondWithStatusCode(_0x5585f8,_0x44a921){_0x44a921=_0x44a921||0xcc;return function(_0x367024){if(_0x367024){return _0x5585f8[_0x804b('0x24')](_0x44a921);}return _0x5585f8[_0x804b('0x25')](_0x44a921)[_0x804b('0x26')]();};}function respondWithResult(_0x552a76,_0x2de812){_0x2de812=_0x2de812||0xc8;return function(_0x7d9c33){if(_0x7d9c33){return _0x552a76['status'](_0x2de812)[_0x804b('0x27')](_0x7d9c33);}};}function respondWithFilteredResult(_0x2366b6,_0x1117a5){return function(_0x27d5ec){if(_0x27d5ec){var _0x2d88da=_0x27d5ec[_0x804b('0x28')],_0x5cc1dd=_0x1117a5[_0x804b('0x29')],_0x456580=_0x1117a5[_0x804b('0x29')]+_0x1117a5['limit'],_0x22f822;if(_0x456580>=_0x2d88da){_0x456580=_0x2d88da;_0x22f822=0xc8;}else{_0x22f822=0xce;}_0x2366b6[_0x804b('0x25')](_0x22f822);return _0x2366b6[_0x804b('0x2a')](_0x804b('0x2b'),_0x5cc1dd+'-'+_0x456580+'/'+_0x2d88da)['json'](_0x27d5ec);}return null;};}function patchUpdates(_0x3dbd41){return function(_0x407357){try{jsonpatch[_0x804b('0x2c')](_0x407357,_0x3dbd41,!![]);}catch(_0x57b8da){return BPromise[_0x804b('0x2d')](_0x57b8da);}return _0x407357[_0x804b('0x2e')]();};}function saveUpdates(_0x5e8f85,_0x391376){return function(_0x37dd3e){if(_0x37dd3e){return _0x37dd3e[_0x804b('0x2f')](_0x5e8f85)[_0x804b('0x30')](function(_0x46de73){return _0x46de73;});}return null;};}function removeEntity(_0x241c96,_0x551792){return function(_0x3b0692){if(_0x3b0692){return _0x3b0692[_0x804b('0x31')]()[_0x804b('0x30')](function(){var _0xa6d897=_0x3b0692[_0x804b('0x32')]({'plain':!![]});var _0x2c509a=_0x804b('0x33');return db[_0x804b('0x34')][_0x804b('0x31')]({'where':{'type':_0x2c509a,'resourceId':_0xa6d897['id']}})[_0x804b('0x30')](function(){return _0x3b0692;});})[_0x804b('0x30')](function(){_0x241c96[_0x804b('0x25')](0xcc)[_0x804b('0x26')]();});}};}function handleEntityNotFound(_0x15c366,_0x20c50b){return function(_0x384c44){if(!_0x384c44){_0x15c366[_0x804b('0x24')](0x194);}return _0x384c44;};}function handleError(_0x1be16f,_0xf47023){_0xf47023=_0xf47023||0x1f4;return function(_0x3cf6df){logger[_0x804b('0x1f')](_0x3cf6df[_0x804b('0x35')]);if(_0x3cf6df[_0x804b('0x36')]){delete _0x3cf6df[_0x804b('0x36')];}_0x1be16f[_0x804b('0x25')](_0xf47023)['send'](_0x3cf6df);};}exports['index']=function(_0x584452,_0x3da331){var _0x2f3661={},_0x37a883={},_0x5b28d7={'count':0x0,'rows':[]};var _0x5918f2=_['map'](db[_0x804b('0x37')][_0x804b('0x38')],function(_0x43cbdf){return{'name':_0x43cbdf[_0x804b('0x39')],'type':_0x43cbdf[_0x804b('0x3a')][_0x804b('0x3b')]};});_0x37a883[_0x804b('0x3c')]=_[_0x804b('0x3d')](_0x5918f2,_0x804b('0x36'));_0x37a883[_0x804b('0x3e')]=_[_0x804b('0x3f')](_0x584452[_0x804b('0x3e')]);_0x37a883[_0x804b('0x40')]=_['intersection'](_0x37a883[_0x804b('0x3c')],_0x37a883[_0x804b('0x3e')]);_0x2f3661[_0x804b('0x41')]=_[_0x804b('0x42')](_0x37a883[_0x804b('0x3c')],qs['fields'](_0x584452['query'][_0x804b('0x43')]));_0x2f3661[_0x804b('0x41')]=_0x2f3661[_0x804b('0x41')]['length']?_0x2f3661[_0x804b('0x41')]:_0x37a883['model'];if(!_0x584452[_0x804b('0x3e')][_0x804b('0x44')](_0x804b('0x45'))){_0x2f3661[_0x804b('0x46')]=qs[_0x804b('0x46')](_0x584452[_0x804b('0x3e')][_0x804b('0x46')]);_0x2f3661['offset']=qs[_0x804b('0x29')](_0x584452[_0x804b('0x3e')][_0x804b('0x29')]);}_0x2f3661[_0x804b('0x47')]=qs['sort'](_0x584452[_0x804b('0x3e')][_0x804b('0x48')]);_0x2f3661[_0x804b('0x49')]=qs[_0x804b('0x40')](_[_0x804b('0x4a')](_0x584452[_0x804b('0x3e')],_0x37a883[_0x804b('0x40')]),_0x5918f2);if(_0x584452[_0x804b('0x3e')]['filter']){_0x2f3661[_0x804b('0x49')]=_['merge'](_0x2f3661['where'],{'$or':_['map'](_0x5918f2,function(_0x467bc5){if(_0x467bc5['type']!==_0x804b('0x4b')){var _0x41a427={};_0x41a427[_0x467bc5[_0x804b('0x36')]]={'$like':'%'+_0x584452[_0x804b('0x3e')]['filter']+'%'};return _0x41a427;}})});}_0x2f3661=_[_0x804b('0x4c')]({},_0x2f3661,_0x584452[_0x804b('0x4d')]);var _0x44211d={'where':_0x2f3661['where']};return db[_0x804b('0x37')][_0x804b('0x28')](_0x44211d)[_0x804b('0x30')](function(_0x4cada2){_0x5b28d7[_0x804b('0x28')]=_0x4cada2;if(_0x584452[_0x804b('0x3e')][_0x804b('0x4e')]){_0x2f3661[_0x804b('0x4f')]=[{'all':!![]}];}return db[_0x804b('0x37')][_0x804b('0x50')](_0x2f3661);})[_0x804b('0x30')](function(_0x2a2a08){_0x5b28d7[_0x804b('0x51')]=_0x2a2a08;return _0x5b28d7;})[_0x804b('0x30')](respondWithFilteredResult(_0x3da331,_0x2f3661))[_0x804b('0x23')](handleError(_0x3da331,null));};exports[_0x804b('0x52')]=function(_0x20862f,_0x2c1796){var _0x578e92={'raw':![],'where':{'id':_0x20862f[_0x804b('0x53')]['id']}},_0x52d0a2={};_0x52d0a2[_0x804b('0x3c')]=_[_0x804b('0x3f')](db[_0x804b('0x37')][_0x804b('0x38')]);_0x52d0a2['query']=_[_0x804b('0x3f')](_0x20862f[_0x804b('0x3e')]);_0x52d0a2[_0x804b('0x40')]=_[_0x804b('0x42')](_0x52d0a2[_0x804b('0x3c')],_0x52d0a2[_0x804b('0x3e')]);_0x578e92['attributes']=_['intersection'](_0x52d0a2[_0x804b('0x3c')],qs[_0x804b('0x43')](_0x20862f['query']['fields']));_0x578e92[_0x804b('0x41')]=_0x578e92[_0x804b('0x41')][_0x804b('0x54')]?_0x578e92['attributes']:_0x52d0a2[_0x804b('0x3c')];if(_0x20862f[_0x804b('0x3e')]['includeAll']){_0x578e92[_0x804b('0x4f')]=[{'all':!![]}];}_0x578e92=_['merge']({},_0x578e92,_0x20862f[_0x804b('0x4d')]);return db['VoiceContext'][_0x804b('0x55')](_0x578e92)[_0x804b('0x30')](handleEntityNotFound(_0x2c1796,null))['then'](respondWithResult(_0x2c1796,null))[_0x804b('0x23')](handleError(_0x2c1796,null));};exports['create']=function(_0x36b417,_0x706e98,_0x33944c){var _0x2f4aa1;return db[_0x804b('0x37')][_0x804b('0x56')](_0x36b417[_0x804b('0x57')],{'raw':!![]})[_0x804b('0x30')](function(_0x453b94){_0x2f4aa1=_0x453b94;return db[_0x804b('0x37')]['findAll']({'raw':!![]});})['then'](function(_0x13fb5c){var _0x4799be=fs['readFileSync'](path[_0x804b('0x58')](config[_0x804b('0x59')],_0x804b('0x5a')),_0x804b('0x5b'));var _0x5a549f=ejs['render'](_0x4799be,{'contexts':_0x13fb5c||[]});fs[_0x804b('0x5c')](_0x804b('0x5d'),_0x5a549f);})[_0x804b('0x30')](function(){return respondWithRpcPromise(_0x804b('0x5e'),_0x804b('0x56'),{'module':_0x804b('0x5f')});})[_0x804b('0x30')](function(){var _0x3100aa=_0x36b417[_0x804b('0x60')][_0x804b('0x32')]({'plain':!![]});if(!_0x3100aa)throw new Error(_0x804b('0x61'));if(_0x3100aa[_0x804b('0x62')]===_0x804b('0x60')){var _0x15ca53=_0x2f4aa1[_0x804b('0x32')]({'plain':!![]});return db[_0x804b('0x63')]['find']({'where':{'name':_0x804b('0x33'),'userProfileId':_0x3100aa[_0x804b('0x64')]},'raw':!![]})['then'](function(_0x87640a){if(_0x87640a&&_0x87640a[_0x804b('0x65')]===0x0){return db[_0x804b('0x34')][_0x804b('0x56')]({'name':_0x15ca53['name'],'resourceId':_0x15ca53['id'],'type':_0x87640a[_0x804b('0x36')],'sectionId':_0x87640a['id']},{})[_0x804b('0x30')](function(){return _0x2f4aa1;});}else{return _0x2f4aa1;}})['catch'](function(_0x3098a1){logger[_0x804b('0x1f')](_0x804b('0x66'),_0x3098a1);throw _0x3098a1;});}return _0x2f4aa1;})['then'](respondWithResult(_0x706e98,0xc9))[_0x804b('0x23')](handleError(_0x706e98,null));};exports[_0x804b('0x2f')]=function(_0x3df323,_0x2295c5,_0x3f4532){var _0x555d2e;return db[_0x804b('0x37')][_0x804b('0x55')]({'where':{'id':_0x3df323[_0x804b('0x53')]['id']}})[_0x804b('0x30')](handleEntityNotFound(_0x2295c5,null))['then'](saveUpdates(_0x3df323['body'],null))[_0x804b('0x30')](function(_0x5695bb){if(_0x5695bb){_0x555d2e=_0x5695bb;return db[_0x804b('0x37')][_0x804b('0x50')]({'raw':!![]});}})[_0x804b('0x30')](function(_0x366f68){var _0x2bfef2=fs['readFileSync'](path[_0x804b('0x58')](config[_0x804b('0x59')],_0x804b('0x5a')),'utf8');var _0x360a81=ejs[_0x804b('0x67')](_0x2bfef2,{'contexts':_0x366f68||[]});fs['writeFileSync'](_0x804b('0x5d'),_0x360a81);})['then'](function(){return respondWithRpcPromise(_0x804b('0x5e'),_0x804b('0x2f'),{'module':'chan_sip.so'});})[_0x804b('0x30')](function(){return _0x555d2e;})[_0x804b('0x30')](respondWithResult(_0x2295c5,null))[_0x804b('0x23')](handleError(_0x2295c5,null));};exports['destroy']=function(_0x436425,_0x492904,_0x3b8d04){var _0x1e429b;return db[_0x804b('0x37')][_0x804b('0x55')]({'where':{'id':_0x436425['params']['id']}})[_0x804b('0x30')](handleEntityNotFound(_0x492904,null))[_0x804b('0x30')](removeEntity(_0x492904,null))[_0x804b('0x30')](function(){return db[_0x804b('0x37')][_0x804b('0x50')]({'raw':!![]});})[_0x804b('0x30')](function(_0x5b3b79){var _0x39ed3c=fs[_0x804b('0x68')](path['join'](config[_0x804b('0x59')],_0x804b('0x5a')),_0x804b('0x5b'));var _0x276230=ejs['render'](_0x39ed3c,{'contexts':_0x5b3b79});fs[_0x804b('0x5c')](_0x804b('0x5d'),_0x276230);return respondWithRpcPromise('Reload',_0x804b('0x31'),{'module':_0x804b('0x5f')});})['catch'](handleError(_0x492904,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 1200663..f5285d1 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 _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 +var _0x0242=['../../config/environment','./voiceContext.attributes','define','VoiceContext','lodash','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x11226b,_0x47daa3){var _0x11d550=function(_0x246ee2){while(--_0x246ee2){_0x11226b['push'](_0x11226b['shift']());}};_0x11d550(++_0x47daa3);}(_0x0242,0x72));var _0x2024=function(_0x45d5ef,_0x10c29b){_0x45d5ef=_0x45d5ef-0x0;var _0x474d19=_0x0242[_0x45d5ef];return _0x474d19;};'use strict';var _=require(_0x2024('0x0'));var util=require(_0x2024('0x1'));var logger=require(_0x2024('0x2'))('api');var moment=require(_0x2024('0x3'));var BPromise=require(_0x2024('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2024('0x5'));var config=require(_0x2024('0x6'));var attributes=require(_0x2024('0x7'));module['exports']=function(_0x4fa007,_0x1ac83e){return _0x4fa007[_0x2024('0x8')](_0x2024('0x9'),attributes,{'tableName':'voice_contexts','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 29ade35..7e3ea87 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 _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 +var _0x2b85=['debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceContext,\x20%s,\x20%s'];(function(_0x3af31b,_0x35a1e5){var _0x295ce4=function(_0x10514e){while(--_0x10514e){_0x3af31b['push'](_0x3af31b['shift']());}};_0x295ce4(++_0x35a1e5);}(_0x2b85,0x197));var _0x52b8=function(_0x133b50,_0x5a3c51){_0x133b50=_0x133b50-0x0;var _0xd2b24f=_0x2b85[_0x133b50];return _0xd2b24f;};'use strict';var _=require('lodash');var util=require(_0x52b8('0x0'));var moment=require('moment');var BPromise=require(_0x52b8('0x1'));var rs=require(_0x52b8('0x2'));var fs=require('fs');var Redis=require(_0x52b8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x52b8('0x4'));var logger=require(_0x52b8('0x5'))(_0x52b8('0x6'));var config=require(_0x52b8('0x7'));var jayson=require(_0x52b8('0x8'));var client=jayson[_0x52b8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe9fc41,_0x51afcc,_0x1fad4f){return new BPromise(function(_0x94af1a,_0x27acde){return client['request'](_0xe9fc41,_0x1fad4f)[_0x52b8('0xa')](function(_0x1b38aa){logger[_0x52b8('0xb')](_0x52b8('0xc'),_0x51afcc,'request\x20sent');logger[_0x52b8('0xd')](_0x52b8('0xe'),_0x51afcc,_0x52b8('0xf'),JSON[_0x52b8('0x10')](_0x1b38aa));if(_0x1b38aa[_0x52b8('0x11')]){if(_0x1b38aa[_0x52b8('0x11')][_0x52b8('0x12')]===0x1f4){logger[_0x52b8('0x11')](_0x52b8('0xc'),_0x51afcc,_0x1b38aa[_0x52b8('0x11')][_0x52b8('0x13')]);return _0x27acde(_0x1b38aa[_0x52b8('0x11')][_0x52b8('0x13')]);}logger[_0x52b8('0x11')](_0x52b8('0xc'),_0x51afcc,_0x1b38aa['error'][_0x52b8('0x13')]);return _0x94af1a(_0x1b38aa[_0x52b8('0x11')][_0x52b8('0x13')]);}else{logger[_0x52b8('0xb')]('VoiceContext,\x20%s,\x20%s',_0x51afcc,_0x52b8('0xf'));_0x94af1a(_0x1b38aa[_0x52b8('0x14')][_0x52b8('0x13')]);}})['catch'](function(_0x229ce8){logger['error'](_0x52b8('0xc'),_0x51afcc,_0x229ce8);_0x27acde(_0x229ce8);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index fb71464..0af66a3 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 _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 +var _0x1f45=['update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put'];(function(_0x5077f6,_0x3865a0){var _0x548cab=function(_0x298255){while(--_0x298255){_0x5077f6['push'](_0x5077f6['shift']());}};_0x548cab(++_0x3865a0);}(_0x1f45,0x87));var _0x51f4=function(_0x531767,_0x3714aa){_0x531767=_0x531767-0x0;var _0x3ddbd3=_0x1f45[_0x531767];return _0x3ddbd3;};'use strict';var multer=require('multer');var util=require(_0x51f4('0x0'));var path=require(_0x51f4('0x1'));var timeout=require(_0x51f4('0x2'));var express=require(_0x51f4('0x3'));var router=express[_0x51f4('0x4')]();var auth=require(_0x51f4('0x5'));var interaction=require(_0x51f4('0x6'));var config=require(_0x51f4('0x7'));var controller=require('./voiceDialReport.controller');router[_0x51f4('0x8')]('/',auth[_0x51f4('0x9')](),controller[_0x51f4('0xa')]);router['get'](_0x51f4('0xb'),auth[_0x51f4('0x9')](),controller[_0x51f4('0xc')]);router[_0x51f4('0x8')](_0x51f4('0xd'),auth['isAuthenticated'](),controller[_0x51f4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x51f4('0xf')]);router[_0x51f4('0x10')](_0x51f4('0xd'),auth[_0x51f4('0x9')](),controller[_0x51f4('0x11')]);router['delete'](_0x51f4('0xd'),auth[_0x51f4('0x9')](),controller['destroy']);module[_0x51f4('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 08bd5ca..aa4e99e 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 _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 +var _0x35e6=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x1628d1,_0xcdacaa){var _0x2c1912=function(_0x8c8ff2){while(--_0x8c8ff2){_0x1628d1['push'](_0x1628d1['shift']());}};_0x2c1912(++_0xcdacaa);}(_0x35e6,0x184));var _0x635e=function(_0x1eb405,_0x37565b){_0x1eb405=_0x1eb405-0x0;var _0x4207a7=_0x35e6[_0x1eb405];return _0x4207a7;};'use strict';var Sequelize=require(_0x635e('0x0'));module[_0x635e('0x1')]={'privilege':{'type':Sequelize[_0x635e('0x2')]},'channel':{'type':Sequelize[_0x635e('0x2')]},'channelstate':{'type':Sequelize[_0x635e('0x3')]},'channelstatedesc':{'type':Sequelize[_0x635e('0x2')]},'calleridnum':{'type':Sequelize[_0x635e('0x2')]},'calleridname':{'type':Sequelize[_0x635e('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x635e('0x2')]},'language':{'type':Sequelize[_0x635e('0x2')]},'accountcode':{'type':Sequelize[_0x635e('0x2')]},'context':{'type':Sequelize[_0x635e('0x2')]},'exten':{'type':Sequelize[_0x635e('0x2')]},'priority':{'type':Sequelize[_0x635e('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x635e('0x2')]},'destchannel':{'type':Sequelize[_0x635e('0x2')]},'destchannelstate':{'type':Sequelize[_0x635e('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x635e('0x2')]},'destcalleridnum':{'type':Sequelize[_0x635e('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x635e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x635e('0x2')]},'destlanguage':{'type':Sequelize[_0x635e('0x2')]},'destaccountcode':{'type':Sequelize[_0x635e('0x2')]},'destcontext':{'type':Sequelize[_0x635e('0x2')]},'destexten':{'type':Sequelize[_0x635e('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x635e('0x2')]},'destlinkedid':{'type':Sequelize[_0x635e('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x635e('0x4')]},'answertime':{'type':Sequelize[_0x635e('0x4')]},'endtime':{'type':Sequelize[_0x635e('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x635e('0x5')},'routeId':{'type':Sequelize[_0x635e('0x3')]},'duration':{'type':Sequelize[_0x635e('0x3')]},'holdtime':{'type':Sequelize[_0x635e('0x3')]},'billableseconds':{'type':Sequelize[_0x635e('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 59f5e8a..296f751 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 _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 +var _0x4045=['count','offset','limit','set','Content-Range','apply','save','update','then','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','body','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json'];(function(_0x40b47f,_0x4ba03d){var _0x46ab88=function(_0x359c4b){while(--_0x359c4b){_0x40b47f['push'](_0x40b47f['shift']());}};_0x46ab88(++_0x4ba03d);}(_0x4045,0x14b));var _0x5404=function(_0x575e54,_0x5406f4){_0x575e54=_0x575e54-0x0;var _0x128cee=_0x4045[_0x575e54];return _0x128cee;};'use strict';var pdf=require(_0x5404('0x0'));var emlformat=require(_0x5404('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5404('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5404('0x3'));var moment=require(_0x5404('0x4'));var BPromise=require(_0x5404('0x5'));var Mustache=require(_0x5404('0x6'));var util=require(_0x5404('0x7'));var path=require(_0x5404('0x8'));var sox=require(_0x5404('0x9'));var csv=require('to-csv');var ejs=require(_0x5404('0xa'));var fs=require('fs');var _=require(_0x5404('0xb'));var squel=require(_0x5404('0xc'));var crypto=require('crypto');var jsforce=require(_0x5404('0xd'));var deskjs=require(_0x5404('0xe'));var toCsv=require(_0x5404('0xf'));var querystring=require(_0x5404('0x10'));var Papa=require(_0x5404('0x11'));var Redis=require('ioredis');var authService=require(_0x5404('0x12'));var qs=require(_0x5404('0x13'));var as=require(_0x5404('0x14'));var hardwareService=require(_0x5404('0x15'));var logger=require(_0x5404('0x16'))(_0x5404('0x17'));var utils=require(_0x5404('0x18'));var config=require(_0x5404('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x250357,_0x31bd6a){_0x31bd6a=_0x31bd6a||0xcc;return function(_0x3bede8){if(_0x3bede8){return _0x250357['sendStatus'](_0x31bd6a);}return _0x250357[_0x5404('0x1a')](_0x31bd6a)[_0x5404('0x1b')]();};}function respondWithResult(_0x12bb26,_0x3bfa6e){_0x3bfa6e=_0x3bfa6e||0xc8;return function(_0x544484){if(_0x544484){return _0x12bb26[_0x5404('0x1a')](_0x3bfa6e)[_0x5404('0x1c')](_0x544484);}};}function respondWithFilteredResult(_0x452e4e,_0x405f52){return function(_0x322f3c){if(_0x322f3c){var _0xefab74=_0x322f3c[_0x5404('0x1d')],_0x4d5858=_0x405f52[_0x5404('0x1e')],_0x3810f2=_0x405f52[_0x5404('0x1e')]+_0x405f52[_0x5404('0x1f')],_0x1fc072;if(_0x3810f2>=_0xefab74){_0x3810f2=_0xefab74;_0x1fc072=0xc8;}else{_0x1fc072=0xce;}_0x452e4e['status'](_0x1fc072);return _0x452e4e[_0x5404('0x20')](_0x5404('0x21'),_0x4d5858+'-'+_0x3810f2+'/'+_0xefab74)['json'](_0x322f3c);}return null;};}function patchUpdates(_0x3a260c){return function(_0x15f67){try{jsonpatch[_0x5404('0x22')](_0x15f67,_0x3a260c,!![]);}catch(_0x3d1801){return BPromise['reject'](_0x3d1801);}return _0x15f67[_0x5404('0x23')]();};}function saveUpdates(_0xf3fbf7,_0x246755){return function(_0x277589){if(_0x277589){return _0x277589[_0x5404('0x24')](_0xf3fbf7)[_0x5404('0x25')](function(_0x2a74f6){return _0x2a74f6;});}return null;};}function removeEntity(_0x1869be,_0x2a7f8c){return function(_0x1899eb){if(_0x1899eb){return _0x1899eb['destroy']()[_0x5404('0x25')](function(){_0x1869be[_0x5404('0x1a')](0xcc)[_0x5404('0x1b')]();});}};}function handleEntityNotFound(_0x4979f7,_0x2e0d6a){return function(_0x4905d2){if(!_0x4905d2){_0x4979f7['sendStatus'](0x194);}return _0x4905d2;};}function handleError(_0x419598,_0x305963){_0x305963=_0x305963||0x1f4;return function(_0xaf151a){logger['error'](_0xaf151a[_0x5404('0x26')]);if(_0xaf151a[_0x5404('0x27')]){delete _0xaf151a[_0x5404('0x27')];}_0x419598['status'](_0x305963)[_0x5404('0x28')](_0xaf151a);};}exports[_0x5404('0x29')]=function(_0x3a96d6,_0x2c430f){var _0x4108e4={},_0x25e6ee={},_0x3f300b={'count':0x0,'rows':[]};var _0x4135fb=_[_0x5404('0x2a')](db[_0x5404('0x2b')][_0x5404('0x2c')],function(_0x117e16){return{'name':_0x117e16[_0x5404('0x2d')],'type':_0x117e16[_0x5404('0x2e')][_0x5404('0x2f')]};});_0x25e6ee[_0x5404('0x30')]=_[_0x5404('0x2a')](_0x4135fb,_0x5404('0x27'));_0x25e6ee[_0x5404('0x31')]=_['keys'](_0x3a96d6[_0x5404('0x31')]);_0x25e6ee['filters']=_[_0x5404('0x32')](_0x25e6ee[_0x5404('0x30')],_0x25e6ee[_0x5404('0x31')]);_0x4108e4['attributes']=_[_0x5404('0x32')](_0x25e6ee['model'],qs[_0x5404('0x33')](_0x3a96d6['query'][_0x5404('0x33')]));_0x4108e4['attributes']=_0x4108e4[_0x5404('0x34')][_0x5404('0x35')]?_0x4108e4['attributes']:_0x25e6ee[_0x5404('0x30')];if(!_0x3a96d6['query']['hasOwnProperty'](_0x5404('0x36'))){_0x4108e4[_0x5404('0x1f')]=qs[_0x5404('0x1f')](_0x3a96d6[_0x5404('0x31')][_0x5404('0x1f')]);_0x4108e4[_0x5404('0x1e')]=qs['offset'](_0x3a96d6[_0x5404('0x31')][_0x5404('0x1e')]);}_0x4108e4['order']=qs['sort'](_0x3a96d6[_0x5404('0x31')]['sort']);_0x4108e4[_0x5404('0x37')]=qs[_0x5404('0x38')](_['pick'](_0x3a96d6['query'],_0x25e6ee[_0x5404('0x38')]),_0x4135fb);if(_0x3a96d6['query'][_0x5404('0x39')]){_0x4108e4[_0x5404('0x37')]=_[_0x5404('0x3a')](_0x4108e4[_0x5404('0x37')],{'$or':_[_0x5404('0x2a')](_0x4135fb,function(_0x14e216){if(_0x14e216[_0x5404('0x2e')]!==_0x5404('0x3b')){var _0x5537e0={};_0x5537e0[_0x14e216[_0x5404('0x27')]]={'$like':'%'+_0x3a96d6[_0x5404('0x31')]['filter']+'%'};return _0x5537e0;}})});}_0x4108e4=_[_0x5404('0x3a')]({},_0x4108e4,_0x3a96d6[_0x5404('0x3c')]);var _0xcdb106={'where':_0x4108e4[_0x5404('0x37')]};return db[_0x5404('0x2b')][_0x5404('0x1d')](_0xcdb106)['then'](function(_0x19af8c){_0x3f300b[_0x5404('0x1d')]=_0x19af8c;if(_0x3a96d6[_0x5404('0x31')][_0x5404('0x3d')]){_0x4108e4[_0x5404('0x3e')]=[{'all':!![]}];}return db[_0x5404('0x2b')][_0x5404('0x3f')](_0x4108e4);})[_0x5404('0x25')](function(_0x1deedb){_0x3f300b[_0x5404('0x40')]=_0x1deedb;return _0x3f300b;})[_0x5404('0x25')](respondWithFilteredResult(_0x2c430f,_0x4108e4))['catch'](handleError(_0x2c430f,null));};exports[_0x5404('0x41')]=function(_0x2dc175,_0x39bdcb){var _0x4f2c54={'raw':!![],'where':{'id':_0x2dc175[_0x5404('0x42')]['id']}},_0xa4f17f={};_0xa4f17f['model']=_[_0x5404('0x43')](db[_0x5404('0x2b')][_0x5404('0x2c')]);_0xa4f17f['query']=_['keys'](_0x2dc175[_0x5404('0x31')]);_0xa4f17f['filters']=_[_0x5404('0x32')](_0xa4f17f[_0x5404('0x30')],_0xa4f17f['query']);_0x4f2c54[_0x5404('0x34')]=_['intersection'](_0xa4f17f['model'],qs[_0x5404('0x33')](_0x2dc175[_0x5404('0x31')][_0x5404('0x33')]));_0x4f2c54[_0x5404('0x34')]=_0x4f2c54[_0x5404('0x34')][_0x5404('0x35')]?_0x4f2c54[_0x5404('0x34')]:_0xa4f17f[_0x5404('0x30')];if(_0x2dc175[_0x5404('0x31')][_0x5404('0x3d')]){_0x4f2c54['include']=[{'all':!![]}];}_0x4f2c54=_['merge']({},_0x4f2c54,_0x2dc175[_0x5404('0x3c')]);return db['VoiceDialReport'][_0x5404('0x44')](_0x4f2c54)[_0x5404('0x25')](handleEntityNotFound(_0x39bdcb,null))[_0x5404('0x25')](respondWithResult(_0x39bdcb,null))[_0x5404('0x45')](handleError(_0x39bdcb,null));};exports['create']=function(_0x16245b,_0x250eff){return db[_0x5404('0x2b')]['create'](_0x16245b[_0x5404('0x46')],{})[_0x5404('0x25')](respondWithResult(_0x250eff,0xc9))['catch'](handleError(_0x250eff,null));};exports[_0x5404('0x24')]=function(_0x4d09f6,_0xf09137){if(_0x4d09f6[_0x5404('0x46')]['id']){delete _0x4d09f6[_0x5404('0x46')]['id'];}return db[_0x5404('0x2b')]['find']({'where':{'id':_0x4d09f6[_0x5404('0x42')]['id']}})[_0x5404('0x25')](handleEntityNotFound(_0xf09137,null))[_0x5404('0x25')](saveUpdates(_0x4d09f6[_0x5404('0x46')],null))[_0x5404('0x25')](respondWithResult(_0xf09137,null))['catch'](handleError(_0xf09137,null));};exports['destroy']=function(_0x30b1e1,_0x5ea14c){return db[_0x5404('0x2b')][_0x5404('0x44')]({'where':{'id':_0x30b1e1[_0x5404('0x42')]['id']}})['then'](handleEntityNotFound(_0x5ea14c,null))[_0x5404('0x25')](removeEntity(_0x5ea14c,null))[_0x5404('0x45')](handleError(_0x5ea14c,null));};exports[_0x5404('0x47')]=function(_0x1497fd,_0x26246a){return db[_0x5404('0x2b')]['describe']()['then'](respondWithResult(_0x26246a,null))[_0x5404('0x45')](handleError(_0x26246a,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 675f69c..1f53638 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 _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 +var _0xdbfa=['rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0xcfc44,_0x179bc1){var _0x307a25=function(_0x2b64de){while(--_0x2b64de){_0xcfc44['push'](_0xcfc44['shift']());}};_0x307a25(++_0x179bc1);}(_0xdbfa,0x186));var _0xadbf=function(_0x5a24b4,_0x4999c5){_0x5a24b4=_0x5a24b4-0x0;var _0x526252=_0xdbfa[_0x5a24b4];return _0x526252;};'use strict';var _=require(_0xadbf('0x0'));var util=require(_0xadbf('0x1'));var logger=require(_0xadbf('0x2'))('api');var moment=require('moment');var BPromise=require(_0xadbf('0x3'));var rp=require(_0xadbf('0x4'));var fs=require('fs');var path=require(_0xadbf('0x5'));var rimraf=require(_0xadbf('0x6'));var config=require('../../config/environment');var attributes=require(_0xadbf('0x7'));module[_0xadbf('0x8')]=function(_0x332225,_0x19bf73){return _0x332225[_0xadbf('0x9')](_0xadbf('0xa'),attributes,{'tableName':_0xadbf('0xb'),'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 a9a39f9..9b0f5bd 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 _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 +var _0x19e6=['stringify','error','code','message','result','CreateVoiceDialReport','create','options','raw','catch','UpdateVoiceDialReport','VoiceDialReport','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x516d17,_0x33afaf){var _0x841c1d=function(_0xdcac6c){while(--_0xdcac6c){_0x516d17['push'](_0x516d17['shift']());}};_0x841c1d(++_0x33afaf);}(_0x19e6,0xd6));var _0x619e=function(_0x41d2c6,_0x4c1a0c){_0x41d2c6=_0x41d2c6-0x0;var _0x1ec2ca=_0x19e6[_0x41d2c6];return _0x1ec2ca;};'use strict';var _=require(_0x619e('0x0'));var util=require(_0x619e('0x1'));var moment=require(_0x619e('0x2'));var BPromise=require(_0x619e('0x3'));var rs=require(_0x619e('0x4'));var fs=require('fs');var Redis=require(_0x619e('0x5'));var db=require(_0x619e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x619e('0x7'))(_0x619e('0x8'));var config=require('../../config/environment');var jayson=require(_0x619e('0x9'));var client=jayson[_0x619e('0xa')][_0x619e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48a3aa,_0x43f764,_0x50d7fc){return new BPromise(function(_0x2de837,_0x105a87){return client['request'](_0x48a3aa,_0x50d7fc)[_0x619e('0xc')](function(_0x110c7e){logger[_0x619e('0xd')](_0x619e('0xe'),_0x43f764,_0x619e('0xf'));logger[_0x619e('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x43f764,_0x619e('0xf'),JSON[_0x619e('0x11')](_0x110c7e));if(_0x110c7e[_0x619e('0x12')]){if(_0x110c7e[_0x619e('0x12')][_0x619e('0x13')]===0x1f4){logger[_0x619e('0x12')](_0x619e('0xe'),_0x43f764,_0x110c7e['error'][_0x619e('0x14')]);return _0x105a87(_0x110c7e[_0x619e('0x12')]['message']);}logger[_0x619e('0x12')](_0x619e('0xe'),_0x43f764,_0x110c7e['error'][_0x619e('0x14')]);return _0x2de837(_0x110c7e['error']['message']);}else{logger[_0x619e('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x43f764,'request\x20sent');_0x2de837(_0x110c7e[_0x619e('0x15')][_0x619e('0x14')]);}})['catch'](function(_0xb3e376){logger[_0x619e('0x12')](_0x619e('0xe'),_0x43f764,_0xb3e376);_0x105a87(_0xb3e376);});});}exports[_0x619e('0x16')]=function(_0x1fce67){var _0x23bf7a=this;return new Promise(function(_0x43d3be,_0x27a7dc){return db['VoiceDialReport'][_0x619e('0x17')](_0x1fce67['body'],{'raw':_0x1fce67['options']?_0x1fce67[_0x619e('0x18')][_0x619e('0x19')]===undefined?!![]:![]:!![]})[_0x619e('0xc')](function(_0x703982){logger[_0x619e('0xd')](_0x619e('0x16'),_0x1fce67);logger[_0x619e('0x10')](_0x619e('0x16'),_0x1fce67,JSON[_0x619e('0x11')](_0x703982));_0x43d3be(_0x703982);})[_0x619e('0x1a')](function(_0x1b13a9){logger[_0x619e('0x12')](_0x619e('0x16'),_0x1b13a9[_0x619e('0x14')],_0x1fce67);_0x27a7dc(_0x23bf7a[_0x619e('0x12')](0x1f4,_0x1b13a9[_0x619e('0x14')]));});});};exports[_0x619e('0x1b')]=function(_0x460cc2){var _0x439b20=this;return new Promise(function(_0x560ce5,_0x253e09){return db[_0x619e('0x1c')]['update'](_0x460cc2[_0x619e('0x1d')],{'raw':_0x460cc2['options']?_0x460cc2[_0x619e('0x18')][_0x619e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x460cc2[_0x619e('0x18')]?_0x460cc2[_0x619e('0x18')][_0x619e('0x1e')]||null:null,'attributes':_0x460cc2['options']?_0x460cc2[_0x619e('0x18')][_0x619e('0x1f')]||null:null,'limit':_0x460cc2[_0x619e('0x18')]?_0x460cc2[_0x619e('0x18')][_0x619e('0x20')]||null:null})['then'](function(_0x47f1c3){logger['info']('UpdateVoiceDialReport',_0x460cc2);logger[_0x619e('0x10')](_0x619e('0x1b'),_0x460cc2,JSON['stringify'](_0x47f1c3));_0x560ce5(_0x47f1c3);})['catch'](function(_0x3bdaeb){logger['error']('UpdateVoiceDialReport',_0x3bdaeb['message'],_0x460cc2);_0x253e09(_0x439b20[_0x619e('0x12')](0x1f4,_0x3bdaeb[_0x619e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 088d234..de96b77 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 _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 +var _0x7f11=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','/:id/applications','addApplications','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x12e7b8,_0x65f525){var _0x2ba712=function(_0x5aa850){while(--_0x5aa850){_0x12e7b8['push'](_0x12e7b8['shift']());}};_0x2ba712(++_0x65f525);}(_0x7f11,0x10c));var _0x17f1=function(_0xa72c46,_0x5d6163){_0xa72c46=_0xa72c46-0x0;var _0x2cc7a6=_0x7f11[_0xa72c46];return _0x2cc7a6;};'use strict';var multer=require(_0x17f1('0x0'));var util=require(_0x17f1('0x1'));var path=require(_0x17f1('0x2'));var timeout=require(_0x17f1('0x3'));var express=require(_0x17f1('0x4'));var router=express[_0x17f1('0x5')]();var auth=require(_0x17f1('0x6'));var interaction=require(_0x17f1('0x7'));var config=require(_0x17f1('0x8'));var controller=require('./voiceExtension.controller');router[_0x17f1('0x9')]('/',auth[_0x17f1('0xa')](),controller[_0x17f1('0xb')]);router[_0x17f1('0x9')](_0x17f1('0xc'),auth['isAuthenticated'](),controller[_0x17f1('0xd')]);router[_0x17f1('0xe')]('/',auth[_0x17f1('0xa')](),controller['create']);router['post'](_0x17f1('0xf'),auth['isAuthenticated'](),controller[_0x17f1('0x10')]);router['put']('/:id',auth[_0x17f1('0xa')](),controller[_0x17f1('0x11')]);router[_0x17f1('0x12')](_0x17f1('0xc'),auth['isAuthenticated'](),controller[_0x17f1('0x13')]);module[_0x17f1('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 5b83c90..2a4c835 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(_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 +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x343ea3,_0x520941){var _0x3d9fbf=function(_0x194095){while(--_0x194095){_0x343ea3['push'](_0x343ea3['shift']());}};_0x3d9fbf(++_0x520941);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 d274d36..eee3ba4 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 _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 +var _0x0dcc=['VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','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','redis','localhost','socket.io-emitter','./voiceExtension.socket','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','get','InboundRoutes','inbound','InternalRoutes','internal','filter','map','value','includes','type','find','name','UserProfileResource','end','stack','index','VoiceExtension','fieldName','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','destroy','create','startsWith','body','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OutboundRoutes','userProfileId','autoAssociation','description','cutdigits','context','addApplications','findOne','sequelize','transaction'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x0dcc,0x145));var _0xc0dc=function(_0x103ab3,_0x24957a){_0x103ab3=_0x103ab3-0x0;var _0x166d52=_0x0dcc[_0x103ab3];return _0x166d52;};'use strict';var pdf=require(_0xc0dc('0x0'));var emlformat=require(_0xc0dc('0x1'));var rimraf=require(_0xc0dc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc0dc('0x3'));var rp=require('request-promise');var moment=require(_0xc0dc('0x4'));var BPromise=require(_0xc0dc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc0dc('0x6'));var sox=require(_0xc0dc('0x7'));var csv=require(_0xc0dc('0x8'));var ejs=require(_0xc0dc('0x9'));var fs=require('fs');var _=require(_0xc0dc('0xa'));var squel=require(_0xc0dc('0xb'));var crypto=require(_0xc0dc('0xc'));var jsforce=require(_0xc0dc('0xd'));var deskjs=require(_0xc0dc('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc0dc('0xf'));var Papa=require(_0xc0dc('0x10'));var Redis=require(_0xc0dc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc0dc('0x12'));var as=require(_0xc0dc('0x13'));var hardwareService=require(_0xc0dc('0x14'));var logger=require(_0xc0dc('0x15'))(_0xc0dc('0x16'));var utils=require(_0xc0dc('0x17'));var config=require(_0xc0dc('0x18'));var licenseUtil=require(_0xc0dc('0x19'));var db=require(_0xc0dc('0x1a'))['db'];config[_0xc0dc('0x1b')]=_['defaults'](config[_0xc0dc('0x1b')],{'host':_0xc0dc('0x1c'),'port':0x18eb});var socket=require(_0xc0dc('0x1d'))(new Redis(config[_0xc0dc('0x1b')]));require(_0xc0dc('0x1e'))['register'](socket);function respondWithStatusCode(_0xc871e,_0xd8b713){_0xd8b713=_0xd8b713||0xcc;return function(_0x2a7951){if(_0x2a7951){return _0xc871e['sendStatus'](_0xd8b713);}return _0xc871e[_0xc0dc('0x1f')](_0xd8b713)['end']();};}function respondWithResult(_0x2f1c0a,_0x3f08f1){_0x3f08f1=_0x3f08f1||0xc8;return function(_0x32d4cb){if(_0x32d4cb){return _0x2f1c0a[_0xc0dc('0x1f')](_0x3f08f1)['json'](_0x32d4cb);}};}function respondWithFilteredResult(_0x29f8bc,_0x24b995){return function(_0x1b5f78){if(_0x1b5f78){var _0x47d0e7=_0x1b5f78[_0xc0dc('0x20')],_0x391a56=_0x24b995[_0xc0dc('0x21')],_0x5f35fd=_0x24b995[_0xc0dc('0x21')]+_0x24b995[_0xc0dc('0x22')],_0x3de6e8;if(_0x5f35fd>=_0x47d0e7){_0x5f35fd=_0x47d0e7;_0x3de6e8=0xc8;}else{_0x3de6e8=0xce;}_0x29f8bc[_0xc0dc('0x1f')](_0x3de6e8);return _0x29f8bc['set'](_0xc0dc('0x23'),_0x391a56+'-'+_0x5f35fd+'/'+_0x47d0e7)[_0xc0dc('0x24')](_0x1b5f78);}return null;};}function patchUpdates(_0x17be06){return function(_0x191a6f){try{jsonpatch[_0xc0dc('0x25')](_0x191a6f,_0x17be06,!![]);}catch(_0x5d592f){return BPromise[_0xc0dc('0x26')](_0x5d592f);}return _0x191a6f[_0xc0dc('0x27')]();};}function saveUpdates(_0x47a933,_0x5a5ab9){return function(_0x1816ae){if(_0x1816ae){return _0x1816ae[_0xc0dc('0x28')](_0x47a933)[_0xc0dc('0x29')](function(_0x51f8f2){return _0x51f8f2;});}return null;};}function removeEntity(_0x100a84,_0x20bdaa){return function(_0x26b75e){if(_0x26b75e){return _0x26b75e['destroy']()[_0xc0dc('0x29')](function(){var _0x18b06a=_0x26b75e[_0xc0dc('0x2a')]({'plain':!![]});var _0x47bec4=[{'name':_0xc0dc('0x2b'),'value':_0xc0dc('0x2c'),'ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0xc0dc('0x2d'),'value':_0xc0dc('0x2e'),'ignore':![]}];var _0x383aea=_(_0x47bec4)[_0xc0dc('0x2f')]('ignore')[_0xc0dc('0x30')](_0xc0dc('0x31'))[_0xc0dc('0x31')]();if(_[_0xc0dc('0x32')](_0x383aea,_0x18b06a[_0xc0dc('0x33')])){return;}var _0x511437=_[_0xc0dc('0x34')](_0x47bec4,[_0xc0dc('0x31'),_0x18b06a[_0xc0dc('0x33')]])[_0xc0dc('0x35')];return db[_0xc0dc('0x36')]['destroy']({'where':{'type':_0x511437,'resourceId':_0x18b06a['id']}})[_0xc0dc('0x29')](function(){return _0x26b75e;});})['then'](function(){_0x100a84['status'](0xcc)[_0xc0dc('0x37')]();});}};}function handleEntityNotFound(_0x5469b4,_0x47bdd4){return function(_0x2b679c){if(!_0x2b679c){_0x5469b4['sendStatus'](0x194);}return _0x2b679c;};}function handleError(_0x59f94b,_0x2a10d9){_0x2a10d9=_0x2a10d9||0x1f4;return function(_0x5396ed){logger['error'](_0x5396ed[_0xc0dc('0x38')]);if(_0x5396ed[_0xc0dc('0x35')]){delete _0x5396ed[_0xc0dc('0x35')];}_0x59f94b[_0xc0dc('0x1f')](_0x2a10d9)['send'](_0x5396ed);};}exports[_0xc0dc('0x39')]=function(_0x5618a3,_0x120ec4){var _0x1cfc84={},_0x1e2f2c={},_0x1ca1d5={'count':0x0,'rows':[]};var _0x227911=_[_0xc0dc('0x30')](db[_0xc0dc('0x3a')]['rawAttributes'],function(_0x1c21eb){return{'name':_0x1c21eb[_0xc0dc('0x3b')],'type':_0x1c21eb[_0xc0dc('0x33')][_0xc0dc('0x3c')]};});_0x1e2f2c['model']=_[_0xc0dc('0x30')](_0x227911,_0xc0dc('0x35'));_0x1e2f2c[_0xc0dc('0x3d')]=_[_0xc0dc('0x3e')](_0x5618a3[_0xc0dc('0x3d')]);_0x1e2f2c['filters']=_[_0xc0dc('0x3f')](_0x1e2f2c[_0xc0dc('0x40')],_0x1e2f2c['query']);_0x1cfc84['attributes']=_[_0xc0dc('0x3f')](_0x1e2f2c[_0xc0dc('0x40')],qs['fields'](_0x5618a3[_0xc0dc('0x3d')][_0xc0dc('0x41')]));_0x1cfc84['attributes']=_0x1cfc84[_0xc0dc('0x42')][_0xc0dc('0x43')]?_0x1cfc84[_0xc0dc('0x42')]:_0x1e2f2c[_0xc0dc('0x40')];if(!_0x5618a3[_0xc0dc('0x3d')][_0xc0dc('0x44')]('nolimit')){_0x1cfc84['limit']=qs[_0xc0dc('0x22')](_0x5618a3['query']['limit']);_0x1cfc84[_0xc0dc('0x21')]=qs['offset'](_0x5618a3[_0xc0dc('0x3d')][_0xc0dc('0x21')]);}_0x1cfc84[_0xc0dc('0x45')]=qs[_0xc0dc('0x46')](_0x5618a3['query'][_0xc0dc('0x46')]);_0x1cfc84[_0xc0dc('0x47')]=qs[_0xc0dc('0x48')](_['pick'](_0x5618a3[_0xc0dc('0x3d')],_0x1e2f2c[_0xc0dc('0x48')]),_0x227911);if(_0x5618a3[_0xc0dc('0x3d')][_0xc0dc('0x2f')]){_0x1cfc84['where']=_['merge'](_0x1cfc84[_0xc0dc('0x47')],{'$or':_[_0xc0dc('0x30')](_0x227911,function(_0x1a11f1){if(_0x1a11f1[_0xc0dc('0x33')]!==_0xc0dc('0x49')){var _0x228736={};_0x228736[_0x1a11f1[_0xc0dc('0x35')]]={'$like':'%'+_0x5618a3[_0xc0dc('0x3d')]['filter']+'%'};return _0x228736;}})});}_0x1cfc84=_['merge']({},_0x1cfc84,_0x5618a3[_0xc0dc('0x4a')]);var _0x44f488={'where':_0x1cfc84['where']};return db[_0xc0dc('0x3a')][_0xc0dc('0x20')](_0x44f488)[_0xc0dc('0x29')](function(_0x51a85e){_0x1ca1d5[_0xc0dc('0x20')]=_0x51a85e;if(_0x5618a3[_0xc0dc('0x3d')][_0xc0dc('0x4b')]){_0x1cfc84[_0xc0dc('0x4c')]=[{'all':!![]}];}return db[_0xc0dc('0x3a')][_0xc0dc('0x4d')](_0x1cfc84);})[_0xc0dc('0x29')](function(_0x53316b){_0x1ca1d5[_0xc0dc('0x4e')]=_0x53316b;return _0x1ca1d5;})[_0xc0dc('0x29')](respondWithFilteredResult(_0x120ec4,_0x1cfc84))[_0xc0dc('0x4f')](handleError(_0x120ec4,null));};exports[_0xc0dc('0x50')]=function(_0x4bb1ba,_0x35d65f){var _0x2abcb9={'raw':![],'where':{'id':_0x4bb1ba[_0xc0dc('0x51')]['id']}},_0x4801bf={};_0x4801bf[_0xc0dc('0x40')]=_[_0xc0dc('0x3e')](db['VoiceExtension'][_0xc0dc('0x52')]);_0x4801bf[_0xc0dc('0x3d')]=_['keys'](_0x4bb1ba['query']);_0x4801bf[_0xc0dc('0x48')]=_[_0xc0dc('0x3f')](_0x4801bf[_0xc0dc('0x40')],_0x4801bf[_0xc0dc('0x3d')]);_0x2abcb9['attributes']=_['intersection'](_0x4801bf['model'],qs['fields'](_0x4bb1ba['query']['fields']));_0x2abcb9['attributes']=_0x2abcb9[_0xc0dc('0x42')][_0xc0dc('0x43')]?_0x2abcb9[_0xc0dc('0x42')]:_0x4801bf[_0xc0dc('0x40')];if(_0x4bb1ba[_0xc0dc('0x3d')]['includeAll']){_0x2abcb9['include']=[{'all':!![]}];}_0x2abcb9=_[_0xc0dc('0x53')]({},_0x2abcb9,_0x4bb1ba[_0xc0dc('0x4a')]);return db['VoiceExtension'][_0xc0dc('0x34')](_0x2abcb9)['then'](handleEntityNotFound(_0x35d65f,null))[_0xc0dc('0x29')](respondWithResult(_0x35d65f,null))[_0xc0dc('0x4f')](handleError(_0x35d65f,null));};exports[_0xc0dc('0x54')]=function(_0x370f3d,_0x3f6c00){return db[_0xc0dc('0x3a')][_0xc0dc('0x34')]({'where':{'id':_0x370f3d['params']['id']}})[_0xc0dc('0x29')](handleEntityNotFound(_0x3f6c00,null))[_0xc0dc('0x29')](removeEntity(_0x3f6c00,null))[_0xc0dc('0x4f')](handleError(_0x3f6c00,null));};exports[_0xc0dc('0x55')]=function(_0x4771a8,_0x4900f8){if(_0x4771a8['body'][_0xc0dc('0x33')]==='outbound'&&!_[_0xc0dc('0x56')](_0x4771a8[_0xc0dc('0x57')][_0xc0dc('0x58')],'_')){_0x4771a8[_0xc0dc('0x57')]['exten']='_'[_0xc0dc('0x59')](_0x4771a8['body'][_0xc0dc('0x58')]);}return db[_0xc0dc('0x3a')][_0xc0dc('0x55')](_0x4771a8[_0xc0dc('0x57')],{'raw':![]})[_0xc0dc('0x29')](function(_0x55419e){var _0x21a6a5=_0x4771a8['user']['get']({'plain':!![]});if(!_0x21a6a5)throw new Error(_0xc0dc('0x5a'));if(_0x21a6a5[_0xc0dc('0x5b')]===_0xc0dc('0x5c')){var _0x42b4c3=_0x55419e[_0xc0dc('0x2a')]({'plain':!![]});var _0x271ede=[{'name':_0xc0dc('0x2b'),'value':_0xc0dc('0x2c')},{'name':_0xc0dc('0x5d'),'value':'outbound'},{'name':'InternalRoutes','value':'internal'}];var _0xd9bd96=_[_0xc0dc('0x34')](_0x271ede,[_0xc0dc('0x31'),_0x42b4c3[_0xc0dc('0x33')]])[_0xc0dc('0x35')];return db['UserProfileSection'][_0xc0dc('0x34')]({'where':{'name':_0xd9bd96,'userProfileId':_0x21a6a5[_0xc0dc('0x5e')]},'raw':!![]})[_0xc0dc('0x29')](function(_0x4f9652){if(_0x4f9652&&_0x4f9652[_0xc0dc('0x5f')]===0x0){return db[_0xc0dc('0x36')][_0xc0dc('0x55')]({'name':_0x42b4c3['name'],'resourceId':_0x42b4c3['id'],'type':_0x4f9652[_0xc0dc('0x35')],'sectionId':_0x4f9652['id']},{})[_0xc0dc('0x29')](function(){return _0x55419e;});}else{return _0x55419e;}})['catch'](function(_0x5ef194){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ef194);throw _0x5ef194;});}return _0x55419e;})[_0xc0dc('0x29')](respondWithResult(_0x4900f8,0xc9))[_0xc0dc('0x4f')](handleError(_0x4900f8,null));};exports[_0xc0dc('0x28')]=function(_0x550163,_0x34ea6d){if(_0x550163['body']['id']){delete _0x550163[_0xc0dc('0x57')]['id'];}return db[_0xc0dc('0x3a')][_0xc0dc('0x34')]({'where':{'id':_0x550163[_0xc0dc('0x51')]['id']}})[_0xc0dc('0x29')](handleEntityNotFound(_0x34ea6d,null))[_0xc0dc('0x29')](function(_0x406c6e){if(_0x406c6e){return db[_0xc0dc('0x3a')]['update'](_['pick'](_0x550163[_0xc0dc('0x57')],[_0xc0dc('0x58'),'context',_0xc0dc('0x60'),'recordingFormat',_0xc0dc('0x61'),'mandatoryDisposition']),{'where':{'context':_0x406c6e[_0xc0dc('0x62')],'exten':_0x406c6e[_0xc0dc('0x58')]},'individualHooks':!![]})['then'](function(_0x4dfed7){return _0x4dfed7;});}return null;})[_0xc0dc('0x29')](respondWithStatusCode(_0x34ea6d,null))['catch'](handleError(_0x34ea6d,null));};exports[_0xc0dc('0x63')]=function(_0x283704,_0x3d3f81,_0x38699b){return db[_0xc0dc('0x3a')][_0xc0dc('0x64')]({'where':{'id':_0x283704['params']['id']}})[_0xc0dc('0x29')](handleEntityNotFound(_0x3d3f81,null))[_0xc0dc('0x29')](function(_0x5d7bb6){if(_0x5d7bb6){return db[_0xc0dc('0x65')][_0xc0dc('0x66')](function(_0x2964e0){return db[_0xc0dc('0x3a')][_0xc0dc('0x54')]({'where':{'VoiceExtensionId':_0x283704[_0xc0dc('0x51')]['id']},'transaction':_0x2964e0})[_0xc0dc('0x29')](function(_0x459ef0){var _0x5e9fc1=_[_0xc0dc('0x30')](_0x283704[_0xc0dc('0x57')],function(_0x47eeb6){_0x47eeb6[_0xc0dc('0x67')]=_0x283704[_0xc0dc('0x51')]['id'];return _0x47eeb6;});return db[_0xc0dc('0x3a')][_0xc0dc('0x68')](_0x5e9fc1,{'transaction':_0x2964e0});});})[_0xc0dc('0x29')](function(){return db[_0xc0dc('0x3a')][_0xc0dc('0x69')]({'where':{'isApp':!![],'VoiceExtensionId':_0x283704['params']['id']},'order':_0xc0dc('0x6a')});});}})[_0xc0dc('0x29')](respondWithResult(_0x3d3f81,null))['catch'](handleError(_0x3d3f81,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 81ea6ae..3609d86 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 _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 +var _0x975c=['hook','exports','../../mysqldb','VoiceExtension','save','update','emit','hasOwnProperty'];(function(_0x2d554f,_0x284acd){var _0x579473=function(_0x4f155c){while(--_0x4f155c){_0x2d554f['push'](_0x2d554f['shift']());}};_0x579473(++_0x284acd);}(_0x975c,0x122));var _0xc975=function(_0x4dea7e,_0x1f527e){_0x4dea7e=_0x4dea7e-0x0;var _0x46cca6=_0x975c[_0x4dea7e];return _0x46cca6;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xc975('0x0'))['db'][_0xc975('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc975('0x2'),'afterUpdate':_0xc975('0x3'),'afterDestroy':'remove'};function emitEvent(_0x26b4ec){return function(_0x11f1a7,_0x3433d7,_0x560aa7){VoiceExtensionEvents[_0xc975('0x4')](_0x26b4ec+':'+_0x11f1a7['id'],_0x11f1a7);VoiceExtensionEvents[_0xc975('0x4')](_0x26b4ec,_0x11f1a7);_0x560aa7(null);};}for(var e in events){if(events[_0xc975('0x5')](e)){var event=events[e];VoiceExtension[_0xc975('0x6')](e,emitEvent(event));}}module[_0xc975('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index fcd1446..0e211ea 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 _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 +var _0xb31c=['path','rimraf','../../config/environment','./voiceExtension.attributes','exports','VoiceExtension','voice_extensions','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x542da8,_0x509c26){var _0x533d7e=function(_0x2a3d04){while(--_0x2a3d04){_0x542da8['push'](_0x542da8['shift']());}};_0x533d7e(++_0x509c26);}(_0xb31c,0xeb));var _0xcb31=function(_0x459975,_0x4afac3){_0x459975=_0x459975-0x0;var _0x4db023=_0xb31c[_0x459975];return _0x4db023;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcb31('0x0'))(_0xcb31('0x1'));var moment=require(_0xcb31('0x2'));var BPromise=require(_0xcb31('0x3'));var rp=require(_0xcb31('0x4'));var fs=require('fs');var path=require(_0xcb31('0x5'));var rimraf=require(_0xcb31('0x6'));var config=require(_0xcb31('0x7'));var attributes=require(_0xcb31('0x8'));module[_0xcb31('0x9')]=function(_0x84a13a,_0x175c93){return _0x84a13a['define'](_0xcb31('0xa'),attributes,{'tableName':_0xcb31('0xb'),'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 74634bc..368a3ab 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 _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 +var _0x177f=['where','attributes','limit','map','model','include','GetVoiceExtension','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','VoiceExtension','findAll','raw','options'];(function(_0x1f9ee0,_0x2152a2){var _0x4274b5=function(_0x4c72bd){while(--_0x4c72bd){_0x1f9ee0['push'](_0x1f9ee0['shift']());}};_0x4274b5(++_0x2152a2);}(_0x177f,0x120));var _0xf177=function(_0xf1a005,_0x361fee){_0xf1a005=_0xf1a005-0x0;var _0x5313f6=_0x177f[_0xf1a005];return _0x5313f6;};'use strict';var _=require(_0xf177('0x0'));var util=require('util');var moment=require(_0xf177('0x1'));var BPromise=require(_0xf177('0x2'));var rs=require(_0xf177('0x3'));var fs=require('fs');var Redis=require(_0xf177('0x4'));var db=require(_0xf177('0x5'))['db'];var utils=require(_0xf177('0x6'));var logger=require(_0xf177('0x7'))(_0xf177('0x8'));var config=require(_0xf177('0x9'));var jayson=require(_0xf177('0xa'));var client=jayson[_0xf177('0xb')]['http']({'port':0x232a});config[_0xf177('0xc')]=_[_0xf177('0xd')](config[_0xf177('0xc')],{'host':_0xf177('0xe'),'port':0x18eb});var socket=require(_0xf177('0xf'))(new Redis(config[_0xf177('0xc')]));require(_0xf177('0x10'))[_0xf177('0x11')](socket);function respondWithRpcPromise(_0x990bdb,_0x452ce9,_0x364f12){return new BPromise(function(_0xa1fdce,_0x4cd1ae){return client['request'](_0x990bdb,_0x364f12)[_0xf177('0x12')](function(_0x2f33d2){logger[_0xf177('0x13')](_0xf177('0x14'),_0x452ce9,_0xf177('0x15'));logger[_0xf177('0x16')](_0xf177('0x17'),_0x452ce9,_0xf177('0x15'),JSON['stringify'](_0x2f33d2));if(_0x2f33d2[_0xf177('0x18')]){if(_0x2f33d2[_0xf177('0x18')][_0xf177('0x19')]===0x1f4){logger['error'](_0xf177('0x14'),_0x452ce9,_0x2f33d2[_0xf177('0x18')][_0xf177('0x1a')]);return _0x4cd1ae(_0x2f33d2['error'][_0xf177('0x1a')]);}logger[_0xf177('0x18')](_0xf177('0x14'),_0x452ce9,_0x2f33d2[_0xf177('0x18')][_0xf177('0x1a')]);return _0xa1fdce(_0x2f33d2['error'][_0xf177('0x1a')]);}else{logger[_0xf177('0x13')](_0xf177('0x14'),_0x452ce9,_0xf177('0x15'));_0xa1fdce(_0x2f33d2[_0xf177('0x1b')][_0xf177('0x1a')]);}})['catch'](function(_0x35f3b8){logger[_0xf177('0x18')](_0xf177('0x14'),_0x452ce9,_0x35f3b8);_0x4cd1ae(_0x35f3b8);});});}exports['GetVoiceExtension']=function(_0x10874f){var _0x4aeb38=this;return new Promise(function(_0xee59db,_0x37ef1a){return db[_0xf177('0x1c')][_0xf177('0x1d')]({'raw':_0x10874f['options']?_0x10874f['options'][_0xf177('0x1e')]===undefined?!![]:![]:!![],'where':_0x10874f[_0xf177('0x1f')]?_0x10874f[_0xf177('0x1f')][_0xf177('0x20')]||null:null,'attributes':_0x10874f['options']?_0x10874f[_0xf177('0x1f')][_0xf177('0x21')]||null:null,'limit':_0x10874f[_0xf177('0x1f')]?_0x10874f[_0xf177('0x1f')][_0xf177('0x22')]||null:null,'include':_0x10874f[_0xf177('0x1f')]?_0x10874f[_0xf177('0x1f')]['include']?_[_0xf177('0x23')](_0x10874f[_0xf177('0x1f')]['include'],function(_0x4b67ef){return{'model':db[_0x4b67ef[_0xf177('0x24')]],'as':_0x4b67ef['as'],'attributes':_0x4b67ef[_0xf177('0x21')],'include':_0x4b67ef[_0xf177('0x25')]?_[_0xf177('0x23')](_0x4b67ef[_0xf177('0x25')],function(_0x4b9ac5){return{'model':db[_0x4b9ac5[_0xf177('0x24')]],'as':_0x4b9ac5['as'],'attributes':_0x4b9ac5[_0xf177('0x21')],'include':_0x4b9ac5['include']?_[_0xf177('0x23')](_0x4b9ac5[_0xf177('0x25')],function(_0xea61b1){return{'model':db[_0xea61b1['model']],'as':_0xea61b1['as'],'attributes':_0xea61b1[_0xf177('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf177('0x12')](function(_0x3f600e){logger[_0xf177('0x13')](_0xf177('0x26'),_0x10874f);logger[_0xf177('0x16')](_0xf177('0x26'),_0x10874f,JSON['stringify'](_0x3f600e));_0xee59db(_0x3f600e);})[_0xf177('0x27')](function(_0x3b2859){logger[_0xf177('0x18')]('GetVoiceExtension',_0x3b2859[_0xf177('0x1a')],_0x10874f);_0x37ef1a(_0x4aeb38[_0xf177('0x18')](0x1f4,_0x3b2859[_0xf177('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 8a35a41..ea759c8 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 _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 +var _0x7590=['./voiceExtension.events','remove','update','emit','removeListener','register','length','voiceExtension:'];(function(_0x41d4f1,_0x5c903f){var _0x22e971=function(_0x75b68){while(--_0x75b68){_0x41d4f1['push'](_0x41d4f1['shift']());}};_0x22e971(++_0x5c903f);}(_0x7590,0x160));var _0x0759=function(_0x2bda2b,_0xc5bb5d){_0x2bda2b=_0x2bda2b-0x0;var _0x50dbb2=_0x7590[_0x2bda2b];return _0x50dbb2;};'use strict';var VoiceExtensionEvents=require(_0x0759('0x0'));var events=['save',_0x0759('0x1'),_0x0759('0x2')];function createListener(_0x339a02,_0x3e5aa8){return function(_0x1fceae){_0x3e5aa8[_0x0759('0x3')](_0x339a02,_0x1fceae);};}function removeListener(_0x23afab,_0x3041c9){return function(){VoiceExtensionEvents[_0x0759('0x4')](_0x23afab,_0x3041c9);};}exports[_0x0759('0x5')]=function(_0x1b3417){for(var _0x4a4235=0x0,_0x40c66b=events[_0x0759('0x6')];_0x4a4235<_0x40c66b;_0x4a4235++){var _0x38e587=events[_0x4a4235];var _0x24619b=createListener(_0x0759('0x7')+_0x38e587,_0x1b3417);VoiceExtensionEvents['on'](_0x38e587,_0x24619b);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 5756453..89e9d80 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 _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 +var _0xc78f=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','/:id/messages','create','/:id','update','destroy','exports'];(function(_0x439d2d,_0x3c3249){var _0x7d77cc=function(_0x44d3ce){while(--_0x44d3ce){_0x439d2d['push'](_0x439d2d['shift']());}};_0x7d77cc(++_0x3c3249);}(_0xc78f,0x170));var _0xfc78=function(_0x5843fd,_0x477c79){_0x5843fd=_0x5843fd-0x0;var _0x54159b=_0xc78f[_0x5843fd];return _0x54159b;};'use strict';var multer=require(_0xfc78('0x0'));var util=require('util');var path=require(_0xfc78('0x1'));var timeout=require(_0xfc78('0x2'));var express=require(_0xfc78('0x3'));var router=express[_0xfc78('0x4')]();var auth=require(_0xfc78('0x5'));var interaction=require(_0xfc78('0x6'));var config=require('../../config/environment');var controller=require(_0xfc78('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xfc78('0x8')]('/:id',auth[_0xfc78('0x9')](),controller['show']);router[_0xfc78('0x8')](_0xfc78('0xa'),auth[_0xfc78('0x9')](),controller['getMessages']);router['post']('/',auth[_0xfc78('0x9')](),controller[_0xfc78('0xb')]);router['put'](_0xfc78('0xc'),auth['isAuthenticated'](),controller[_0xfc78('0xd')]);router['delete'](_0xfc78('0xc'),auth[_0xfc78('0x9')](),controller[_0xfc78('0xe')]);module[_0xfc78('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index eb2d880..9681c48 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 _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 +var _0x0abf=['ENUM','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','setDataValue','email','string','trim','central','yes'];(function(_0x56806d,_0x51afa2){var _0x3e629a=function(_0xf3a318){while(--_0xf3a318){_0x56806d['push'](_0x56806d['shift']());}};_0x3e629a(++_0x51afa2);}(_0x0abf,0xe8));var _0xf0ab=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0abf[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xf0ab('0x1')]},'context':{'type':Sequelize[_0xf0ab('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xf0ab('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xf0ab('0x1')]},'fullname':{'type':Sequelize[_0xf0ab('0x1')]},'email':{'type':Sequelize[_0xf0ab('0x1')],'validate':{'isEmail':!![]},'set':function(_0xbb1f91){this[_0xf0ab('0x2')](_0xf0ab('0x3'),typeof _0xbb1f91===_0xf0ab('0x4')&&_0xbb1f91['trim']()?_0xbb1f91[_0xf0ab('0x5')]():null);}},'pager':{'type':Sequelize[_0xf0ab('0x1')]},'tz':{'type':Sequelize[_0xf0ab('0x1')],'defaultValue':_0xf0ab('0x6')},'attach':{'type':Sequelize['ENUM'](_0xf0ab('0x7'),'no'),'defaultValue':_0xf0ab('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0xf0ab('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xf0ab('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xf0ab('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf0ab('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':_0xf0ab('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':_0xf0ab('0x7'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xf0ab('0x1')]},'emailbody':{'type':Sequelize[_0xf0ab('0x1')]},'maxsecs':{'type':Sequelize[_0xf0ab('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xf0ab('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf0ab('0xb')],'get':function(){return this[_0xf0ab('0xc')](_0xf0ab('0xd'))+_0xf0ab('0xe')+this[_0xf0ab('0xc')](_0xf0ab('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 2029da5..703a3fc 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 _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 +var _0x86c0=['error','stack','send','index','VoiceMail','rawAttributes','type','model','name','query','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','where','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getMessages','findOne','hasOwnProperty','order','VoiceMailMessage','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','update','then','Voicemails'];(function(_0x21debf,_0x5bab7b){var _0x324608=function(_0x2b9e13){while(--_0x2b9e13){_0x21debf['push'](_0x21debf['shift']());}};_0x324608(++_0x5bab7b);}(_0x86c0,0x133));var _0x086c=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0x86c0[_0x269ee8];return _0x4d98bd;};'use strict';var pdf=require(_0x086c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x086c('0x1'));var zipdir=require(_0x086c('0x2'));var jsonpatch=require(_0x086c('0x3'));var rp=require(_0x086c('0x4'));var moment=require('moment');var BPromise=require(_0x086c('0x5'));var Mustache=require(_0x086c('0x6'));var util=require(_0x086c('0x7'));var path=require(_0x086c('0x8'));var sox=require('sox');var csv=require(_0x086c('0x9'));var ejs=require(_0x086c('0xa'));var fs=require('fs');var _=require(_0x086c('0xb'));var squel=require(_0x086c('0xc'));var crypto=require(_0x086c('0xd'));var jsforce=require(_0x086c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x086c('0x9'));var querystring=require(_0x086c('0xf'));var Papa=require(_0x086c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x086c('0x11'));var as=require(_0x086c('0x12'));var hardwareService=require(_0x086c('0x13'));var logger=require(_0x086c('0x14'))(_0x086c('0x15'));var utils=require('../../config/utils');var config=require(_0x086c('0x16'));var licenseUtil=require(_0x086c('0x17'));var db=require(_0x086c('0x18'))['db'];function respondWithStatusCode(_0x3d7cde,_0x4b9681){_0x4b9681=_0x4b9681||0xcc;return function(_0x5144bb){if(_0x5144bb){return _0x3d7cde[_0x086c('0x19')](_0x4b9681);}return _0x3d7cde['status'](_0x4b9681)[_0x086c('0x1a')]();};}function respondWithResult(_0x282e0a,_0x5db47b){_0x5db47b=_0x5db47b||0xc8;return function(_0x40666e){if(_0x40666e){return _0x282e0a[_0x086c('0x1b')](_0x5db47b)[_0x086c('0x1c')](_0x40666e);}};}function respondWithFilteredResult(_0x2db80a,_0x587053){return function(_0x2e37fb){if(_0x2e37fb){var _0x174791=_0x2e37fb[_0x086c('0x1d')],_0x398d8f=_0x587053[_0x086c('0x1e')],_0x5382fe=_0x587053[_0x086c('0x1e')]+_0x587053[_0x086c('0x1f')],_0x34e74f;if(_0x5382fe>=_0x174791){_0x5382fe=_0x174791;_0x34e74f=0xc8;}else{_0x34e74f=0xce;}_0x2db80a['status'](_0x34e74f);return _0x2db80a['set'](_0x086c('0x20'),_0x398d8f+'-'+_0x5382fe+'/'+_0x174791)[_0x086c('0x1c')](_0x2e37fb);}return null;};}function patchUpdates(_0x1e80c2){return function(_0x36becb){try{jsonpatch[_0x086c('0x21')](_0x36becb,_0x1e80c2,!![]);}catch(_0x506b89){return BPromise['reject'](_0x506b89);}return _0x36becb['save']();};}function saveUpdates(_0x3ae033,_0x15582b){return function(_0x5b8565){if(_0x5b8565){return _0x5b8565[_0x086c('0x22')](_0x3ae033)['then'](function(_0x3a98c3){return _0x3a98c3;});}return null;};}function removeEntity(_0x216817,_0x2095d1){return function(_0x2dad53){if(_0x2dad53){return _0x2dad53['destroy']()[_0x086c('0x23')](function(){var _0x56a794=_0x2dad53['get']({'plain':!![]});var _0x5469d4=_0x086c('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x5469d4,'resourceId':_0x56a794['id']}})[_0x086c('0x23')](function(){return _0x2dad53;});})['then'](function(){_0x216817[_0x086c('0x1b')](0xcc)[_0x086c('0x1a')]();});}};}function handleEntityNotFound(_0x57507b,_0x591b0d){return function(_0x317d7b){if(!_0x317d7b){_0x57507b[_0x086c('0x19')](0x194);}return _0x317d7b;};}function handleError(_0x2ee764,_0x3fe25f){_0x3fe25f=_0x3fe25f||0x1f4;return function(_0x5a0d00){logger[_0x086c('0x25')](_0x5a0d00[_0x086c('0x26')]);if(_0x5a0d00['name']){delete _0x5a0d00['name'];}_0x2ee764['status'](_0x3fe25f)[_0x086c('0x27')](_0x5a0d00);};}exports[_0x086c('0x28')]=function(_0x57612c,_0x23e8e3){var _0x538075={},_0x43a1d0={},_0x31e428={'count':0x0,'rows':[]};var _0x290c50=_['map'](db[_0x086c('0x29')][_0x086c('0x2a')],function(_0x4b9e4c){return{'name':_0x4b9e4c['fieldName'],'type':_0x4b9e4c[_0x086c('0x2b')]['key']};});_0x43a1d0[_0x086c('0x2c')]=_['map'](_0x290c50,_0x086c('0x2d'));_0x43a1d0[_0x086c('0x2e')]=_['keys'](_0x57612c[_0x086c('0x2e')]);_0x43a1d0[_0x086c('0x2f')]=_[_0x086c('0x30')](_0x43a1d0['model'],_0x43a1d0['query']);_0x538075['attributes']=_['intersection'](_0x43a1d0[_0x086c('0x2c')],qs[_0x086c('0x31')](_0x57612c['query']['fields']));_0x538075[_0x086c('0x32')]=_0x538075[_0x086c('0x32')][_0x086c('0x33')]?_0x538075[_0x086c('0x32')]:_0x43a1d0[_0x086c('0x2c')];if(!_0x57612c[_0x086c('0x2e')]['hasOwnProperty'](_0x086c('0x34'))){_0x538075[_0x086c('0x1f')]=qs['limit'](_0x57612c['query']['limit']);_0x538075[_0x086c('0x1e')]=qs['offset'](_0x57612c[_0x086c('0x2e')][_0x086c('0x1e')]);}_0x538075['order']=qs[_0x086c('0x35')](_0x57612c['query']['sort']);_0x538075['where']=qs[_0x086c('0x2f')](_[_0x086c('0x36')](_0x57612c[_0x086c('0x2e')],_0x43a1d0[_0x086c('0x2f')]),_0x290c50);if(_0x57612c[_0x086c('0x2e')][_0x086c('0x37')]){_0x538075[_0x086c('0x38')]=_[_0x086c('0x39')](_0x538075['where'],{'$or':_[_0x086c('0x3a')](_0x290c50,function(_0x3d6ba1){if(_0x3d6ba1[_0x086c('0x2b')]!==_0x086c('0x3b')){var _0x3544a5={};_0x3544a5[_0x3d6ba1[_0x086c('0x2d')]]={'$like':'%'+_0x57612c[_0x086c('0x2e')][_0x086c('0x37')]+'%'};return _0x3544a5;}})});}_0x538075=_[_0x086c('0x39')]({},_0x538075,_0x57612c['options']);var _0x129492={'where':_0x538075[_0x086c('0x38')]};return db[_0x086c('0x29')][_0x086c('0x1d')](_0x129492)[_0x086c('0x23')](function(_0x14aca9){_0x31e428['count']=_0x14aca9;if(_0x57612c[_0x086c('0x2e')][_0x086c('0x3c')]){_0x538075[_0x086c('0x3d')]=[{'all':!![]}];}return db[_0x086c('0x29')][_0x086c('0x3e')](_0x538075);})[_0x086c('0x23')](function(_0xd73cf2){_0x31e428[_0x086c('0x3f')]=_0xd73cf2;return _0x31e428;})[_0x086c('0x23')](respondWithFilteredResult(_0x23e8e3,_0x538075))[_0x086c('0x40')](handleError(_0x23e8e3,null));};exports[_0x086c('0x41')]=function(_0x377fd1,_0x1c62ce){var _0x4a5bd7={'raw':!![],'where':{'id':_0x377fd1[_0x086c('0x42')]['id']}},_0x186694={};_0x186694[_0x086c('0x2c')]=_['keys'](db['VoiceMail'][_0x086c('0x2a')]);_0x186694[_0x086c('0x2e')]=_[_0x086c('0x43')](_0x377fd1[_0x086c('0x2e')]);_0x186694[_0x086c('0x2f')]=_[_0x086c('0x30')](_0x186694[_0x086c('0x2c')],_0x186694[_0x086c('0x2e')]);_0x4a5bd7[_0x086c('0x32')]=_[_0x086c('0x30')](_0x186694['model'],qs[_0x086c('0x31')](_0x377fd1[_0x086c('0x2e')][_0x086c('0x31')]));_0x4a5bd7['attributes']=_0x4a5bd7['attributes'][_0x086c('0x33')]?_0x4a5bd7[_0x086c('0x32')]:_0x186694[_0x086c('0x2c')];if(_0x377fd1['query'][_0x086c('0x3c')]){_0x4a5bd7[_0x086c('0x3d')]=[{'all':!![]}];}_0x4a5bd7=_[_0x086c('0x39')]({},_0x4a5bd7,_0x377fd1[_0x086c('0x44')]);return db['VoiceMail']['find'](_0x4a5bd7)['then'](handleEntityNotFound(_0x1c62ce,null))[_0x086c('0x23')](respondWithResult(_0x1c62ce,null))[_0x086c('0x40')](handleError(_0x1c62ce,null));};exports[_0x086c('0x45')]=function(_0x267e86,_0x5cdd68){return db[_0x086c('0x29')]['create'](_0x267e86[_0x086c('0x46')],{})[_0x086c('0x23')](function(_0x2b7cd7){var _0xc63c2d=_0x267e86['user'][_0x086c('0x47')]({'plain':!![]});if(!_0xc63c2d)throw new Error(_0x086c('0x48'));if(_0xc63c2d[_0x086c('0x49')]===_0x086c('0x4a')){var _0x464f07=_0x2b7cd7[_0x086c('0x47')]({'plain':!![]});var _0x289ccf=_0x086c('0x24');return db[_0x086c('0x4b')][_0x086c('0x4c')]({'where':{'name':_0x289ccf,'userProfileId':_0xc63c2d[_0x086c('0x4d')]},'raw':!![]})[_0x086c('0x23')](function(_0x25e4ca){if(_0x25e4ca&&_0x25e4ca['autoAssociation']===0x0){return db[_0x086c('0x4e')]['create']({'name':_0x464f07[_0x086c('0x2d')],'resourceId':_0x464f07['id'],'type':_0x25e4ca['name'],'sectionId':_0x25e4ca['id']},{})[_0x086c('0x23')](function(){return _0x2b7cd7;});}else{return _0x2b7cd7;}})[_0x086c('0x40')](function(_0x325cb5){logger[_0x086c('0x25')](_0x086c('0x4f'),_0x325cb5);throw _0x325cb5;});}return _0x2b7cd7;})['then'](respondWithResult(_0x5cdd68,0xc9))['catch'](handleError(_0x5cdd68,null));};exports[_0x086c('0x22')]=function(_0x2b2fe9,_0x478344){if(_0x2b2fe9[_0x086c('0x46')]['id']){delete _0x2b2fe9['body']['id'];}return db['VoiceMail']['find']({'where':{'id':_0x2b2fe9[_0x086c('0x42')]['id']}})[_0x086c('0x23')](handleEntityNotFound(_0x478344,null))['then'](saveUpdates(_0x2b2fe9[_0x086c('0x46')],null))[_0x086c('0x23')](respondWithResult(_0x478344,null))[_0x086c('0x40')](handleError(_0x478344,null));};exports[_0x086c('0x50')]=function(_0x22bd85,_0x2a5d5a){return db[_0x086c('0x29')][_0x086c('0x4c')]({'where':{'id':_0x22bd85['params']['id']}})[_0x086c('0x23')](handleEntityNotFound(_0x2a5d5a,null))[_0x086c('0x23')](removeEntity(_0x2a5d5a,null))['catch'](handleError(_0x2a5d5a,null));};exports[_0x086c('0x51')]=function(_0x5bdf01,_0x36b597,_0x500742){return db['VoiceMail'][_0x086c('0x52')]({'where':{'id':_0x5bdf01[_0x086c('0x42')]['id']}})[_0x086c('0x23')](handleEntityNotFound(_0x36b597,null))[_0x086c('0x23')](function(_0x17aa94){var _0x56ee0c;var _0x2f457f={},_0x2509c9={};_0x2509c9[_0x086c('0x2c')]=_[_0x086c('0x43')](db['VoiceMailMessage'][_0x086c('0x2a')]);_0x2509c9['query']=_[_0x086c('0x43')](_0x5bdf01[_0x086c('0x2e')]);_0x2509c9[_0x086c('0x2f')]=_[_0x086c('0x30')](_0x2509c9[_0x086c('0x2c')],_0x2509c9[_0x086c('0x2e')]);_0x2f457f[_0x086c('0x32')]=_['intersection'](_0x2509c9[_0x086c('0x2c')],qs[_0x086c('0x31')](_0x5bdf01[_0x086c('0x2e')]['fields']));_0x2f457f['attributes']=_0x2f457f[_0x086c('0x32')][_0x086c('0x33')]?_0x2f457f[_0x086c('0x32')]:_0x2509c9[_0x086c('0x2c')];if(!_0x5bdf01[_0x086c('0x2e')][_0x086c('0x53')](_0x086c('0x34'))){_0x2f457f[_0x086c('0x1f')]=qs[_0x086c('0x1f')](_0x5bdf01['query'][_0x086c('0x1f')]);_0x2f457f[_0x086c('0x1e')]=qs[_0x086c('0x1e')](_0x5bdf01['query'][_0x086c('0x1e')]);}_0x2f457f[_0x086c('0x54')]=qs[_0x086c('0x35')](_0x5bdf01[_0x086c('0x2e')][_0x086c('0x35')]);_0x2f457f['where']=qs[_0x086c('0x2f')](_[_0x086c('0x36')](_0x5bdf01['query'],_0x2509c9['filters']));if(_0x5bdf01[_0x086c('0x2e')][_0x086c('0x37')]){_0x2f457f[_0x086c('0x38')]=_[_0x086c('0x39')](_0x2f457f[_0x086c('0x38')],{'$or':_[_0x086c('0x3a')](_0x2f457f[_0x086c('0x32')],function(_0x2d721f){var _0x53571f={};_0x53571f[_0x2d721f]={'$like':'%'+_0x5bdf01[_0x086c('0x2e')][_0x086c('0x37')]+'%'};return _0x53571f;})});}_0x2f457f[_0x086c('0x38')]=_[_0x086c('0x39')](_0x2f457f[_0x086c('0x38')],{'mailboxuser':_0x17aa94['mailbox']});_0x2f457f=_[_0x086c('0x39')]({},_0x2f457f,_0x5bdf01[_0x086c('0x44')]);return db[_0x086c('0x55')]['findAndCountAll'](_0x2f457f)[_0x086c('0x23')](respondWithFilteredResult(_0x36b597,_0x2f457f));})[_0x086c('0x40')](handleError(_0x36b597,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 1a93812..8215579 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 _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 +var _0x414f=['rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x181d13,_0x261e23){var _0x179d8c=function(_0x5196cf){while(--_0x5196cf){_0x181d13['push'](_0x181d13['shift']());}};_0x179d8c(++_0x261e23);}(_0x414f,0x13f));var _0xf414=function(_0x397ddb,_0x574faf){_0x397ddb=_0x397ddb-0x0;var _0x4af353=_0x414f[_0x397ddb];return _0x4af353;};'use strict';var _=require(_0xf414('0x0'));var util=require('util');var logger=require(_0xf414('0x1'))(_0xf414('0x2'));var moment=require('moment');var BPromise=require(_0xf414('0x3'));var rp=require(_0xf414('0x4'));var fs=require('fs');var path=require(_0xf414('0x5'));var rimraf=require(_0xf414('0x6'));var config=require(_0xf414('0x7'));var attributes=require(_0xf414('0x8'));module[_0xf414('0x9')]=function(_0x5dda1d,_0x3be83a){return _0x5dda1d['define'](_0xf414('0xa'),attributes,{'tableName':_0xf414('0xb'),'paranoid':![],'indexes':[{'name':_0xf414('0xc'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 0ce9f97..2b53e13 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 _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 +var _0xbb8a=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xbb8a,0x1a6));var _0xabb8=function(_0x3aab60,_0x379540){_0x3aab60=_0x3aab60-0x0;var _0x44a2cf=_0xbb8a[_0x3aab60];return _0x44a2cf;};'use strict';var _=require(_0xabb8('0x0'));var util=require(_0xabb8('0x1'));var moment=require(_0xabb8('0x2'));var BPromise=require(_0xabb8('0x3'));var rs=require(_0xabb8('0x4'));var fs=require('fs');var Redis=require(_0xabb8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xabb8('0x6'));var logger=require(_0xabb8('0x7'))(_0xabb8('0x8'));var config=require('../../config/environment');var jayson=require(_0xabb8('0x9'));var client=jayson[_0xabb8('0xa')][_0xabb8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52fd02,_0x5b7f6b,_0x111e06){return new BPromise(function(_0x2bed2b,_0x41ae9){return client['request'](_0x52fd02,_0x111e06)[_0xabb8('0xc')](function(_0xbaefba){logger[_0xabb8('0xd')](_0xabb8('0xe'),_0x5b7f6b,_0xabb8('0xf'));logger[_0xabb8('0x10')](_0xabb8('0x11'),_0x5b7f6b,_0xabb8('0xf'),JSON['stringify'](_0xbaefba));if(_0xbaefba[_0xabb8('0x12')]){if(_0xbaefba[_0xabb8('0x12')][_0xabb8('0x13')]===0x1f4){logger[_0xabb8('0x12')]('VoiceMail,\x20%s,\x20%s',_0x5b7f6b,_0xbaefba[_0xabb8('0x12')][_0xabb8('0x14')]);return _0x41ae9(_0xbaefba[_0xabb8('0x12')][_0xabb8('0x14')]);}logger[_0xabb8('0x12')](_0xabb8('0xe'),_0x5b7f6b,_0xbaefba[_0xabb8('0x12')]['message']);return _0x2bed2b(_0xbaefba[_0xabb8('0x12')][_0xabb8('0x14')]);}else{logger[_0xabb8('0xd')]('VoiceMail,\x20%s,\x20%s',_0x5b7f6b,_0xabb8('0xf'));_0x2bed2b(_0xbaefba[_0xabb8('0x15')][_0xabb8('0x14')]);}})['catch'](function(_0x4434b8){logger[_0xabb8('0x12')](_0xabb8('0xe'),_0x5b7f6b,_0x4434b8);_0x41ae9(_0x4434b8);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 703c3e6..87aec80 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 _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 +var _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','destroy','exports','multer','util'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x814b,0x1a2));var _0xb814=function(_0x311f44,_0x1d7f5b){_0x311f44=_0x311f44-0x0;var _0x46f1e6=_0x814b[_0x311f44];return _0x46f1e6;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 1592a14..220b9e6 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 _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 +var _0x19a3=['TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long'];(function(_0x2f08,_0x5ab959){var _0x4f1927=function(_0x2d2902){while(--_0x2d2902){_0x2f08['push'](_0x2f08['shift']());}};_0x4f1927(++_0x5ab959);}(_0x19a3,0x69));var _0x319a=function(_0x2852e0,_0x5c8451){_0x2852e0=_0x2852e0-0x0;var _0x87132d=_0x19a3[_0x2852e0];return _0x87132d;};'use strict';var Sequelize=require(_0x319a('0x0'));module['exports']={'name':{'type':Sequelize[_0x319a('0x1')],'get':function(_0x290658){return this[_0x319a('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x319a('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x319a('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x319a('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x319a('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x319a('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x319a('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x319a('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x319a('0x5')](_0x319a('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x319a('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x319a('0x7'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 059f0ee..0c53d43 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 _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 +var _0xe88e=['stack','name','send','VoiceMailMessage','rawAttributes','fieldName','key','differenceBy','map','query','keys','filters','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','catch','params','intersection','find','create','body','download','recording','msg_id','Sequelize','ValidationError','attachment','attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe88e,0xcb));var _0xee88=function(_0x401e83,_0xc6d9c5){_0x401e83=_0x401e83-0x0;var _0x3cc505=_0xe88e[_0x401e83];return _0x3cc505;};'use strict';var pdf=require(_0xee88('0x0'));var emlformat=require(_0xee88('0x1'));var rimraf=require(_0xee88('0x2'));var zipdir=require(_0xee88('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee88('0x4'));var moment=require(_0xee88('0x5'));var BPromise=require(_0xee88('0x6'));var Mustache=require(_0xee88('0x7'));var util=require(_0xee88('0x8'));var path=require(_0xee88('0x9'));var sox=require(_0xee88('0xa'));var csv=require(_0xee88('0xb'));var ejs=require(_0xee88('0xc'));var fs=require('fs');var _=require(_0xee88('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xee88('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xee88('0xb'));var querystring=require(_0xee88('0xf'));var Papa=require(_0xee88('0x10'));var Redis=require(_0xee88('0x11'));var authService=require(_0xee88('0x12'));var qs=require(_0xee88('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee88('0x14'));var logger=require('../../config/logger')(_0xee88('0x15'));var utils=require(_0xee88('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xae043c,_0x26b860){_0x26b860=_0x26b860||0xcc;return function(_0x1c64d9){if(_0x1c64d9){return _0xae043c[_0xee88('0x17')](_0x26b860);}return _0xae043c['status'](_0x26b860)[_0xee88('0x18')]();};}function respondWithResult(_0x4ec5c3,_0x5121a3){_0x5121a3=_0x5121a3||0xc8;return function(_0x5823a3){if(_0x5823a3){return _0x4ec5c3[_0xee88('0x19')](_0x5121a3)['json'](_0x5823a3);}};}function respondWithFilteredResult(_0x2486fb,_0x23c6ea){return function(_0xda10f1){if(_0xda10f1){var _0x14bfb1=_0xda10f1['count'],_0x76d4df=_0x23c6ea[_0xee88('0x1a')],_0x4e2f62=_0x23c6ea[_0xee88('0x1a')]+_0x23c6ea[_0xee88('0x1b')],_0x52a481;if(_0x4e2f62>=_0x14bfb1){_0x4e2f62=_0x14bfb1;_0x52a481=0xc8;}else{_0x52a481=0xce;}_0x2486fb[_0xee88('0x19')](_0x52a481);return _0x2486fb[_0xee88('0x1c')](_0xee88('0x1d'),_0x76d4df+'-'+_0x4e2f62+'/'+_0x14bfb1)[_0xee88('0x1e')](_0xda10f1);}return null;};}function patchUpdates(_0x21a35e){return function(_0x476b19){try{jsonpatch[_0xee88('0x1f')](_0x476b19,_0x21a35e,!![]);}catch(_0x46493e){return BPromise['reject'](_0x46493e);}return _0x476b19[_0xee88('0x20')]();};}function saveUpdates(_0x8ac8a1,_0x162f24){return function(_0x26df0d){if(_0x26df0d){return _0x26df0d[_0xee88('0x21')](_0x8ac8a1)[_0xee88('0x22')](function(_0x39c3fa){return _0x39c3fa;});}return null;};}function removeEntity(_0x26633f,_0x420c8f){return function(_0x543234){if(_0x543234){return _0x543234[_0xee88('0x23')]()[_0xee88('0x22')](function(){_0x26633f[_0xee88('0x19')](0xcc)[_0xee88('0x18')]();});}};}function handleEntityNotFound(_0x29de95,_0x54d0fb){return function(_0x3b7010){if(!_0x3b7010){_0x29de95[_0xee88('0x17')](0x194);}return _0x3b7010;};}function handleError(_0xa06cbe,_0x10d20a){_0x10d20a=_0x10d20a||0x1f4;return function(_0x4f825e){logger[_0xee88('0x24')](_0x4f825e[_0xee88('0x25')]);if(_0x4f825e[_0xee88('0x26')]){delete _0x4f825e[_0xee88('0x26')];}_0xa06cbe[_0xee88('0x19')](_0x10d20a)[_0xee88('0x27')](_0x4f825e);};}exports['index']=function(_0xd10ffa,_0x420993){var _0xa9e236={},_0x89a438={},_0x2366e9={'count':0x0,'rows':[]};var _0x4c72e6=_['map'](db[_0xee88('0x28')][_0xee88('0x29')],function(_0x1de0c0){return{'name':_0x1de0c0[_0xee88('0x2a')],'type':_0x1de0c0['type'][_0xee88('0x2b')]};});_0x89a438['model']=_[_0xee88('0x2c')](_[_0xee88('0x2d')](_0x4c72e6,_0xee88('0x26')),[_0xee88('0x26')]);_0x89a438[_0xee88('0x2e')]=_[_0xee88('0x2f')](_0xd10ffa['query']);_0x89a438[_0xee88('0x30')]=_['intersection'](_0x89a438[_0xee88('0x31')],_0x89a438[_0xee88('0x2e')]);_0xa9e236[_0xee88('0x32')]=_['intersection'](_0x89a438[_0xee88('0x31')],qs[_0xee88('0x33')](_0xd10ffa['query'][_0xee88('0x33')]));_0xa9e236[_0xee88('0x32')]=_0xa9e236[_0xee88('0x32')][_0xee88('0x34')]?_0xa9e236[_0xee88('0x32')]:_0x89a438[_0xee88('0x31')];if(!_0xd10ffa[_0xee88('0x2e')]['hasOwnProperty'](_0xee88('0x35'))){_0xa9e236['limit']=qs[_0xee88('0x1b')](_0xd10ffa['query'][_0xee88('0x1b')]);_0xa9e236[_0xee88('0x1a')]=qs[_0xee88('0x1a')](_0xd10ffa[_0xee88('0x2e')]['offset']);}_0xa9e236[_0xee88('0x36')]=qs['sort'](_0xd10ffa[_0xee88('0x2e')][_0xee88('0x37')]);_0xa9e236[_0xee88('0x38')]=qs[_0xee88('0x30')](_[_0xee88('0x39')](_0xd10ffa[_0xee88('0x2e')],_0x89a438[_0xee88('0x30')]),_0x4c72e6);if(_0xd10ffa['query'][_0xee88('0x3a')]){_0xa9e236[_0xee88('0x38')]=_[_0xee88('0x3b')](_0xa9e236[_0xee88('0x38')],{'$or':_[_0xee88('0x2d')](_0x4c72e6,function(_0x35b87b){if(_0x35b87b[_0xee88('0x3c')]!==_0xee88('0x3d')){var _0x78331b={};_0x78331b[_0x35b87b[_0xee88('0x26')]]={'$like':'%'+_0xd10ffa[_0xee88('0x2e')]['filter']+'%'};return _0x78331b;}})});}_0xa9e236=_[_0xee88('0x3b')]({},_0xa9e236,_0xd10ffa[_0xee88('0x3e')]);var _0x4590cf={'where':_0xa9e236[_0xee88('0x38')]};return db[_0xee88('0x28')][_0xee88('0x3f')](_0x4590cf)[_0xee88('0x22')](function(_0x3b5672){_0x2366e9[_0xee88('0x3f')]=_0x3b5672;if(_0xd10ffa[_0xee88('0x2e')][_0xee88('0x40')]){_0xa9e236[_0xee88('0x41')]=[{'all':!![]}];}return db[_0xee88('0x28')]['findAll'](_0xa9e236);})['then'](function(_0x343482){_0x2366e9['rows']=_0x343482;return _0x2366e9;})['then'](respondWithFilteredResult(_0x420993,_0xa9e236))[_0xee88('0x42')](handleError(_0x420993,null));};exports['show']=function(_0x39697e,_0x4f6067){var _0x363558={'raw':!![],'where':{'id':_0x39697e[_0xee88('0x43')]['id']}},_0xb3fc79={};_0xb3fc79[_0xee88('0x31')]=_[_0xee88('0x2f')](db[_0xee88('0x28')][_0xee88('0x29')]);_0xb3fc79[_0xee88('0x2e')]=_[_0xee88('0x2f')](_0x39697e[_0xee88('0x2e')]);_0xb3fc79[_0xee88('0x30')]=_[_0xee88('0x44')](_0xb3fc79['model'],_0xb3fc79[_0xee88('0x2e')]);_0x363558[_0xee88('0x32')]=_[_0xee88('0x44')](_0xb3fc79[_0xee88('0x31')],qs[_0xee88('0x33')](_0x39697e[_0xee88('0x2e')][_0xee88('0x33')]));_0x363558[_0xee88('0x32')]=_0x363558['attributes'][_0xee88('0x34')]?_0x363558['attributes']:_0xb3fc79['model'];if(_0x39697e['query'][_0xee88('0x40')]){_0x363558[_0xee88('0x41')]=[{'all':!![]}];}_0x363558=_[_0xee88('0x3b')]({},_0x363558,_0x39697e[_0xee88('0x3e')]);return db['VoiceMailMessage'][_0xee88('0x45')](_0x363558)[_0xee88('0x22')](handleEntityNotFound(_0x4f6067,null))[_0xee88('0x22')](respondWithResult(_0x4f6067,null))['catch'](handleError(_0x4f6067,null));};exports['create']=function(_0x4eb271,_0x289066){return db['VoiceMailMessage'][_0xee88('0x46')](_0x4eb271[_0xee88('0x47')],{})[_0xee88('0x22')](respondWithResult(_0x289066,0xc9))['catch'](handleError(_0x289066,null));};exports[_0xee88('0x21')]=function(_0x5cd255,_0x5996b8){if(_0x5cd255[_0xee88('0x47')]['id']){delete _0x5cd255['body']['id'];}return db[_0xee88('0x28')][_0xee88('0x45')]({'where':{'id':_0x5cd255['params']['id']}})[_0xee88('0x22')](handleEntityNotFound(_0x5996b8,null))['then'](saveUpdates(_0x5cd255[_0xee88('0x47')],null))['then'](respondWithResult(_0x5996b8,null))[_0xee88('0x42')](handleError(_0x5996b8,null));};exports['destroy']=function(_0x30165e,_0x41a71e){return db[_0xee88('0x28')]['find']({'where':{'id':_0x30165e[_0xee88('0x43')]['id']}})[_0xee88('0x22')](handleEntityNotFound(_0x41a71e,null))[_0xee88('0x22')](removeEntity(_0x41a71e,null))[_0xee88('0x42')](handleError(_0x41a71e,null));};exports[_0xee88('0x48')]=function(_0x48fbbd,_0x590e00,_0x2d49d2){return db[_0xee88('0x28')][_0xee88('0x45')]({'where':{'id':_0x48fbbd[_0xee88('0x43')]['id']},'attributes':['id',_0xee88('0x49'),_0xee88('0x4a')]})[_0xee88('0x22')](handleEntityNotFound(_0x590e00,null))[_0xee88('0x22')](function(_0x45dca1){if(_0x45dca1){if(!_0x45dca1[_0xee88('0x49')]){throw new db[(_0xee88('0x4b'))][(_0xee88('0x4c'))]('VoiceMailMessage\x20not\x20found');}var _0x490efe={'Content-Type':'audio/wav','Content-Disposition':_0xee88('0x4d')};if(_0x45dca1[_0xee88('0x4a')]){_0x490efe['Content-Disposition']=_0xee88('0x4e')+_0x45dca1[_0xee88('0x4a')]+_0xee88('0x4f');}_0x590e00['set'](_0x490efe);return _0x590e00['send'](new Buffer(_0x45dca1[_0xee88('0x49')]));}})[_0xee88('0x42')](handleError(_0x590e00,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 90cd846..6023119 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 _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 +var _0xd8cb=['voice_voicemail_messages','dir','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','VoiceMailMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd8cb,0x1d6));var _0xbd8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8cb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xbd8c('0x0'));var logger=require(_0xbd8c('0x1'))(_0xbd8c('0x2'));var moment=require('moment');var BPromise=require(_0xbd8c('0x3'));var rp=require(_0xbd8c('0x4'));var fs=require('fs');var path=require(_0xbd8c('0x5'));var rimraf=require(_0xbd8c('0x6'));var config=require(_0xbd8c('0x7'));var attributes=require(_0xbd8c('0x8'));module['exports']=function(_0x3f51dd,_0x3025e7){return _0x3f51dd['define'](_0xbd8c('0x9'),attributes,{'tableName':_0xbd8c('0xa'),'paranoid':![],'indexes':[{'name':_0xbd8c('0xb'),'fields':[_0xbd8c('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 7bce106..14b3340 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 _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 +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x21d88d,_0x4ff19c){var _0x30a579=function(_0x24cf7a){while(--_0x24cf7a){_0x21d88d['push'](_0x21d88d['shift']());}};_0x30a579(++_0x4ff19c);}(_0x2ef3,0xba));var _0x32ef=function(_0x442a11,_0x532ddf){_0x442a11=_0x442a11-0x0;var _0x261a3b=_0x2ef3[_0x442a11];return _0x261a3b;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 9b57592..fd6a1d6 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 _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 +var _0x974a=['isAuthenticated','/:id','show','/:id/sounds','getSounds','create','post','put','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','express','../../config/environment','./voiceMusicOnHold.controller','get'];(function(_0x456956,_0x7343d3){var _0xa25d0e=function(_0x3f0129){while(--_0x3f0129){_0x456956['push'](_0x456956['shift']());}};_0xa25d0e(++_0x7343d3);}(_0x974a,0xad));var _0xa974=function(_0x5d2dc3,_0x1e9809){_0x5d2dc3=_0x5d2dc3-0x0;var _0x59da9b=_0x974a[_0x5d2dc3];return _0x59da9b;};'use strict';var multer=require(_0xa974('0x0'));var util=require(_0xa974('0x1'));var path=require('path');var timeout=require(_0xa974('0x2'));var express=require(_0xa974('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa974('0x4'));var controller=require(_0xa974('0x5'));router[_0xa974('0x6')]('/',auth[_0xa974('0x7')](),controller['index']);router[_0xa974('0x6')](_0xa974('0x8'),auth[_0xa974('0x7')](),controller[_0xa974('0x9')]);router[_0xa974('0x6')](_0xa974('0xa'),auth[_0xa974('0x7')](),controller[_0xa974('0xb')]);router['post']('/',auth[_0xa974('0x7')](),controller[_0xa974('0xc')]);router[_0xa974('0xd')]('/:id/sounds',auth[_0xa974('0x7')](),controller['addSound']);router[_0xa974('0xe')](_0xa974('0x8'),auth[_0xa974('0x7')](),controller['update']);router[_0xa974('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa974('0x10')]);router[_0xa974('0xf')](_0xa974('0x11'),auth['isAuthenticated'](),controller[_0xa974('0x12')]);module[_0xa974('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 26f82f9..72d00c1 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 _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 +var _0x0a6f=['files','mp3nb','quietmp3nb','mp3','STRING','TIMESTAMP','BOOLEAN','sequelize','exports','ENUM'];(function(_0x5d331d,_0x26691b){var _0x6898fa=function(_0x3a2083){while(--_0x3a2083){_0x5d331d['push'](_0x5d331d['shift']());}};_0x6898fa(++_0x26691b);}(_0x0a6f,0xbb));var _0xf0a6=function(_0x3db71e,_0x275086){_0x3db71e=_0x3db71e-0x0;var _0x4240a1=_0x0a6f[_0x3db71e];return _0x4240a1;};'use strict';var Sequelize=require(_0xf0a6('0x0'));module[_0xf0a6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xf0a6('0x2')]('custom',_0xf0a6('0x3'),_0xf0a6('0x4'),_0xf0a6('0x5'),'quietmp3',_0xf0a6('0x6')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xf0a6('0x7')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xf0a6('0x7')],'allowNull':!![]},'sort':{'type':Sequelize[_0xf0a6('0x7')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xf0a6('0x7')],'allowNull':!![]},'stamp':{'type':_0xf0a6('0x8')},'defaultEntry':{'type':Sequelize[_0xf0a6('0x9')],'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 900cc02..f0023fa 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 _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 +var _0x8619=['show','params','keys','length','find','body','create','sequelize','transaction','mode','directory','root','server/files/moh','files','mkdirSync','0777','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','join','Sequelize','ValidationError','message','addSound','Sound','findOne','createdAt','server/files/sounds/converted','%s.%s','basename','save_name','extname','converted_format','format','symlinkSync','removeSound','id2','unlinkSync','getSounds','filter','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','update','then','get','MusicOnHolds','UserProfileResource','destroy','stack','name','index','map','VoiceMusicOnHold','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x26add1,_0xf64861){var _0x3330ee=function(_0x529b20){while(--_0x529b20){_0x26add1['push'](_0x26add1['shift']());}};_0x3330ee(++_0xf64861);}(_0x8619,0x9c));var _0x9861=function(_0x29df03,_0x2ddf27){_0x29df03=_0x29df03-0x0;var _0x2eab5b=_0x8619[_0x29df03];return _0x2eab5b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9861('0x0'));var rimraf=require(_0x9861('0x1'));var zipdir=require(_0x9861('0x2'));var jsonpatch=require(_0x9861('0x3'));var rp=require('request-promise');var moment=require(_0x9861('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9861('0x5'));var util=require(_0x9861('0x6'));var path=require(_0x9861('0x7'));var sox=require('sox');var csv=require(_0x9861('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9861('0x9'));var squel=require(_0x9861('0xa'));var crypto=require(_0x9861('0xb'));var jsforce=require(_0x9861('0xc'));var deskjs=require(_0x9861('0xd'));var toCsv=require(_0x9861('0x8'));var querystring=require(_0x9861('0xe'));var Papa=require('papaparse');var Redis=require(_0x9861('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9861('0x10'));var as=require(_0x9861('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9861('0x12'))('api');var utils=require(_0x9861('0x13'));var config=require(_0x9861('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9861('0x15'))['db'];function respondWithStatusCode(_0x38d1d9,_0x2b2024){_0x2b2024=_0x2b2024||0xcc;return function(_0x28a97f){if(_0x28a97f){return _0x38d1d9[_0x9861('0x16')](_0x2b2024);}return _0x38d1d9['status'](_0x2b2024)[_0x9861('0x17')]();};}function respondWithResult(_0x192c04,_0xb8338a){_0xb8338a=_0xb8338a||0xc8;return function(_0x24ab5f){if(_0x24ab5f){return _0x192c04[_0x9861('0x18')](_0xb8338a)[_0x9861('0x19')](_0x24ab5f);}};}function respondWithFilteredResult(_0x517ac1,_0x1c4604){return function(_0x5c49f3){if(_0x5c49f3){var _0x3b5b4d=_0x5c49f3[_0x9861('0x1a')],_0x300ee6=_0x1c4604[_0x9861('0x1b')],_0x263e7c=_0x1c4604[_0x9861('0x1b')]+_0x1c4604[_0x9861('0x1c')],_0x5c5547;if(_0x263e7c>=_0x3b5b4d){_0x263e7c=_0x3b5b4d;_0x5c5547=0xc8;}else{_0x5c5547=0xce;}_0x517ac1[_0x9861('0x18')](_0x5c5547);return _0x517ac1['set'](_0x9861('0x1d'),_0x300ee6+'-'+_0x263e7c+'/'+_0x3b5b4d)[_0x9861('0x19')](_0x5c49f3);}return null;};}function patchUpdates(_0x4114b4){return function(_0x104c86){try{jsonpatch[_0x9861('0x1e')](_0x104c86,_0x4114b4,!![]);}catch(_0x38f23c){return BPromise[_0x9861('0x1f')](_0x38f23c);}return _0x104c86['save']();};}function saveUpdates(_0x32c8c9,_0x21a641){return function(_0x41bcbc){if(_0x41bcbc){return _0x41bcbc[_0x9861('0x20')](_0x32c8c9)['then'](function(_0x436a7c){return _0x436a7c;});}return null;};}function removeEntity(_0xb5308c,_0x1e69bd){return function(_0x3899ff){if(_0x3899ff){return _0x3899ff['destroy']()[_0x9861('0x21')](function(){var _0x92f8b5=_0x3899ff[_0x9861('0x22')]({'plain':!![]});var _0x5927df=_0x9861('0x23');return db[_0x9861('0x24')][_0x9861('0x25')]({'where':{'type':_0x5927df,'resourceId':_0x92f8b5['id']}})[_0x9861('0x21')](function(){return _0x3899ff;});})[_0x9861('0x21')](function(){_0xb5308c[_0x9861('0x18')](0xcc)[_0x9861('0x17')]();});}};}function handleEntityNotFound(_0x4f201d,_0x586c42){return function(_0x388fa3){if(!_0x388fa3){_0x4f201d[_0x9861('0x16')](0x194);}return _0x388fa3;};}function handleError(_0x57b339,_0x484dec){_0x484dec=_0x484dec||0x1f4;return function(_0x41f054){logger['error'](_0x41f054[_0x9861('0x26')]);if(_0x41f054['name']){delete _0x41f054[_0x9861('0x27')];}_0x57b339[_0x9861('0x18')](_0x484dec)['send'](_0x41f054);};}exports[_0x9861('0x28')]=function(_0x3fab1e,_0x54044f){var _0xf517be={},_0x1208d1={},_0x5db5cb={'count':0x0,'rows':[]};var _0x5c5913=_[_0x9861('0x29')](db[_0x9861('0x2a')][_0x9861('0x2b')],function(_0x2b2ac8){return{'name':_0x2b2ac8[_0x9861('0x2c')],'type':_0x2b2ac8['type'][_0x9861('0x2d')]};});_0x1208d1[_0x9861('0x2e')]=_['map'](_0x5c5913,_0x9861('0x27'));_0x1208d1[_0x9861('0x2f')]=_['keys'](_0x3fab1e[_0x9861('0x2f')]);_0x1208d1[_0x9861('0x30')]=_['intersection'](_0x1208d1['model'],_0x1208d1['query']);_0xf517be[_0x9861('0x31')]=_[_0x9861('0x32')](_0x1208d1[_0x9861('0x2e')],qs[_0x9861('0x33')](_0x3fab1e[_0x9861('0x2f')]['fields']));_0xf517be[_0x9861('0x31')]=_0xf517be[_0x9861('0x31')]['length']?_0xf517be[_0x9861('0x31')]:_0x1208d1[_0x9861('0x2e')];if(!_0x3fab1e['query'][_0x9861('0x34')](_0x9861('0x35'))){_0xf517be[_0x9861('0x1c')]=qs[_0x9861('0x1c')](_0x3fab1e[_0x9861('0x2f')]['limit']);_0xf517be[_0x9861('0x1b')]=qs[_0x9861('0x1b')](_0x3fab1e[_0x9861('0x2f')][_0x9861('0x1b')]);}_0xf517be['order']=qs[_0x9861('0x36')](_0x3fab1e[_0x9861('0x2f')][_0x9861('0x36')]);_0xf517be['where']=qs[_0x9861('0x30')](_[_0x9861('0x37')](_0x3fab1e[_0x9861('0x2f')],_0x1208d1[_0x9861('0x30')]),_0x5c5913);if(_0x3fab1e[_0x9861('0x2f')]['filter']){_0xf517be[_0x9861('0x38')]=_[_0x9861('0x39')](_0xf517be[_0x9861('0x38')],{'$or':_[_0x9861('0x29')](_0x5c5913,function(_0x2b424f){if(_0x2b424f[_0x9861('0x3a')]!==_0x9861('0x3b')){var _0x280620={};_0x280620[_0x2b424f[_0x9861('0x27')]]={'$like':'%'+_0x3fab1e[_0x9861('0x2f')]['filter']+'%'};return _0x280620;}})});}_0xf517be=_[_0x9861('0x39')]({},_0xf517be,_0x3fab1e[_0x9861('0x3c')]);var _0x90ef39={'where':_0xf517be[_0x9861('0x38')]};return db[_0x9861('0x2a')][_0x9861('0x1a')](_0x90ef39)[_0x9861('0x21')](function(_0x3cf886){_0x5db5cb[_0x9861('0x1a')]=_0x3cf886;if(_0x3fab1e[_0x9861('0x2f')][_0x9861('0x3d')]){_0xf517be[_0x9861('0x3e')]=[{'all':!![]}];}return db[_0x9861('0x2a')][_0x9861('0x3f')](_0xf517be);})['then'](function(_0x49bbd3){_0x5db5cb[_0x9861('0x40')]=_0x49bbd3;return _0x5db5cb;})[_0x9861('0x21')](respondWithFilteredResult(_0x54044f,_0xf517be))[_0x9861('0x41')](handleError(_0x54044f,null));};exports[_0x9861('0x42')]=function(_0x30f573,_0x2a1b1a){var _0x5f25cf={'raw':![],'where':{'id':_0x30f573[_0x9861('0x43')]['id']}},_0x488b2e={};_0x488b2e['model']=_[_0x9861('0x44')](db[_0x9861('0x2a')][_0x9861('0x2b')]);_0x488b2e[_0x9861('0x2f')]=_[_0x9861('0x44')](_0x30f573[_0x9861('0x2f')]);_0x488b2e[_0x9861('0x30')]=_[_0x9861('0x32')](_0x488b2e[_0x9861('0x2e')],_0x488b2e[_0x9861('0x2f')]);_0x5f25cf[_0x9861('0x31')]=_[_0x9861('0x32')](_0x488b2e[_0x9861('0x2e')],qs['fields'](_0x30f573['query'][_0x9861('0x33')]));_0x5f25cf[_0x9861('0x31')]=_0x5f25cf[_0x9861('0x31')][_0x9861('0x45')]?_0x5f25cf[_0x9861('0x31')]:_0x488b2e[_0x9861('0x2e')];if(_0x30f573[_0x9861('0x2f')][_0x9861('0x3d')]){_0x5f25cf[_0x9861('0x3e')]=[{'all':!![]}];}_0x5f25cf=_['merge']({},_0x5f25cf,_0x30f573[_0x9861('0x3c')]);return db['VoiceMusicOnHold'][_0x9861('0x46')](_0x5f25cf)[_0x9861('0x21')](handleEntityNotFound(_0x2a1b1a,null))[_0x9861('0x21')](respondWithResult(_0x2a1b1a,null))[_0x9861('0x41')](handleError(_0x2a1b1a,null));};exports[_0x9861('0x20')]=function(_0x35394a,_0x1bfc2a){if(_0x35394a[_0x9861('0x47')]['id']){delete _0x35394a[_0x9861('0x47')]['id'];}return db[_0x9861('0x2a')][_0x9861('0x46')]({'where':{'id':_0x35394a['params']['id']}})[_0x9861('0x21')](handleEntityNotFound(_0x1bfc2a,null))[_0x9861('0x21')](saveUpdates(_0x35394a[_0x9861('0x47')],null))['then'](respondWithResult(_0x1bfc2a,null))['catch'](handleError(_0x1bfc2a,null));};exports[_0x9861('0x48')]=function(_0x4b3a8b,_0x565965,_0x567001){return db[_0x9861('0x49')][_0x9861('0x4a')](function(_0x36c7d1){if(_0x4b3a8b['body'][_0x9861('0x4b')]==='files'){_0x4b3a8b[_0x9861('0x47')][_0x9861('0x4c')]=path['join'](config[_0x9861('0x4d')],_0x9861('0x4e'),_0x4b3a8b['body'][_0x9861('0x27')]);}return db[_0x9861('0x2a')][_0x9861('0x48')](_0x4b3a8b[_0x9861('0x47')],{'transaction':_0x36c7d1})[_0x9861('0x21')](function(_0xafc9e5){if(_0x4b3a8b[_0x9861('0x47')][_0x9861('0x4b')]===_0x9861('0x4f')){fs[_0x9861('0x50')](_0xafc9e5['directory'],parseInt(_0x9861('0x51'),0x8));}var _0x2e64a8=_0x4b3a8b[_0x9861('0x52')]['get']({'plain':!![]});if(!_0x2e64a8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e64a8[_0x9861('0x53')]==='user'){var _0x1b2d60=_0xafc9e5[_0x9861('0x22')]({'plain':!![]});return db[_0x9861('0x54')][_0x9861('0x46')]({'where':{'name':_0x9861('0x23'),'userProfileId':_0x2e64a8[_0x9861('0x55')]},'raw':!![]})[_0x9861('0x21')](function(_0x5cf078){if(_0x5cf078&&_0x5cf078[_0x9861('0x56')]===0x0){return db[_0x9861('0x24')][_0x9861('0x48')]({'name':_0x1b2d60[_0x9861('0x27')],'resourceId':_0x1b2d60['id'],'type':_0x5cf078[_0x9861('0x27')],'sectionId':_0x5cf078['id']},{})[_0x9861('0x21')](function(){return _0xafc9e5;});}else{return _0xafc9e5;}})['catch'](function(_0x1468db){logger['error'](_0x9861('0x57'),_0x1468db);});}return _0xafc9e5;});})[_0x9861('0x21')](respondWithResult(_0x565965,0xc9))[_0x9861('0x41')](handleError(_0x565965,null));};exports[_0x9861('0x25')]=function(_0x85629f,_0xb5675f,_0x43a70b){var _0x5c7dfd;return db[_0x9861('0x2a')][_0x9861('0x46')]({'where':{'id':_0x85629f[_0x9861('0x43')]['id']}})[_0x9861('0x21')](function(_0x13c76b){if(_0x13c76b){return db['sequelize'][_0x9861('0x4a')](function(_0x236023){return _0x13c76b[_0x9861('0x25')]({'transaction':_0x236023,'raw':!![]})[_0x9861('0x21')](function(_0x454444){if(_0x454444['directory']){fs[_0x9861('0x58')](_0x454444[_0x9861('0x4c')])[_0x9861('0x59')](function(_0x115355){fs['unlinkSync'](path[_0x9861('0x5a')](_0x454444['directory'],_0x115355));});fs['rmdirSync'](_0x454444['directory']);}return _0x454444;});})[_0x9861('0x41')](function(_0x3dfce0){throw new db[(_0x9861('0x5b'))][(_0x9861('0x5c'))](_0x3dfce0[_0x9861('0x5d')]);});}})[_0x9861('0x21')](handleEntityNotFound(_0xb5675f,null))[_0x9861('0x21')](removeEntity(_0xb5675f,null))['catch'](handleError(_0xb5675f,null));};exports[_0x9861('0x5e')]=function(_0x5745e5,_0x2108f6,_0x3bf984){return db[_0x9861('0x49')][_0x9861('0x4a')](function(_0x5edd50){var _0x58cb74;return db[_0x9861('0x2a')][_0x9861('0x46')]({'where':{'id':_0x5745e5['params']['id']}})['then'](function(_0x4a57bb){if(_0x4a57bb){_0x58cb74=_0x4a57bb;return _0x4a57bb[_0x9861('0x5e')](_0x5745e5[_0x9861('0x47')]['id'],{'transaction':_0x5edd50});}})[_0x9861('0x21')](function(_0x323ef3){if(_0x323ef3){return db[_0x9861('0x5f')][_0x9861('0x60')]({'where':{'id':_0x5745e5['body']['id']},'attributes':['id',_0x9861('0x27'),'save_name','converted_format',_0x9861('0x61')],'raw':!![]});}})['then'](function(_0xfd94e3){if(_0xfd94e3){var _0x80db5f=path[_0x9861('0x5a')](config[_0x9861('0x4d')],_0x9861('0x62'),util['format'](_0x9861('0x63'),path[_0x9861('0x64')](_0xfd94e3[_0x9861('0x65')],path[_0x9861('0x66')](_0xfd94e3[_0x9861('0x65')])),_0xfd94e3[_0x9861('0x67')]));var _0x4872ad=path[_0x9861('0x5a')](config[_0x9861('0x4d')],_0x9861('0x4e'),_0x58cb74[_0x9861('0x27')],util[_0x9861('0x68')]('%s.%s',_0xfd94e3[_0x9861('0x27')],_0xfd94e3['converted_format']));fs[_0x9861('0x69')](_0x80db5f,_0x4872ad);return _0xfd94e3;}})[_0x9861('0x41')](function(_0x4e485c){throw new db['Sequelize'][(_0x9861('0x5c'))](_0x4e485c[_0x9861('0x5d')]);});})[_0x9861('0x21')](handleEntityNotFound(_0x2108f6,null))['then'](respondWithResult(_0x2108f6,0xc9))[_0x9861('0x41')](handleError(_0x2108f6,null));};exports[_0x9861('0x6a')]=function(_0x478f83,_0x326930,_0x2f933b){return db[_0x9861('0x49')][_0x9861('0x4a')](function(_0xc3a6bc){var _0x2c65a9;return db[_0x9861('0x2a')]['findOne']({'where':{'id':_0x478f83[_0x9861('0x43')]['id']}})['then'](handleEntityNotFound(_0x326930,null))['then'](function(_0x4f8d33){if(_0x4f8d33){_0x2c65a9=_0x4f8d33;return _0x4f8d33['removeSound'](_0x478f83['params'][_0x9861('0x6b')]);}})[_0x9861('0x21')](function(_0x303fe1){if(_0x303fe1){return db[_0x9861('0x5f')][_0x9861('0x60')]({'where':{'id':_0x478f83['params']['id2']},'attributes':['id',_0x9861('0x27'),'save_name',_0x9861('0x67'),_0x9861('0x61')],'raw':!![]});}})[_0x9861('0x21')](function(_0x99207){if(_0x99207){fs[_0x9861('0x6c')](path[_0x9861('0x5a')](_0x2c65a9[_0x9861('0x4c')],util[_0x9861('0x68')](_0x9861('0x63'),_0x99207[_0x9861('0x27')],_0x99207[_0x9861('0x67')])));return _0x99207;}})[_0x9861('0x41')](function(_0x3d5e73){throw new db[(_0x9861('0x5b'))][(_0x9861('0x5c'))](_0x3d5e73[_0x9861('0x5d')]);});})['then'](handleEntityNotFound(_0x326930,null))['then'](respondWithStatusCode(_0x326930,0xcc))['catch'](handleError(_0x326930,null));};exports[_0x9861('0x6d')]=function(_0x21320e,_0x5b77d2,_0x2a787f){var _0x1a52f6={};var _0x3f77e1={};var _0xb58d54;var _0x1cc774;return db[_0x9861('0x2a')][_0x9861('0x60')]({'where':{'id':_0x21320e['params']['id']}})[_0x9861('0x21')](handleEntityNotFound(_0x5b77d2,null))[_0x9861('0x21')](function(_0x4210c2){if(_0x4210c2){_0xb58d54=_0x4210c2;_0x3f77e1[_0x9861('0x2e')]=_[_0x9861('0x44')](db[_0x9861('0x5f')][_0x9861('0x2b')]);_0x3f77e1[_0x9861('0x2f')]=_['keys'](_0x21320e[_0x9861('0x2f')]);_0x3f77e1[_0x9861('0x30')]=_[_0x9861('0x32')](_0x3f77e1['model'],_0x3f77e1['query']);_0x1a52f6[_0x9861('0x31')]=_['intersection'](_0x3f77e1[_0x9861('0x2e')],qs[_0x9861('0x33')](_0x21320e[_0x9861('0x2f')][_0x9861('0x33')]));_0x1a52f6[_0x9861('0x31')]=_0x1a52f6['attributes'][_0x9861('0x45')]?_0x1a52f6[_0x9861('0x31')]:_0x3f77e1['model'];_0x1a52f6['order']=qs[_0x9861('0x36')](_0x21320e[_0x9861('0x2f')][_0x9861('0x36')]);_0x1a52f6['where']=qs[_0x9861('0x30')](_['pick'](_0x21320e['query'],_0x3f77e1[_0x9861('0x30')]));if(_0x21320e[_0x9861('0x2f')][_0x9861('0x6e')]){_0x1a52f6[_0x9861('0x38')]=_[_0x9861('0x39')](_0x1a52f6[_0x9861('0x38')],{'$or':_[_0x9861('0x29')](_0x1a52f6[_0x9861('0x31')],function(_0x17668d){var _0x4edf4e={};_0x4edf4e[_0x17668d]={'$like':'%'+_0x21320e[_0x9861('0x2f')]['filter']+'%'};return _0x4edf4e;})});}_0x1a52f6=_[_0x9861('0x39')]({},_0x1a52f6,_0x21320e['options']);return _0xb58d54[_0x9861('0x6d')](_0x1a52f6);}})[_0x9861('0x21')](function(_0x5f13c5){if(_0x5f13c5){_0x1cc774=_0x5f13c5[_0x9861('0x45')];if(!_0x21320e['query']['hasOwnProperty'](_0x9861('0x35'))){_0x1a52f6[_0x9861('0x1c')]=qs['limit'](_0x21320e['query'][_0x9861('0x1c')]);_0x1a52f6['offset']=qs[_0x9861('0x1b')](_0x21320e[_0x9861('0x2f')][_0x9861('0x1b')]);}return _0xb58d54[_0x9861('0x6d')](_0x1a52f6);}})[_0x9861('0x21')](function(_0x1e9908){if(_0x1e9908){return _0x1e9908?{'count':_0x1cc774,'rows':_0x1e9908}:null;}})['then'](respondWithResult(_0x5b77d2,null))[_0x9861('0x41')](handleError(_0x5b77d2,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index e60d0b0..47ae2da 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 _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 +var _0x2359=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash','../../config/logger','api','moment'];(function(_0x2e322a,_0xd4f6c2){var _0x509a65=function(_0x1135ed){while(--_0x1135ed){_0x2e322a['push'](_0x2e322a['shift']());}};_0x509a65(++_0xd4f6c2);}(_0x2359,0x1c3));var _0x9235=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x2359[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x9235('0x0'));var util=require('util');var logger=require(_0x9235('0x1'))(_0x9235('0x2'));var moment=require(_0x9235('0x3'));var BPromise=require(_0x9235('0x4'));var rp=require(_0x9235('0x5'));var fs=require('fs');var path=require(_0x9235('0x6'));var rimraf=require(_0x9235('0x7'));var config=require(_0x9235('0x8'));var attributes=require(_0x9235('0x9'));module[_0x9235('0xa')]=function(_0x286030,_0x147444){return _0x286030[_0x9235('0xb')](_0x9235('0xc'),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 a228b12..4947c96 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 _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 +var _0x4e79=['request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4c53db,_0x361d7f){var _0x464b17=function(_0x731b3e){while(--_0x731b3e){_0x4c53db['push'](_0x4c53db['shift']());}};_0x464b17(++_0x361d7f);}(_0x4e79,0xff));var _0x94e7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4e79[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x94e7('0x0'));var util=require(_0x94e7('0x1'));var moment=require(_0x94e7('0x2'));var BPromise=require(_0x94e7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x94e7('0x4'));var logger=require(_0x94e7('0x5'))(_0x94e7('0x6'));var config=require(_0x94e7('0x7'));var jayson=require(_0x94e7('0x8'));var client=jayson[_0x94e7('0x9')][_0x94e7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e6760,_0x5a2af6,_0x45e23c){return new BPromise(function(_0x13ac18,_0x4d01ca){return client[_0x94e7('0xb')](_0x2e6760,_0x45e23c)[_0x94e7('0xc')](function(_0x434151){logger[_0x94e7('0xd')](_0x94e7('0xe'),_0x5a2af6,_0x94e7('0xf'));logger['debug']('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x5a2af6,_0x94e7('0xf'),JSON['stringify'](_0x434151));if(_0x434151['error']){if(_0x434151[_0x94e7('0x10')]['code']===0x1f4){logger[_0x94e7('0x10')](_0x94e7('0xe'),_0x5a2af6,_0x434151['error']['message']);return _0x4d01ca(_0x434151[_0x94e7('0x10')]['message']);}logger[_0x94e7('0x10')](_0x94e7('0xe'),_0x5a2af6,_0x434151[_0x94e7('0x10')]['message']);return _0x13ac18(_0x434151[_0x94e7('0x10')][_0x94e7('0x11')]);}else{logger[_0x94e7('0xd')](_0x94e7('0xe'),_0x5a2af6,'request\x20sent');_0x13ac18(_0x434151['result'][_0x94e7('0x11')]);}})[_0x94e7('0x12')](function(_0x26e431){logger[_0x94e7('0x10')](_0x94e7('0xe'),_0x5a2af6,_0x26e431);_0x4d01ca(_0x26e431);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 1f7a10f..3791481 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 _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 +var _0x6194=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/users','getAgents','post','addAgents','put','update','delete','destroy','removeAgents','exports','multer'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x6194,0x1c7));var _0x4619=function(_0x5d6a36,_0xa0fa93){_0x5d6a36=_0x5d6a36-0x0;var _0x5a52c1=_0x6194[_0x5d6a36];return _0x5a52c1;};'use strict';var multer=require(_0x4619('0x0'));var util=require(_0x4619('0x1'));var path=require('path');var timeout=require(_0x4619('0x2'));var express=require(_0x4619('0x3'));var router=express['Router']();var auth=require(_0x4619('0x4'));var interaction=require(_0x4619('0x5'));var config=require(_0x4619('0x6'));var controller=require('./voicePrefix.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4619('0x7')]);router[_0x4619('0x8')](_0x4619('0x9'),auth[_0x4619('0xa')](),controller[_0x4619('0xb')]);router[_0x4619('0x8')](_0x4619('0xc'),auth['isAuthenticated'](),controller[_0x4619('0xd')]);router['get'](_0x4619('0xe'),auth[_0x4619('0xa')](),controller[_0x4619('0xf')]);router[_0x4619('0x10')]('/',auth[_0x4619('0xa')](),controller['create']);router[_0x4619('0x10')](_0x4619('0xe'),auth[_0x4619('0xa')](),controller[_0x4619('0x11')]);router[_0x4619('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4619('0x13')]);router[_0x4619('0x14')](_0x4619('0xc'),auth[_0x4619('0xa')](),controller[_0x4619('0x15')]);router[_0x4619('0x14')](_0x4619('0xe'),auth[_0x4619('0xa')](),controller[_0x4619('0x16')]);module[_0x4619('0x17')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index bba8c55..b93f16e 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 _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 +var _0xb6e6=['getDataValue','INTEGER','sequelize','STRING','name','VIRTUAL','system-'];(function(_0x58c053,_0x51c43f){var _0xe1079=function(_0x172345){while(--_0x172345){_0x58c053['push'](_0x58c053['shift']());}};_0xe1079(++_0x51c43f);}(_0xb6e6,0xbf));var _0x6b6e=function(_0x51d593,_0x547e60){_0x51d593=_0x51d593-0x0;var _0x1079ec=_0xb6e6[_0x51d593];return _0x1079ec;};'use strict';var Sequelize=require(_0x6b6e('0x0'));module['exports']={'name':{'type':Sequelize[_0x6b6e('0x1')],'allowNull':![],'unique':_0x6b6e('0x2')},'prefix':{'type':Sequelize[_0x6b6e('0x3')],'get':function(_0x43b560){return _0x6b6e('0x4')+this[_0x6b6e('0x5')](_0x6b6e('0x2'))+'-';}},'description':{'type':Sequelize[_0x6b6e('0x1')]},'callerIdAll':{'type':Sequelize[_0x6b6e('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x6b6e('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 3a024d5..5b6b867 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 _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 +var _0x04e7=['NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','sequelize','findById','addAgents','body','ids','omit','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','html-pdf','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','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','name','send','index','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','VoicePrefix','rows','show','params','keys','length','include','find','catch','describe','create','transaction','VoiceExtension','VoiceExtensionId','user','UserProfileSection','autoAssociation','error','context','from-sip','exten','app','system','Voice\x20Prefix\x20Extension','prefix'];(function(_0x2c0312,_0x2be972){var _0x46222d=function(_0x593c31){while(--_0x593c31){_0x2c0312['push'](_0x2c0312['shift']());}};_0x46222d(++_0x2be972);}(_0x04e7,0x121));var _0x704e=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0x04e7[_0x3e3bee];return _0x3ae14c;};'use strict';var pdf=require(_0x704e('0x0'));var emlformat=require(_0x704e('0x1'));var rimraf=require(_0x704e('0x2'));var zipdir=require(_0x704e('0x3'));var jsonpatch=require(_0x704e('0x4'));var rp=require(_0x704e('0x5'));var moment=require(_0x704e('0x6'));var BPromise=require(_0x704e('0x7'));var Mustache=require(_0x704e('0x8'));var util=require(_0x704e('0x9'));var path=require(_0x704e('0xa'));var sox=require(_0x704e('0xb'));var csv=require('to-csv');var ejs=require(_0x704e('0xc'));var fs=require('fs');var _=require(_0x704e('0xd'));var squel=require(_0x704e('0xe'));var crypto=require(_0x704e('0xf'));var jsforce=require(_0x704e('0x10'));var deskjs=require(_0x704e('0x11'));var toCsv=require(_0x704e('0x12'));var querystring=require(_0x704e('0x13'));var Papa=require(_0x704e('0x14'));var Redis=require(_0x704e('0x15'));var authService=require(_0x704e('0x16'));var qs=require(_0x704e('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x704e('0x18'));var logger=require(_0x704e('0x19'))(_0x704e('0x1a'));var utils=require(_0x704e('0x1b'));var config=require(_0x704e('0x1c'));var licenseUtil=require(_0x704e('0x1d'));var db=require(_0x704e('0x1e'))['db'];config['redis']=_['defaults'](config[_0x704e('0x1f')],{'host':_0x704e('0x20'),'port':0x18eb});var socket=require(_0x704e('0x21'))(new Redis(config[_0x704e('0x1f')]));require(_0x704e('0x22'))[_0x704e('0x23')](socket);function respondWithStatusCode(_0x2abf61,_0x33a743){_0x33a743=_0x33a743||0xcc;return function(_0x57a907){if(_0x57a907){return _0x2abf61[_0x704e('0x24')](_0x33a743);}return _0x2abf61[_0x704e('0x25')](_0x33a743)[_0x704e('0x26')]();};}function respondWithResult(_0x583cc0,_0x2b203b){_0x2b203b=_0x2b203b||0xc8;return function(_0x35a3e9){if(_0x35a3e9){return _0x583cc0[_0x704e('0x25')](_0x2b203b)['json'](_0x35a3e9);}};}function respondWithFilteredResult(_0x1b347a,_0x1bd0cf){return function(_0x315636){if(_0x315636){var _0x340bde=_0x315636['count'],_0x3d10ba=_0x1bd0cf[_0x704e('0x27')],_0x554c09=_0x1bd0cf['offset']+_0x1bd0cf['limit'],_0x333524;if(_0x554c09>=_0x340bde){_0x554c09=_0x340bde;_0x333524=0xc8;}else{_0x333524=0xce;}_0x1b347a['status'](_0x333524);return _0x1b347a[_0x704e('0x28')](_0x704e('0x29'),_0x3d10ba+'-'+_0x554c09+'/'+_0x340bde)[_0x704e('0x2a')](_0x315636);}return null;};}function patchUpdates(_0x5f1a62){return function(_0x4a785a){try{jsonpatch[_0x704e('0x2b')](_0x4a785a,_0x5f1a62,!![]);}catch(_0x152ad8){return BPromise[_0x704e('0x2c')](_0x152ad8);}return _0x4a785a[_0x704e('0x2d')]();};}function saveUpdates(_0x418322,_0x3cafe7){return function(_0x30a391){if(_0x30a391){return _0x30a391[_0x704e('0x2e')](_0x418322)[_0x704e('0x2f')](function(_0x269113){return _0x269113;});}return null;};}function removeEntity(_0x1a46be,_0x5554d0){return function(_0x5cae04){if(_0x5cae04){return _0x5cae04[_0x704e('0x30')]()[_0x704e('0x2f')](function(){var _0x4130ad=_0x5cae04[_0x704e('0x31')]({'plain':!![]});var _0x36b851=_0x704e('0x32');return db[_0x704e('0x33')][_0x704e('0x30')]({'where':{'type':_0x36b851,'resourceId':_0x4130ad['id']}})['then'](function(){return _0x5cae04;});})[_0x704e('0x2f')](function(){_0x1a46be[_0x704e('0x25')](0xcc)[_0x704e('0x26')]();});}};}function handleEntityNotFound(_0x50d3ab,_0x3b2b13){return function(_0x510a70){if(!_0x510a70){_0x50d3ab[_0x704e('0x24')](0x194);}return _0x510a70;};}function handleError(_0x123e61,_0x39e535){_0x39e535=_0x39e535||0x1f4;return function(_0x395e7){logger['error'](_0x395e7['stack']);if(_0x395e7[_0x704e('0x34')]){delete _0x395e7['name'];}_0x123e61['status'](_0x39e535)[_0x704e('0x35')](_0x395e7);};}exports[_0x704e('0x36')]=function(_0x31a04b,_0x3b430c){var _0x3ed2ae={},_0x5cc6f5={},_0x5737d0={'count':0x0,'rows':[]};var _0x29738d=_['map'](db['VoicePrefix'][_0x704e('0x37')],function(_0xe57be){return{'name':_0xe57be[_0x704e('0x38')],'type':_0xe57be[_0x704e('0x39')][_0x704e('0x3a')]};});_0x5cc6f5[_0x704e('0x3b')]=_[_0x704e('0x3c')](_0x29738d,'name');_0x5cc6f5[_0x704e('0x3d')]=_['keys'](_0x31a04b[_0x704e('0x3d')]);_0x5cc6f5['filters']=_[_0x704e('0x3e')](_0x5cc6f5[_0x704e('0x3b')],_0x5cc6f5[_0x704e('0x3d')]);_0x3ed2ae[_0x704e('0x3f')]=_[_0x704e('0x3e')](_0x5cc6f5[_0x704e('0x3b')],qs[_0x704e('0x40')](_0x31a04b[_0x704e('0x3d')][_0x704e('0x40')]));_0x3ed2ae['attributes']=_0x3ed2ae[_0x704e('0x3f')]['length']?_0x3ed2ae[_0x704e('0x3f')]:_0x5cc6f5['model'];if(!_0x31a04b['query'][_0x704e('0x41')](_0x704e('0x42'))){_0x3ed2ae['limit']=qs[_0x704e('0x43')](_0x31a04b['query'][_0x704e('0x43')]);_0x3ed2ae[_0x704e('0x27')]=qs[_0x704e('0x27')](_0x31a04b['query'][_0x704e('0x27')]);}_0x3ed2ae[_0x704e('0x44')]=qs[_0x704e('0x45')](_0x31a04b[_0x704e('0x3d')][_0x704e('0x45')]);_0x3ed2ae[_0x704e('0x46')]=qs[_0x704e('0x47')](_[_0x704e('0x48')](_0x31a04b[_0x704e('0x3d')],_0x5cc6f5['filters']),_0x29738d);if(_0x31a04b['query'][_0x704e('0x49')]){_0x3ed2ae[_0x704e('0x46')]=_[_0x704e('0x4a')](_0x3ed2ae['where'],{'$or':_[_0x704e('0x3c')](_0x29738d,function(_0x264049){if(_0x264049[_0x704e('0x39')]!==_0x704e('0x4b')){var _0x152acf={};_0x152acf[_0x264049[_0x704e('0x34')]]={'$like':'%'+_0x31a04b[_0x704e('0x3d')][_0x704e('0x49')]+'%'};return _0x152acf;}})});}_0x3ed2ae=_['merge']({},_0x3ed2ae,_0x31a04b[_0x704e('0x4c')]);var _0x19cdb2={'where':_0x3ed2ae[_0x704e('0x46')]};return db['VoicePrefix']['count'](_0x19cdb2)[_0x704e('0x2f')](function(_0x2f2a49){_0x5737d0[_0x704e('0x4d')]=_0x2f2a49;if(_0x31a04b[_0x704e('0x3d')][_0x704e('0x4e')]){_0x3ed2ae['include']=[{'all':!![]}];}return db[_0x704e('0x4f')]['findAll'](_0x3ed2ae);})['then'](function(_0x55f03a){_0x5737d0[_0x704e('0x50')]=_0x55f03a;return _0x5737d0;})[_0x704e('0x2f')](respondWithFilteredResult(_0x3b430c,_0x3ed2ae))['catch'](handleError(_0x3b430c,null));};exports[_0x704e('0x51')]=function(_0xf2bfdb,_0xe6df5e){var _0x7c1129={'raw':![],'where':{'id':_0xf2bfdb[_0x704e('0x52')]['id']}},_0x3123ef={};_0x3123ef['model']=_[_0x704e('0x53')](db[_0x704e('0x4f')][_0x704e('0x37')]);_0x3123ef[_0x704e('0x3d')]=_[_0x704e('0x53')](_0xf2bfdb[_0x704e('0x3d')]);_0x3123ef[_0x704e('0x47')]=_[_0x704e('0x3e')](_0x3123ef['model'],_0x3123ef[_0x704e('0x3d')]);_0x7c1129[_0x704e('0x3f')]=_['intersection'](_0x3123ef[_0x704e('0x3b')],qs[_0x704e('0x40')](_0xf2bfdb[_0x704e('0x3d')][_0x704e('0x40')]));_0x7c1129[_0x704e('0x3f')]=_0x7c1129[_0x704e('0x3f')][_0x704e('0x54')]?_0x7c1129[_0x704e('0x3f')]:_0x3123ef['model'];if(_0xf2bfdb['query'][_0x704e('0x4e')]){_0x7c1129[_0x704e('0x55')]=[{'all':!![]}];}_0x7c1129=_['merge']({},_0x7c1129,_0xf2bfdb['options']);return db[_0x704e('0x4f')][_0x704e('0x56')](_0x7c1129)[_0x704e('0x2f')](handleEntityNotFound(_0xe6df5e,null))[_0x704e('0x2f')](respondWithResult(_0xe6df5e,null))[_0x704e('0x57')](handleError(_0xe6df5e,null));};exports[_0x704e('0x30')]=function(_0x4da19a,_0x1d06e8){return db[_0x704e('0x4f')]['find']({'where':{'id':_0x4da19a[_0x704e('0x52')]['id']}})['then'](handleEntityNotFound(_0x1d06e8,null))['then'](removeEntity(_0x1d06e8,null))[_0x704e('0x57')](handleError(_0x1d06e8,null));};exports[_0x704e('0x58')]=function(_0x4f21b2,_0x1ba5ec){return db[_0x704e('0x4f')]['describe']()[_0x704e('0x2f')](respondWithResult(_0x1ba5ec,null))[_0x704e('0x57')](handleError(_0x1ba5ec,null));};exports[_0x704e('0x59')]=function(_0x1d6c60,_0x15de31){var _0x18fedf;return db['sequelize'][_0x704e('0x5a')](function(_0xc5aa5f){return db[_0x704e('0x4f')][_0x704e('0x59')](_0x1d6c60['body'],{'transaction':_0xc5aa5f})[_0x704e('0x2f')](function(_0xff9801){_0x18fedf=_0xff9801['get']({'plain':!![]});return db[_0x704e('0x5b')][_0x704e('0x56')]({'where':{'id':_0x18fedf[_0x704e('0x5c')]},'raw':!![]})[_0x704e('0x2f')](function(_0x4d275e){return createVoicePrefixExtensions(_0x18fedf,_0x4d275e,_0xc5aa5f);});});})['then'](function(){var _0x41fdc1=_0x1d6c60[_0x704e('0x5d')][_0x704e('0x31')]({'plain':!![]});if(!_0x41fdc1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41fdc1['role']===_0x704e('0x5d')){var _0x5c0e34=_0x18fedf;return db[_0x704e('0x5e')]['find']({'where':{'name':_0x704e('0x32'),'userProfileId':_0x41fdc1['userProfileId']},'raw':!![]})[_0x704e('0x2f')](function(_0x409706){if(_0x409706&&_0x409706[_0x704e('0x5f')]===0x0){return db['UserProfileResource'][_0x704e('0x59')]({'name':_0x5c0e34['name'],'resourceId':_0x5c0e34['id'],'type':_0x409706['name'],'sectionId':_0x409706['id']},{})[_0x704e('0x2f')](function(){return _0x18fedf;});}else{return _0x18fedf;}})['catch'](function(_0xed2fc1){logger[_0x704e('0x60')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xed2fc1);throw _0xed2fc1;});}return _0x18fedf;})['then'](respondWithResult(_0x15de31,null))[_0x704e('0x57')](handleError(_0x15de31,null));};function Extension(_0x70a17f,_0x334513,_0x3d65d3,_0x353732){this[_0x704e('0x61')]=_0x704e('0x62');this[_0x704e('0x63')]=_0x70a17f;this[_0x704e('0x64')]=_0x3d65d3;this['type']=_0x704e('0x65');this['description']=_0x704e('0x66');this['priority']=_0x334513;this['appdata']=_0x353732;}function createVoicePrefixExtensions(_0x31402c,_0x566654,_0x1ffe0a){return new BPromise(function(_0x260341,_0x58af7f){var _0x5ec2fc=new Extension(formatPrefixName(_0x31402c[_0x704e('0x67')]),0x1,_0x704e('0x68'),_0x704e('0x69'));_0x5ec2fc[_0x704e('0x6a')]=_0x31402c['id'];return db['VoiceExtension']['create'](_0x5ec2fc,{'transaction':_0x1ffe0a})[_0x704e('0x2f')](function(_0x32954e){var _0x52b324=_0x32954e[_0x704e('0x31')]({'plain':!![]});var _0x527f85=_[_0x704e('0x3c')](addVoicePrefixExtensions(_0x31402c,_0x566654),function(_0x28bcc1){_0x28bcc1[_0x704e('0x5c')]=_0x52b324['id'];_0x28bcc1['VoicePrefixId']=_0x31402c['id'];return _0x28bcc1;});return db['VoiceExtension'][_0x704e('0x6b')](_0x527f85,{'transaction':_0x1ffe0a})[_0x704e('0x2f')](function(_0x1b3628){if(!_0x1b3628){return _0x58af7f(_0x704e('0x6c'));}else{return _0x260341(_0x1b3628);}})['catch'](function(_0x1f9eb2){return _0x58af7f(_0x1f9eb2);});});;});};function addVoicePrefixExtensions(_0x197045,_0x4a66e1){var _0x50515c=[];var _0x4e792f=formatPrefixName(_0x197045[_0x704e('0x67')]);_0x50515c[_0x704e('0x6d')](new Extension(_0x4e792f,0x2,_0x704e('0x6e'),_0x704e('0x6f')+_0x197045[_0x704e('0x34')]));if(_0x197045[_0x704e('0x70')]){_0x50515c[_0x704e('0x6d')](new Extension(_0x4e792f,0x3,_0x704e('0x6e'),_0x704e('0x71')+_0x197045[_0x704e('0x70')]));}else{_0x50515c['push'](new Extension(_0x4e792f,0x3,'NoOp',_0x704e('0x72')));}_0x50515c['push'](new Extension(_0x4e792f,0x4,'goto',_0x4a66e1['context']+','+_0x704e('0x73')+(0x8+_0x197045[_0x704e('0x34')][_0x704e('0x54')])+'}'+','+0x1));return _0x50515c;}function formatPrefixName(_0x7ee846){var _0x116efd='_';for(var _0x274a8e=0x0;_0x274a8e<_0x7ee846['length'];_0x274a8e++){if(_0x7ee846[_0x704e('0x74')](_0x274a8e)=='-'){_0x116efd+=_0x7ee846[_0x704e('0x74')](_0x274a8e);}else{_0x116efd+='['+_0x7ee846[_0x704e('0x74')](_0x274a8e)+']';}}_0x116efd+='.';return _0x116efd;}exports['update']=function(_0xc4b3c4,_0x51d070,_0x1d3403){var _0x4574d7=_0xc4b3c4['body'];_0x4574d7[_0x704e('0x67')]=_0x704e('0x75')+_0x4574d7[_0x704e('0x34')]+'-';return db[_0x704e('0x76')][_0x704e('0x5a')](function(_0x4ab4b3){return db['VoicePrefix']['update'](_0x4574d7,{'where':{'id':_0x4574d7['id']},'transaction':_0x4ab4b3})[_0x704e('0x2f')](function(){return db[_0x704e('0x5b')][_0x704e('0x30')]({'where':{'VoicePrefixId':_0x4574d7['id']},'transaction':_0x4ab4b3})[_0x704e('0x2f')](function(){return db['VoiceExtension'][_0x704e('0x56')]({'where':{'id':_0x4574d7[_0x704e('0x5c')]},'raw':!![]})[_0x704e('0x2f')](function(_0x1e9387){return createVoicePrefixExtensions(_0x4574d7,_0x1e9387,_0x4ab4b3);});});});})[_0x704e('0x2f')](function(){return db['VoicePrefix'][_0x704e('0x77')](_0x4574d7['id']);})[_0x704e('0x2f')](respondWithResult(_0x51d070,null))[_0x704e('0x57')](handleError(_0x51d070,null));};exports[_0x704e('0x78')]=function(_0x124f2c,_0x8b7004,_0x417a71){return db[_0x704e('0x4f')][_0x704e('0x56')]({'where':{'id':_0x124f2c[_0x704e('0x52')]['id']}})[_0x704e('0x2f')](handleEntityNotFound(_0x8b7004,null))[_0x704e('0x2f')](function(_0x1df464){if(_0x1df464){return _0x1df464[_0x704e('0x78')](_0x124f2c[_0x704e('0x79')][_0x704e('0x7a')],_[_0x704e('0x7b')](_0x124f2c[_0x704e('0x79')],[_0x704e('0x7a'),'id'])||{})[_0x704e('0x7c')](function(_0x98fa66){for(var _0x113de8=0x0;_0x113de8<_0x124f2c[_0x704e('0x79')][_0x704e('0x7a')]['length'];_0x113de8+=0x1){socket[_0x704e('0x7d')]('userVoicePrefix:save',{'UserId':_0x124f2c[_0x704e('0x79')][_0x704e('0x7a')][_0x113de8],'VoicePrefixId':_0x124f2c[_0x704e('0x52')]['id']});}return _0x98fa66;});}})['then'](respondWithResult(_0x8b7004,null))[_0x704e('0x57')](handleError(_0x8b7004,null));};exports[_0x704e('0x7e')]=function(_0x39a417,_0x1c9c55,_0x408f0f){return db[_0x704e('0x4f')][_0x704e('0x56')]({'where':{'id':_0x39a417[_0x704e('0x52')]['id']}})[_0x704e('0x2f')](handleEntityNotFound(_0x1c9c55,null))[_0x704e('0x2f')](function(_0x4fa13d){if(_0x4fa13d){return _0x4fa13d['removeAgents'](_0x39a417[_0x704e('0x3d')][_0x704e('0x7a')])[_0x704e('0x2f')](function(){if(_[_0x704e('0x7f')](_0x39a417[_0x704e('0x3d')]['ids'])){for(var _0x5b51c7=0x0;_0x5b51c7<_0x39a417['query'][_0x704e('0x7a')]['length'];_0x5b51c7+=0x1){socket[_0x704e('0x7d')](_0x704e('0x80'),{'UserId':Number(_0x39a417[_0x704e('0x3d')]['ids'][_0x5b51c7]),'VoicePrefixId':Number(_0x39a417[_0x704e('0x52')]['id'])});}}else{socket[_0x704e('0x7d')](_0x704e('0x80'),{'UserId':Number(_0x39a417[_0x704e('0x3d')][_0x704e('0x7a')]),'VoicePrefixId':Number(_0x39a417[_0x704e('0x52')]['id'])});}});}})[_0x704e('0x2f')](respondWithStatusCode(_0x1c9c55,null))[_0x704e('0x57')](handleError(_0x1c9c55,null));};exports[_0x704e('0x81')]=function(_0x310164,_0xe16ef2,_0x45e2af){var _0x45b371={};var _0x286a76={};var _0x4a6ae0;var _0x4f04bd;return db[_0x704e('0x4f')][_0x704e('0x82')]({'where':{'id':_0x310164[_0x704e('0x52')]['id']}})[_0x704e('0x2f')](handleEntityNotFound(_0xe16ef2,null))[_0x704e('0x2f')](function(_0x56fe7c){if(_0x56fe7c){_0x4a6ae0=_0x56fe7c;_0x286a76['model']=_[_0x704e('0x53')](db['User'][_0x704e('0x37')]);_0x286a76[_0x704e('0x3d')]=_['keys'](_0x310164[_0x704e('0x3d')]);_0x286a76['filters']=_[_0x704e('0x3e')](_0x286a76[_0x704e('0x3b')],_0x286a76['query']);_0x45b371[_0x704e('0x3f')]=_['intersection'](_0x286a76['model'],qs[_0x704e('0x40')](_0x310164['query'][_0x704e('0x40')]));_0x45b371[_0x704e('0x3f')]=_0x45b371[_0x704e('0x3f')][_0x704e('0x54')]?_0x45b371[_0x704e('0x3f')]:_0x286a76[_0x704e('0x3b')];_0x45b371[_0x704e('0x44')]=qs[_0x704e('0x45')](_0x310164[_0x704e('0x3d')][_0x704e('0x45')]);_0x45b371['where']=qs[_0x704e('0x47')](_['pick'](_0x310164[_0x704e('0x3d')],_0x286a76[_0x704e('0x47')]));if(_0x310164['query'][_0x704e('0x49')]){_0x45b371[_0x704e('0x46')]=_[_0x704e('0x4a')](_0x45b371[_0x704e('0x46')],{'$or':_[_0x704e('0x3c')](_0x45b371[_0x704e('0x3f')],function(_0x3f4dbd){var _0x3e83dc={};_0x3e83dc[_0x3f4dbd]={'$like':'%'+_0x310164[_0x704e('0x3d')][_0x704e('0x49')]+'%'};return _0x3e83dc;})});}_0x45b371=_[_0x704e('0x4a')]({},_0x45b371,_0x310164[_0x704e('0x4c')]);return _0x4a6ae0['getAgents'](_0x45b371);}})[_0x704e('0x2f')](function(_0x1c7178){if(_0x1c7178){_0x4f04bd=_0x1c7178['length'];if(!_0x310164[_0x704e('0x3d')][_0x704e('0x41')](_0x704e('0x42'))){_0x45b371[_0x704e('0x43')]=qs[_0x704e('0x43')](_0x310164[_0x704e('0x3d')][_0x704e('0x43')]);_0x45b371[_0x704e('0x27')]=qs[_0x704e('0x27')](_0x310164[_0x704e('0x3d')][_0x704e('0x27')]);}return _0x4a6ae0[_0x704e('0x81')](_0x45b371);}})[_0x704e('0x2f')](function(_0x5822a8){if(_0x5822a8){return _0x5822a8?{'count':_0x4f04bd,'rows':_0x5822a8}:null;}})[_0x704e('0x2f')](respondWithResult(_0xe16ef2,null))['catch'](handleError(_0xe16ef2,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index c1e2aae..3d2aebc 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(_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 +var _0xedd9=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xedd9,0xfc));var _0x9edd=function(_0x574f3b,_0x31f052){_0x574f3b=_0x574f3b-0x0;var _0x1a1b1f=_0xedd9[_0x574f3b];return _0x1a1b1f;};'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 95b14fb..cdfd7cd 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 _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 +var _0xc736=['api','moment','bluebird','path','rimraf','../../config/environment','define','voice_prefixes','../../config/logger'];(function(_0xdc9009,_0x2e0722){var _0xa7bb77=function(_0x4a7330){while(--_0x4a7330){_0xdc9009['push'](_0xdc9009['shift']());}};_0xa7bb77(++_0x2e0722);}(_0xc736,0xaa));var _0x6c73=function(_0x3c9c54,_0x2f9f32){_0x3c9c54=_0x3c9c54-0x0;var _0x42766c=_0xc736[_0x3c9c54];return _0x42766c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6c73('0x0'))(_0x6c73('0x1'));var moment=require(_0x6c73('0x2'));var BPromise=require(_0x6c73('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c73('0x4'));var rimraf=require(_0x6c73('0x5'));var config=require(_0x6c73('0x6'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x360df4,_0x4a8304){return _0x360df4[_0x6c73('0x7')]('VoicePrefix',attributes,{'tableName':_0x6c73('0x8'),'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 21bcbce..8a3c4e7 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 _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 +var _0x6bf1=['VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x6bf1,0x71));var _0x16bf=function(_0x447127,_0xbe4ade){_0x447127=_0x447127-0x0;var _0x358a25=_0x6bf1[_0x447127];return _0x358a25;};'use strict';var _=require(_0x16bf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x16bf('0x1'));var rs=require(_0x16bf('0x2'));var fs=require('fs');var Redis=require(_0x16bf('0x3'));var db=require(_0x16bf('0x4'))['db'];var utils=require(_0x16bf('0x5'));var logger=require('../../config/logger')(_0x16bf('0x6'));var config=require(_0x16bf('0x7'));var jayson=require(_0x16bf('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x16bf('0x9')]=_[_0x16bf('0xa')](config[_0x16bf('0x9')],{'host':_0x16bf('0xb'),'port':0x18eb});var socket=require(_0x16bf('0xc'))(new Redis(config[_0x16bf('0x9')]));require(_0x16bf('0xd'))[_0x16bf('0xe')](socket);function respondWithRpcPromise(_0x58ebb1,_0x232990,_0x22f6b8){return new BPromise(function(_0x2b0c9f,_0x407e2a){return client[_0x16bf('0xf')](_0x58ebb1,_0x22f6b8)[_0x16bf('0x10')](function(_0x51c193){logger['info'](_0x16bf('0x11'),_0x232990,_0x16bf('0x12'));logger[_0x16bf('0x13')](_0x16bf('0x14'),_0x232990,_0x16bf('0x12'),JSON[_0x16bf('0x15')](_0x51c193));if(_0x51c193[_0x16bf('0x16')]){if(_0x51c193[_0x16bf('0x16')][_0x16bf('0x17')]===0x1f4){logger['error'](_0x16bf('0x11'),_0x232990,_0x51c193[_0x16bf('0x16')]['message']);return _0x407e2a(_0x51c193[_0x16bf('0x16')][_0x16bf('0x18')]);}logger[_0x16bf('0x16')](_0x16bf('0x11'),_0x232990,_0x51c193[_0x16bf('0x16')]['message']);return _0x2b0c9f(_0x51c193['error']['message']);}else{logger[_0x16bf('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x232990,_0x16bf('0x12'));_0x2b0c9f(_0x51c193['result'][_0x16bf('0x18')]);}})['catch'](function(_0x10c5fa){logger[_0x16bf('0x16')](_0x16bf('0x11'),_0x232990,_0x10c5fa);_0x407e2a(_0x10c5fa);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 3757b8c..b029c3c 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 _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 +var _0xafdc=['./voicePrefix.events','save','remove','update','emit','removeListener','register','length','voicePrefix:'];(function(_0x54f01a,_0x12e01c){var _0x4787f1=function(_0x89ae1b){while(--_0x89ae1b){_0x54f01a['push'](_0x54f01a['shift']());}};_0x4787f1(++_0x12e01c);}(_0xafdc,0x1cb));var _0xcafd=function(_0x3f45fb,_0x4b67c0){_0x3f45fb=_0x3f45fb-0x0;var _0x1797ef=_0xafdc[_0x3f45fb];return _0x1797ef;};'use strict';var VoicePrefixEvents=require(_0xcafd('0x0'));var events=[_0xcafd('0x1'),_0xcafd('0x2'),_0xcafd('0x3')];function createListener(_0x8b547a,_0x90579b){return function(_0x4d14e3){_0x90579b[_0xcafd('0x4')](_0x8b547a,_0x4d14e3);};}function removeListener(_0x3b1440,_0xfabcf3){return function(){VoicePrefixEvents[_0xcafd('0x5')](_0x3b1440,_0xfabcf3);};}exports[_0xcafd('0x6')]=function(_0x52dafb){for(var _0x1a499b=0x0,_0x565f83=events[_0xcafd('0x7')];_0x1a499b<_0x565f83;_0x1a499b++){var _0x1160c8=events[_0x1a499b];var _0x7bc1a7=createListener(_0xcafd('0x8')+_0x1160c8,_0x52dafb);VoicePrefixEvents['on'](_0x1160c8,_0x7bc1a7);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 26e8ec5..5c943a7 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 _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 +var _0x6a18=['addAgents','addLists','put','/:id','delete','destroy','removeTeams','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','post','create','clone','/:id/teams','/:id/users'];(function(_0x5b40ff,_0x2b8d6e){var _0x2edd1b=function(_0x1a826d){while(--_0x1a826d){_0x5b40ff['push'](_0x5b40ff['shift']());}};_0x2edd1b(++_0x2b8d6e);}(_0x6a18,0xf9));var _0x86a1=function(_0x467ad6,_0x10892e){_0x467ad6=_0x467ad6-0x0;var _0x4052cc=_0x6a18[_0x467ad6];return _0x4052cc;};'use strict';var multer=require(_0x86a1('0x0'));var util=require(_0x86a1('0x1'));var path=require(_0x86a1('0x2'));var timeout=require(_0x86a1('0x3'));var express=require(_0x86a1('0x4'));var router=express[_0x86a1('0x5')]();var auth=require(_0x86a1('0x6'));var interaction=require(_0x86a1('0x7'));var config=require(_0x86a1('0x8'));var controller=require(_0x86a1('0x9'));router[_0x86a1('0xa')]('/',auth[_0x86a1('0xb')](),controller[_0x86a1('0xc')]);router[_0x86a1('0xa')]('/:id',auth[_0x86a1('0xb')](),controller[_0x86a1('0xd')]);router['get'](_0x86a1('0xe'),auth[_0x86a1('0xb')](),controller[_0x86a1('0xf')]);router['get']('/:id/hopper_histories',auth[_0x86a1('0xb')](),controller[_0x86a1('0x10')]);router[_0x86a1('0xa')](_0x86a1('0x11'),auth[_0x86a1('0xb')](),controller[_0x86a1('0x12')]);router[_0x86a1('0xa')](_0x86a1('0x13'),auth[_0x86a1('0xb')](),controller[_0x86a1('0x14')]);router['get']('/:id/teams',auth[_0x86a1('0xb')](),controller['getTeams']);router[_0x86a1('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0x86a1('0x15')]);router['get'](_0x86a1('0x16'),auth['isAuthenticated'](),controller[_0x86a1('0x17')]);router[_0x86a1('0xa')](_0x86a1('0x18'),auth[_0x86a1('0xb')](),controller['getLists']);router[_0x86a1('0xa')](_0x86a1('0x19'),auth[_0x86a1('0xb')](),controller['getBlackLists']);router[_0x86a1('0x1a')]('/',auth[_0x86a1('0xb')](),controller[_0x86a1('0x1b')]);router[_0x86a1('0x1a')]('/:id/clone',auth[_0x86a1('0xb')](),controller[_0x86a1('0x1c')]);router['post'](_0x86a1('0x1d'),auth['isAuthenticated'](),controller['addTeams']);router[_0x86a1('0x1a')](_0x86a1('0x1e'),auth[_0x86a1('0xb')](),controller[_0x86a1('0x1f')]);router[_0x86a1('0x1a')]('/:id/lists',auth[_0x86a1('0xb')](),controller[_0x86a1('0x20')]);router[_0x86a1('0x1a')](_0x86a1('0x19'),auth[_0x86a1('0xb')](),controller['addBlackLists']);router[_0x86a1('0x21')](_0x86a1('0x22'),auth[_0x86a1('0xb')](),controller['update']);router[_0x86a1('0x23')](_0x86a1('0x22'),auth[_0x86a1('0xb')](),controller[_0x86a1('0x24')]);router['delete'](_0x86a1('0x1d'),auth['isAuthenticated'](),controller[_0x86a1('0x25')]);router[_0x86a1('0x23')](_0x86a1('0x1e'),auth[_0x86a1('0xb')](),controller['removeAgents']);router[_0x86a1('0x23')](_0x86a1('0x18'),auth[_0x86a1('0xb')](),controller[_0x86a1('0x26')]);router[_0x86a1('0x23')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x86a1('0x27')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index c1ba564..6c46979 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(_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 +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(_0x206c5a,_0xd53a88){var _0x16e118=function(_0x31dbb3){while(--_0x31dbb3){_0x206c5a['push'](_0x206c5a['shift']());}};_0x16e118(++_0xd53a88);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 7bdd93a..5dffc44 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 _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 +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(_0x5622d4,_0x396780){var _0x353176=function(_0x3d1ede){while(--_0x3d1ede){_0x5622d4['push'](_0x5622d4['shift']());}};_0x353176(++_0x396780);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1b745b,_0x3e2d40){_0x1b745b=_0x1b745b-0x0;var _0x120a9d=_0xcb91[_0x1b745b];return _0x120a9d;};'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 5af9749..05b8843 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 _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 +var _0x6d6d=['hook','events','../../mysqldb','VoiceQueue','save','update','remove','hasOwnProperty'];(function(_0x18ad19,_0x5c35a1){var _0x34d0cd=function(_0x280881){while(--_0x280881){_0x18ad19['push'](_0x18ad19['shift']());}};_0x34d0cd(++_0x5c35a1);}(_0x6d6d,0x1a1));var _0xd6d6=function(_0x5ac55b,_0xb5382b){_0x5ac55b=_0x5ac55b-0x0;var _0x2ef30c=_0x6d6d[_0x5ac55b];return _0x2ef30c;};'use strict';var EventEmitter=require(_0xd6d6('0x0'));var VoiceQueue=require(_0xd6d6('0x1'))['db'][_0xd6d6('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd6d6('0x3'),'afterUpdate':_0xd6d6('0x4'),'afterDestroy':_0xd6d6('0x5')};function emitEvent(_0xcdbb67){return function(_0x5769f6,_0x581746,_0x8752ed){VoiceQueueEvents['emit'](_0xcdbb67+':'+_0x5769f6['id'],_0x5769f6);VoiceQueueEvents['emit'](_0xcdbb67,_0x5769f6);_0x8752ed(null);};}for(var e in events){if(events[_0xd6d6('0x6')](e)){var event=events[e];VoiceQueue[_0xd6d6('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 847d0f5..fc5ecd2 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 _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 +var _0xe883=['exports','define','VoiceQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceQueue.attributes'];(function(_0x90f34f,_0x404021){var _0x4b18cf=function(_0x25112d){while(--_0x25112d){_0x90f34f['push'](_0x90f34f['shift']());}};_0x4b18cf(++_0x404021);}(_0xe883,0x18f));var _0x3e88=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xe883[_0x9dfc10];return _0x4f938a;};'use strict';var _=require('lodash');var util=require(_0x3e88('0x0'));var logger=require(_0x3e88('0x1'))(_0x3e88('0x2'));var moment=require(_0x3e88('0x3'));var BPromise=require(_0x3e88('0x4'));var rp=require(_0x3e88('0x5'));var fs=require('fs');var path=require(_0x3e88('0x6'));var rimraf=require('rimraf');var config=require(_0x3e88('0x7'));var attributes=require(_0x3e88('0x8'));module[_0x3e88('0x9')]=function(_0x20f923,_0x198280){return _0x20f923[_0x3e88('0xa')](_0x3e88('0xb'),attributes,{'tableName':'voice_queues','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 758c629..828371d 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 _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 +var _0x1fdd=['localhost','socket.io-emitter','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','include','map','model','ShowVoiceQueue','find','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x2b26c5,_0x547bea){var _0xfc7f7f=function(_0x2280b9){while(--_0x2280b9){_0x2b26c5['push'](_0x2b26c5['shift']());}};_0xfc7f7f(++_0x547bea);}(_0x1fdd,0x153));var _0xd1fd=function(_0x1e6437,_0x52d483){_0x1e6437=_0x1e6437-0x0;var _0x3f97ae=_0x1fdd[_0x1e6437];return _0x3f97ae;};'use strict';var _=require(_0xd1fd('0x0'));var util=require(_0xd1fd('0x1'));var moment=require(_0xd1fd('0x2'));var BPromise=require(_0xd1fd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd1fd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd1fd('0x5'));var logger=require('../../config/logger')(_0xd1fd('0x6'));var config=require(_0xd1fd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd1fd('0x8')][_0xd1fd('0x9')]({'port':0x232a});config[_0xd1fd('0xa')]=_[_0xd1fd('0xb')](config['redis'],{'host':_0xd1fd('0xc'),'port':0x18eb});var socket=require(_0xd1fd('0xd'))(new Redis(config[_0xd1fd('0xa')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x22ae3e,_0xf2056b,_0x529249){return new BPromise(function(_0xe99215,_0xaa6a1a){return client[_0xd1fd('0xe')](_0x22ae3e,_0x529249)[_0xd1fd('0xf')](function(_0x5c347d){logger[_0xd1fd('0x10')](_0xd1fd('0x11'),_0xf2056b,_0xd1fd('0x12'));logger[_0xd1fd('0x13')](_0xd1fd('0x14'),_0xf2056b,_0xd1fd('0x12'),JSON[_0xd1fd('0x15')](_0x5c347d));if(_0x5c347d['error']){if(_0x5c347d['error'][_0xd1fd('0x16')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0xf2056b,_0x5c347d[_0xd1fd('0x17')]['message']);return _0xaa6a1a(_0x5c347d[_0xd1fd('0x17')][_0xd1fd('0x18')]);}logger[_0xd1fd('0x17')]('VoiceQueue,\x20%s,\x20%s',_0xf2056b,_0x5c347d[_0xd1fd('0x17')][_0xd1fd('0x18')]);return _0xe99215(_0x5c347d['error'][_0xd1fd('0x18')]);}else{logger[_0xd1fd('0x10')](_0xd1fd('0x11'),_0xf2056b,'request\x20sent');_0xe99215(_0x5c347d[_0xd1fd('0x19')]['message']);}})[_0xd1fd('0x1a')](function(_0x1396bb){logger[_0xd1fd('0x17')]('VoiceQueue,\x20%s,\x20%s',_0xf2056b,_0x1396bb);_0xaa6a1a(_0x1396bb);});});}exports[_0xd1fd('0x1b')]=function(_0xef1633){var _0x572cb3=this;return new Promise(function(_0x4c4763,_0x3428cf){return db[_0xd1fd('0x1c')][_0xd1fd('0x1d')]({'raw':_0xef1633[_0xd1fd('0x1e')]?_0xef1633[_0xd1fd('0x1e')][_0xd1fd('0x1f')]===undefined?!![]:![]:!![],'where':_0xef1633[_0xd1fd('0x1e')]?_0xef1633[_0xd1fd('0x1e')][_0xd1fd('0x20')]||null:null,'attributes':_0xef1633[_0xd1fd('0x1e')]?_0xef1633[_0xd1fd('0x1e')][_0xd1fd('0x21')]||null:null,'limit':_0xef1633[_0xd1fd('0x1e')]?_0xef1633[_0xd1fd('0x1e')]['limit']||null:null,'include':_0xef1633[_0xd1fd('0x1e')]?_0xef1633[_0xd1fd('0x1e')][_0xd1fd('0x22')]?_[_0xd1fd('0x23')](_0xef1633[_0xd1fd('0x1e')][_0xd1fd('0x22')],function(_0x3c1bfd){return{'model':db[_0x3c1bfd[_0xd1fd('0x24')]],'as':_0x3c1bfd['as'],'attributes':_0x3c1bfd['attributes'],'include':_0x3c1bfd['include']?_[_0xd1fd('0x23')](_0x3c1bfd[_0xd1fd('0x22')],function(_0x2afc41){return{'model':db[_0x2afc41[_0xd1fd('0x24')]],'as':_0x2afc41['as'],'attributes':_0x2afc41[_0xd1fd('0x21')],'include':_0x2afc41[_0xd1fd('0x22')]?_[_0xd1fd('0x23')](_0x2afc41[_0xd1fd('0x22')],function(_0x1c2aba){return{'model':db[_0x1c2aba[_0xd1fd('0x24')]],'as':_0x1c2aba['as'],'attributes':_0x1c2aba[_0xd1fd('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd1fd('0xf')](function(_0x3fd907){logger[_0xd1fd('0x10')](_0xd1fd('0x1b'),_0xef1633);logger[_0xd1fd('0x13')](_0xd1fd('0x1b'),_0xef1633,JSON[_0xd1fd('0x15')](_0x3fd907));_0x4c4763(_0x3fd907);})['catch'](function(_0x651102){logger['error'](_0xd1fd('0x1b'),_0x651102[_0xd1fd('0x18')],_0xef1633);_0x3428cf(_0x572cb3[_0xd1fd('0x17')](0x1f4,_0x651102[_0xd1fd('0x18')]));});});};exports[_0xd1fd('0x25')]=function(_0x531b0d){var _0x18d686=this;return new Promise(function(_0x4b2e67,_0x2139f5){return db[_0xd1fd('0x1c')][_0xd1fd('0x26')]({'raw':_0x531b0d[_0xd1fd('0x1e')]?_0x531b0d[_0xd1fd('0x1e')][_0xd1fd('0x1f')]===undefined?!![]:![]:!![],'where':_0x531b0d['options']?_0x531b0d[_0xd1fd('0x1e')][_0xd1fd('0x20')]||null:null,'attributes':_0x531b0d[_0xd1fd('0x1e')]?_0x531b0d[_0xd1fd('0x1e')]['attributes']||null:null,'include':_0x531b0d['options']?_0x531b0d[_0xd1fd('0x1e')]['include']?_[_0xd1fd('0x23')](_0x531b0d[_0xd1fd('0x1e')][_0xd1fd('0x22')],function(_0x2b0f53){return{'model':db[_0x2b0f53['model']],'as':_0x2b0f53['as'],'attributes':_0x2b0f53['attributes'],'include':_0x2b0f53[_0xd1fd('0x22')]?_[_0xd1fd('0x23')](_0x2b0f53[_0xd1fd('0x22')],function(_0x53a003){return{'model':db[_0x53a003[_0xd1fd('0x24')]],'as':_0x53a003['as'],'attributes':_0x53a003[_0xd1fd('0x21')],'include':_0x53a003[_0xd1fd('0x22')]?_['map'](_0x53a003[_0xd1fd('0x22')],function(_0x471392){return{'model':db[_0x471392[_0xd1fd('0x24')]],'as':_0x471392['as'],'attributes':_0x471392['attributes']};}):[]};}):[]};}):[]:[]})[_0xd1fd('0xf')](function(_0xcd5868){logger[_0xd1fd('0x10')](_0xd1fd('0x25'),_0x531b0d);logger[_0xd1fd('0x13')](_0xd1fd('0x25'),_0x531b0d,JSON[_0xd1fd('0x15')](_0xcd5868));_0x4b2e67(_0xcd5868);})[_0xd1fd('0x1a')](function(_0x48d22c){logger[_0xd1fd('0x17')](_0xd1fd('0x25'),_0x48d22c[_0xd1fd('0x18')],_0x531b0d);_0x2139f5(_0x18d686[_0xd1fd('0x17')](0x1f4,_0x48d22c[_0xd1fd('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 6a4201c..d6d5c9f 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 _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 +var _0x547b=['register','length','voiceQueue:','./voiceQueue.events','save','emit','removeListener'];(function(_0x2dc5b7,_0x3837ba){var _0x4edb5b=function(_0x3ed644){while(--_0x3ed644){_0x2dc5b7['push'](_0x2dc5b7['shift']());}};_0x4edb5b(++_0x3837ba);}(_0x547b,0x1b5));var _0xb547=function(_0x41458c,_0x2e3ffc){_0x41458c=_0x41458c-0x0;var _0x250e13=_0x547b[_0x41458c];return _0x250e13;};'use strict';var VoiceQueueEvents=require(_0xb547('0x0'));var events=[_0xb547('0x1'),'remove','update'];function createListener(_0x1d3cea,_0x56aebc){return function(_0x658071){_0x56aebc[_0xb547('0x2')](_0x1d3cea,_0x658071);};}function removeListener(_0x578a5d,_0xc6533d){return function(){VoiceQueueEvents[_0xb547('0x3')](_0x578a5d,_0xc6533d);};}exports[_0xb547('0x4')]=function(_0x2e6293){for(var _0x146eb7=0x0,_0x2b9508=events[_0xb547('0x5')];_0x146eb7<_0x2b9508;_0x146eb7++){var _0xd0f30f=events[_0x146eb7];var _0x2d3748=createListener(_0xb547('0x6')+_0xd0f30f,_0x2e6293);VoiceQueueEvents['on'](_0xd0f30f,_0x2d3748);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 391698a..150fdbe 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 _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 +var _0x33af=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','put','update','delete','destroy','util','connect-timeout','express','Router'];(function(_0x47a192,_0x2f5f9f){var _0x9b9f14=function(_0x2357a4){while(--_0x2357a4){_0x47a192['push'](_0x47a192['shift']());}};_0x9b9f14(++_0x2f5f9f);}(_0x33af,0xec));var _0xf33a=function(_0x1f78cb,_0x58e9f3){_0x1f78cb=_0x1f78cb-0x0;var _0x2cf6b8=_0x33af[_0x1f78cb];return _0x2cf6b8;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var auth=require(_0xf33a('0x4'));var interaction=require(_0xf33a('0x5'));var config=require(_0xf33a('0x6'));var controller=require('./voiceQueueReport.controller');router[_0xf33a('0x7')]('/',auth[_0xf33a('0x8')](),controller['index']);router[_0xf33a('0x7')](_0xf33a('0x9'),auth[_0xf33a('0x8')](),controller[_0xf33a('0xa')]);router[_0xf33a('0x7')](_0xf33a('0xb'),auth['isAuthenticated'](),controller[_0xf33a('0xc')]);router[_0xf33a('0x7')](_0xf33a('0xd'),auth[_0xf33a('0x8')](),controller[_0xf33a('0xe')]);router[_0xf33a('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf33a('0x10')](_0xf33a('0xd'),auth[_0xf33a('0x8')](),controller[_0xf33a('0x11')]);router[_0xf33a('0x12')]('/:id',auth[_0xf33a('0x8')](),controller[_0xf33a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index a8de4fa..42ba7e2 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 _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 +var _0x0713=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0xb85fd5,_0x3362ae){var _0x34228e=function(_0x1e62fa){while(--_0x1e62fa){_0xb85fd5['push'](_0xb85fd5['shift']());}};_0x34228e(++_0x3362ae);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3071('0x0')]={'type':{'type':Sequelize[_0x3071('0x1')]},'uniqueid':{'type':Sequelize[_0x3071('0x1')]},'calleridnum':{'type':Sequelize[_0x3071('0x1')]},'calleridname':{'type':Sequelize[_0x3071('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x3071('0x2')],'set':function(_0x33a70c){var _0x3137c8=moment(_0x33a70c);var _0xabd7b6=moment(this[_0x3071('0x3')](_0x3071('0x4')))[_0x3071('0x5')](_0x3071('0x6'));var _0x22274c=_0x3137c8[_0x3071('0x7')](_0xabd7b6,_0x3071('0x8'));this[_0x3071('0x9')]('queuecallerleaveAt',_0x33a70c);this[_0x3071('0x9')](_0x3071('0xa'),_0x22274c||null);}},'position':{'type':Sequelize[_0x3071('0xb')]},'count':{'type':Sequelize[_0x3071('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexit':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x3071('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x3071('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3071('0x1')]},'accountcode':{'type':Sequelize[_0x3071('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3071('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x3071('0xb')]},'mohtime':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3071('0x1')]},'transfer':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3071('0x1')],'comment':_0x3071('0xd')},'transferexten':{'type':Sequelize[_0x3071('0x1')]},'transferuniqueid':{'type':Sequelize[_0x3071('0x1')]},'disposition':{'type':Sequelize[_0x3071('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3071('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 48ad98d..ae7f6cc 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(_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 +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(_0x5329d2,_0x268198){var _0x28218d=function(_0x4625be){while(--_0x4625be){_0x5329d2['push'](_0x5329d2['shift']());}};_0x28218d(++_0x268198);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 2cb5164..69e9626 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 _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 +var _0x9478=['VoiceQueueReport','setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb'];(function(_0x3f019d,_0x1d25d2){var _0x59dfcb=function(_0x3d8a1c){while(--_0x3d8a1c){_0x3f019d['push'](_0x3f019d['shift']());}};_0x59dfcb(++_0x1d25d2);}(_0x9478,0x1e4));var _0x8947=function(_0x48e705,_0x329c32){_0x48e705=_0x48e705-0x0;var _0x4eb2e4=_0x9478[_0x48e705];return _0x4eb2e4;};'use strict';var EventEmitter=require(_0x8947('0x0'));var VoiceQueueReport=require(_0x8947('0x1'))['db'][_0x8947('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x8947('0x3')](0x0);var events={'afterCreate':_0x8947('0x4'),'afterUpdate':_0x8947('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5b1649){return function(_0x57cde0,_0x15f740,_0xd8cab7){VoiceQueueReportEvents[_0x8947('0x6')](_0x5b1649+':'+_0x57cde0['id'],_0x57cde0);VoiceQueueReportEvents[_0x8947('0x6')](_0x5b1649,_0x57cde0);_0xd8cab7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x8947('0x7')](e,emitEvent(event));}}module[_0x8947('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 1b84821..6e0c346 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.model.js +++ b/server/api/voiceQueueReport/voiceQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['request-promise','path','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','moment','bluebird'];(function(_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 +var _0x2032=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x10f68e,_0xf198ea){var _0x4c8372=function(_0x38517){while(--_0x38517){_0x10f68e['push'](_0x10f68e['shift']());}};_0x4c8372(++_0xf198ea);}(_0x2032,0xd9));var _0x2203=function(_0x1beaa2,_0x1b21ec){_0x1beaa2=_0x1beaa2-0x0;var _0x12bb9c=_0x2032[_0x1beaa2];return _0x12bb9c;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[{'fields':[_0x2203('0xc')]},{'fields':[_0x2203('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index df4d5ae..a72203b 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 _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 +var _0x5e6c=['limit','map','include','model','attributes','CreateVoiceQueueReport','create','catch','update','body','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','redis','defaults','localhost','socket.io-emitter','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where'];(function(_0x24b997,_0x1b388){var _0x341026=function(_0x3341d7){while(--_0x3341d7){_0x24b997['push'](_0x24b997['shift']());}};_0x341026(++_0x1b388);}(_0x5e6c,0x1b8));var _0xc5e6=function(_0x19c42e,_0x4b277b){_0x19c42e=_0x19c42e-0x0;var _0x52eb06=_0x5e6c[_0x19c42e];return _0x52eb06;};'use strict';var _=require(_0xc5e6('0x0'));var util=require(_0xc5e6('0x1'));var moment=require(_0xc5e6('0x2'));var BPromise=require(_0xc5e6('0x3'));var rs=require(_0xc5e6('0x4'));var fs=require('fs');var Redis=require(_0xc5e6('0x5'));var db=require(_0xc5e6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5e6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc5e6('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xc5e6('0x9')]=_[_0xc5e6('0xa')](config[_0xc5e6('0x9')],{'host':_0xc5e6('0xb'),'port':0x18eb});var socket=require(_0xc5e6('0xc'))(new Redis(config[_0xc5e6('0x9')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x57427c,_0x4b44ed,_0x36e0e8){return new BPromise(function(_0x480b49,_0x4bf9bf){return client['request'](_0x57427c,_0x36e0e8)[_0xc5e6('0xd')](function(_0x295d98){logger[_0xc5e6('0xe')](_0xc5e6('0xf'),_0x4b44ed,_0xc5e6('0x10'));logger[_0xc5e6('0x11')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x4b44ed,'request\x20sent',JSON[_0xc5e6('0x12')](_0x295d98));if(_0x295d98[_0xc5e6('0x13')]){if(_0x295d98[_0xc5e6('0x13')][_0xc5e6('0x14')]===0x1f4){logger[_0xc5e6('0x13')](_0xc5e6('0xf'),_0x4b44ed,_0x295d98[_0xc5e6('0x13')][_0xc5e6('0x15')]);return _0x4bf9bf(_0x295d98[_0xc5e6('0x13')][_0xc5e6('0x15')]);}logger['error'](_0xc5e6('0xf'),_0x4b44ed,_0x295d98[_0xc5e6('0x13')][_0xc5e6('0x15')]);return _0x480b49(_0x295d98[_0xc5e6('0x13')][_0xc5e6('0x15')]);}else{logger[_0xc5e6('0xe')](_0xc5e6('0xf'),_0x4b44ed,_0xc5e6('0x10'));_0x480b49(_0x295d98['result'][_0xc5e6('0x15')]);}})['catch'](function(_0x3f9419){logger[_0xc5e6('0x13')](_0xc5e6('0xf'),_0x4b44ed,_0x3f9419);_0x4bf9bf(_0x3f9419);});});}exports[_0xc5e6('0x16')]=function(_0x437cab){var _0x44fa79=this;return new Promise(function(_0x38be91,_0x2a35e5){return db[_0xc5e6('0x17')][_0xc5e6('0x18')]({'raw':_0x437cab[_0xc5e6('0x19')]?_0x437cab[_0xc5e6('0x19')][_0xc5e6('0x1a')]===undefined?!![]:![]:!![],'where':_0x437cab[_0xc5e6('0x19')]?_0x437cab[_0xc5e6('0x19')][_0xc5e6('0x1b')]||null:null,'attributes':_0x437cab['options']?_0x437cab[_0xc5e6('0x19')]['attributes']||null:null,'limit':_0x437cab[_0xc5e6('0x19')]?_0x437cab[_0xc5e6('0x19')][_0xc5e6('0x1c')]||null:null,'include':_0x437cab[_0xc5e6('0x19')]?_0x437cab[_0xc5e6('0x19')]['include']?_[_0xc5e6('0x1d')](_0x437cab[_0xc5e6('0x19')][_0xc5e6('0x1e')],function(_0x523ed4){return{'model':db[_0x523ed4[_0xc5e6('0x1f')]],'as':_0x523ed4['as'],'attributes':_0x523ed4[_0xc5e6('0x20')],'include':_0x523ed4['include']?_['map'](_0x523ed4[_0xc5e6('0x1e')],function(_0x2f7036){return{'model':db[_0x2f7036['model']],'as':_0x2f7036['as'],'attributes':_0x2f7036[_0xc5e6('0x20')],'include':_0x2f7036[_0xc5e6('0x1e')]?_[_0xc5e6('0x1d')](_0x2f7036[_0xc5e6('0x1e')],function(_0x32f07f){return{'model':db[_0x32f07f[_0xc5e6('0x1f')]],'as':_0x32f07f['as'],'attributes':_0x32f07f[_0xc5e6('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26c3f4){logger['info'](_0xc5e6('0x16'),_0x437cab);logger[_0xc5e6('0x11')](_0xc5e6('0x16'),_0x437cab,JSON[_0xc5e6('0x12')](_0x26c3f4));_0x38be91(_0x26c3f4);})['catch'](function(_0xe0e01d){logger['error'](_0xc5e6('0x16'),_0xe0e01d['message'],_0x437cab);_0x2a35e5(_0x44fa79[_0xc5e6('0x13')](0x1f4,_0xe0e01d[_0xc5e6('0x15')]));});});};exports[_0xc5e6('0x21')]=function(_0x38da61){var _0x1d0483=this;return new Promise(function(_0x18e639,_0x225e13){return db[_0xc5e6('0x17')][_0xc5e6('0x22')](_0x38da61['body'],{'raw':_0x38da61[_0xc5e6('0x19')]?_0x38da61['options'][_0xc5e6('0x1a')]===undefined?!![]:![]:!![]})[_0xc5e6('0xd')](function(_0x511b82){logger[_0xc5e6('0xe')](_0xc5e6('0x21'),_0x38da61);logger['debug']('CreateVoiceQueueReport',_0x38da61,JSON[_0xc5e6('0x12')](_0x511b82));_0x18e639(_0x511b82);})[_0xc5e6('0x23')](function(_0x4e8c03){logger[_0xc5e6('0x13')](_0xc5e6('0x21'),_0x4e8c03[_0xc5e6('0x15')],_0x38da61);_0x225e13(_0x1d0483[_0xc5e6('0x13')](0x1f4,_0x4e8c03[_0xc5e6('0x15')]));});});};exports['UpdateVoiceQueueReport']=function(_0x255be8){var _0x4c4ba1=this;return new Promise(function(_0x20ffa5,_0x1a60a5){return db['VoiceQueueReport'][_0xc5e6('0x24')](_0x255be8[_0xc5e6('0x25')],{'raw':_0x255be8[_0xc5e6('0x19')]?_0x255be8['options'][_0xc5e6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x255be8[_0xc5e6('0x19')]?_0x255be8[_0xc5e6('0x19')][_0xc5e6('0x1b')]||null:null,'attributes':_0x255be8[_0xc5e6('0x19')]?_0x255be8[_0xc5e6('0x19')][_0xc5e6('0x20')]||null:null,'limit':_0x255be8[_0xc5e6('0x19')]?_0x255be8['options'][_0xc5e6('0x1c')]||null:null})['then'](function(_0x462a39){logger['info'](_0xc5e6('0x26'),_0x255be8);logger[_0xc5e6('0x11')]('UpdateVoiceQueueReport',_0x255be8,JSON[_0xc5e6('0x12')](_0x462a39));_0x20ffa5(_0x462a39);})[_0xc5e6('0x23')](function(_0xb2dc21){logger[_0xc5e6('0x13')](_0xc5e6('0x26'),_0xb2dc21['message'],_0x255be8);_0x1a60a5(_0x4c4ba1[_0xc5e6('0x13')](0x1f4,_0xb2dc21[_0xc5e6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index df9f3c5..49f9db8 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 _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 +var _0x8c68=['register','voiceQueueReport:','./voiceQueueReport.events','save','remove','emit'];(function(_0x59689b,_0x8421c0){var _0x2baa5f=function(_0x45a671){while(--_0x45a671){_0x59689b['push'](_0x59689b['shift']());}};_0x2baa5f(++_0x8421c0);}(_0x8c68,0x1be));var _0x88c6=function(_0xb516f1,_0x36ff20){_0xb516f1=_0xb516f1-0x0;var _0x466fc8=_0x8c68[_0xb516f1];return _0x466fc8;};'use strict';var VoiceQueueReportEvents=require(_0x88c6('0x0'));var events=[_0x88c6('0x1'),_0x88c6('0x2'),'update'];function createListener(_0x59c35f,_0x214baa){return function(_0xc973d7){_0x214baa[_0x88c6('0x3')](_0x59c35f,_0xc973d7);};}function removeListener(_0x453e91,_0x48eee1){return function(){VoiceQueueReportEvents['removeListener'](_0x453e91,_0x48eee1);};}exports[_0x88c6('0x4')]=function(_0x2fcc8e){for(var _0x3984ca=0x0,_0x3785d2=events['length'];_0x3984ca<_0x3785d2;_0x3984ca++){var _0x484742=events[_0x3984ca];var _0x3b16ee=createListener(_0x88c6('0x5')+_0x484742,_0x2fcc8e);VoiceQueueReportEvents['on'](_0x484742,_0x3b16ee);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 8d5ce10..e9952c4 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 _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 +var _0xbe43=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','isAuthenticated','show','post','create','/:id','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x1693b1,_0x521105){var _0x42b895=function(_0x224855){while(--_0x224855){_0x1693b1['push'](_0x1693b1['shift']());}};_0x42b895(++_0x521105);}(_0xbe43,0x1bc));var _0x3be4=function(_0x4c0fc3,_0x53946d){_0x4c0fc3=_0x4c0fc3-0x0;var _0x13f033=_0xbe43[_0x4c0fc3];return _0x13f033;};'use strict';var multer=require(_0x3be4('0x0'));var util=require(_0x3be4('0x1'));var path=require(_0x3be4('0x2'));var timeout=require(_0x3be4('0x3'));var express=require(_0x3be4('0x4'));var router=express[_0x3be4('0x5')]();var auth=require(_0x3be4('0x6'));var interaction=require(_0x3be4('0x7'));var config=require(_0x3be4('0x8'));var controller=require(_0x3be4('0x9'));router[_0x3be4('0xa')]('/',auth['isAuthenticated'](),controller[_0x3be4('0xb')]);router['get']('/:id',auth[_0x3be4('0xc')](),controller[_0x3be4('0xd')]);router[_0x3be4('0xe')]('/',auth[_0x3be4('0xc')](),controller[_0x3be4('0xf')]);router['put'](_0x3be4('0x10'),auth[_0x3be4('0xc')](),controller['update']);router['delete']('/:id',auth[_0x3be4('0xc')](),controller[_0x3be4('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index d25ca6c..448c7f8 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 _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 +var _0x191a=['YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING','DATE','format'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x191a,0x67));var _0xa191=function(_0x57a829,_0x1f4123){_0x57a829=_0x57a829-0x0;var _0x528802=_0x191a[_0x57a829];return _0x528802;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa191('0x0'));module[_0xa191('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa191('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa191('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa191('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa191('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa191('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa191('0x3')],'allowNull':![],'defaultValue':moment()[_0xa191('0x4')](_0xa191('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 0bc00f8..b21a392 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 _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 +var _0xeee4=['lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','rows','params','length','includeAll','find','catch','create','body','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x3b3210,_0x25e8ed){var _0x5b5484=function(_0x417858){while(--_0x417858){_0x3b3210['push'](_0x3b3210['shift']());}};_0x5b5484(++_0x25e8ed);}(_0xeee4,0xce));var _0x4eee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeee4[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x4eee('0x0'));var emlformat=require(_0x4eee('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4eee('0x2'));var rp=require('request-promise');var moment=require(_0x4eee('0x3'));var BPromise=require(_0x4eee('0x4'));var Mustache=require(_0x4eee('0x5'));var util=require(_0x4eee('0x6'));var path=require(_0x4eee('0x7'));var sox=require(_0x4eee('0x8'));var csv=require(_0x4eee('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4eee('0xa'));var squel=require(_0x4eee('0xb'));var crypto=require('crypto');var jsforce=require(_0x4eee('0xc'));var deskjs=require(_0x4eee('0xd'));var toCsv=require(_0x4eee('0x9'));var querystring=require(_0x4eee('0xe'));var Papa=require(_0x4eee('0xf'));var Redis=require('ioredis');var authService=require(_0x4eee('0x10'));var qs=require(_0x4eee('0x11'));var as=require(_0x4eee('0x12'));var hardwareService=require(_0x4eee('0x13'));var logger=require(_0x4eee('0x14'))(_0x4eee('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4eee('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b029f,_0x561a64){_0x561a64=_0x561a64||0xcc;return function(_0x653401){if(_0x653401){return _0x5b029f[_0x4eee('0x17')](_0x561a64);}return _0x5b029f['status'](_0x561a64)[_0x4eee('0x18')]();};}function respondWithResult(_0x57c708,_0x3cda78){_0x3cda78=_0x3cda78||0xc8;return function(_0x5a994f){if(_0x5a994f){return _0x57c708[_0x4eee('0x19')](_0x3cda78)[_0x4eee('0x1a')](_0x5a994f);}};}function respondWithFilteredResult(_0x5e398c,_0x54416b){return function(_0x424e05){if(_0x424e05){var _0x2cee47=_0x424e05[_0x4eee('0x1b')],_0x196a23=_0x54416b['offset'],_0x397831=_0x54416b[_0x4eee('0x1c')]+_0x54416b[_0x4eee('0x1d')],_0xf2b4b2;if(_0x397831>=_0x2cee47){_0x397831=_0x2cee47;_0xf2b4b2=0xc8;}else{_0xf2b4b2=0xce;}_0x5e398c[_0x4eee('0x19')](_0xf2b4b2);return _0x5e398c[_0x4eee('0x1e')]('Content-Range',_0x196a23+'-'+_0x397831+'/'+_0x2cee47)['json'](_0x424e05);}return null;};}function patchUpdates(_0x3c4451){return function(_0x4ae6ff){try{jsonpatch[_0x4eee('0x1f')](_0x4ae6ff,_0x3c4451,!![]);}catch(_0x2c148f){return BPromise[_0x4eee('0x20')](_0x2c148f);}return _0x4ae6ff[_0x4eee('0x21')]();};}function saveUpdates(_0x1542d5,_0x510088){return function(_0xff6955){if(_0xff6955){return _0xff6955[_0x4eee('0x22')](_0x1542d5)[_0x4eee('0x23')](function(_0x2c4838){return _0x2c4838;});}return null;};}function removeEntity(_0x233524,_0x5137e9){return function(_0x269647){if(_0x269647){return _0x269647[_0x4eee('0x24')]()[_0x4eee('0x23')](function(){_0x233524[_0x4eee('0x19')](0xcc)[_0x4eee('0x18')]();});}};}function handleEntityNotFound(_0x237256,_0x5acff8){return function(_0x52d6bc){if(!_0x52d6bc){_0x237256[_0x4eee('0x17')](0x194);}return _0x52d6bc;};}function handleError(_0x98b417,_0x58880e){_0x58880e=_0x58880e||0x1f4;return function(_0x52f77c){logger[_0x4eee('0x25')](_0x52f77c[_0x4eee('0x26')]);if(_0x52f77c[_0x4eee('0x27')]){delete _0x52f77c[_0x4eee('0x27')];}_0x98b417[_0x4eee('0x19')](_0x58880e)[_0x4eee('0x28')](_0x52f77c);};}exports[_0x4eee('0x29')]=function(_0x558ec4,_0x33aff3){var _0x842b73={},_0x4dafe3={},_0x3c68ab={'count':0x0,'rows':[]};var _0x1175ed=_[_0x4eee('0x2a')](db[_0x4eee('0x2b')][_0x4eee('0x2c')],function(_0x2a7067){return{'name':_0x2a7067['fieldName'],'type':_0x2a7067[_0x4eee('0x2d')][_0x4eee('0x2e')]};});_0x4dafe3[_0x4eee('0x2f')]=_['map'](_0x1175ed,'name');_0x4dafe3['query']=_[_0x4eee('0x30')](_0x558ec4[_0x4eee('0x31')]);_0x4dafe3[_0x4eee('0x32')]=_[_0x4eee('0x33')](_0x4dafe3['model'],_0x4dafe3[_0x4eee('0x31')]);_0x842b73['attributes']=_[_0x4eee('0x33')](_0x4dafe3[_0x4eee('0x2f')],qs['fields'](_0x558ec4[_0x4eee('0x31')][_0x4eee('0x34')]));_0x842b73['attributes']=_0x842b73['attributes']['length']?_0x842b73[_0x4eee('0x35')]:_0x4dafe3[_0x4eee('0x2f')];if(!_0x558ec4[_0x4eee('0x31')]['hasOwnProperty'](_0x4eee('0x36'))){_0x842b73[_0x4eee('0x1d')]=qs[_0x4eee('0x1d')](_0x558ec4[_0x4eee('0x31')]['limit']);_0x842b73[_0x4eee('0x1c')]=qs['offset'](_0x558ec4[_0x4eee('0x31')][_0x4eee('0x1c')]);}_0x842b73[_0x4eee('0x37')]=qs[_0x4eee('0x38')](_0x558ec4[_0x4eee('0x31')][_0x4eee('0x38')]);_0x842b73['where']=qs[_0x4eee('0x32')](_[_0x4eee('0x39')](_0x558ec4[_0x4eee('0x31')],_0x4dafe3[_0x4eee('0x32')]),_0x1175ed);if(_0x558ec4['query'][_0x4eee('0x3a')]){_0x842b73[_0x4eee('0x3b')]=_[_0x4eee('0x3c')](_0x842b73[_0x4eee('0x3b')],{'$or':_[_0x4eee('0x2a')](_0x1175ed,function(_0x17719a){if(_0x17719a[_0x4eee('0x2d')]!=='VIRTUAL'){var _0x1cbb93={};_0x1cbb93[_0x17719a[_0x4eee('0x27')]]={'$like':'%'+_0x558ec4['query'][_0x4eee('0x3a')]+'%'};return _0x1cbb93;}})});}_0x842b73=_[_0x4eee('0x3c')]({},_0x842b73,_0x558ec4[_0x4eee('0x3d')]);var _0x229b6d={'where':_0x842b73[_0x4eee('0x3b')]};return db[_0x4eee('0x2b')][_0x4eee('0x1b')](_0x229b6d)[_0x4eee('0x23')](function(_0x530dc3){_0x3c68ab['count']=_0x530dc3;if(_0x558ec4[_0x4eee('0x31')]['includeAll']){_0x842b73[_0x4eee('0x3e')]=[{'all':!![]}];}return db[_0x4eee('0x2b')][_0x4eee('0x3f')](_0x842b73);})[_0x4eee('0x23')](function(_0x79f123){_0x3c68ab[_0x4eee('0x40')]=_0x79f123;return _0x3c68ab;})[_0x4eee('0x23')](respondWithFilteredResult(_0x33aff3,_0x842b73))['catch'](handleError(_0x33aff3,null));};exports['show']=function(_0x24999d,_0x44ad8c){var _0x5e7c09={'raw':!![],'where':{'id':_0x24999d[_0x4eee('0x41')]['id']}},_0x13cf11={};_0x13cf11[_0x4eee('0x2f')]=_[_0x4eee('0x30')](db[_0x4eee('0x2b')][_0x4eee('0x2c')]);_0x13cf11[_0x4eee('0x31')]=_[_0x4eee('0x30')](_0x24999d['query']);_0x13cf11[_0x4eee('0x32')]=_[_0x4eee('0x33')](_0x13cf11['model'],_0x13cf11[_0x4eee('0x31')]);_0x5e7c09[_0x4eee('0x35')]=_['intersection'](_0x13cf11['model'],qs['fields'](_0x24999d[_0x4eee('0x31')]['fields']));_0x5e7c09[_0x4eee('0x35')]=_0x5e7c09[_0x4eee('0x35')][_0x4eee('0x42')]?_0x5e7c09[_0x4eee('0x35')]:_0x13cf11[_0x4eee('0x2f')];if(_0x24999d['query'][_0x4eee('0x43')]){_0x5e7c09[_0x4eee('0x3e')]=[{'all':!![]}];}_0x5e7c09=_[_0x4eee('0x3c')]({},_0x5e7c09,_0x24999d[_0x4eee('0x3d')]);return db[_0x4eee('0x2b')][_0x4eee('0x44')](_0x5e7c09)[_0x4eee('0x23')](handleEntityNotFound(_0x44ad8c,null))['then'](respondWithResult(_0x44ad8c,null))[_0x4eee('0x45')](handleError(_0x44ad8c,null));};exports[_0x4eee('0x46')]=function(_0x55417d,_0xd44c0a){return db[_0x4eee('0x2b')]['create'](_0x55417d[_0x4eee('0x47')],{})['then'](respondWithResult(_0xd44c0a,0xc9))[_0x4eee('0x45')](handleError(_0xd44c0a,null));};exports[_0x4eee('0x22')]=function(_0x3cfcab,_0x17b547){if(_0x3cfcab[_0x4eee('0x47')]['id']){delete _0x3cfcab[_0x4eee('0x47')]['id'];}return db[_0x4eee('0x2b')][_0x4eee('0x44')]({'where':{'id':_0x3cfcab['params']['id']}})[_0x4eee('0x23')](handleEntityNotFound(_0x17b547,null))[_0x4eee('0x23')](saveUpdates(_0x3cfcab[_0x4eee('0x47')],null))['then'](respondWithResult(_0x17b547,null))[_0x4eee('0x45')](handleError(_0x17b547,null));};exports[_0x4eee('0x24')]=function(_0xfa42e9,_0xe40314){return db[_0x4eee('0x2b')][_0x4eee('0x44')]({'where':{'id':_0xfa42e9[_0x4eee('0x41')]['id']}})[_0x4eee('0x23')](handleEntityNotFound(_0xe40314,null))[_0x4eee('0x23')](removeEntity(_0xe40314,null))[_0x4eee('0x45')](handleError(_0xe40314,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index d181017..cda00fc 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 _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 +var _0x8fb3=['./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x543752,_0x2a8db6){var _0x420891=function(_0x28de82){while(--_0x28de82){_0x543752['push'](_0x543752['shift']());}};_0x420891(++_0x2a8db6);}(_0x8fb3,0xa8));var _0x38fb=function(_0x58f0a1,_0x14cd3e){_0x58f0a1=_0x58f0a1-0x0;var _0x896d28=_0x8fb3[_0x58f0a1];return _0x896d28;};'use strict';var _=require(_0x38fb('0x0'));var util=require(_0x38fb('0x1'));var logger=require('../../config/logger')(_0x38fb('0x2'));var moment=require(_0x38fb('0x3'));var BPromise=require('bluebird');var rp=require(_0x38fb('0x4'));var fs=require('fs');var path=require(_0x38fb('0x5'));var rimraf=require(_0x38fb('0x6'));var config=require(_0x38fb('0x7'));var attributes=require(_0x38fb('0x8'));module[_0x38fb('0x9')]=function(_0x275024,_0x41692e){return _0x275024[_0x38fb('0xa')](_0x38fb('0xb'),attributes,{'tableName':_0x38fb('0xc'),'paranoid':![],'indexes':[{'name':_0x38fb('0xd'),'fields':[_0x38fb('0xe'),_0x38fb('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 187ac98..2cea47f 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 _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 +var _0x19e1=['moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0x577f95,_0xdffe12){var _0x41af5e=function(_0x14ae4d){while(--_0x14ae4d){_0x577f95['push'](_0x577f95['shift']());}};_0x41af5e(++_0xdffe12);}(_0x19e1,0x163));var _0x119e=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0x19e1[_0x17bb31];return _0x505c71;};'use strict';var _=require(_0x119e('0x0'));var util=require(_0x119e('0x1'));var moment=require(_0x119e('0x2'));var BPromise=require(_0x119e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x119e('0x4'))['db'];var utils=require(_0x119e('0x5'));var logger=require('../../config/logger')(_0x119e('0x6'));var config=require(_0x119e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x119e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b5306,_0x25e166,_0x16a2ee){return new BPromise(function(_0x1b3797,_0x53d5b7){return client[_0x119e('0x9')](_0x1b5306,_0x16a2ee)[_0x119e('0xa')](function(_0x1a6747){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x25e166,_0x119e('0xb'));logger[_0x119e('0xc')](_0x119e('0xd'),_0x25e166,_0x119e('0xb'),JSON[_0x119e('0xe')](_0x1a6747));if(_0x1a6747[_0x119e('0xf')]){if(_0x1a6747[_0x119e('0xf')]['code']===0x1f4){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x53d5b7(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}logger['error'](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x1b3797(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}else{logger[_0x119e('0x12')](_0x119e('0x10'),_0x25e166,_0x119e('0xb'));_0x1b3797(_0x1a6747[_0x119e('0x13')][_0x119e('0x11')]);}})[_0x119e('0x14')](function(_0x54c326){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x54c326);_0x53d5b7(_0x54c326);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 033b68a..d7f0c43 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 _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 +var _0xebb9=['post','create','runTranscribe','put','update','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','/describe','describe','get','/:id','show','download','/:id/downloads','downloads'];(function(_0x5e573c,_0x1744dc){var _0x2170e1=function(_0x4af77e){while(--_0x4af77e){_0x5e573c['push'](_0x5e573c['shift']());}};_0x2170e1(++_0x1744dc);}(_0xebb9,0x66));var _0x9ebb=function(_0x292f2c,_0x2f94ad){_0x292f2c=_0x292f2c-0x0;var _0x443c8a=_0xebb9[_0x292f2c];return _0x443c8a;};'use strict';var multer=require(_0x9ebb('0x0'));var util=require(_0x9ebb('0x1'));var path=require('path');var timeout=require(_0x9ebb('0x2'));var express=require(_0x9ebb('0x3'));var router=express[_0x9ebb('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9ebb('0x5'));var config=require(_0x9ebb('0x6'));var controller=require(_0x9ebb('0x7'));router['get']('/',auth[_0x9ebb('0x8')](),controller[_0x9ebb('0x9')]);router['get'](_0x9ebb('0xa'),auth['isAuthenticated'](),controller[_0x9ebb('0xb')]);router[_0x9ebb('0xc')](_0x9ebb('0xd'),auth[_0x9ebb('0x8')](),controller[_0x9ebb('0xe')]);router['get']('/:id/download',auth[_0x9ebb('0x8')](),controller[_0x9ebb('0xf')]);router['get'](_0x9ebb('0x10'),controller[_0x9ebb('0x11')]);router[_0x9ebb('0xc')]('/:id/transcribe',auth['isAuthenticated'](),controller['downloadTranscribe']);router[_0x9ebb('0x12')]('/',auth['isAuthenticated'](),controller[_0x9ebb('0x13')]);router[_0x9ebb('0x12')]('/:id/transcribe',auth[_0x9ebb('0x8')](),controller[_0x9ebb('0x14')]);router[_0x9ebb('0x15')](_0x9ebb('0xd'),auth[_0x9ebb('0x8')](),controller[_0x9ebb('0x16')]);router['delete'](_0x9ebb('0xd'),auth['isAuthenticated'](),controller[_0x9ebb('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 647cdca..eda997a 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 _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 +var _0x33f5=['BOOLEAN','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports','VIRTUAL','value','extname','getDataValue','STRING','setDataValue','channel','split','INTEGER','TEXT','NEW','FLOAT'];(function(_0x3b90e5,_0x1d17f9){var _0x2d0589=function(_0x425008){while(--_0x425008){_0x3b90e5['push'](_0x3b90e5['shift']());}};_0x2d0589(++_0x1d17f9);}(_0x33f5,0x18e));var _0x533f=function(_0xa765c,_0x3c7e74){_0xa765c=_0xa765c-0x0;var _0xc10485=_0x33f5[_0xa765c];return _0xc10485;};'use strict';var Sequelize=require(_0x533f('0x0'));var moment=require(_0x533f('0x1'));var path=require(_0x533f('0x2'));module[_0x533f('0x3')]={'format':{'type':Sequelize[_0x533f('0x4')],'get':function(){return this['getDataValue'](_0x533f('0x5'))?path[_0x533f('0x6')](this[_0x533f('0x7')](_0x533f('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x533f('0x8')]},'channel':{'type':Sequelize[_0x533f('0x8')],'set':function(_0x3c930f){if(_0x3c930f){this[_0x533f('0x9')](_0x533f('0xa'),_0x3c930f);this['setDataValue']('membername',_0x3c930f[_0x533f('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x533f('0x8')]},'calleridnum':{'type':Sequelize[_0x533f('0x8')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x533f('0x8')]},'connectedlinename':{'type':Sequelize[_0x533f('0x8')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x533f('0x8')]},'value':{'type':Sequelize[_0x533f('0x8')]},'type':{'type':Sequelize[_0x533f('0x8')]},'rating':{'type':Sequelize[_0x533f('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x533f('0x8')]},'userDisposition':{'type':Sequelize[_0x533f('0x8')]},'userSecondDisposition':{'type':Sequelize[_0x533f('0x8')]},'userThirdDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0x533f('0xd')]},'transcribeName':{'type':Sequelize[_0x533f('0x8')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0x533f('0xe')},'fileUri':{'type':Sequelize[_0x533f('0xd')]},'fileText':{'type':Sequelize[_0x533f('0xd')]},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0x533f('0x8')]},'sPositive':{'type':Sequelize[_0x533f('0xf')]},'sNegative':{'type':Sequelize[_0x533f('0xf')]},'sNeutral':{'type':Sequelize[_0x533f('0xf')]},'sMixed':{'type':Sequelize[_0x533f('0xf')]},'tempSentiment':{'type':Sequelize[_0x533f('0x10')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x533f('0x11')],'get':function(){return moment(this[_0x533f('0x7')](_0x533f('0x12')))[_0x533f('0x13')](_0x533f('0x14'))[_0x533f('0x15')]();}},'updatedAt':{'type':Sequelize[_0x533f('0x11')],'get':function(){return moment(this[_0x533f('0x7')](_0x533f('0x16')))[_0x533f('0x13')]('MM-DD-YYYY\x20HH:mm')[_0x533f('0x15')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 3e5b282..ac154cc 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 _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 +var _0xbebc=['unlinkSync','.cypher','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','transcribeName','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Sequelize','Transcribe\x20not\x20configured','runSentiment','sentiment','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../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','apply','reject','update','then','destroy','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','catch','show','params','fields','include','find','create','body','describe','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','VoiceRecording\x20not\x20found','filename','extname','unlink','download','message','downloads','sequelize','token','push','recording','ValidationError','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x3ccd1a,_0x26d505){var _0x490970=function(_0x547f3f){while(--_0x547f3f){_0x3ccd1a['push'](_0x3ccd1a['shift']());}};_0x490970(++_0x26d505);}(_0xbebc,0xc7));var _0xcbeb=function(_0x2a288e,_0xc92ec9){_0x2a288e=_0x2a288e-0x0;var _0x586128=_0xbebc[_0x2a288e];return _0x586128;};'use strict';var pdf=require(_0xcbeb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcbeb('0x1'));var jsonpatch=require(_0xcbeb('0x2'));var rp=require('request-promise');var moment=require(_0xcbeb('0x3'));var BPromise=require(_0xcbeb('0x4'));var Mustache=require(_0xcbeb('0x5'));var util=require(_0xcbeb('0x6'));var path=require(_0xcbeb('0x7'));var sox=require(_0xcbeb('0x8'));var csv=require(_0xcbeb('0x9'));var ejs=require(_0xcbeb('0xa'));var fs=require('fs');var _=require(_0xcbeb('0xb'));var squel=require('squel');var crypto=require(_0xcbeb('0xc'));var jsforce=require(_0xcbeb('0xd'));var deskjs=require(_0xcbeb('0xe'));var toCsv=require(_0xcbeb('0x9'));var querystring=require(_0xcbeb('0xf'));var Papa=require(_0xcbeb('0x10'));var AWS=require('aws-sdk');var uuidv4=require(_0xcbeb('0x11'));var Redis=require(_0xcbeb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xcbeb('0x13'));var as=require(_0xcbeb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbeb('0x15'))(_0xcbeb('0x16'));var utils=require(_0xcbeb('0x17'));var config=require(_0xcbeb('0x18'));var licenseUtil=require(_0xcbeb('0x19'));var db=require(_0xcbeb('0x1a'))['db'];function respondWithStatusCode(_0x32fa2a,_0x1ccda1){_0x1ccda1=_0x1ccda1||0xcc;return function(_0x16e7bc){if(_0x16e7bc){return _0x32fa2a[_0xcbeb('0x1b')](_0x1ccda1);}return _0x32fa2a[_0xcbeb('0x1c')](_0x1ccda1)[_0xcbeb('0x1d')]();};}function respondWithResult(_0x949ea3,_0xfcfd77){_0xfcfd77=_0xfcfd77||0xc8;return function(_0x55b449){if(_0x55b449){return _0x949ea3[_0xcbeb('0x1c')](_0xfcfd77)[_0xcbeb('0x1e')](_0x55b449);}};}function respondWithFilteredResult(_0x46bb90,_0x9cc7a1){return function(_0x56635e){if(_0x56635e){var _0x484c2c=_0x56635e[_0xcbeb('0x1f')],_0x58c3c9=_0x9cc7a1[_0xcbeb('0x20')],_0xed2ee4=_0x9cc7a1['offset']+_0x9cc7a1[_0xcbeb('0x21')],_0x377a32;if(_0xed2ee4>=_0x484c2c){_0xed2ee4=_0x484c2c;_0x377a32=0xc8;}else{_0x377a32=0xce;}_0x46bb90[_0xcbeb('0x1c')](_0x377a32);return _0x46bb90[_0xcbeb('0x22')](_0xcbeb('0x23'),_0x58c3c9+'-'+_0xed2ee4+'/'+_0x484c2c)[_0xcbeb('0x1e')](_0x56635e);}return null;};}function patchUpdates(_0x570865){return function(_0x29a4aa){try{jsonpatch[_0xcbeb('0x24')](_0x29a4aa,_0x570865,!![]);}catch(_0x984b6c){return BPromise[_0xcbeb('0x25')](_0x984b6c);}return _0x29a4aa['save']();};}function saveUpdates(_0x3a4e3e,_0x2b6a01){return function(_0x337417){if(_0x337417){return _0x337417[_0xcbeb('0x26')](_0x3a4e3e)[_0xcbeb('0x27')](function(_0x305362){return _0x305362;});}return null;};}function removeEntity(_0x529630,_0x548c0e){return function(_0x27d1ba){if(_0x27d1ba){return _0x27d1ba[_0xcbeb('0x28')]()[_0xcbeb('0x27')](function(){_0x529630[_0xcbeb('0x1c')](0xcc)[_0xcbeb('0x1d')]();});}};}function handleEntityNotFound(_0x22beb0,_0x4581b1){return function(_0x471abb){if(!_0x471abb){_0x22beb0[_0xcbeb('0x1b')](0x194);}return _0x471abb;};}function handleError(_0x1b352f,_0x51ad42){_0x51ad42=_0x51ad42||0x1f4;return function(_0x33c56e){logger['error'](_0x33c56e['stack']);if(_0x33c56e[_0xcbeb('0x29')]){delete _0x33c56e[_0xcbeb('0x29')];}_0x1b352f['status'](_0x51ad42)[_0xcbeb('0x2a')](_0x33c56e);};}exports[_0xcbeb('0x2b')]=function(_0x43b018,_0x14a904){var _0x4124fa={},_0x575d87={},_0x299f02={'count':0x0,'rows':[]};var _0x405ab3=_[_0xcbeb('0x2c')](db[_0xcbeb('0x2d')][_0xcbeb('0x2e')],function(_0x3706c7){return{'name':_0x3706c7[_0xcbeb('0x2f')],'type':_0x3706c7[_0xcbeb('0x30')]['key']};});_0x575d87[_0xcbeb('0x31')]=_[_0xcbeb('0x32')](_['map'](_0x405ab3,_0xcbeb('0x29')),['format']);_0x575d87['query']=_[_0xcbeb('0x33')](_0x43b018[_0xcbeb('0x34')]);_0x575d87[_0xcbeb('0x35')]=_[_0xcbeb('0x36')](_0x575d87['model'],_0x575d87[_0xcbeb('0x34')]);_0x4124fa[_0xcbeb('0x37')]=_[_0xcbeb('0x36')](_0x575d87['model'],qs['fields'](_0x43b018[_0xcbeb('0x34')]['fields']));_0x4124fa[_0xcbeb('0x37')]=_0x4124fa['attributes'][_0xcbeb('0x38')]?_0x4124fa[_0xcbeb('0x37')]:_0x575d87['model'];if(!_0x43b018[_0xcbeb('0x34')][_0xcbeb('0x39')](_0xcbeb('0x3a'))){_0x4124fa[_0xcbeb('0x21')]=qs[_0xcbeb('0x21')](_0x43b018['query']['limit']);_0x4124fa[_0xcbeb('0x20')]=qs[_0xcbeb('0x20')](_0x43b018[_0xcbeb('0x34')][_0xcbeb('0x20')]);}_0x4124fa[_0xcbeb('0x3b')]=qs['sort'](_0x43b018['query'][_0xcbeb('0x3c')]);_0x4124fa[_0xcbeb('0x3d')]=qs[_0xcbeb('0x35')](_[_0xcbeb('0x3e')](_0x43b018[_0xcbeb('0x34')],_0x575d87['filters']),_0x405ab3);if(_0x43b018[_0xcbeb('0x34')][_0xcbeb('0x3f')]){_0x4124fa['where']=_['merge'](_0x4124fa[_0xcbeb('0x3d')],{'$or':_['map'](_0x405ab3,function(_0x3bdbb4){if(_0x3bdbb4[_0xcbeb('0x30')]!==_0xcbeb('0x40')){var _0x453d51={};_0x453d51[_0x3bdbb4['name']]={'$like':'%'+_0x43b018[_0xcbeb('0x34')][_0xcbeb('0x3f')]+'%'};return _0x453d51;}})});}_0x4124fa=_[_0xcbeb('0x41')]({},_0x4124fa,_0x43b018[_0xcbeb('0x42')]);var _0x2a38b7={'where':_0x4124fa[_0xcbeb('0x3d')]};return db[_0xcbeb('0x2d')]['count'](_0x2a38b7)[_0xcbeb('0x27')](function(_0xa0d263){_0x299f02[_0xcbeb('0x1f')]=_0xa0d263;if(_0x43b018[_0xcbeb('0x34')][_0xcbeb('0x43')]){_0x4124fa['include']=[{'all':!![]}];}return db[_0xcbeb('0x2d')]['findAll'](_0x4124fa);})[_0xcbeb('0x27')](function(_0x19a034){_0x299f02['rows']=_0x19a034;return _0x299f02;})['then'](respondWithFilteredResult(_0x14a904,_0x4124fa))[_0xcbeb('0x44')](handleError(_0x14a904,null));};exports[_0xcbeb('0x45')]=function(_0x174853,_0x1ceff3){var _0x5ca0e8={'raw':![],'where':{'id':_0x174853[_0xcbeb('0x46')]['id']}},_0x5edae2={};_0x5edae2[_0xcbeb('0x31')]=_['keys'](db[_0xcbeb('0x2d')][_0xcbeb('0x2e')]);_0x5edae2[_0xcbeb('0x34')]=_[_0xcbeb('0x33')](_0x174853[_0xcbeb('0x34')]);_0x5edae2[_0xcbeb('0x35')]=_[_0xcbeb('0x36')](_0x5edae2[_0xcbeb('0x31')],_0x5edae2['query']);_0x5ca0e8[_0xcbeb('0x37')]=_[_0xcbeb('0x36')](_0x5edae2[_0xcbeb('0x31')],qs[_0xcbeb('0x47')](_0x174853['query'][_0xcbeb('0x47')]));_0x5ca0e8['attributes']=_0x5ca0e8[_0xcbeb('0x37')]['length']?_0x5ca0e8[_0xcbeb('0x37')]:_0x5edae2[_0xcbeb('0x31')];if(_0x174853[_0xcbeb('0x34')][_0xcbeb('0x43')]){_0x5ca0e8[_0xcbeb('0x48')]=[{'all':!![]}];}_0x5ca0e8=_[_0xcbeb('0x41')]({},_0x5ca0e8,_0x174853['options']);return db['VoiceRecording'][_0xcbeb('0x49')](_0x5ca0e8)[_0xcbeb('0x27')](handleEntityNotFound(_0x1ceff3,null))[_0xcbeb('0x27')](respondWithResult(_0x1ceff3,null))[_0xcbeb('0x44')](handleError(_0x1ceff3,null));};exports[_0xcbeb('0x4a')]=function(_0x26fbc4,_0x3680e6){return db[_0xcbeb('0x2d')][_0xcbeb('0x4a')](_0x26fbc4[_0xcbeb('0x4b')],{})['then'](respondWithResult(_0x3680e6,0xc9))[_0xcbeb('0x44')](handleError(_0x3680e6,null));};exports['update']=function(_0x42e4c1,_0x53ffc5){if(_0x42e4c1[_0xcbeb('0x4b')]['id']){delete _0x42e4c1[_0xcbeb('0x4b')]['id'];}return db['VoiceRecording'][_0xcbeb('0x49')]({'where':{'id':_0x42e4c1['params']['id']}})[_0xcbeb('0x27')](handleEntityNotFound(_0x53ffc5,null))[_0xcbeb('0x27')](saveUpdates(_0x42e4c1[_0xcbeb('0x4b')],null))[_0xcbeb('0x27')](respondWithResult(_0x53ffc5,null))[_0xcbeb('0x44')](handleError(_0x53ffc5,null));};exports[_0xcbeb('0x4c')]=function(_0x1a27c9,_0xfdcaf7){return db[_0xcbeb('0x2d')]['describe']()['then'](respondWithResult(_0xfdcaf7,null))[_0xcbeb('0x44')](handleError(_0xfdcaf7,null));};exports['download']=function(_0x3e57e3,_0x418383,_0x423e54){var _0x3955bc=require(_0xcbeb('0x4d'));var _0x154694=![];var _0x25e2eb={};if(_0x3e57e3['query']['type']&&_0x3e57e3[_0xcbeb('0x34')][_0xcbeb('0x30')]===_0xcbeb('0x4e')){_0x25e2eb['uniqueid']=_0x3e57e3['params']['id'];}else{_0x25e2eb['id']=_0x3e57e3['params']['id'];}return db[_0xcbeb('0x2d')][_0xcbeb('0x49')]({'where':_0x25e2eb,'attributes':['id',_0xcbeb('0x4f')],'raw':!![]})[_0xcbeb('0x27')](handleEntityNotFound(_0x418383,null))[_0xcbeb('0x27')](function(_0x1663ce){if(_0x1663ce){var _0x23a9b9=_0x1663ce[_0xcbeb('0x4f')];var _0x545809=util[_0xcbeb('0x50')](_0xcbeb('0x51'),_0x23a9b9);if(fs[_0xcbeb('0x52')](_0x545809)){_0x154694=!![];return _0x3955bc[_0xcbeb('0x53')](_0x545809,_0x23a9b9,config[_0xcbeb('0x54')]['recording'])[_0xcbeb('0x27')](function(){return _0x1663ce;});}return _0x1663ce;}})[_0xcbeb('0x27')](function(_0x4d1130){if(_0x4d1130){var _0x24cbc6=_0x4d1130[_0xcbeb('0x4f')];if(!fs[_0xcbeb('0x52')](_0x24cbc6)){throw new db['Sequelize']['ValidationError'](_0xcbeb('0x55'));}if(_0x4d1130[_0xcbeb('0x56')]){return _0x418383['download'](_0x24cbc6,_0x4d1130[_0xcbeb('0x56')]+path[_0xcbeb('0x57')](_0x24cbc6),function(){if(_0x154694){fs[_0xcbeb('0x58')](_0x24cbc6);}});}else{return _0x418383[_0xcbeb('0x59')](_0x24cbc6,function(_0x55a7fd){if(_0x154694){fs['unlink'](_0x24cbc6);}});}}})['catch'](function(_0x4b107d){if(_0x4b107d[_0xcbeb('0x5a')]===_0xcbeb('0x55')){_0x418383[_0xcbeb('0x1c')](0x194)['send']('Not\x20found');}else{return handleError(_0x418383,null);}});};exports[_0xcbeb('0x5b')]=function(_0x960d7f,_0x5250b1,_0x12300a){var _0x4a136d=require(_0xcbeb('0x4d'));var _0x21e6f1=![];var _0x2691e0={'$and':[db['sequelize']['where'](db[_0xcbeb('0x5c')]['fn']('MD5',db[_0xcbeb('0x5c')]['col'](_0xcbeb('0x4e'))),_0x960d7f[_0xcbeb('0x34')][_0xcbeb('0x5d')])]};if(_0x960d7f[_0xcbeb('0x34')][_0xcbeb('0x30')]&&_0x960d7f[_0xcbeb('0x34')][_0xcbeb('0x30')]==='uniqueid'){_0x2691e0['$and'][_0xcbeb('0x5e')]({'uniqueid':_0x960d7f[_0xcbeb('0x46')]['id']});}else{_0x2691e0['$and'][_0xcbeb('0x5e')]({'id':_0x960d7f[_0xcbeb('0x46')]['id']});}return db['VoiceRecording'][_0xcbeb('0x49')]({'where':_0x2691e0,'attributes':['id',_0xcbeb('0x4f')],'raw':!![]})[_0xcbeb('0x27')](handleEntityNotFound(_0x5250b1,null))[_0xcbeb('0x27')](function(_0x30600d){if(_0x30600d){var _0x462290=util['format']('%s.cypher',_0x30600d[_0xcbeb('0x4f')]);if(fs[_0xcbeb('0x52')](_0x462290)){_0x21e6f1=!![];return _0x4a136d[_0xcbeb('0x53')](_0x462290,_0x30600d[_0xcbeb('0x4f')],config[_0xcbeb('0x54')][_0xcbeb('0x5f')])[_0xcbeb('0x27')](function(){return _0x30600d;});}return _0x30600d;}})[_0xcbeb('0x27')](function(_0x511ff3){if(_0x511ff3){if(!fs[_0xcbeb('0x52')](_0x511ff3[_0xcbeb('0x4f')])){throw new db['Sequelize'][(_0xcbeb('0x60'))](_0xcbeb('0x55'));}if(_0x511ff3[_0xcbeb('0x56')]){return _0x5250b1[_0xcbeb('0x59')](_0x511ff3[_0xcbeb('0x4f')],_0x511ff3['filename']+path[_0xcbeb('0x57')](_0x511ff3['value']),function(){if(_0x21e6f1){fs['unlink'](_0x511ff3[_0xcbeb('0x4f')]);}});}else{return _0x5250b1[_0xcbeb('0x59')](_0x511ff3['value'],function(_0x5e5f88){if(_0x21e6f1){fs[_0xcbeb('0x58')](_0x511ff3[_0xcbeb('0x4f')]);}});}}})[_0xcbeb('0x44')](handleError(_0x5250b1,null));};exports['destroy']=function(_0x2661e2,_0x19564f){return db[_0xcbeb('0x2d')][_0xcbeb('0x49')]({'where':{'id':_0x2661e2[_0xcbeb('0x46')]['id']}})[_0xcbeb('0x27')](function(_0x33c39b){if(!_0x33c39b)throw new ReferenceError(_0xcbeb('0x61'));return _0x33c39b;})['then'](function(_0x5eabee){var _0x1835dd=_0x5eabee['value'];logger[_0xcbeb('0x62')](_0xcbeb('0x63'),_0x1835dd);if(!_[_0xcbeb('0x64')](_0x5eabee[_0xcbeb('0x4f')])&&fs[_0xcbeb('0x52')](_0x1835dd)){logger[_0xcbeb('0x62')](_0xcbeb('0x65')+_0x1835dd+_0xcbeb('0x66'));fs[_0xcbeb('0x67')](_0x1835dd);}_0x1835dd=_0x1835dd+_0xcbeb('0x68');if(!_[_0xcbeb('0x64')](_0x5eabee[_0xcbeb('0x4f')])&&fs[_0xcbeb('0x52')](_0x1835dd)){logger['info'](_0xcbeb('0x65')+_0x1835dd+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x1835dd);}return _0x5eabee;})[_0xcbeb('0x27')](function(_0x4ff92c){if(!_0x4ff92c)throw new InternalError();return _0x4ff92c[_0xcbeb('0x28')]();})[_0xcbeb('0x27')](function(){_0x19564f[_0xcbeb('0x1c')](0xcc)[_0xcbeb('0x1d')]();})[_0xcbeb('0x44')](handleError(_0x19564f,null));};function getBucketslist(_0x5bd354,_0x1117a4,_0x5869b6){return new Promise(function(_0x3f4fed,_0x53eb16){var _0xebfd15=new AWS['S3']({'accessKeyId':_0x1117a4,'secretAccessKey':_0x5bd354,'region':_0x5869b6});_0xebfd15[_0xcbeb('0x69')]({},function(_0x4f0f32,_0x2ffdd7){if(_0x4f0f32){return _0x53eb16(_0x4f0f32);}else{return _0x3f4fed(_0x2ffdd7);}});});}function createBucket(_0x4cf3f6,_0x40a1d0,_0x75b60,_0xfac52c){return new Promise(function(_0x1a88dd,_0x3310c9){var _0x299d8a=new AWS['S3']({'accessKeyId':_0x40a1d0,'secretAccessKey':_0x4cf3f6,'region':_0x75b60});_0x299d8a['createBucket']({'Bucket':_0xfac52c},function(_0x42fdd9,_0x19a829){if(_0x42fdd9){return _0x3310c9(_0x42fdd9);}else{return _0x1a88dd(_0x19a829);}});});}function uploadFile(_0x1df125,_0x3c2950,_0xc9330b,_0x199e2d,_0x1c1124,_0x512a12){return new Promise(function(_0x40dc22,_0x1e2cfb){var _0x3f6b3b=new AWS['S3']({'accessKeyId':_0x3c2950,'secretAccessKey':_0x1df125,'region':_0xc9330b});_0x3f6b3b[_0xcbeb('0x6a')]({'Bucket':_0x199e2d,'Key':_0x1c1124,'Body':_0x512a12},function(_0x1d5f6d,_0x4ec8c9){if(_0x1d5f6d){return _0x1e2cfb(_0x1d5f6d);}else{return _0x40dc22(_0x4ec8c9);}});});}function startTranscribe(_0x1c5f69,_0x12b704,_0xaa47f8,_0x3f479f,_0x58d604,_0x293daf){return new Promise(function(_0x188638,_0x474aa8){var _0x2fb775=new AWS[(_0xcbeb('0x6b'))]({'accessKeyId':_0x12b704,'secretAccessKey':_0x1c5f69,'region':_0xaa47f8});_0x2fb775[_0xcbeb('0x6c')]({'TranscriptionJobName':_0x3f479f,'LanguageCode':_0x58d604,'Media':{'MediaFileUri':_0x293daf}},function(_0x59d775,_0xa4070c){if(_0x59d775){return _0x474aa8(_0x59d775);}else{return _0x188638(_0xa4070c);}});});}function transcribe(_0xf2faca,_0x5b6415,_0x1b2dbf,_0x13ae2c,_0x5eb5a5,_0x3b55e5,_0x1f0ec7){return new Promise(function(_0x541f35,_0x196cce){var _0x2a837d={};logger[_0xcbeb('0x62')](util[_0xcbeb('0x50')](_0xcbeb('0x6d'),_0xf2faca,_0x5eb5a5));return uploadFile(_0x5b6415,_0x1b2dbf,_0x13ae2c,_0x5eb5a5,path[_0xcbeb('0x6e')](_0x3b55e5),fs[_0xcbeb('0x6f')](_0x3b55e5))[_0xcbeb('0x27')](function(_0x207989){logger[_0xcbeb('0x62')](util['format'](_0xcbeb('0x70'),_0xf2faca,_0x5eb5a5,_0x207989[_0xcbeb('0x71')]));_0x2a837d[_0xcbeb('0x72')]=_0x207989['Bucket'];_0x2a837d[_0xcbeb('0x73')]=_0x207989[_0xcbeb('0x71')];logger['info'](util[_0xcbeb('0x50')](_0xcbeb('0x74'),_0xf2faca));return startTranscribe(_0x5b6415,_0x1b2dbf,_0x13ae2c,uuidv4(),_0x1f0ec7,_0x207989[_0xcbeb('0x71')]);})['then'](function(_0x480724){logger[_0xcbeb('0x62')](util[_0xcbeb('0x50')](_0xcbeb('0x75'),_0xf2faca,_0x480724['TranscriptionJob']['TranscriptionJobName']));_0x2a837d[_0xcbeb('0x76')]=_0x480724[_0xcbeb('0x77')][_0xcbeb('0x78')];_0x2a837d[_0xcbeb('0x79')]=_0x480724[_0xcbeb('0x77')][_0xcbeb('0x7a')];return _0x541f35(_0x2a837d);})[_0xcbeb('0x44')](function(_0x3e626f){return _0x196cce(_0x3e626f);});});}exports[_0xcbeb('0x7b')]=function(_0x247df5,_0x560564,_0x5020c1){var _0x52aa22;var _0x6504b;var _0x27663a;var _0x25eb11=require('../../components/encryptor');return db[_0xcbeb('0x2d')][_0xcbeb('0x7c')]({'where':{'id':_0x247df5['params']['id']}})[_0xcbeb('0x27')](function(_0x6817d2){if(_0x6817d2){var _0x5211fe=util['format']('%s.cypher',_0x6817d2[_0xcbeb('0x4f')]);if(fs[_0xcbeb('0x52')](_0x5211fe)){cypher=!![];return _0x25eb11[_0xcbeb('0x53')](_0x5211fe,_0x6817d2[_0xcbeb('0x4f')],config[_0xcbeb('0x54')]['recording'])[_0xcbeb('0x27')](function(){return _0x6817d2;});}return _0x6817d2;}})[_0xcbeb('0x27')](function(_0x2b3b35){if(!_0x2b3b35){throw new db['Sequelize'][(_0xcbeb('0x60'))](_0xcbeb('0x7d'));}_0x6504b=_0x2b3b35;return db[_0xcbeb('0x7e')]['findOne']({'where':{'id':0x1}});})[_0xcbeb('0x27')](handleEntityNotFound(_0x560564,null))['then'](function(_0x3e1ab6){if(_0x3e1ab6){_0x52aa22=_0x3e1ab6;if(!_0x52aa22[_0xcbeb('0x7f')]||!_0x52aa22[_0xcbeb('0x80')]||!_0x52aa22[_0xcbeb('0x81')]||!_0x52aa22[_0xcbeb('0x82')]||!_0x52aa22[_0xcbeb('0x72')]){throw new db[(_0xcbeb('0x83'))][(_0xcbeb('0x60'))](_0xcbeb('0x84'));}if(_0x247df5['body'][_0xcbeb('0x85')]&&(!_0x52aa22[_0xcbeb('0x86')]||!_0x52aa22['sentimentAccountId']||!_0x52aa22['sentimentRegion']||!_0x52aa22[_0xcbeb('0x82')]||!_0x52aa22['bucket'])){throw new db[(_0xcbeb('0x83'))][(_0xcbeb('0x60'))](_0xcbeb('0x87'));}return db['CloudProvider'][_0xcbeb('0x7c')]({'where':{'id':_0x52aa22[_0xcbeb('0x80')]}});}})[_0xcbeb('0x27')](function(_0x33d9df){if(!_0x33d9df){throw new db['Sequelize'][(_0xcbeb('0x60'))](_0xcbeb('0x88'));}if(!_0x33d9df[_0xcbeb('0x89')]||!_0x33d9df[_0xcbeb('0x8a')]){throw new db[(_0xcbeb('0x83'))][(_0xcbeb('0x60'))](_0xcbeb('0x8b'));}_0x27663a=_0x33d9df;return getBucketslist(_0x27663a['data1'],_0x27663a[_0xcbeb('0x8a')],_0x52aa22[_0xcbeb('0x81')]);})[_0xcbeb('0x27')](function(_0x118458){if(_0x118458&&_0x118458['Buckets']){var _0xc3c541=_[_0xcbeb('0x49')](_0x118458[_0xcbeb('0x8c')],function(_0x4eeedb){return _0x4eeedb['Name']===_0x52aa22['bucket'];});if(!_0xc3c541){logger[_0xcbeb('0x62')](util[_0xcbeb('0x50')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x247df5[_0xcbeb('0x46')]['id'],_0x52aa22[_0xcbeb('0x72')]));return createBucket(_0x27663a[_0xcbeb('0x89')],_0x27663a[_0xcbeb('0x8a')],_0x52aa22[_0xcbeb('0x81')],_0x52aa22[_0xcbeb('0x72')]);}logger[_0xcbeb('0x62')](util[_0xcbeb('0x50')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x247df5['params']['id'],_0x52aa22[_0xcbeb('0x72')]));return;}})[_0xcbeb('0x27')](function(_0x5b0f72){if(_0x6504b[_0xcbeb('0x79')]===_0xcbeb('0x8d')){return transcribe(_0x247df5[_0xcbeb('0x46')]['id'],_0x27663a[_0xcbeb('0x89')],_0x27663a['data2'],_0x52aa22[_0xcbeb('0x81')],_0x52aa22['bucket'],_0x6504b[_0xcbeb('0x4f')],_0x52aa22['language']);}else{logger[_0xcbeb('0x62')](util[_0xcbeb('0x50')](_0xcbeb('0x8e'),_0x247df5['params']['id']));return{'transcribeStatus':_0xcbeb('0x8f')};}})[_0xcbeb('0x27')](function(_0x2dbed6){if(_0x2dbed6){_0x2dbed6[_0xcbeb('0x90')]=_0x247df5[_0xcbeb('0x4b')]['runSentiment'];return _0x6504b[_0xcbeb('0x91')](_0x2dbed6);}})[_0xcbeb('0x27')](respondWithResult(_0x560564,null))[_0xcbeb('0x44')](handleError(_0x560564,null));};function writeFile(_0x43aa45,_0x5d87a8){return new Promise(function(_0x5accbd,_0x3ec15d){fs[_0xcbeb('0x92')](_0x5d87a8,_0x43aa45,function(_0x162960,_0x5e6127){if(_0x162960){return _0x3ec15d(_0x162960);}else{return _0x5accbd(_0x5e6127);}});});}exports['downloadTranscribe']=function(_0x1f13b7,_0x42a56f,_0x3122c1){return db[_0xcbeb('0x2d')]['findOne']({'where':{'id':_0x1f13b7['params']['id']}})[_0xcbeb('0x27')](handleEntityNotFound(_0x42a56f))[_0xcbeb('0x27')](function(_0x384666){if(_0x384666&&_0x384666[_0xcbeb('0x93')]){var _0x4bd506=_0x384666[_0xcbeb('0x93')];var _0x471636=config[_0xcbeb('0x94')]+_0xcbeb('0x95')+_0x384666['id']+'.txt';if(fs[_0xcbeb('0x52')](_0x471636)){return _0x471636;}return writeFile(_0x4bd506,_0x471636)['then'](function(){return _0x471636;});}else{throw new db[(_0xcbeb('0x83'))][(_0xcbeb('0x60'))](_0xcbeb('0x96'));}})['then'](function(_0x489387){return _0x42a56f[_0xcbeb('0x59')](_0x489387);})['catch'](handleError(_0x42a56f));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 70506a3..2ab42ca 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 _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 +var _0xa86b=['exports','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa86b,0x147));var _0xba86=function(_0x4f4b9e,_0xafd458){_0x4f4b9e=_0x4f4b9e-0x0;var _0xc1a2bf=_0xa86b[_0x4f4b9e];return _0xc1a2bf;};'use strict';var _=require(_0xba86('0x0'));var util=require(_0xba86('0x1'));var logger=require(_0xba86('0x2'))(_0xba86('0x3'));var moment=require(_0xba86('0x4'));var BPromise=require(_0xba86('0x5'));var rp=require(_0xba86('0x6'));var fs=require('fs');var path=require(_0xba86('0x7'));var rimraf=require(_0xba86('0x8'));var config=require(_0xba86('0x9'));var attributes=require(_0xba86('0xa'));module[_0xba86('0xb')]=function(_0xcf1014,_0x5491cb){return _0xcf1014['define']('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xba86('0xc'),'fields':[_0xba86('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 5b622fc..ec7048c 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(_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 +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(_0x237340,_0x39b15d){var _0x5542c8=function(_0xb6a05f){while(--_0xb6a05f){_0x237340['push'](_0x237340['shift']());}};_0x5542c8(++_0x39b15d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 2187114..2a51df3 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 _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 +var _0x1b18=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x5894be,_0x4aced5){var _0x367927=function(_0x2731b7){while(--_0x2731b7){_0x5894be['push'](_0x5894be['shift']());}};_0x367927(++_0x4aced5);}(_0x1b18,0x13a));var _0x81b1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1b18[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x81b1('0x0'));var util=require(_0x81b1('0x1'));var path=require(_0x81b1('0x2'));var timeout=require(_0x81b1('0x3'));var express=require(_0x81b1('0x4'));var router=express['Router']();var auth=require(_0x81b1('0x5'));var interaction=require(_0x81b1('0x6'));var config=require(_0x81b1('0x7'));var controller=require(_0x81b1('0x8'));router[_0x81b1('0x9')]('/',auth[_0x81b1('0xa')](),controller['index']);router[_0x81b1('0x9')](_0x81b1('0xb'),auth[_0x81b1('0xa')](),controller[_0x81b1('0xc')]);router[_0x81b1('0x9')]('/:id',auth[_0x81b1('0xa')](),controller[_0x81b1('0xd')]);router[_0x81b1('0xe')]('/',auth[_0x81b1('0xa')](),controller[_0x81b1('0xf')]);router[_0x81b1('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x81b1('0x11')]);router[_0x81b1('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x81b1('0x13')]);module[_0x81b1('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index db03be4..979a454 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 _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 +var _0x5679=['sequelize','moment','ENUM','attended','STRING','Yes'];(function(_0x5e9d75,_0x15c37b){var _0x316f43=function(_0x35bc25){while(--_0x35bc25){_0x5e9d75['push'](_0x5e9d75['shift']());}};_0x316f43(++_0x15c37b);}(_0x5679,0x15c));var _0x9567=function(_0x2217d8,_0x2df132){_0x2217d8=_0x2217d8-0x0;var _0x1a86e2=_0x5679[_0x2217d8];return _0x1a86e2;};'use strict';var Sequelize=require(_0x9567('0x0'));var moment=require(_0x9567('0x1'));module['exports']={'type':{'type':Sequelize[_0x9567('0x2')]('blind',_0x9567('0x3'))},'result':{'type':Sequelize[_0x9567('0x4')]},'transfererchannel':{'type':Sequelize[_0x9567('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x9567('0x4')]},'transferercalleridname':{'type':Sequelize[_0x9567('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x9567('0x4')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x9567('0x4')]},'transferercontext':{'type':Sequelize[_0x9567('0x4')]},'transfererexten':{'type':Sequelize[_0x9567('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x9567('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x9567('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x9567('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x9567('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x9567('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x9567('0x4')]},'transfereeexten':{'type':Sequelize[_0x9567('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x9567('0x4')]},'isexternal':{'type':Sequelize[_0x9567('0x2')](_0x9567('0x5'),'No')},'context':{'type':Sequelize[_0x9567('0x4')]},'extension':{'type':Sequelize[_0x9567('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index fe38534..e6470a4 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 _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 +var _0x1952=['fast-json-patch','moment','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','map','VIRTUAL','merge','options','VoiceTransferReport','include','rows','catch','show','params','keys','includeAll','find','create','body','describe','eml-format','rimraf'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1952,0x92));var _0x2195=function(_0x2d2b9b,_0x487c93){_0x2d2b9b=_0x2d2b9b-0x0;var _0x4c3155=_0x1952[_0x2d2b9b];return _0x4c3155;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2195('0x0'));var rimraf=require(_0x2195('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2195('0x2'));var rp=require('request-promise');var moment=require(_0x2195('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2195('0x4'));var path=require(_0x2195('0x5'));var sox=require('sox');var csv=require(_0x2195('0x6'));var ejs=require(_0x2195('0x7'));var fs=require('fs');var _=require(_0x2195('0x8'));var squel=require(_0x2195('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2195('0xa'));var toCsv=require(_0x2195('0x6'));var querystring=require(_0x2195('0xb'));var Papa=require(_0x2195('0xc'));var Redis=require(_0x2195('0xd'));var authService=require(_0x2195('0xe'));var qs=require(_0x2195('0xf'));var as=require(_0x2195('0x10'));var hardwareService=require(_0x2195('0x11'));var logger=require(_0x2195('0x12'))(_0x2195('0x13'));var utils=require(_0x2195('0x14'));var config=require(_0x2195('0x15'));var licenseUtil=require(_0x2195('0x16'));var db=require(_0x2195('0x17'))['db'];function respondWithStatusCode(_0x231da3,_0xf78cd){_0xf78cd=_0xf78cd||0xcc;return function(_0x2d6800){if(_0x2d6800){return _0x231da3['sendStatus'](_0xf78cd);}return _0x231da3[_0x2195('0x18')](_0xf78cd)[_0x2195('0x19')]();};}function respondWithResult(_0x50a1eb,_0x5b039f){_0x5b039f=_0x5b039f||0xc8;return function(_0x5cdfd1){if(_0x5cdfd1){return _0x50a1eb[_0x2195('0x18')](_0x5b039f)[_0x2195('0x1a')](_0x5cdfd1);}};}function respondWithFilteredResult(_0x2b10b5,_0x19ca5d){return function(_0x27c97c){if(_0x27c97c){var _0x4f0030=_0x27c97c[_0x2195('0x1b')],_0x5c3e0c=_0x19ca5d[_0x2195('0x1c')],_0x2fd921=_0x19ca5d[_0x2195('0x1c')]+_0x19ca5d[_0x2195('0x1d')],_0x41ba82;if(_0x2fd921>=_0x4f0030){_0x2fd921=_0x4f0030;_0x41ba82=0xc8;}else{_0x41ba82=0xce;}_0x2b10b5[_0x2195('0x18')](_0x41ba82);return _0x2b10b5[_0x2195('0x1e')](_0x2195('0x1f'),_0x5c3e0c+'-'+_0x2fd921+'/'+_0x4f0030)['json'](_0x27c97c);}return null;};}function patchUpdates(_0x5be73b){return function(_0x5d94af){try{jsonpatch[_0x2195('0x20')](_0x5d94af,_0x5be73b,!![]);}catch(_0x411896){return BPromise[_0x2195('0x21')](_0x411896);}return _0x5d94af[_0x2195('0x22')]();};}function saveUpdates(_0x1e0c8d,_0xbf84cf){return function(_0x57d996){if(_0x57d996){return _0x57d996[_0x2195('0x23')](_0x1e0c8d)[_0x2195('0x24')](function(_0x3731db){return _0x3731db;});}return null;};}function removeEntity(_0x52e678,_0x3e24a6){return function(_0x257291){if(_0x257291){return _0x257291[_0x2195('0x25')]()[_0x2195('0x24')](function(){_0x52e678[_0x2195('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21966b,_0x5145d6){return function(_0x2e3fa3){if(!_0x2e3fa3){_0x21966b[_0x2195('0x26')](0x194);}return _0x2e3fa3;};}function handleError(_0x2f48a2,_0x3b16a4){_0x3b16a4=_0x3b16a4||0x1f4;return function(_0x22faec){logger[_0x2195('0x27')](_0x22faec[_0x2195('0x28')]);if(_0x22faec[_0x2195('0x29')]){delete _0x22faec[_0x2195('0x29')];}_0x2f48a2[_0x2195('0x18')](_0x3b16a4)['send'](_0x22faec);};}exports[_0x2195('0x2a')]=function(_0x4657d1,_0x4b06f5){var _0x30313a={},_0xdb0d18={},_0x24bc76={'count':0x0,'rows':[]};var _0x417bc8=_['map'](db['VoiceTransferReport'][_0x2195('0x2b')],function(_0x4a6c94){return{'name':_0x4a6c94[_0x2195('0x2c')],'type':_0x4a6c94[_0x2195('0x2d')]['key']};});_0xdb0d18[_0x2195('0x2e')]=_['map'](_0x417bc8,_0x2195('0x29'));_0xdb0d18[_0x2195('0x2f')]=_['keys'](_0x4657d1[_0x2195('0x2f')]);_0xdb0d18[_0x2195('0x30')]=_[_0x2195('0x31')](_0xdb0d18['model'],_0xdb0d18[_0x2195('0x2f')]);_0x30313a[_0x2195('0x32')]=_[_0x2195('0x31')](_0xdb0d18[_0x2195('0x2e')],qs[_0x2195('0x33')](_0x4657d1[_0x2195('0x2f')][_0x2195('0x33')]));_0x30313a[_0x2195('0x32')]=_0x30313a['attributes'][_0x2195('0x34')]?_0x30313a['attributes']:_0xdb0d18['model'];if(!_0x4657d1[_0x2195('0x2f')][_0x2195('0x35')](_0x2195('0x36'))){_0x30313a[_0x2195('0x1d')]=qs[_0x2195('0x1d')](_0x4657d1[_0x2195('0x2f')][_0x2195('0x1d')]);_0x30313a[_0x2195('0x1c')]=qs[_0x2195('0x1c')](_0x4657d1[_0x2195('0x2f')]['offset']);}_0x30313a['order']=qs['sort'](_0x4657d1['query']['sort']);_0x30313a[_0x2195('0x37')]=qs[_0x2195('0x30')](_[_0x2195('0x38')](_0x4657d1['query'],_0xdb0d18[_0x2195('0x30')]),_0x417bc8);if(_0x4657d1['query'][_0x2195('0x39')]){_0x30313a[_0x2195('0x37')]=_['merge'](_0x30313a[_0x2195('0x37')],{'$or':_[_0x2195('0x3a')](_0x417bc8,function(_0x5eb5d9){if(_0x5eb5d9[_0x2195('0x2d')]!==_0x2195('0x3b')){var _0x428b37={};_0x428b37[_0x5eb5d9[_0x2195('0x29')]]={'$like':'%'+_0x4657d1['query'][_0x2195('0x39')]+'%'};return _0x428b37;}})});}_0x30313a=_[_0x2195('0x3c')]({},_0x30313a,_0x4657d1[_0x2195('0x3d')]);var _0x1c5e9d={'where':_0x30313a[_0x2195('0x37')]};return db[_0x2195('0x3e')]['count'](_0x1c5e9d)[_0x2195('0x24')](function(_0x4eb1d5){_0x24bc76['count']=_0x4eb1d5;if(_0x4657d1['query']['includeAll']){_0x30313a[_0x2195('0x3f')]=[{'all':!![]}];}return db[_0x2195('0x3e')]['findAll'](_0x30313a);})[_0x2195('0x24')](function(_0x516b5c){_0x24bc76[_0x2195('0x40')]=_0x516b5c;return _0x24bc76;})[_0x2195('0x24')](respondWithFilteredResult(_0x4b06f5,_0x30313a))[_0x2195('0x41')](handleError(_0x4b06f5,null));};exports[_0x2195('0x42')]=function(_0x9bd9bc,_0x306107){var _0x112bba={'raw':!![],'where':{'id':_0x9bd9bc[_0x2195('0x43')]['id']}},_0x2ad53f={};_0x2ad53f['model']=_[_0x2195('0x44')](db[_0x2195('0x3e')][_0x2195('0x2b')]);_0x2ad53f[_0x2195('0x2f')]=_[_0x2195('0x44')](_0x9bd9bc[_0x2195('0x2f')]);_0x2ad53f[_0x2195('0x30')]=_[_0x2195('0x31')](_0x2ad53f['model'],_0x2ad53f[_0x2195('0x2f')]);_0x112bba[_0x2195('0x32')]=_['intersection'](_0x2ad53f[_0x2195('0x2e')],qs[_0x2195('0x33')](_0x9bd9bc[_0x2195('0x2f')][_0x2195('0x33')]));_0x112bba['attributes']=_0x112bba[_0x2195('0x32')][_0x2195('0x34')]?_0x112bba[_0x2195('0x32')]:_0x2ad53f[_0x2195('0x2e')];if(_0x9bd9bc[_0x2195('0x2f')][_0x2195('0x45')]){_0x112bba[_0x2195('0x3f')]=[{'all':!![]}];}_0x112bba=_[_0x2195('0x3c')]({},_0x112bba,_0x9bd9bc[_0x2195('0x3d')]);return db[_0x2195('0x3e')][_0x2195('0x46')](_0x112bba)['then'](handleEntityNotFound(_0x306107,null))['then'](respondWithResult(_0x306107,null))['catch'](handleError(_0x306107,null));};exports[_0x2195('0x47')]=function(_0xd5dcd,_0x598297){return db[_0x2195('0x3e')]['create'](_0xd5dcd[_0x2195('0x48')],{})[_0x2195('0x24')](respondWithResult(_0x598297,0xc9))[_0x2195('0x41')](handleError(_0x598297,null));};exports[_0x2195('0x23')]=function(_0x574a97,_0x138110){if(_0x574a97[_0x2195('0x48')]['id']){delete _0x574a97['body']['id'];}return db['VoiceTransferReport'][_0x2195('0x46')]({'where':{'id':_0x574a97[_0x2195('0x43')]['id']}})[_0x2195('0x24')](handleEntityNotFound(_0x138110,null))['then'](saveUpdates(_0x574a97[_0x2195('0x48')],null))[_0x2195('0x24')](respondWithResult(_0x138110,null))[_0x2195('0x41')](handleError(_0x138110,null));};exports[_0x2195('0x25')]=function(_0x26e112,_0x46e2ad){return db['VoiceTransferReport']['find']({'where':{'id':_0x26e112[_0x2195('0x43')]['id']}})[_0x2195('0x24')](handleEntityNotFound(_0x46e2ad,null))[_0x2195('0x24')](removeEntity(_0x46e2ad,null))[_0x2195('0x41')](handleError(_0x46e2ad,null));};exports['describe']=function(_0x5aba0a,_0x1ec74a){return db['VoiceTransferReport'][_0x2195('0x49')]()[_0x2195('0x24')](respondWithResult(_0x1ec74a,null))[_0x2195('0x41')](handleError(_0x1ec74a,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index fee137f..12ac2aa 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 _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 +var _0x0626=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','report_call_transfer'];(function(_0x3d65de,_0x231136){var _0x1c40b3=function(_0x3bbddc){while(--_0x3bbddc){_0x3d65de['push'](_0x3d65de['shift']());}};_0x1c40b3(++_0x231136);}(_0x0626,0x1ef));var _0x6062=function(_0x28ee95,_0x2377d3){_0x28ee95=_0x28ee95-0x0;var _0x235143=_0x0626[_0x28ee95];return _0x235143;};'use strict';var _=require(_0x6062('0x0'));var util=require(_0x6062('0x1'));var logger=require(_0x6062('0x2'))(_0x6062('0x3'));var moment=require(_0x6062('0x4'));var BPromise=require(_0x6062('0x5'));var rp=require(_0x6062('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6062('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0x6062('0x8')]=function(_0x354f34,_0x7c3d72){return _0x354f34[_0x6062('0x9')]('VoiceTransferReport',attributes,{'tableName':_0x6062('0xa'),'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 3b16e51..c0ec25e 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 _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 +var _0x2fc2=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','CreateVoiceTransferReport','create','options','raw','then','catch','lodash','bluebird'];(function(_0x10c3f1,_0x563147){var _0x1c9653=function(_0x5d026e){while(--_0x5d026e){_0x10c3f1['push'](_0x10c3f1['shift']());}};_0x1c9653(++_0x563147);}(_0x2fc2,0x193));var _0x22fc=function(_0x46e0eb,_0x4dd609){_0x46e0eb=_0x46e0eb-0x0;var _0x52687a=_0x2fc2[_0x46e0eb];return _0x52687a;};'use strict';var _=require(_0x22fc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x22fc('0x1'));var rs=require(_0x22fc('0x2'));var fs=require('fs');var Redis=require(_0x22fc('0x3'));var db=require(_0x22fc('0x4'))['db'];var utils=require(_0x22fc('0x5'));var logger=require(_0x22fc('0x6'))(_0x22fc('0x7'));var config=require(_0x22fc('0x8'));var jayson=require(_0x22fc('0x9'));var client=jayson[_0x22fc('0xa')][_0x22fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39b7f6,_0x463c55,_0x1140d5){return new BPromise(function(_0x34f6b6,_0x31b327){return client[_0x22fc('0xc')](_0x39b7f6,_0x1140d5)['then'](function(_0x1234bf){logger[_0x22fc('0xd')](_0x22fc('0xe'),_0x463c55,_0x22fc('0xf'));logger[_0x22fc('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x463c55,_0x22fc('0xf'),JSON[_0x22fc('0x11')](_0x1234bf));if(_0x1234bf['error']){if(_0x1234bf[_0x22fc('0x12')][_0x22fc('0x13')]===0x1f4){logger['error'](_0x22fc('0xe'),_0x463c55,_0x1234bf[_0x22fc('0x12')][_0x22fc('0x14')]);return _0x31b327(_0x1234bf['error'][_0x22fc('0x14')]);}logger[_0x22fc('0x12')](_0x22fc('0xe'),_0x463c55,_0x1234bf['error'][_0x22fc('0x14')]);return _0x34f6b6(_0x1234bf[_0x22fc('0x12')][_0x22fc('0x14')]);}else{logger[_0x22fc('0xd')](_0x22fc('0xe'),_0x463c55,_0x22fc('0xf'));_0x34f6b6(_0x1234bf['result'][_0x22fc('0x14')]);}})['catch'](function(_0x46c106){logger[_0x22fc('0x12')](_0x22fc('0xe'),_0x463c55,_0x46c106);_0x31b327(_0x46c106);});});}exports[_0x22fc('0x15')]=function(_0x4b2872){var _0xb11a8f=this;return new Promise(function(_0x5dd580,_0x508e7e){return db['VoiceTransferReport'][_0x22fc('0x16')](_0x4b2872['body'],{'raw':_0x4b2872[_0x22fc('0x17')]?_0x4b2872[_0x22fc('0x17')][_0x22fc('0x18')]===undefined?!![]:![]:!![]})[_0x22fc('0x19')](function(_0x52fe71){logger[_0x22fc('0xd')]('CreateVoiceTransferReport',_0x4b2872);logger[_0x22fc('0x10')](_0x22fc('0x15'),_0x4b2872,JSON[_0x22fc('0x11')](_0x52fe71));_0x5dd580(_0x52fe71);})[_0x22fc('0x1a')](function(_0x3448f6){logger['error'](_0x22fc('0x15'),_0x3448f6[_0x22fc('0x14')],_0x4b2872);_0x508e7e(_0xb11a8f[_0x22fc('0x12')](0x1f4,_0x3448f6['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index d1d166d..0c5d233 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 _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 +var _0x1da1=['unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','canUpdate','originate','isAuthenticated','hangup','/hold','hold','/unhold'];(function(_0x4fd109,_0x33c503){var _0x30f0a6=function(_0xc11c0d){while(--_0xc11c0d){_0x4fd109['push'](_0x4fd109['shift']());}};_0x30f0a6(++_0x33c503);}(_0x1da1,0x1a4));var _0x11da=function(_0x299e45,_0x2197bf){_0x299e45=_0x299e45-0x0;var _0x2ef4dd=_0x1da1[_0x299e45];return _0x2ef4dd;};'use strict';var express=require(_0x11da('0x0'));var router=express[_0x11da('0x1')]();var auth=require(_0x11da('0x2'));var controller=require(_0x11da('0x3'));router[_0x11da('0x4')]('/originate',auth['isAuthenticated'](),auth[_0x11da('0x5')](),controller[_0x11da('0x6')]);router[_0x11da('0x4')]('/hangup',auth[_0x11da('0x7')](),auth[_0x11da('0x5')](),controller[_0x11da('0x8')]);router['post']('/answer',auth[_0x11da('0x7')](),auth[_0x11da('0x5')](),controller['answer']);router[_0x11da('0x4')](_0x11da('0x9'),auth['isAuthenticated'](),auth[_0x11da('0x5')](),controller[_0x11da('0xa')]);router[_0x11da('0x4')](_0x11da('0xb'),auth[_0x11da('0x7')](),auth[_0x11da('0x5')](),controller[_0x11da('0xc')]);router[_0x11da('0x4')](_0x11da('0xd'),auth['isAuthenticated'](),auth[_0x11da('0x5')](),controller[_0x11da('0xe')]);router[_0x11da('0x4')](_0x11da('0xf'),auth[_0x11da('0x7')](),auth['canUpdate'](),controller[_0x11da('0x10')]);module[_0x11da('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 2ba6e06..a5bd8ae 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 _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 +var _0x3cb3=['length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','callNumber','callerId','entityFound:','user:%s','json','hangup\x20fired:','userId','format','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','filter','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','webbarapi','defaults','redis','socket.io-emitter','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','agent','VoiceChannels','all','rows','UserId','sessionId'];(function(_0x336c2b,_0x3c04cc){var _0x348e81=function(_0x209b2f){while(--_0x209b2f){_0x336c2b['push'](_0x336c2b['shift']());}};_0x348e81(++_0x3c04cc);}(_0x3cb3,0x156));var _0x33cb=function(_0x2b79a4,_0x1d34d7){_0x2b79a4=_0x2b79a4-0x0;var _0x6ba213=_0x3cb3[_0x2b79a4];return _0x6ba213;};'use strict';var path=require(_0x33cb('0x0'));var fs=require('fs');var _=require(_0x33cb('0x1'));var db=require(_0x33cb('0x2'))['db'];var config=require(_0x33cb('0x3'));var util=require(_0x33cb('0x4'));var BPromise=require(_0x33cb('0x5'));var jayson=require(_0x33cb('0x6'));var amiClient=jayson[_0x33cb('0x7')]['http']({'port':0x232a});var logger=require('../../config/logger')(_0x33cb('0x8'));var Redis=require('ioredis');config['redis']=_[_0x33cb('0x9')](config[_0x33cb('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x33cb('0xb'))(new Redis(config['redis']));var Schema=require(_0x33cb('0xc'));var originateValidation=new Schema({'userId':{'type':_0x33cb('0xd'),'required':[!![],_0x33cb('0xe')]},'callNumber':{'type':'string','required':[!![],_0x33cb('0xf')]},'callerId':{'type':_0x33cb('0x10')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x33cb('0xd'),'required':[!![],_0x33cb('0xe')]},'sessionId':{'type':_0x33cb('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x33cb('0xd'),'required':[!![],_0x33cb('0xe')]},'sessionId':{'type':_0x33cb('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x33cb('0xe')]},'sessionId':{'type':_0x33cb('0x10'),'required':[!![],_0x33cb('0x11')]},'transferNumber':{'type':'string','required':[!![],_0x33cb('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x33cb('0xd'),'required':[!![],_0x33cb('0xe')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x33cb('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x33cb('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x33cb('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0xa5ac7d,_0x3020c3,_0x2494a3){logger[_0x33cb('0x13')](_0xa5ac7d,_0x3020c3,JSON[_0x33cb('0x14')](_0x2494a3));io['to'](_0xa5ac7d)[_0x33cb('0x15')](_0x3020c3,_0x2494a3);}function handleError(_0x1018f6){return function(_0x1bdceb){console[_0x33cb('0x16')](_0x33cb('0x17'),_0x1bdceb,_0x1bdceb instanceof RangeError);logger[_0x33cb('0x18')](_0x1bdceb[_0x33cb('0x19')]);if(_0x1bdceb instanceof RangeError){if(_0x1bdceb[_0x33cb('0x1a')]){delete _0x1bdceb[_0x33cb('0x1a')];}_0x1018f6[_0x33cb('0x1b')](0x194)[_0x33cb('0x1c')](_0x1bdceb);}else{if(_0x1bdceb['name']){delete _0x1bdceb[_0x33cb('0x1a')];}_0x1018f6['status'](0x1f4)[_0x33cb('0x1c')](_0x1bdceb);}};}function checkError(){return function(_0x2ef94e){if(!_0x2ef94e){throw new RangeError(_0x33cb('0x1d'));}return _0x2ef94e;};}function respondWithRpcPromise(_0xa7bcd8,_0x2f5f5b){return new BPromise(function(_0x48ef4f,_0x1ceb2f){var _0x5e98f6=amiClient;return _0x5e98f6[_0x33cb('0x1e')](_0xa7bcd8,_0x2f5f5b)[_0x33cb('0x1f')](function(_0x4cd4f3){if(_0x4cd4f3[_0x33cb('0x18')]){if(_0x4cd4f3[_0x33cb('0x18')][_0x33cb('0x20')]===0x1f4){return _0x1ceb2f(_0x4cd4f3[_0x33cb('0x18')][_0x33cb('0x21')]);}return _0x48ef4f(_0x4cd4f3[_0x33cb('0x18')][_0x33cb('0x21')]);}else{_0x48ef4f(_0x4cd4f3[_0x33cb('0x22')]);}})[_0x33cb('0x23')](function(_0x448a94){_0x1ceb2f(_0x448a94);});});}function getAgent(_0x3b83cb){return db[_0x33cb('0x24')]['findOne']({'where':{'id':_0x3b83cb,'role':_0x33cb('0x25')}})['then'](checkError());}function getAgentCheckSession(_0x327ced,_0x423b17){return new BPromise(function(_0x43a186,_0x29a193){var _0x2c0d1e=respondWithRpcPromise(_0x33cb('0x26'));var _0x1dd29d=getAgent(_0x327ced);Promise[_0x33cb('0x27')]([_0x2c0d1e,_0x1dd29d])[_0x33cb('0x1f')](function(_0x7f8dd){var _0x5f5173=_0x7f8dd[0x0];var _0x2dd613=_0x7f8dd[0x1];var _0x4e3d9e=_['filter'](_0x5f5173[_0x33cb('0x28')],function(_0x3b0fe7){return _0x3b0fe7[_0x33cb('0x29')]==_0x2dd613['id']&&_0x3b0fe7[_0x33cb('0x2a')]==_0x423b17;});if(_0x4e3d9e[_0x33cb('0x2b')]==0x1){_0x43a186(_0x2dd613);}else{_0x29a193(new RangeError(_0x33cb('0x2c')+_0x423b17+_0x33cb('0x2d')));}});});}exports[_0x33cb('0x2e')]=function(_0x4bb186,_0x408896){logger[_0x33cb('0x13')](_0x33cb('0x2f'),_0x4bb186[_0x33cb('0x30')]);var _0x4cf4b5=originateValidation[_0x33cb('0xc')](_0x4bb186[_0x33cb('0x30')]);if(_0x4cf4b5['length']>0x0){return _0x408896[_0x33cb('0x1b')](0x190)['json'](_0x4cf4b5);}var _0x725be5=_0x4bb186[_0x33cb('0x30')]['userId'];var _0x156426=_0x4bb186[_0x33cb('0x30')][_0x33cb('0x31')];var _0x2fdebe=_0x4bb186[_0x33cb('0x30')][_0x33cb('0x32')];var _0x2f669e=_0x4bb186[_0x33cb('0x30')]['callbackUrl'];return getAgent(_0x725be5)['then'](function(_0x233ad2){logger[_0x33cb('0x13')](_0x33cb('0x33'),_0x233ad2[_0x33cb('0x1a')]);emit(util['format'](_0x33cb('0x34'),_0x233ad2[_0x33cb('0x1a')]),'webbar:originate',{'callNumber':_0x156426,'callerId':_0x2fdebe,'callbackUrl':_0x2f669e});return _0x408896['status'](0xc8)[_0x33cb('0x35')]({'error':![],'message':'originate\x20executed!'});})[_0x33cb('0x23')](handleError(_0x408896));};exports['hangup']=function(_0x5ca7a4,_0x10a2e8){logger[_0x33cb('0x13')](_0x33cb('0x36'),_0x5ca7a4[_0x33cb('0x30')]);var _0x100a8e=hangupValidation[_0x33cb('0xc')](_0x5ca7a4[_0x33cb('0x30')]);if(_0x100a8e[_0x33cb('0x2b')]>0x0){return _0x10a2e8['status'](0x190)[_0x33cb('0x35')](_0x100a8e);}var _0x17d490=_0x5ca7a4['body']['userId'];var _0x1c8ace=_0x5ca7a4[_0x33cb('0x30')][_0x33cb('0x2a')];return getAgent(_0x17d490)[_0x33cb('0x1f')](function(_0x374500){logger[_0x33cb('0x13')](_0x33cb('0x33'),_0x374500['name']);emit(util['format'](_0x33cb('0x34'),_0x374500['name']),'webbar:hangup',{'sessionId':_0x1c8ace});return _0x10a2e8[_0x33cb('0x1b')](0xc8)[_0x33cb('0x35')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x10a2e8));};exports['answer']=function(_0x27d95e,_0x537e3a){logger[_0x33cb('0x13')]('answer\x20fired:',_0x27d95e[_0x33cb('0x30')]);var _0x2f9e46=answerValidation[_0x33cb('0xc')](_0x27d95e[_0x33cb('0x30')]);if(_0x2f9e46[_0x33cb('0x2b')]>0x0){return _0x537e3a[_0x33cb('0x1b')](0x190)[_0x33cb('0x35')](_0x2f9e46);}var _0x960ec4=_0x27d95e[_0x33cb('0x30')][_0x33cb('0x37')];var _0x235bc4=_0x27d95e['body'][_0x33cb('0x2a')];return getAgent(_0x960ec4)[_0x33cb('0x1f')](function(_0x3e26e1){logger[_0x33cb('0x13')]('entityFound:',_0x3e26e1['name']);emit(util[_0x33cb('0x38')]('user:%s',_0x3e26e1[_0x33cb('0x1a')]),_0x33cb('0x39'),{'sessionId':_0x235bc4});return _0x537e3a[_0x33cb('0x1b')](0xc8)[_0x33cb('0x35')]({'error':![],'message':_0x33cb('0x3a')});})['catch'](handleError(_0x537e3a));};exports[_0x33cb('0x3b')]=function(_0x241dea,_0x432452){logger[_0x33cb('0x13')](_0x33cb('0x3c'),_0x241dea[_0x33cb('0x30')]);var _0x56e80c=holdValidation['validate'](_0x241dea[_0x33cb('0x30')]);if(_0x56e80c[_0x33cb('0x2b')]>0x0){return _0x432452[_0x33cb('0x1b')](0x190)[_0x33cb('0x35')](_0x56e80c);}var _0xb81aac=_0x241dea['body'][_0x33cb('0x37')];var _0x4c45d7=_0x241dea[_0x33cb('0x30')][_0x33cb('0x2a')];return getAgent(_0xb81aac)[_0x33cb('0x1f')](function(_0x5caa09){logger[_0x33cb('0x13')]('entityFound:',_0x5caa09['name']);emit(util[_0x33cb('0x38')]('user:%s',_0x5caa09[_0x33cb('0x1a')]),_0x33cb('0x3d'),{'sessionId':_0x4c45d7});return _0x432452['status'](0xc8)[_0x33cb('0x35')]({'error':![],'message':_0x33cb('0x3e')});})['catch'](handleError(_0x432452));};exports[_0x33cb('0x3f')]=function(_0x532902,_0x2030b5){logger['info'](_0x33cb('0x40'),_0x532902[_0x33cb('0x30')]);var _0x37a022=unholdValidation[_0x33cb('0xc')](_0x532902['body']);if(_0x37a022[_0x33cb('0x2b')]>0x0){return _0x2030b5[_0x33cb('0x1b')](0x190)['json'](_0x37a022);}var _0x1d65c0=_0x532902['body']['userId'];var _0x2fb42d=_0x532902['body'][_0x33cb('0x2a')];return getAgent(_0x1d65c0)[_0x33cb('0x1f')](function(_0x5a6d4b){logger[_0x33cb('0x13')](_0x33cb('0x33'),_0x5a6d4b[_0x33cb('0x1a')]);emit(util['format'](_0x33cb('0x34'),_0x5a6d4b[_0x33cb('0x1a')]),_0x33cb('0x41'),{'sessionId':_0x2fb42d});return _0x2030b5[_0x33cb('0x1b')](0xc8)[_0x33cb('0x35')]({'error':![],'message':_0x33cb('0x42')});})[_0x33cb('0x23')](handleError(_0x2030b5));};exports[_0x33cb('0x43')]=function(_0x1878cf,_0x2cc290){logger[_0x33cb('0x13')](_0x33cb('0x44'),_0x2cc290['body']);var _0x1546b5=callsValidation[_0x33cb('0xc')](_0x1878cf[_0x33cb('0x30')]);if(_0x1546b5[_0x33cb('0x2b')]>0x0){return _0x2cc290[_0x33cb('0x1b')](0x190)[_0x33cb('0x35')](_0x1546b5);}var _0xe330a1=_0x1878cf[_0x33cb('0x30')][_0x33cb('0x37')];var _0x6b5121=respondWithRpcPromise(_0x33cb('0x26'));var _0x2b686a=getAgent(_0xe330a1);return Promise['all']([_0x6b5121,_0x2b686a])[_0x33cb('0x1f')](function(_0x3564c0){var _0x3a6231=_0x3564c0[0x0];var _0x1f718f=_0x3564c0[0x1];var _0x2d9842=_[_0x33cb('0x45')](_0x3a6231['rows'],function(_0x4cca5e){return _0x4cca5e[_0x33cb('0x29')]==_0x1f718f['id'];});return _0x2cc290[_0x33cb('0x1b')](0xc8)[_0x33cb('0x35')]({'count':_0x2d9842[_0x33cb('0x2b')],'rows':_0x2d9842});})['catch'](handleError(_0x2cc290));};exports[_0x33cb('0x46')]=function(_0x4ecb5f,_0x538ce4){logger[_0x33cb('0x13')](_0x33cb('0x47'),_0x4ecb5f[_0x33cb('0x30')]);var _0x568e55=conferenceValidation[_0x33cb('0xc')](_0x4ecb5f['body']);if(_0x568e55[_0x33cb('0x2b')]>0x0){return _0x538ce4[_0x33cb('0x1b')](0x190)[_0x33cb('0x35')](_0x568e55);}var _0x214420=_0x4ecb5f[_0x33cb('0x30')][_0x33cb('0x37')];return getAgent(_0x214420)['then'](function(_0x19032a){logger[_0x33cb('0x13')](_0x33cb('0x33'),_0x19032a[_0x33cb('0x1a')]);emit(util[_0x33cb('0x38')](_0x33cb('0x34'),_0x19032a[_0x33cb('0x1a')]),_0x33cb('0x48'));return _0x538ce4[_0x33cb('0x1b')](0xc8)[_0x33cb('0x35')]({'error':![],'message':'conference\x20executed!'});})[_0x33cb('0x23')](handleError(_0x538ce4));};exports[_0x33cb('0x49')]=function(_0xdfbaca,_0x1cf3f7){logger[_0x33cb('0x13')](_0x33cb('0x4a'),_0xdfbaca['body']);var _0x3c3985=transferValidation['validate'](_0xdfbaca['body']);if(_0x3c3985[_0x33cb('0x2b')]>0x0){return _0x1cf3f7[_0x33cb('0x1b')](0x190)[_0x33cb('0x35')](_0x3c3985);}var _0xadb85a=_0xdfbaca[_0x33cb('0x30')][_0x33cb('0x37')];var _0x2cfa1c=_0xdfbaca[_0x33cb('0x30')][_0x33cb('0x2a')];var _0x2354da=_0xdfbaca[_0x33cb('0x30')]['transferNumber'];return getAgent(_0xadb85a)[_0x33cb('0x1f')](function(_0x465f3e){logger[_0x33cb('0x13')](_0x33cb('0x33'),_0x465f3e[_0x33cb('0x1a')]);emit(util[_0x33cb('0x38')](_0x33cb('0x34'),_0x465f3e[_0x33cb('0x1a')]),_0x33cb('0x4b'),{'sessionId':_0x2cfa1c,'transferNumber':_0x2354da});return _0x1cf3f7[_0x33cb('0x1b')](0xc8)[_0x33cb('0x35')]({'error':![],'message':_0x33cb('0x4c')});})[_0x33cb('0x23')](handleError(_0x1cf3f7));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 4d8b09b..8ff14c7 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 _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 +var _0x4024=['index','get','/describe','describe','isAuthenticated','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents','getApplications','post','create','addDisposition','addAnswer','/:id/users','addAgents','/:id/applications','/:id/notify','notify','/:id/send','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./whatsappAccount.controller'];(function(_0x4f8a7b,_0x4f9ea9){var _0x525fd3=function(_0x101c79){while(--_0x101c79){_0x4f8a7b['push'](_0x4f8a7b['shift']());}};_0x525fd3(++_0x4f9ea9);}(_0x4024,0x89));var _0x4402=function(_0x2a4b8f,_0x4d728b){_0x2a4b8f=_0x2a4b8f-0x0;var _0x42cbb3=_0x4024[_0x2a4b8f];return _0x42cbb3;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var auth=require(_0x4402('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4402('0x5'));var controller=require(_0x4402('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x4402('0x7')]);router[_0x4402('0x8')](_0x4402('0x9'),auth['isAuthenticated'](),controller[_0x4402('0xa')]);router['get']('/:id',auth[_0x4402('0xb')](),controller['show']);router['get'](_0x4402('0xc'),auth['isAuthenticated'](),controller[_0x4402('0xd')]);router['get'](_0x4402('0xe'),auth['isAuthenticated'](),controller[_0x4402('0xf')]);router[_0x4402('0x8')]('/:id/users',auth[_0x4402('0xb')](),controller[_0x4402('0x10')]);router[_0x4402('0x8')]('/:id/applications',auth[_0x4402('0xb')](),controller[_0x4402('0x11')]);router[_0x4402('0x12')]('/',auth[_0x4402('0xb')](),controller[_0x4402('0x13')]);router[_0x4402('0x12')](_0x4402('0xc'),auth[_0x4402('0xb')](),controller[_0x4402('0x14')]);router[_0x4402('0x12')](_0x4402('0xe'),auth[_0x4402('0xb')](),controller[_0x4402('0x15')]);router[_0x4402('0x12')](_0x4402('0x16'),auth[_0x4402('0xb')](),controller[_0x4402('0x17')]);router[_0x4402('0x12')](_0x4402('0x18'),auth[_0x4402('0xb')](),controller['addApplications']);router['post'](_0x4402('0x19'),controller[_0x4402('0x1a')]);router['post'](_0x4402('0x1b'),auth[_0x4402('0xb')](),controller['send']);router[_0x4402('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x4402('0x1d')]);router[_0x4402('0x1e')](_0x4402('0x1f'),auth['isAuthenticated'](),controller[_0x4402('0x20')]);router['delete']('/:id/dispositions',auth[_0x4402('0xb')](),controller[_0x4402('0x21')]);router[_0x4402('0x1e')](_0x4402('0xe'),auth[_0x4402('0xb')](),controller[_0x4402('0x22')]);router[_0x4402('0x1e')](_0x4402('0x16'),auth[_0x4402('0xb')](),controller['removeAgents']);module[_0x4402('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index b6f5753..85bdadb 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 _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 +var _0x5f81=['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','randomstring','exports','STRING','name','generate','ENUM','twilio','TEXT'];(function(_0x32dc49,_0x112ae2){var _0x169742=function(_0x3c53d8){while(--_0x3c53d8){_0x32dc49['push'](_0x32dc49['shift']());}};_0x169742(++_0x112ae2);}(_0x5f81,0xe8));var _0x15f8=function(_0x24080d,_0x510cd2){_0x24080d=_0x24080d-0x0;var _0x23ab68=_0x5f81[_0x24080d];return _0x23ab68;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x15f8('0x0'));module[_0x15f8('0x1')]={'name':{'type':Sequelize[_0x15f8('0x2')],'unique':_0x15f8('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x15f8('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x15f8('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x15f8('0x2')],'defaultValue':function(){return rs[_0x15f8('0x4')]();}},'phone':{'type':Sequelize[_0x15f8('0x2')]},'type':{'type':Sequelize[_0x15f8('0x5')](_0x15f8('0x6'))},'accountSid':{'type':Sequelize[_0x15f8('0x2')]},'authToken':{'type':Sequelize[_0x15f8('0x2')]},'notificationTemplate':{'type':Sequelize[_0x15f8('0x7')],'defaultValue':function(){return _0x15f8('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x15f8('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x15f8('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x15f8('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x15f8('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x15f8('0xc'),'set':function(_0x3ca1d6){if(!_0x3ca1d6){this[_0x15f8('0xd')](_0x15f8('0xe'),null);}this[_0x15f8('0xd')](_0x15f8('0xf'),_0x3ca1d6);}},'description':{'type':Sequelize[_0x15f8('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index a32eaab..87a6dc8 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 _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 +var _0x0a4f=['Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','whatsapp:','messageId','isNil','ValidationError','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','defaults','contact','WhatsappInteraction','interaction','created','push','close','unmanaged','ContactId','UserId','unshift','Start','startRouting','receiveMessage','entity\x20found','text/xml','send','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','WhatsappMessage','Messages','dataValues','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','get','UserProfileResource','destroy','stack','name','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','show','params','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','userProfileId','autoAssociation','describe','addDisposition','Disposition','getDispositions','WhatsappAccountId','count','rows','removeDispositions','ids','CannedAnswer','getAnswers','findOne','include','removeAnswers','addAgents','spread','emit','removeAgents','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','WhatsappApplication','priority','getApplications','notify','whatsapp','account','applications'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0a4f,0x19b));var _0xf0a4=function(_0x3f62a7,_0xcd2468){_0x3f62a7=_0x3f62a7-0x0;var _0x5ceab2=_0x0a4f[_0x3f62a7];return _0x5ceab2;};'use strict';var pdf=require(_0xf0a4('0x0'));var emlformat=require(_0xf0a4('0x1'));var rimraf=require(_0xf0a4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf0a4('0x3'));var rp=require(_0xf0a4('0x4'));var moment=require(_0xf0a4('0x5'));var BPromise=require(_0xf0a4('0x6'));var Mustache=require(_0xf0a4('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf0a4('0x8'));var csv=require('to-csv');var ejs=require(_0xf0a4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf0a4('0xa'));var crypto=require(_0xf0a4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf0a4('0xc'));var toCsv=require(_0xf0a4('0xd'));var querystring=require(_0xf0a4('0xe'));var Papa=require(_0xf0a4('0xf'));var Redis=require(_0xf0a4('0x10'));var authService=require(_0xf0a4('0x11'));var qs=require(_0xf0a4('0x12'));var as=require(_0xf0a4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0a4('0x14'))(_0xf0a4('0x15'));var utils=require(_0xf0a4('0x16'));var config=require(_0xf0a4('0x17'));var licenseUtil=require(_0xf0a4('0x18'));var db=require(_0xf0a4('0x19'))['db'];config[_0xf0a4('0x1a')]=_['defaults'](config[_0xf0a4('0x1a')],{'host':_0xf0a4('0x1b'),'port':0x18eb});var socket=require(_0xf0a4('0x1c'))(new Redis(config[_0xf0a4('0x1a')]));require(_0xf0a4('0x1d'))[_0xf0a4('0x1e')](socket);var jayson=require(_0xf0a4('0x1f'));var client=jayson[_0xf0a4('0x20')][_0xf0a4('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x5b4e9e,_0x288fcf,_0xbf533f,_0x13ab11){return new BPromise(function(_0x310ea5,_0x2bb28e){var _0x54e390=_0x13ab11||client;return _0x54e390[_0xf0a4('0x22')](_0x5b4e9e,_0xbf533f)[_0xf0a4('0x23')](function(_0x344756){logger['info'](_0xf0a4('0x24'),_0x288fcf,_0xf0a4('0x25'));logger[_0xf0a4('0x26')](_0xf0a4('0x27'),_0x288fcf,_0xf0a4('0x25'),JSON[_0xf0a4('0x28')](_0x344756));if(_0x344756[_0xf0a4('0x29')]){if(_0x344756[_0xf0a4('0x29')][_0xf0a4('0x2a')]===0x1f4){logger['error'](_0xf0a4('0x24'),_0x288fcf,_0x344756[_0xf0a4('0x29')][_0xf0a4('0x2b')]);return _0x2bb28e(_0x344756[_0xf0a4('0x29')][_0xf0a4('0x2b')]);}logger[_0xf0a4('0x29')](_0xf0a4('0x24'),_0x288fcf,_0x344756[_0xf0a4('0x29')][_0xf0a4('0x2b')]);return _0x310ea5(_0x344756[_0xf0a4('0x29')][_0xf0a4('0x2b')]);}else{logger[_0xf0a4('0x2c')]('WhatsappAccount,\x20%s,\x20%s',_0x288fcf,_0xf0a4('0x25'));_0x310ea5(_0x344756[_0xf0a4('0x2d')]['message']);}})[_0xf0a4('0x2e')](function(_0xdf0420){logger[_0xf0a4('0x29')](_0xf0a4('0x24'),_0x288fcf,_0xdf0420);_0x2bb28e(_0xdf0420);});});}function respondWithStatusCode(_0x14bf8e,_0x4ef837){_0x4ef837=_0x4ef837||0xcc;return function(_0x1c723f){if(_0x1c723f){return _0x14bf8e[_0xf0a4('0x2f')](_0x4ef837);}return _0x14bf8e[_0xf0a4('0x30')](_0x4ef837)[_0xf0a4('0x31')]();};}function respondWithResult(_0x4f7fe5,_0x2186c9){_0x2186c9=_0x2186c9||0xc8;return function(_0x59d294){if(_0x59d294){return _0x4f7fe5[_0xf0a4('0x30')](_0x2186c9)[_0xf0a4('0x32')](_0x59d294);}};}function respondWithFilteredResult(_0x13da73,_0x4e9667){return function(_0x44fe34){if(_0x44fe34){var _0x3d55a2=_0x44fe34['count'],_0x8a2d60=_0x4e9667[_0xf0a4('0x33')],_0x3c6ba6=_0x4e9667['offset']+_0x4e9667[_0xf0a4('0x34')],_0x203ede;if(_0x3c6ba6>=_0x3d55a2){_0x3c6ba6=_0x3d55a2;_0x203ede=0xc8;}else{_0x203ede=0xce;}_0x13da73[_0xf0a4('0x30')](_0x203ede);return _0x13da73[_0xf0a4('0x35')]('Content-Range',_0x8a2d60+'-'+_0x3c6ba6+'/'+_0x3d55a2)[_0xf0a4('0x32')](_0x44fe34);}return null;};}function patchUpdates(_0x583a83){return function(_0x598581){try{jsonpatch[_0xf0a4('0x36')](_0x598581,_0x583a83,!![]);}catch(_0x32a068){return BPromise[_0xf0a4('0x37')](_0x32a068);}return _0x598581[_0xf0a4('0x38')]();};}function saveUpdates(_0x3149c6,_0x1e0c67){return function(_0x33db9a){if(_0x33db9a){return _0x33db9a[_0xf0a4('0x39')](_0x3149c6)[_0xf0a4('0x23')](function(_0x3d1d31){return _0x3d1d31;});}return null;};}function removeEntity(_0x795ec3,_0x25964e){return function(_0x349aeb){if(_0x349aeb){return _0x349aeb['destroy']()[_0xf0a4('0x23')](function(){var _0x4c4886=_0x349aeb[_0xf0a4('0x3a')]({'plain':!![]});var _0x3e6bd6='WhatsappAccounts';return db[_0xf0a4('0x3b')][_0xf0a4('0x3c')]({'where':{'type':_0x3e6bd6,'resourceId':_0x4c4886['id']}})[_0xf0a4('0x23')](function(){return _0x349aeb;});})[_0xf0a4('0x23')](function(){_0x795ec3[_0xf0a4('0x30')](0xcc)[_0xf0a4('0x31')]();});}};}function handleEntityNotFound(_0xbb1e8c,_0x1b1228){return function(_0x570c3b){if(!_0x570c3b){_0xbb1e8c['sendStatus'](0x194);}return _0x570c3b;};}function handleError(_0x45ab13,_0x2a639a){_0x2a639a=_0x2a639a||0x1f4;return function(_0x13176c){logger['error'](_0x13176c[_0xf0a4('0x3d')]);if(_0x13176c[_0xf0a4('0x3e')]){delete _0x13176c['name'];}_0x45ab13[_0xf0a4('0x30')](_0x2a639a)['send'](_0x13176c);};}exports[_0xf0a4('0x3f')]=function(_0xb1ed65,_0x328472){var _0x4705c2={'include':[{'model':db['Pause'],'as':_0xf0a4('0x40')}]},_0x1b1ab7={},_0x59b1e1={'count':0x0,'rows':[]};var _0x2047de=_[_0xf0a4('0x41')](db[_0xf0a4('0x42')][_0xf0a4('0x43')],function(_0x43ab04){return{'name':_0x43ab04[_0xf0a4('0x44')],'type':_0x43ab04[_0xf0a4('0x45')]['key']};});_0x1b1ab7[_0xf0a4('0x46')]=_['map'](_0x2047de,_0xf0a4('0x3e'));_0x1b1ab7['query']=_[_0xf0a4('0x47')](_0xb1ed65[_0xf0a4('0x48')]);_0x1b1ab7[_0xf0a4('0x49')]=_['intersection'](_0x1b1ab7[_0xf0a4('0x46')],_0x1b1ab7['query']);_0x4705c2[_0xf0a4('0x4a')]=_[_0xf0a4('0x4b')](_0x1b1ab7[_0xf0a4('0x46')],qs[_0xf0a4('0x4c')](_0xb1ed65['query'][_0xf0a4('0x4c')]));_0x4705c2['attributes']=_0x4705c2[_0xf0a4('0x4a')][_0xf0a4('0x4d')]?_0x4705c2[_0xf0a4('0x4a')]:_0x1b1ab7['model'];if(!_0xb1ed65[_0xf0a4('0x48')][_0xf0a4('0x4e')](_0xf0a4('0x4f'))){_0x4705c2[_0xf0a4('0x34')]=qs[_0xf0a4('0x34')](_0xb1ed65['query'][_0xf0a4('0x34')]);_0x4705c2[_0xf0a4('0x33')]=qs[_0xf0a4('0x33')](_0xb1ed65['query'][_0xf0a4('0x33')]);}_0x4705c2[_0xf0a4('0x50')]=qs[_0xf0a4('0x51')](_0xb1ed65[_0xf0a4('0x48')][_0xf0a4('0x51')]);_0x4705c2[_0xf0a4('0x52')]=qs['filters'](_[_0xf0a4('0x53')](_0xb1ed65['query'],_0x1b1ab7[_0xf0a4('0x49')]),_0x2047de);if(_0xb1ed65[_0xf0a4('0x48')][_0xf0a4('0x54')]){_0x4705c2['where']=_['merge'](_0x4705c2['where'],{'$or':_[_0xf0a4('0x41')](_0x2047de,function(_0x416d59){if(_0x416d59['type']!=='VIRTUAL'){var _0x3a3b57={};_0x3a3b57[_0x416d59[_0xf0a4('0x3e')]]={'$like':'%'+_0xb1ed65[_0xf0a4('0x48')][_0xf0a4('0x54')]+'%'};return _0x3a3b57;}})});}_0x4705c2=_[_0xf0a4('0x55')]({},_0x4705c2,_0xb1ed65[_0xf0a4('0x56')]);var _0x17ca54={'where':_0x4705c2[_0xf0a4('0x52')]};return db[_0xf0a4('0x42')]['count'](_0x17ca54)[_0xf0a4('0x23')](function(_0x106025){_0x59b1e1['count']=_0x106025;if(_0xb1ed65['query'][_0xf0a4('0x57')]){_0x4705c2['include']=[{'all':!![]}];}return db[_0xf0a4('0x42')][_0xf0a4('0x58')](_0x4705c2);})[_0xf0a4('0x23')](function(_0xf7a710){_0x59b1e1['rows']=_0xf7a710;return _0x59b1e1;})[_0xf0a4('0x23')](respondWithFilteredResult(_0x328472,_0x4705c2))['catch'](handleError(_0x328472,null));};exports[_0xf0a4('0x59')]=function(_0x36022d,_0x46f40a){var _0x1dc88a={'raw':![],'where':{'id':_0x36022d[_0xf0a4('0x5a')]['id']},'include':[{'model':db[_0xf0a4('0x5b')],'as':_0xf0a4('0x40')}]},_0x4f1ac1={};_0x4f1ac1[_0xf0a4('0x46')]=_[_0xf0a4('0x47')](db[_0xf0a4('0x42')][_0xf0a4('0x43')]);_0x4f1ac1[_0xf0a4('0x48')]=_[_0xf0a4('0x47')](_0x36022d[_0xf0a4('0x48')]);_0x4f1ac1['filters']=_[_0xf0a4('0x4b')](_0x4f1ac1[_0xf0a4('0x46')],_0x4f1ac1[_0xf0a4('0x48')]);_0x1dc88a[_0xf0a4('0x4a')]=_[_0xf0a4('0x4b')](_0x4f1ac1[_0xf0a4('0x46')],qs[_0xf0a4('0x4c')](_0x36022d[_0xf0a4('0x48')][_0xf0a4('0x4c')]));_0x1dc88a[_0xf0a4('0x4a')]=_0x1dc88a[_0xf0a4('0x4a')]['length']?_0x1dc88a[_0xf0a4('0x4a')]:_0x4f1ac1['model'];if(_0x36022d['query'][_0xf0a4('0x57')]){_0x1dc88a['include']=[{'all':!![]}];}_0x1dc88a=_[_0xf0a4('0x55')]({},_0x1dc88a,_0x36022d[_0xf0a4('0x56')]);return db['WhatsappAccount'][_0xf0a4('0x5c')](_0x1dc88a)[_0xf0a4('0x23')](handleEntityNotFound(_0x46f40a,null))[_0xf0a4('0x23')](respondWithResult(_0x46f40a,null))['catch'](handleError(_0x46f40a,null));};exports[_0xf0a4('0x5d')]=function(_0x4713d1,_0x8e9838){return db[_0xf0a4('0x42')][_0xf0a4('0x5d')](_0x4713d1[_0xf0a4('0x5e')],{})[_0xf0a4('0x23')](function(_0x2a7b4e){var _0x2eb06d=_0x4713d1[_0xf0a4('0x5f')][_0xf0a4('0x3a')]({'plain':!![]});if(!_0x2eb06d)throw new Error(_0xf0a4('0x60'));if(_0x2eb06d[_0xf0a4('0x61')]===_0xf0a4('0x5f')){var _0x20a054=_0x2a7b4e['get']({'plain':!![]});var _0xcf6eb5=_0xf0a4('0x62');return db['UserProfileSection']['find']({'where':{'name':_0xcf6eb5,'userProfileId':_0x2eb06d[_0xf0a4('0x63')]},'raw':!![]})[_0xf0a4('0x23')](function(_0x1ec5d6){if(_0x1ec5d6&&_0x1ec5d6[_0xf0a4('0x64')]===0x0){return db[_0xf0a4('0x3b')][_0xf0a4('0x5d')]({'name':_0x20a054[_0xf0a4('0x3e')],'resourceId':_0x20a054['id'],'type':_0x1ec5d6[_0xf0a4('0x3e')],'sectionId':_0x1ec5d6['id']},{})[_0xf0a4('0x23')](function(){return _0x2a7b4e;});}else{return _0x2a7b4e;}})[_0xf0a4('0x2e')](function(_0x42ea59){logger[_0xf0a4('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42ea59);throw _0x42ea59;});}return _0x2a7b4e;})['then'](respondWithResult(_0x8e9838,0xc9))[_0xf0a4('0x2e')](handleError(_0x8e9838,null));};exports['update']=function(_0x20c648,_0x2e64d0){if(_0x20c648[_0xf0a4('0x5e')]['id']){delete _0x20c648['body']['id'];}return db['WhatsappAccount'][_0xf0a4('0x5c')]({'where':{'id':_0x20c648['params']['id']},'include':[{'model':db['Pause'],'as':_0xf0a4('0x40')}]})['then'](handleEntityNotFound(_0x2e64d0,null))[_0xf0a4('0x23')](saveUpdates(_0x20c648[_0xf0a4('0x5e')],null))['then'](respondWithResult(_0x2e64d0,null))['catch'](handleError(_0x2e64d0,null));};exports[_0xf0a4('0x3c')]=function(_0x421ec0,_0x457794){return db[_0xf0a4('0x42')][_0xf0a4('0x5c')]({'where':{'id':_0x421ec0[_0xf0a4('0x5a')]['id']}})[_0xf0a4('0x23')](handleEntityNotFound(_0x457794,null))[_0xf0a4('0x23')](removeEntity(_0x457794,null))[_0xf0a4('0x2e')](handleError(_0x457794,null));};exports[_0xf0a4('0x65')]=function(_0x9f8cd4,_0x3d75b6){return db[_0xf0a4('0x42')][_0xf0a4('0x65')]()[_0xf0a4('0x23')](respondWithResult(_0x3d75b6,null))[_0xf0a4('0x2e')](handleError(_0x3d75b6,null));};exports[_0xf0a4('0x66')]=function(_0x54440c,_0x57fca8,_0x5100a9){if(_0x54440c['body']['id']){delete _0x54440c[_0xf0a4('0x5e')]['id'];}return db[_0xf0a4('0x42')]['find']({'where':{'id':_0x54440c[_0xf0a4('0x5a')]['id']}})[_0xf0a4('0x23')](handleEntityNotFound(_0x57fca8,null))[_0xf0a4('0x23')](function(_0x29427e){if(_0x29427e){_0x54440c[_0xf0a4('0x5e')]['WhatsappAccountId']=_0x29427e['id'];return db[_0xf0a4('0x67')][_0xf0a4('0x5d')](_0x54440c[_0xf0a4('0x5e')]);}})[_0xf0a4('0x23')](respondWithResult(_0x57fca8,null))[_0xf0a4('0x2e')](handleError(_0x57fca8,null));};exports[_0xf0a4('0x68')]=function(_0x104c1b,_0x443221,_0x230f79){var _0x213906={'raw':![],'where':{}};var _0x249d6e={};var _0x2d092f={'count':0x0,'rows':[]};return db[_0xf0a4('0x42')]['findOne']({'where':{'id':_0x104c1b[_0xf0a4('0x5a')]['id']}})[_0xf0a4('0x23')](handleEntityNotFound(_0x443221,null))[_0xf0a4('0x23')](function(_0x13d448){if(_0x13d448){_0x249d6e['model']=_[_0xf0a4('0x47')](db['Disposition'][_0xf0a4('0x43')]);_0x249d6e[_0xf0a4('0x48')]=_['keys'](_0x104c1b[_0xf0a4('0x48')]);_0x249d6e[_0xf0a4('0x49')]=_['intersection'](_0x249d6e[_0xf0a4('0x46')],_0x249d6e[_0xf0a4('0x48')]);_0x213906['attributes']=_[_0xf0a4('0x4b')](_0x249d6e[_0xf0a4('0x46')],qs[_0xf0a4('0x4c')](_0x104c1b['query'][_0xf0a4('0x4c')]));_0x213906[_0xf0a4('0x4a')]=_0x213906[_0xf0a4('0x4a')][_0xf0a4('0x4d')]?_0x213906['attributes']:_0x249d6e['model'];if(!_0x104c1b[_0xf0a4('0x48')]['hasOwnProperty'](_0xf0a4('0x4f'))){_0x213906['limit']=qs[_0xf0a4('0x34')](_0x104c1b[_0xf0a4('0x48')][_0xf0a4('0x34')]);_0x213906[_0xf0a4('0x33')]=qs[_0xf0a4('0x33')](_0x104c1b['query'][_0xf0a4('0x33')]);}_0x213906['order']=qs[_0xf0a4('0x51')](_0x104c1b[_0xf0a4('0x48')]['sort']);_0x213906[_0xf0a4('0x52')]=qs['filters'](_['pick'](_0x104c1b[_0xf0a4('0x48')],_0x249d6e[_0xf0a4('0x49')]));_0x213906[_0xf0a4('0x52')][_0xf0a4('0x69')]=_0x13d448['id'];if(_0x104c1b['query'][_0xf0a4('0x54')]){_0x213906[_0xf0a4('0x52')]=_[_0xf0a4('0x55')](_0x213906[_0xf0a4('0x52')],{'$or':_[_0xf0a4('0x41')](_0x213906['attributes'],function(_0x559ee2){var _0x2fa086={};_0x2fa086[_0x559ee2]={'$like':'%'+_0x104c1b['query'][_0xf0a4('0x54')]+'%'};return _0x2fa086;})});}_0x213906=_['merge']({},_0x213906,_0x104c1b['options']);return db[_0xf0a4('0x67')][_0xf0a4('0x6a')]({'where':_0x213906[_0xf0a4('0x52')]})[_0xf0a4('0x23')](function(_0x2dcf61){_0x2d092f['count']=_0x2dcf61;if(_0x104c1b['query']['includeAll']){_0x213906['include']=[{'all':!![]}];}return db[_0xf0a4('0x67')][_0xf0a4('0x58')](_0x213906);})[_0xf0a4('0x23')](function(_0x1751bc){_0x2d092f[_0xf0a4('0x6b')]=_0x1751bc;return _0x2d092f;});}})[_0xf0a4('0x23')](respondWithFilteredResult(_0x443221,_0x213906))[_0xf0a4('0x2e')](handleError(_0x443221,null));};exports[_0xf0a4('0x6c')]=function(_0x90e0cb,_0x480143,_0x15667e){return db['WhatsappAccount'][_0xf0a4('0x5c')]({'where':{'id':_0x90e0cb[_0xf0a4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x480143,null))['then'](function(_0x1b2552){if(_0x1b2552){return _0x1b2552[_0xf0a4('0x6c')](_0x90e0cb[_0xf0a4('0x48')][_0xf0a4('0x6d')]);}})[_0xf0a4('0x23')](respondWithStatusCode(_0x480143,null))['catch'](handleError(_0x480143,null));};exports['addAnswer']=function(_0xe07c77,_0x2e1f19,_0x153428){if(_0xe07c77['body']['id']){delete _0xe07c77['body']['id'];}return db[_0xf0a4('0x42')][_0xf0a4('0x5c')]({'where':{'id':_0xe07c77[_0xf0a4('0x5a')]['id']}})[_0xf0a4('0x23')](handleEntityNotFound(_0x2e1f19,null))[_0xf0a4('0x23')](function(_0x4d108c){if(_0x4d108c){_0xe07c77[_0xf0a4('0x5e')][_0xf0a4('0x69')]=_0x4d108c['id'];return db[_0xf0a4('0x6e')][_0xf0a4('0x5d')](_0xe07c77[_0xf0a4('0x5e')]);}})[_0xf0a4('0x23')](respondWithResult(_0x2e1f19,null))['catch'](handleError(_0x2e1f19,null));};exports[_0xf0a4('0x6f')]=function(_0x1488bd,_0x3ba751,_0x39c86c){var _0x457812={'raw':![],'where':{}};var _0x4f7f72={};var _0x30c2b4={'count':0x0,'rows':[]};return db[_0xf0a4('0x42')][_0xf0a4('0x70')]({'where':{'id':_0x1488bd[_0xf0a4('0x5a')]['id']}})[_0xf0a4('0x23')](handleEntityNotFound(_0x3ba751,null))[_0xf0a4('0x23')](function(_0x44b4b4){if(_0x44b4b4){_0x4f7f72[_0xf0a4('0x46')]=_[_0xf0a4('0x47')](db[_0xf0a4('0x6e')]['rawAttributes']);_0x4f7f72[_0xf0a4('0x48')]=_[_0xf0a4('0x47')](_0x1488bd[_0xf0a4('0x48')]);_0x4f7f72[_0xf0a4('0x49')]=_['intersection'](_0x4f7f72[_0xf0a4('0x46')],_0x4f7f72[_0xf0a4('0x48')]);_0x457812['attributes']=_[_0xf0a4('0x4b')](_0x4f7f72['model'],qs[_0xf0a4('0x4c')](_0x1488bd[_0xf0a4('0x48')][_0xf0a4('0x4c')]));_0x457812[_0xf0a4('0x4a')]=_0x457812['attributes'][_0xf0a4('0x4d')]?_0x457812[_0xf0a4('0x4a')]:_0x4f7f72['model'];if(!_0x1488bd['query'][_0xf0a4('0x4e')](_0xf0a4('0x4f'))){_0x457812['limit']=qs[_0xf0a4('0x34')](_0x1488bd[_0xf0a4('0x48')][_0xf0a4('0x34')]);_0x457812[_0xf0a4('0x33')]=qs['offset'](_0x1488bd[_0xf0a4('0x48')]['offset']);}_0x457812[_0xf0a4('0x50')]=qs[_0xf0a4('0x51')](_0x1488bd['query']['sort']);_0x457812[_0xf0a4('0x52')]=qs[_0xf0a4('0x49')](_['pick'](_0x1488bd['query'],_0x4f7f72['filters']));_0x457812[_0xf0a4('0x52')]['WhatsappAccountId']=_0x44b4b4['id'];if(_0x1488bd[_0xf0a4('0x48')][_0xf0a4('0x54')]){_0x457812[_0xf0a4('0x52')]=_[_0xf0a4('0x55')](_0x457812[_0xf0a4('0x52')],{'$or':_['map'](_0x457812[_0xf0a4('0x4a')],function(_0x57c050){var _0x50388e={};_0x50388e[_0x57c050]={'$like':'%'+_0x1488bd[_0xf0a4('0x48')][_0xf0a4('0x54')]+'%'};return _0x50388e;})});}_0x457812=_['merge']({},_0x457812,_0x1488bd[_0xf0a4('0x56')]);return db[_0xf0a4('0x6e')][_0xf0a4('0x6a')]({'where':_0x457812['where']})[_0xf0a4('0x23')](function(_0x3ec2fe){_0x30c2b4[_0xf0a4('0x6a')]=_0x3ec2fe;if(_0x1488bd[_0xf0a4('0x48')]['includeAll']){_0x457812[_0xf0a4('0x71')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf0a4('0x58')](_0x457812);})[_0xf0a4('0x23')](function(_0x1044cd){_0x30c2b4[_0xf0a4('0x6b')]=_0x1044cd;return _0x30c2b4;});}})[_0xf0a4('0x23')](respondWithFilteredResult(_0x3ba751,_0x457812))[_0xf0a4('0x2e')](handleError(_0x3ba751,null));};exports[_0xf0a4('0x72')]=function(_0x15db09,_0x5497ae,_0x116866){return db[_0xf0a4('0x42')][_0xf0a4('0x5c')]({'where':{'id':_0x15db09[_0xf0a4('0x5a')]['id']}})[_0xf0a4('0x23')](handleEntityNotFound(_0x5497ae,null))[_0xf0a4('0x23')](function(_0x17a8e3){if(_0x17a8e3){return _0x17a8e3[_0xf0a4('0x72')](_0x15db09[_0xf0a4('0x48')][_0xf0a4('0x6d')]);}})[_0xf0a4('0x23')](respondWithStatusCode(_0x5497ae,null))['catch'](handleError(_0x5497ae,null));};exports['addAgents']=function(_0x4440ac,_0x2d8fc4,_0x33b70b){return db['WhatsappAccount'][_0xf0a4('0x5c')]({'where':{'id':_0x4440ac[_0xf0a4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2d8fc4,null))['then'](function(_0x36f8d5){if(_0x36f8d5){return _0x36f8d5[_0xf0a4('0x73')](_0x4440ac[_0xf0a4('0x5e')][_0xf0a4('0x6d')],_['omit'](_0x4440ac['body'],[_0xf0a4('0x6d'),'id'])||{})[_0xf0a4('0x74')](function(_0x2969fc){for(var _0x209104=0x0;_0x209104<_0x4440ac['body']['ids'][_0xf0a4('0x4d')];_0x209104+=0x1){socket[_0xf0a4('0x75')]('userWhatsappAccount:save',{'UserId':_0x4440ac['body']['ids'][_0x209104],'WhatsappAccountId':_0x4440ac['params']['id']});}return _0x2969fc;});}})[_0xf0a4('0x23')](respondWithResult(_0x2d8fc4,null))['catch'](handleError(_0x2d8fc4,null));};exports['removeAgents']=function(_0x8325e4,_0x298358,_0x2600d9){return db[_0xf0a4('0x42')][_0xf0a4('0x5c')]({'where':{'id':_0x8325e4[_0xf0a4('0x5a')]['id']}})[_0xf0a4('0x23')](handleEntityNotFound(_0x298358,null))['then'](function(_0x402df2){if(_0x402df2){return _0x402df2[_0xf0a4('0x76')](_0x8325e4[_0xf0a4('0x48')][_0xf0a4('0x6d')])[_0xf0a4('0x23')](function(){if(_['isArray'](_0x8325e4[_0xf0a4('0x48')][_0xf0a4('0x6d')])){for(var _0x5f58de=0x0;_0x5f58de<_0x8325e4[_0xf0a4('0x48')][_0xf0a4('0x6d')][_0xf0a4('0x4d')];_0x5f58de+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x8325e4[_0xf0a4('0x48')][_0xf0a4('0x6d')][_0x5f58de]),'WhatsappAccountId':Number(_0x8325e4['params']['id'])});}}else{socket['emit'](_0xf0a4('0x77'),{'UserId':Number(_0x8325e4['query'][_0xf0a4('0x6d')]),'WhatsappAccountId':Number(_0x8325e4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x298358,null))[_0xf0a4('0x2e')](handleError(_0x298358,null));};exports['getAgents']=function(_0xcbef60,_0x1dd760,_0x4e982f){var _0x4700ec={};var _0xd8c1ae={};var _0x1c1526;var _0x40663c;return db[_0xf0a4('0x42')][_0xf0a4('0x70')]({'where':{'id':_0xcbef60['params']['id']}})[_0xf0a4('0x23')](handleEntityNotFound(_0x1dd760,null))[_0xf0a4('0x23')](function(_0x890a54){if(_0x890a54){_0x1c1526=_0x890a54;_0xd8c1ae[_0xf0a4('0x46')]=_[_0xf0a4('0x47')](db[_0xf0a4('0x78')][_0xf0a4('0x43')]);_0xd8c1ae[_0xf0a4('0x48')]=_[_0xf0a4('0x47')](_0xcbef60[_0xf0a4('0x48')]);_0xd8c1ae[_0xf0a4('0x49')]=_[_0xf0a4('0x4b')](_0xd8c1ae[_0xf0a4('0x46')],_0xd8c1ae[_0xf0a4('0x48')]);_0x4700ec[_0xf0a4('0x4a')]=_[_0xf0a4('0x4b')](_0xd8c1ae[_0xf0a4('0x46')],qs['fields'](_0xcbef60['query']['fields']));_0x4700ec['attributes']=_0x4700ec[_0xf0a4('0x4a')][_0xf0a4('0x4d')]?_0x4700ec[_0xf0a4('0x4a')]:_0xd8c1ae[_0xf0a4('0x46')];_0x4700ec[_0xf0a4('0x50')]=qs[_0xf0a4('0x51')](_0xcbef60[_0xf0a4('0x48')]['sort']);_0x4700ec[_0xf0a4('0x52')]=qs[_0xf0a4('0x49')](_[_0xf0a4('0x53')](_0xcbef60['query'],_0xd8c1ae[_0xf0a4('0x49')]));if(_0xcbef60[_0xf0a4('0x48')][_0xf0a4('0x54')]){_0x4700ec[_0xf0a4('0x52')]=_[_0xf0a4('0x55')](_0x4700ec[_0xf0a4('0x52')],{'$or':_[_0xf0a4('0x41')](_0x4700ec[_0xf0a4('0x4a')],function(_0x18b95d){var _0x158b5f={};_0x158b5f[_0x18b95d]={'$like':'%'+_0xcbef60[_0xf0a4('0x48')][_0xf0a4('0x54')]+'%'};return _0x158b5f;})});}_0x4700ec=_['merge']({},_0x4700ec,_0xcbef60[_0xf0a4('0x56')]);return _0x1c1526[_0xf0a4('0x79')](_0x4700ec);}})['then'](function(_0x22dc77){if(_0x22dc77){_0x40663c=_0x22dc77[_0xf0a4('0x4d')];if(!_0xcbef60[_0xf0a4('0x48')][_0xf0a4('0x4e')](_0xf0a4('0x4f'))){_0x4700ec[_0xf0a4('0x34')]=qs[_0xf0a4('0x34')](_0xcbef60['query'][_0xf0a4('0x34')]);_0x4700ec[_0xf0a4('0x33')]=qs[_0xf0a4('0x33')](_0xcbef60[_0xf0a4('0x48')][_0xf0a4('0x33')]);}return _0x1c1526['getAgents'](_0x4700ec);}})[_0xf0a4('0x23')](function(_0x3f624a){if(_0x3f624a){return _0x3f624a?{'count':_0x40663c,'rows':_0x3f624a}:null;}})[_0xf0a4('0x23')](respondWithResult(_0x1dd760,null))[_0xf0a4('0x2e')](handleError(_0x1dd760,null));};exports[_0xf0a4('0x7a')]=function(_0x43ceb4,_0xbf03b3,_0x309102){return db[_0xf0a4('0x42')]['findOne']({'where':{'id':_0x43ceb4[_0xf0a4('0x5a')]['id']}})[_0xf0a4('0x23')](handleEntityNotFound(_0xbf03b3,null))['then'](function(_0x16c82d){if(_0x16c82d){return db[_0xf0a4('0x7b')][_0xf0a4('0x7c')](function(_0x3d3420){return db[_0xf0a4('0x7d')][_0xf0a4('0x3c')]({'where':{'WhatsappAccountId':_0x43ceb4[_0xf0a4('0x5a')]['id']},'transaction':_0x3d3420})[_0xf0a4('0x23')](function(_0x3b1594){var _0x4ef8fc=_[_0xf0a4('0x41')](_0x43ceb4[_0xf0a4('0x5e')],function(_0x3b91d8){_0x3b91d8[_0xf0a4('0x69')]=_0x43ceb4[_0xf0a4('0x5a')]['id'];return _0x3b91d8;});return db['WhatsappApplication']['bulkCreate'](_0x4ef8fc,{'transaction':_0x3d3420});});})[_0xf0a4('0x23')](function(){return db[_0xf0a4('0x7d')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x43ceb4[_0xf0a4('0x5a')]['id']},'order':_0xf0a4('0x7e')});});}})[_0xf0a4('0x23')](respondWithResult(_0xbf03b3,null))[_0xf0a4('0x2e')](handleError(_0xbf03b3,null));};exports[_0xf0a4('0x7f')]=function(_0x4d9a27,_0x3960fd,_0x59b7b4){var _0x30a74a={};var _0x303e50={};var _0x126384;var _0x5787b4;return db['WhatsappAccount'][_0xf0a4('0x70')]({'where':{'id':_0x4d9a27['params']['id']}})[_0xf0a4('0x23')](handleEntityNotFound(_0x3960fd,null))[_0xf0a4('0x23')](function(_0x399313){if(_0x399313){_0x126384=_0x399313;_0x303e50[_0xf0a4('0x46')]=_[_0xf0a4('0x47')](db[_0xf0a4('0x7d')][_0xf0a4('0x43')]);_0x303e50[_0xf0a4('0x48')]=_[_0xf0a4('0x47')](_0x4d9a27[_0xf0a4('0x48')]);_0x303e50[_0xf0a4('0x49')]=_[_0xf0a4('0x4b')](_0x303e50['model'],_0x303e50[_0xf0a4('0x48')]);_0x30a74a[_0xf0a4('0x4a')]=_[_0xf0a4('0x4b')](_0x303e50[_0xf0a4('0x46')],qs[_0xf0a4('0x4c')](_0x4d9a27[_0xf0a4('0x48')][_0xf0a4('0x4c')]));_0x30a74a['attributes']=_0x30a74a[_0xf0a4('0x4a')][_0xf0a4('0x4d')]?_0x30a74a[_0xf0a4('0x4a')]:_0x303e50[_0xf0a4('0x46')];_0x30a74a[_0xf0a4('0x50')]=qs['sort'](_0x4d9a27[_0xf0a4('0x48')][_0xf0a4('0x51')]);_0x30a74a[_0xf0a4('0x52')]=qs[_0xf0a4('0x49')](_['pick'](_0x4d9a27[_0xf0a4('0x48')],_0x303e50[_0xf0a4('0x49')]));if(_0x4d9a27[_0xf0a4('0x48')]['filter']){_0x30a74a[_0xf0a4('0x52')]=_[_0xf0a4('0x55')](_0x30a74a[_0xf0a4('0x52')],{'$or':_[_0xf0a4('0x41')](_0x30a74a[_0xf0a4('0x4a')],function(_0x5ce1a3){var _0x44a4a1={};_0x44a4a1[_0x5ce1a3]={'$like':'%'+_0x4d9a27['query'][_0xf0a4('0x54')]+'%'};return _0x44a4a1;})});}_0x30a74a=_['merge']({},_0x30a74a,_0x4d9a27[_0xf0a4('0x56')]);return _0x126384[_0xf0a4('0x7f')](_0x30a74a);}})[_0xf0a4('0x23')](function(_0x995abd){if(_0x995abd){_0x5787b4=_0x995abd[_0xf0a4('0x4d')];if(!_0x4d9a27[_0xf0a4('0x48')]['hasOwnProperty'](_0xf0a4('0x4f'))){_0x30a74a[_0xf0a4('0x34')]=qs[_0xf0a4('0x34')](_0x4d9a27['query'][_0xf0a4('0x34')]);_0x30a74a[_0xf0a4('0x33')]=qs[_0xf0a4('0x33')](_0x4d9a27[_0xf0a4('0x48')][_0xf0a4('0x33')]);}return _0x126384['getApplications'](_0x30a74a);}})[_0xf0a4('0x23')](function(_0x2b970b){if(_0x2b970b){return _0x2b970b?{'count':_0x5787b4,'rows':_0x2b970b}:null;}})[_0xf0a4('0x23')](respondWithResult(_0x3960fd,null))[_0xf0a4('0x2e')](handleError(_0x3960fd,null));};exports[_0xf0a4('0x80')]=function(_0x537800,_0xf9fa6a,_0x1d5a14){var _0x723b9d={'channel':_0xf0a4('0x81')};var _0xd7557a=[];var _0x5cddb8=[];var _0x368627={};return db[_0xf0a4('0x42')][_0xf0a4('0x5c')]({'where':{'id':_0x537800[_0xf0a4('0x5a')]['id']},'include':[{'model':db[_0xf0a4('0x7d')],'as':'Applications'}]})[_0xf0a4('0x23')](handleEntityNotFound(_0xf9fa6a,null))['then'](function(_0x2f6214){_0x723b9d[_0xf0a4('0x82')]=_0x2f6214;_0x723b9d[_0xf0a4('0x83')]=_['orderBy'](_0x2f6214[_0xf0a4('0x84')],['priority'],[_0xf0a4('0x85')]);if(_0x723b9d[_0xf0a4('0x82')][_0xf0a4('0x84')]){delete _0x723b9d[_0xf0a4('0x82')][_0xf0a4('0x84')];}return db[_0xf0a4('0x86')][_0xf0a4('0x65')]();})[_0xf0a4('0x23')](function(_0x5e5915){if(!_0x5e5915){throw new db[(_0xf0a4('0x87'))]['ValidationError'](_0xf0a4('0x88'));}_0xd7557a=_[_0xf0a4('0x89')](_[_0xf0a4('0x47')](_0x5e5915),[_0xf0a4('0x8a'),_0xf0a4('0x8b')]);_0x5cddb8=_[_0xf0a4('0x89')](_[_0xf0a4('0x47')](_0x5e5915),[_0xf0a4('0x8a'),_0xf0a4('0x8b'),_0xf0a4('0x8c'),_0xf0a4('0x8d')]);_0x723b9d[_0xf0a4('0x5e')]={'mapKey':'mobile'};if(_0x723b9d['account']['type']&&_0x723b9d[_0xf0a4('0x82')]['type']===_0xf0a4('0x8e')){_0x723b9d['body'][_0xf0a4('0x8f')]=_0x537800[_0xf0a4('0x5e')]['From']['replace'](_0xf0a4('0x90'),'');_0x723b9d['body'][_0xf0a4('0x5e')]=_0x537800[_0xf0a4('0x5e')]['Body'];_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x91')]=_0x537800[_0xf0a4('0x5e')]['MessageSid'];}if(_0x723b9d[_0xf0a4('0x5e')]['id']){delete _0x723b9d[_0xf0a4('0x5e')]['id'];}if(_[_0xf0a4('0x92')](_0x723b9d['body'][_0xf0a4('0x8f')])){throw new db[(_0xf0a4('0x87'))][(_0xf0a4('0x93'))](_0xf0a4('0x94'));}if(_[_0xf0a4('0x92')](_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x5e')])||_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x5e')]===''){throw new db['Sequelize'][(_0xf0a4('0x93'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf0a4('0x92')](_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x95')])){throw new db[(_0xf0a4('0x87'))][(_0xf0a4('0x93'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5cddb8);}if(!_[_0xf0a4('0x96')](_0x5cddb8,_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x95')])){throw new db[(_0xf0a4('0x87'))][(_0xf0a4('0x93'))](_0xf0a4('0x97')+_0x5cddb8);}_0x368627[_0x723b9d['body']['mapKey']]=_0x723b9d[_0xf0a4('0x5e')]['from'];return db['CmList']['find']({'where':{'id':_0x723b9d[_0xf0a4('0x82')][_0xf0a4('0x8d')]},'include':[{'model':db[_0xf0a4('0x86')],'as':_0xf0a4('0x98'),'where':_0x368627,'limit':0x1,'order':[[_0xf0a4('0x8b'),_0xf0a4('0x99')]]}]});})[_0xf0a4('0x23')](handleEntityNotFound(_0xf9fa6a,null))[_0xf0a4('0x23')](function(_0x53ed1d){if(_0x53ed1d){_0x723b9d[_0xf0a4('0x9a')]=_[_0xf0a4('0x9b')](_0x53ed1d,[_0xf0a4('0x98')]);if(_0x53ed1d[_0xf0a4('0x98')]['length']){return _0x53ed1d[_0xf0a4('0x98')][0x0];}var _0x115548=_[_0xf0a4('0x9c')](_0x723b9d['body'],{'firstName':_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x8f')],'ListId':_0x53ed1d['id']});_0x115548[_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x95')]]=_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x8f')];return db[_0xf0a4('0x86')][_0xf0a4('0x5d')](_0x115548,{'fields':_0xd7557a,'raw':!![]});}})[_0xf0a4('0x23')](handleEntityNotFound(_0xf9fa6a,null))[_0xf0a4('0x23')](function(_0x19c651){if(_0x19c651){_0x723b9d[_0xf0a4('0x9d')]=_0x19c651;var _0x21d2a0={'ContactId':_0x19c651['id'],'phone':_0x723b9d['body'][_0xf0a4('0x8f')],'WhatsappAccountId':_0x537800[_0xf0a4('0x5a')]['id']};var _0x2fe3b1={'ContactId':_0x19c651['id'],'WhatsappAccountId':_0x537800[_0xf0a4('0x5a')]['id'],'closed':![]};return db[_0xf0a4('0x9e')][_0xf0a4('0x5c')]({'where':_0x2fe3b1})['then'](function(_0x5de094){if(_0x5de094){return[_0x5de094,![]];}return db[_0xf0a4('0x9e')][_0xf0a4('0x5d')](_0x21d2a0)['then'](function(_0x159956){return[_0x159956,!![]];});});}})[_0xf0a4('0x74')](function(_0x5a80bc,_0x156184){_0x723b9d['interaction']=_0x5a80bc[_0xf0a4('0x3a')]({'plain':!![]});_0x723b9d[_0xf0a4('0x9f')][_0xf0a4('0xa0')]=![];if(_0x156184){if(_0x723b9d[_0xf0a4('0x82')]['autoclose']){_0x723b9d[_0xf0a4('0x83')][_0xf0a4('0xa1')]({'id':0x0,'priority':_0x723b9d[_0xf0a4('0x83')]['length']+0x1,'app':_0xf0a4('0xa2'),'appdata':_0xf0a4('0xa3'),'interval':'*,*,*,*'});}_0x723b9d['interaction']['created']=!![];}return db['WhatsappMessage'][_0xf0a4('0x5d')]({'phone':_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x8f')],'messageId':_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x91')],'body':_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x5e')],'WhatsappAccountId':_0x537800[_0xf0a4('0x5a')]['id'],'WhatsappInteractionId':_0x5a80bc['id'],'direction':'in','ContactId':_0x5a80bc[_0xf0a4('0xa4')],'AttachmentId':_0x723b9d[_0xf0a4('0x5e')]['AttachmentId']});})[_0xf0a4('0x23')](function(_0x542f32){_0x723b9d[_0xf0a4('0x2b')]=_0x542f32;if(_0x723b9d[_0xf0a4('0x9f')][_0xf0a4('0xa5')]){return db[_0xf0a4('0x78')][_0xf0a4('0x5c')]({'attributes':['id',_0xf0a4('0x3e')],'where':{'id':_0x723b9d[_0xf0a4('0x9f')]['UserId']}})[_0xf0a4('0x23')](function(_0x13fa50){if(_0x13fa50){_0x723b9d[_0xf0a4('0x83')][_0xf0a4('0xa6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x13fa50[_0xf0a4('0x3e')]+','+(_0x723b9d[_0xf0a4('0x82')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xf0a4('0xa7'),_0xf0a4('0xa8'),_0x723b9d);});}return respondWithRpcPromise(_0xf0a4('0xa7'),_0xf0a4('0xa8'),_0x723b9d);})['then'](function(_0x217a48){if(_0x217a48){var _0x5ea283=0xc8;var _0xb29d20=_0xf0a4('0xa9');logger['info'](_0xf0a4('0x27'),_0xb29d20,_0x5ea283,_0xf0a4('0xaa'));logger[_0xf0a4('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xb29d20,_0x5ea283,_0xf0a4('0xaa'),JSON[_0xf0a4('0x28')](_0x217a48));if(_0x723b9d[_0xf0a4('0x82')][_0xf0a4('0x45')]==='twilio'){return _0xf9fa6a['status'](_0x5ea283)['set']('Content-Type',_0xf0a4('0xab'))[_0xf0a4('0xac')](_0xf0a4('0xad'));}else{return _0xf9fa6a['status'](_0x5ea283)['json'](_0x217a48);}}})['catch'](handleError(_0xf9fa6a,null));};exports[_0xf0a4('0xac')]=function(_0x328e2c,_0x4b22df,_0x4d4a1e){var _0x442662,_0x425f10,_0x16dc3d;if(_[_0xf0a4('0x92')](_0x328e2c['body']['body'])||_0x328e2c[_0xf0a4('0x5e')]['body']===''){throw new db['Sequelize'][(_0xf0a4('0x93'))](_0xf0a4('0xae'));}if(_[_0xf0a4('0x92')](_0x328e2c[_0xf0a4('0x5e')]['to'])){throw new db[(_0xf0a4('0x87'))][(_0xf0a4('0x93'))](_0xf0a4('0xaf'));}_0x442662=_0x328e2c[_0xf0a4('0x5e')]['to'];return db[_0xf0a4('0x42')]['find']({'where':{'id':_0x328e2c[_0xf0a4('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0xf0a4('0xb0'),'include':[{'model':db[_0xf0a4('0x86')],'as':_0xf0a4('0x98'),'where':{'mobile':_0x442662},'limit':0x1,'order':[[_0xf0a4('0x8b'),_0xf0a4('0x99')]]}]}]})['then'](handleEntityNotFound(_0x4b22df,null))[_0xf0a4('0x23')](function(_0x5e37a7){if(_0x5e37a7&&_0x5e37a7[_0xf0a4('0xb0')]){_0x425f10=_0x5e37a7[_0xf0a4('0x3a')]({'plain':!![]});if(_0x425f10['List']&&_0x425f10['List'][_0xf0a4('0x98')][_0xf0a4('0x4d')]){return _0x425f10[_0xf0a4('0xb0')]['Contacts'][0x0];}return db[_0xf0a4('0x86')][_0xf0a4('0x5d')](_[_0xf0a4('0x9c')](_0x328e2c[_0xf0a4('0x5e')],{'firstName':_0x442662,'mobile':_0x442662,'phone':_0x442662,'ListId':_0x425f10[_0xf0a4('0x8d')]}));}})[_0xf0a4('0x23')](handleEntityNotFound(_0x4b22df,null))[_0xf0a4('0x23')](function(_0x595e60){if(_0x595e60){_0x16dc3d=_0x595e60;return db[_0xf0a4('0x9e')]['find']({'where':{'ContactId':_0x16dc3d['id'],'closed':![],'WhatsappAccountId':_0x425f10['id']}})[_0xf0a4('0x23')](function(_0x3353fd){if(_0x3353fd){return[_0x3353fd,![]];}return db[_0xf0a4('0x9e')][_0xf0a4('0x5d')]({'UserId':_0x328e2c[_0xf0a4('0x5f')]['id'],'ContactId':_0x16dc3d['id'],'WhatsappAccountId':_0x425f10['id'],'phone':_0x442662,'firstMsgDirection':_0xf0a4('0xb1'),'Messages':[_['merge'](_0x328e2c['body'],{'read':![],'body':_0x328e2c[_0xf0a4('0x5e')]['body'],'phone':_0x442662,'WhatsappAccountId':_0x425f10['id'],'UserId':_0x328e2c[_0xf0a4('0x5f')]['id'],'ContactId':_0x16dc3d['id']})]},{'include':[{'model':db[_0xf0a4('0xb2')],'as':_0xf0a4('0xb3')}]})[_0xf0a4('0x23')](function(_0x5d1b56){return[_0x5d1b56,!![]];});});}})['spread'](function(_0x14cffc,_0x3bfc06){if(_0x3bfc06){return _0x14cffc;}return db['WhatsappMessage'][_0xf0a4('0x5d')](_[_0xf0a4('0x55')](_0x328e2c[_0xf0a4('0x5e')],{'read':![],'body':_0x328e2c['body'][_0xf0a4('0x5e')],'phone':_0x442662,'WhatsappAccountId':_0x425f10['id'],'WhatsappInteractionId':_0x14cffc['id'],'UserId':_0x328e2c[_0xf0a4('0x5f')]['id'],'ContactId':_0x16dc3d['id']}))[_0xf0a4('0x23')](function(_0x187074){_0x14cffc['dataValues'][_0xf0a4('0xb3')]=[];_0x14cffc[_0xf0a4('0xb4')]['Messages'][_0xf0a4('0xa1')](_0x187074[_0xf0a4('0xb4')]);return _0x14cffc;});})[_0xf0a4('0x23')](respondWithResult(_0x4b22df,null))[_0xf0a4('0x2e')](handleError(_0x4b22df,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index e1bbeec..e82b7bd 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 _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 +var _0x90b1=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','update','remove'];(function(_0x1fd581,_0x34ab1){var _0x18c07d=function(_0x37dcc9){while(--_0x37dcc9){_0x1fd581['push'](_0x1fd581['shift']());}};_0x18c07d(++_0x34ab1);}(_0x90b1,0x1bb));var _0x190b=function(_0x4ce93d,_0x552831){_0x4ce93d=_0x4ce93d-0x0;var _0x209b1a=_0x90b1[_0x4ce93d];return _0x209b1a;};'use strict';var EventEmitter=require(_0x190b('0x0'));var WhatsappAccount=require(_0x190b('0x1'))['db'][_0x190b('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x190b('0x3'),'afterDestroy':_0x190b('0x4')};function emitEvent(_0xa05468){return function(_0x120ddc,_0x4fbcad,_0x4c355f){WhatsappAccountEvents['emit'](_0xa05468+':'+_0x120ddc['id'],_0x120ddc);WhatsappAccountEvents['emit'](_0xa05468,_0x120ddc);_0x4c355f(null);};}for(var e in events){if(events[_0x190b('0x5')](e)){var event=events[e];WhatsappAccount[_0x190b('0x6')](e,emitEvent(event));}}module[_0x190b('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 9ed8cfd..017a13d 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 _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 +var _0x414d=['rimraf','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2c6810,_0x23c079){var _0x213881=function(_0x528021){while(--_0x528021){_0x2c6810['push'](_0x2c6810['shift']());}};_0x213881(++_0x23c079);}(_0x414d,0x126));var _0xd414=function(_0x1d1963,_0x32cc0e){_0x1d1963=_0x1d1963-0x0;var _0x3f58bb=_0x414d[_0x1d1963];return _0x3f58bb;};'use strict';var _=require('lodash');var util=require(_0xd414('0x0'));var logger=require(_0xd414('0x1'))('api');var moment=require(_0xd414('0x2'));var BPromise=require(_0xd414('0x3'));var rp=require(_0xd414('0x4'));var fs=require('fs');var path=require(_0xd414('0x5'));var rimraf=require(_0xd414('0x6'));var config=require(_0xd414('0x7'));var attributes=require(_0xd414('0x8'));module['exports']=function(_0x5379b0,_0x1795c7){return _0x5379b0[_0xd414('0x9')](_0xd414('0xa'),attributes,{'tableName':_0xd414('0xb'),'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 693e132..7454277 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 _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 +var _0x6d37=['WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowWhatsappAccount','find','options','raw','where','attributes','include','model','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x565d34,_0x4176da){var _0x3751e7=function(_0x42428b){while(--_0x42428b){_0x565d34['push'](_0x565d34['shift']());}};_0x3751e7(++_0x4176da);}(_0x6d37,0x103));var _0x76d3=function(_0x43d6f9,_0x215396){_0x43d6f9=_0x43d6f9-0x0;var _0x5ad561=_0x6d37[_0x43d6f9];return _0x5ad561;};'use strict';var _=require(_0x76d3('0x0'));var util=require(_0x76d3('0x1'));var moment=require(_0x76d3('0x2'));var BPromise=require(_0x76d3('0x3'));var rs=require(_0x76d3('0x4'));var fs=require('fs');var Redis=require(_0x76d3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x76d3('0x6'));var logger=require('../../config/logger')(_0x76d3('0x7'));var config=require('../../config/environment');var jayson=require(_0x76d3('0x8'));var client=jayson[_0x76d3('0x9')][_0x76d3('0xa')]({'port':0x232a});config[_0x76d3('0xb')]=_['defaults'](config[_0x76d3('0xb')],{'host':_0x76d3('0xc'),'port':0x18eb});var socket=require(_0x76d3('0xd'))(new Redis(config['redis']));require(_0x76d3('0xe'))[_0x76d3('0xf')](socket);function respondWithRpcPromise(_0x15270b,_0x32fec7,_0x25c051){return new BPromise(function(_0x3df62,_0x251064){return client[_0x76d3('0x10')](_0x15270b,_0x25c051)[_0x76d3('0x11')](function(_0x27c9d4){logger[_0x76d3('0x12')](_0x76d3('0x13'),_0x32fec7,_0x76d3('0x14'));logger['debug'](_0x76d3('0x15'),_0x32fec7,_0x76d3('0x14'),JSON[_0x76d3('0x16')](_0x27c9d4));if(_0x27c9d4[_0x76d3('0x17')]){if(_0x27c9d4[_0x76d3('0x17')]['code']===0x1f4){logger[_0x76d3('0x17')](_0x76d3('0x13'),_0x32fec7,_0x27c9d4[_0x76d3('0x17')]['message']);return _0x251064(_0x27c9d4[_0x76d3('0x17')][_0x76d3('0x18')]);}logger[_0x76d3('0x17')](_0x76d3('0x13'),_0x32fec7,_0x27c9d4['error'][_0x76d3('0x18')]);return _0x3df62(_0x27c9d4['error'][_0x76d3('0x18')]);}else{logger[_0x76d3('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x32fec7,_0x76d3('0x14'));_0x3df62(_0x27c9d4[_0x76d3('0x19')][_0x76d3('0x18')]);}})['catch'](function(_0x562b2b){logger[_0x76d3('0x17')](_0x76d3('0x13'),_0x32fec7,_0x562b2b);_0x251064(_0x562b2b);});});}exports[_0x76d3('0x1a')]=function(_0x1a6c9f){var _0x5acd09=this;return new Promise(function(_0x1fa6e2,_0x5865e7){return db['WhatsappAccount'][_0x76d3('0x1b')]({'raw':_0x1a6c9f[_0x76d3('0x1c')]?_0x1a6c9f[_0x76d3('0x1c')][_0x76d3('0x1d')]===undefined?!![]:![]:!![],'where':_0x1a6c9f[_0x76d3('0x1c')]?_0x1a6c9f[_0x76d3('0x1c')][_0x76d3('0x1e')]||null:null,'attributes':_0x1a6c9f['options']?_0x1a6c9f[_0x76d3('0x1c')][_0x76d3('0x1f')]||null:null,'include':_0x1a6c9f[_0x76d3('0x1c')]?_0x1a6c9f[_0x76d3('0x1c')][_0x76d3('0x20')]?_['map'](_0x1a6c9f['options'][_0x76d3('0x20')],function(_0x4d4f3f){return{'model':db[_0x4d4f3f[_0x76d3('0x21')]],'as':_0x4d4f3f['as'],'attributes':_0x4d4f3f[_0x76d3('0x1f')],'include':_0x4d4f3f['include']?_['map'](_0x4d4f3f[_0x76d3('0x20')],function(_0x58071b){return{'model':db[_0x58071b['model']],'as':_0x58071b['as'],'attributes':_0x58071b['attributes'],'include':_0x58071b[_0x76d3('0x20')]?_['map'](_0x58071b[_0x76d3('0x20')],function(_0x5dc097){return{'model':db[_0x5dc097[_0x76d3('0x21')]],'as':_0x5dc097['as'],'attributes':_0x5dc097['attributes']};}):[]};}):[]};}):[]:[]})[_0x76d3('0x11')](function(_0x3ced65){logger[_0x76d3('0x12')]('ShowWhatsappAccount',_0x1a6c9f);logger['debug'](_0x76d3('0x1a'),_0x1a6c9f,JSON[_0x76d3('0x16')](_0x3ced65));_0x1fa6e2(_0x3ced65);})[_0x76d3('0x22')](function(_0x116d02){logger[_0x76d3('0x17')](_0x76d3('0x1a'),_0x116d02[_0x76d3('0x18')],_0x1a6c9f);_0x5865e7(_0x5acd09['error'](0x1f4,_0x116d02[_0x76d3('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index b693230..b40fb1d 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 _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 +var _0xea94=['update','emit','removeListener','register','length','./whatsappAccount.events','remove'];(function(_0x595a5c,_0x4197c6){var _0x3b384e=function(_0x54051f){while(--_0x54051f){_0x595a5c['push'](_0x595a5c['shift']());}};_0x3b384e(++_0x4197c6);}(_0xea94,0x155));var _0x4ea9=function(_0x49d48d,_0xf1fdaa){_0x49d48d=_0x49d48d-0x0;var _0x46e093=_0xea94[_0x49d48d];return _0x46e093;};'use strict';var WhatsappAccountEvents=require(_0x4ea9('0x0'));var events=['save',_0x4ea9('0x1'),_0x4ea9('0x2')];function createListener(_0x2f67ef,_0xabcb5a){return function(_0x20ec68){_0xabcb5a[_0x4ea9('0x3')](_0x2f67ef,_0x20ec68);};}function removeListener(_0x734ee3,_0x262054){return function(){WhatsappAccountEvents[_0x4ea9('0x4')](_0x734ee3,_0x262054);};}exports[_0x4ea9('0x5')]=function(_0x1cdf2a){for(var _0xbe159e=0x0,_0x48f994=events[_0x4ea9('0x6')];_0xbe159e<_0x48f994;_0xbe159e++){var _0x261e52=events[_0xbe159e];var _0x403c65=createListener('whatsappAccount:'+_0x261e52,_0x1cdf2a);WhatsappAccountEvents['on'](_0x261e52,_0x403c65);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 8d0a45e..5ba7da1 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 _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 +var _0xb074=['get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./whatsappApplication.controller'];(function(_0x72d743,_0xaf43bd){var _0x3617e6=function(_0x1401e0){while(--_0x1401e0){_0x72d743['push'](_0x72d743['shift']());}};_0x3617e6(++_0xaf43bd);}(_0xb074,0xd6));var _0x4b07=function(_0x2154e7,_0x195446){_0x2154e7=_0x2154e7-0x0;var _0x462859=_0xb074[_0x2154e7];return _0x462859;};'use strict';var multer=require(_0x4b07('0x0'));var util=require(_0x4b07('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4b07('0x2'));var router=express[_0x4b07('0x3')]();var auth=require(_0x4b07('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4b07('0x5'));var controller=require(_0x4b07('0x6'));router[_0x4b07('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4b07('0x7')](_0x4b07('0x8'),auth[_0x4b07('0x9')](),controller[_0x4b07('0xa')]);router[_0x4b07('0xb')]('/',auth[_0x4b07('0x9')](),controller[_0x4b07('0xc')]);router[_0x4b07('0xd')](_0x4b07('0x8'),auth[_0x4b07('0x9')](),controller[_0x4b07('0xe')]);router[_0x4b07('0xf')](_0x4b07('0x8'),auth[_0x4b07('0x9')](),controller['destroy']);module[_0x4b07('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 9568aa0..4669b3d 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 _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 +var _0x2d4f=['STRING','exports','INTEGER','noop','TEXT'];(function(_0x4d7eff,_0x20826c){var _0x4fa4b3=function(_0x45e7ae){while(--_0x45e7ae){_0x4d7eff['push'](_0x4d7eff['shift']());}};_0x4fa4b3(++_0x20826c);}(_0x2d4f,0x150));var _0xf2d4=function(_0x5de21b,_0x5c76ba){_0x5de21b=_0x5de21b-0x0;var _0x4dbe50=_0x2d4f[_0x5de21b];return _0x4dbe50;};'use strict';var Sequelize=require('sequelize');module[_0xf2d4('0x0')]={'priority':{'type':Sequelize[_0xf2d4('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf2d4('0x2')},'appdata':{'type':Sequelize[_0xf2d4('0x3')]()},'description':{'type':Sequelize[_0xf2d4('0x4')]},'interval':{'type':Sequelize[_0xf2d4('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 34fd08e..75397ac 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 _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 +var _0xb11f=['sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','filter','options','include','rows','show','params','fields','includeAll','find','catch','create','body','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x442e11,_0x47488f){var _0x50495d=function(_0x3c72ba){while(--_0x3c72ba){_0x442e11['push'](_0x442e11['shift']());}};_0x50495d(++_0x47488f);}(_0xb11f,0x103));var _0xfb11=function(_0x157559,_0x3e1b99){_0x157559=_0x157559-0x0;var _0x165e17=_0xb11f[_0x157559];return _0x165e17;};'use strict';var pdf=require(_0xfb11('0x0'));var emlformat=require(_0xfb11('0x1'));var rimraf=require(_0xfb11('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb11('0x3'));var rp=require(_0xfb11('0x4'));var moment=require(_0xfb11('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfb11('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xfb11('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfb11('0x8'));var squel=require(_0xfb11('0x9'));var crypto=require(_0xfb11('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfb11('0xb'));var toCsv=require(_0xfb11('0x7'));var querystring=require(_0xfb11('0xc'));var Papa=require('papaparse');var Redis=require(_0xfb11('0xd'));var authService=require(_0xfb11('0xe'));var qs=require(_0xfb11('0xf'));var as=require(_0xfb11('0x10'));var hardwareService=require(_0xfb11('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xfb11('0x12'));var licenseUtil=require(_0xfb11('0x13'));var db=require(_0xfb11('0x14'))['db'];function respondWithStatusCode(_0x3e2b7f,_0x3ae6c8){_0x3ae6c8=_0x3ae6c8||0xcc;return function(_0x2d3d38){if(_0x2d3d38){return _0x3e2b7f[_0xfb11('0x15')](_0x3ae6c8);}return _0x3e2b7f[_0xfb11('0x16')](_0x3ae6c8)[_0xfb11('0x17')]();};}function respondWithResult(_0x8ca91f,_0x4eb794){_0x4eb794=_0x4eb794||0xc8;return function(_0x533ecf){if(_0x533ecf){return _0x8ca91f[_0xfb11('0x16')](_0x4eb794)['json'](_0x533ecf);}};}function respondWithFilteredResult(_0x1c061e,_0x17109b){return function(_0x3fc216){if(_0x3fc216){var _0xbc1d8d=_0x3fc216[_0xfb11('0x18')],_0x16077e=_0x17109b[_0xfb11('0x19')],_0x3625ea=_0x17109b[_0xfb11('0x19')]+_0x17109b[_0xfb11('0x1a')],_0x451f47;if(_0x3625ea>=_0xbc1d8d){_0x3625ea=_0xbc1d8d;_0x451f47=0xc8;}else{_0x451f47=0xce;}_0x1c061e[_0xfb11('0x16')](_0x451f47);return _0x1c061e[_0xfb11('0x1b')](_0xfb11('0x1c'),_0x16077e+'-'+_0x3625ea+'/'+_0xbc1d8d)[_0xfb11('0x1d')](_0x3fc216);}return null;};}function patchUpdates(_0x4eea54){return function(_0x1354f5){try{jsonpatch['apply'](_0x1354f5,_0x4eea54,!![]);}catch(_0x2b045e){return BPromise[_0xfb11('0x1e')](_0x2b045e);}return _0x1354f5[_0xfb11('0x1f')]();};}function saveUpdates(_0x2bcab6,_0x1634c1){return function(_0x4b88c9){if(_0x4b88c9){return _0x4b88c9[_0xfb11('0x20')](_0x2bcab6)['then'](function(_0x23c8f9){return _0x23c8f9;});}return null;};}function removeEntity(_0x230842,_0x3c77b5){return function(_0x4d5a48){if(_0x4d5a48){return _0x4d5a48['destroy']()[_0xfb11('0x21')](function(){_0x230842[_0xfb11('0x16')](0xcc)[_0xfb11('0x17')]();});}};}function handleEntityNotFound(_0x381b91,_0x10609f){return function(_0x3cfdb7){if(!_0x3cfdb7){_0x381b91[_0xfb11('0x15')](0x194);}return _0x3cfdb7;};}function handleError(_0x9f8896,_0x44a7c9){_0x44a7c9=_0x44a7c9||0x1f4;return function(_0x56ee33){logger[_0xfb11('0x22')](_0x56ee33[_0xfb11('0x23')]);if(_0x56ee33[_0xfb11('0x24')]){delete _0x56ee33[_0xfb11('0x24')];}_0x9f8896[_0xfb11('0x16')](_0x44a7c9)[_0xfb11('0x25')](_0x56ee33);};}exports[_0xfb11('0x26')]=function(_0x2a73ba,_0x29fccb){var _0x471919={},_0x289cb6={},_0x3c1d57={'count':0x0,'rows':[]};var _0x10bcd0=_[_0xfb11('0x27')](db[_0xfb11('0x28')][_0xfb11('0x29')],function(_0x370dbe){return{'name':_0x370dbe[_0xfb11('0x2a')],'type':_0x370dbe['type']['key']};});_0x289cb6[_0xfb11('0x2b')]=_[_0xfb11('0x27')](_0x10bcd0,_0xfb11('0x24'));_0x289cb6['query']=_[_0xfb11('0x2c')](_0x2a73ba[_0xfb11('0x2d')]);_0x289cb6[_0xfb11('0x2e')]=_[_0xfb11('0x2f')](_0x289cb6[_0xfb11('0x2b')],_0x289cb6[_0xfb11('0x2d')]);_0x471919[_0xfb11('0x30')]=_[_0xfb11('0x2f')](_0x289cb6[_0xfb11('0x2b')],qs['fields'](_0x2a73ba['query']['fields']));_0x471919[_0xfb11('0x30')]=_0x471919[_0xfb11('0x30')][_0xfb11('0x31')]?_0x471919[_0xfb11('0x30')]:_0x289cb6['model'];if(!_0x2a73ba[_0xfb11('0x2d')][_0xfb11('0x32')](_0xfb11('0x33'))){_0x471919[_0xfb11('0x1a')]=qs[_0xfb11('0x1a')](_0x2a73ba[_0xfb11('0x2d')]['limit']);_0x471919['offset']=qs[_0xfb11('0x19')](_0x2a73ba[_0xfb11('0x2d')][_0xfb11('0x19')]);}_0x471919['order']=qs['sort'](_0x2a73ba[_0xfb11('0x2d')][_0xfb11('0x34')]);_0x471919[_0xfb11('0x35')]=qs[_0xfb11('0x2e')](_[_0xfb11('0x36')](_0x2a73ba[_0xfb11('0x2d')],_0x289cb6[_0xfb11('0x2e')]),_0x10bcd0);if(_0x2a73ba['query']['filter']){_0x471919[_0xfb11('0x35')]=_[_0xfb11('0x37')](_0x471919[_0xfb11('0x35')],{'$or':_['map'](_0x10bcd0,function(_0x27284c){if(_0x27284c[_0xfb11('0x38')]!=='VIRTUAL'){var _0x393b61={};_0x393b61[_0x27284c[_0xfb11('0x24')]]={'$like':'%'+_0x2a73ba['query'][_0xfb11('0x39')]+'%'};return _0x393b61;}})});}_0x471919=_[_0xfb11('0x37')]({},_0x471919,_0x2a73ba[_0xfb11('0x3a')]);var _0x176feb={'where':_0x471919['where']};return db['WhatsappApplication'][_0xfb11('0x18')](_0x176feb)['then'](function(_0x3f6c14){_0x3c1d57['count']=_0x3f6c14;if(_0x2a73ba['query']['includeAll']){_0x471919[_0xfb11('0x3b')]=[{'all':!![]}];}return db[_0xfb11('0x28')]['findAll'](_0x471919);})[_0xfb11('0x21')](function(_0x378c99){_0x3c1d57[_0xfb11('0x3c')]=_0x378c99;return _0x3c1d57;})[_0xfb11('0x21')](respondWithFilteredResult(_0x29fccb,_0x471919))['catch'](handleError(_0x29fccb,null));};exports[_0xfb11('0x3d')]=function(_0x178f87,_0x1c2cb7){var _0x1458fa={'raw':!![],'where':{'id':_0x178f87[_0xfb11('0x3e')]['id']}},_0x12beca={};_0x12beca[_0xfb11('0x2b')]=_['keys'](db[_0xfb11('0x28')][_0xfb11('0x29')]);_0x12beca['query']=_[_0xfb11('0x2c')](_0x178f87[_0xfb11('0x2d')]);_0x12beca[_0xfb11('0x2e')]=_[_0xfb11('0x2f')](_0x12beca[_0xfb11('0x2b')],_0x12beca[_0xfb11('0x2d')]);_0x1458fa[_0xfb11('0x30')]=_['intersection'](_0x12beca[_0xfb11('0x2b')],qs[_0xfb11('0x3f')](_0x178f87['query'][_0xfb11('0x3f')]));_0x1458fa[_0xfb11('0x30')]=_0x1458fa['attributes'][_0xfb11('0x31')]?_0x1458fa['attributes']:_0x12beca['model'];if(_0x178f87[_0xfb11('0x2d')][_0xfb11('0x40')]){_0x1458fa[_0xfb11('0x3b')]=[{'all':!![]}];}_0x1458fa=_[_0xfb11('0x37')]({},_0x1458fa,_0x178f87[_0xfb11('0x3a')]);return db[_0xfb11('0x28')][_0xfb11('0x41')](_0x1458fa)['then'](handleEntityNotFound(_0x1c2cb7,null))['then'](respondWithResult(_0x1c2cb7,null))[_0xfb11('0x42')](handleError(_0x1c2cb7,null));};exports[_0xfb11('0x43')]=function(_0x3bd0b6,_0xfb17c4){return db[_0xfb11('0x28')][_0xfb11('0x43')](_0x3bd0b6[_0xfb11('0x44')],{})[_0xfb11('0x21')](respondWithResult(_0xfb17c4,0xc9))[_0xfb11('0x42')](handleError(_0xfb17c4,null));};exports[_0xfb11('0x20')]=function(_0x74c716,_0x29804b){if(_0x74c716['body']['id']){delete _0x74c716[_0xfb11('0x44')]['id'];}return db[_0xfb11('0x28')][_0xfb11('0x41')]({'where':{'id':_0x74c716[_0xfb11('0x3e')]['id']}})[_0xfb11('0x21')](handleEntityNotFound(_0x29804b,null))[_0xfb11('0x21')](saveUpdates(_0x74c716[_0xfb11('0x44')],null))[_0xfb11('0x21')](respondWithResult(_0x29804b,null))[_0xfb11('0x42')](handleError(_0x29804b,null));};exports[_0xfb11('0x45')]=function(_0x103045,_0x5e385d){return db[_0xfb11('0x28')]['find']({'where':{'id':_0x103045[_0xfb11('0x3e')]['id']}})[_0xfb11('0x21')](handleEntityNotFound(_0x5e385d,null))[_0xfb11('0x21')](removeEntity(_0x5e385d,null))[_0xfb11('0x42')](handleError(_0x5e385d,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 7ba51ae..74f32b6 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 _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 +var _0x01de=['whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication'];(function(_0x4c6176,_0x204159){var _0x1caaeb=function(_0xf78baf){while(--_0xf78baf){_0x4c6176['push'](_0x4c6176['shift']());}};_0x1caaeb(++_0x204159);}(_0x01de,0x1b6));var _0xe01d=function(_0x2add23,_0x37f8dd){_0x2add23=_0x2add23-0x0;var _0x287daf=_0x01de[_0x2add23];return _0x287daf;};'use strict';var _=require(_0xe01d('0x0'));var util=require(_0xe01d('0x1'));var logger=require('../../config/logger')(_0xe01d('0x2'));var moment=require(_0xe01d('0x3'));var BPromise=require(_0xe01d('0x4'));var rp=require(_0xe01d('0x5'));var fs=require('fs');var path=require(_0xe01d('0x6'));var rimraf=require('rimraf');var config=require(_0xe01d('0x7'));var attributes=require(_0xe01d('0x8'));module[_0xe01d('0x9')]=function(_0x10f6e1,_0x1d3776){return _0x10f6e1[_0xe01d('0xa')](_0xe01d('0xb'),attributes,{'tableName':_0xe01d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe01d('0xd'),'collate':_0xe01d('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 7723d0d..7f63050 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 _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 +var _0x14f5=['WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14a27b,_0x3a1d4d){var _0x1cdd25=function(_0x313f05){while(--_0x313f05){_0x14a27b['push'](_0x14a27b['shift']());}};_0x1cdd25(++_0x3a1d4d);}(_0x14f5,0xae));var _0x514f=function(_0x5d543b,_0x6a969a){_0x5d543b=_0x5d543b-0x0;var _0x2015b8=_0x14f5[_0x5d543b];return _0x2015b8;};'use strict';var _=require('lodash');var util=require(_0x514f('0x0'));var moment=require('moment');var BPromise=require(_0x514f('0x1'));var rs=require(_0x514f('0x2'));var fs=require('fs');var Redis=require(_0x514f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x514f('0x4'));var logger=require(_0x514f('0x5'))('rpc');var config=require(_0x514f('0x6'));var jayson=require(_0x514f('0x7'));var client=jayson[_0x514f('0x8')][_0x514f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x463985,_0x43ec42,_0xdb9614){return new BPromise(function(_0x4a5497,_0x203b02){return client['request'](_0x463985,_0xdb9614)[_0x514f('0xa')](function(_0x1e3fa7){logger[_0x514f('0xb')](_0x514f('0xc'),_0x43ec42,_0x514f('0xd'));logger[_0x514f('0xe')](_0x514f('0xf'),_0x43ec42,'request\x20sent',JSON['stringify'](_0x1e3fa7));if(_0x1e3fa7['error']){if(_0x1e3fa7[_0x514f('0x10')][_0x514f('0x11')]===0x1f4){logger[_0x514f('0x10')](_0x514f('0xc'),_0x43ec42,_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);return _0x203b02(_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);}logger[_0x514f('0x10')](_0x514f('0xc'),_0x43ec42,_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);return _0x4a5497(_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);}else{logger[_0x514f('0xb')]('WhatsappApplication,\x20%s,\x20%s',_0x43ec42,_0x514f('0xd'));_0x4a5497(_0x1e3fa7[_0x514f('0x13')]['message']);}})[_0x514f('0x14')](function(_0x53851d){logger[_0x514f('0x10')](_0x514f('0xc'),_0x43ec42,_0x53851d);_0x203b02(_0x53851d);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index a776fd5..a5e883d 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 _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 +var _0x77eb=['removeTags','exports','multer','util','path','express','Router','../../config/environment','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','post','create','/:id/tags','tracked','whatsapp','put','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy'];(function(_0x3f1306,_0x3e6e7c){var _0x2562d2=function(_0x3f0182){while(--_0x3f0182){_0x3f1306['push'](_0x3f1306['shift']());}};_0x2562d2(++_0x3e6e7c);}(_0x77eb,0x98));var _0xb77e=function(_0xa2b098,_0x461a08){_0xa2b098=_0xa2b098-0x0;var _0x29502e=_0x77eb[_0xa2b098];return _0x29502e;};'use strict';var multer=require(_0xb77e('0x0'));var util=require(_0xb77e('0x1'));var path=require(_0xb77e('0x2'));var timeout=require('connect-timeout');var express=require(_0xb77e('0x3'));var router=express[_0xb77e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb77e('0x5'));var controller=require('./whatsappInteraction.controller');router[_0xb77e('0x6')]('/',auth[_0xb77e('0x7')](),controller[_0xb77e('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xb77e('0x9')]);router['get'](_0xb77e('0xa'),auth[_0xb77e('0x7')](),controller['show']);router[_0xb77e('0x6')](_0xb77e('0xb'),auth[_0xb77e('0x7')](),controller[_0xb77e('0xc')]);router[_0xb77e('0x6')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xb77e('0xd')]('/',auth['isAuthenticated'](),controller[_0xb77e('0xe')]);router[_0xb77e('0xd')](_0xb77e('0xb'),auth[_0xb77e('0x7')](),controller['addMessage']);router['post'](_0xb77e('0xf'),auth['isAuthenticated'](),interaction[_0xb77e('0x10')](_0xb77e('0x11'),'whatsappinteraction:addtags'),controller['addTags']);router[_0xb77e('0x12')](_0xb77e('0xa'),auth[_0xb77e('0x7')](),interaction['tracked']('whatsapp',_0xb77e('0x13')),controller['update']);router[_0xb77e('0x14')](_0xb77e('0xa'),auth[_0xb77e('0x7')](),interaction[_0xb77e('0x10')](_0xb77e('0x11'),_0xb77e('0x15')),controller[_0xb77e('0x16')]);router[_0xb77e('0x14')](_0xb77e('0xf'),auth[_0xb77e('0x7')](),controller[_0xb77e('0x17')]);module[_0xb77e('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 7ad7567..5ac5165 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 _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 +var _0x7d51=['STRING','out','ENUM','sequelize','moment','DATE'];(function(_0x49ab54,_0x487c8b){var _0x173ea3=function(_0x7dc49d){while(--_0x7dc49d){_0x49ab54['push'](_0x49ab54['shift']());}};_0x173ea3(++_0x487c8b);}(_0x7d51,0x1e9));var _0x17d5=function(_0x42ff7a,_0x368e66){_0x42ff7a=_0x42ff7a-0x0;var _0x5335ba=_0x7d51[_0x42ff7a];return _0x5335ba;};'use strict';var Sequelize=require(_0x17d5('0x0'));var moment=require(_0x17d5('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x17d5('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x17d5('0x3')]},'thirdDisposition':{'type':Sequelize[_0x17d5('0x3')]},'note':{'type':Sequelize[_0x17d5('0x3')]},'phone':{'type':Sequelize[_0x17d5('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x17d5('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x17d5('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x17d5('0x5')]('in',_0x17d5('0x4')),'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 3d141aa..f4afc4e 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 _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 +var _0x5f2f=['filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','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','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','toString','groupBy','WhatsappInteractionId','all','rows','show','params','rawAttributes','includeAll','include','options','create','body','describe','addMessage','omit','ids','getMessages','pick','format','YYYY-MM-DD\x20HH:mm:ss','WhatsappMessage','setTags','findAll','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','CmContact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Whatsapp','YYYY-MM-DD','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.html','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','fullname','TagIds','forEach','Tags','push','catch','index','map','WhatsappInteraction','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','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','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','start','Tag','split','union','User','UserId','buildExpression','keys','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4a2aa1,_0x552a98){_0x4a2aa1=_0x4a2aa1-0x0;var _0x23f0ce=_0x5f2f[_0x4a2aa1];return _0x23f0ce;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];config[_0xf5f2('0x18')]=_[_0xf5f2('0x19')](config[_0xf5f2('0x18')],{'host':_0xf5f2('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5f2('0x18')]));require(_0xf5f2('0x1b'))[_0xf5f2('0x1c')](socket);function respondWithStatusCode(_0x1c1a5c,_0x422b55){_0x422b55=_0x422b55||0xcc;return function(_0x4d97fc){if(_0x4d97fc){return _0x1c1a5c[_0xf5f2('0x1d')](_0x422b55);}return _0x1c1a5c[_0xf5f2('0x1e')](_0x422b55)[_0xf5f2('0x1f')]();};}function respondWithResult(_0x1b6dd2,_0x23e23a){_0x23e23a=_0x23e23a||0xc8;return function(_0x3a9dbb){if(_0x3a9dbb){return _0x1b6dd2[_0xf5f2('0x1e')](_0x23e23a)[_0xf5f2('0x20')](_0x3a9dbb);}};}function respondWithFilteredResult(_0x11f702,_0x228ace){return function(_0x20fccd){if(_0x20fccd){var _0x28e097=_0x20fccd[_0xf5f2('0x21')],_0x4ff59b=_0x228ace[_0xf5f2('0x22')],_0x3ee69=_0x228ace['offset']+_0x228ace[_0xf5f2('0x23')],_0x3cf5ea;if(_0x3ee69>=_0x28e097){_0x3ee69=_0x28e097;_0x3cf5ea=0xc8;}else{_0x3cf5ea=0xce;}_0x11f702[_0xf5f2('0x1e')](_0x3cf5ea);return _0x11f702['set']('Content-Range',_0x4ff59b+'-'+_0x3ee69+'/'+_0x28e097)[_0xf5f2('0x20')](_0x20fccd);}return null;};}function patchUpdates(_0x388e6c){return function(_0x4ae323){try{jsonpatch[_0xf5f2('0x24')](_0x4ae323,_0x388e6c,!![]);}catch(_0x170042){return BPromise[_0xf5f2('0x25')](_0x170042);}return _0x4ae323[_0xf5f2('0x26')]();};}function saveUpdates(_0x36f1cb,_0x4c691a){return function(_0x21cd91){if(_0x21cd91){return _0x21cd91[_0xf5f2('0x27')](_0x36f1cb)[_0xf5f2('0x28')](function(_0x2833fe){return _0x2833fe;});}return null;};}function removeEntity(_0x287ad5,_0x5bdf4a){return function(_0x529f07){if(_0x529f07){return _0x529f07[_0xf5f2('0x29')]()[_0xf5f2('0x28')](function(){_0x287ad5[_0xf5f2('0x1e')](0xcc)[_0xf5f2('0x1f')]();});}};}function handleEntityNotFound(_0xf6c58d,_0x788a8d){return function(_0x13a3be){if(!_0x13a3be){_0xf6c58d[_0xf5f2('0x1d')](0x194);}return _0x13a3be;};}function handleError(_0x294414,_0x4ab014){_0x4ab014=_0x4ab014||0x1f4;return function(_0xaa2602){logger[_0xf5f2('0x2a')](_0xaa2602[_0xf5f2('0x2b')]);if(_0xaa2602[_0xf5f2('0x2c')]){delete _0xaa2602[_0xf5f2('0x2c')];}_0x294414[_0xf5f2('0x1e')](_0x4ab014)['send'](_0xaa2602);};}function getInteractionUsers(_0x53cb96,_0x22c826){return new BPromise(function(_0x14c829,_0x11c771){try{if(_0x22c826[_0x53cb96['id']]){_0x53cb96['Users']=_['map'](_0x22c826[_0x53cb96['id']],function(_0x29571b){return{'id':_0x29571b['id'],'fullname':_0x29571b[_0xf5f2('0x2d')]};});}}catch(_0x17394a){_0x11c771(_0x17394a);}_0x14c829(_0x53cb96);});}function getInteractionTags(_0x153924,_0x1b381e){return new BPromise(function(_0x54c0c8,_0x52e959){try{if(_0x153924[_0xf5f2('0x2e')]){_0x153924['Tags']=[];_0x153924[_0xf5f2('0x2e')]['split'](',')[_0xf5f2('0x2f')](function(_0x31087c){_0x153924[_0xf5f2('0x30')][_0xf5f2('0x31')](_0x1b381e[_0x31087c]);});}delete _0x153924[_0xf5f2('0x2e')];}catch(_0x277eee){_0x52e959(_0x277eee);}_0x54c0c8(_0x153924);});}function updateWhatsappInteraction(_0x2ac089,_0x2c0e05,_0x5ca917){return new BPromise(function(_0x4149e6,_0x43e4ff){return getInteractionUsers(_0x2ac089,_0x5ca917)[_0xf5f2('0x28')](function(_0x43c77d){return getInteractionTags(_0x43c77d,_0x2c0e05);})[_0xf5f2('0x28')](function(_0x27c0e7){_0x4149e6(_0x27c0e7);})[_0xf5f2('0x32')](function(_0x48d64d){_0x43e4ff(_0x48d64d);});});}exports[_0xf5f2('0x33')]=function(_0xf503e8,_0x55989d){var _0x3fc168={},_0x4b8c42={},_0x18ae07={'count':0x0,'rows':[]};var _0x3930fb=_[_0xf5f2('0x34')](db[_0xf5f2('0x35')]['rawAttributes'],function(_0x5a98d7){return{'name':_0x5a98d7[_0xf5f2('0x36')],'type':_0x5a98d7[_0xf5f2('0x37')][_0xf5f2('0x38')]};});_0x4b8c42['model']=_[_0xf5f2('0x34')](_0x3930fb,'name');_0x4b8c42[_0xf5f2('0x39')]=_['keys'](_0xf503e8[_0xf5f2('0x39')]);_0x4b8c42[_0xf5f2('0x3a')]=_['intersection'](_0x4b8c42[_0xf5f2('0x3b')],_0x4b8c42[_0xf5f2('0x39')]);_0x3fc168[_0xf5f2('0x3c')]=_[_0xf5f2('0x3d')](_0x4b8c42['model'],qs['fields'](_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x3e')]));_0x3fc168[_0xf5f2('0x3c')]=_0x3fc168[_0xf5f2('0x3c')][_0xf5f2('0x3f')]?_0x3fc168[_0xf5f2('0x3c')]:_0x4b8c42[_0xf5f2('0x3b')];if(!_0xf503e8['query'][_0xf5f2('0x40')](_0xf5f2('0x41'))){_0x3fc168['limit']=qs[_0xf5f2('0x23')](_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x23')]);_0x3fc168[_0xf5f2('0x22')]=qs[_0xf5f2('0x22')](_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x22')]);}_0x3fc168[_0xf5f2('0x42')]=qs['sort'](_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x43')]);_0x3fc168[_0xf5f2('0x44')]=qs['filters'](_['pick'](_0xf503e8['query'],_0x4b8c42[_0xf5f2('0x3a')]),_0x3930fb);var _0x2ad13c=[];var _0x4c8d8e=squel[_0xf5f2('0x45')]()[_0xf5f2('0x46')]('id')[_0xf5f2('0x46')](_0xf5f2('0x2c'))[_0xf5f2('0x46')](_0xf5f2('0x47'))[_0xf5f2('0x48')](_0xf5f2('0x49'));var _0x40c322=squel[_0xf5f2('0x45')]()[_0xf5f2('0x46')](_0xf5f2('0x4a'))[_0xf5f2('0x46')](_0xf5f2('0x4b'))['field'](_0xf5f2('0x4c'))['from'](_0xf5f2('0x4d'),'ui')[_0xf5f2('0x4e')](_0xf5f2('0x4f'),'u',_0xf5f2('0x50'));var _0x31bf0e=squel[_0xf5f2('0x45')]()['from'](_0xf5f2('0x51'),'i')[_0xf5f2('0x4e')](_0xf5f2('0x52'),'c',_0xf5f2('0x53'))[_0xf5f2('0x4e')](_0xf5f2('0x4f'),'o',_0xf5f2('0x54'))[_0xf5f2('0x4e')]('whatsapp_accounts','a',_0xf5f2('0x55'))[_0xf5f2('0x4e')](_0xf5f2('0x56'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0xf5f2('0x4e')](_0xf5f2('0x57'),'it',_0xf5f2('0x58'))['left_join']('tools_tags','t',_0xf5f2('0x59'));var _0x27c472=squel['expr']();var _0x14aa81=[];var _0x533cca=squel[_0xf5f2('0x5a')]();var _0x497eb8;if(_0xf503e8[_0xf5f2('0x39')]['search']){_0x497eb8=as[_0xf5f2('0x5b')](_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x5c')]);var _0x11a083=_0x497eb8['sqlOperator'];for(var _0x3154c1=0x0;_0x3154c1<_0x497eb8[_0xf5f2('0x5d')]['length'];_0x3154c1++){var _0x58213b=_0x497eb8[_0xf5f2('0x5d')][_0x3154c1];var _0x3dc0c4='i';var _0x57782c=_[_0xf5f2('0x5e')](_0x3930fb,[_0xf5f2('0x2c'),_0x58213b[_0xf5f2('0x46')]]);if(!_0x57782c){switch(_0x58213b[_0xf5f2('0x46')]){case'unreadMessages':if(_0x58213b['value']==0x1){_0x31bf0e[_0xf5f2('0x5f')]('`'+_0x58213b[_0xf5f2('0x46')]+'`\x20=\x200');}else{_0x31bf0e[_0xf5f2('0x5f')]('`'+_0x58213b[_0xf5f2('0x46')]+_0xf5f2('0x60'));}break;case _0xf5f2('0x61'):if(_0x58213b[_0xf5f2('0x62')]===_0xf5f2('0x63')){if(_0x58213b[_0xf5f2('0x64')]['split']('\x20')['length']>0x1){_0x27c472[_0x11a083](_0xf5f2('0x65'),qs[_0xf5f2('0x66')](_0x58213b[_0xf5f2('0x64')]),null);}else{var _0x46a905='%'+_0x58213b[_0xf5f2('0x64')]+'%';_0x27c472[_0x11a083]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x46a905,_0x46a905,_0x46a905);}}else{_0x57782c=_[_0xf5f2('0x5e')](_0x3930fb,[_0xf5f2('0x2c'),_0xf5f2('0x67')]);_0x58213b['field']=_0xf5f2('0x67');_0x20ccb6=as['buildExpression'](_0x3dc0c4,_0x57782c[_0xf5f2('0x37')],_0x58213b);_0x27c472[_0x11a083](_0x20ccb6[_0xf5f2('0x68')],_0x20ccb6[_0xf5f2('0x64')][_0xf5f2('0x69')],_0x20ccb6['value']['end']);}break;case _0xf5f2('0x6a'):var _0x4de303=_0x58213b[_0xf5f2('0x64')][_0xf5f2('0x6b')](',')['map'](function(_0x3f0579){return Number(_0x3f0579);});_0x4de303[_0xf5f2('0x2f')](function(_0x2a8f6d){_0x533cca['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2a8f6d+',%');});_0x14aa81=_[_0xf5f2('0x6c')](_0x14aa81,_0x4de303);break;case _0xf5f2('0x6d'):if(_0x58213b[_0xf5f2('0x62')]===_0xf5f2('0x63')){_0x27c472[_0x11a083]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x58213b[_0xf5f2('0x64')]+'%',null);}else{_0x57782c=_['find'](_0x3930fb,[_0xf5f2('0x2c'),_0xf5f2('0x6e')]);_0x58213b[_0xf5f2('0x46')]=_0xf5f2('0x6e');_0x20ccb6=as[_0xf5f2('0x6f')](_0x3dc0c4,_0x57782c['type'],_0x58213b);_0x27c472[_0x11a083](_0x20ccb6[_0xf5f2('0x68')],_0x20ccb6[_0xf5f2('0x64')][_0xf5f2('0x69')],_0x20ccb6[_0xf5f2('0x64')][_0xf5f2('0x1f')]);}break;case'body':_0x20ccb6=as[_0xf5f2('0x6f')]('me',null,_0x58213b);_0x27c472[_0x11a083](_0x20ccb6['text'],_0x20ccb6['value'][_0xf5f2('0x69')],_0x20ccb6['value'][_0xf5f2('0x1f')]);break;}}else{var _0x20ccb6=as[_0xf5f2('0x6f')](_0x3dc0c4,_0x57782c[_0xf5f2('0x37')],_0x58213b);_0x27c472[_0x11a083](_0x20ccb6['text'],_0x20ccb6[_0xf5f2('0x64')][_0xf5f2('0x69')],_0x20ccb6[_0xf5f2('0x64')][_0xf5f2('0x1f')]);}}}else{var _0x15b680=_(_0xf503e8[_0xf5f2('0x39')])[_0xf5f2('0x70')]()['map'](function(_0x1f55af){return _[_0xf5f2('0x71')](_0x3930fb,[_0xf5f2('0x2c'),_0x1f55af])?_0x1f55af:undefined;})[_0xf5f2('0x72')]()['value']();if(!_[_0xf5f2('0x73')](_0x15b680)){_0x15b680['forEach'](function(_0x410866){if(_0x410866===_0xf5f2('0x74')){_0x31bf0e['where'](_0xf5f2('0x75'),[][_0xf5f2('0x76')](_0xf503e8[_0xf5f2('0x39')][_0x410866]));}else if(_0x410866===_0xf5f2('0x77')){var _0x146462=JSON['parse'](_0xf503e8[_0xf5f2('0x39')][_0x410866])[_0xf5f2('0x78')];var _0x3a0e75=JSON[_0xf5f2('0x79')](_0xf503e8[_0xf5f2('0x39')][_0x410866])[_0xf5f2('0x7a')];_0x31bf0e['where'](_0xf5f2('0x7b'),_0x146462,_0x3a0e75);}else{if(_0xf503e8[_0xf5f2('0x39')][_0x410866]==='null'){_0x31bf0e[_0xf5f2('0x44')]('i.'+_0x410866+_0xf5f2('0x7c'));}else{_0x31bf0e[_0xf5f2('0x44')]('i.'+_0x410866+'\x20=\x20?',_0xf503e8['query'][_0x410866]);}}});}if(_0xf503e8['query'][_0xf5f2('0x7d')]){if(_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x7d')]==0x1){_0x31bf0e[_0xf5f2('0x5f')](_0xf5f2('0x7e'));}else{_0x31bf0e['having'](_0xf5f2('0x7f'));}}if(_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x80')]){_0x14aa81=_[_0xf5f2('0x81')](_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x80')])?_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x80')]:new Array(_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x80')]);_0x14aa81[_0xf5f2('0x2f')](function(_0x5679bc){_0x533cca['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5679bc+',%');});}if(_0xf503e8['query'][_0xf5f2('0x82')]){var _0xafba8e=_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x82')][_0xf5f2('0x83')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xf5f2('0x84')](_0xafba8e)){_0x27c472['or'](_0xf5f2('0x85'),_0xafba8e+'%')['or'](_0xf5f2('0x86'),_0xafba8e+'%');}else{_0x27c472['or'](_0xf5f2('0x87'),qs[_0xf5f2('0x66')](_0xafba8e))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xafba8e+'%');}}}_0x31bf0e[_0xf5f2('0x44')](_0x27c472);_0x31bf0e[_0xf5f2('0x88')]('i.id');var _0x777098={'type':db[_0xf5f2('0x89')][_0xf5f2('0x8a')][_0xf5f2('0x8b')],'raw':!![]};var _0x588434=_0x31bf0e[_0xf5f2('0x8c')]();_0x588434[_0xf5f2('0x46')](_0xf5f2('0x8d'));_0x588434[_0xf5f2('0x46')](_0xf5f2('0x8e'),'unreadMessages');if(_0x3fc168['order']){_0x3fc168[_0xf5f2('0x42')][_0xf5f2('0x2f')](function(_0x17eb69){var _0xe3ea1e=_0x17eb69[0x0]==='contactName'?_0x17eb69[0x0]:'i.'+_0x17eb69[0x0];_0x31bf0e['order'](_0xe3ea1e,_0x17eb69[0x1]===_0xf5f2('0x8f')?![]:!![]);});}if(!_['isEmpty'](_0x14aa81)){_0x31bf0e['having'](_0x533cca);_0x588434['where']('t.id\x20IN\x20?',_0x14aa81);}BPromise[_0xf5f2('0x90')]()[_0xf5f2('0x28')](function(){if(!_0x497eb8){if(_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x74')])return;_0x588434[_0xf5f2('0x44')](_0xf5f2('0x91'));_0x31bf0e[_0xf5f2('0x44')](_0xf5f2('0x91'));return;}if(_0xf503e8[_0xf5f2('0x92')][_0xf5f2('0x93')]!==_0xf5f2('0x94'))return;return _0xf503e8[_0xf5f2('0x92')][_0xf5f2('0x95')]({'attributes':['id'],'raw':!![]})[_0xf5f2('0x28')](function(_0x796b01){if(_[_0xf5f2('0x73')](_0x796b01)){_0x588434[_0xf5f2('0x44')](_0xf5f2('0x96'));_0x31bf0e['where'](_0xf5f2('0x96'));}else{_0x588434[_0xf5f2('0x44')](_0xf5f2('0x75'),_[_0xf5f2('0x34')](_0x796b01,'id'));_0x31bf0e[_0xf5f2('0x44')](_0xf5f2('0x75'),_[_0xf5f2('0x34')](_0x796b01,'id'));}});})[_0xf5f2('0x28')](function(){if(_0xf503e8['user'][_0xf5f2('0x93')]==='agent'&&!_0x497eb8&&!_0xf503e8['query']['WhatsappAccountId'])return[];return db['sequelize']['query'](_0x588434['toString'](),_0x777098);})[_0xf5f2('0x28')](function(_0x18ce86){_0x18ae07[_0xf5f2('0x21')]=_0x18ce86[_0xf5f2('0x3f')];if(_0x18ae07[_0xf5f2('0x21')]===0x0)return[];return db[_0xf5f2('0x97')]['query'](_0x4c8d8e['toString'](),_0x777098)[_0xf5f2('0x28')](function(_0x578a22){_0x2ad13c=_[_0xf5f2('0x98')](_0x578a22,'id');_0x777098=_[_0xf5f2('0x99')](_0x777098,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xf503e8['query'][_0xf5f2('0x3e')]){_0x3fc168[_0xf5f2('0x3c')]['forEach'](function(_0x1c624f){_0x31bf0e[_0xf5f2('0x46')]('i.'+_0x1c624f);});}else{_0x31bf0e['field'](_0xf5f2('0x8e'),_0xf5f2('0x9a'));_0x31bf0e[_0xf5f2('0x46')]('a.key',_0xf5f2('0x9b'));_0x31bf0e[_0xf5f2('0x46')](_0xf5f2('0x9c'),_0xf5f2('0x9d'));_0x31bf0e[_0xf5f2('0x46')](_0xf5f2('0x9e'),_0xf5f2('0x9f'));_0x31bf0e[_0xf5f2('0x46')](_0xf5f2('0xa0'));_0x31bf0e[_0xf5f2('0x46')](_0xf5f2('0xa1'),_0xf5f2('0xa2'));_0x31bf0e[_0xf5f2('0x46')](_0xf5f2('0xa3'),_0xf5f2('0xa4'));_0x31bf0e[_0xf5f2('0x46')](_0xf5f2('0xa5'),_0xf5f2('0xa6'));_0x31bf0e[_0xf5f2('0x46')](_0xf5f2('0xa7'),_0xf5f2('0xa8'));_0x31bf0e['field'](_0xf5f2('0xa9'),_0xf5f2('0xaa'));_0x31bf0e['field'](_0xf5f2('0xab'),_0xf5f2('0xac'));_0x31bf0e['field'](_0xf5f2('0xad'),_0xf5f2('0xae'));_0x31bf0e[_0xf5f2('0x46')]('o.internal','Owner.internal');_0x31bf0e[_0xf5f2('0x46')](_0xf5f2('0xaf'),_0xf5f2('0x2e'));}if(_0x3fc168['limit'])_0x31bf0e['limit'](_0x3fc168[_0xf5f2('0x23')]);if(_0x3fc168[_0xf5f2('0x22')])_0x31bf0e[_0xf5f2('0x22')](_0x3fc168['offset']);return db['sequelize']['query'](_0x31bf0e['toString'](),_0x777098);})['then'](function(_0x4e884b){_0x40c322['where'](_0xf5f2('0xb0'),_[_0xf5f2('0x34')](_0x4e884b,'id'));return db[_0xf5f2('0x97')][_0xf5f2('0x39')](_0x40c322[_0xf5f2('0xb1')](),_0x777098)[_0xf5f2('0x28')](function(_0xa10f88){var _0x40e921=_[_0xf5f2('0xb2')](_0xa10f88,_0xf5f2('0xb3'));var _0x1bb4ac=[];_0x4e884b[_0xf5f2('0x2f')](function(_0x10c982){_0x1bb4ac['push'](updateWhatsappInteraction(_0x10c982,_0x2ad13c,_0x40e921));});return BPromise[_0xf5f2('0xb4')](_0x1bb4ac);});});})[_0xf5f2('0x28')](function(_0x5783e2){_0x18ae07[_0xf5f2('0xb5')]=_0x5783e2;return _0x18ae07;})[_0xf5f2('0x28')](respondWithFilteredResult(_0x55989d,_0x3fc168))['catch'](handleError(_0x55989d,null));};exports[_0xf5f2('0xb6')]=function(_0xfe9cf5,_0x281f61){var _0x4bd9e8={'raw':![],'where':{'id':_0xfe9cf5[_0xf5f2('0xb7')]['id']}},_0x21c5fc={};_0x21c5fc['model']=_[_0xf5f2('0x70')](db[_0xf5f2('0x35')][_0xf5f2('0xb8')]);_0x21c5fc['query']=_[_0xf5f2('0x70')](_0xfe9cf5['query']);_0x21c5fc[_0xf5f2('0x3a')]=_['intersection'](_0x21c5fc[_0xf5f2('0x3b')],_0x21c5fc[_0xf5f2('0x39')]);_0x4bd9e8[_0xf5f2('0x3c')]=_[_0xf5f2('0x3d')](_0x21c5fc['model'],qs[_0xf5f2('0x3e')](_0xfe9cf5['query']['fields']));_0x4bd9e8['attributes']=_0x4bd9e8[_0xf5f2('0x3c')][_0xf5f2('0x3f')]?_0x4bd9e8['attributes']:_0x21c5fc[_0xf5f2('0x3b')];if(_0xfe9cf5[_0xf5f2('0x39')][_0xf5f2('0xb9')]){_0x4bd9e8[_0xf5f2('0xba')]=[{'all':!![]}];}_0x4bd9e8=_[_0xf5f2('0x99')]({},_0x4bd9e8,_0xfe9cf5[_0xf5f2('0xbb')]);return db['WhatsappInteraction'][_0xf5f2('0x5e')](_0x4bd9e8)[_0xf5f2('0x28')](handleEntityNotFound(_0x281f61,null))['then'](respondWithResult(_0x281f61,null))[_0xf5f2('0x32')](handleError(_0x281f61,null));};exports[_0xf5f2('0xbc')]=function(_0x58042c,_0x32301a){return db[_0xf5f2('0x35')][_0xf5f2('0xbc')](_0x58042c[_0xf5f2('0xbd')],{})[_0xf5f2('0x28')](respondWithResult(_0x32301a,0xc9))[_0xf5f2('0x32')](handleError(_0x32301a,null));};exports['update']=function(_0x3f8452,_0x5a8af6){if(_0x3f8452[_0xf5f2('0xbd')]['id']){delete _0x3f8452[_0xf5f2('0xbd')]['id'];}return db[_0xf5f2('0x35')][_0xf5f2('0x5e')]({'where':{'id':_0x3f8452[_0xf5f2('0xb7')]['id']}})[_0xf5f2('0x28')](handleEntityNotFound(_0x5a8af6,null))[_0xf5f2('0x28')](saveUpdates(_0x3f8452['body'],null))[_0xf5f2('0x28')](respondWithResult(_0x5a8af6,null))[_0xf5f2('0x32')](handleError(_0x5a8af6,null));};exports[_0xf5f2('0x29')]=function(_0x934a7d,_0x35fe1a){return db[_0xf5f2('0x35')][_0xf5f2('0x5e')]({'where':{'id':_0x934a7d[_0xf5f2('0xb7')]['id']}})[_0xf5f2('0x28')](handleEntityNotFound(_0x35fe1a,null))[_0xf5f2('0x28')](removeEntity(_0x35fe1a,null))['catch'](handleError(_0x35fe1a,null));};exports['describe']=function(_0x2076c7,_0x46e2c6){return db[_0xf5f2('0x35')][_0xf5f2('0xbe')]()['then'](respondWithResult(_0x46e2c6,null))[_0xf5f2('0x32')](handleError(_0x46e2c6,null));};exports[_0xf5f2('0xbf')]=function(_0x3bb238,_0x3d7f53,_0x456a1e){return db['WhatsappMessage'][_0xf5f2('0x5e')]({'where':{'id':_0x3bb238[_0xf5f2('0xb7')]['id']}})['then'](handleEntityNotFound(_0x3d7f53,null))[_0xf5f2('0x28')](function(_0x3ff714){if(_0x3ff714){return _0x3ff714[_0xf5f2('0xbf')](_0x3bb238[_0xf5f2('0xbd')]['ids'],_[_0xf5f2('0xc0')](_0x3bb238[_0xf5f2('0xbd')],[_0xf5f2('0xc1'),'id'])||{});}})['then'](respondWithResult(_0x3d7f53,null))['catch'](handleError(_0x3d7f53,null));};exports[_0xf5f2('0xc2')]=function(_0x2a082c,_0x1432ef,_0x46aa62){var _0xbe2fb6={'raw':![],'where':{}};var _0x1a5d90={};var _0x58711d={'count':0x0,'rows':[]};return db[_0xf5f2('0x35')]['findOne']({'where':{'id':_0x2a082c[_0xf5f2('0xb7')]['id']}})[_0xf5f2('0x28')](handleEntityNotFound(_0x1432ef,null))[_0xf5f2('0x28')](function(_0xa74467){if(_0xa74467){_0x1a5d90[_0xf5f2('0x3b')]=_[_0xf5f2('0x70')](db['WhatsappMessage'][_0xf5f2('0xb8')]);_0x1a5d90[_0xf5f2('0x39')]=_[_0xf5f2('0x70')](_0x2a082c[_0xf5f2('0x39')]);_0x1a5d90[_0xf5f2('0x3a')]=_[_0xf5f2('0x3d')](_0x1a5d90[_0xf5f2('0x3b')],_0x1a5d90['query']);_0xbe2fb6[_0xf5f2('0x3c')]=_['intersection'](_0x1a5d90['model'],qs['fields'](_0x2a082c[_0xf5f2('0x39')][_0xf5f2('0x3e')]));_0xbe2fb6['attributes']=_0xbe2fb6[_0xf5f2('0x3c')][_0xf5f2('0x3f')]?_0xbe2fb6[_0xf5f2('0x3c')]:_0x1a5d90[_0xf5f2('0x3b')];if(!_0x2a082c['query'][_0xf5f2('0x40')](_0xf5f2('0x41'))){_0xbe2fb6[_0xf5f2('0x23')]=qs['limit'](_0x2a082c[_0xf5f2('0x39')][_0xf5f2('0x23')]);_0xbe2fb6['offset']=qs[_0xf5f2('0x22')](_0x2a082c[_0xf5f2('0x39')][_0xf5f2('0x22')]);}_0xbe2fb6[_0xf5f2('0x42')]=qs[_0xf5f2('0x43')](_0x2a082c[_0xf5f2('0x39')][_0xf5f2('0x43')]);_0xbe2fb6[_0xf5f2('0x44')]=qs[_0xf5f2('0x3a')](_[_0xf5f2('0xc3')](_0x2a082c[_0xf5f2('0x39')],_0x1a5d90['filters']));_0xbe2fb6[_0xf5f2('0x44')][_0xf5f2('0xb3')]=_0xa74467['id'];if(_0x2a082c['query'][_0xf5f2('0x82')]){_0xbe2fb6['where']=_[_0xf5f2('0x99')](_0xbe2fb6[_0xf5f2('0x44')],{'$or':_[_0xf5f2('0x34')](_0xbe2fb6[_0xf5f2('0x3c')],function(_0x57157a){var _0x451711={};_0x451711[_0x57157a]={'$like':'%'+_0x2a082c['query'][_0xf5f2('0x82')]+'%'};return _0x451711;})});}if(_0x2a082c['query'][_0xf5f2('0x78')]){var _0xde71c=_0x2a082c['query'][_0xf5f2('0x78')][_0xf5f2('0x6b')](',');var _0x16619b={};_0x16619b[_0xde71c[0x0]]={'$gte':moment(_0xde71c[0x1])[_0xf5f2('0xc4')](_0xf5f2('0xc5'))};_0xbe2fb6[_0xf5f2('0x44')]=_['merge'](_0xbe2fb6['where'],_0x16619b);}_0xbe2fb6=_[_0xf5f2('0x99')]({},_0xbe2fb6,_0x2a082c[_0xf5f2('0xbb')]);return db['WhatsappMessage'][_0xf5f2('0x21')]({'where':_0xbe2fb6[_0xf5f2('0x44')]})[_0xf5f2('0x28')](function(_0x1b4690){_0x58711d[_0xf5f2('0x21')]=_0x1b4690;if(_0x2a082c[_0xf5f2('0x39')][_0xf5f2('0xb9')]){_0xbe2fb6['include']=[{'all':!![]}];}return db[_0xf5f2('0xc6')]['findAll'](_0xbe2fb6);})[_0xf5f2('0x28')](function(_0x5ec0f3){_0x58711d[_0xf5f2('0xb5')]=_0x5ec0f3;return _0x58711d;});}})['then'](respondWithFilteredResult(_0x1432ef,_0xbe2fb6))[_0xf5f2('0x32')](handleError(_0x1432ef,null));};exports['addTags']=function(_0x51fd11,_0x2c285c,_0x2cfb98){return db['WhatsappInteraction'][_0xf5f2('0x5e')]({'where':{'id':_0x51fd11[_0xf5f2('0xb7')]['id']}})[_0xf5f2('0x28')](handleEntityNotFound(_0x2c285c,null))[_0xf5f2('0x28')](function(_0x1d1588){if(_0x1d1588){return _0x1d1588[_0xf5f2('0xc7')](_0x51fd11[_0xf5f2('0xbd')][_0xf5f2('0xc1')],_['omit'](_0x51fd11['body'],[_0xf5f2('0xc1'),'id'])||{})['spread'](function(){return db[_0xf5f2('0x6a')][_0xf5f2('0xc8')]({'attributes':['id',_0xf5f2('0x2c'),_0xf5f2('0x47')],'where':{'id':_0x51fd11[_0xf5f2('0xbd')][_0xf5f2('0xc1')]}});})[_0xf5f2('0x28')](function(_0x63dc22){socket[_0xf5f2('0xc9')](_0xf5f2('0xca'),{'id':Number(_0x51fd11[_0xf5f2('0xb7')]['id']),'tags':_0x63dc22||[]});return{'id':Number(_0x51fd11[_0xf5f2('0xb7')]['id']),'tags':_0x63dc22||[]};});}})['then'](respondWithResult(_0x2c285c,null))[_0xf5f2('0x32')](handleError(_0x2c285c,null));};exports['removeTags']=function(_0x12c153,_0x3910f9,_0x131fa8){return db[_0xf5f2('0x35')][_0xf5f2('0x5e')]({'where':{'id':_0x12c153[_0xf5f2('0xb7')]['id']}})[_0xf5f2('0x28')](handleEntityNotFound(_0x3910f9,null))[_0xf5f2('0x28')](function(_0x29db4f){if(_0x29db4f){return _0x29db4f[_0xf5f2('0xcb')](_0x12c153[_0xf5f2('0x39')]['ids']);}})[_0xf5f2('0x28')](respondWithStatusCode(_0x3910f9,null))[_0xf5f2('0x32')](handleError(_0x3910f9,null));};exports[_0xf5f2('0xcc')]=function(_0x18d4ce,_0x339035){var _0x3f8794=moment()[_0xf5f2('0xcd')]()['toString']();var _0x179995=path[_0xf5f2('0xce')](config[_0xf5f2('0xcf')],_0xf5f2('0xd0'),_0xf5f2('0xd1'),_0xf5f2('0xd2'));var _0x1b90d7=path[_0xf5f2('0xce')](config[_0xf5f2('0xcf')],_0xf5f2('0xd0'),_0xf5f2('0xd1'),_0xf5f2('0xd3'));var _0x15a94c=path[_0xf5f2('0xce')](_0x179995,_0x3f8794);var _0x140b28=util[_0xf5f2('0xc4')]('transcript-%d-%s.zip',_0x18d4ce[_0xf5f2('0xb7')]['id'],_0x3f8794);var _0x316162=path['join'](_0x179995,_0x140b28);var _0x59a477=[];_0x59a477[_0xf5f2('0x31')]({'model':db[_0xf5f2('0x6d')],'as':_0xf5f2('0x6d'),'attributes':['id',_0xf5f2('0x2d')],'raw':!![]});_0x59a477['push']({'model':db[_0xf5f2('0xd4')],'as':_0xf5f2('0x61'),'attributes':['id',_0xf5f2('0xd5'),_0xf5f2('0xd6')],'raw':!![]});if(_0x18d4ce[_0xf5f2('0x39')][_0xf5f2('0xd3')]){_0x59a477['push']({'model':db[_0xf5f2('0xd7')],'as':'Attachment','raw':!![]});}var _0x4f3dd0=[{'model':db[_0xf5f2('0xc6')],'as':_0xf5f2('0xd8'),'attributes':['id',_0xf5f2('0xbd'),_0xf5f2('0x77'),_0xf5f2('0xd9'),_0xf5f2('0xda'),_0xf5f2('0x7d')],'include':_0x59a477}];_0x4f3dd0['push']({'model':db[_0xf5f2('0xdb')],'as':_0xf5f2('0xdc'),'attributes':['id',_0xf5f2('0x2c')]});_0x4f3dd0['push']({'model':db[_0xf5f2('0x6d')],'as':'Owner','attributes':['id','fullname']});return db[_0xf5f2('0x35')]['find']({'where':{'id':_0x18d4ce[_0xf5f2('0xb7')]['id']},'include':_0x4f3dd0})[_0xf5f2('0x28')](handleEntityNotFound(_0x339035,null))['then'](function(_0x6cf15f){if(_0x6cf15f){var _0xdf8f44=_0x6cf15f['get']({'plain':!![]});fs[_0xf5f2('0xdd')](_0x15a94c);var _0xf60679={'format':'A4','border':_0xf5f2('0xde'),'header':{'height':_0xf5f2('0xdf'),'contents':{'first':_0xf5f2('0xe0')}},'footer':{'height':'30px','contents':{'default':util[_0xf5f2('0xc4')](_0xf5f2('0xe1'),util['format']('%s\x20#%d',_0xf5f2('0xe2'),_0xdf8f44['id']),moment()[_0xf5f2('0xc4')](_0xf5f2('0xe3'))[_0xf5f2('0xb1')]())}}};var _0x1f51d8={'channel':_0xf5f2('0xe2'),'account':_0xdf8f44[_0xf5f2('0xdc')][_0xf5f2('0x2c')],'agent':_0xdf8f44['Owner']?_0xdf8f44['Owner'][_0xf5f2('0x2d')]:'N.A.','createdAt':moment(_0xdf8f44[_0xf5f2('0x77')])[_0xf5f2('0xc4')](_0xf5f2('0xc5'))[_0xf5f2('0xb1')](),'closedAt':_0xdf8f44['closed']?moment(_0xdf8f44[_0xf5f2('0xe4')])[_0xf5f2('0xc4')](_0xf5f2('0xc5'))[_0xf5f2('0xb1')]():'','disposition':_0xdf8f44[_0xf5f2('0xe5')],'messages':_(_0xdf8f44['Messages'])[_0xf5f2('0x82')]({'secret':![]})[_0xf5f2('0x34')](function(_0x378009){if(_0x378009[_0xf5f2('0xd7')]){var _0x404ac7=path[_0xf5f2('0xce')](_0x1b90d7,_0x378009[_0xf5f2('0xd7')][_0xf5f2('0xe6')]);if(fs[_0xf5f2('0xe7')](_0x404ac7)){fs[_0xf5f2('0xe8')](_0x404ac7)[_0xf5f2('0xe9')](fs[_0xf5f2('0xea')](path['join'](_0x15a94c,_0x378009[_0xf5f2('0xd7')]['basename'])));}}return{'date':moment(_0x378009[_0xf5f2('0x77')])[_0xf5f2('0xc4')](_0xf5f2('0xc5'))[_0xf5f2('0xb1')](),'sender':_0x378009[_0xf5f2('0xd9')]===_0xf5f2('0xeb')?_0x378009[_0xf5f2('0x6d')]?_0x378009[_0xf5f2('0x6d')][_0xf5f2('0x2d')]:_0xf5f2('0xec'):_0x378009[_0xf5f2('0x61')][_0xf5f2('0xd5')]+(_0x378009[_0xf5f2('0x61')][_0xf5f2('0xd6')]?'\x20'+_0x378009[_0xf5f2('0x61')][_0xf5f2('0xd6')]:''),'body':_0x378009[_0xf5f2('0xd7')]?_0x378009[_0xf5f2('0xd7')]['basename']:_0x378009[_0xf5f2('0xbd')],'direction':_0x378009['direction']==='out'?'A':'C','secret':_0x378009[_0xf5f2('0xda')],'read':_0x378009[_0xf5f2('0x7d')],'attachment':_0x378009['Attachment']};})[_0xf5f2('0x64')]()};return ejs[_0xf5f2('0xed')](path[_0xf5f2('0xce')](config[_0xf5f2('0xcf')],_0xf5f2('0xd0'),_0xf5f2('0xee'),_0xf5f2('0xef')),{'interaction':_0x1f51d8})[_0xf5f2('0x28')](function(_0x5b64c5){return new BPromise(function(_0x3cabf8,_0x27f99){pdf[_0xf5f2('0xbc')](_0x5b64c5,_0xf60679)['toFile'](path[_0xf5f2('0xce')](_0x15a94c,_0xf5f2('0xf0')+_0xdf8f44['id']+'-'+_0x3f8794+_0xf5f2('0xf1')),function(_0x2aac82,_0x52d3e9){if(_0x2aac82)return _0x27f99(_0x2aac82);_0x3cabf8(_0x52d3e9);});});})['then'](function(){return new BPromise(function(_0x3ece47,_0x3d7497){zipdir(_0x15a94c,{'saveTo':_0x316162},function(_0x46a0ee,_0x346693){if(_0x46a0ee)return _0x3d7497(_0x46a0ee);return _0x3ece47(_0x346693);});})[_0xf5f2('0x28')](function(){return new BPromise(function(_0x46f940,_0x2cead8){rimraf(_0x15a94c,function(_0x106f50){if(_0x106f50)_0x2cead8(_0x106f50);return _0x46f940();});});})[_0xf5f2('0x28')](function(){return _0x339035[_0xf5f2('0xcc')](_0x316162,_0x140b28,function(_0x59070b){if(_0x59070b){console[_0xf5f2('0xf2')](_0xf5f2('0xf3'),_0x59070b);}else{fs[_0xf5f2('0xf4')](_0x316162);}});});});}else{return _0x339035['sendStatus'](0xc8);}})[_0xf5f2('0x32')](handleError(_0x339035,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index c3b6b0e..d7ffcfd 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 _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 +var _0xec64=['then','setDataValue','Users','map','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','getUsers'];(function(_0x578c22,_0x3b816f){var _0x50fe10=function(_0x21d25){while(--_0x21d25){_0x578c22['push'](_0x578c22['shift']());}};_0x50fe10(++_0x3b816f);}(_0xec64,0xb4));var _0x4ec6=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0xec64[_0xdd2bfa];return _0x55397e;};'use strict';var EventEmitter=require(_0x4ec6('0x0'));var WhatsappInteraction=require(_0x4ec6('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x4ec6('0x1'))['db'][_0x4ec6('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x4ec6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4ec6('0x4'),'afterDestroy':_0x4ec6('0x5')};function emitEvent(_0xdba419){return function(_0x2b336f,_0x434b35,_0x57d903){_0x2b336f[_0x4ec6('0x6')]({'attributes':['id'],'raw':!![]})[_0x4ec6('0x7')](function(_0x5bae9a){_0x2b336f[_0x4ec6('0x8')](_0x4ec6('0x9'),_0x5bae9a[_0x4ec6('0xa')](function(_0x2ecd48){return{'id':_0x2ecd48['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x2b336f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x31979f){_0x2b336f['setDataValue'](_0x4ec6('0xb'),_0x31979f[_0x4ec6('0xc')]);WhatsappInteractionEvents[_0x4ec6('0xd')](_0xdba419+':'+_0x2b336f['id'],_0x2b336f);WhatsappInteractionEvents[_0x4ec6('0xd')](_0xdba419,_0x2b336f);_0x57d903(null);})[_0x4ec6('0xe')](_0x57d903(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x4ec6('0xf')](e,emitEvent(event));}}module[_0x4ec6('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 5dc0bfb..6757cb2 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 _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 +var _0x9e87=['moment','request-promise','rimraf','../../config/environment','define','WhatsappInteraction','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api'];(function(_0x5dbca3,_0x4eb5e0){var _0x502942=function(_0x27016d){while(--_0x27016d){_0x5dbca3['push'](_0x5dbca3['shift']());}};_0x502942(++_0x4eb5e0);}(_0x9e87,0x169));var _0x79e8=function(_0x15d409,_0x16c2ee){_0x15d409=_0x15d409-0x0;var _0x379106=_0x9e87[_0x15d409];return _0x379106;};'use strict';var _=require(_0x79e8('0x0'));var util=require('util');var logger=require(_0x79e8('0x1'))(_0x79e8('0x2'));var moment=require(_0x79e8('0x3'));var BPromise=require('bluebird');var rp=require(_0x79e8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79e8('0x5'));var config=require(_0x79e8('0x6'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x39a4bb,_0x2bc042){return _0x39a4bb[_0x79e8('0x7')](_0x79e8('0x8'),attributes,{'tableName':_0x79e8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x44061c,_0x4ea183,_0x2b5fb0){if(_0x44061c[_0x79e8('0xa')](_0x79e8('0xb'))){_0x44061c['closedAt']=moment()[_0x79e8('0xc')](_0x79e8('0xd'));}_0x2b5fb0(null,_0x44061c);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index a83b51a..c4339c7 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 _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 +var _0x1e9c=['client','http','redis','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappInteraction','update','body','options','where','UpdateWhatsappInteraction','debug','AddTagsToWhatsappInteraction','find','addTags','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x13e093,_0x5970c3){var _0x5b3634=function(_0x460f16){while(--_0x460f16){_0x13e093['push'](_0x13e093['shift']());}};_0x5b3634(++_0x5970c3);}(_0x1e9c,0x6e));var _0xc1e9=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x1e9c[_0x26462c];return _0x509a42;};'use strict';var _=require(_0xc1e9('0x0'));var util=require('util');var moment=require(_0xc1e9('0x1'));var BPromise=require('bluebird');var rs=require(_0xc1e9('0x2'));var fs=require('fs');var Redis=require(_0xc1e9('0x3'));var db=require(_0xc1e9('0x4'))['db'];var utils=require(_0xc1e9('0x5'));var logger=require(_0xc1e9('0x6'))(_0xc1e9('0x7'));var config=require(_0xc1e9('0x8'));var jayson=require(_0xc1e9('0x9'));var client=jayson[_0xc1e9('0xa')][_0xc1e9('0xb')]({'port':0x232a});config[_0xc1e9('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc1e9('0xd'))(new Redis(config[_0xc1e9('0xc')]));require(_0xc1e9('0xe'))[_0xc1e9('0xf')](socket);function respondWithRpcPromise(_0x332d08,_0x4e713f,_0x1cc07b){return new BPromise(function(_0x5107d7,_0x26c484){return client[_0xc1e9('0x10')](_0x332d08,_0x1cc07b)[_0xc1e9('0x11')](function(_0x2906fc){logger[_0xc1e9('0x12')](_0xc1e9('0x13'),_0x4e713f,_0xc1e9('0x14'));logger['debug'](_0xc1e9('0x15'),_0x4e713f,_0xc1e9('0x14'),JSON[_0xc1e9('0x16')](_0x2906fc));if(_0x2906fc[_0xc1e9('0x17')]){if(_0x2906fc[_0xc1e9('0x17')][_0xc1e9('0x18')]===0x1f4){logger[_0xc1e9('0x17')](_0xc1e9('0x13'),_0x4e713f,_0x2906fc[_0xc1e9('0x17')][_0xc1e9('0x19')]);return _0x26c484(_0x2906fc[_0xc1e9('0x17')][_0xc1e9('0x19')]);}logger[_0xc1e9('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x4e713f,_0x2906fc[_0xc1e9('0x17')][_0xc1e9('0x19')]);return _0x5107d7(_0x2906fc[_0xc1e9('0x17')][_0xc1e9('0x19')]);}else{logger['info'](_0xc1e9('0x13'),_0x4e713f,_0xc1e9('0x14'));_0x5107d7(_0x2906fc[_0xc1e9('0x1a')][_0xc1e9('0x19')]);}})[_0xc1e9('0x1b')](function(_0x17d10c){logger[_0xc1e9('0x17')](_0xc1e9('0x13'),_0x4e713f,_0x17d10c);_0x26c484(_0x17d10c);});});}exports['UpdateWhatsappInteraction']=function(_0x11458c){var _0x446c18=this;return new Promise(function(_0x401f80,_0x1a84d7){return db[_0xc1e9('0x1c')][_0xc1e9('0x1d')](_0x11458c[_0xc1e9('0x1e')],{'raw':_0x11458c[_0xc1e9('0x1f')]?_0x11458c[_0xc1e9('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11458c['options']?_0x11458c[_0xc1e9('0x1f')][_0xc1e9('0x20')]||null:null,'attributes':_0x11458c[_0xc1e9('0x1f')]?_0x11458c[_0xc1e9('0x1f')]['attributes']||null:null,'limit':_0x11458c['options']?_0x11458c['options']['limit']||null:null})[_0xc1e9('0x11')](function(_0x30c4ec){logger[_0xc1e9('0x12')](_0xc1e9('0x21'),_0x11458c);logger[_0xc1e9('0x22')](_0xc1e9('0x21'),_0x11458c,JSON[_0xc1e9('0x16')](_0x30c4ec));_0x401f80(_0x30c4ec);})[_0xc1e9('0x1b')](function(_0x56333b){logger[_0xc1e9('0x17')](_0xc1e9('0x21'),_0x56333b[_0xc1e9('0x19')],_0x11458c);_0x1a84d7(_0x446c18['error'](0x1f4,_0x56333b[_0xc1e9('0x19')]));});});};exports[_0xc1e9('0x23')]=function(_0x4fa972){return new Promise(function(_0x3d89c8,_0x4067e5){return db['WhatsappInteraction'][_0xc1e9('0x24')]({'where':_0x4fa972[_0xc1e9('0x1f')]?_0x4fa972['options'][_0xc1e9('0x20')]||null:null})['then'](function(_0x52a60a){if(_0x52a60a){return _0x52a60a[_0xc1e9('0x25')](_0x4fa972['body']['ids'],_['omit'](_0x4fa972['body'],['ids','id'])||{});}})[_0xc1e9('0x26')](function(_0x1de23f){logger[_0xc1e9('0x12')](_0xc1e9('0x27'),_0x4fa972);logger['debug']('AddTags',_0x4fa972,JSON[_0xc1e9('0x16')](_0x1de23f));_0x3d89c8(_0x1de23f);})[_0xc1e9('0x1b')](function(_0x2a3a1b){logger[_0xc1e9('0x17')](_0xc1e9('0x27'),_0x2a3a1b[_0xc1e9('0x19')],_0x4fa972);_0x4067e5(_this['error'](0x1f4,_0x2a3a1b[_0xc1e9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 2d4dba2..e2c5f7c 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 _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 +var _0x684d=['save','update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x470ede,_0x244451){var _0x369ab1=function(_0x32cbee){while(--_0x32cbee){_0x470ede['push'](_0x470ede['shift']());}};_0x369ab1(++_0x244451);}(_0x684d,0x1c7));var _0xd684=function(_0x5e1535,_0x40409c){_0x5e1535=_0x5e1535-0x0;var _0x3399c9=_0x684d[_0x5e1535];return _0x3399c9;};'use strict';var WhatsappInteractionEvents=require(_0xd684('0x0'));var events=[_0xd684('0x1'),'remove',_0xd684('0x2')];function createListener(_0x3effe7,_0x552c12){return function(_0x356240){_0x552c12[_0xd684('0x3')](_0x3effe7,_0x356240);};}function removeListener(_0x3b212c,_0x330d7a){return function(){WhatsappInteractionEvents[_0xd684('0x4')](_0x3b212c,_0x330d7a);};}exports[_0xd684('0x5')]=function(_0x51341b){for(var _0x254378=0x0,_0x44064a=events[_0xd684('0x6')];_0x254378<_0x44064a;_0x254378++){var _0x1c736e=events[_0x254378];var _0x54b26a=createListener(_0xd684('0x7')+_0x1c736e,_0x51341b);WhatsappInteractionEvents['on'](_0x1c736e,_0x54b26a);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index a8ef3b8..9306c97 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 _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 +var _0x3633=['accept','/:id/reject','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id/accept'];(function(_0x550f80,_0x2d7260){var _0x2159d9=function(_0x3416e3){while(--_0x3416e3){_0x550f80['push'](_0x550f80['shift']());}};_0x2159d9(++_0x2d7260);}(_0x3633,0x148));var _0x3363=function(_0x18ff4e,_0x4a94dc){_0x18ff4e=_0x18ff4e-0x0;var _0xe63e7b=_0x3633[_0x18ff4e];return _0xe63e7b;};'use strict';var multer=require(_0x3363('0x0'));var util=require('util');var path=require(_0x3363('0x1'));var timeout=require(_0x3363('0x2'));var express=require(_0x3363('0x3'));var router=express[_0x3363('0x4')]();var auth=require(_0x3363('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3363('0x6'));var controller=require(_0x3363('0x7'));router[_0x3363('0x8')]('/',auth['isAuthenticated'](),controller[_0x3363('0x9')]);router['get'](_0x3363('0xa'),auth[_0x3363('0xb')](),controller[_0x3363('0xc')]);router[_0x3363('0x8')](_0x3363('0xd'),auth[_0x3363('0xb')](),controller[_0x3363('0xe')]);router[_0x3363('0xf')]('/',auth[_0x3363('0xb')](),interaction['tracked'](_0x3363('0x10'),_0x3363('0x11')),controller[_0x3363('0x12')]);router[_0x3363('0xf')](_0x3363('0x13'),controller[_0x3363('0x14')]);router[_0x3363('0x15')]('/:id',auth[_0x3363('0xb')](),controller['update']);router[_0x3363('0x15')](_0x3363('0x16'),auth[_0x3363('0xb')](),controller[_0x3363('0x17')]);router[_0x3363('0x15')](_0x3363('0x18'),auth[_0x3363('0xb')](),controller['reject']);router['delete'](_0x3363('0xd'),auth[_0x3363('0xb')](),controller[_0x3363('0x19')]);module[_0x3363('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 1215b5c..ebff40b 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 _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 +var _0x849d=['medium','ENUM','out','BOOLEAN','STRING','sequelize','exports','TEXT'];(function(_0x11bac4,_0x4b137c){var _0x445507=function(_0x43ea0c){while(--_0x43ea0c){_0x11bac4['push'](_0x11bac4['shift']());}};_0x445507(++_0x4b137c);}(_0x849d,0x16d));var _0xd849=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x849d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd849('0x0'));module[_0xd849('0x1')]={'body':{'type':Sequelize[_0xd849('0x2')](_0xd849('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd849('0x4')]('in','out'),'defaultValue':_0xd849('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xd849('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd849('0x7')]},'providerResponse':{'type':Sequelize[_0xd849('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 935b2a4..b854fdc 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 _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 +var _0x42f4=['EventManager','acceptmessage','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SIP/%s','channel','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../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','./whatsappMessage.socket','register','jayson/promise','client','http','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','then','destroy','stack','name','send','map','rawAttributes','type','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappMessage','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','update','describe','whatsapp','read','UserId','user','agent','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','null','AcceptMessage','acceptMessage','manual','interface','event','accept'];(function(_0x2dd471,_0x51a6af){var _0x200f68=function(_0x1891d4){while(--_0x1891d4){_0x2dd471['push'](_0x2dd471['shift']());}};_0x200f68(++_0x51a6af);}(_0x42f4,0x19d));var _0x442f=function(_0x5aef17,_0x592cd4){_0x5aef17=_0x5aef17-0x0;var _0x43f9d0=_0x42f4[_0x5aef17];return _0x43f9d0;};'use strict';var pdf=require(_0x442f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x442f('0x1'));var zipdir=require(_0x442f('0x2'));var jsonpatch=require(_0x442f('0x3'));var rp=require(_0x442f('0x4'));var moment=require(_0x442f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x442f('0x6'));var sox=require(_0x442f('0x7'));var csv=require('to-csv');var ejs=require(_0x442f('0x8'));var fs=require('fs');var _=require(_0x442f('0x9'));var squel=require(_0x442f('0xa'));var crypto=require(_0x442f('0xb'));var jsforce=require(_0x442f('0xc'));var deskjs=require(_0x442f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x442f('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x442f('0xf'));var as=require(_0x442f('0x10'));var hardwareService=require(_0x442f('0x11'));var logger=require(_0x442f('0x12'))(_0x442f('0x13'));var utils=require(_0x442f('0x14'));var config=require(_0x442f('0x15'));var licenseUtil=require(_0x442f('0x16'));var db=require(_0x442f('0x17'))['db'];config[_0x442f('0x18')]=_['defaults'](config[_0x442f('0x18')],{'host':_0x442f('0x19'),'port':0x18eb});var socket=require(_0x442f('0x1a'))(new Redis(config[_0x442f('0x18')]));require(_0x442f('0x1b'))[_0x442f('0x1c')](socket);var jayson=require(_0x442f('0x1d'));var client=jayson[_0x442f('0x1e')][_0x442f('0x1f')]({'port':0x232c});var client9002=jayson[_0x442f('0x1e')][_0x442f('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3d075a,_0x42fb1b,_0x2f0ff8,_0x23fe2e){return new BPromise(function(_0x3ff2b1,_0x5ee97b){var _0xa37e23=_0x23fe2e||client;return _0xa37e23['request'](_0x3d075a,_0x2f0ff8)['then'](function(_0x5668e0){logger['info'](_0x442f('0x20'),_0x42fb1b,_0x442f('0x21'));logger[_0x442f('0x22')](_0x442f('0x23'),_0x42fb1b,_0x442f('0x21'),JSON[_0x442f('0x24')](_0x5668e0));if(_0x5668e0['error']){if(_0x5668e0[_0x442f('0x25')]['code']===0x1f4){logger[_0x442f('0x25')](_0x442f('0x20'),_0x42fb1b,_0x5668e0[_0x442f('0x25')]['message']);return _0x5ee97b(_0x5668e0[_0x442f('0x25')][_0x442f('0x26')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x42fb1b,_0x5668e0[_0x442f('0x25')][_0x442f('0x26')]);return _0x3ff2b1(_0x5668e0[_0x442f('0x25')][_0x442f('0x26')]);}else{logger[_0x442f('0x27')](_0x442f('0x20'),_0x42fb1b,_0x442f('0x21'));_0x3ff2b1(_0x5668e0[_0x442f('0x28')][_0x442f('0x26')]);}})['catch'](function(_0x393eed){logger[_0x442f('0x25')](_0x442f('0x20'),_0x42fb1b,_0x393eed);_0x5ee97b(_0x393eed);});});}function respondWithStatusCode(_0x2d3cd5,_0x495f74){_0x495f74=_0x495f74||0xcc;return function(_0x10b312){if(_0x10b312){return _0x2d3cd5[_0x442f('0x29')](_0x495f74);}return _0x2d3cd5[_0x442f('0x2a')](_0x495f74)[_0x442f('0x2b')]();};}function respondWithResult(_0x55c9dc,_0x5ee478){_0x5ee478=_0x5ee478||0xc8;return function(_0x23fccf){if(_0x23fccf){return _0x55c9dc[_0x442f('0x2a')](_0x5ee478)['json'](_0x23fccf);}};}function respondWithFilteredResult(_0x37da9d,_0x5a272e){return function(_0x95dbe4){if(_0x95dbe4){var _0x36abd2=_0x95dbe4[_0x442f('0x2c')],_0x75f990=_0x5a272e[_0x442f('0x2d')],_0x539643=_0x5a272e[_0x442f('0x2d')]+_0x5a272e[_0x442f('0x2e')],_0x367ae0;if(_0x539643>=_0x36abd2){_0x539643=_0x36abd2;_0x367ae0=0xc8;}else{_0x367ae0=0xce;}_0x37da9d['status'](_0x367ae0);return _0x37da9d['set'](_0x442f('0x2f'),_0x75f990+'-'+_0x539643+'/'+_0x36abd2)['json'](_0x95dbe4);}return null;};}function patchUpdates(_0x253cf0){return function(_0x1ee1c2){try{jsonpatch[_0x442f('0x30')](_0x1ee1c2,_0x253cf0,!![]);}catch(_0x1b9a60){return BPromise[_0x442f('0x31')](_0x1b9a60);}return _0x1ee1c2[_0x442f('0x32')]();};}function saveUpdates(_0x44ac9b,_0x225f38){return function(_0x14b275){if(_0x14b275){return _0x14b275['update'](_0x44ac9b)[_0x442f('0x33')](function(_0x5459cb){return _0x5459cb;});}return null;};}function removeEntity(_0x67b48d,_0x30df94){return function(_0x53c0a0){if(_0x53c0a0){return _0x53c0a0[_0x442f('0x34')]()[_0x442f('0x33')](function(){_0x67b48d[_0x442f('0x2a')](0xcc)[_0x442f('0x2b')]();});}};}function handleEntityNotFound(_0x195946,_0x4fd8ed){return function(_0x318f34){if(!_0x318f34){_0x195946[_0x442f('0x29')](0x194);}return _0x318f34;};}function handleError(_0x257d03,_0x12d02b){_0x12d02b=_0x12d02b||0x1f4;return function(_0x185b05){logger['error'](_0x185b05[_0x442f('0x35')]);if(_0x185b05[_0x442f('0x36')]){delete _0x185b05['name'];}_0x257d03[_0x442f('0x2a')](_0x12d02b)[_0x442f('0x37')](_0x185b05);};}exports['index']=function(_0x41113f,_0x70e0a1){var _0x10bcf3={},_0x1e6266={},_0x396d5e={'count':0x0,'rows':[]};var _0x3ad24f=_[_0x442f('0x38')](db['WhatsappMessage'][_0x442f('0x39')],function(_0x40cc18){return{'name':_0x40cc18['fieldName'],'type':_0x40cc18[_0x442f('0x3a')]['key']};});_0x1e6266[_0x442f('0x3b')]=_[_0x442f('0x38')](_0x3ad24f,_0x442f('0x36'));_0x1e6266['query']=_['keys'](_0x41113f['query']);_0x1e6266[_0x442f('0x3c')]=_[_0x442f('0x3d')](_0x1e6266[_0x442f('0x3b')],_0x1e6266[_0x442f('0x3e')]);_0x10bcf3[_0x442f('0x3f')]=_[_0x442f('0x3d')](_0x1e6266['model'],qs[_0x442f('0x40')](_0x41113f[_0x442f('0x3e')][_0x442f('0x40')]));_0x10bcf3[_0x442f('0x3f')]=_0x10bcf3[_0x442f('0x3f')]['length']?_0x10bcf3['attributes']:_0x1e6266['model'];if(!_0x41113f['query'][_0x442f('0x41')](_0x442f('0x42'))){_0x10bcf3['limit']=qs[_0x442f('0x2e')](_0x41113f[_0x442f('0x3e')]['limit']);_0x10bcf3[_0x442f('0x2d')]=qs['offset'](_0x41113f[_0x442f('0x3e')][_0x442f('0x2d')]);}_0x10bcf3['order']=qs[_0x442f('0x43')](_0x41113f[_0x442f('0x3e')][_0x442f('0x43')]);_0x10bcf3[_0x442f('0x44')]=qs[_0x442f('0x3c')](_[_0x442f('0x45')](_0x41113f[_0x442f('0x3e')],_0x1e6266['filters']),_0x3ad24f);if(_0x41113f[_0x442f('0x3e')][_0x442f('0x46')]){_0x10bcf3[_0x442f('0x44')]=_[_0x442f('0x47')](_0x10bcf3[_0x442f('0x44')],{'$or':_[_0x442f('0x38')](_0x3ad24f,function(_0x1e93d8){if(_0x1e93d8[_0x442f('0x3a')]!==_0x442f('0x48')){var _0xa6602={};_0xa6602[_0x1e93d8[_0x442f('0x36')]]={'$like':'%'+_0x41113f[_0x442f('0x3e')]['filter']+'%'};return _0xa6602;}})});}_0x10bcf3=_[_0x442f('0x47')]({},_0x10bcf3,_0x41113f[_0x442f('0x49')]);var _0x1cecf8={'where':_0x10bcf3[_0x442f('0x44')]};return db[_0x442f('0x4a')][_0x442f('0x2c')](_0x1cecf8)[_0x442f('0x33')](function(_0x3c2736){_0x396d5e[_0x442f('0x2c')]=_0x3c2736;if(_0x41113f[_0x442f('0x3e')][_0x442f('0x4b')]){_0x10bcf3[_0x442f('0x4c')]=[{'all':!![]}];}return db[_0x442f('0x4a')][_0x442f('0x4d')](_0x10bcf3);})[_0x442f('0x33')](function(_0x54dcc8){_0x396d5e[_0x442f('0x4e')]=_0x54dcc8;return _0x396d5e;})[_0x442f('0x33')](respondWithFilteredResult(_0x70e0a1,_0x10bcf3))['catch'](handleError(_0x70e0a1,null));};exports[_0x442f('0x4f')]=function(_0x237234,_0x56f9d3){var _0x3f8b0f={'raw':!![],'where':{'id':_0x237234[_0x442f('0x50')]['id']}},_0xf80e44={};_0xf80e44[_0x442f('0x3b')]=_['keys'](db['WhatsappMessage']['rawAttributes']);_0xf80e44[_0x442f('0x3e')]=_[_0x442f('0x51')](_0x237234[_0x442f('0x3e')]);_0xf80e44[_0x442f('0x3c')]=_[_0x442f('0x3d')](_0xf80e44[_0x442f('0x3b')],_0xf80e44['query']);_0x3f8b0f[_0x442f('0x3f')]=_[_0x442f('0x3d')](_0xf80e44[_0x442f('0x3b')],qs[_0x442f('0x40')](_0x237234[_0x442f('0x3e')][_0x442f('0x40')]));_0x3f8b0f[_0x442f('0x3f')]=_0x3f8b0f[_0x442f('0x3f')][_0x442f('0x52')]?_0x3f8b0f['attributes']:_0xf80e44[_0x442f('0x3b')];if(_0x237234[_0x442f('0x3e')][_0x442f('0x4b')]){_0x3f8b0f[_0x442f('0x4c')]=[{'all':!![]}];}_0x3f8b0f=_[_0x442f('0x47')]({},_0x3f8b0f,_0x237234['options']);return db[_0x442f('0x4a')][_0x442f('0x53')](_0x3f8b0f)[_0x442f('0x33')](handleEntityNotFound(_0x56f9d3,null))['then'](respondWithResult(_0x56f9d3,null))[_0x442f('0x54')](handleError(_0x56f9d3,null));};exports[_0x442f('0x55')]=function(_0x218a3e,_0x5d201e){return db[_0x442f('0x4a')]['create'](_0x218a3e[_0x442f('0x56')],{})[_0x442f('0x33')](respondWithResult(_0x5d201e,0xc9))[_0x442f('0x54')](handleError(_0x5d201e,null));};exports[_0x442f('0x57')]=function(_0x3fd129,_0x3e2a84){if(_0x3fd129[_0x442f('0x56')]['id']){delete _0x3fd129[_0x442f('0x56')]['id'];}return db[_0x442f('0x4a')]['find']({'where':{'id':_0x3fd129[_0x442f('0x50')]['id']}})['then'](handleEntityNotFound(_0x3e2a84,null))[_0x442f('0x33')](saveUpdates(_0x3fd129[_0x442f('0x56')],null))['then'](respondWithResult(_0x3e2a84,null))['catch'](handleError(_0x3e2a84,null));};exports[_0x442f('0x34')]=function(_0x33624b,_0x33a9d2){return db[_0x442f('0x4a')]['find']({'where':{'id':_0x33624b['params']['id']}})[_0x442f('0x33')](handleEntityNotFound(_0x33a9d2,null))[_0x442f('0x33')](removeEntity(_0x33a9d2,null))['catch'](handleError(_0x33a9d2,null));};exports[_0x442f('0x58')]=function(_0x35f247,_0x280ea0){return db[_0x442f('0x4a')][_0x442f('0x58')]()['then'](respondWithResult(_0x280ea0,null))[_0x442f('0x54')](handleError(_0x280ea0,null));};var interaction_log=require(_0x442f('0x12'))('whatsapp-interactions');exports['accept']=function(_0x2813d1,_0xd95af8,_0x1f65e4){var _0x4830e3={'agent':{},'channel':_0x442f('0x59')};if(_0x2813d1[_0x442f('0x56')]['id']){delete _0x2813d1[_0x442f('0x56')]['id'];}_0x2813d1['body'][_0x442f('0x5a')]=!![];_0x2813d1['body']['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2813d1[_0x442f('0x56')][_0x442f('0x5b')]=_0x2813d1[_0x442f('0x56')][_0x442f('0x5b')]||_0x2813d1[_0x442f('0x5c')]['id'];_0x4830e3[_0x442f('0x5d')]['id']=_0x2813d1[_0x442f('0x56')][_0x442f('0x5b')];return db['WhatsappMessage'][_0x442f('0x53')]({'where':{'id':_0x2813d1[_0x442f('0x50')]['id'],'UserId':null},'include':[{'model':db[_0x442f('0x5e')],'as':_0x442f('0x5f')}]})[_0x442f('0x33')](handleEntityNotFound(_0xd95af8,null))[_0x442f('0x33')](saveUpdates(_0x2813d1[_0x442f('0x56')],null))[_0x442f('0x33')](function(_0xe3b8e7){if(_0xe3b8e7){_0x4830e3['message']=_0xe3b8e7[_0x442f('0x60')]({'plain':!![]});return db[_0x442f('0x61')][_0x442f('0x53')]({'where':{'id':_0xe3b8e7[_0x442f('0x62')]}});}return null;})[_0x442f('0x33')](handleEntityNotFound(_0xd95af8,null))[_0x442f('0x33')](function(_0x34721b){if(_0x34721b){return _0x34721b['update']({'UserId':_0x2813d1['body'][_0x442f('0x5b')],'read1stAt':_[_0x442f('0x63')](_0x34721b[_0x442f('0x64')])?moment()[_0x442f('0x65')](_0x442f('0x66')):undefined});}return null;})['then'](function(_0xa89eca){if(_0xa89eca){_0x4830e3[_0x442f('0x67')]=_0xa89eca[_0x442f('0x60')]({'plain':!![]});interaction_log[_0x442f('0x27')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2813d1[_0x442f('0x5c')]['id'],_0x2813d1[_0x442f('0x5c')]['name'],_0x2813d1['user']['role'],_0x4830e3[_0x442f('0x67')]['id'],_0x2813d1[_0x442f('0x56')]?JSON[_0x442f('0x24')](_0x2813d1[_0x442f('0x56')]):_0x442f('0x68'));return respondWithRpcPromise(_0x442f('0x69'),_0x442f('0x6a'),_0x4830e3);}return null;})[_0x442f('0x33')](function(_0xb958fb){if(_0xb958fb){if(_0x2813d1[_0x442f('0x56')][_0x442f('0x6b')]){_0x4830e3['message'][_0x442f('0x6c')]=util['format']('SIP/%s',_0x2813d1[_0x442f('0x5c')][_0x442f('0x36')]);_0x4830e3[_0x442f('0x26')]['channel']=_0x4830e3['channel'];_0x4830e3[_0x442f('0x26')][_0x442f('0x6d')]=_0x442f('0x6e');return respondWithRpcPromise(_0x442f('0x6f'),_0x442f('0x6f'),{'event':_0x442f('0x70'),'message':_0x4830e3[_0x442f('0x26')]},client9002)[_0x442f('0x33')](function(){return _0x4830e3;});}return _0x4830e3;}return null;})['then'](respondWithResult(_0xd95af8,null))['catch'](handleError(_0xd95af8,null));};var interaction_log=require(_0x442f('0x12'))(_0x442f('0x71'));exports[_0x442f('0x31')]=function(_0x4aee57,_0x141793,_0x5af59d){var _0x4d4620={'agent':{},'channel':_0x442f('0x59')};if(_0x4aee57[_0x442f('0x56')]['id']){delete _0x4aee57[_0x442f('0x56')]['id'];}_0x4aee57[_0x442f('0x56')][_0x442f('0x5b')]=_0x4aee57[_0x442f('0x56')][_0x442f('0x5b')]||_0x4aee57[_0x442f('0x5c')]['id'];_0x4d4620[_0x442f('0x5d')]['id']=_0x4aee57[_0x442f('0x56')][_0x442f('0x5b')];return db['WhatsappMessage'][_0x442f('0x53')]({'where':{'id':_0x4aee57[_0x442f('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x141793,null))[_0x442f('0x33')](function(_0x332194){if(_0x332194){_0x4d4620[_0x442f('0x26')]=_0x332194[_0x442f('0x60')]({'plain':!![]});return db[_0x442f('0x61')][_0x442f('0x53')]({'where':{'id':_0x332194[_0x442f('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x141793,null))[_0x442f('0x33')](function(_0x47a117){if(_0x47a117){_0x4d4620[_0x442f('0x67')]=_0x47a117[_0x442f('0x60')]({'plain':!![]});interaction_log[_0x442f('0x27')](_0x442f('0x72'),_0x4aee57[_0x442f('0x5c')]['id'],_0x4aee57[_0x442f('0x5c')][_0x442f('0x36')],_0x4aee57[_0x442f('0x5c')][_0x442f('0x73')],_0x4d4620[_0x442f('0x67')]['id'],_0x4aee57[_0x442f('0x56')]?JSON['stringify'](_0x4aee57[_0x442f('0x56')]):_0x442f('0x68'));return respondWithRpcPromise(_0x442f('0x74'),_0x442f('0x75'),_0x4d4620);}return null;})[_0x442f('0x33')](function(_0x7dacf5){if(_0x7dacf5){_0x7dacf5[_0x442f('0x26')]['interface']=util[_0x442f('0x65')](_0x442f('0x76'),_0x4aee57[_0x442f('0x5c')][_0x442f('0x36')]);_0x7dacf5[_0x442f('0x26')][_0x442f('0x77')]=_0x4d4620[_0x442f('0x77')];_0x7dacf5['message'][_0x442f('0x6d')]=_0x442f('0x31');respondWithRpcPromise(_0x442f('0x6f'),_0x442f('0x6f'),{'event':_0x442f('0x78'),'message':_0x7dacf5[_0x442f('0x26')]},client9002);return _0x4d4620;}return null;})[_0x442f('0x33')](respondWithResult(_0x141793,null))[_0x442f('0x54')](handleError(_0x141793,null));};exports['status']=function(_0x15d0d6,_0x35e4c0,_0x13e4c9){if(_0x15d0d6[_0x442f('0x56')]['id']){delete _0x15d0d6[_0x442f('0x56')]['id'];}var _0x56f66d;return db[_0x442f('0x4a')][_0x442f('0x53')]({'where':{'id':_0x15d0d6[_0x442f('0x50')]['id']}})[_0x442f('0x33')](handleEntityNotFound(_0x35e4c0,null))['then'](function(_0x12e5ba){if(_0x12e5ba){_0x56f66d=_0x12e5ba;return db[_0x442f('0x79')][_0x442f('0x53')]({'where':{'id':_0x12e5ba[_0x442f('0x7a')]}});}})['then'](handleEntityNotFound(_0x35e4c0,null))[_0x442f('0x33')](function(_0x56c861){if(_0x56c861){logger['debug'](_0x442f('0x7b'),_0x442f('0x2a'),_0x442f('0x7c'),_0x56c861['type'],util[_0x442f('0x7d')](_0x15d0d6[_0x442f('0x56')],{'showHidden':![],'depth':null}));switch(_0x56c861[_0x442f('0x3a')]){case _0x442f('0x7e'):if(_0x15d0d6[_0x442f('0x56')]['MessageSid']&&_0x15d0d6[_0x442f('0x56')][_0x442f('0x7f')]===_0x56f66d[_0x442f('0x80')]&&_0x15d0d6[_0x442f('0x56')][_0x442f('0x81')]&&_0x15d0d6['body']['MessageStatus']===_0x442f('0x5a')){return _0x56f66d[_0x442f('0x57')]({'read':!![]});}else{logger[_0x442f('0x25')](_0x442f('0x82'),_0x442f('0x2a'),_0x442f('0x7e'),util[_0x442f('0x7d')](_0x15d0d6[_0x442f('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x56f66d;}})[_0x442f('0x33')](respondWithResult(_0x35e4c0,null))[_0x442f('0x54')](handleError(_0x35e4c0,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index d007da9..6693b43 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_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 +var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x3e6ffb,_0x52b20a){var _0x55681d=function(_0x2945fb){while(--_0x2945fb){_0x3e6ffb['push'](_0x3e6ffb['shift']());}};_0x55681d(++_0x52b20a);}(_0xb10b,0x12a));var _0xbb10=function(_0x20e283,_0x2b5a6e){_0x20e283=_0x20e283-0x0;var _0x199e10=_0xb10b[_0x20e283];return _0x199e10;};'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 diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 6a414f4..121bd8c 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 _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 +var _0xd022=['get','direction','toLowerCase','out','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','secret','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','messageId','body','models'];(function(_0x1ca448,_0x112213){var _0xee2ac8=function(_0x5861ec){while(--_0x5861ec){_0x1ca448['push'](_0x1ca448['shift']());}};_0xee2ac8(++_0x112213);}(_0xd022,0x1c9));var _0x2d02=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xd022[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require(_0x2d02('0x0'));var logger=require('../../config/logger')(_0x2d02('0x1'));var moment=require(_0x2d02('0x2'));var BPromise=require(_0x2d02('0x3'));var rp=require(_0x2d02('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d02('0x5'));var config=require(_0x2d02('0x6'));var attributes=require(_0x2d02('0x7'));module['exports']=function(_0x15e435,_0x43f2e4){return _0x15e435[_0x2d02('0x8')](_0x2d02('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x2d02('0xa')]},{'name':'fti_whatsapp_messages','fields':[_0x2d02('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x48a4f0,_0x7bf1ad,_0x47c815){var _0x305e45=_0x15e435[_0x2d02('0xc')];var _0x390594=_0x48a4f0[_0x2d02('0xd')]({'plain':!![]});if(_0x390594[_0x2d02('0xe')][_0x2d02('0xf')]()==='in'||_0x390594[_0x2d02('0xe')][_0x2d02('0xf')]()===_0x2d02('0x10')&&!_0x390594['secret']&&!_[_0x2d02('0x11')](_0x390594['UserId'])){_0x305e45[_0x2d02('0x12')][_0x2d02('0x13')]({'where':{'id':_0x390594[_0x2d02('0x14')]}})[_0x2d02('0x15')](function(_0xf1a9ed){if(_0xf1a9ed){_0xf1a9ed[_0x2d02('0x16')]({'lastMsgAt':_0x390594[_0x2d02('0x17')],'lastMsgDirection':_0x390594[_0x2d02('0xe')][_0x2d02('0xf')]()});}})[_0x2d02('0x18')](function(_0x508ead){console[_0x2d02('0x19')](_0x508ead);});}if(_0x390594[_0x2d02('0xe')]===_0x2d02('0x10')&&!_0x390594[_0x2d02('0x1a')]){var _0x2466ea;_0x305e45['WhatsappAccount']['find']({'where':{'id':_0x390594[_0x2d02('0x1b')]},'raw':!![]})['then'](function(_0x47ea28){_0x2466ea=_0x47ea28;if(_0x2466ea&&_0x2466ea[_0x2d02('0x1c')]){switch(_0x2466ea[_0x2d02('0x1c')]){case _0x2d02('0x1d'):var _0x4982d2=require('twilio');if(_0x2466ea[_0x2d02('0x1e')]&&_0x2466ea['authToken']&&_0x2466ea['phone']){var _0x5c7685=new _0x4982d2(_0x2466ea[_0x2d02('0x1e')],_0x2466ea[_0x2d02('0x1f')]);_0x5c7685[_0x2d02('0x20')][_0x2d02('0x21')]({'body':_0x390594[_0x2d02('0xb')],'to':'whatsapp:'+_0x390594['phone'],'from':_0x2d02('0x22')+_0x2466ea[_0x2d02('0x23')],'statusCallback':_0x2466ea[_0x2d02('0x24')]+_0x2d02('0x25')+_0x390594['id']+_0x2d02('0x26')+_0x2466ea[_0x2d02('0x27')]})[_0x2d02('0x15')](function(_0x4b379b){if(_0x4b379b[_0x2d02('0x28')]){return _0x48a4f0[_0x2d02('0x16')]({'messageId':_0x4b379b[_0x2d02('0x28')]});}})[_0x2d02('0x18')](function(_0x56a7a1){logger[_0x2d02('0x19')](_0x2d02('0x29'),_0x2d02('0x2a'),_0x2d02('0x1d'),util['inspect'](_0x56a7a1,{'showHidden':![],'depth':null}));});}else{logger[_0x2d02('0x19')](_0x2d02('0x29'),_0x2d02('0x2a'),'twilio',_0x2d02('0x2b'));}break;}}})[_0x2d02('0x2c')](function(){_0x47c815();});}else{_0x47c815();}}},'charset':_0x2d02('0x2d'),'collate':_0x2d02('0x2e')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 29ee10e..4357007 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 _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 +var _0x3d33=['jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','request\x20sent','debug','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','result','body','options','CreateWhatsappMessage','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x33cf93,_0x1f7083){var _0x54fc2b=function(_0x190fde){while(--_0x190fde){_0x33cf93['push'](_0x33cf93['shift']());}};_0x54fc2b(++_0x1f7083);}(_0x3d33,0x16b));var _0x33d3=function(_0x553bf7,_0x4acdaa){_0x553bf7=_0x553bf7-0x0;var _0x24437f=_0x3d33[_0x553bf7];return _0x24437f;};'use strict';var _=require(_0x33d3('0x0'));var util=require(_0x33d3('0x1'));var moment=require(_0x33d3('0x2'));var BPromise=require('bluebird');var rs=require(_0x33d3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x33d3('0x4'))['db'];var utils=require(_0x33d3('0x5'));var logger=require(_0x33d3('0x6'))(_0x33d3('0x7'));var config=require(_0x33d3('0x8'));var jayson=require(_0x33d3('0x9'));var client=jayson['client'][_0x33d3('0xa')]({'port':0x232a});config['redis']=_[_0x33d3('0xb')](config[_0x33d3('0xc')],{'host':_0x33d3('0xd'),'port':0x18eb});var socket=require(_0x33d3('0xe'))(new Redis(config['redis']));require(_0x33d3('0xf'))[_0x33d3('0x10')](socket);function respondWithRpcPromise(_0x2c2127,_0x2bf501,_0x4d061d){return new BPromise(function(_0x298f95,_0x895eb2){return client[_0x33d3('0x11')](_0x2c2127,_0x4d061d)[_0x33d3('0x12')](function(_0x56ae6d){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x2bf501,_0x33d3('0x13'));logger[_0x33d3('0x14')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x2bf501,_0x33d3('0x13'),JSON['stringify'](_0x56ae6d));if(_0x56ae6d[_0x33d3('0x15')]){if(_0x56ae6d[_0x33d3('0x15')][_0x33d3('0x16')]===0x1f4){logger[_0x33d3('0x15')](_0x33d3('0x17'),_0x2bf501,_0x56ae6d[_0x33d3('0x15')][_0x33d3('0x18')]);return _0x895eb2(_0x56ae6d['error']['message']);}logger[_0x33d3('0x15')](_0x33d3('0x17'),_0x2bf501,_0x56ae6d[_0x33d3('0x15')][_0x33d3('0x18')]);return _0x298f95(_0x56ae6d[_0x33d3('0x15')]['message']);}else{logger[_0x33d3('0x19')]('WhatsappMessage,\x20%s,\x20%s',_0x2bf501,'request\x20sent');_0x298f95(_0x56ae6d[_0x33d3('0x1a')][_0x33d3('0x18')]);}})['catch'](function(_0x3a9d4a){logger['error'](_0x33d3('0x17'),_0x2bf501,_0x3a9d4a);_0x895eb2(_0x3a9d4a);});});}exports['CreateWhatsappMessage']=function(_0xc10473){var _0x1d75d9=this;return new Promise(function(_0x31c34b,_0x237918){return db['WhatsappMessage']['create'](_0xc10473[_0x33d3('0x1b')],{'raw':_0xc10473[_0x33d3('0x1c')]?_0xc10473[_0x33d3('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3e75f9){logger[_0x33d3('0x19')]('CreateWhatsappMessage',_0xc10473);logger[_0x33d3('0x14')](_0x33d3('0x1d'),_0xc10473,JSON['stringify'](_0x3e75f9));_0x31c34b(_0x3e75f9);})[_0x33d3('0x1e')](function(_0x516b52){logger['error'](_0x33d3('0x1d'),_0x516b52[_0x33d3('0x18')],_0xc10473);_0x237918(_0x1d75d9[_0x33d3('0x15')](0x1f4,_0x516b52[_0x33d3('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index c866d53..9c7a253 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 _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 +var _0xc13f=['register','length','whatsappMessage:','save','remove','update','emit','removeListener'];(function(_0x372515,_0xdd11f){var _0xa3bf4e=function(_0x212cc8){while(--_0x212cc8){_0x372515['push'](_0x372515['shift']());}};_0xa3bf4e(++_0xdd11f);}(_0xc13f,0x1c3));var _0xfc13=function(_0x386885,_0x309fbc){_0x386885=_0x386885-0x0;var _0xd23949=_0xc13f[_0x386885];return _0xd23949;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xfc13('0x0'),_0xfc13('0x1'),_0xfc13('0x2')];function createListener(_0x2cf3ed,_0x2f69b3){return function(_0x1f65e0){_0x2f69b3[_0xfc13('0x3')](_0x2cf3ed,_0x1f65e0);};}function removeListener(_0x37a6cc,_0x2629ce){return function(){WhatsappMessageEvents[_0xfc13('0x4')](_0x37a6cc,_0x2629ce);};}exports[_0xfc13('0x5')]=function(_0xc78059){for(var _0x34891c=0x0,_0x3f11a3=events[_0xfc13('0x6')];_0x34891c<_0x3f11a3;_0x34891c++){var _0x2244a9=events[_0x34891c];var _0x478886=createListener(_0xfc13('0x7')+_0x2244a9,_0xc78059);WhatsappMessageEvents['on'](_0x2244a9,_0x478886);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 977225a..cb7b6dc 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 _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 +var _0x5726=['/:id/teams','addTeams','addAgents','/:id','destroy','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','describe','getMembers','getTeams','/:id/users','getAgents','create','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5726,0x17f));var _0x6572=function(_0x1e8637,_0x5d224f){_0x1e8637=_0x1e8637-0x0;var _0x588cf2=_0x5726[_0x1e8637];return _0x588cf2;};'use strict';var multer=require(_0x6572('0x0'));var util=require(_0x6572('0x1'));var path=require(_0x6572('0x2'));var timeout=require(_0x6572('0x3'));var express=require('express');var router=express[_0x6572('0x4')]();var auth=require(_0x6572('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6572('0x6'));var controller=require('./whatsappQueue.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6572('0x7')](_0x6572('0x8'),auth[_0x6572('0x9')](),controller[_0x6572('0xa')]);router[_0x6572('0x7')]('/:id',auth[_0x6572('0x9')](),controller['show']);router[_0x6572('0x7')]('/:id/members',auth[_0x6572('0x9')](),controller[_0x6572('0xb')]);router['get']('/:id/teams',auth[_0x6572('0x9')](),controller[_0x6572('0xc')]);router[_0x6572('0x7')](_0x6572('0xd'),auth['isAuthenticated'](),controller[_0x6572('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6572('0xf')]);router[_0x6572('0x10')](_0x6572('0x11'),auth[_0x6572('0x9')](),controller[_0x6572('0x12')]);router[_0x6572('0x10')](_0x6572('0xd'),auth[_0x6572('0x9')](),controller[_0x6572('0x13')]);router['put'](_0x6572('0x14'),auth[_0x6572('0x9')](),controller['update']);router['delete'](_0x6572('0x14'),auth['isAuthenticated'](),controller[_0x6572('0x15')]);router[_0x6572('0x16')](_0x6572('0x11'),auth['isAuthenticated'](),controller[_0x6572('0x17')]);router[_0x6572('0x16')]('/:id/users',auth[_0x6572('0x9')](),controller[_0x6572('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 3bf54a0..9daa828 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 _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 +var _0x24de=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x3d7734,_0x1da198){var _0x9dfc6f=function(_0x569a25){while(--_0x569a25){_0x3d7734['push'](_0x3d7734['shift']());}};_0x9dfc6f(++_0x1da198);}(_0x24de,0x1e7));var _0xe24d=function(_0x259860,_0x80f56d){_0x259860=_0x259860-0x0;var _0x599310=_0x24de[_0x259860];return _0x599310;};'use strict';var Sequelize=require(_0xe24d('0x0'));module[_0xe24d('0x1')]={'name':{'type':Sequelize[_0xe24d('0x2')],'unique':_0xe24d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xe24d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe24d('0x5')](_0xe24d('0x6'),_0xe24d('0x7'),_0xe24d('0x8'))},'description':{'type':Sequelize[_0xe24d('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 7f9731f..9f9653a 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 _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 +var _0x33cd=['save','update','then','destroy','WhatsappQueues','error','stack','send','map','rawAttributes','fieldName','type','key','model','name','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','count','include','WhatsappQueue','findAll','rows','catch','show','params','length','includeAll','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','findOne','UserWhatsappQueue','User','findAndCountAll','UserId','agent','createdAt','%s/%s','SIP','whatsappPause','updatedAt','getTeams','Team','ids','online','voicePause','flatMap','sequelize','transaction','addTeams','each','emit','userWhatsappQueue:save','removeTeams','Agents','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','toString','SELECT','every','includes','all','union','compact','value','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','fast-json-patch','request-promise','moment','mustache','util','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','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','reject'];(function(_0x1d040d,_0x4fab9b){var _0x57aac7=function(_0x12a0c3){while(--_0x12a0c3){_0x1d040d['push'](_0x1d040d['shift']());}};_0x57aac7(++_0x4fab9b);}(_0x33cd,0x179));var _0xd33c=function(_0x3dd63a,_0x4bdddf){_0x3dd63a=_0x3dd63a-0x0;var _0x1af397=_0x33cd[_0x3dd63a];return _0x1af397;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd33c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd33c('0x1'));var rp=require(_0xd33c('0x2'));var moment=require(_0xd33c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd33c('0x4'));var util=require(_0xd33c('0x5'));var path=require('path');var sox=require(_0xd33c('0x6'));var csv=require('to-csv');var ejs=require(_0xd33c('0x7'));var fs=require('fs');var _=require(_0xd33c('0x8'));var squel=require(_0xd33c('0x9'));var crypto=require(_0xd33c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd33c('0xb'));var toCsv=require(_0xd33c('0xc'));var querystring=require(_0xd33c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd33c('0xe'));var qs=require(_0xd33c('0xf'));var as=require(_0xd33c('0x10'));var hardwareService=require(_0xd33c('0x11'));var logger=require(_0xd33c('0x12'))(_0xd33c('0x13'));var utils=require('../../config/utils');var config=require(_0xd33c('0x14'));var licenseUtil=require(_0xd33c('0x15'));var db=require(_0xd33c('0x16'))['db'];config[_0xd33c('0x17')]=_['defaults'](config['redis'],{'host':_0xd33c('0x18'),'port':0x18eb});var socket=require(_0xd33c('0x19'))(new Redis(config['redis']));require(_0xd33c('0x1a'))[_0xd33c('0x1b')](socket);function respondWithStatusCode(_0x405a23,_0xc2b799){_0xc2b799=_0xc2b799||0xcc;return function(_0x4db7c){if(_0x4db7c){return _0x405a23[_0xd33c('0x1c')](_0xc2b799);}return _0x405a23['status'](_0xc2b799)[_0xd33c('0x1d')]();};}function respondWithResult(_0x4396c3,_0x5a083a){_0x5a083a=_0x5a083a||0xc8;return function(_0x11a7d4){if(_0x11a7d4){return _0x4396c3[_0xd33c('0x1e')](_0x5a083a)[_0xd33c('0x1f')](_0x11a7d4);}};}function respondWithFilteredResult(_0x5db04d,_0x40574f){return function(_0x48d833){if(_0x48d833){var _0x451f1f=_0x48d833['count'],_0x2f2eef=_0x40574f[_0xd33c('0x20')],_0x1ddcb1=_0x40574f['offset']+_0x40574f[_0xd33c('0x21')],_0x305026;if(_0x1ddcb1>=_0x451f1f){_0x1ddcb1=_0x451f1f;_0x305026=0xc8;}else{_0x305026=0xce;}_0x5db04d[_0xd33c('0x1e')](_0x305026);return _0x5db04d[_0xd33c('0x22')](_0xd33c('0x23'),_0x2f2eef+'-'+_0x1ddcb1+'/'+_0x451f1f)[_0xd33c('0x1f')](_0x48d833);}return null;};}function patchUpdates(_0x5852bd){return function(_0x104082){try{jsonpatch['apply'](_0x104082,_0x5852bd,!![]);}catch(_0x36e18b){return BPromise[_0xd33c('0x24')](_0x36e18b);}return _0x104082[_0xd33c('0x25')]();};}function saveUpdates(_0x15568c,_0x13e573){return function(_0x18f4f9){if(_0x18f4f9){return _0x18f4f9[_0xd33c('0x26')](_0x15568c)[_0xd33c('0x27')](function(_0xacd683){return _0xacd683;});}return null;};}function removeEntity(_0xa176d4,_0x4e9f0e){return function(_0x799cf0){if(_0x799cf0){return _0x799cf0[_0xd33c('0x28')]()['then'](function(){var _0x5911b8=_0x799cf0['get']({'plain':!![]});var _0x39ba48=_0xd33c('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x39ba48,'resourceId':_0x5911b8['id']}})['then'](function(){return _0x799cf0;});})[_0xd33c('0x27')](function(){_0xa176d4['status'](0xcc)[_0xd33c('0x1d')]();});}};}function handleEntityNotFound(_0x20f735,_0x5c1a41){return function(_0x5c7a7b){if(!_0x5c7a7b){_0x20f735['sendStatus'](0x194);}return _0x5c7a7b;};}function handleError(_0x336df1,_0x3579f1){_0x3579f1=_0x3579f1||0x1f4;return function(_0x3054f1){logger[_0xd33c('0x2a')](_0x3054f1[_0xd33c('0x2b')]);if(_0x3054f1['name']){delete _0x3054f1['name'];}_0x336df1[_0xd33c('0x1e')](_0x3579f1)[_0xd33c('0x2c')](_0x3054f1);};}exports['index']=function(_0xb364da,_0x25e989){var _0x2630d4={},_0x1304c9={},_0x435dee={'count':0x0,'rows':[]};var _0x23d4fa=_[_0xd33c('0x2d')](db['WhatsappQueue'][_0xd33c('0x2e')],function(_0x1239d0){return{'name':_0x1239d0[_0xd33c('0x2f')],'type':_0x1239d0[_0xd33c('0x30')][_0xd33c('0x31')]};});_0x1304c9[_0xd33c('0x32')]=_[_0xd33c('0x2d')](_0x23d4fa,_0xd33c('0x33'));_0x1304c9['query']=_[_0xd33c('0x34')](_0xb364da['query']);_0x1304c9['filters']=_[_0xd33c('0x35')](_0x1304c9[_0xd33c('0x32')],_0x1304c9[_0xd33c('0x36')]);_0x2630d4[_0xd33c('0x37')]=_[_0xd33c('0x35')](_0x1304c9[_0xd33c('0x32')],qs[_0xd33c('0x38')](_0xb364da[_0xd33c('0x36')][_0xd33c('0x38')]));_0x2630d4[_0xd33c('0x37')]=_0x2630d4[_0xd33c('0x37')]['length']?_0x2630d4['attributes']:_0x1304c9[_0xd33c('0x32')];if(!_0xb364da[_0xd33c('0x36')][_0xd33c('0x39')](_0xd33c('0x3a'))){_0x2630d4['limit']=qs[_0xd33c('0x21')](_0xb364da[_0xd33c('0x36')][_0xd33c('0x21')]);_0x2630d4[_0xd33c('0x20')]=qs[_0xd33c('0x20')](_0xb364da[_0xd33c('0x36')][_0xd33c('0x20')]);}_0x2630d4[_0xd33c('0x3b')]=qs[_0xd33c('0x3c')](_0xb364da['query']['sort']);_0x2630d4[_0xd33c('0x3d')]=qs['filters'](_[_0xd33c('0x3e')](_0xb364da[_0xd33c('0x36')],_0x1304c9[_0xd33c('0x3f')]),_0x23d4fa);if(_0xb364da[_0xd33c('0x36')][_0xd33c('0x40')]){_0x2630d4['where']=_[_0xd33c('0x41')](_0x2630d4[_0xd33c('0x3d')],{'$or':_[_0xd33c('0x2d')](_0x23d4fa,function(_0x3eb862){if(_0x3eb862['type']!==_0xd33c('0x42')){var _0x4bdf33={};_0x4bdf33[_0x3eb862[_0xd33c('0x33')]]={'$like':'%'+_0xb364da[_0xd33c('0x36')]['filter']+'%'};return _0x4bdf33;}})});}_0x2630d4=_[_0xd33c('0x41')]({},_0x2630d4,_0xb364da['options']);var _0x2023f6={'where':_0x2630d4['where']};return db['WhatsappQueue'][_0xd33c('0x43')](_0x2023f6)[_0xd33c('0x27')](function(_0x3c10f1){_0x435dee[_0xd33c('0x43')]=_0x3c10f1;if(_0xb364da['query']['includeAll']){_0x2630d4[_0xd33c('0x44')]=[{'all':!![]}];}return db[_0xd33c('0x45')][_0xd33c('0x46')](_0x2630d4);})[_0xd33c('0x27')](function(_0x163dce){_0x435dee[_0xd33c('0x47')]=_0x163dce;return _0x435dee;})['then'](respondWithFilteredResult(_0x25e989,_0x2630d4))[_0xd33c('0x48')](handleError(_0x25e989,null));};exports[_0xd33c('0x49')]=function(_0x737d1a,_0x4df7cb){var _0x5bab10={'raw':!![],'where':{'id':_0x737d1a[_0xd33c('0x4a')]['id']}},_0x2510b6={};_0x2510b6[_0xd33c('0x32')]=_[_0xd33c('0x34')](db[_0xd33c('0x45')][_0xd33c('0x2e')]);_0x2510b6[_0xd33c('0x36')]=_[_0xd33c('0x34')](_0x737d1a['query']);_0x2510b6['filters']=_[_0xd33c('0x35')](_0x2510b6[_0xd33c('0x32')],_0x2510b6[_0xd33c('0x36')]);_0x5bab10[_0xd33c('0x37')]=_[_0xd33c('0x35')](_0x2510b6[_0xd33c('0x32')],qs[_0xd33c('0x38')](_0x737d1a[_0xd33c('0x36')][_0xd33c('0x38')]));_0x5bab10[_0xd33c('0x37')]=_0x5bab10[_0xd33c('0x37')][_0xd33c('0x4b')]?_0x5bab10[_0xd33c('0x37')]:_0x2510b6['model'];if(_0x737d1a[_0xd33c('0x36')][_0xd33c('0x4c')]){_0x5bab10[_0xd33c('0x44')]=[{'all':!![]}];}_0x5bab10=_[_0xd33c('0x41')]({},_0x5bab10,_0x737d1a[_0xd33c('0x4d')]);return db[_0xd33c('0x45')]['find'](_0x5bab10)[_0xd33c('0x27')](handleEntityNotFound(_0x4df7cb,null))[_0xd33c('0x27')](respondWithResult(_0x4df7cb,null))[_0xd33c('0x48')](handleError(_0x4df7cb,null));};exports[_0xd33c('0x4e')]=function(_0x4481fe,_0x26930a){return db[_0xd33c('0x45')][_0xd33c('0x4e')](_0x4481fe[_0xd33c('0x4f')],{})['then'](function(_0x4f3955){var _0x3579aa=_0x4481fe[_0xd33c('0x50')][_0xd33c('0x51')]({'plain':!![]});if(!_0x3579aa)throw new Error(_0xd33c('0x52'));if(_0x3579aa[_0xd33c('0x53')]===_0xd33c('0x50')){var _0xbf74cc=_0x4f3955[_0xd33c('0x51')]({'plain':!![]});var _0x5c8d81=_0xd33c('0x29');return db[_0xd33c('0x54')][_0xd33c('0x55')]({'where':{'name':_0x5c8d81,'userProfileId':_0x3579aa[_0xd33c('0x56')]},'raw':!![]})['then'](function(_0x17269c){if(_0x17269c&&_0x17269c[_0xd33c('0x57')]===0x0){return db[_0xd33c('0x58')][_0xd33c('0x4e')]({'name':_0xbf74cc[_0xd33c('0x33')],'resourceId':_0xbf74cc['id'],'type':_0x17269c['name'],'sectionId':_0x17269c['id']},{})[_0xd33c('0x27')](function(){return _0x4f3955;});}else{return _0x4f3955;}})[_0xd33c('0x48')](function(_0xdfb221){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdfb221);throw _0xdfb221;});}return _0x4f3955;})['then'](respondWithResult(_0x26930a,0xc9))[_0xd33c('0x48')](handleError(_0x26930a,null));};exports[_0xd33c('0x26')]=function(_0x3ba8cc,_0x5e3a79){if(_0x3ba8cc[_0xd33c('0x4f')]['id']){delete _0x3ba8cc[_0xd33c('0x4f')]['id'];}return db['WhatsappQueue'][_0xd33c('0x55')]({'where':{'id':_0x3ba8cc[_0xd33c('0x4a')]['id']}})[_0xd33c('0x27')](handleEntityNotFound(_0x5e3a79,null))['then'](saveUpdates(_0x3ba8cc[_0xd33c('0x4f')],null))[_0xd33c('0x27')](respondWithResult(_0x5e3a79,null))['catch'](handleError(_0x5e3a79,null));};exports[_0xd33c('0x28')]=function(_0x248432,_0x489dfb){return db[_0xd33c('0x45')][_0xd33c('0x55')]({'where':{'id':_0x248432['params']['id']}})[_0xd33c('0x27')](handleEntityNotFound(_0x489dfb,null))[_0xd33c('0x27')](removeEntity(_0x489dfb,null))[_0xd33c('0x48')](handleError(_0x489dfb,null));};exports['describe']=function(_0x2c1763,_0x1bc6f7){return db['WhatsappQueue'][_0xd33c('0x59')]()[_0xd33c('0x27')](respondWithResult(_0x1bc6f7,null))[_0xd33c('0x48')](handleError(_0x1bc6f7,null));};exports[_0xd33c('0x5a')]=function(_0x285af8,_0x3ab9b2,_0x5270c8){var _0x2205e8={'raw':!![],'where':{}},_0xd8f29e={},_0x43451b;return db['WhatsappQueue'][_0xd33c('0x5b')]({'where':{'id':_0x285af8[_0xd33c('0x4a')]['id']}})[_0xd33c('0x27')](handleEntityNotFound(_0x3ab9b2,null))[_0xd33c('0x27')](function(_0x2d2bfb){if(_0x2d2bfb){_0x43451b=_0x2d2bfb['get']({'plain':!![]});_0xd8f29e['model']=_[_0xd33c('0x34')](db['UserWhatsappQueue'][_0xd33c('0x2e')]);_0xd8f29e[_0xd33c('0x36')]=_[_0xd33c('0x34')](_0x285af8[_0xd33c('0x36')]);_0xd8f29e[_0xd33c('0x3f')]=_[_0xd33c('0x35')](_0xd8f29e['model'],_0xd8f29e['query']);_0x2205e8[_0xd33c('0x37')]=_[_0xd33c('0x35')](_0xd8f29e[_0xd33c('0x32')],qs[_0xd33c('0x38')](_0x285af8[_0xd33c('0x36')][_0xd33c('0x38')]));_0x2205e8['attributes']=_0x2205e8[_0xd33c('0x37')][_0xd33c('0x4b')]?_0x2205e8[_0xd33c('0x37')]:_0xd8f29e[_0xd33c('0x32')];if(!_0x285af8[_0xd33c('0x36')][_0xd33c('0x39')](_0xd33c('0x3a'))){_0x2205e8[_0xd33c('0x21')]=qs[_0xd33c('0x21')](_0x285af8['query'][_0xd33c('0x21')]);_0x2205e8[_0xd33c('0x20')]=qs[_0xd33c('0x20')](_0x285af8[_0xd33c('0x36')][_0xd33c('0x20')]);}_0x2205e8[_0xd33c('0x3b')]=qs[_0xd33c('0x3c')](_0x285af8[_0xd33c('0x36')][_0xd33c('0x3c')]);_0x2205e8[_0xd33c('0x3d')]=qs['filters'](_[_0xd33c('0x3e')](_0x285af8[_0xd33c('0x36')],_0xd8f29e[_0xd33c('0x3f')]));_0x2205e8[_0xd33c('0x3d')]['WhatsappQueueId']=_0x2d2bfb['id'];if(_0x285af8['query']['filter']){_0x2205e8[_0xd33c('0x3d')]=_['merge'](_0x2205e8[_0xd33c('0x3d')],{'$or':_[_0xd33c('0x2d')](_0x2205e8['attributes'],function(_0x27473a){var _0xb39859={};_0xb39859[_0x27473a]={'$like':'%'+_0x285af8[_0xd33c('0x36')][_0xd33c('0x40')]+'%'};return _0xb39859;})});}_0x2205e8=_[_0xd33c('0x41')]({},_0x2205e8,_0x285af8[_0xd33c('0x4d')]);return db[_0xd33c('0x5c')][_0xd33c('0x46')](_0x2205e8);}})[_0xd33c('0x27')](function(_0xa6440b){if(_0xa6440b){return db[_0xd33c('0x5d')][_0xd33c('0x5e')]({'where':{'id':_[_0xd33c('0x2d')](_0xa6440b,_0xd33c('0x5f')),'role':_0xd33c('0x60')},'attributes':['id',_0xd33c('0x33'),'whatsappPause','updatedAt',_0xd33c('0x61')]});}})[_0xd33c('0x27')](function(_0x29801e){if(_0x29801e){return{'count':_0x29801e[_0xd33c('0x43')],'rows':_[_0xd33c('0x2d')](_0x29801e[_0xd33c('0x47')],function(_0x231881){return{'membername':_0x231881[_0xd33c('0x33')],'UserId':_0x231881['id'],'queue_name':_0x43451b[_0xd33c('0x33')],'WhatsappQueueId':_0x43451b['id'],'interface':util['format'](_0xd33c('0x62'),_0xd33c('0x63'),_0x231881[_0xd33c('0x33')]),'penalty':0x0,'paused':_0x231881[_0xd33c('0x64')],'createdAt':_0x231881[_0xd33c('0x61')],'updatedAt':_0x231881[_0xd33c('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd33c('0x27')](respondWithFilteredResult(_0x3ab9b2,_0x2205e8))[_0xd33c('0x48')](handleError(_0x3ab9b2,null));};exports[_0xd33c('0x66')]=function(_0x32541a,_0xb05399,_0x1e3c43){var _0x11d0c9={};var _0x5663b3={};var _0x466b57;var _0x3de8bd;return db[_0xd33c('0x45')][_0xd33c('0x5b')]({'where':{'id':_0x32541a[_0xd33c('0x4a')]['id']}})[_0xd33c('0x27')](handleEntityNotFound(_0xb05399,null))['then'](function(_0xb37dee){if(_0xb37dee){_0x466b57=_0xb37dee;_0x5663b3[_0xd33c('0x32')]=_[_0xd33c('0x34')](db[_0xd33c('0x67')][_0xd33c('0x2e')]);_0x5663b3[_0xd33c('0x36')]=_[_0xd33c('0x34')](_0x32541a['query']);_0x5663b3[_0xd33c('0x3f')]=_[_0xd33c('0x35')](_0x5663b3[_0xd33c('0x32')],_0x5663b3[_0xd33c('0x36')]);_0x11d0c9[_0xd33c('0x37')]=_[_0xd33c('0x35')](_0x5663b3[_0xd33c('0x32')],qs[_0xd33c('0x38')](_0x32541a[_0xd33c('0x36')][_0xd33c('0x38')]));_0x11d0c9[_0xd33c('0x37')]=_0x11d0c9['attributes'][_0xd33c('0x4b')]?_0x11d0c9[_0xd33c('0x37')]:_0x5663b3['model'];_0x11d0c9[_0xd33c('0x3b')]=qs[_0xd33c('0x3c')](_0x32541a[_0xd33c('0x36')][_0xd33c('0x3c')]);_0x11d0c9[_0xd33c('0x3d')]=qs[_0xd33c('0x3f')](_[_0xd33c('0x3e')](_0x32541a['query'],_0x5663b3[_0xd33c('0x3f')]));if(_0x32541a[_0xd33c('0x36')][_0xd33c('0x40')]){_0x11d0c9[_0xd33c('0x3d')]=_[_0xd33c('0x41')](_0x11d0c9[_0xd33c('0x3d')],{'$or':_[_0xd33c('0x2d')](_0x11d0c9[_0xd33c('0x37')],function(_0x4cecd5){var _0x20455f={};_0x20455f[_0x4cecd5]={'$like':'%'+_0x32541a[_0xd33c('0x36')][_0xd33c('0x40')]+'%'};return _0x20455f;})});}_0x11d0c9=_[_0xd33c('0x41')]({},_0x11d0c9,_0x32541a['options']);return _0x466b57[_0xd33c('0x66')](_0x11d0c9);}})[_0xd33c('0x27')](function(_0x2ea2c0){if(_0x2ea2c0){_0x3de8bd=_0x2ea2c0[_0xd33c('0x4b')];if(!_0x32541a['query']['hasOwnProperty']('nolimit')){_0x11d0c9[_0xd33c('0x21')]=qs[_0xd33c('0x21')](_0x32541a[_0xd33c('0x36')][_0xd33c('0x21')]);_0x11d0c9[_0xd33c('0x20')]=qs['offset'](_0x32541a[_0xd33c('0x36')][_0xd33c('0x20')]);}return _0x466b57[_0xd33c('0x66')](_0x11d0c9);}})[_0xd33c('0x27')](function(_0x4a7004){if(_0x4a7004){return _0x4a7004?{'count':_0x3de8bd,'rows':_0x4a7004}:null;}})[_0xd33c('0x27')](respondWithResult(_0xb05399,null))['catch'](handleError(_0xb05399,null));};exports['addTeams']=function(_0x5eaa18,_0x64029a,_0x3f5a48){var _0x25af62=_0x5eaa18[_0xd33c('0x4f')][_0xd33c('0x68')];return db[_0xd33c('0x67')][_0xd33c('0x46')]({'where':{'id':_0x25af62},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xd33c('0x33'),_0xd33c('0x69'),_0xd33c('0x6a'),'interface'],'raw':!![]}]})[_0xd33c('0x27')](function(_0x3e839){if(_0x3e839){var _0x5a2eb8=_[_0xd33c('0x6b')](_0x3e839,function(_0xb3292d){var _0x37b854=_0xb3292d['get']({'plain':!![]});return _0x37b854['Agents'];});return db['WhatsappQueue'][_0xd33c('0x55')]({'where':{'id':_0x5eaa18[_0xd33c('0x4a')]['id']}})['then'](function(_0x409e4c){return db[_0xd33c('0x6c')][_0xd33c('0x6d')](function(_0x4e094e){return _0x409e4c[_0xd33c('0x6e')](_0x25af62,{'transaction':_0x4e094e})[_0xd33c('0x27')](function(){return BPromise[_0xd33c('0x6f')](_0x5a2eb8,function(_0x8a932c){return db[_0xd33c('0x5c')]['findOrCreate']({'where':{'UserId':_0x8a932c['id'],'WhatsappQueueId':_0x5eaa18[_0xd33c('0x4a')]['id']},'transaction':_0x4e094e});});})[_0xd33c('0x27')](function(){_0x5a2eb8['forEach'](function(_0x5cfca0){socket[_0xd33c('0x70')](_0xd33c('0x71'),{'UserId':_0x5cfca0['id'],'WhatsappQueueId':_0x409e4c['id']});});});});});}})['then'](respondWithStatusCode(_0x64029a,null))[_0xd33c('0x48')](handleError(_0x64029a,null));};exports[_0xd33c('0x72')]=function(_0x1c023d,_0xbe84cb,_0x46897d){return db['Team']['findAll']({'where':{'id':_0x1c023d[_0xd33c('0x36')][_0xd33c('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd33c('0x73'),'attributes':['id'],'raw':!![]}]})[_0xd33c('0x27')](handleEntityNotFound(_0xbe84cb,null))[_0xd33c('0x27')](function(_0x313456){var _0x4820cc=_['map'](_0x313456,'id');var _0x8cab53=[];var _0x5701d3=[];var _0x5b1015=squel['select']();_0x5b1015[_0xd33c('0x74')](_0xd33c('0x75'))['from']('team_has_whatsapp_queues','tq')[_0xd33c('0x76')](_0xd33c('0x77'),'ut',_0xd33c('0x78'))['where'](_0xd33c('0x79'),_0x1c023d[_0xd33c('0x4a')]['id']);for(var _0x3ac858=0x0;_0x3ac858<_0x313456[_0xd33c('0x4b')];_0x3ac858+=0x1){let _0x21afdf=_0x313456[_0x3ac858];for(var _0x195cdc=0x0;_0x195cdc<_0x21afdf[_0xd33c('0x73')][_0xd33c('0x4b')];_0x195cdc+=0x1){let _0x59e881=_0x21afdf[_0xd33c('0x73')][_0x195cdc];var _0x526d25=_0x5b1015['clone']();_0x526d25[_0xd33c('0x3d')]('ut.UserId\x20=\x20?',_0x59e881['id']);_0x5701d3['push'](db[_0xd33c('0x6c')]['query'](_0x526d25[_0xd33c('0x7a')](),{'type':db[_0xd33c('0x6c')]['QueryTypes'][_0xd33c('0x7b')]})[_0xd33c('0x27')](function(_0x1cad58){if(_0x1cad58[_0xd33c('0x4b')]===0x1){return _0x59e881['id'];}else{var _0x486481=_[_0xd33c('0x7c')](_[_0xd33c('0x2d')](_0x1cad58,'TeamId'),function(_0x4fe354){return _[_0xd33c('0x7d')](_0x4820cc,_0x4fe354);});if(_0x486481){return _0x59e881['id'];}}}));}}return BPromise[_0xd33c('0x7e')](_0x5701d3)[_0xd33c('0x27')](function(_0x147b78){_0x8cab53=_(_0x8cab53)[_0xd33c('0x7f')](_0x147b78)[_0xd33c('0x80')]()[_0xd33c('0x81')]();return db[_0xd33c('0x45')][_0xd33c('0x55')]({'where':{'id':_0x1c023d[_0xd33c('0x4a')]['id']}})['then'](function(_0x467bae){return db[_0xd33c('0x6c')]['transaction'](function(_0x25a94e){return _0x467bae[_0xd33c('0x72')](_0x1c023d[_0xd33c('0x36')][_0xd33c('0x68')],{'transaction':_0x25a94e})[_0xd33c('0x27')](function(){if(!_['isEmpty'](_0x8cab53)){return _0x467bae[_0xd33c('0x82')](_0x8cab53,{'transaction':_0x25a94e});}})['then'](function(){_0x8cab53[_0xd33c('0x83')](function(_0x201637){socket['emit'](_0xd33c('0x84'),{'UserId':_0x201637,'WhatsappQueueId':_0x467bae['id']});});});});});});})[_0xd33c('0x27')](respondWithStatusCode(_0xbe84cb,null))[_0xd33c('0x48')](handleError(_0xbe84cb,null));};exports[_0xd33c('0x85')]=function(_0x435dd3,_0x284554,_0x3304f9){return db[_0xd33c('0x45')][_0xd33c('0x55')]({'where':{'id':_0x435dd3[_0xd33c('0x4a')]['id']}})[_0xd33c('0x27')](handleEntityNotFound(_0x284554,null))[_0xd33c('0x27')](function(_0x1e6e10){if(_0x1e6e10){return _0x1e6e10[_0xd33c('0x85')](_0x435dd3['body'][_0xd33c('0x68')],_[_0xd33c('0x86')](_0x435dd3['body'],[_0xd33c('0x68'),'id'])||{})[_0xd33c('0x87')](function(_0x3a86b2){for(var _0x17b07a=0x0;_0x17b07a<_0x435dd3[_0xd33c('0x4f')][_0xd33c('0x68')][_0xd33c('0x4b')];_0x17b07a+=0x1){socket['emit'](_0xd33c('0x71'),{'UserId':_0x435dd3['body'][_0xd33c('0x68')][_0x17b07a],'WhatsappQueueId':_0x435dd3[_0xd33c('0x4a')]['id']});}return _0x3a86b2;});}})[_0xd33c('0x27')](respondWithResult(_0x284554,null))[_0xd33c('0x48')](handleError(_0x284554,null));};exports['removeAgents']=function(_0x431703,_0x188576,_0x172c5c){return db[_0xd33c('0x45')]['find']({'where':{'id':_0x431703[_0xd33c('0x4a')]['id']}})[_0xd33c('0x27')](handleEntityNotFound(_0x188576,null))[_0xd33c('0x27')](function(_0x2df526){if(_0x2df526){return _0x2df526[_0xd33c('0x82')](_0x431703[_0xd33c('0x36')][_0xd33c('0x68')])[_0xd33c('0x27')](function(){if(_[_0xd33c('0x88')](_0x431703[_0xd33c('0x36')]['ids'])){for(var _0x5d187e=0x0;_0x5d187e<_0x431703[_0xd33c('0x36')][_0xd33c('0x68')]['length'];_0x5d187e+=0x1){socket[_0xd33c('0x70')]('userWhatsappQueue:remove',{'UserId':Number(_0x431703['query'][_0xd33c('0x68')][_0x5d187e]),'WhatsappQueueId':Number(_0x431703[_0xd33c('0x4a')]['id'])});}}else{socket[_0xd33c('0x70')](_0xd33c('0x84'),{'UserId':Number(_0x431703['query'][_0xd33c('0x68')]),'WhatsappQueueId':Number(_0x431703['params']['id'])});}});}})[_0xd33c('0x27')](respondWithStatusCode(_0x188576,null))['catch'](handleError(_0x188576,null));};exports[_0xd33c('0x89')]=function(_0x430b33,_0xf42df,_0x1d27cd){var _0x56a902={};var _0x38b1b7={};var _0xd27bb2;var _0xa64f71;return db['WhatsappQueue'][_0xd33c('0x5b')]({'where':{'id':_0x430b33[_0xd33c('0x4a')]['id']}})[_0xd33c('0x27')](handleEntityNotFound(_0xf42df,null))[_0xd33c('0x27')](function(_0x49c3a6){if(_0x49c3a6){_0xd27bb2=_0x49c3a6;_0x38b1b7['model']=_[_0xd33c('0x34')](db[_0xd33c('0x5d')]['rawAttributes']);_0x38b1b7[_0xd33c('0x36')]=_[_0xd33c('0x34')](_0x430b33['query']);_0x38b1b7[_0xd33c('0x3f')]=_['intersection'](_0x38b1b7[_0xd33c('0x32')],_0x38b1b7[_0xd33c('0x36')]);_0x56a902[_0xd33c('0x37')]=_[_0xd33c('0x35')](_0x38b1b7['model'],qs[_0xd33c('0x38')](_0x430b33['query']['fields']));_0x56a902[_0xd33c('0x37')]=_0x56a902[_0xd33c('0x37')]['length']?_0x56a902['attributes']:_0x38b1b7['model'];_0x56a902[_0xd33c('0x3b')]=qs[_0xd33c('0x3c')](_0x430b33[_0xd33c('0x36')][_0xd33c('0x3c')]);_0x56a902[_0xd33c('0x3d')]=qs[_0xd33c('0x3f')](_['pick'](_0x430b33['query'],_0x38b1b7[_0xd33c('0x3f')]));if(_0x430b33[_0xd33c('0x36')][_0xd33c('0x40')]){_0x56a902[_0xd33c('0x3d')]=_[_0xd33c('0x41')](_0x56a902[_0xd33c('0x3d')],{'$or':_[_0xd33c('0x2d')](_0x56a902[_0xd33c('0x37')],function(_0x217b80){var _0x2760cc={};_0x2760cc[_0x217b80]={'$like':'%'+_0x430b33['query'][_0xd33c('0x40')]+'%'};return _0x2760cc;})});}_0x56a902=_['merge']({},_0x56a902,_0x430b33[_0xd33c('0x4d')]);return _0xd27bb2[_0xd33c('0x89')](_0x56a902);}})[_0xd33c('0x27')](function(_0x327b4d){if(_0x327b4d){_0xa64f71=_0x327b4d[_0xd33c('0x4b')];if(!_0x430b33[_0xd33c('0x36')][_0xd33c('0x39')]('nolimit')){_0x56a902[_0xd33c('0x21')]=qs[_0xd33c('0x21')](_0x430b33[_0xd33c('0x36')][_0xd33c('0x21')]);_0x56a902[_0xd33c('0x20')]=qs[_0xd33c('0x20')](_0x430b33[_0xd33c('0x36')]['offset']);}return _0xd27bb2[_0xd33c('0x89')](_0x56a902);}})[_0xd33c('0x27')](function(_0x5b49a8){if(_0x5b49a8){return _0x5b49a8?{'count':_0xa64f71,'rows':_0x5b49a8}:null;}})[_0xd33c('0x27')](respondWithResult(_0xf42df,null))[_0xd33c('0x48')](handleError(_0xf42df,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 96b4d42..60216d6 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 _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 +var _0xadba=['WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0xf7b88a,_0x12c26c){var _0x286494=function(_0x22c311){while(--_0x22c311){_0xf7b88a['push'](_0xf7b88a['shift']());}};_0x286494(++_0x12c26c);}(_0xadba,0xaa));var _0xaadb=function(_0x2dad55,_0x148a03){_0x2dad55=_0x2dad55-0x0;var _0x5de97a=_0xadba[_0x2dad55];return _0x5de97a;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xaadb('0x0'))['db'][_0xaadb('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xaadb('0x2')](0x0);var events={'afterCreate':_0xaadb('0x3'),'afterUpdate':_0xaadb('0x4'),'afterDestroy':_0xaadb('0x5')};function emitEvent(_0x5aeaf9){return function(_0x569c2e,_0x386819,_0x9416ec){WhatsappQueueEvents['emit'](_0x5aeaf9+':'+_0x569c2e['id'],_0x569c2e);WhatsappQueueEvents[_0xaadb('0x6')](_0x5aeaf9,_0x569c2e);_0x9416ec(null);};}for(var e in events){if(events[_0xaadb('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xaadb('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 76b826d..fcbcf01 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 _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 +var _0x2f99=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0x2f99,0xd0));var _0x92f9=function(_0x22327c,_0x555652){_0x22327c=_0x22327c-0x0;var _0x292823=_0x2f99[_0x22327c];return _0x292823;};'use strict';var _=require(_0x92f9('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x92f9('0x1'));var BPromise=require(_0x92f9('0x2'));var rp=require(_0x92f9('0x3'));var fs=require('fs');var path=require(_0x92f9('0x4'));var rimraf=require(_0x92f9('0x5'));var config=require(_0x92f9('0x6'));var attributes=require('./whatsappQueue.attributes');module[_0x92f9('0x7')]=function(_0x5409e5,_0x51f435){return _0x5409e5[_0x92f9('0x8')](_0x92f9('0x9'),attributes,{'tableName':_0x92f9('0xa'),'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 183d690..16f1b93 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 _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 +var _0xac6e=['lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','raw','options','where','limit','include','map','model','attributes','stringify','find','ShowWhatsappQueue'];(function(_0x1325af,_0x89ed7f){var _0x453639=function(_0xcfc504){while(--_0xcfc504){_0x1325af['push'](_0x1325af['shift']());}};_0x453639(++_0x89ed7f);}(_0xac6e,0x156));var _0xeac6=function(_0x375524,_0x51b2d8){_0x375524=_0x375524-0x0;var _0x4272b2=_0xac6e[_0x375524];return _0x4272b2;};'use strict';var _=require(_0xeac6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xeac6('0x1'));var rs=require(_0xeac6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeac6('0x3'));var logger=require(_0xeac6('0x4'))(_0xeac6('0x5'));var config=require(_0xeac6('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xeac6('0x7')]({'port':0x232a});config[_0xeac6('0x8')]=_[_0xeac6('0x9')](config[_0xeac6('0x8')],{'host':_0xeac6('0xa'),'port':0x18eb});var socket=require(_0xeac6('0xb'))(new Redis(config[_0xeac6('0x8')]));require('./whatsappQueue.socket')[_0xeac6('0xc')](socket);function respondWithRpcPromise(_0xed6123,_0x55e5b1,_0x1e2163){return new BPromise(function(_0x2bd390,_0x369be9){return client[_0xeac6('0xd')](_0xed6123,_0x1e2163)[_0xeac6('0xe')](function(_0x22e205){logger['info'](_0xeac6('0xf'),_0x55e5b1,_0xeac6('0x10'));logger[_0xeac6('0x11')](_0xeac6('0x12'),_0x55e5b1,_0xeac6('0x10'),JSON['stringify'](_0x22e205));if(_0x22e205[_0xeac6('0x13')]){if(_0x22e205[_0xeac6('0x13')][_0xeac6('0x14')]===0x1f4){logger[_0xeac6('0x13')](_0xeac6('0xf'),_0x55e5b1,_0x22e205['error'][_0xeac6('0x15')]);return _0x369be9(_0x22e205['error']['message']);}logger[_0xeac6('0x13')](_0xeac6('0xf'),_0x55e5b1,_0x22e205[_0xeac6('0x13')]['message']);return _0x2bd390(_0x22e205[_0xeac6('0x13')]['message']);}else{logger[_0xeac6('0x16')](_0xeac6('0xf'),_0x55e5b1,_0xeac6('0x10'));_0x2bd390(_0x22e205[_0xeac6('0x17')]['message']);}})[_0xeac6('0x18')](function(_0x3b45dd){logger[_0xeac6('0x13')](_0xeac6('0xf'),_0x55e5b1,_0x3b45dd);_0x369be9(_0x3b45dd);});});}exports[_0xeac6('0x19')]=function(_0x55505e){var _0xd7dd68=this;return new Promise(function(_0x3cf4c5,_0x461bba){return db[_0xeac6('0x1a')]['findAll']({'raw':_0x55505e['options']?_0x55505e['options'][_0xeac6('0x1b')]===undefined?!![]:![]:!![],'where':_0x55505e['options']?_0x55505e[_0xeac6('0x1c')][_0xeac6('0x1d')]||null:null,'attributes':_0x55505e['options']?_0x55505e['options']['attributes']||null:null,'limit':_0x55505e[_0xeac6('0x1c')]?_0x55505e[_0xeac6('0x1c')][_0xeac6('0x1e')]||null:null,'include':_0x55505e[_0xeac6('0x1c')]?_0x55505e[_0xeac6('0x1c')][_0xeac6('0x1f')]?_[_0xeac6('0x20')](_0x55505e[_0xeac6('0x1c')][_0xeac6('0x1f')],function(_0x5afbfa){return{'model':db[_0x5afbfa[_0xeac6('0x21')]],'as':_0x5afbfa['as'],'attributes':_0x5afbfa[_0xeac6('0x22')],'include':_0x5afbfa[_0xeac6('0x1f')]?_[_0xeac6('0x20')](_0x5afbfa[_0xeac6('0x1f')],function(_0x8600ed){return{'model':db[_0x8600ed['model']],'as':_0x8600ed['as'],'attributes':_0x8600ed[_0xeac6('0x22')],'include':_0x8600ed['include']?_[_0xeac6('0x20')](_0x8600ed['include'],function(_0x1cd93e){return{'model':db[_0x1cd93e[_0xeac6('0x21')]],'as':_0x1cd93e['as'],'attributes':_0x1cd93e['attributes']};}):[]};}):[]};}):[]:[]})[_0xeac6('0xe')](function(_0x47a83e){logger[_0xeac6('0x16')]('GetWhatsappQueue',_0x55505e);logger[_0xeac6('0x11')]('GetWhatsappQueue',_0x55505e,JSON[_0xeac6('0x23')](_0x47a83e));_0x3cf4c5(_0x47a83e);})[_0xeac6('0x18')](function(_0x7b05ec){logger['error'](_0xeac6('0x19'),_0x7b05ec['message'],_0x55505e);_0x461bba(_0xd7dd68['error'](0x1f4,_0x7b05ec[_0xeac6('0x15')]));});});};exports['ShowWhatsappQueue']=function(_0x2fa1ea){var _0x4155b0=this;return new Promise(function(_0x314d48,_0x4ca84b){return db[_0xeac6('0x1a')][_0xeac6('0x24')]({'raw':_0x2fa1ea['options']?_0x2fa1ea['options'][_0xeac6('0x1b')]===undefined?!![]:![]:!![],'where':_0x2fa1ea[_0xeac6('0x1c')]?_0x2fa1ea[_0xeac6('0x1c')][_0xeac6('0x1d')]||null:null,'attributes':_0x2fa1ea[_0xeac6('0x1c')]?_0x2fa1ea[_0xeac6('0x1c')][_0xeac6('0x22')]||null:null,'include':_0x2fa1ea['options']?_0x2fa1ea[_0xeac6('0x1c')][_0xeac6('0x1f')]?_[_0xeac6('0x20')](_0x2fa1ea[_0xeac6('0x1c')]['include'],function(_0x1c3cb0){return{'model':db[_0x1c3cb0['model']],'as':_0x1c3cb0['as'],'attributes':_0x1c3cb0['attributes'],'include':_0x1c3cb0[_0xeac6('0x1f')]?_[_0xeac6('0x20')](_0x1c3cb0['include'],function(_0x4515c8){return{'model':db[_0x4515c8[_0xeac6('0x21')]],'as':_0x4515c8['as'],'attributes':_0x4515c8[_0xeac6('0x22')],'include':_0x4515c8['include']?_[_0xeac6('0x20')](_0x4515c8[_0xeac6('0x1f')],function(_0x586a06){return{'model':db[_0x586a06['model']],'as':_0x586a06['as'],'attributes':_0x586a06['attributes']};}):[]};}):[]};}):[]:[]})[_0xeac6('0xe')](function(_0x12db22){logger[_0xeac6('0x16')](_0xeac6('0x25'),_0x2fa1ea);logger[_0xeac6('0x11')](_0xeac6('0x25'),_0x2fa1ea,JSON['stringify'](_0x12db22));_0x314d48(_0x12db22);})[_0xeac6('0x18')](function(_0x490daf){logger['error'](_0xeac6('0x25'),_0x490daf[_0xeac6('0x15')],_0x2fa1ea);_0x4ca84b(_0x4155b0['error'](0x1f4,_0x490daf['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index e1cf76d..386f66e 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 _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 +var _0xfb6d=['remove','update','register','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x569d32,_0x5ae90b){var _0x2de6ee=function(_0x122451){while(--_0x122451){_0x569d32['push'](_0x569d32['shift']());}};_0x2de6ee(++_0x5ae90b);}(_0xfb6d,0x124));var _0xdfb6=function(_0x7c2bb7,_0x4acc29){_0x7c2bb7=_0x7c2bb7-0x0;var _0x40040d=_0xfb6d[_0x7c2bb7];return _0x40040d;};'use strict';var WhatsappQueueEvents=require(_0xdfb6('0x0'));var events=[_0xdfb6('0x1'),_0xdfb6('0x2'),_0xdfb6('0x3')];function createListener(_0x22699e,_0x52d38d){return function(_0x1b1d74){_0x52d38d['emit'](_0x22699e,_0x1b1d74);};}function removeListener(_0x38991d,_0x4851ba){return function(){WhatsappQueueEvents['removeListener'](_0x38991d,_0x4851ba);};}exports[_0xdfb6('0x4')]=function(_0x14b3b8){for(var _0x2e916a=0x0,_0x2b4407=events['length'];_0x2e916a<_0x2b4407;_0x2e916a++){var _0x53a4da=events[_0x2e916a];var _0x3721bb=createListener(_0xdfb6('0x5')+_0x53a4da,_0x14b3b8);WhatsappQueueEvents['on'](_0x53a4da,_0x3721bb);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 3a7b0e5..1ea7636 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 _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 +var _0xd880=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id'];(function(_0x1e619d,_0x222b1e){var _0x3a6282=function(_0x12fa49){while(--_0x12fa49){_0x1e619d['push'](_0x1e619d['shift']());}};_0x3a6282(++_0x222b1e);}(_0xd880,0x7e));var _0x0d88=function(_0x35d493,_0x5d7597){_0x35d493=_0x35d493-0x0;var _0x4bd5d4=_0xd880[_0x35d493];return _0x4bd5d4;};'use strict';var multer=require(_0x0d88('0x0'));var util=require(_0x0d88('0x1'));var path=require(_0x0d88('0x2'));var timeout=require(_0x0d88('0x3'));var express=require(_0x0d88('0x4'));var router=express[_0x0d88('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0d88('0x6'));var config=require(_0x0d88('0x7'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x0d88('0x8')](),controller[_0x0d88('0x9')]);router['get'](_0x0d88('0xa'),auth[_0x0d88('0x8')](),controller[_0x0d88('0xb')]);router[_0x0d88('0xc')](_0x0d88('0xd'),auth[_0x0d88('0x8')](),controller['show']);router[_0x0d88('0xe')]('/',auth['isAuthenticated'](),controller[_0x0d88('0xf')]);router[_0x0d88('0x10')](_0x0d88('0xd'),auth[_0x0d88('0x8')](),controller[_0x0d88('0x11')]);router[_0x0d88('0x12')](_0x0d88('0xd'),auth[_0x0d88('0x8')](),controller['destroy']);module[_0x0d88('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 047ec3f..06619de 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['sequelize','exports','STRING','DATE'];(function(_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 +var _0x34e8=['sequelize','exports','STRING','DATE'];(function(_0x3d680f,_0x1bcd97){var _0x5605e1=function(_0x15c8d3){while(--_0x15c8d3){_0x3d680f['push'](_0x3d680f['shift']());}};_0x5605e1(++_0x1bcd97);}(_0x34e8,0x12c));var _0x834e=function(_0x10286d,_0x1f72f7){_0x10286d=_0x10286d-0x0;var _0x111c1e=_0x34e8[_0x10286d];return _0x111c1e;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'uniqueid':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x834e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x834e('0x3')]},'acceptAt':{'type':Sequelize[_0x834e('0x3')]},'exitAt':{'type':Sequelize[_0x834e('0x3')]},'reason':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 17faca7..83283da 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 _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 +var _0x8a6c=['ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','Content-Range','json','apply','save','update','then','destroy','end','error','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','create','body','find','describe','html-pdf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x8a6c,0x1a2));var _0xc8a6=function(_0x12315f,_0x4f8d2e){_0x12315f=_0x12315f-0x0;var _0x44eb16=_0x8a6c[_0x12315f];return _0x44eb16;};'use strict';var pdf=require(_0xc8a6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc8a6('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc8a6('0x2'));var Mustache=require(_0xc8a6('0x3'));var util=require(_0xc8a6('0x4'));var path=require(_0xc8a6('0x5'));var sox=require(_0xc8a6('0x6'));var csv=require(_0xc8a6('0x7'));var ejs=require(_0xc8a6('0x8'));var fs=require('fs');var _=require(_0xc8a6('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc8a6('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc8a6('0x7'));var querystring=require(_0xc8a6('0xb'));var Papa=require(_0xc8a6('0xc'));var Redis=require(_0xc8a6('0xd'));var authService=require(_0xc8a6('0xe'));var qs=require(_0xc8a6('0xf'));var as=require(_0xc8a6('0x10'));var hardwareService=require(_0xc8a6('0x11'));var logger=require('../../config/logger')(_0xc8a6('0x12'));var utils=require(_0xc8a6('0x13'));var config=require(_0xc8a6('0x14'));var licenseUtil=require(_0xc8a6('0x15'));var db=require(_0xc8a6('0x16'))['db'];function respondWithStatusCode(_0x7de531,_0x2de75c){_0x2de75c=_0x2de75c||0xcc;return function(_0x8769cd){if(_0x8769cd){return _0x7de531['sendStatus'](_0x2de75c);}return _0x7de531[_0xc8a6('0x17')](_0x2de75c)['end']();};}function respondWithResult(_0x528cab,_0x1b79cf){_0x1b79cf=_0x1b79cf||0xc8;return function(_0x510e8e){if(_0x510e8e){return _0x528cab[_0xc8a6('0x17')](_0x1b79cf)['json'](_0x510e8e);}};}function respondWithFilteredResult(_0x402837,_0x21a89b){return function(_0x10a103){if(_0x10a103){var _0x5758e3=_0x10a103[_0xc8a6('0x18')],_0x36975a=_0x21a89b[_0xc8a6('0x19')],_0xcc6d47=_0x21a89b[_0xc8a6('0x19')]+_0x21a89b['limit'],_0x5ad92e;if(_0xcc6d47>=_0x5758e3){_0xcc6d47=_0x5758e3;_0x5ad92e=0xc8;}else{_0x5ad92e=0xce;}_0x402837[_0xc8a6('0x17')](_0x5ad92e);return _0x402837['set'](_0xc8a6('0x1a'),_0x36975a+'-'+_0xcc6d47+'/'+_0x5758e3)[_0xc8a6('0x1b')](_0x10a103);}return null;};}function patchUpdates(_0x35764b){return function(_0x47a10c){try{jsonpatch[_0xc8a6('0x1c')](_0x47a10c,_0x35764b,!![]);}catch(_0x45e7e0){return BPromise['reject'](_0x45e7e0);}return _0x47a10c[_0xc8a6('0x1d')]();};}function saveUpdates(_0x2c7639,_0x25f5c6){return function(_0x18f5ca){if(_0x18f5ca){return _0x18f5ca[_0xc8a6('0x1e')](_0x2c7639)[_0xc8a6('0x1f')](function(_0x418d99){return _0x418d99;});}return null;};}function removeEntity(_0x11352d,_0x2ea53a){return function(_0x30f121){if(_0x30f121){return _0x30f121[_0xc8a6('0x20')]()[_0xc8a6('0x1f')](function(){_0x11352d[_0xc8a6('0x17')](0xcc)[_0xc8a6('0x21')]();});}};}function handleEntityNotFound(_0x283c4a,_0x5f1781){return function(_0x4ba640){if(!_0x4ba640){_0x283c4a['sendStatus'](0x194);}return _0x4ba640;};}function handleError(_0x44eba4,_0x4b4e76){_0x4b4e76=_0x4b4e76||0x1f4;return function(_0x3f3a8e){logger[_0xc8a6('0x22')](_0x3f3a8e['stack']);if(_0x3f3a8e[_0xc8a6('0x23')]){delete _0x3f3a8e['name'];}_0x44eba4[_0xc8a6('0x17')](_0x4b4e76)[_0xc8a6('0x24')](_0x3f3a8e);};}exports[_0xc8a6('0x25')]=function(_0x20dcea,_0x5f37e7){var _0x2a971d={},_0x3c43b1={},_0xd958a={'count':0x0,'rows':[]};var _0x56a3bb=_['map'](db[_0xc8a6('0x26')][_0xc8a6('0x27')],function(_0x4b3867){return{'name':_0x4b3867[_0xc8a6('0x28')],'type':_0x4b3867[_0xc8a6('0x29')][_0xc8a6('0x2a')]};});_0x3c43b1[_0xc8a6('0x2b')]=_[_0xc8a6('0x2c')](_0x56a3bb,_0xc8a6('0x23'));_0x3c43b1['query']=_[_0xc8a6('0x2d')](_0x20dcea[_0xc8a6('0x2e')]);_0x3c43b1[_0xc8a6('0x2f')]=_[_0xc8a6('0x30')](_0x3c43b1[_0xc8a6('0x2b')],_0x3c43b1['query']);_0x2a971d['attributes']=_['intersection'](_0x3c43b1[_0xc8a6('0x2b')],qs[_0xc8a6('0x31')](_0x20dcea[_0xc8a6('0x2e')][_0xc8a6('0x31')]));_0x2a971d['attributes']=_0x2a971d['attributes'][_0xc8a6('0x32')]?_0x2a971d[_0xc8a6('0x33')]:_0x3c43b1[_0xc8a6('0x2b')];if(!_0x20dcea[_0xc8a6('0x2e')][_0xc8a6('0x34')](_0xc8a6('0x35'))){_0x2a971d[_0xc8a6('0x36')]=qs['limit'](_0x20dcea['query'][_0xc8a6('0x36')]);_0x2a971d['offset']=qs[_0xc8a6('0x19')](_0x20dcea[_0xc8a6('0x2e')]['offset']);}_0x2a971d[_0xc8a6('0x37')]=qs[_0xc8a6('0x38')](_0x20dcea[_0xc8a6('0x2e')][_0xc8a6('0x38')]);_0x2a971d[_0xc8a6('0x39')]=qs[_0xc8a6('0x2f')](_[_0xc8a6('0x3a')](_0x20dcea['query'],_0x3c43b1[_0xc8a6('0x2f')]),_0x56a3bb);if(_0x20dcea['query'][_0xc8a6('0x3b')]){_0x2a971d[_0xc8a6('0x39')]=_[_0xc8a6('0x3c')](_0x2a971d[_0xc8a6('0x39')],{'$or':_['map'](_0x56a3bb,function(_0x2a98ab){if(_0x2a98ab['type']!=='VIRTUAL'){var _0x22a2c7={};_0x22a2c7[_0x2a98ab[_0xc8a6('0x23')]]={'$like':'%'+_0x20dcea[_0xc8a6('0x2e')]['filter']+'%'};return _0x22a2c7;}})});}_0x2a971d=_['merge']({},_0x2a971d,_0x20dcea[_0xc8a6('0x3d')]);var _0x139dd0={'where':_0x2a971d['where']};return db['WhatsappQueueReport'][_0xc8a6('0x18')](_0x139dd0)[_0xc8a6('0x1f')](function(_0x1f02e2){_0xd958a[_0xc8a6('0x18')]=_0x1f02e2;if(_0x20dcea[_0xc8a6('0x2e')][_0xc8a6('0x3e')]){_0x2a971d[_0xc8a6('0x3f')]=[{'all':!![]}];}return db[_0xc8a6('0x26')][_0xc8a6('0x40')](_0x2a971d);})['then'](function(_0x5b8b33){_0xd958a['rows']=_0x5b8b33;return _0xd958a;})[_0xc8a6('0x1f')](respondWithFilteredResult(_0x5f37e7,_0x2a971d))[_0xc8a6('0x41')](handleError(_0x5f37e7,null));};exports['show']=function(_0x5c9afc,_0x370df7){var _0x289591={'raw':!![],'where':{'id':_0x5c9afc[_0xc8a6('0x42')]['id']}},_0x3f593a={};_0x3f593a[_0xc8a6('0x2b')]=_['keys'](db[_0xc8a6('0x26')][_0xc8a6('0x27')]);_0x3f593a[_0xc8a6('0x2e')]=_[_0xc8a6('0x2d')](_0x5c9afc[_0xc8a6('0x2e')]);_0x3f593a[_0xc8a6('0x2f')]=_[_0xc8a6('0x30')](_0x3f593a['model'],_0x3f593a[_0xc8a6('0x2e')]);_0x289591[_0xc8a6('0x33')]=_[_0xc8a6('0x30')](_0x3f593a['model'],qs['fields'](_0x5c9afc[_0xc8a6('0x2e')][_0xc8a6('0x31')]));_0x289591[_0xc8a6('0x33')]=_0x289591[_0xc8a6('0x33')]['length']?_0x289591[_0xc8a6('0x33')]:_0x3f593a[_0xc8a6('0x2b')];if(_0x5c9afc[_0xc8a6('0x2e')]['includeAll']){_0x289591[_0xc8a6('0x3f')]=[{'all':!![]}];}_0x289591=_[_0xc8a6('0x3c')]({},_0x289591,_0x5c9afc['options']);return db['WhatsappQueueReport']['find'](_0x289591)['then'](handleEntityNotFound(_0x370df7,null))[_0xc8a6('0x1f')](respondWithResult(_0x370df7,null))[_0xc8a6('0x41')](handleError(_0x370df7,null));};exports[_0xc8a6('0x43')]=function(_0x1ea146,_0x1395ed){return db[_0xc8a6('0x26')][_0xc8a6('0x43')](_0x1ea146[_0xc8a6('0x44')],{})[_0xc8a6('0x1f')](respondWithResult(_0x1395ed,0xc9))[_0xc8a6('0x41')](handleError(_0x1395ed,null));};exports[_0xc8a6('0x1e')]=function(_0x12b3f2,_0x18016f){if(_0x12b3f2[_0xc8a6('0x44')]['id']){delete _0x12b3f2[_0xc8a6('0x44')]['id'];}return db[_0xc8a6('0x26')]['find']({'where':{'id':_0x12b3f2[_0xc8a6('0x42')]['id']}})[_0xc8a6('0x1f')](handleEntityNotFound(_0x18016f,null))[_0xc8a6('0x1f')](saveUpdates(_0x12b3f2[_0xc8a6('0x44')],null))[_0xc8a6('0x1f')](respondWithResult(_0x18016f,null))[_0xc8a6('0x41')](handleError(_0x18016f,null));};exports[_0xc8a6('0x20')]=function(_0x590926,_0x53e8c0){return db[_0xc8a6('0x26')][_0xc8a6('0x45')]({'where':{'id':_0x590926['params']['id']}})[_0xc8a6('0x1f')](handleEntityNotFound(_0x53e8c0,null))[_0xc8a6('0x1f')](removeEntity(_0x53e8c0,null))['catch'](handleError(_0x53e8c0,null));};exports[_0xc8a6('0x46')]=function(_0x4e55b0,_0x591f74){return db[_0xc8a6('0x26')][_0xc8a6('0x46')]()[_0xc8a6('0x1f')](respondWithResult(_0x591f74,null))[_0xc8a6('0x41')](handleError(_0x591f74,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 7626321..61355a0 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 _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 +var _0xd6b2=['report_whatsapp_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport'];(function(_0x1047e9,_0x37948e){var _0x15f50e=function(_0x455edb){while(--_0x455edb){_0x1047e9['push'](_0x1047e9['shift']());}};_0x15f50e(++_0x37948e);}(_0xd6b2,0xec));var _0x2d6b=function(_0x4a2e27,_0x6ecce){_0x4a2e27=_0x4a2e27-0x0;var _0xeec515=_0xd6b2[_0x4a2e27];return _0xeec515;};'use strict';var _=require('lodash');var util=require(_0x2d6b('0x0'));var logger=require(_0x2d6b('0x1'))(_0x2d6b('0x2'));var moment=require(_0x2d6b('0x3'));var BPromise=require(_0x2d6b('0x4'));var rp=require(_0x2d6b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2d6b('0x6'));var attributes=require(_0x2d6b('0x7'));module[_0x2d6b('0x8')]=function(_0xdd238f,_0x56a5ee){return _0xdd238f[_0x2d6b('0x9')](_0x2d6b('0xa'),attributes,{'tableName':_0x2d6b('0xb'),'paranoid':![],'indexes':[{'name':_0x2d6b('0xc'),'fields':[_0x2d6b('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 a1e7e6d..21bd9f9 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 _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 +var _0xc502=['stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','debug'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xc502,0x10a));var _0x2c50=function(_0x5ad4be,_0x357097){_0x5ad4be=_0x5ad4be-0x0;var _0x156465=_0xc502[_0x5ad4be];return _0x156465;};'use strict';var _=require(_0x2c50('0x0'));var util=require(_0x2c50('0x1'));var moment=require(_0x2c50('0x2'));var BPromise=require('bluebird');var rs=require(_0x2c50('0x3'));var fs=require('fs');var Redis=require(_0x2c50('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c50('0x5'));var logger=require(_0x2c50('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2c50('0x7'));var client=jayson['client'][_0x2c50('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ed679,_0x5bb83e,_0x1d692a){return new BPromise(function(_0x52c51d,_0x5a9123){return client[_0x2c50('0x9')](_0x3ed679,_0x1d692a)[_0x2c50('0xa')](function(_0x37fccd){logger[_0x2c50('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5bb83e,'request\x20sent');logger[_0x2c50('0xc')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x5bb83e,'request\x20sent',JSON[_0x2c50('0xd')](_0x37fccd));if(_0x37fccd[_0x2c50('0xe')]){if(_0x37fccd['error'][_0x2c50('0xf')]===0x1f4){logger[_0x2c50('0xe')](_0x2c50('0x10'),_0x5bb83e,_0x37fccd[_0x2c50('0xe')][_0x2c50('0x11')]);return _0x5a9123(_0x37fccd[_0x2c50('0xe')]['message']);}logger['error'](_0x2c50('0x10'),_0x5bb83e,_0x37fccd['error'][_0x2c50('0x11')]);return _0x52c51d(_0x37fccd[_0x2c50('0xe')][_0x2c50('0x11')]);}else{logger['info'](_0x2c50('0x10'),_0x5bb83e,_0x2c50('0x12'));_0x52c51d(_0x37fccd[_0x2c50('0x13')][_0x2c50('0x11')]);}})[_0x2c50('0x14')](function(_0xcea716){logger['error'](_0x2c50('0x10'),_0x5bb83e,_0xcea716);_0x5a9123(_0xcea716);});});}exports[_0x2c50('0x15')]=function(_0x1b8e2c){var _0x4c62cc=this;return new Promise(function(_0xdec8d0,_0x1f769e){return db[_0x2c50('0x16')][_0x2c50('0x17')](_0x1b8e2c[_0x2c50('0x18')],{'raw':_0x1b8e2c[_0x2c50('0x19')]?_0x1b8e2c[_0x2c50('0x19')][_0x2c50('0x1a')]===undefined?!![]:![]:!![]})[_0x2c50('0xa')](function(_0x407f84){logger[_0x2c50('0xb')](_0x2c50('0x15'),_0x1b8e2c);logger[_0x2c50('0xc')](_0x2c50('0x15'),_0x1b8e2c,JSON[_0x2c50('0xd')](_0x407f84));_0xdec8d0(_0x407f84);})[_0x2c50('0x14')](function(_0x17373d){logger[_0x2c50('0xe')](_0x2c50('0x15'),_0x17373d[_0x2c50('0x11')],_0x1b8e2c);_0x1f769e(_0x4c62cc['error'](0x1f4,_0x17373d[_0x2c50('0x11')]));});});};exports[_0x2c50('0x1b')]=function(_0x5ab6b4){var _0x543437=this;return new Promise(function(_0x11efd3,_0x4e72dd){return db[_0x2c50('0x16')][_0x2c50('0x1c')](_0x5ab6b4[_0x2c50('0x18')],{'raw':_0x5ab6b4[_0x2c50('0x19')]?_0x5ab6b4[_0x2c50('0x19')][_0x2c50('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ab6b4[_0x2c50('0x19')]?_0x5ab6b4[_0x2c50('0x19')][_0x2c50('0x1d')]||null:null,'attributes':_0x5ab6b4[_0x2c50('0x19')]?_0x5ab6b4[_0x2c50('0x19')][_0x2c50('0x1e')]||null:null,'limit':_0x5ab6b4['options']?_0x5ab6b4[_0x2c50('0x19')]['limit']||null:null})[_0x2c50('0xa')](function(_0xb0492a){logger[_0x2c50('0xb')](_0x2c50('0x1b'),_0x5ab6b4);logger[_0x2c50('0xc')](_0x2c50('0x1b'),_0x5ab6b4,JSON[_0x2c50('0xd')](_0xb0492a));_0x11efd3(_0xb0492a);})['catch'](function(_0x595196){logger[_0x2c50('0xe')](_0x2c50('0x1b'),_0x595196[_0x2c50('0x11')],_0x5ab6b4);_0x4e72dd(_0x543437[_0x2c50('0xe')](0x1f4,_0x595196[_0x2c50('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index e48c0c0..c9b3fc6 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 _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 +var _0x23fa=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','index','describe','/:id'];(function(_0x39fbca,_0x16903a){var _0x295e34=function(_0x42dd79){while(--_0x42dd79){_0x39fbca['push'](_0x39fbca['shift']());}};_0x295e34(++_0x16903a);}(_0x23fa,0x183));var _0xa23f=function(_0x1f81ce,_0x37f3f2){_0x1f81ce=_0x1f81ce-0x0;var _0x2d1f73=_0x23fa[_0x1f81ce];return _0x2d1f73;};'use strict';var multer=require(_0xa23f('0x0'));var util=require(_0xa23f('0x1'));var path=require('path');var timeout=require(_0xa23f('0x2'));var express=require(_0xa23f('0x3'));var router=express[_0xa23f('0x4')]();var auth=require(_0xa23f('0x5'));var interaction=require(_0xa23f('0x6'));var config=require('../../config/environment');var controller=require(_0xa23f('0x7'));router[_0xa23f('0x8')]('/',auth['isAuthenticated'](),controller[_0xa23f('0x9')]);router[_0xa23f('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xa23f('0xa')]);router[_0xa23f('0x8')](_0xa23f('0xb'),auth[_0xa23f('0xc')](),controller[_0xa23f('0xd')]);router[_0xa23f('0xe')]('/',auth['isAuthenticated'](),controller[_0xa23f('0xf')]);router[_0xa23f('0x10')](_0xa23f('0xb'),auth[_0xa23f('0xc')](),controller[_0xa23f('0x11')]);router[_0xa23f('0x12')]('/:id',auth[_0xa23f('0xc')](),controller[_0xa23f('0x13')]);module[_0xa23f('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 86ae0ac..2dc0375 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 _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 +var _0x5f2f=['agent','queue','DATE','sequelize','exports','STRING','ENUM','account'];(function(_0x1bfc2d,_0x181462){var _0x501195=function(_0x184937){while(--_0x184937){_0x1bfc2d['push'](_0x1bfc2d['shift']());}};_0x501195(++_0x181462);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1e0065,_0x2ebf65){_0x1e0065=_0x1e0065-0x0;var _0x34b5e2=_0x5f2f[_0x1e0065];return _0x34b5e2;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'uniqueid':{'type':Sequelize[_0xf5f2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf5f2('0x3')](_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf5f2('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index c259160..2ad85c1 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 _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 +var _0xba10=['map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','params','keys','WhatsappTransferReport','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','set','Content-Range','apply','reject','update','then','destroy','sendStatus','name','send','index'];(function(_0xa148b4,_0x5d1feb){var _0x18a6ba=function(_0x44fe73){while(--_0x44fe73){_0xa148b4['push'](_0xa148b4['shift']());}};_0x18a6ba(++_0x5d1feb);}(_0xba10,0x70));var _0x0ba1=function(_0x52ddf6,_0x21a24e){_0x52ddf6=_0x52ddf6-0x0;var _0x19f49b=_0xba10[_0x52ddf6];return _0x19f49b;};'use strict';var pdf=require(_0x0ba1('0x0'));var emlformat=require(_0x0ba1('0x1'));var rimraf=require(_0x0ba1('0x2'));var zipdir=require(_0x0ba1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0ba1('0x4'));var BPromise=require(_0x0ba1('0x5'));var Mustache=require(_0x0ba1('0x6'));var util=require(_0x0ba1('0x7'));var path=require(_0x0ba1('0x8'));var sox=require(_0x0ba1('0x9'));var csv=require('to-csv');var ejs=require(_0x0ba1('0xa'));var fs=require('fs');var _=require(_0x0ba1('0xb'));var squel=require(_0x0ba1('0xc'));var crypto=require(_0x0ba1('0xd'));var jsforce=require(_0x0ba1('0xe'));var deskjs=require(_0x0ba1('0xf'));var toCsv=require(_0x0ba1('0x10'));var querystring=require(_0x0ba1('0x11'));var Papa=require(_0x0ba1('0x12'));var Redis=require('ioredis');var authService=require(_0x0ba1('0x13'));var qs=require(_0x0ba1('0x14'));var as=require(_0x0ba1('0x15'));var hardwareService=require(_0x0ba1('0x16'));var logger=require(_0x0ba1('0x17'))('api');var utils=require(_0x0ba1('0x18'));var config=require(_0x0ba1('0x19'));var licenseUtil=require(_0x0ba1('0x1a'));var db=require(_0x0ba1('0x1b'))['db'];function respondWithStatusCode(_0x3d665d,_0x1467ef){_0x1467ef=_0x1467ef||0xcc;return function(_0x580b65){if(_0x580b65){return _0x3d665d['sendStatus'](_0x1467ef);}return _0x3d665d[_0x0ba1('0x1c')](_0x1467ef)[_0x0ba1('0x1d')]();};}function respondWithResult(_0x22f00e,_0x4e76c9){_0x4e76c9=_0x4e76c9||0xc8;return function(_0x376fd1){if(_0x376fd1){return _0x22f00e['status'](_0x4e76c9)[_0x0ba1('0x1e')](_0x376fd1);}};}function respondWithFilteredResult(_0x359cc8,_0x5959a3){return function(_0x50dbed){if(_0x50dbed){var _0x102a64=_0x50dbed['count'],_0x2e8f6f=_0x5959a3['offset'],_0x2ea0f8=_0x5959a3['offset']+_0x5959a3['limit'],_0x1c8a57;if(_0x2ea0f8>=_0x102a64){_0x2ea0f8=_0x102a64;_0x1c8a57=0xc8;}else{_0x1c8a57=0xce;}_0x359cc8[_0x0ba1('0x1c')](_0x1c8a57);return _0x359cc8[_0x0ba1('0x1f')](_0x0ba1('0x20'),_0x2e8f6f+'-'+_0x2ea0f8+'/'+_0x102a64)[_0x0ba1('0x1e')](_0x50dbed);}return null;};}function patchUpdates(_0x573ae1){return function(_0x1073c5){try{jsonpatch[_0x0ba1('0x21')](_0x1073c5,_0x573ae1,!![]);}catch(_0x26cf1b){return BPromise[_0x0ba1('0x22')](_0x26cf1b);}return _0x1073c5['save']();};}function saveUpdates(_0x131cc5,_0x4b3925){return function(_0xf18461){if(_0xf18461){return _0xf18461[_0x0ba1('0x23')](_0x131cc5)[_0x0ba1('0x24')](function(_0x3b0db8){return _0x3b0db8;});}return null;};}function removeEntity(_0x502816,_0x29abcb){return function(_0x5070c7){if(_0x5070c7){return _0x5070c7[_0x0ba1('0x25')]()[_0x0ba1('0x24')](function(){_0x502816[_0x0ba1('0x1c')](0xcc)[_0x0ba1('0x1d')]();});}};}function handleEntityNotFound(_0x3ce879,_0x193b04){return function(_0x501aac){if(!_0x501aac){_0x3ce879[_0x0ba1('0x26')](0x194);}return _0x501aac;};}function handleError(_0x20484c,_0x54c144){_0x54c144=_0x54c144||0x1f4;return function(_0x390a1d){logger['error'](_0x390a1d['stack']);if(_0x390a1d['name']){delete _0x390a1d[_0x0ba1('0x27')];}_0x20484c[_0x0ba1('0x1c')](_0x54c144)[_0x0ba1('0x28')](_0x390a1d);};}exports[_0x0ba1('0x29')]=function(_0xd6df23,_0x2f0317){var _0x807740={},_0x137a42={},_0x3a0065={'count':0x0,'rows':[]};var _0x471c31=_[_0x0ba1('0x2a')](db['WhatsappTransferReport'][_0x0ba1('0x2b')],function(_0x2d6eaf){return{'name':_0x2d6eaf[_0x0ba1('0x2c')],'type':_0x2d6eaf[_0x0ba1('0x2d')][_0x0ba1('0x2e')]};});_0x137a42['model']=_[_0x0ba1('0x2a')](_0x471c31,_0x0ba1('0x27'));_0x137a42[_0x0ba1('0x2f')]=_['keys'](_0xd6df23[_0x0ba1('0x2f')]);_0x137a42['filters']=_[_0x0ba1('0x30')](_0x137a42[_0x0ba1('0x31')],_0x137a42['query']);_0x807740[_0x0ba1('0x32')]=_[_0x0ba1('0x30')](_0x137a42[_0x0ba1('0x31')],qs['fields'](_0xd6df23[_0x0ba1('0x2f')][_0x0ba1('0x33')]));_0x807740['attributes']=_0x807740[_0x0ba1('0x32')][_0x0ba1('0x34')]?_0x807740[_0x0ba1('0x32')]:_0x137a42[_0x0ba1('0x31')];if(!_0xd6df23['query'][_0x0ba1('0x35')](_0x0ba1('0x36'))){_0x807740[_0x0ba1('0x37')]=qs[_0x0ba1('0x37')](_0xd6df23[_0x0ba1('0x2f')]['limit']);_0x807740['offset']=qs[_0x0ba1('0x38')](_0xd6df23['query'][_0x0ba1('0x38')]);}_0x807740[_0x0ba1('0x39')]=qs['sort'](_0xd6df23['query']['sort']);_0x807740[_0x0ba1('0x3a')]=qs[_0x0ba1('0x3b')](_[_0x0ba1('0x3c')](_0xd6df23[_0x0ba1('0x2f')],_0x137a42[_0x0ba1('0x3b')]),_0x471c31);if(_0xd6df23['query'][_0x0ba1('0x3d')]){_0x807740[_0x0ba1('0x3a')]=_[_0x0ba1('0x3e')](_0x807740[_0x0ba1('0x3a')],{'$or':_[_0x0ba1('0x2a')](_0x471c31,function(_0x168653){if(_0x168653[_0x0ba1('0x2d')]!==_0x0ba1('0x3f')){var _0x274dd9={};_0x274dd9[_0x168653[_0x0ba1('0x27')]]={'$like':'%'+_0xd6df23[_0x0ba1('0x2f')]['filter']+'%'};return _0x274dd9;}})});}_0x807740=_[_0x0ba1('0x3e')]({},_0x807740,_0xd6df23[_0x0ba1('0x40')]);var _0xae1197={'where':_0x807740[_0x0ba1('0x3a')]};return db['WhatsappTransferReport'][_0x0ba1('0x41')](_0xae1197)[_0x0ba1('0x24')](function(_0x2d44da){_0x3a0065[_0x0ba1('0x41')]=_0x2d44da;if(_0xd6df23['query'][_0x0ba1('0x42')]){_0x807740[_0x0ba1('0x43')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x807740);})[_0x0ba1('0x24')](function(_0x3bd8ea){_0x3a0065[_0x0ba1('0x44')]=_0x3bd8ea;return _0x3a0065;})[_0x0ba1('0x24')](respondWithFilteredResult(_0x2f0317,_0x807740))[_0x0ba1('0x45')](handleError(_0x2f0317,null));};exports['show']=function(_0x58b24c,_0x42bf34){var _0x2fed24={'raw':!![],'where':{'id':_0x58b24c[_0x0ba1('0x46')]['id']}},_0x124c6c={};_0x124c6c[_0x0ba1('0x31')]=_[_0x0ba1('0x47')](db[_0x0ba1('0x48')][_0x0ba1('0x2b')]);_0x124c6c[_0x0ba1('0x2f')]=_[_0x0ba1('0x47')](_0x58b24c[_0x0ba1('0x2f')]);_0x124c6c[_0x0ba1('0x3b')]=_[_0x0ba1('0x30')](_0x124c6c[_0x0ba1('0x31')],_0x124c6c[_0x0ba1('0x2f')]);_0x2fed24[_0x0ba1('0x32')]=_['intersection'](_0x124c6c[_0x0ba1('0x31')],qs[_0x0ba1('0x33')](_0x58b24c[_0x0ba1('0x2f')][_0x0ba1('0x33')]));_0x2fed24[_0x0ba1('0x32')]=_0x2fed24[_0x0ba1('0x32')]['length']?_0x2fed24['attributes']:_0x124c6c[_0x0ba1('0x31')];if(_0x58b24c[_0x0ba1('0x2f')][_0x0ba1('0x42')]){_0x2fed24[_0x0ba1('0x43')]=[{'all':!![]}];}_0x2fed24=_[_0x0ba1('0x3e')]({},_0x2fed24,_0x58b24c[_0x0ba1('0x40')]);return db[_0x0ba1('0x48')][_0x0ba1('0x49')](_0x2fed24)[_0x0ba1('0x24')](handleEntityNotFound(_0x42bf34,null))[_0x0ba1('0x24')](respondWithResult(_0x42bf34,null))[_0x0ba1('0x45')](handleError(_0x42bf34,null));};exports['create']=function(_0x3bb424,_0xb36c11){return db[_0x0ba1('0x48')][_0x0ba1('0x4a')](_0x3bb424[_0x0ba1('0x4b')],{})[_0x0ba1('0x24')](respondWithResult(_0xb36c11,0xc9))['catch'](handleError(_0xb36c11,null));};exports['update']=function(_0x5f0173,_0x595923){if(_0x5f0173[_0x0ba1('0x4b')]['id']){delete _0x5f0173[_0x0ba1('0x4b')]['id'];}return db[_0x0ba1('0x48')][_0x0ba1('0x49')]({'where':{'id':_0x5f0173['params']['id']}})[_0x0ba1('0x24')](handleEntityNotFound(_0x595923,null))[_0x0ba1('0x24')](saveUpdates(_0x5f0173[_0x0ba1('0x4b')],null))[_0x0ba1('0x24')](respondWithResult(_0x595923,null))['catch'](handleError(_0x595923,null));};exports['destroy']=function(_0x34e9a5,_0x72f32e){return db[_0x0ba1('0x48')][_0x0ba1('0x49')]({'where':{'id':_0x34e9a5['params']['id']}})['then'](handleEntityNotFound(_0x72f32e,null))['then'](removeEntity(_0x72f32e,null))[_0x0ba1('0x45')](handleError(_0x72f32e,null));};exports[_0x0ba1('0x4c')]=function(_0x1da347,_0x143623){return db[_0x0ba1('0x48')][_0x0ba1('0x4c')]()['then'](respondWithResult(_0x143623,null))[_0x0ba1('0x45')](handleError(_0x143623,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 3c29a30..99c541a 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 _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 +var _0x3f77=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','uniqueid'];(function(_0x1b7611,_0x21db55){var _0x44bf5b=function(_0x5e1650){while(--_0x5e1650){_0x1b7611['push'](_0x1b7611['shift']());}};_0x44bf5b(++_0x21db55);}(_0x3f77,0xf0));var _0x73f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f77[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x73f7('0x0'));var util=require(_0x73f7('0x1'));var logger=require(_0x73f7('0x2'))(_0x73f7('0x3'));var moment=require(_0x73f7('0x4'));var BPromise=require(_0x73f7('0x5'));var rp=require(_0x73f7('0x6'));var fs=require('fs');var path=require(_0x73f7('0x7'));var rimraf=require(_0x73f7('0x8'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0x73f7('0x9')]=function(_0x5c5106,_0x56a744){return _0x5c5106[_0x73f7('0xa')]('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x73f7('0xb'),'fields':[_0x73f7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 21012ed..20fa759 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(_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 +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(_0x5747ca,_0x31b427){var _0x5db802=function(_0x554ee7){while(--_0x554ee7){_0x5747ca['push'](_0x5747ca['shift']());}};_0x5db802(++_0x31b427);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 ba6b0a5..d51ea4a 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x0c2b=['./mysqldb','./config/environment','./config/logger','app','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','then','listen','info','start','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:','./config/seedDB','default','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c2b,0x194));var _0xb0c2=function(_0x3ae8f8,_0x2eadaf){_0x3ae8f8=_0x3ae8f8-0x0;var _0x25a2b1=_0x0c2b[_0x3ae8f8];return _0x25a2b1;};'use strict';var _=require(_0xb0c2('0x0'));var mysqldb=require(_0xb0c2('0x1'));var rpc=require('./rpc');var config=require(_0xb0c2('0x2'));var logger=require(_0xb0c2('0x3'))(_0xb0c2('0x4'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0xb0c2('0x5'));var chat=require(_0xb0c2('0x6'));var whatsapp=require(_0xb0c2('0x7'));var transcribe=require(_0xb0c2('0x8'));function main(){return mysqldb['db'][_0xb0c2('0x9')]['sync']()[_0xb0c2('0xa')](function(){return rpc[_0xb0c2('0xb')]();})[_0xb0c2('0xa')](function(_0x5052b8){logger[_0xb0c2('0xc')](_0x5052b8);return chat[_0xb0c2('0xd')]();})[_0xb0c2('0xa')](function(){return whatsapp[_0xb0c2('0xd')]();})['then'](function(){return schedule['start']();})[_0xb0c2('0xa')](function(){return transcribe[_0xb0c2('0xd')]();})[_0xb0c2('0xa')](function(_0x4242f4){logger['info'](_0x4242f4);return pm2[_0xb0c2('0xd')](pm2Config);})[_0xb0c2('0xa')](function(_0x25872d){logger[_0xb0c2('0xc')](_0xb0c2('0xe'),_[_0xb0c2('0xf')](_[_0xb0c2('0x10')](_0x25872d,{'status':_0xb0c2('0x11')}),_0xb0c2('0x12'))[_0xb0c2('0x13')]());logger[_0xb0c2('0xc')](_0xb0c2('0x14'),_[_0xb0c2('0xf')](_[_0xb0c2('0x10')](_0x25872d,function(_0x6eb706){return _0x6eb706['status']!==_0xb0c2('0x11');}),_0xb0c2('0x12'))[_0xb0c2('0x13')]()||'None');config['seedDB']&&require(_0xb0c2('0x15'))[_0xb0c2('0x16')]();require(_0xb0c2('0x17'))['default']();})[_0xb0c2('0x18')](function(_0x5147fc){logger['error'](_0xb0c2('0x19'),_0x5147fc);process[_0xb0c2('0x1a')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 2ceeaef..1b74052 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 _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 +var _0x2c06=['phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','authorization','startsWith','headers','User','find','authenticate','pass','Bearer','query','apikey','getUuid','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','add','minutes','catch','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','splice','unshift','encryptString','join','promisify','secret','payload','options','verify','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','bluebird','util','secrets','session','role','name','internal','email','voicePause','chatPause','faxPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x2c06,0x1bb));var _0x62c0=function(_0x57507e,_0x1ceefb){_0x57507e=_0x57507e-0x0;var _0x54a5c0=_0x2c06[_0x57507e];return _0x54a5c0;};'use strict';var db=require(_0x62c0('0x0'))['db'];var config=require(_0x62c0('0x1'));var hardwareConf=require(_0x62c0('0x2'));var licenseUtil=require(_0x62c0('0x3'));var encryptor=require(_0x62c0('0x4'));var _=require(_0x62c0('0x5'));var jwt=require(_0x62c0('0x6'));var expressJwt=require(_0x62c0('0x7'));var compose=require('composable-middleware');var basicAuth=require(_0x62c0('0x8'));var crypto=require('crypto');var BPromise=require(_0x62c0('0x9'));var util=require(_0x62c0('0xa'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x62c0('0xb')][_0x62c0('0xc')]});var userAttributes=['id',_0x62c0('0xd'),'fullname',_0x62c0('0xe'),_0x62c0('0xf'),_0x62c0('0x10'),'userpic','permissions','md5secret',_0x62c0('0x11'),_0x62c0('0x12'),'mailPause',_0x62c0('0x13'),'smsPause','openchannelPause',_0x62c0('0x14'),_0x62c0('0x15'),_0x62c0('0x16'),_0x62c0('0x17'),_0x62c0('0x18'),'allowmessenger',_0x62c0('0x19'),_0x62c0('0x1a'),_0x62c0('0x1b'),_0x62c0('0x1c'),_0x62c0('0x1d'),_0x62c0('0x1e'),_0x62c0('0x1f'),_0x62c0('0x20'),_0x62c0('0x21'),_0x62c0('0x22'),_0x62c0('0x23'),_0x62c0('0x24'),_0x62c0('0x25'),_0x62c0('0x26'),_0x62c0('0x27'),'settingsEnabled'];exports[_0x62c0('0x28')]=function(){return this[_0x62c0('0x29')](!![])[_0x62c0('0x2a')](function(_0x22a739,_0x1a7d42,_0x31f75f){if(_0x22a739[_0x62c0('0x2b')]){_0x31f75f();}else{return db[_0x62c0('0x2c')][_0x62c0('0x2d')]({'where':{'id':_0x22a739[_0x62c0('0x2e')]['id']},'attributes':['id',_0x62c0('0x2f'),_0x62c0('0x30')],'raw':!![]})[_0x62c0('0x31')](function(_0x3c4dd2){if(_0x3c4dd2&&_0x3c4dd2[_0x62c0('0x2f')]){return _0x1a7d42[_0x62c0('0x32')](_0x3c4dd2[_0x62c0('0x30')]===_0x62c0('0x33')?0x195:0x193)[_0x62c0('0x34')]({'message':_0x3c4dd2[_0x62c0('0x30')]===_0x62c0('0x33')?_0x62c0('0x35'):_0x62c0('0x36')});}else{_0x31f75f();}})['catch'](function(_0x2ea033){_0x31f75f(_0x2ea033);});}});};exports['isAuthenticated']=function isAuthenticated(_0x5928e1){return compose()[_0x62c0('0x2a')](function(_0x222bab,_0x4ca8c8,_0x34afed){var _0x15322e;if(_0x222bab['headers'][_0x62c0('0x37')]){if(_[_0x62c0('0x38')](_0x222bab[_0x62c0('0x39')][_0x62c0('0x37')],'Basic')){var _0x564bd2=basicAuth(_0x222bab);db[_0x62c0('0x3a')][_0x62c0('0x3b')]({'where':{'name':_0x564bd2[_0x62c0('0xe')]}})[_0x62c0('0x31')](function(_0x1f4285){if(!_0x1f4285||!_0x1f4285[_0x62c0('0x3c')](_0x564bd2[_0x62c0('0x3d')])){return _0x4ca8c8[_0x62c0('0x32')](0x191)[_0x62c0('0x34')]({'message':'Wrong\x20credentials.'});}_0x222bab[_0x62c0('0x2b')]={'id':_0x1f4285['id']};_0x34afed();})['catch'](function(_0x525349){_0x34afed(_0x525349);});}else if(_[_0x62c0('0x38')](_0x222bab['headers'][_0x62c0('0x37')],_0x62c0('0x3e'))){validateJwt(_0x222bab,_0x4ca8c8,_0x34afed);}else{if(_0x5928e1){_0x34afed();}else{return _0x4ca8c8['status'](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x222bab[_0x62c0('0x3f')][_0x62c0('0x40')]){try{var _0x50caad={'audience':hardwareConf[_0x62c0('0x41')](),'issuer':hardwareConf[_0x62c0('0x41')]()};verifyJwt(_0x222bab['query'][_0x62c0('0x40')],_0x50caad)['then'](function(_0x31b672){return db[_0x62c0('0x3a')]['find']({'where':{'id':_0x31b672[_0x62c0('0x42')]}})[_0x62c0('0x31')](function(_0x5e47ef){_0x15322e=_0x5e47ef;return db['Setting'][_0x62c0('0x2d')]({'where':{'id':0x1},'attributes':[_0x62c0('0x43'),'blockDuration'],'raw':!![]});})[_0x62c0('0x31')](function(_0x347e9e){if(!_0x15322e||!_[_0x62c0('0x44')](_0x15322e[_0x62c0('0x45')],_0x31b672[_0x62c0('0x46')])){return _0x4ca8c8[_0x62c0('0x32')](0x191)[_0x62c0('0x34')]({'message':_0x62c0('0x47')});}if(_0x15322e[_0x62c0('0x48')]){return _0x4ca8c8[_0x62c0('0x32')](0x191)['json']({'message':_0x62c0('0x49')});}if(_0x15322e[_0x62c0('0x4a')]){if(_0x347e9e[_0x62c0('0x4b')]>0x0){if(moment(_0x15322e['blockedAt'])[_0x62c0('0x4c')](_0x347e9e[_0x62c0('0x4b')],_0x62c0('0x4d'))>moment()){return _0x4ca8c8[_0x62c0('0x32')](0x191)[_0x62c0('0x34')]({'message':_0x62c0('0x49')});}}else{return _0x4ca8c8[_0x62c0('0x32')](0x191)[_0x62c0('0x34')]({'message':_0x62c0('0x49')});}}_0x222bab[_0x62c0('0x2b')]={'id':_0x15322e['id']};_0x34afed();});})[_0x62c0('0x4e')](function(){return _0x4ca8c8[_0x62c0('0x32')](0x191)[_0x62c0('0x34')]({'message':_0x62c0('0x49')});});}catch(_0x425862){_0x34afed(_0x425862);}}else if(_0x5928e1){_0x34afed();}else{return _0x4ca8c8[_0x62c0('0x32')](0x193)[_0x62c0('0x34')]({'message':_0x62c0('0x4f')});}})[_0x62c0('0x2a')](function(_0xd224,_0x36a21c,_0x232b74){if(_0xd224[_0x62c0('0x2b')]){db['User'][_0x62c0('0x3b')]({'where':{'id':_0xd224[_0x62c0('0x2b')]['id']},'attributes':userAttributes})[_0x62c0('0x31')](function(_0x5211fb){if(!_0x5211fb){return _0x36a21c['status'](0x194)[_0x62c0('0x34')]({'message':_0x62c0('0x50')});}_0xd224[_0x62c0('0x2b')]=_0x5211fb;_0x232b74();})[_0x62c0('0x4e')](function(_0x1fcc85){_0x232b74(_0x1fcc85);});}else if(_0x5928e1){_0x232b74();}else{return _0x36a21c[_0x62c0('0x32')](0x194)['json']({'message':_0x62c0('0x51')});}});};exports[_0x62c0('0x52')]=function canUpdate(){return compose()[_0x62c0('0x2a')](function(_0x211c5a,_0x3e2cdf,_0x3da343){return licenseUtil[_0x62c0('0x53')]()[_0x62c0('0x31')](function(_0x1840b4){if(_0x1840b4[_0x62c0('0x54')]){_0x3da343();}else{return _0x3e2cdf[_0x62c0('0x32')](0x193)[_0x62c0('0x34')]({'message':_0x62c0('0x55')});}})[_0x62c0('0x4e')](function(_0x59b885){_0x3da343(_0x59b885);});});};exports[_0x62c0('0x56')]=function(_0xe09b97,_0x36636d,_0x1f4c18){_0xe09b97[_0x62c0('0x56')]=!![];return _0x1f4c18();};exports[_0x62c0('0x57')]=function signToken(_0x541e82){return signJwt(_0x541e82);};exports[_0x62c0('0x58')]=function(_0x53029c,_0x3a9532){if(!_0x53029c['user']){return _0x3a9532[_0x62c0('0x32')](0x194)[_0x62c0('0x34')]({'message':_0x62c0('0x59')});}var _0x412541={'payload':{'id':_0x53029c[_0x62c0('0x2b')]['id'],'role':_0x53029c[_0x62c0('0x2b')][_0x62c0('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x412541)[_0x62c0('0x31')](function(_0x21ad84){_0x3a9532['cookie'](_0x62c0('0x5a'),_0x21ad84);_0x3a9532[_0x62c0('0x5b')](_0x62c0('0x5c'));})['catch'](function(_0x4959d7){return _0x3a9532[_0x62c0('0x32')](0x1f4)[_0x62c0('0x5d')](_0x4959d7);});};exports[_0x62c0('0x5e')]=function(_0x1d0577){if(_['isNil'](_0x1d0577[_0x62c0('0x45')])||_[_0x62c0('0x5f')](_0x1d0577[_0x62c0('0x60')])){return null;}else{return createJwt(_0x1d0577);}};exports['generateApiKey']=function(_0x45ca26){_0x45ca26[_0x62c0('0x45')]=generateNonce();_0x45ca26[_0x62c0('0x60')]=generateIssuedAt();return createJwt(_0x45ca26);};exports[_0x62c0('0x61')]=function(_0xba15a4,_0x1c0ec6){var _0x2252b1=_0xba15a4[_0x62c0('0x3f')][_0x62c0('0x40')];if(_0x2252b1){var _0x5b4db3={'nonce':_0x1c0ec6['apiKeyNonce'],'iat':_0x1c0ec6[_0x62c0('0x60')],'audience':hardwareConf[_0x62c0('0x41')](),'issuer':hardwareConf[_0x62c0('0x41')]()};return verifyJwt(_0x2252b1,_0x5b4db3)[_0x62c0('0x31')](function(){return generateApiKey(_0x1c0ec6);});}else{throw{'message':_0x62c0('0x62')};}};exports[_0x62c0('0x63')]=function(_0x49f24f){var _0xf59580=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xf59580[_0x62c0('0x64')](_0x49f24f))throw new db[(_0x62c0('0x65'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x15c166,_0x1d3cd4,_0x47aa8a){var _0x51c96a=encryptor[_0x62c0('0x66')](_0x1d3cd4)[_0x62c0('0x67')](',');for(var _0x3f3562=0x0;_0x3f3562<_0x47aa8a;_0x3f3562++){if(!_0x51c96a[_0x3f3562])break;if(_0x15c166[_0x62c0('0x68')]()===_0x51c96a[_0x3f3562][_0x62c0('0x68')]()){var _0x546294=util['format'](_0x62c0('0x69'),_0x47aa8a);if(_0x47aa8a===0x1){_0x546294='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x62c0('0x65'))][(_0x62c0('0x6a'))](_0x546294);}}return;};exports[_0x62c0('0x6b')]=function(_0x5a833b,_0x4139ef){var _0x1ce1aa=_0x4139ef?encryptor['decryptString'](_0x4139ef)[_0x62c0('0x67')](','):[];if(_0x1ce1aa['length']===0x5){_0x1ce1aa[_0x62c0('0x6c')](-0x1,0x1);}_0x1ce1aa[_0x62c0('0x6d')](_0x5a833b);return encryptor[_0x62c0('0x6e')](_0x1ce1aa[_0x62c0('0x6f')](','));};function signJwt(_0x4e8d98){var _0x576d85=BPromise[_0x62c0('0x70')](jwt['sign'],{'context':jwt});var _0x3e3d1b=_0x4e8d98[_0x62c0('0x71')]||config[_0x62c0('0xb')][_0x62c0('0xc')];return new BPromise(function(_0x3b6288,_0x397152){_0x576d85(_0x4e8d98[_0x62c0('0x72')],_0x3e3d1b,_0x4e8d98[_0x62c0('0x73')])['then'](function(_0x5d336f){_0x3b6288(_0x5d336f);})[_0x62c0('0x4e')](function(_0x4da243){_0x397152(_0x4da243);});});}function verifyJwt(_0x46a4dd,_0x541e37,_0x127c09){var _0xfe0c27=BPromise['promisify'](jwt[_0x62c0('0x74')],{'context':jwt});var _0x37936f=_0x127c09||config[_0x62c0('0xb')]['session'];return new BPromise(function(_0x27676a,_0x5105bc){_0xfe0c27(_0x46a4dd,_0x37936f,_0x541e37)[_0x62c0('0x31')](function(_0x26810b){_0x27676a(_0x26810b);})[_0x62c0('0x4e')](function(_0xcaaa28){_0x5105bc(_0xcaaa28);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString']('hex');}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x62c0('0x75')]();}function createJwt(_0x818d2d){var _0x3ce479={'payload':{'iat':_0x818d2d['apiKeyIat'],'nonce':_0x818d2d[_0x62c0('0x45')]},'options':{'algorithm':_0x62c0('0x76'),'subject':_0x818d2d['id']['toString'](),'issuer':hardwareConf[_0x62c0('0x41')](),'audience':hardwareConf[_0x62c0('0x41')]()}};return signJwt(_0x3ce479)[_0x62c0('0x31')](function(_0x5587f9){return{'iat':_0x818d2d[_0x62c0('0x60')],'nonce':_0x818d2d[_0x62c0('0x45')],'token':_0x5587f9};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 40fab7e..a5142d0 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 _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 +var _0x038b=['bluebird','../../config/environment','secrets','aes-256-ctr','hasOwnProperty','createWriteStream','createCipher','algorithm','data','update','binary','write','end','final','close','decryptFile','createReadStream','createDecipher','unlink','secret','utf8','base64','decryptString'];(function(_0x55b133,_0x252c39){var _0x55dfb2=function(_0x45ec67){while(--_0x45ec67){_0x55b133['push'](_0x55b133['shift']());}};_0x55dfb2(++_0x252c39);}(_0x038b,0x114));var _0xb038=function(_0x2b95d4,_0x42abab){_0x2b95d4=_0x2b95d4-0x0;var _0x358260=_0x038b[_0x2b95d4];return _0x358260;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xb038('0x0'));var config=require(_0xb038('0x1'));const stringOptions={'secret':config[_0xb038('0x2')]['session'],'algorithm':_0xb038('0x3')};const fileOptions={'algorithm':'aes192'};function combineOptions(_0x23574d){var _0x3d090b={};for(var _0x4a8a30 in fileOptions){if(fileOptions[_0xb038('0x4')](_0x4a8a30)){_0x3d090b[_0x4a8a30]=fileOptions[_0x4a8a30];}}if(_0x23574d){for(var _0x11da3a in _0x23574d){if(_0x23574d['hasOwnProperty'](_0x11da3a)){_0x3d090b[_0x11da3a]=_0x23574d[_0x11da3a];}}}return _0x3d090b;}exports['encryptFile']=function(_0x2e3e64,_0x1b077a,_0x1534a9,_0x4b4085){return new BPromise(function(_0x48a4d7,_0x462e8f){_0x4b4085=combineOptions(_0x4b4085);var _0x20c102=new Buffer(_0x1534a9);var _0x4d85b4=fs['createReadStream'](_0x2e3e64);var _0xe3d046=fs[_0xb038('0x5')](_0x1b077a);var _0x5c96b5=crypto[_0xb038('0x6')](_0x4b4085[_0xb038('0x7')],_0x20c102);_0x4d85b4['on'](_0xb038('0x8'),function(_0x3368c1){var _0x3a09a3=new Buffer(_0x5c96b5[_0xb038('0x9')](_0x3368c1),_0xb038('0xa'));_0xe3d046[_0xb038('0xb')](_0x3a09a3);});_0x4d85b4['on'](_0xb038('0xc'),function(){try{var _0x57acd8=new Buffer(_0x5c96b5[_0xb038('0xd')](_0xb038('0xa')),_0xb038('0xa'));_0xe3d046[_0xb038('0xb')](_0x57acd8);_0xe3d046[_0xb038('0xc')]();_0xe3d046['on'](_0xb038('0xe'),function(){return _0x48a4d7(_0x1b077a);});}catch(_0x13f893){fs['unlink'](_0x1b077a);return _0x462e8f(_0x13f893);}});});};exports[_0xb038('0xf')]=function(_0x26e4f2,_0x183141,_0x39323e,_0xdef213){return new BPromise(function(_0x2b4173,_0x5246c3){_0xdef213=combineOptions(_0xdef213);var _0x2a4134=new Buffer(_0x39323e);var _0x3039b0=fs[_0xb038('0x10')](_0x26e4f2);var _0x3b095a=fs['createWriteStream'](_0x183141);var _0x49b237=crypto[_0xb038('0x11')](_0xdef213[_0xb038('0x7')],_0x2a4134);_0x3039b0['on'](_0xb038('0x8'),function(_0x31c348){var _0x4fd2e8=new Buffer(_0x49b237[_0xb038('0x9')](_0x31c348),_0xb038('0xa'));_0x3b095a[_0xb038('0xb')](_0x4fd2e8);});_0x3039b0['on'](_0xb038('0xc'),function(){try{var _0xc6cd61=new Buffer(_0x49b237['final'](_0xb038('0xa')),_0xb038('0xa'));_0x3b095a[_0xb038('0xb')](_0xc6cd61);_0x3b095a[_0xb038('0xc')]();_0x3b095a['on']('close',function(){return _0x2b4173(_0x183141);});}catch(_0x2812c9){fs[_0xb038('0x12')](_0x183141);return _0x5246c3(_0x2812c9);}});});};exports['encryptString']=function(_0x1eb9cd,_0x43d403,_0x573f93){var _0x241329=_0x573f93||stringOptions['algorithm'];var _0x25ff46=_0x43d403||stringOptions[_0xb038('0x13')];var _0x27ff21=crypto[_0xb038('0x6')](_0x241329,_0x25ff46);var _0x5d4343=_0x27ff21[_0xb038('0x9')](_0x1eb9cd,_0xb038('0x14'),'base64');_0x5d4343+=_0x27ff21[_0xb038('0xd')](_0xb038('0x15'));return _0x5d4343;};exports[_0xb038('0x16')]=function(_0x5d18c8,_0xa8fe18,_0x3af191){var _0x1fa72d=_0x3af191||stringOptions['algorithm'];var _0x41abf4=_0xa8fe18||stringOptions[_0xb038('0x13')];var _0x28a6a9=crypto[_0xb038('0x11')](_0x1fa72d,_0x41abf4);var _0xc387d=_0x28a6a9['update'](_0x5d18c8,_0xb038('0x15'),_0xb038('0x14'));_0xc387d+=_0x28a6a9[_0xb038('0xd')](_0xb038('0x14'));return _0xc387d;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 1388f8a..3841351 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 _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 +var _0x5636=['mkdirSync','csv','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','num','%s\x20limit\x20%d\x20OFFSET\x20%d','push','.csv','join'];(function(_0x9c8c83,_0x16ebdd){var _0x4636ac=function(_0x5bacfc){while(--_0x5bacfc){_0x9c8c83['push'](_0x9c8c83['shift']());}};_0x4636ac(++_0x16ebdd);}(_0x5636,0x102));var _0x6563=function(_0xca31aa,_0x25bb9e){_0xca31aa=_0xca31aa-0x0;var _0x5f4e26=_0x5636[_0xca31aa];return _0x5f4e26;};'use strict';var util=require(_0x6563('0x0'));var path=require(_0x6563('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x6563('0x2'));var rimraf=require(_0x6563('0x3'));var db=require(_0x6563('0x4'))['db'];var dbH=require('../../mysqldb')[_0x6563('0x5')];var logger=require(_0x6563('0x6'))(_0x6563('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x6563('0x8')][0x2]);var QUERY=process[_0x6563('0x8')][0x3];var PATH=process[_0x6563('0x8')][0x4];function analyticExtractedReport(_0x9884a9,_0x2d57d5){var _0x2d0d5b={'status':_0x9884a9};var _0x98fcd4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2d57d5){_0x2d0d5b[_0x6563('0x9')]=_0x2d57d5;}return db[_0x6563('0xa')][_0x6563('0xb')](_0x2d0d5b,_0x98fcd4);}function main(){var _0x516d1a=0x1388;var _0x51fdc2;logger[_0x6563('0xc')](util[_0x6563('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x6563('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6563('0xf'),_0x6563('0x10')]})[_0x6563('0x11')](function(_0x33816e){if(_0x33816e){_0x51fdc2=_0x33816e;_0x516d1a=_0x51fdc2[_0x6563('0x10')]||0x1388;}})[_0x6563('0x11')](function(){return dbH[_0x6563('0x12')][_0x6563('0x13')](util['format'](_0x6563('0x14'),QUERY),{'type':dbH['sequelize'][_0x6563('0x15')][_0x6563('0x16')]});})[_0x6563('0x11')](function(_0x10d08c){if(!_0x10d08c[0x0]['num']){return analyticExtractedReport(_0x6563('0x17'));}var _0x11baa2=[];var _0x477d9b=0x0;var _0xd398ce=!![];if(_0x10d08c&&_0x10d08c['length']){var _0x3563fd=_0x10d08c[0x0]['num']%(_0x477d9b+_0x516d1a);if(_0x51fdc2['split']){for(;_0xd398ce;_0x477d9b+=_0x516d1a,_0x3563fd=_0x10d08c[0x0]['num']%(_0x477d9b+_0x516d1a)){if(_0x3563fd==0x0||_0x3563fd==_0x10d08c[0x0][_0x6563('0x18')]){_0xd398ce=![];}_0x11baa2['push'](dbH['sequelize'][_0x6563('0x13')](util[_0x6563('0xd')](_0x6563('0x19'),QUERY,_0x516d1a,_0x477d9b),{'type':dbH[_0x6563('0x12')][_0x6563('0x15')][_0x6563('0x16')]}));}}else{_0x11baa2[_0x6563('0x1a')](dbH[_0x6563('0x12')][_0x6563('0x13')](QUERY,{'type':dbH['sequelize'][_0x6563('0x15')][_0x6563('0x16')]}));}}var _0x20b478=path['dirname'](PATH);var _0x293db2=path['basename'](PATH,_0x6563('0x1b'));var _0x105379=_0x51fdc2['split']&&_0x11baa2['length']>0x1;var _0x3ab7f6=[];if(!fs['existsSync'](path[_0x6563('0x1c')](_0x20b478,_0x293db2))&&_0x105379){fs[_0x6563('0x1d')](path[_0x6563('0x1c')](_0x20b478,_0x293db2));}return BPromise['each'](_0x11baa2,function(_0xd860d5){_0x3ab7f6['push'](_0xd860d5);})[_0x6563('0x11')](function(){for(var _0x1590e6=0x0;_0x1590e6<_0x3ab7f6['length'];_0x1590e6+=0x1){var _0x365b16;var _0x28252d=_0x3ab7f6[_0x1590e6];if(_0x105379){_0x365b16=path['join'](_0x20b478,_0x293db2,util[_0x6563('0xd')]('%s%d.%s',_0x293db2,_0x1590e6,_0x6563('0x1e')));}else{_0x365b16=path['join'](_0x20b478,util['format'](_0x6563('0x1f'),_0x293db2,_0x6563('0x1e')));}fs[_0x6563('0x20')](_0x365b16,csv(_0x28252d));}})[_0x6563('0x11')](function(){if(_0x105379){zipdir(path[_0x6563('0x1c')](_0x20b478,_0x293db2),{'saveTo':path['join'](_0x20b478,util[_0x6563('0xd')]('%s.%s',_0x293db2,'zip'))},function(_0x3582c9,_0x35af37){});rimraf(path[_0x6563('0x1c')](_0x20b478,_0x293db2),function(){});}})[_0x6563('0x11')](function(){logger[_0x6563('0xc')](util[_0x6563('0xd')](_0x6563('0x21'),EXTRACTED_REPORT_ID,_0x6563('0x22')));return analyticExtractedReport(_0x6563('0x23'),_0x105379?util[_0x6563('0xd')]('%s.%s',_0x293db2,_0x105379?_0x6563('0x24'):_0x6563('0x1e')):null);});})[_0x6563('0x25')](function(_0x1558fb){logger[_0x6563('0xc')](util[_0x6563('0xd')](_0x6563('0x26'),EXTRACTED_REPORT_ID,'CSV'),util[_0x6563('0x27')](_0x1558fb,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x6563('0x28'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index f95cfd3..e334552 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(_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 +var _0x5f2f=['hasOwnProperty','push','num','Empty','dirname','basename','Setting','find','split','splitSizePdf','then','length','query','format','QueryTypes','SELECT','sequelize','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','landscape','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','%s.%s','createWriteStream','finish','err','end','info','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','lodash','bluebird','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport'];(function(_0x1a58ba,_0x28888c){var _0x231bed=function(_0x47e789){while(--_0x47e789){_0x1a58ba['push'](_0x1a58ba['shift']());}};_0x231bed(++_0x28888c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x720b50,_0x39fd7a){_0x720b50=_0x720b50-0x0;var _0x502e62=_0x5f2f[_0x720b50];return _0x502e62;};'use strict';var _=require(_0xf5f2('0x0'));var fs=require('fs');var BPromise=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var path=require(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var PdfPrinter=require(_0xf5f2('0x5'));var zipdir=require(_0xf5f2('0x6'));var rimraf=require(_0xf5f2('0x7'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf5f2('0x8')];var logger=require(_0xf5f2('0x9'))(_0xf5f2('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xf5f2('0xb')][0x2]);var QUERY=process[_0xf5f2('0xb')][0x3];var PATH=process[_0xf5f2('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xf5f2('0xc');var _extractedReport;function analyticExtractedReport(_0x46cd9c,_0x2ec345){var _0x56a69f={'status':_0x46cd9c};var _0x375da4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ec345){_0x56a69f[_0xf5f2('0xd')]=_0x2ec345;}return db[_0xf5f2('0xe')]['update'](_0x56a69f,_0x375da4);}function getHeader(_0x977a59){var _0x4ebbbe=[];for(var _0x53fb33 in _0x977a59){if(_0x977a59[_0xf5f2('0xf')](_0x53fb33)){_0x4ebbbe[_0xf5f2('0x10')]({'text':_0x53fb33,'style':'tableHeader'});}}return _0x4ebbbe;}function extractReport(_0x336f6b){var _0x14b51f=0x1388;var _0x331482;if(!_0x336f6b[0x0][_0xf5f2('0x11')]){return analyticExtractedReport(_0xf5f2('0x12'));}var _0x3e5956=[];var _0x5c01b8=0x0;var _0x5850f4=!![];var _0xea612c=path[_0xf5f2('0x13')](PATH);var _0x1c1a5c=path[_0xf5f2('0x14')](PATH,'.pdf');var _0xafe430=![];var _0x286197=[];return db[_0xf5f2('0x15')][_0xf5f2('0x16')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf5f2('0x17'),_0xf5f2('0x18')]})[_0xf5f2('0x19')](function(_0x395a5a){if(_0x395a5a){_0x331482=_0x395a5a;_0x14b51f=_0x331482[_0xf5f2('0x18')]||0x3e8;}})[_0xf5f2('0x19')](function(){if(_0x336f6b&&_0x336f6b[_0xf5f2('0x1a')]){var _0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f);if(_0x331482[_0xf5f2('0x17')]){for(;_0x5850f4;_0x5c01b8+=_0x14b51f,_0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f)){if(_0x28e097==0x0||_0x28e097==_0x336f6b[0x0][_0xf5f2('0x11')]){_0x5850f4=![];}_0x3e5956[_0xf5f2('0x10')](dbH['sequelize'][_0xf5f2('0x1b')](util[_0xf5f2('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14b51f,_0x5c01b8),{'type':dbH['sequelize'][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}else{_0x3e5956['push'](dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](QUERY,{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}_0xafe430=_0x331482['split']&&_0x3e5956[_0xf5f2('0x1a')]>0x1;if(!fs[_0xf5f2('0x20')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c))&&_0xafe430){fs[_0xf5f2('0x22')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c));}return BPromise['each'](_0x3e5956,function(_0x529f07){_0x286197[_0xf5f2('0x10')](_0x529f07);});})[_0xf5f2('0x19')](function(){return BPromise[_0xf5f2('0x23')](_0x3e5956,function(_0x1a5bb3,_0xf6c58d){var _0x788a8d;var _0x13a3be=util[_0xf5f2('0x1c')](_0xf5f2('0x24'),NAME,_extractedReport['name'],moment(_extractedReport[_0xf5f2('0x25')])[_0xf5f2('0x1c')](FORMAT),moment(_extractedReport[_0xf5f2('0x26')])[_0xf5f2('0x1c')](FORMAT));var _0x198c73={'pageSize':'A4','pageOrientation':_0xf5f2('0x27'),'content':[{'text':_0x13a3be,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x22c826={'headerRows':0x1,'body':[]};_0x22c826[_0xf5f2('0x28')][_0xf5f2('0x10')](getHeader(_0x1a5bb3[0x0]));var _0x5027ab;for(var _0x5a2c7e=0x0;_0x5a2c7e<_0x1a5bb3[_0xf5f2('0x1a')];_0x5a2c7e+=0x1){_0x5027ab=[];for(var _0x50b8a2 in _0x1a5bb3[_0x5a2c7e]){if(_0x1a5bb3[_0x5a2c7e][_0xf5f2('0xf')](_0x50b8a2)){_0x5027ab[_0xf5f2('0x10')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]?_[_0xf5f2('0x29')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]):'');}}_0x22c826['body']['push'](_0x5027ab);}_0x198c73[_0xf5f2('0x2a')]['push']({'table':_0x22c826});return new BPromise(function(_0xb744b9,_0x58a4df){var _0x45b643=new PdfPrinter({'Roboto':{'normal':__dirname+_0xf5f2('0x2b'),'bold':__dirname+_0xf5f2('0x2c'),'italics':__dirname+_0xf5f2('0x2d'),'bolditalics':__dirname+_0xf5f2('0x2e')}});var _0x277eee=_0x45b643[_0xf5f2('0x2f')](_0x198c73);if(_0xafe430){_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c,util['format'](_0xf5f2('0x30'),_0x1c1a5c,_0xf6c58d,_0xf5f2('0x31')));}else{_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xf5f2('0x31')));}var _0x297c0c=_0x277eee['pipe'](fs[_0xf5f2('0x33')](_0x788a8d));_0x297c0c['on'](_0xf5f2('0x34'),function(){_0xb744b9();});_0x297c0c['on']('error',function(_0x3fc168){console['log'](_0xf5f2('0x35'),_0x3fc168);_0x58a4df(_0x3fc168);});_0x277eee[_0xf5f2('0x36')]();});});})[_0xf5f2('0x19')](function(){if(_0xafe430){return new BPromise(function(_0x2e3cca,_0x59a6dd){zipdir(path['join'](_0xea612c,_0x1c1a5c),{'saveTo':path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,'zip'))},function(_0x41447f){if(_0x41447f){_0x59a6dd(_0x41447f);}else{_0x2e3cca();}});});}})['then'](function(){if(_0xafe430){rimraf(path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c),function(){});}})['then'](function(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf5f2('0x38')));return analyticExtractedReport(_0xf5f2('0x39'),_0xafe430?util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xafe430?'zip':'pdf'):null);});}function main(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')](_0xf5f2('0x3a'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')));return db[_0xf5f2('0xe')][_0xf5f2('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf5f2('0x19')](function(_0x4c0ac7){_extractedReport=_0x4c0ac7;return dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](util['format'](_0xf5f2('0x3d'),QUERY),{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]});})[_0xf5f2('0x19')](extractReport)[_0xf5f2('0x3e')](function(_0x462ea3){logger[_0xf5f2('0x37')](util['format'](_0xf5f2('0x3f'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')),util[_0xf5f2('0x40')](_0x462ea3,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 7f961c2..cfea593 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 _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 +var _0x8df6=['catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util','path','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','dirname','basename','.xlsx','existsSync','join','mkdirSync','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed'];(function(_0x1296fe,_0x329852){var _0x10466e=function(_0x2b4b4d){while(--_0x2b4b4d){_0x1296fe['push'](_0x1296fe['shift']());}};_0x10466e(++_0x329852);}(_0x8df6,0xee));var _0x68df=function(_0xac89f9,_0x2f5de5){_0xac89f9=_0xac89f9-0x0;var _0x2eeb59=_0x8df6[_0xac89f9];return _0x2eeb59;};'use strict';var util=require(_0x68df('0x0'));var path=require(_0x68df('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x68df('0x2'));var BPromise=require(_0x68df('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x68df('0x4'));var db=require(_0x68df('0x5'))['db'];var dbH=require('../../mysqldb')[_0x68df('0x6')];var logger=require(_0x68df('0x7'))(_0x68df('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x68df('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x68df('0x9')][0x4];function analyticExtractedReport(_0x313251,_0x41bff5){var _0x7b6b14={'status':_0x313251};var _0x4572b6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x41bff5){_0x7b6b14[_0x68df('0xa')]=_0x41bff5;}return db[_0x68df('0xb')][_0x68df('0xc')](_0x7b6b14,_0x4572b6);}function main(){var _0x3d5aff=0x1388;var _0x2e8fa2;logger[_0x68df('0xd')](util[_0x68df('0xe')](_0x68df('0xf'),EXTRACTED_REPORT_ID,_0x68df('0x10')));return db[_0x68df('0x11')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x68df('0x12'),_0x68df('0x13')]})[_0x68df('0x14')](function(_0x3ee3d1){if(_0x3ee3d1){_0x2e8fa2=_0x3ee3d1;_0x3d5aff=_0x2e8fa2[_0x68df('0x13')]||0x1388;}})[_0x68df('0x14')](function(){return dbH[_0x68df('0x15')][_0x68df('0x16')](util[_0x68df('0xe')](_0x68df('0x17'),QUERY),{'type':dbH['sequelize'][_0x68df('0x18')][_0x68df('0x19')]});})[_0x68df('0x14')](function(_0x4e79aa){if(!_0x4e79aa[0x0][_0x68df('0x1a')]){return analyticExtractedReport(_0x68df('0x1b'));}var _0x19f726=[];var _0x4e1530=0x0;var _0x50273d=!![];if(_0x2e8fa2['split']){if(_0x4e79aa&&_0x4e79aa[_0x68df('0x1c')]){var _0x3f62e9=_0x4e79aa[0x0][_0x68df('0x1a')]%(_0x4e1530+_0x3d5aff);for(;_0x50273d;_0x4e1530+=_0x3d5aff,_0x3f62e9=_0x4e79aa[0x0][_0x68df('0x1a')]%(_0x4e1530+_0x3d5aff)){if(_0x3f62e9==0x0||_0x3f62e9==_0x4e79aa[0x0][_0x68df('0x1a')]){_0x50273d=![];}_0x19f726[_0x68df('0x1d')](dbH['sequelize'][_0x68df('0x16')](util[_0x68df('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3d5aff,_0x4e1530),{'type':dbH[_0x68df('0x15')]['QueryTypes'][_0x68df('0x19')]}));}}}else{_0x19f726[_0x68df('0x1d')](dbH[_0x68df('0x15')][_0x68df('0x16')](QUERY,{'type':dbH[_0x68df('0x15')][_0x68df('0x18')][_0x68df('0x19')]}));}var _0x3dc6f4=path[_0x68df('0x1e')](PATH);var _0x2c8f23=path[_0x68df('0x1f')](PATH,_0x68df('0x20'));var _0x186e4c=_0x2e8fa2[_0x68df('0x12')]&&_0x19f726[_0x68df('0x1c')]>0x1;var _0x423d41=[];if(!fs[_0x68df('0x21')](path[_0x68df('0x22')](_0x3dc6f4,_0x2c8f23))&&_0x186e4c){fs[_0x68df('0x23')](path[_0x68df('0x22')](_0x3dc6f4,_0x2c8f23));}return BPromise['each'](_0x19f726,function(_0x5cb1ea){_0x423d41['push'](_0x5cb1ea);})['then'](function(){for(var _0x483ebc=0x0;_0x483ebc<_0x423d41['length'];_0x483ebc+=0x1){var _0x519b0a;var _0x7a3d44=_0x423d41[_0x483ebc];if(_0x186e4c){_0x519b0a=path['join'](_0x3dc6f4,_0x2c8f23,util[_0x68df('0xe')](_0x68df('0x24'),_0x2c8f23,_0x483ebc,_0x68df('0x25')));}else{_0x519b0a=path[_0x68df('0x22')](_0x3dc6f4,util[_0x68df('0xe')](_0x68df('0x26'),_0x2c8f23,_0x68df('0x25')));}fs[_0x68df('0x27')](_0x519b0a,json2xls(_0x7a3d44),_0x68df('0x28'));}})['then'](function(){if(_0x186e4c){zipdir(path[_0x68df('0x22')](_0x3dc6f4,_0x2c8f23),{'saveTo':path[_0x68df('0x22')](_0x3dc6f4,util[_0x68df('0xe')]('%s.%s',_0x2c8f23,_0x68df('0x29')))},function(_0x3a6744,_0x4bf63a){});rimraf(path['join'](_0x3dc6f4,_0x2c8f23),function(){});}})[_0x68df('0x14')](function(){logger['info'](util[_0x68df('0xe')](_0x68df('0x2a'),EXTRACTED_REPORT_ID,_0x68df('0x10')));return analyticExtractedReport(_0x68df('0x2b'),_0x186e4c?util[_0x68df('0xe')](_0x68df('0x26'),_0x2c8f23,_0x186e4c?_0x68df('0x29'):_0x68df('0x25')):null);});})[_0x68df('0x2c')](function(_0x2e7840){logger['info'](util['format'](_0x68df('0x2d'),EXTRACTED_REPORT_ID,_0x68df('0x10')),util[_0x68df('0x2e')](_0x2e7840,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 18c12b2..debddec 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 _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 +var _0x4de5=['filter','groupBy','playback','hasOwnProperty','extensions','extension','find','type','format','context','priority','outbound','push','CDR(destination)=','${EXTEN:','cutdigits','VoiceExtensionId','Set','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','concat','Hangup','bulkCreate','sortBy','catch','error','rewrite','util','models','Interval','findAll','then','intervals','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)'];(function(_0x2e2fb3,_0x628269){var _0x42125a=function(_0x1e1a80){while(--_0x1e1a80){_0x2e2fb3['push'](_0x2e2fb3['shift']());}};_0x42125a(++_0x628269);}(_0x4de5,0xbb));var _0x54de=function(_0x5deea7,_0x122937){_0x5deea7=_0x5deea7-0x0;var _0x4e95eb=_0x4de5[_0x5deea7];return _0x4e95eb;};'use strict';var _=require('lodash');var util=require(_0x54de('0x0'));function rewrite(_0x4b5213,_0x143539){var _0x2a88a2=this;return _0x4b5213[_0x54de('0x1')][_0x54de('0x2')][_0x54de('0x3')]({'raw':!![]})[_0x54de('0x4')](function(_0x356ff6){_0x2a88a2[_0x54de('0x5')]=_0x356ff6;return _0x4b5213[_0x54de('0x1')]['VoiceExtension'][_0x54de('0x3')]({'where':{'IntervalId':_0x143539['IntervalId']},'raw':!![]});})[_0x54de('0x4')](function(_0x423a72){return _0x4b5213[_0x54de('0x1')][_0x54de('0x6')][_0x54de('0x3')]({'where':{'exten':{'$in':_[_0x54de('0x7')](_[_0x54de('0x8')](_0x423a72,_0x54de('0x9')))}},'order':[{'raw':_0x54de('0xa')}],'raw':!![]});})[_0x54de('0x4')](function(_0x31991e){var _0xdaf277=_['filter'](_0x31991e,{'priority':'1'});var _0x4484c5=_[_0x54de('0xb')](_0x31991e,{'isApp':0x1});var _0xd26666=_[_0x54de('0xc')](_0x4484c5,'exten');var _0x57d80f=['queue',_0x54de('0xd')];var _0x22ae74=[];var _0x22e3e3=[];for(var _0x43e2e9 in _0xd26666){if(_0xd26666[_0x54de('0xe')](_0x43e2e9)){_0x2a88a2['priority']=0x2;_0x2a88a2[_0x54de('0xf')]=[];_0x2a88a2[_0x54de('0x10')]=_[_0x54de('0x11')](_0xdaf277,{'exten':_0xd26666[_0x43e2e9][0x0][_0x54de('0x9')]});_0x2a88a2['extensions']['push']({'type':_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')],'app':'Set','appdata':util[_0x54de('0x13')]('CDR(type)=%s',_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')]),'context':_0xd26666[_0x43e2e9][0x0][_0x54de('0x14')],'exten':_0xd26666[_0x43e2e9][0x0][_0x54de('0x9')],'priority':_0x2a88a2[_0x54de('0x15')]++,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0]['VoiceExtensionId']});if(_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')]===_0x54de('0x16')){if(_0x2a88a2[_0x54de('0x10')]){_0x2a88a2[_0x54de('0xf')][_0x54de('0x17')]({'type':_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')],'app':'Set','appdata':_0x54de('0x18')+(_0x2a88a2['extension']['cutdigits']?_0x54de('0x19')+_0x2a88a2[_0x54de('0x10')][_0x54de('0x1a')]+'}':'${EXTEN}'),'context':_0xd26666[_0x43e2e9][0x0]['context'],'exten':_0xd26666[_0x43e2e9][0x0]['exten'],'priority':_0x2a88a2[_0x54de('0x15')]++,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]});}_0x2a88a2['extensions'][_0x54de('0x17')]({'type':_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')],'app':_0x54de('0x1c'),'appdata':_0x54de('0x1d')+_0xd26666[_0x43e2e9][0x0]['VoiceExtensionId'],'context':_0xd26666[_0x43e2e9][0x0][_0x54de('0x14')],'exten':_0xd26666[_0x43e2e9][0x0]['exten'],'priority':_0x2a88a2[_0x54de('0x15')]++,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]});var _0x1bfeb8=_0x2a88a2[_0x54de('0x15')]++;_0x2a88a2[_0x54de('0xf')]['push']({'type':_0xd26666[_0x43e2e9][0x0]['type'],'app':_0x54de('0x1e'),'appdata':_0x54de('0x1f')+(_0x1bfeb8+0x2)+_0x54de('0x20')+(_0x1bfeb8+0x1)+')','context':_0xd26666[_0x43e2e9][0x0]['context'],'exten':_0xd26666[_0x43e2e9][0x0]['exten'],'priority':_0x1bfeb8,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]});if(_0x2a88a2[_0x54de('0x10')]){_0x2a88a2[_0x54de('0xf')][_0x54de('0x17')]({'type':_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')],'app':_0x54de('0x1c'),'appdata':_0x2a88a2['extension'][_0x54de('0x1a')]?'CDR(prefix)=${EXTEN:0:'+_0x2a88a2[_0x54de('0x10')][_0x54de('0x1a')]+'}':_0x54de('0x21'),'context':_0xd26666[_0x43e2e9][0x0][_0x54de('0x14')],'exten':_0xd26666[_0x43e2e9][0x0][_0x54de('0x9')],'priority':_0x2a88a2['priority']++,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0]['VoiceExtensionId']});}_0x2a88a2['extensions'][_0x54de('0x17')]({'type':_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')],'app':_0x54de('0x1c'),'appdata':_0x54de('0x22')+_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')],'context':_0xd26666[_0x43e2e9][0x0][_0x54de('0x14')],'exten':_0xd26666[_0x43e2e9][0x0][_0x54de('0x9')],'priority':_0x2a88a2[_0x54de('0x15')]++,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]});if(_0x2a88a2[_0x54de('0x10')]&&_0x2a88a2[_0x54de('0x10')][_0x54de('0xe')](_0x54de('0x23'))&&_0x2a88a2[_0x54de('0x10')]['recordingFormat']!=='none'){_0x2a88a2[_0x54de('0xf')][_0x54de('0x17')]({'type':_0xd26666[_0x43e2e9][0x0]['type'],'app':_0x54de('0x1c'),'appdata':_0x54de('0x24'),'context':_0xd26666[_0x43e2e9][0x0]['context'],'exten':_0xd26666[_0x43e2e9][0x0][_0x54de('0x9')],'priority':_0x2a88a2[_0x54de('0x15')]++,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]});_0x2a88a2[_0x54de('0xf')][_0x54de('0x17')]({'type':_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')],'app':_0x54de('0x1c'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x2a88a2[_0x54de('0x10')]['recordingFormat']||_0x54de('0x25'),'context':_0xd26666[_0x43e2e9][0x0]['context'],'exten':_0xd26666[_0x43e2e9][0x0][_0x54de('0x9')],'priority':_0x2a88a2['priority']++,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]});}}_0x2a88a2[_0x54de('0xf')][_0x54de('0x17')]({'type':_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')],'app':_0x54de('0x1c'),'appdata':_0x54de('0x26'),'context':_0xd26666[_0x43e2e9][0x0][_0x54de('0x14')],'exten':_0xd26666[_0x43e2e9][0x0]['exten'],'priority':_0x2a88a2['priority']++,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0]['VoiceExtensionId']});_0x2a88a2[_0x54de('0xf')]['push']({'type':_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')],'app':_0x54de('0x1c'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0xd26666[_0x43e2e9][0x0][_0x54de('0x14')],'exten':_0xd26666[_0x43e2e9][0x0][_0x54de('0x9')],'priority':_0x2a88a2[_0x54de('0x15')]++,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]});_0x2a88a2['extensions'][_0x54de('0x17')]({'type':_0xd26666[_0x43e2e9][0x0]['type'],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0xd26666[_0x43e2e9][0x0][_0x54de('0x14')],'exten':_0xd26666[_0x43e2e9][0x0]['exten'],'priority':_0x2a88a2[_0x54de('0x15')]++,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]});for(var _0x429de6=0x0,_0x2f50b4=0x0;_0x429de6<_0xd26666[_0x43e2e9][_0x54de('0x27')];_0x429de6+=0x1,_0x2f50b4=0x0){var _0x3aa2e9=_0xd26666[_0x43e2e9][_0x429de6];if(_0x3aa2e9[_0x54de('0x12')]){_0x3aa2e9[_0x54de('0x12')]=_0x3aa2e9[_0x54de('0x12')][_0x54de('0x28')]();}var _0x1f5405=[];var _0xfe60d2=[];delete _0x3aa2e9['id'];delete _0x3aa2e9[_0x54de('0x29')];delete _0x3aa2e9[_0x54de('0x2a')];var _0x2b275a=_0x3aa2e9[_0x54de('0x2b')]!==_0x54de('0x2c')?[_0x3aa2e9[_0x54de('0x2b')]]:_0x3aa2e9['IntervalId']?_[_0x54de('0x8')](_[_0x54de('0xb')](_0x2a88a2[_0x54de('0x5')],{'IntervalId':_0x3aa2e9[_0x54de('0x2d')]}),_0x54de('0x2b')):[];if(_0x3aa2e9[_0x54de('0xe')](_0x54de('0x2e'))){if(_0x3aa2e9[_0x54de('0x2e')]&&_0x3aa2e9[_0x54de('0x2e')]!=='--'){_0x1f5405[_0x54de('0x17')]({'type':_0x3aa2e9[_0x54de('0x12')],'app':_0x54de('0x1c'),'appdata':'CDR(tag)='+_0x3aa2e9['tag'],'context':_0x3aa2e9['context'],'exten':_0x3aa2e9[_0x54de('0x9')],'priority':_0x2b275a[_0x54de('0x27')]+_0x2a88a2[_0x54de('0x15')]+_0x2f50b4++,'VoiceExtensionId':_0x3aa2e9[_0x54de('0x1b')]});}}if(_0x3aa2e9[_0x54de('0x12')]===_0x54de('0x16')&&_0x3aa2e9[_0x54de('0xe')](_0x54de('0x2f'))){if(_0x3aa2e9[_0x54de('0x2f')]){_0x1f5405['push']({'type':_0x3aa2e9[_0x54de('0x12')],'app':_0x54de('0x1e'),'appdata':_0x54de('0x30')+_0x3aa2e9[_0x54de('0x2f')]+')','context':_0x3aa2e9[_0x54de('0x14')],'exten':_0x3aa2e9[_0x54de('0x9')],'priority':_0x2b275a[_0x54de('0x27')]+_0x2a88a2[_0x54de('0x15')]+_0x2f50b4++,'VoiceExtensionId':_0x3aa2e9[_0x54de('0x1b')]});}else{_0x1f5405[_0x54de('0x17')]({'type':_0x3aa2e9[_0x54de('0x12')],'app':'ExecIf','appdata':_0x54de('0x31'),'context':_0x3aa2e9[_0x54de('0x14')],'exten':_0x3aa2e9['exten'],'priority':_0x2b275a['length']+_0x2a88a2[_0x54de('0x15')]+_0x2f50b4++,'VoiceExtensionId':_0x3aa2e9[_0x54de('0x1b')]});}}if(_0x3aa2e9[_0x54de('0xe')](_0x54de('0x32'))){if(_0x57d80f['indexOf'](_0x3aa2e9[_0x54de('0x33')][_0x54de('0x28')]())>=0x0&&_0x3aa2e9[_0x54de('0x34')]!==_0x54de('0x35')){if(_0x3aa2e9[_0x54de('0x32')]){_0x1f5405['push']({'type':_0x3aa2e9[_0x54de('0x12')],'app':'ExecIf','appdata':_0x54de('0x36'),'context':_0x3aa2e9[_0x54de('0x14')],'exten':_0x3aa2e9[_0x54de('0x9')],'priority':_0x2b275a[_0x54de('0x27')]+_0x2a88a2[_0x54de('0x15')]+_0x2f50b4++,'VoiceExtensionId':_0x3aa2e9[_0x54de('0x1b')]});_0x1f5405[_0x54de('0x17')]({'type':_0x3aa2e9[_0x54de('0x12')],'app':_0x54de('0x1c'),'appdata':_0x54de('0x37'),'context':_0x3aa2e9[_0x54de('0x14')],'exten':_0x3aa2e9['exten'],'priority':_0x2b275a[_0x54de('0x27')]+_0x2a88a2[_0x54de('0x15')]+_0x2f50b4++,'VoiceExtensionId':_0x3aa2e9[_0x54de('0x1b')]});}else{_0x1f5405[_0x54de('0x17')]({'type':_0x3aa2e9['type'],'app':_0x54de('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x3aa2e9['context'],'exten':_0x3aa2e9[_0x54de('0x9')],'priority':_0x2b275a['length']+_0x2a88a2['priority']+_0x2f50b4++,'VoiceExtensionId':_0x3aa2e9[_0x54de('0x1b')]});_0x1f5405[_0x54de('0x17')]({'type':_0x3aa2e9['type'],'app':_0x54de('0x1c'),'appdata':_0x54de('0x38'),'context':_0x3aa2e9[_0x54de('0x14')],'exten':_0x3aa2e9['exten'],'priority':_0x2b275a[_0x54de('0x27')]+_0x2a88a2[_0x54de('0x15')]+_0x2f50b4++,'VoiceExtensionId':_0x3aa2e9['VoiceExtensionId']});}}}for(var _0x192ae8=0x0;_0x192ae8<_0x2b275a[_0x54de('0x27')];_0x192ae8+=0x1){var _0x4a9175=_0x2a88a2[_0x54de('0x15')]+_0x2b275a[_0x54de('0x27')];var _0x135f34=_0x192ae8===_0x2b275a[_0x54de('0x27')]-0x1?_0x2a88a2[_0x54de('0x15')]+_0x1f5405[_0x54de('0x27')]+_0xfe60d2[_0x54de('0x27')]+0x2:_0x2a88a2['priority']+_0x192ae8+0x1;_0x1f5405[_0x54de('0x39')](_0x192ae8,0x0,{'type':_0x3aa2e9[_0x54de('0x12')],'app':'GotoIfTime','appdata':_0x2b275a[_0x192ae8]+'?'+_0x3aa2e9['context']+_0x54de('0x3a')+_0x4a9175+':'+_0x3aa2e9[_0x54de('0x14')]+_0x54de('0x3a')+_0x135f34,'exten':_0x3aa2e9['exten'],'context':_0x3aa2e9[_0x54de('0x14')],'priority':_0x2a88a2[_0x54de('0x15')]+_0x192ae8,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]});}_0x3aa2e9[_0x54de('0x15')]=_0x1f5405['length']?_['last'](_0x1f5405)[_0x54de('0x15')]+0x1:_0x2a88a2[_0x54de('0x15')];_0x2a88a2[_0x54de('0x15')]=(_0xfe60d2[_0x54de('0x27')]?_['last'](_0xfe60d2)[_0x54de('0x15')]:_0x3aa2e9['priority'])+0x1;_0x2a88a2[_0x54de('0xf')]=_[_0x54de('0x3b')](_0x2a88a2[_0x54de('0xf')],_0x1f5405,[_0x3aa2e9],_0xfe60d2);}_0x2a88a2[_0x54de('0xf')][_0x54de('0x17')]({'type':_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')],'app':_0x54de('0x3c'),'exten':_0xd26666[_0x43e2e9][0x0][_0x54de('0x9')],'context':_0xd26666[_0x43e2e9][0x0]['context'],'priority':_0x2a88a2[_0x54de('0x15')],'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]});_0x22ae74[_0x54de('0x17')](_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]);_0x22e3e3=_[_0x54de('0x3b')](_0x22e3e3,_0x2a88a2[_0x54de('0xf')]);}}return _0x4b5213['transaction'](function(_0x6a5fd1){return _0x4b5213[_0x54de('0x1')]['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x22ae74}},'transaction':_0x6a5fd1})['then'](function(_0x422794){return _0x4b5213['models'][_0x54de('0x6')][_0x54de('0x3d')](_[_0x54de('0x3e')](_0x22e3e3,_0x54de('0x15')),{'transaction':_0x6a5fd1});});});})[_0x54de('0x3f')](function(_0x1c3dbe){console[_0x54de('0x40')](_0x1c3dbe);});}exports[_0x54de('0x41')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index dd9ec5a..724440d 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 _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 +var _0xbaf0=['YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','into','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','fromQuery','cm_contacts','str','cm_hopper_final','\x20=\x20?','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','onlyIfOpen','catch','all','BlackLists','get','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','duplicate','pause','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate'];(function(_0x327ec2,_0x56195d){var _0x4e2ff7=function(_0x4d351f){while(--_0x4d351f){_0x327ec2['push'](_0x327ec2['shift']());}};_0x4e2ff7(++_0x56195d);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require('bluebird');var util=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var fs=require('fs');var squel=require(_0x0baf('0x2'));var Papa=require(_0x0baf('0x3'));var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));config[_0x0baf('0x8')]=_[_0x0baf('0x9')](config[_0x0baf('0x8')],{'host':_0x0baf('0xa'),'port':0x18eb});var socket=require(_0x0baf('0xb'))(new Redis(config[_0x0baf('0x8')]));require(_0x0baf('0xc'))['register'](socket);try{if(!process[_0x0baf('0xd')][0x2]||process['argv'][0x2]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x2]===_0x0baf('0xf')){throw new Error(_0x0baf('0x10'));}var FILEPATH=process[_0x0baf('0xd')][0x2];if(!process[_0x0baf('0xd')][0x3]||process[_0x0baf('0xd')][0x3]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x3]===_0x0baf('0xf')||!process[_0x0baf('0xd')][0x4]||process['argv'][0x4]==='undefined'||process[_0x0baf('0xd')][0x4]===_0x0baf('0xf')){throw new Error(_0x0baf('0x11'));}var FIELDS=_[_0x0baf('0x12')](process['argv'][0x3][_0x0baf('0x13')](','),process['argv'][0x4][_0x0baf('0x13')](','));if(!process[_0x0baf('0xd')][0x5]||process[_0x0baf('0xd')][0x5]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x5]===_0x0baf('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x0baf('0xd')][0x6]&&process[_0x0baf('0xd')][0x6]!==_0x0baf('0xe')&&process[_0x0baf('0xd')][0x6]!==_0x0baf('0xf')?process[_0x0baf('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x0baf('0xd')][0x7]!==_0x0baf('0xe')&&process[_0x0baf('0xd')][0x7]!==_0x0baf('0xf')?process[_0x0baf('0xd')][0x7]:null;if(!process[_0x0baf('0xd')][0x8]||process['argv'][0x8]==='undefined'||process[_0x0baf('0xd')][0x8]===_0x0baf('0xf')){throw new Error(_0x0baf('0x14'));}var SOCKET_TIMESTAMP=process[_0x0baf('0xd')][0x8];}catch(_0x1fa92b){logger[_0x0baf('0x15')](_0x1fa92b);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x210cd8,_0x636a13,_0x2c42e2,_0x15a2c3){var _0x54f2fa={'message':_0x636a13};_0x54f2fa[_0x210cd8]=!![];if(_0x2c42e2){_0x54f2fa[_0x0baf('0x16')]=_0x2c42e2;}if(_0x15a2c3){_0x54f2fa['index']=_0x15a2c3;}return _0x54f2fa;}function isEmail(_0xf6c158){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0xf6c158);}function checkRow(_0x4de74c,_0x2ef0aa,_0x48a0e9){return new BPromise(function(_0x4be1b9,_0x47c4b){if(_[_0x0baf('0x17')](_0x4de74c)){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x18'),null,_0x48a0e9));}if(_0x4de74c[_0x0baf('0x19')]&&_0x4de74c['errors'][_0x0baf('0x1a')]){var _0x4681c5=_[_0x0baf('0x1b')](_0x4de74c[_0x0baf('0x19')],_0x0baf('0x1c'))[_0x0baf('0x1d')](';');return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x4681c5,null,_0x48a0e9));}var _0x549fd0={};for(var _0x1590b4 in FIELDS){if(FIELDS[_0x0baf('0x1e')](_0x1590b4)&&FIELDS[_0x1590b4]){_0x549fd0[_0x1590b4]=_0x4de74c[_0x0baf('0x1f')][0x0][FIELDS[_0x1590b4]]||_0x4de74c[_0x0baf('0x1f')][0x0]['\ufeff'+FIELDS[_0x1590b4]];}}if(!_0x549fd0['firstName']){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x20'),null,_0x48a0e9));}if(!_0x549fd0['phone']){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x21'),null,_0x48a0e9));}if(_0x549fd0[_0x0baf('0x22')]){var _0xb4dbb1=moment(_0x549fd0[_0x0baf('0x22')],_0x0baf('0x23'));if(!_0xb4dbb1[_0x0baf('0x24')]()){return _0x47c4b(handleCheckRowError('error',_0x0baf('0x25'),null,_0x48a0e9));}}if(_0x549fd0[_0x0baf('0x26')]){if(!isEmail(_0x549fd0[_0x0baf('0x26')])){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x27'),null,_0x48a0e9));}}_0x549fd0[_0x0baf('0x28')]=LISTID;_0x549fd0[_0x0baf('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0baf('0x1a')]&&_0x2ef0aa){var _0x59431b={};for(var _0x3ded64=0x0,_0x2adfd7=DUPLICATES[_0x0baf('0x1a')];_0x3ded64<_0x2adfd7;_0x3ded64+=0x1){_0x59431b[DUPLICATES[_0x3ded64]]=_0x549fd0[DUPLICATES[_0x3ded64]];}var _0x45294a=_[_0x0baf('0x2a')](_0x2ef0aa,_0x59431b);if(_0x45294a){return _0x47c4b(handleCheckRowError('duplicate',_0x0baf('0x2b'),_0x45294a,_0x48a0e9));}}return db['CmContact'][_0x0baf('0x2c')](_0x549fd0,{'raw':!![],'hooks':![],'fields':_[_0x0baf('0x2d')](_0x549fd0)})[_0x0baf('0x2e')](function(_0x3d65f2){if(DUPLICATES&&DUPLICATES['length']&&_0x2ef0aa){_0x2ef0aa[_0x0baf('0x2f')](_[_0x0baf('0x30')](_0x549fd0,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3d65f2['id'];return _0x4be1b9();})['catch'](function(_0x23d890){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x31')+(_0x23d890[_0x0baf('0x1c')]||JSON[_0x0baf('0x32')](_0x23d890)),null,_0x48a0e9));});});}function checkHopper(){function _0x1b0991(){return function(_0xe03d82){logger[_0x0baf('0x15')]('cmContact',_0x0baf('0x33'),util[_0x0baf('0x34')](_0xe03d82,{'showHidden':![],'depth':null}));};}var _0x5b991f=function(_0x32c022,_0x57783c){var _0x5c545f=squel[_0x0baf('0x35')]()[_0x0baf('0x36')]('cm_hopper')['fromQuery']([_0x0baf('0x37'),_0x0baf('0x38'),_0x0baf('0x39'),_0x0baf('0x28'),_0x57783c,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),_0x0baf('0x37'))[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x38'))[_0x0baf('0x3d')]('id','ContactId')[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),'ListId')[_0x0baf('0x3d')](_0x32c022['id'][_0x0baf('0x3f')](),_0x57783c)[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3a'))[_0x0baf('0x3d')]('NOW()',_0x0baf('0x3b'))[_0x0baf('0x40')]('cm_contacts')[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')](_0x0baf('0x43'),LISTID['toString']())[_0x0baf('0x41')](_0x0baf('0x44'))[_0x0baf('0x41')](_0x0baf('0x45'),squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'))[_0x0baf('0x40')](_0x0baf('0x46'))[_0x0baf('0x41')](_0x57783c+'\x20=\x20?',_0x32c022['id'][_0x0baf('0x3f')]())))[_0x0baf('0x3f')]();return _0x5c545f;};var _0x1daf1d=function(_0x339aff,_0x22207a){var _0x55f4f8=squel[_0x0baf('0x35')]()[_0x0baf('0x36')](_0x0baf('0x46'))[_0x0baf('0x47')]([_0x0baf('0x37'),'scheduledAt',_0x0baf('0x39'),_0x0baf('0x28'),_0x22207a,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),'phone')[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x38'))['field']('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),_0x0baf('0x28'))[_0x0baf('0x3d')](_0x339aff['id'][_0x0baf('0x3f')](),_0x22207a)[_0x0baf('0x3d')]('NOW()',_0x0baf('0x3a'))[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')](_0x0baf('0x43'),LISTID[_0x0baf('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44'))[_0x0baf('0x41')](_0x0baf('0x45'),squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')]('calleridnum')[_0x0baf('0x40')](_0x0baf('0x4a'))[_0x0baf('0x41')](_0x22207a+_0x0baf('0x4b'),_0x339aff['id'][_0x0baf('0x3f')]()))[_0x0baf('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0baf('0x3c')]()['field'](_0x0baf('0x37'))['from'](_0x0baf('0x46'))['where'](_0x22207a+_0x0baf('0x4b'),_0x339aff['id']['toString']())))[_0x0baf('0x3f')]();return _0x55f4f8;};function _0xcf7b8d(_0x411c1f,_0x4520d1){var _0x42a68b=squel['insert']()[_0x0baf('0x36')](_0x0baf('0x46'))[_0x0baf('0x47')]([_0x0baf('0x37'),_0x0baf('0x38'),_0x0baf('0x39'),'ListId',_0x4520d1,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),_0x0baf('0x37'))[_0x0baf('0x3d')]('NOW()','scheduledAt')[_0x0baf('0x3d')]('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),_0x0baf('0x28'))[_0x0baf('0x3d')](_0x411c1f['id'][_0x0baf('0x3f')](),_0x4520d1)[_0x0baf('0x3d')](_0x0baf('0x3e'),'createdAt')[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))['where'](_0x0baf('0x43'),LISTID[_0x0baf('0x3f')]())[_0x0baf('0x41')](_0x0baf('0x4c'),squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44')))[_0x0baf('0x3f')]();return _0x42a68b;}function _0x498405(_0x178495,_0x5dc434){var _0x3c00e7=squel['insert']()['into'](_0x0baf('0x4d'))['fromQuery']([_0x0baf('0x37'),_0x0baf('0x39'),'ListId',_0x5dc434,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()['field']('phone',_0x0baf('0x37'))[_0x0baf('0x3d')]('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),'ListId')[_0x0baf('0x3d')](_0x178495['id']['toString'](),_0x5dc434)['field']('NOW()',_0x0baf('0x3a'))['field']('NOW()',_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')]('ListId\x20=\x20?',LISTID[_0x0baf('0x3f')]())[_0x0baf('0x41')](_0x0baf('0x4c'),squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44')))['toString']();return _0x3c00e7;}return db[_0x0baf('0x4e')][_0x0baf('0x4f')]({'where':{'type':_0x0baf('0x50')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x0baf('0x51')],'as':_0x0baf('0x52'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x2c20fe){var _0x125906=[];if(_0x2c20fe){var _0x27a959;for(var _0x4cc046=0x0,_0x5874cc;_0x4cc046<_0x2c20fe['length'];_0x4cc046+=0x1){_0x5874cc=_0x2c20fe[_0x4cc046]['get']({'plain':!![]});switch(_0x5874cc[_0x0baf('0x53')]){case _0x0baf('0x54'):_0x125906[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x1daf1d(_0x5874cc,_0x0baf('0x57')))['then'](function(){})['catch'](_0x1b0991()));break;case _0x0baf('0x58'):_0x125906['push'](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x5b991f(_0x5874cc,'VoiceQueueId'))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));break;default:_0x125906[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0xcf7b8d(_0x5874cc,_0x0baf('0x57')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}}return _0x125906;})[_0x0baf('0x5a')]()['then'](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0baf('0x5b'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x333b07){var _0x20a514=[];if(_0x333b07){var _0x5093f5;for(var _0x1be7f2=0x0,_0x410f6c;_0x1be7f2<_0x333b07['length'];_0x1be7f2+=0x1){_0x410f6c=_0x333b07[_0x1be7f2]['get']({'plain':!![]});_0x20a514[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x498405(_0x410f6c,_0x0baf('0x57')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}return _0x20a514;})[_0x0baf('0x5a')]();})[_0x0baf('0x2e')](function(){return db['Campaign'][_0x0baf('0x4f')]({'attributes':['id',_0x0baf('0x53')],'include':[{'model':db['CmList'],'as':_0x0baf('0x52'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x538f24){var _0x97d385=[];if(_0x538f24){for(var _0x4043d5=0x0,_0x421ca0;_0x4043d5<_0x538f24[_0x0baf('0x1a')];_0x4043d5+=0x1){_0x421ca0=_0x538f24[_0x4043d5][_0x0baf('0x5c')]({'plain':!![]});switch(_0x421ca0['dialCheckDuplicateType']){case'always':_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')]['query'](_0x1daf1d(_0x421ca0,_0x0baf('0x5d')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));break;case'onlyIfOpen':_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x5b991f(_0x421ca0,'CampaignId'))[_0x0baf('0x2e')](function(){})['catch'](_0x1b0991()));break;default:_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0xcf7b8d(_0x421ca0,_0x0baf('0x5d')))[_0x0baf('0x2e')](function(){})['catch'](_0x1b0991()));}}}return _0x97d385;})[_0x0baf('0x5a')]();})[_0x0baf('0x2e')](function(){return db['Campaign'][_0x0baf('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x0baf('0x51')],'as':_0x0baf('0x5b'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x1cbbcc){var _0x250df2=[];if(_0x1cbbcc){for(var _0xa4fd1b=0x0,_0x1cda78;_0xa4fd1b<_0x1cbbcc[_0x0baf('0x1a')];_0xa4fd1b+=0x1){_0x1cda78=_0x1cbbcc[_0xa4fd1b][_0x0baf('0x5c')]({'plain':!![]});_0x250df2[_0x0baf('0x2f')](db[_0x0baf('0x55')]['query'](_0x498405(_0x1cda78,'CampaignId'))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}return _0x250df2;})[_0x0baf('0x5a')]();})['catch'](function(_0x507783){logger[_0x0baf('0x15')](_0x0baf('0x5e'),_0x0baf('0x5f'),_0x507783[_0x0baf('0x1c')]);});}var processPromises=function(_0x2dcdfe){return BPromise[_0x0baf('0x5a')](promises)[_0x0baf('0x2e')](function(_0xa2d315){})[_0x0baf('0x59')](function(_0x4e8e85){logger[_0x0baf('0x15')](_0x0baf('0x60'),JSON[_0x0baf('0x32')](_0x4e8e85));})[_0x0baf('0x61')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2dcdfe){return _0x2dcdfe['resume']();}});};var endCsv=function(){return BPromise[_0x0baf('0x62')]()[_0x0baf('0x2e')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x0baf('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0baf('0x64')](FILEPATH);}catch(_0x52e0c4){logger[_0x0baf('0x15')](_0x0baf('0x65'),JSON[_0x0baf('0x32')](_0x52e0c4));}finally{process[_0x0baf('0x66')](0x0);}});};process['on'](_0x0baf('0x67'),function(){logger[_0x0baf('0x68')](_0x0baf('0x69'));endCsv();});function main(){return BPromise[_0x0baf('0x62')]()[_0x0baf('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0baf('0x13')](',');return db[_0x0baf('0x6a')][_0x0baf('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1ed607){var _0xd0f63b=fs[_0x0baf('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0baf('0x6c')](_0xd0f63b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3c37b4,_0x195303){total+=0x1;var _0x49d411=total;promises[_0x0baf('0x2f')](checkRow(_0x3c37b4,_0x1ed607,_0x49d411)[_0x0baf('0x2e')](function(){success+=0x1;})[_0x0baf('0x59')](function(_0x457ae8){if(_0x457ae8[_0x0baf('0x15')]){errors+=0x1;delete _0x457ae8['error'];}else if(_0x457ae8[_0x0baf('0x6d')]){duplicates+=0x1;delete _0x457ae8[_0x0baf('0x6d')];}rows[_0x0baf('0x2f')](_0x457ae8);}));if(total%0xc8===0x0){_0x195303[_0x0baf('0x6e')]();return processPromises(_0x195303);}},'complete':function(){return processPromises()[_0x0baf('0x2e')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0xb5f4e5,_0x5a2454){logger[_0x0baf('0x68')]('CSV\x20parse\x20error',JSON[_0x0baf('0x32')](_0xb5f4e5));endCsv();}});})[_0x0baf('0x59')](function(_0x1ce7bb){logger[_0x0baf('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x0baf('0x32')](_0x1ce7bb));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 30c6cec..24fcfda 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 _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 +var _0xa478=['where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_hopper_black','.id\x20=\x20','ListId\x20=\x20?','\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','min_id','group','info','error','message','exit','errors','sequelize','catch','main','stringify','start','binding','root','.csv','writeFileSync','parse','length','rows','data','hasOwnProperty','trim','replace','isValid','push','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','firstName','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','format','scheduledat',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','each','finish','affectedRows','unlink','complete','argv','existsSync','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','uncaughtException','lodash','moment','squel','ioredis','../../../mysqldb','../../../config/environment','import','defaults','localhost','socket.io-emitter','redis','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xa478,0x1da));var _0x8a47=function(_0x49b14d,_0x578d07){_0x49b14d=_0x49b14d-0x0;var _0x3d2488=_0xa478[_0x49b14d];return _0x3d2488;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x8a47('0x0'));var Papa=require('papaparse');var util=require('util');var BPromise=require('bluebird');var moment=require(_0x8a47('0x1'));var squel=require(_0x8a47('0x2'));var Redis=require(_0x8a47('0x3'));var db=require(_0x8a47('0x4'))['db'];var config=require(_0x8a47('0x5'));var logger=require('../../../config/logger')(_0x8a47('0x6'));config['redis']=_[_0x8a47('0x7')](config['redis'],{'host':_0x8a47('0x8'),'port':0x18eb});var socket=require(_0x8a47('0x9'))(new Redis(config[_0x8a47('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0x8a47('0xb'));function isEmail(_0x52ca7f){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))*$/[_0x8a47('0xc')](_0x52ca7f);}function selectNotIn(_0x493914,_0xe781ab,_0x4a473c,_0x45062d,_0x2025a8){return squel[_0x8a47('0xd')]()[_0x8a47('0xe')](_0x8a47('0xf'))[_0x8a47('0x10')](_0x45062d)[_0x8a47('0x11')](_0xe781ab,null,_0xe781ab+'.id\x20=\x20'+_0x45062d+'.'+_0x4a473c)[_0x8a47('0x12')](_0x45062d+'.'+_0x4a473c+_0x8a47('0x13')+_0x493914+'.'+_0x4a473c)['where'](_0xe781ab+_0x8a47('0x14')+_0x2025a8[_0x8a47('0x11')]()+')');}function insertCmHopper(_0x4a7766,_0x35cb02,_0x475956,_0x443ebf,_0x396d41){var _0x40d297=[_0x8a47('0x15'),_0x8a47('0x16'),_0x8a47('0x17'),_0x8a47('0x18'),_0x35cb02+'.'+_0x443ebf,_0x8a47('0x19'),_0x8a47('0x1a'),_0x8a47('0x1b'),_0x8a47('0x1c'),'\x22'+_0x396d41+'\x22'];return squel[_0x8a47('0x1d')]()[_0x8a47('0x1e')](_0x8a47('0x1f'))[_0x8a47('0x20')](['phone','scheduledat',_0x8a47('0x21'),_0x8a47('0x22'),_0x443ebf,_0x8a47('0x23'),_0x8a47('0x24'),_0x8a47('0x25'),'UserId',_0x8a47('0x26')],squel[_0x8a47('0xd')]()[_0x8a47('0x27')](_0x40d297)['from'](_0x35cb02)['join'](_0x8a47('0x28'),null,_0x8a47('0x29')+_0x35cb02+_0x8a47('0x2a'))[_0x8a47('0x11')](_0x475956,null,_0x475956+'.id\x20=\x20'+_0x35cb02+'.'+_0x443ebf)['where'](_0x35cb02+_0x8a47('0x2b'),_0x4a7766)[_0x8a47('0x12')](_0x8a47('0x2c'),NOW)['where'](_0x8a47('0x2d'),selectNotIn(_0x35cb02,_0x475956,_0x443ebf,_0x8a47('0x1f'),['\x22always\x22',_0x8a47('0x2e')]))[_0x8a47('0x12')](_0x8a47('0x2d'),selectNotIn(_0x35cb02,_0x475956,_0x443ebf,_0x8a47('0x1f'),[_0x8a47('0x2f')])))[_0x8a47('0x30')]();}function insertCmHopperBlack(_0x2ba6cf,_0x30efea,_0x20e6c0,_0x4567b2){var _0xe59694=[_0x8a47('0x15'),'cm_contacts.id',_0x8a47('0x18'),_0x30efea+'.'+_0x4567b2,_0x8a47('0x19'),'cm_contacts.updatedAt'];return squel[_0x8a47('0x1d')]()['into'](_0x8a47('0x31'))[_0x8a47('0x20')](['phone',_0x8a47('0x21'),_0x8a47('0x22'),_0x4567b2,_0x8a47('0x23'),_0x8a47('0x24')],squel[_0x8a47('0xd')]()['fields'](_0xe59694)['from'](_0x30efea)[_0x8a47('0x11')](_0x8a47('0x28'),null,_0x8a47('0x29')+_0x30efea+_0x8a47('0x2a'))['join'](_0x20e6c0,null,_0x20e6c0+_0x8a47('0x32')+_0x30efea+'.'+_0x4567b2)['where'](_0x30efea+_0x8a47('0x2b'),_0x2ba6cf)[_0x8a47('0x12')](_0x8a47('0x2c'),NOW)[_0x8a47('0x12')](_0x8a47('0x2d'),squel['select']()[_0x8a47('0xe')](_0x8a47('0xf'))[_0x8a47('0x10')]('cm_hopper_black')['where'](_0x8a47('0x33'),_0x2ba6cf)[_0x8a47('0x12')](_0x4567b2+_0x8a47('0x34'),_0x30efea+'.'+_0x4567b2)))[_0x8a47('0x30')]();}function insertCmContact(_0x1fdc43,_0x81aeb2,_0x54be27,_0x490446){var _0x28835f=_['concat'](_[_0x8a47('0x35')](_0x490446),['ListId',_0x8a47('0x36'),_0x8a47('0x23'),_0x8a47('0x24')]);return squel[_0x8a47('0x1d')]()[_0x8a47('0x1e')](_0x8a47('0x28'))[_0x8a47('0x20')](_0x28835f,squel['select']()[_0x8a47('0x27')](_0x28835f)['from'](_0x81aeb2)[_0x8a47('0x12')]('('+_0x54be27[_0x8a47('0x11')](',')+_0x8a47('0x37'),squel['select']()[_0x8a47('0x27')](_0x54be27)[_0x8a47('0x10')]('cm_contacts')[_0x8a47('0x12')]('ListId\x20=\x20?',_0x1fdc43)['where'](_0x8a47('0x38')))[_0x8a47('0x12')]('id\x20IN\x20?',squel[_0x8a47('0xd')]()['field']('MIN(id)',_0x8a47('0x39'))[_0x8a47('0x10')](_0x81aeb2)[_0x8a47('0x3a')](_0x54be27[_0x8a47('0x11')](','))))[_0x8a47('0x30')]();}function handleStop(){logger[_0x8a47('0x3b')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x596278){logger[_0x8a47('0x3c')](_0x596278[_0x8a47('0x3d')]);process[_0x8a47('0x3e')](0x1);}function handleError(_0x38c18c,_0x5787f3){stats[_0x8a47('0x3f')]['push']({'name':_0x5787f3['code'],'message':_0x5787f3['message'],'row':_0x38c18c});}function handleQuery(_0x51967e){logger[_0x8a47('0x3b')](_0x51967e);return db[_0x8a47('0x40')]['query'](_0x51967e)['spread'](function(_0x51f1a2){results['push'](_0x51f1a2);})[_0x8a47('0x41')](function(_0x3121a6){logger[_0x8a47('0x3c')](_0x3121a6[_0x8a47('0x3d')]);});}function main(_0xad78c5,_0x274948,_0x5d7308,_0x6347c7){logger['info'](_0x8a47('0x42'),_0xad78c5,JSON[_0x8a47('0x43')](_0x274948));process['send'](_0x8a47('0x44'));var _0x23b2d8=_0x274948[_0x8a47('0x45')];var _0x1a385f=_0x274948['socket_timestamp'];var _0x442321=path[_0x8a47('0x11')](config[_0x8a47('0x46')],'server/files/tmp',_0x1a385f+_0x8a47('0x47'));var _0x48097f=_['keys'](_0x23b2d8)[_0x8a47('0x11')]();logger[_0x8a47('0x3b')]('header',_0x48097f);fs[_0x8a47('0x48')](_0x442321,_0x48097f+'\x0a');Papa[_0x8a47('0x49')](fs['createReadStream'](_0xad78c5),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3d58e7,_0x38877e){try{for(var _0x4441a7=0x0,_0x10f8d4=[];_0x4441a7<_0x3d58e7['data'][_0x8a47('0x4a')];_0x4441a7++){stats[_0x8a47('0x4b')]+=0x1;if(_0x3d58e7[_0x8a47('0x3f')][_0x4441a7]){handleError(_0x3d58e7[_0x8a47('0x4c')][_0x4441a7],_0x3d58e7[_0x8a47('0x3f')][_0x4441a7]);}else{var _0x4853de=[];for(var _0x837177 in _0x23b2d8){if(_0x23b2d8[_0x8a47('0x4d')](_0x837177)){if(_0x3d58e7[_0x8a47('0x4c')][_0x4441a7][_0x23b2d8[_0x837177]]){var _0x5ed866=_[_0x8a47('0x4e')](_0x3d58e7[_0x8a47('0x4c')][_0x4441a7][_0x23b2d8[_0x837177]][_0x8a47('0x4f')](/"/g,'\x27'));switch(_0x837177){case'scheduledat':var _0xa2fe51=moment(_0x5ed866,_0x8a47('0xb'),!![]);if(_0xa2fe51[_0x8a47('0x50')]()){_0x10f8d4[_0x8a47('0x51')]('\x22'+_0x5ed866+'\x22');}else{_0x4853de[_0x8a47('0x51')](_0x8a47('0x52'));}break;case'priority':var _0x11a575=parseInt(_0x5ed866);_0x5ed866=_[_0x8a47('0x53')](_0x11a575)||_0x11a575<0x0||_0x11a575>0x4?_0x6347c7?0x3:0x2:_0x11a575;_0x10f8d4[_0x8a47('0x51')]('\x22'+_0x5ed866+'\x22');break;case _0x8a47('0x54'):var _0x42122d=parseInt(_0x5ed866);if(_['isNumber'](_0x42122d)&&_['includes'](_0x5d7308,_0x42122d)){_0x10f8d4[_0x8a47('0x51')]('\x22'+_0x42122d+'\x22');}else{_0x4853de[_0x8a47('0x51')](_0x8a47('0x55'));}break;case _0x8a47('0x56'):if(isEmail(_0x5ed866)){_0x10f8d4[_0x8a47('0x51')]('\x22'+_0x5ed866+'\x22');}else{_0x4853de[_0x8a47('0x51')]('email\x20wrong\x20format');}break;case _0x8a47('0x57'):var _0x2db110=moment(_0x5ed866,_0x8a47('0x58'),!![]);if(_0x2db110['isValid']()){_0x10f8d4[_0x8a47('0x51')]('\x22'+_0x5ed866+'\x22');}else{_0x4853de['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x10f8d4['push']('\x22'+_0x5ed866+'\x22');}}else{switch(_0x837177){case _0x8a47('0x59'):case _0x8a47('0xf'):_0x4853de[_0x8a47('0x51')](_0x837177+'\x20not\x20specified');break;default:_0x10f8d4[_0x8a47('0x51')]('\x22\x22');}}}}if(_0x4853de['length']){handleError(_0x3d58e7[_0x8a47('0x4c')][_0x4441a7],{'code':_0x8a47('0x5a'),'message':_0x4853de[_0x8a47('0x11')]()});}else{fs[_0x8a47('0x5b')](_0x442321,_0x10f8d4[_0x8a47('0x11')]()+'\x0a');}_0x10f8d4=[];}if(!(stats[_0x8a47('0x4b')]%0xc8)){socket[_0x8a47('0x5c')](_0x8a47('0x5d')+_0x1a385f,stats);stats[_0x8a47('0x3f')]=[];}}if(stopped){logger[_0x8a47('0x3b')](_0x8a47('0x5e'));_0x38877e[_0x8a47('0x5f')]();}}catch(_0x3836ba){handleError(_0x3d58e7[_0x8a47('0x4c')][_0x4441a7],{'code':_0x8a47('0x60'),'message':_0x3836ba['message']});logger['error'](_0x8a47('0x61'),_0x3836ba[_0x8a47('0x3d')]);}},'complete':function(){try{var _0x3f1a20=[];var _0x436fc9='cm_contacts';if(_0x274948[_0x8a47('0x62')]&&_0x274948[_0x8a47('0x62')][_0x8a47('0x4a')]){_0x436fc9=_0x8a47('0x63')+_0x1a385f;_0x3f1a20['push'](_0x8a47('0x64')+_0x436fc9+_0x8a47('0x65'));}var _0x1c2a4e=util[_0x8a47('0x66')]('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',_0x442321,_0x436fc9,_0x48097f,_0x274948[_0x8a47('0x22')],_0x274948[_0x8a47('0x36')]||null,NOW,NOW);if(_['isNil'](_0x23b2d8[_0x8a47('0x67')])){_0x1c2a4e+=_0x8a47('0x68');}_0x3f1a20['push'](_0x1c2a4e);if(_0x274948[_0x8a47('0x62')]&&_0x274948[_0x8a47('0x62')][_0x8a47('0x4a')]){_0x3f1a20['push'](insertCmContact(_0x274948[_0x8a47('0x22')],_0x436fc9,_0x274948[_0x8a47('0x62')],_0x23b2d8));_0x3f1a20[_0x8a47('0x51')](_0x8a47('0x69')+_0x436fc9+';');}_0x3f1a20[_0x8a47('0x51')](insertCmHopper(_0x274948['ListId'],_0x8a47('0x6a'),_0x8a47('0x6b'),_0x8a47('0x6c'),_0x6347c7));_0x3f1a20[_0x8a47('0x51')](insertCmHopperBlack(_0x274948[_0x8a47('0x22')],_0x8a47('0x6d'),_0x8a47('0x6b'),_0x8a47('0x6c')));_0x3f1a20[_0x8a47('0x51')](insertCmHopper(_0x274948[_0x8a47('0x22')],'campaigns_has_cm_lists','campaigns',_0x8a47('0x6e'),_0x6347c7));_0x3f1a20['push'](insertCmHopperBlack(_0x274948[_0x8a47('0x22')],'campaigns_has_cm_blacklists','campaigns',_0x8a47('0x6e')));BPromise[_0x8a47('0x6f')](_0x3f1a20,handleQuery)['then'](function(_0x42808c){stats[_0x8a47('0x70')]=!![];stats['affectedRows']=_0x274948['duplicates']&&_0x274948[_0x8a47('0x62')]['length']?results[0x2][_0x8a47('0x71')]:results[0x0]['affectedRows'];socket[_0x8a47('0x5c')](_0x8a47('0x5d')+_0x1a385f,stats);fs[_0x8a47('0x72')](_0xad78c5);fs[_0x8a47('0x72')](_0x442321);process[_0x8a47('0x3e')](0x0);})[_0x8a47('0x41')](function(_0x5c3c80){logger[_0x8a47('0x3c')](_0x5c3c80[_0x8a47('0x3d')]);process[_0x8a47('0x3e')](0x1);});}catch(_0x2a5a58){logger[_0x8a47('0x3c')](_0x8a47('0x73'),_0x2a5a58[_0x8a47('0x3d')]);process[_0x8a47('0x3e')](0x1);}},'error':function(_0x2f3a46,_0x55c52e,_0x32454e,_0x51fdab){throw new Error(_0x51fdab);}});}function validate(){if(process[_0x8a47('0x74')]&&process[_0x8a47('0x74')][_0x8a47('0x4a')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x4faa16=path[_0x8a47('0x11')](config[_0x8a47('0x46')],'server/files/tmp',process[_0x8a47('0x74')][0x2]);if(!fs[_0x8a47('0x75')](_0x4faa16)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x2fb700={};try{_0x2fb700=JSON[_0x8a47('0x49')](process[_0x8a47('0x74')][0x3]);if(!_0x2fb700[_0x8a47('0x45')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x2fb700[_0x8a47('0x45')][_0x8a47('0xf')]){throw new Error(_0x8a47('0x76'));}if(!_0x2fb700[_0x8a47('0x45')][_0x8a47('0x59')]){throw new Error(_0x8a47('0x77'));}var _0x36b7f4=0x0;if(_0x2fb700['binding'][_0x8a47('0x54')]){_0x36b7f4=0x1;}if(!_0x2fb700['ListId']){throw new Error(_0x8a47('0x78'));}}catch(_0x2826f8){throw new Error('body\x20id\x20mandatory');}var _0x7d5785=[];try{_0x7d5785=_['map'](JSON[_0x8a47('0x49')](process[_0x8a47('0x74')][0x4]),'id');}catch(_0x530bfa){logger[_0x8a47('0x3b')](_0x8a47('0x79'));}main(_0x4faa16,_0x2fb700,_0x7d5785,_0x36b7f4);}validate();process['on']('SIGINT',handleStop);process['on'](_0x8a47('0x7a'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index e312079..88b0f75 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 _0x9f88=['ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','from','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper','toString','cm_hopper_black','fields','.CmListId','field','ListId\x20=\x20?','\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','cm_contacts',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','group','info','exit','errors','code','error','main','start','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','keys','header','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','replace','scheduledat','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','includes','email','email\x20wrong\x20format','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','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','CompanyId','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','each','affectedRows','argv','arguments\x20\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\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','ioredis','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','cm_contacts_temp_','format','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','length','isNil','push','then','catch','message','split','findOne','CmContactHasItem','update','create','PHONE','inserted','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','fromQuery','scheduledat','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_hopper','\x22onlyIfOpen\x22','\x22always\x22','cm_contacts.ListId','cm_contacts.createdAt','into','cm_hopper_black','cm_contacts','cm_contacts.phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','keys'];(function(_0x382ff3,_0x1a8673){var _0x322de4=function(_0x30d611){while(--_0x30d611){_0x382ff3['push'](_0x382ff3['shift']());}};_0x322de4(++_0x1a8673);}(_0x46bb,0x186));var _0xb46b=function(_0x58c239,_0x1788bc){_0x58c239=_0x58c239-0x0;var _0x1cd7cb=_0x46bb[_0x58c239];return _0x1cd7cb;};'use strict';var fs=require('fs');var path=require(_0xb46b('0x0'));var _=require('lodash');var Papa=require(_0xb46b('0x1'));var util=require(_0xb46b('0x2'));var BPromise=require(_0xb46b('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require(_0xb46b('0x4'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xb46b('0x5'))(_0xb46b('0x6'));config[_0xb46b('0x7')]=_[_0xb46b('0x8')](config[_0xb46b('0x7')],{'host':_0xb46b('0x9'),'port':0x18eb});var socket=require(_0xb46b('0xa'))(new Redis(config[_0xb46b('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()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xb46b('0xb')+moment()[_0xb46b('0xc')]('YYYYMMDDHHmmss');var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x43f066){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))*$/[_0xb46b('0xd')](_0x43f066);}function selectNotIn(_0x2263a9,_0x4e0b34,_0x185af2,_0x31f514,_0x2c73fe){return squel[_0xb46b('0xe')]()[_0xb46b('0xf')](_0xb46b('0x10'))[_0xb46b('0x11')](_0x31f514)[_0xb46b('0x12')](_0x4e0b34,null,_0x4e0b34+_0xb46b('0x13')+_0x31f514+'.'+_0x185af2)['where'](_0x31f514+'.'+_0x185af2+_0xb46b('0x14')+_0x2263a9+'.'+_0x185af2)[_0xb46b('0x15')](_0x4e0b34+_0xb46b('0x16')+_0x2c73fe['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x557b75,_0x22e16f){promisesAdditionalPhones=[];promisesContact=[];return db[_0xb46b('0x17')][_0xb46b('0x18')](_0xb46b('0x19')+tempTableName)['spread'](function(_0x320d0f){if(_0x320d0f!==null){var _0x2501a7=[];for(var _0x27977d=0x0;_0x27977d<_0x320d0f[_0xb46b('0x1a')];_0x27977d++){var _0x3b45a6=_0x320d0f[_0x27977d];if(!_[_0xb46b('0x1b')](_0x3b45a6[_0xb46b('0x10')])){if(!_[_0xb46b('0x1b')](_0x3b45a6['AdditionalPhones']))_0x2501a7[_0xb46b('0x1c')](insertAdditionalPhones(_0x3b45a6));promisesContact[_0xb46b('0x1c')]({'contact':_0x3b45a6});}}}Promise['all'](_0x2501a7)[_0xb46b('0x1d')](function(){_0x557b75({'val':0x1});});})[_0xb46b('0x1e')](function(_0x236b39){logger['error'](_0x236b39[_0xb46b('0x1f')]);});});}function insertAdditionalPhones(_0x133bb0){return new Promise(function(_0x393a69,_0x1af559){var _0x28dce0=_0x133bb0['AdditionalPhones'];if(_['isNil'](_0x28dce0))_0x1af559({'val':0x0});else{var _0x2a3969=_0x28dce0[_0xb46b('0x20')](';');var _0x3e5126=[];orderBy=0x0;for(var _0x3df386=0x0;_0x3df386<_0x2a3969['length'];_0x3df386++){_0x3e5126[_0xb46b('0x1c')](splitAdditionalPhone(_0x133bb0['id'],_0x2a3969[_0x3df386]));}Promise['all'](_0x3e5126)[_0xb46b('0x1d')](function(){_0x393a69({'val':_0x2a3969[_0xb46b('0x1a')]});});}});}function splitAdditionalPhone(_0x3a64a0,_0x5c080a){return new Promise(function(_0x3f48e7,_0x51f8f4){var _0x5f5a2e=_0x5c080a[_0xb46b('0x20')](':');var _0x37fd88=_0x5f5a2e[0x0];var _0x3a2ad6=_0x5f5a2e[0x1];if(_0x3a2ad6!==''){var _0x2451cd=_0x3a2ad6[_0xb46b('0x20')]('|');var _0x1102bb=[];for(var _0x5a7f5a=0x0;_0x5a7f5a<_0x2451cd[_0xb46b('0x1a')];_0x5a7f5a++){if(_0x2451cd[_0x5a7f5a]!==''){var _0x389334=_['filter'](promisesAdditionalPhones,{'contactId':_0x3a64a0,'phone':_0x2451cd[_0x5a7f5a]});if(_0x389334['length']==0x0){orderBy++;promisesAdditionalPhones[_0xb46b('0x1c')]({'contactId':_0x3a64a0,'contactTypeId':_0x37fd88,'phone':_0x2451cd[_0x5a7f5a],'orderBy':orderBy});}}}_0x3f48e7({'ok':0x1});}else _0x3f48e7({'res':0x0});});}function createAdditionalPhone(_0x54e843,_0x4771b4,_0x2e30de,_0x12feea){return new Promise(function(_0x4d6207,_0x303268){return db['CmContactHasItem'][_0xb46b('0x21')]({'where':{'CmContactId':_0x54e843,'item':_0x2e30de}})['then'](function(_0x1f874c){if(_0x1f874c){return db[_0xb46b('0x22')][_0xb46b('0x23')]({'ItemTypeId':_0x4771b4,'OrderBy':_0x12feea},{'where':{'CmContactId':_0x54e843,'item':_0x2e30de}})[_0xb46b('0x1d')](function(_0x227d2a){_0x4d6207({'res':'updated'});});}else{return db[_0xb46b('0x22')][_0xb46b('0x24')]({'CmContactId':_0x54e843,'item':_0x2e30de,'ItemTypeId':_0x4771b4,'OrderBy':_0x12feea,'ItemClass':_0xb46b('0x25')})[_0xb46b('0x1d')](function(_0x75f2bc){_0x4d6207({'res':_0xb46b('0x26')});});}});});}function updateContact(_0x38d676){return new Promise(function(_0x20f233,_0x4ad807){var _0x3b312c=_0x38d676['id'];delete _0x38d676['id'];return db['CmContact'][_0xb46b('0x23')](_0x38d676,{'where':{'id':_0x3b312c}})[_0xb46b('0x1d')](function(_0x42f83b){updatedRows+=0x1;return db[_0xb46b('0x27')][_0xb46b('0x23')]({'phone':_0x38d676['phone']},{'where':{'ContactId':_0x3b312c}})[_0xb46b('0x1d')](function(_0x475d74){_0x20f233({'ret':'OK'});});});});}function insertCmHopper(_0x30fed7,_0x215d0f,_0x35eb26,_0x30ea3b,_0x2c0889){var _0x3f18ce=[_0xb46b('0x28'),_0xb46b('0x29'),_0xb46b('0x2a'),'cm_contacts.ListId',_0x215d0f+'.'+_0x30ea3b,'cm_contacts.createdAt',_0xb46b('0x2b'),_0xb46b('0x2c'),_0xb46b('0x2d'),'\x22'+_0x2c0889+'\x22'];return squel[_0xb46b('0x2e')]()['into']('cm_hopper')[_0xb46b('0x2f')]([_0xb46b('0x10'),_0xb46b('0x30'),'ContactId',_0xb46b('0x31'),_0x30ea3b,_0xb46b('0x32'),_0xb46b('0x33'),_0xb46b('0x34'),_0xb46b('0x35'),_0xb46b('0x36')],squel['select']()[_0xb46b('0x37')](_0x3f18ce)[_0xb46b('0x11')](_0x215d0f)[_0xb46b('0x12')]('cm_contacts',null,_0xb46b('0x38')+_0x215d0f+_0xb46b('0x39'))['join'](_0x35eb26,null,_0x35eb26+_0xb46b('0x13')+_0x215d0f+'.'+_0x30ea3b)[_0xb46b('0x15')](_0x215d0f+_0xb46b('0x3a'),_0x30fed7)['where'](_0xb46b('0x3b'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x215d0f,_0x35eb26,_0x30ea3b,_0xb46b('0x3c'),['\x22always\x22',_0xb46b('0x3d')]))[_0xb46b('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x215d0f,_0x35eb26,_0x30ea3b,_0xb46b('0x3c'),[_0xb46b('0x3e')])))['toString']();}function insertCmHopperBlack(_0x327d7c,_0x3df353,_0x1ccded,_0x2f81f3){var _0x1b415b=[_0xb46b('0x28'),'cm_contacts.id',_0xb46b('0x3f'),_0x3df353+'.'+_0x2f81f3,_0xb46b('0x40'),_0xb46b('0x2b')];return squel[_0xb46b('0x2e')]()[_0xb46b('0x41')](_0xb46b('0x42'))[_0xb46b('0x2f')]([_0xb46b('0x10'),'ContactId',_0xb46b('0x31'),_0x2f81f3,_0xb46b('0x32'),'updatedAt'],squel['select']()[_0xb46b('0x37')](_0x1b415b)[_0xb46b('0x11')](_0x3df353)['join'](_0xb46b('0x43'),null,_0xb46b('0x38')+_0x3df353+_0xb46b('0x39'))['join'](_0x1ccded,null,_0x1ccded+'.id\x20=\x20'+_0x3df353+'.'+_0x2f81f3)[_0xb46b('0x15')](_0x3df353+_0xb46b('0x3a'),_0x327d7c)[_0xb46b('0x15')](_0xb46b('0x3b'),NOW)[_0xb46b('0x15')](_0xb46b('0x44'),squel['select']()[_0xb46b('0xf')](_0xb46b('0x10'))[_0xb46b('0x11')](_0xb46b('0x42'))[_0xb46b('0x15')](_0xb46b('0x45'),_0x327d7c)[_0xb46b('0x15')](_0x2f81f3+'\x20=\x20?',_0x3df353+'.'+_0x2f81f3)))['toString']();}function insertCmHopperAdditionalPhones(_0x2bc28d){var _0x3d2999=[_0xb46b('0x46'),_0xb46b('0x47'),_0xb46b('0x48'),_0xb46b('0x49'),_0xb46b('0x4a')];return squel[_0xb46b('0x2e')]()[_0xb46b('0x41')]('cm_hopper_additional_phones')[_0xb46b('0x2f')]([_0xb46b('0x4b'),_0xb46b('0x10'),_0xb46b('0x4c'),'createdAt',_0xb46b('0x33')],squel[_0xb46b('0xe')]()[_0xb46b('0x37')](_0x3d2999)[_0xb46b('0x11')]('cm_hopper')[_0xb46b('0x12')](_0xb46b('0x43'),null,_0xb46b('0x4d'))[_0xb46b('0x12')](_0xb46b('0x4e'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xb46b('0x15')](_0xb46b('0x4f'),_0x2bc28d)[_0xb46b('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x59da66,_0x3edc49,_0x1c5384,_0x3ea2d1){var _0x2df2ff=_['concat'](_[_0xb46b('0x50')](_0x3ea2d1),[_0xb46b('0x31'),_0xb46b('0x51'),_0xb46b('0x32'),_0xb46b('0x33')]);return squel[_0xb46b('0x2e')]()[_0xb46b('0x41')]('cm_contacts')['fromQuery'](_0x2df2ff,squel[_0xb46b('0xe')]()[_0xb46b('0x37')](_0x2df2ff)[_0xb46b('0x11')](_0x3edc49)['where']('('+_0x1c5384['join'](',')+_0xb46b('0x52'),squel[_0xb46b('0xe')]()['fields'](_0x1c5384)[_0xb46b('0x11')]('cm_contacts')[_0xb46b('0x15')](_0xb46b('0x45'),_0x59da66))[_0xb46b('0x15')](_0xb46b('0x53'),squel[_0xb46b('0xe')]()[_0xb46b('0xf')](_0xb46b('0x54'),_0xb46b('0x55'))['from'](_0x3edc49)[_0xb46b('0x56')](_0x1c5384[_0xb46b('0x12')](','))))[_0xb46b('0x57')]();}function handleStop(){logger[_0xb46b('0x58')](_0xb46b('0x59'));stopped=!![];}function handleUncaughtException(_0x40359d){logger[_0xb46b('0x5a')](_0x40359d[_0xb46b('0x1f')]);process['exit'](0x1);}function handleError(_0x41c99f,_0x434b82){stats['errors'][_0xb46b('0x1c')]({'name':_0x434b82['code'],'message':_0x434b82[_0xb46b('0x1f')],'row':_0x41c99f});}function handleQuery(_0x106fbd){logger[_0xb46b('0x58')](_0x106fbd);return db['sequelize']['query'](_0x106fbd)[_0xb46b('0x5b')](function(_0x1cc540){results['push'](_0x1cc540);})[_0xb46b('0x1e')](function(_0x14f331){logger['error'](_0x14f331[_0xb46b('0x1f')]);});}function main(_0x4d10c9,_0x3c8282,_0x5d2b90,_0x1b2d93){logger['info'](_0xb46b('0x5c'),_0x4d10c9,JSON[_0xb46b('0x5d')](_0x3c8282));process[_0xb46b('0x5e')](_0xb46b('0x5f'));var _0xe61fab=_0x3c8282['binding'];var _0xa6d5b1=_[_0xb46b('0x60')](_0xe61fab);var _0x13a42f=_0x3c8282[_0xb46b('0x61')];var _0x336a70=path[_0xb46b('0x12')](config[_0xb46b('0x62')],_0xb46b('0x63'),_0x13a42f+_0xb46b('0x64'));logger[_0xb46b('0x58')](_0xb46b('0x65'),_0x3c8282);db[_0xb46b('0x66')][_0xb46b('0x67')]({'raw':!![],'attributes':['id','name']})[_0xb46b('0x1d')](function(_0x451102){for(var _0x15f6b3=0x0;_0x15f6b3<_0x451102[_0xb46b('0x1a')];_0x15f6b3++){if(_0x451102[_0x15f6b3]['name']in _0xe61fab){contactItemTypes[_0xb46b('0x1c')](_0x451102[_0x15f6b3]);delete _0xa6d5b1[_0x451102[_0x15f6b3][_0xb46b('0x68')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0xa6d5b1[_0xb46b('0x69')]='';var _0x675633=_[_0xb46b('0x50')](_0xa6d5b1)[_0xb46b('0x12')]();logger['info'](_0xb46b('0x6a'),_0x675633);fs[_0xb46b('0x6b')](_0x336a70,_0x675633+'\x0a');Papa[_0xb46b('0x6c')](fs['createReadStream'](_0x4d10c9),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3ec07d,_0x350943){try{for(var _0x474f39=0x0,_0x2972bc=[];_0x474f39<_0x3ec07d[_0xb46b('0x6d')]['length'];_0x474f39++){stats[_0xb46b('0x6e')]+=0x1;if(_0x3ec07d[_0xb46b('0x6f')][_0x474f39]){handleError(_0x3ec07d[_0xb46b('0x6d')][_0x474f39],_0x3ec07d[_0xb46b('0x6f')][_0x474f39]);}else{var _0x2eec76=[];var _0x4e5352=[];for(var _0x43ef1 in _0xe61fab){let _0x5399b0=contactItemTypes[_0xb46b('0x70')](_0x566663=>_0x566663[_0xb46b('0x68')]===_0x43ef1);if(_[_0xb46b('0x1b')](_0x5399b0)){if(_0xe61fab[_0xb46b('0x71')](_0x43ef1)){if(_0x3ec07d[_0xb46b('0x6d')][_0x474f39][_0xe61fab[_0x43ef1]]){var _0x48edd2=_[_0xb46b('0x72')](_0x3ec07d[_0xb46b('0x6d')][_0x474f39][_0xe61fab[_0x43ef1]][_0xb46b('0x73')](/"/g,'\x27'));switch(_0x43ef1){case _0xb46b('0x30'):var _0x567bf2=moment(_0x48edd2,_0xb46b('0x74'),!![]);if(_0x567bf2[_0xb46b('0x75')]()){_0x2972bc[_0xb46b('0x1c')]('\x22'+_0x48edd2+'\x22');}else{_0x2eec76[_0xb46b('0x1c')](_0xb46b('0x76'));}break;case _0xb46b('0x34'):var _0x767a49=parseInt(_0x48edd2);_0x48edd2=_[_0xb46b('0x77')](_0x767a49)||_0x767a49<0x0||_0x767a49>0x4?_0x1b2d93?0x3:0x2:_0x767a49;_0x2972bc[_0xb46b('0x1c')]('\x22'+_0x48edd2+'\x22');break;case _0xb46b('0x35'):var _0x349ecc=parseInt(_0x48edd2);if(_[_0xb46b('0x78')](_0x349ecc)&&_[_0xb46b('0x79')](_0x5d2b90,_0x349ecc)){_0x2972bc[_0xb46b('0x1c')]('\x22'+_0x349ecc+'\x22');}else{_0x2eec76[_0xb46b('0x1c')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x48edd2)){_0x2972bc['push']('\x22'+_0x48edd2+'\x22');}else{_0x2eec76['push']('email\x20wrong\x20format');}break;case _0xb46b('0x7a'):var _0x2fa4f4=moment(_0x48edd2,'YYYY-MM-DD',!![]);if(_0x2fa4f4['isValid']()){_0x2972bc[_0xb46b('0x1c')]('\x22'+_0x48edd2+'\x22');}else{_0x2eec76[_0xb46b('0x1c')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x2972bc[_0xb46b('0x1c')]('\x22'+_0x48edd2+'\x22');}}else{switch(_0x43ef1){case _0xb46b('0x7b'):case _0xb46b('0x10'):_0x2eec76[_0xb46b('0x1c')](_0x43ef1+_0xb46b('0x7c'));break;default:_0x2972bc[_0xb46b('0x1c')]('\x22\x22');}}}}else{var _0x4833bf='';for(var _0x45e9b4=0x0;_0x45e9b4<_0xe61fab[_0x43ef1]['length'];_0x45e9b4++){var _0x48edd2=_[_0xb46b('0x72')](_0x3ec07d[_0xb46b('0x6d')][_0x474f39][_0xe61fab[_0x43ef1][_0x45e9b4]][_0xb46b('0x73')](/"/g,'\x27'));if(_0x4833bf=='')_0x4833bf=_0x48edd2;else _0x4833bf+='|'+_0x48edd2;}_0x4e5352[_0xb46b('0x1c')](_0x5399b0['id']+':'+_0x4833bf);}}if(hasAdditionalPhones){_0x2972bc['push']('\x22'+_0x4e5352[_0xb46b('0x12')](';')+'\x22');}if(_0x2eec76[_0xb46b('0x1a')]){handleError(_0x3ec07d[_0xb46b('0x6d')][_0x474f39],{'code':_0xb46b('0x7d'),'message':_0x2eec76[_0xb46b('0x12')]()});}else{fs[_0xb46b('0x7e')](_0x336a70,_0x2972bc['join']()+'\x0a');}_0x2972bc=[];}if(!(stats[_0xb46b('0x6e')]%0xc8)){socket[_0xb46b('0x7f')](_0xb46b('0x80')+_0x13a42f,stats);stats[_0xb46b('0x6f')]=[];}}if(stopped){logger[_0xb46b('0x58')]('Abort\x20parser');_0x350943[_0xb46b('0x81')]();}}catch(_0x5edb5d){handleError(_0x3ec07d[_0xb46b('0x6d')][_0x474f39],{'code':'SystemError','message':_0x5edb5d[_0xb46b('0x1f')]});logger[_0xb46b('0x5a')](_0xb46b('0x82'),_0x5edb5d[_0xb46b('0x1f')]);}},'complete':function(){try{var _0x463f63=[];var _0x1264c2=tempTableName;_0x463f63['push'](_0xb46b('0x83')+_0x1264c2+_0xb46b('0x84'));logger[_0xb46b('0x58')](_0xb46b('0x85'),contactItemTypes[_0xb46b('0x1a')]);var _0x3226f0=util[_0xb46b('0xc')](_0xb46b('0x86'),_0x336a70,_0x1264c2,_0x675633,_0x3c8282['ListId'],_0x3c8282[_0xb46b('0x51')]||null,NOW,NOW);if(_[_0xb46b('0x1b')](_0xe61fab['scheduledat'])){_0x3226f0+=_0xb46b('0x87');}_0x463f63[_0xb46b('0x1c')](_0x3226f0);BPromise[_0xb46b('0x88')](_0x463f63,handleQuery)['then'](function(_0x1d1790){BPromise[_0xb46b('0x89')]([handleAdditionalPhones()])[_0xb46b('0x1d')](function(){_0x463f63=[];for(var _0x349467=0x0;_0x349467=_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 +var _0x075b=['utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','format','catch','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1','license','split','createDecipher','%s:%s:%s','update','base64'];(function(_0x26afb1,_0xedd07b){var _0x5586aa=function(_0x1a98af){while(--_0x1a98af){_0x26afb1['push'](_0x26afb1['shift']());}};_0x5586aa(++_0xedd07b);}(_0x075b,0x9d));var _0xb075=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x075b[_0x4565bf];return _0x5610ba;};'use strict';var crypto=require(_0xb075('0x0'));var util=require(_0xb075('0x1'));var compose=require(_0xb075('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0xb075('0x3'));function getValueFromLicense(_0x111ebc,_0x583561){if(_0x111ebc&&_0x583561){if(_0x583561[_0xb075('0x4')]&&_0x583561[_0xb075('0x5')]){var _0x5f1e01=_0x583561[_0xb075('0x4')];var _0x2f96ab=_0x583561[_0xb075('0x5')];var _0x5a5d74=_0x5f1e01[_0xb075('0x6')]('-')[0x4];var _0x2ef910=_0x5f1e01['split']('-')[0x0];var _0x26edba=crypto[_0xb075('0x7')]('aes-256-ctr',util['format'](_0xb075('0x8'),_0x5a5d74,_0x5f1e01,_0x2ef910));var _0x347b3d=_0x26edba[_0xb075('0x9')](_0x2f96ab,_0xb075('0xa'),_0xb075('0xb'));_0x347b3d+=_0x26edba[_0xb075('0xc')](_0xb075('0xb'));var _0x5b63db=JSON[_0xb075('0xd')](_0x347b3d);return _0x5b63db[_0xb075('0xe')](_0x111ebc)?_0x5b63db[_0x111ebc]:null;}}return null;}function isLimit(_0xeb15c,_0x18e4b2,_0xf0f4ea,_0x493807){var _0x56c25f=_0x18e4b2;return compose()[_0xb075('0xf')](function(_0x39cd5f,_0x48f429,_0x535669){return db[_0xb075('0x10')][_0xb075('0x11')]({'where':{'id':0x1},'raw':!![]})[_0xb075('0x12')](function(_0x362adf){var _0x18454e=getValueFromLicense(_0xeb15c,_0x362adf);return _0x18454e?_0x18454e:_0x56c25f;})[_0xb075('0x12')](function(_0x467c5e){_0x56c25f=_0x467c5e;return _0xf0f4ea[_0xb075('0x13')](_0x493807);})['then'](function(_0x268024){if(_0x268024>=_0x56c25f){return _0x48f429[_0xb075('0x14')](0x193)['json']({'message':util[_0xb075('0x15')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0xeb15c)});}_0x535669();})[_0xb075('0x16')](function(_0x48ca2b){_0x535669(_0x48ca2b);});});}function isUserLimit(){return isLimit(_0xb075('0x17'),0x1,db[_0xb075('0x18')],{'where':{'$or':[{'role':_0xb075('0x19')},{'role':_0xb075('0x1a')}]}});}exports[_0xb075('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 63449b3..810e16d 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 _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 +var _0x4c75=['$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','pop','hours','add','minutes','seconds','format','moment','parseSearch','sqlOperator','[$or]','and','replace','split','length','slice','forEach','match','filter','indexOf','conditions','push','buildExpression','DATE','operator','$eq','value','includes','$gt','$lte','days','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','$ne','$notIn','text','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring'];(function(_0x2f0b50,_0x26936d){var _0x38b09e=function(_0x418287){while(--_0x418287){_0x2f0b50['push'](_0x2f0b50['shift']());}};_0x38b09e(++_0x26936d);}(_0x4c75,0x1d9));var _0x54c7=function(_0x3cbba7,_0x23b17c){_0x3cbba7=_0x3cbba7-0x0;var _0x512e9b=_0x4c75[_0x3cbba7];return _0x512e9b;};'use strict';var _=require('lodash');var moment=require(_0x54c7('0x0'));exports[_0x54c7('0x1')]=function(_0x14c83e){var _0x3e297b={'conditions':[]};_0x3e297b[_0x54c7('0x2')]=_['startsWith'](_0x14c83e,_0x54c7('0x3'))?'or':_0x54c7('0x4');var _0x17fcc3=_0x14c83e[_0x54c7('0x5')]('[$and]','')[_0x54c7('0x5')]('[$or]','')[_0x54c7('0x6')]('||');for(var _0x3fd0d8=0x0;_0x3fd0d8<_0x17fcc3[_0x54c7('0x7')];_0x3fd0d8++){var _0x2afd29=_0x17fcc3[_0x3fd0d8][_0x54c7('0x6')](':=');var _0x1ce2a7=_0x2afd29[0x0];var _0x515550=_0x2afd29[_0x54c7('0x8')](0x1);_0x515550[_0x54c7('0x9')](function(_0x4fe70e){var _0x32512a=_0x4fe70e[_0x54c7('0x6')]('[')['shift']();var _0xf5aaad=_0x4fe70e[_0x54c7('0xa')](/\[(.*?)\]/g);_0xf5aaad['forEach'](function(_0x2f12e5){var _0x1e2517=_0x2f12e5[_0x54c7('0x6')]('[')[_0x54c7('0xb')](function(_0x5d6ab4){return _0x5d6ab4[_0x54c7('0xc')](']')>-0x1;})['map'](function(_0x25555f){return _0x25555f[_0x54c7('0x6')](']')[0x0];})[0x0];_0x3e297b[_0x54c7('0xd')][_0x54c7('0xe')]({'field':_0x1ce2a7,'operator':_0x32512a,'value':_0x1e2517});});});}return _0x3e297b;};exports[_0x54c7('0xf')]=function(_0x127da8,_0x268271,_0x306c17){var _0x2a805={};if(_0x268271===_0x54c7('0x10')){if(_0x306c17[_0x54c7('0x11')]===_0x54c7('0x12')){_0x306c17[_0x54c7('0x11')]='$between';_0x306c17[_0x54c7('0x13')]+=','+_0x306c17[_0x54c7('0x13')];}else if(_[_0x54c7('0x14')]([_0x54c7('0x15'),_0x54c7('0x16')],_0x306c17[_0x54c7('0x11')])){_0x306c17[_0x54c7('0x13')]=moment(_0x306c17[_0x54c7('0x13')])['add'](0x1,_0x54c7('0x17'))['format'](_0x54c7('0x18'));}}if(_0x306c17['castTo']){_0x268271=_0x306c17[_0x54c7('0x19')];_0x2a805['text']=_0x54c7('0x1a')+_0x127da8+'.'+_0x306c17[_0x54c7('0x1b')]+_0x54c7('0x1c')+_0x306c17['castTo']+')\x20'+parseOperator(_0x306c17[_0x54c7('0x11')]);}else{_0x2a805['text']=_0x127da8+'.'+_0x306c17[_0x54c7('0x1b')]+'\x20'+parseOperator(_0x306c17[_0x54c7('0x11')]);}if(_[_0x54c7('0x14')]([_0x54c7('0x1d'),_0x54c7('0x1e')],_0x306c17[_0x54c7('0x11')]))_0x2a805[_0x54c7('0x1f')]='('+_0x2a805[_0x54c7('0x1f')]+_0x54c7('0x20')+_0x127da8+'.'+_0x306c17[_0x54c7('0x1b')]+_0x54c7('0x21');_0x2a805[_0x54c7('0x13')]=parseValue(_0x268271,_0x306c17[_0x54c7('0x11')],_0x306c17[_0x54c7('0x13')]);return _0x2a805;};function parseOperator(_0x832a0d){var _0x29be82;switch(_0x832a0d){case _0x54c7('0x22'):_0x29be82=_0x54c7('0x23');break;case _0x54c7('0x1e'):_0x29be82=_0x54c7('0x24');break;case _0x54c7('0x12'):_0x29be82=_0x54c7('0x25');break;case _0x54c7('0x1d'):_0x29be82=_0x54c7('0x26');break;case _0x54c7('0x27'):case'$startsWith':case _0x54c7('0x28'):_0x29be82=_0x54c7('0x29');break;case _0x54c7('0x2a'):_0x29be82=_0x54c7('0x2b');break;case _0x54c7('0x15'):_0x29be82=_0x54c7('0x2c');break;case'$lte':_0x29be82=_0x54c7('0x2d');break;case _0x54c7('0x2e'):_0x29be82=_0x54c7('0x2f');break;case'$between':_0x29be82=_0x54c7('0x30');break;}return _0x29be82;}function parseValue(_0x5c40a8,_0x451f7e,_0x3f518e){var _0x2e6908={'start':undefined,'end':undefined};switch(_0x451f7e){case _0x54c7('0x22'):case _0x54c7('0x1e'):_0x2e6908[_0x54c7('0x31')]=_0x3f518e[_0x54c7('0x6')](',');break;case _0x54c7('0x27'):_0x2e6908['start']='%'+_0x3f518e+'%';break;case _0x54c7('0x32'):_0x2e6908[_0x54c7('0x31')]=_0x3f518e+'%';break;case _0x54c7('0x28'):_0x2e6908['start']='%'+_0x3f518e;break;case'$between':var _0x2e996c=_0x3f518e[_0x54c7('0x6')](',');var _0x3f518e=_0x2e996c['shift']();var _0xcc9365=_0x2e996c[_0x54c7('0x33')]();if(_0x5c40a8===_0x54c7('0x10')){_0x3f518e=moment(_0x3f518e)['utcOffset'](0x0,!![])['format']();_0xcc9365=moment(_0xcc9365)['utcOffset'](0x0,!![])['add'](0x17,_0x54c7('0x34'))[_0x54c7('0x35')](0x3b,_0x54c7('0x36'))[_0x54c7('0x35')](0x3b,_0x54c7('0x37'))[_0x54c7('0x38')]();}_0x2e6908={'start':_0x3f518e,'end':_0xcc9365};break;default:_0x2e6908[_0x54c7('0x31')]=_0x3f518e;break;}return _0x2e6908;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index e11e4e4..1b1ff94 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 _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 +var _0xbd10=['sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','isObject','isString','length','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','match','replace','includes','push','join','lodash','sequelize','moment','fields','split','isEmpty','forOwn','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte','subtract','isArray','parse','limit','offset'];(function(_0x43c2e5,_0x588843){var _0x3a76cf=function(_0x2e5cdd){while(--_0x2e5cdd){_0x43c2e5['push'](_0x43c2e5['shift']());}};_0x3a76cf(++_0x588843);}(_0xbd10,0x191));var _0x0bd1=function(_0x486592,_0xf233c6){_0x486592=_0x486592-0x0;var _0x497a7d=_0xbd10[_0x486592];return _0x497a7d;};'use strict';var _=require(_0x0bd1('0x0'));var sequelize=require(_0x0bd1('0x1'));var moment=require(_0x0bd1('0x2'));var LIMIT_VALUE=0xfa;exports[_0x0bd1('0x3')]=function(_0x3930d2){var _0x5d39c4=null;if(_0x3930d2){_0x5d39c4=_0x3930d2[_0x0bd1('0x4')](',');}return _0x5d39c4;};exports['filters']=function(_0xa9e68e,_0x58dc9b){var _0x266358={};if(!_[_0x0bd1('0x5')](_0xa9e68e)){_[_0x0bd1('0x6')](_0xa9e68e,function(_0x146a04,_0x213b13){try{if(_0x58dc9b){var _0x2365c2=_['find'](_0x58dc9b,{'name':_0x213b13})||{};if(_0x2365c2['type']===_0x0bd1('0x7')&&_[_0x0bd1('0x8')](_0x146a04)){var _0x5ef169=JSON['parse'](_0x146a04);var _0x1ff5c1={'$gte':moment(moment(_0x5ef169[_0x0bd1('0x9')])['format'](_0x0bd1('0xa')))[_0x0bd1('0xb')]()[_0x0bd1('0xc')](),'$lte':moment(moment(_0x5ef169[_0x0bd1('0xd')])['format'](_0x0bd1('0xa')))[_0x0bd1('0xb')]()[_0x0bd1('0xe')](0x1,'s')[_0x0bd1('0xc')]()};_0x266358[_0x213b13]=_0x1ff5c1;}else{_0x266358[_0x213b13]=_[_0x0bd1('0xf')](_0x146a04)?_0x146a04:JSON[_0x0bd1('0x10')](_0x146a04);}}else{_0x266358[_0x213b13]=_[_0x0bd1('0xf')](_0x146a04)?_0x146a04:JSON['parse'](_0x146a04);}}catch(_0x499700){_0x266358[_0x213b13]=_0x146a04[_0x0bd1('0x4')](',');}});}return _0x266358;};exports[_0x0bd1('0x11')]=function(_0x4fa40e){_0x4fa40e=parseInt(_0x4fa40e,0xa);if(!_0x4fa40e||_0x4fa40e<0x0){_0x4fa40e=LIMIT_VALUE;}return _0x4fa40e;};exports[_0x0bd1('0x12')]=function(_0x4394d6){_0x4394d6=parseInt(_0x4394d6,0xa);if(!_0x4394d6||_0x4394d6<0x0){_0x4394d6=0x0;}return _0x4394d6;};exports[_0x0bd1('0x13')]=function(_0x43d552){var _0x226052,_0x5544df=null;if(_0x43d552){_0x226052=_0x43d552['split'](',');_0x5544df=_[_0x0bd1('0x14')](_0x226052,function(_0x39e68d){if(_0x39e68d[_0x0bd1('0x15')]('-')===0x0){return[_0x39e68d===_0x0bd1('0x16')?sequelize[_0x0bd1('0x17')](sequelize[_0x0bd1('0x18')](_0x0bd1('0x16')),_0x0bd1('0x19')):_0x39e68d[_0x0bd1('0x1a')](0x1),_0x0bd1('0x1b')];}else{return[_0x39e68d===_0x0bd1('0x16')?sequelize[_0x0bd1('0x17')](sequelize[_0x0bd1('0x18')](_0x0bd1('0x16')),'unsigned'):_0x39e68d,_0x0bd1('0x1c')];}});}return _0x5544df;};exports[_0x0bd1('0x1d')]=function(_0x3ff104,_0x2df1e2){if(_[_0x0bd1('0x5')](_0x3ff104)){return _0x3ff104;}if(_[_0x0bd1('0xf')](_0x3ff104)){for(var _0x1c0c7d=0x0;_0x1c0c7d<_0x3ff104['length'];_0x1c0c7d+=0x1){_0x3ff104[_0x1c0c7d]=this[_0x0bd1('0x1d')](_0x3ff104[_0x1c0c7d],_0x2df1e2);}return _0x3ff104;}if(!_[_0x0bd1('0x1e')](_0x3ff104)){return _0x3ff104;}if(_[_0x0bd1('0x1f')](_0x2df1e2)){_0x2df1e2=[_0x2df1e2];}if(!_[_0x0bd1('0xf')](_0x2df1e2)){return _0x3ff104;}for(var _0x2997f3=0x0;_0x2997f3<_0x2df1e2[_0x0bd1('0x20')];_0x2997f3+=0x1){_['unset'](_0x3ff104,_0x2df1e2[_0x2997f3]);}for(var _0x3e13c3 in _0x3ff104){if(_0x3ff104[_0x0bd1('0x21')](_0x3e13c3)){_0x3ff104[_0x3e13c3]=this[_0x0bd1('0x1d')](_0x3ff104[_0x3e13c3],_0x2df1e2);}}return _0x3ff104;};exports[_0x0bd1('0x22')]=function(_0x3fc8d4){return _0x3fc8d4['match'](RegExp(_0x0bd1('0x23')))?!![]:![];};exports[_0x0bd1('0x24')]=function(_0x36056e){return _0x36056e[_0x0bd1('0x25')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x35b0a0){var _0x1b106c=[];_0x35b0a0[_0x0bd1('0x4')](/[ ,]+/)['forEach'](function(_0x1aa119){_0x1aa119=_0x1aa119[_0x0bd1('0x26')](/([^:]")"+/g,'$1');_0x1aa119='+'+_0x1aa119+'*';if(_0x1aa119[_0x0bd1('0x27')]('@'))_0x1aa119='\x22'+_0x1aa119+'\x22';_0x1b106c[_0x0bd1('0x28')](_0x1aa119);});return _0x1b106c[_0x0bd1('0x29')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 671c351..355a018 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x8a2a=['views','root','/server/views','engine','html','ejs','renderFile','urlencoded','50mb','json','initialize','serve-favicon','body-parser','method-override','errorhandler','path','cors','./environment','default','get','env','production','set','appPath','join','public','development','test','json\x20replacer','split','use','static'];(function(_0x2a13b7,_0x4889b0){var _0x2057c1=function(_0x57d357){while(--_0x57d357){_0x2a13b7['push'](_0x2a13b7['shift']());}};_0x2057c1(++_0x4889b0);}(_0x8a2a,0x8b));var _0xa8a2=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0x8a2a[_0x351509];return _0x4e9861;};'use strict';var express=require('express');var favicon=require(_0xa8a2('0x0'));var bodyParser=require(_0xa8a2('0x1'));var methodOverride=require(_0xa8a2('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xa8a2('0x3'));var path=require(_0xa8a2('0x4'));var passport=require('passport');var cors=require(_0xa8a2('0x5'));var moment=require('moment');var config=require(_0xa8a2('0x6'));var db=require('../mysqldb')['db'];exports[_0xa8a2('0x7')]=function(_0x1a2694){var _0x1f2646=_0x1a2694[_0xa8a2('0x8')](_0xa8a2('0x9'));if(_0x1f2646===_0xa8a2('0xa')){_0x1a2694[_0xa8a2('0xb')](_0xa8a2('0xc'),path[_0xa8a2('0xd')](config['root'],_0xa8a2('0xe')));}if(_0x1f2646===_0xa8a2('0xf')||_0x1f2646===_0xa8a2('0x10')){_0x1a2694[_0xa8a2('0xb')](_0xa8a2('0xc'),path['join'](config['root'],'client'));_0x1a2694['use'](errorHandler());}_0x1a2694[_0xa8a2('0xb')](_0xa8a2('0x11'),function(_0x10e14a,_0x4fc0cb){if(this[_0x10e14a]instanceof Date){_0x4fc0cb=this[_0x10e14a]['toISOString']()[_0xa8a2('0x12')]('.')[0x0]+'Z';}return _0x4fc0cb;});_0x1a2694[_0xa8a2('0x13')](express[_0xa8a2('0x14')](_0x1a2694[_0xa8a2('0x8')](_0xa8a2('0xc'))));_0x1a2694['set'](_0xa8a2('0x15'),config[_0xa8a2('0x16')]+_0xa8a2('0x17'));_0x1a2694[_0xa8a2('0x18')](_0xa8a2('0x19'),require(_0xa8a2('0x1a'))[_0xa8a2('0x1b')]);_0x1a2694[_0xa8a2('0xb')]('view\x20engine',_0xa8a2('0x19'));_0x1a2694[_0xa8a2('0x13')](bodyParser[_0xa8a2('0x1c')]({'limit':_0xa8a2('0x1d'),'extended':!![]}));_0x1a2694[_0xa8a2('0x13')](bodyParser[_0xa8a2('0x1e')]({'limit':_0xa8a2('0x1d')}));_0x1a2694['use'](cors());_0x1a2694['use'](methodOverride());_0x1a2694[_0xa8a2('0x13')](cookieParser());_0x1a2694[_0xa8a2('0x13')](passport[_0xa8a2('0x1f')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 7c03f1a..60ba5f8 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 _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 +var _0x9f5a=['filter','family','IPv4','internal','concat','mac','address','cpus','map','model','join','createHash','update','digest','win32','replace','macAddress','ipAddress','md5','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','networkInterfaces','orderBy','length'];(function(_0x2351b7,_0x669c2c){var _0x2d0032=function(_0x54a6d2){while(--_0x54a6d2){_0x2351b7['push'](_0x2351b7['shift']());}};_0x2d0032(++_0x669c2c);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x83751a,_0x5c9b18){_0x83751a=_0x83751a-0x0;var _0x511107=_0x9f5a[_0x83751a];return _0x511107;};'use strict';var _=require(_0xa9f5('0x0'));var os=require('os');var crypto=require(_0xa9f5('0x1'));var machine=require(_0xa9f5('0x2'));var exec=require(_0xa9f5('0x3'))['execSync'];function getInterfaces(){var _0x4268b0=[];var _0x45e3f5=os[_0xa9f5('0x4')]();var _0x4eeedd=_[_0xa9f5('0x5')](_['keys'](_0x45e3f5));for(var _0x1a2b95=0x0;_0x1a2b95<_0x4eeedd[_0xa9f5('0x6')];_0x1a2b95++){var _0x49e337=_0x45e3f5[_0x4eeedd[_0x1a2b95]][_0xa9f5('0x7')](function(_0x285dad){return _0x285dad[_0xa9f5('0x8')]===_0xa9f5('0x9')&&_0x285dad[_0xa9f5('0xa')]===![];});_0x4268b0=_0x4268b0[_0xa9f5('0xb')](_0x49e337);}return _0x4268b0;}function getFirstInterface(){var _0x189ef8=_['head'](getInterfaces());return{'macAddress':_0x189ef8&&_0x189ef8[_0xa9f5('0xc')]?_0x189ef8[_0xa9f5('0xc')]:'00:00:00:00:00:00','ipAddress':_0x189ef8&&_0x189ef8[_0xa9f5('0xd')]?_0x189ef8[_0xa9f5('0xd')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x418ba3=_[_0xa9f5('0x5')](os[_0xa9f5('0xe')]()[_0xa9f5('0xf')](function(_0x4c26a8){return _0x4c26a8[_0xa9f5('0x10')];}))[_0xa9f5('0x11')](':');return crypto[_0xa9f5('0x12')]('md5')[_0xa9f5('0x13')](_0x418ba3)[_0xa9f5('0x14')]('hex');}exports['getUuid']=function(){switch(os['platform']()){case _0xa9f5('0x15'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0xa9f5('0x16')]('\x0d\x0a','');default:var _0x131ed6=getFirstInterface();var _0x44f5e4=getCPUhash();var _0x415f12=_0x44f5e4+'|'+os['hostname']()+'|'+_0x131ed6[_0xa9f5('0x17')]+'|'+_0x131ed6[_0xa9f5('0x18')];var _0x230fc2=crypto[_0xa9f5('0x12')](_0xa9f5('0x19'))[_0xa9f5('0x13')](_0x415f12)[_0xa9f5('0x14')](_0xa9f5('0x1a'));return _0x230fc2[_0xa9f5('0x1b')](0x0,0x8)+'-'+_0x230fc2[_0xa9f5('0x1b')](0x8,0xc)+'-'+_0x230fc2[_0xa9f5('0x1b')](0xc,0x10)+'-'+_0x230fc2[_0xa9f5('0x1b')](0x10,0x14)+'-'+_0x230fc2['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 8764f93..f00ed70 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 _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 +var _0x09b9=['../logger','../../api/jira/jira.controller','process','format','exports','GET','then','catch','User','findOne','fullname','|reason|','|uuid|','|email|','email','openIssue','Motion\x20License\x20Alert','Alert','license','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','data1','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','request-promise','bluebird','version','../../mysqldb','./hardware'];(function(_0x1fec0a,_0x55b45f){var _0x5341d1=function(_0x47ada5){while(--_0x47ada5){_0x1fec0a['push'](_0x1fec0a['shift']());}};_0x5341d1(++_0x55b45f);}(_0x09b9,0xbe));var _0x909b=function(_0x3cb169,_0x5c4d3a){_0x3cb169=_0x3cb169-0x0;var _0x3778d9=_0x09b9[_0x3cb169];return _0x3778d9;};'use strict';var util=require(_0x909b('0x0'));var moment=require('moment');var rp=require(_0x909b('0x1'));var BPromise=require(_0x909b('0x2'));var pkginfo=require('pkginfo')(module,_0x909b('0x3'));var db=require(_0x909b('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x909b('0x5'));var logger=require(_0x909b('0x6'))('license');var jira=require(_0x909b('0x7'));const {config}=require(_0x909b('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x239214){return new BPromise(function(_0x2da64d,_0x30fbb8){var _0x1ba8c0=util[_0x909b('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x239214,module[_0x909b('0xa')][_0x909b('0x3')]);if(oldToken){_0x1ba8c0=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x239214,module['exports'][_0x909b('0x3')],oldToken);}var _0x30771d={'uri':_0x1ba8c0,'method':_0x909b('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x30771d)[_0x909b('0xc')](function(_0x8de499){_0x2da64d(_0x8de499);})[_0x909b('0xd')](function(_0x1c47e2){_0x30fbb8(_0x1c47e2);});});}function sendJiraAlert(_0x5435ca,_0x6c92c9,_0x446de1){var _0x4c7471='||FIELD||VALUE||\x0a';return db[_0x909b('0xe')][_0x909b('0xf')]({'where':{'role':'admin'},'attributes':[_0x909b('0x10'),'email'],'raw':!![]})[_0x909b('0xc')](function(_0x4869c7){ADMIN=_0x4869c7;_0x4c7471+=_0x909b('0x11')+_0x446de1+'|\x0a';_0x4c7471+=_0x909b('0x12')+_0x5435ca+'|\x0a';_0x4c7471+='|machineUuid|'+_0x6c92c9+'|\x0a';_0x4c7471+='|name|'+ADMIN[_0x909b('0x10')]+'|\x0a';_0x4c7471+=_0x909b('0x13')+ADMIN[_0x909b('0x14')]+'|\x0a';return _0x4c7471;})[_0x909b('0xc')](function(_0x35c55c){var _0x5df0a6=hardware['getFirstInterface']()['ipAddress'];return jira[_0x909b('0x15')]({'key':'MOTLICENSE','summary':_0x909b('0x16'),'description':_0x35c55c,'issuetype':_0x909b('0x17'),'oldToken':_0x5435ca,'newToken':_0x6c92c9,'email':ADMIN[_0x909b('0x14')],'name':ADMIN[_0x909b('0x10')],'reason':GRAY_PERIOD_REASON,'ip':_0x5df0a6});});}function manageLicense(_0x5a5bbf,_0x5a8210){var _0x597d29=_0x5a8210['get']({'plain':!![]});httpRequest(_0x5a5bbf)['then'](function(_0x500dc1){if(oldToken){oldToken=undefined;}if(_0x500dc1['active']){if(!_0x597d29[_0x909b('0x18')]&&_0x597d29[_0x909b('0x18')]!=_0x500dc1[_0x909b('0x18')]||_0x597d29[_0x909b('0x18')]&&_0x597d29[_0x909b('0x19')]){logger['info'](_0x909b('0x1a'));}if(_0x597d29['license']&&!_0x597d29[_0x909b('0x19')]&&_0x597d29[_0x909b('0x18')]!=_0x500dc1[_0x909b('0x18')]){logger[_0x909b('0x1b')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x597d29['license']&&!_0x597d29['data2']&&_0x597d29[_0x909b('0x18')]==_0x500dc1[_0x909b('0x18')]){return _0x5a8210;}return _0x5a8210[_0x909b('0x1c')]({'data1':_0x5a5bbf,'data2':null,'license':_0x500dc1[_0x909b('0x18')]});}else{if(_0x500dc1['license']||_0x597d29[_0x909b('0x18')]){if(!_0x597d29[_0x909b('0x19')]){if(_0x597d29['data1']==_0x5a5bbf){GRAY_PERIOD_REASON='Disabled';logger[_0x909b('0x1b')](_0x909b('0x1d'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x597d29[_0x909b('0x1e')];logger[_0x909b('0x1b')](_0x909b('0x1f'),_0x597d29[_0x909b('0x1e')],_0x5a5bbf);}sendJiraAlert(_0x597d29[_0x909b('0x1e')],_0x500dc1[_0x909b('0x20')],GRAY_PERIOD_REASON);logger['info'](_0x909b('0x21'),GRAY_PERIOD_REASON[_0x909b('0x22')](),moment()[_0x909b('0x9')](_0x909b('0x23')));return _0x5a8210[_0x909b('0x1c')]({'data2':encryptor[_0x909b('0x24')](moment()['format'](_0x909b('0x23')))});}else{if(moment()[_0x909b('0x25')](encryptor[_0x909b('0x26')](_0x597d29[_0x909b('0x19')]),_0x909b('0x27'))>DAYS){logger[_0x909b('0x1b')](_0x909b('0x28'),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x5a8210[_0x909b('0x1c')]({'data1':_0x5a5bbf,'data2':null,'license':null});}}}else{if(_0x597d29['data1']!=_0x5a5bbf){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x597d29[_0x909b('0x1e')],_0x5a5bbf);return _0x5a8210[_0x909b('0x1c')]({'data1':_0x5a5bbf,'data2':null,'license':null});}}}return _0x5a8210;})[_0x909b('0xc')](function(_0x4601ab){_0x5a8210=_0x4601ab;})[_0x909b('0xd')](function(_0x5dfcc2){logger[_0x909b('0x29')](_0x5dfcc2['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x909b('0x2a')](),_0x5a8210);},TIME);});}function defaultLicense(){var _0x3b86d3=hardware['getUuid']();if(_0x3b86d3){return db[_0x909b('0x2b')][_0x909b('0x2c')]({'where':{'id':0x1},'defaults':{'data1':_0x3b86d3}})[_0x909b('0x2d')](function(_0x1e3a82,_0xdb56bb){logger[_0x909b('0x1b')](_0x909b('0x2e'),_0x3b86d3);manageLicense(_0x3b86d3,_0x1e3a82);})['catch'](function(_0x5768ea){logger[_0x909b('0x29')](_0x5768ea[_0x909b('0x2f')]);});}}exports[_0x909b('0x30')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index da44fcb..b054ea8 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 _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 +var _0x3c65=['uuid','split','%s:%s:%s','demo','decryptString','gray','deadline','add','days','format','grayReason','changed','disabled','data1','message','findAll','role','sequelize','COUNT','count','admin','user','telephone','users','telephones','forEach','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','defaults','then'];(function(_0x8df2d2,_0x590380){var _0xcdf8f3=function(_0x471b49){while(--_0x471b49){_0x8df2d2['push'](_0x8df2d2['shift']());}};_0xcdf8f3(++_0x590380);}(_0x3c65,0x122));var _0x53c6=function(_0x2dc343,_0xf015a2){_0x2dc343=_0x2dc343-0x0;var _0x51eac5=_0x3c65[_0x2dc343];return _0x51eac5;};'use strict';var util=require(_0x53c6('0x0'));var _=require('lodash');var moment=require(_0x53c6('0x1'));var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require(_0x53c6('0x2'));var db=require(_0x53c6('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x53c6('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x53c6('0x5'),'machineUuid':hardware[_0x53c6('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x53c6('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x53c6('0x7'),'machineUuid':hardware[_0x53c6('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x369760){return new BPromise(function(_0x3924af,_0x34076e){return db['License'][_0x53c6('0x8')](_[_0x53c6('0x9')](_0x369760,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x4f27bf){return checkLicense(_0x4f27bf,null);})[_0x53c6('0xa')](function(_0x11ffe5){_0x3924af(_0x11ffe5);return;})['catch'](function(_0x115000){_0x34076e(_0x115000);});});}function checkLicense(_0x1db6cb,_0x2d7058){if(!_0x1db6cb){demoLicense[_0x53c6('0xb')]=_0x1db6cb['data1'];return demoLicense;}try{var _0xc4eab8=_0x2d7058||_0x1db6cb['license'];if(_['isEmpty'](_0xc4eab8)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x17ea24=_0x1db6cb['data1'];var _0xf92bfb=_0x1db6cb['data2'];var _0x10e116=_0x17ea24[_0x53c6('0xc')]('-')[0x4];var _0x459f6c=_0x17ea24[_0x53c6('0xc')]('-')[0x0];var _0x4df93a=encryptor['decryptString'](_0xc4eab8,util['format'](_0x53c6('0xd'),_0x10e116,_0x17ea24,_0x459f6c));var _0x29667f=JSON['parse'](_0x4df93a);_0x29667f[_0x53c6('0xe')]=![];_0x29667f[_0x53c6('0xb')]=_0x17ea24;_0x29667f['machineUuid']=hardware[_0x53c6('0x6')]();if(_0xf92bfb){var _0x511772=encryptor[_0x53c6('0xf')](_0xf92bfb);_0x29667f[_0x53c6('0x10')]=_0x511772;_0x29667f[_0x53c6('0x11')]=moment(_0x511772)[_0x53c6('0x12')](0x7,_0x53c6('0x13'))[_0x53c6('0x14')]();_0x29667f[_0x53c6('0x15')]=_0x29667f[_0x53c6('0xb')]!=_0x29667f['machineUuid']?_0x53c6('0x16'):_0x53c6('0x17');}return _0x29667f;}catch(_0x39dfd3){breakingLicense['uuid']=_0x1db6cb[_0x53c6('0x18')];breakingLicense[_0x53c6('0x19')]=_0x39dfd3[_0x53c6('0x19')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4f4cbe,_0x163712){getLicense()['then'](function(_0x50cbd3){return db['User'][_0x53c6('0x1a')]({'attributes':[_0x53c6('0x1b'),[db[_0x53c6('0x1c')]['fn'](_0x53c6('0x1d'),db[_0x53c6('0x1c')]['col']('role')),_0x53c6('0x1e')]],'group':'role','where':{'role':{'$or':[_0x53c6('0x1f'),_0x53c6('0x20'),_0x53c6('0x21')]}},'raw':!![]})[_0x53c6('0xa')](function(_0xcf2301){var _0x31a362={'user':_0x50cbd3[_0x53c6('0x22')]||0x0,'telephone':_0x50cbd3[_0x53c6('0x23')]||0x0};_0xcf2301[_0x53c6('0x24')](function(_0x380b28){var _0x185b0c=_0x380b28['role']==='admin'?_0x53c6('0x20'):_0x380b28['role'];_0x31a362[_0x185b0c]-=_0x380b28['count'];if(_0x31a362[_0x185b0c]<0x0)_0x31a362[_0x185b0c]=0x0;});_0x4f4cbe(_0x31a362);return;});})[_0x53c6('0x25')](function(_0x287db2){_0x163712(_0x287db2);});});}function checkUserLimits(_0x3e14d7){return new BPromise(function(_0x1536c4,_0x445ef3){getLimits()[_0x53c6('0xa')](function(_0x4facf2){var _0x15d52d=_[_0x53c6('0x26')](_[_0x53c6('0x27')](_0x3e14d7,_0x53c6('0x1b')),[_0x53c6('0x1f'),'user','telephone']);var _0xab950=(_0x15d52d[_0x53c6('0x1f')]||0x0)+(_0x15d52d[_0x53c6('0x20')]||0x0);var _0x17382c=_0x15d52d['telephone']||0x0;if(_0xab950>_0x4facf2['user'])return _0x445ef3(_0x53c6('0x28'));if(_0x17382c>_0x4facf2[_0x53c6('0x21')])return _0x445ef3(_0x53c6('0x29'));return _0x1536c4();})[_0x53c6('0x25')](function(_0x3e6239){_0x445ef3(_0x3e6239);});});}module[_0x53c6('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 66a02c6..a7bbf94 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 _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 +var _0x82f4=['http://localhost:9000','app-id','secret','exports'];(function(_0x4ccdfb,_0x169b9e){var _0x32f147=function(_0x10d9e3){while(--_0x10d9e3){_0x4ccdfb['push'](_0x4ccdfb['shift']());}};_0x32f147(++_0x169b9e);}(_0x82f4,0x1bf));var _0x482f=function(_0xf17965,_0x31747d){_0xf17965=_0xf17965-0x0;var _0x398a12=_0x82f4[_0xf17965];return _0x398a12;};'use strict';module[_0x482f('0x0')]={'DOMAIN':_0x482f('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x482f('0x2'),'GOOGLE_SECRET':_0x482f('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 7034c7a..f1a5db9 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x7e2b=['Logger','transports','%s-%s','error','File','info','Console','moment','util','path','join','/var','format','message','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports'];(function(_0x30c5b3,_0x4c2174){var _0x58cbf5=function(_0x19840a){while(--_0x19840a){_0x30c5b3['push'](_0x30c5b3['shift']());}};_0x58cbf5(++_0x4c2174);}(_0x7e2b,0x1e7));var _0xb7e2=function(_0x3fb84f,_0x526d87){_0x3fb84f=_0x3fb84f-0x0;var _0x48975c=_0x7e2b[_0x3fb84f];return _0x48975c;};'use strict';var moment=require(_0xb7e2('0x0'));var winston=require('winston');var util=require(_0xb7e2('0x1'));var path=require(_0xb7e2('0x2'));var debugLevel='INFO';function filename(_0x292c3f,_0x2cbc75){return path[_0xb7e2('0x3')](_0xb7e2('0x4'),'log','xcally',util[_0xb7e2('0x5')]('%s-%s.log',_0x292c3f,_0x2cbc75));}function formatter(_0x2d3390,_0x24620d){_0x24620d[_0xb7e2('0x6')]=_0x24620d['message'][_0xb7e2('0x7')](/@@{/g,'{{{')['replace'](/}@@/g,'}}}')['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xb7e2('0x5')](_0xb7e2('0x8'),moment()['format'](_0xb7e2('0x9')),_0x24620d[_0xb7e2('0xa')][_0xb7e2('0xb')](),_0x2d3390,_0x24620d['message']);}module[_0xb7e2('0xc')]=function(_0x40e03b){return new winston[(_0xb7e2('0xd'))]({'transports':[new winston[(_0xb7e2('0xe'))]['File']({'name':util[_0xb7e2('0x5')](_0xb7e2('0xf'),_0x40e03b,_0xb7e2('0x10')),'filename':filename(_0x40e03b,'error'),'level':_0xb7e2('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4bfc3b){return formatter(_0x40e03b,_0x4bfc3b);}}),new winston[(_0xb7e2('0xe'))][(_0xb7e2('0x11'))]({'name':util[_0xb7e2('0x5')]('%s-%s',_0x40e03b,'info'),'filename':filename(_0x40e03b,_0xb7e2('0x12')),'level':_0xb7e2('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3632fc){return formatter(_0x40e03b,_0x3632fc);}}),new winston[(_0xb7e2('0xe'))][(_0xb7e2('0x13'))]({'level':process['env']['debugLevel']||debugLevel,'json':![],'formatter':function(_0xd33e54){return formatter(_0x40e03b,_0xd33e54);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index effda8f..4f2622e 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 _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 +var _0x3036=['../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','join','../../services/express/index.js','ami','../../services/ami/index.js','email'];(function(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0x3036,0x1a9));var _0x6303=function(_0x55beac,_0x4d19d3){_0x55beac=_0x55beac-0x0;var _0x3f0421=_0x3036[_0x55beac];return _0x3f0421;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path[_0x6303('0x0')](__dirname,_0x6303('0x1'))},{'name':_0x6303('0x2'),'script':path['join'](__dirname,_0x6303('0x3'))},{'name':'agi','script':path['join'](__dirname,'../../services/agi/index.js')},{'name':_0x6303('0x4'),'script':path['join'](__dirname,_0x6303('0x5'))},{'name':_0x6303('0x6'),'script':path[_0x6303('0x0')](__dirname,'../../services/routing/index.js')},{'name':_0x6303('0x7'),'script':path[_0x6303('0x0')](__dirname,_0x6303('0x8'))}]};module[_0x6303('0x9')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 7a4b4c2..b180b42 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 _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 +var _0xb2f1=['describe','delete','dump','saved','pm2','bluebird','connected','then','start','disconnect','stop','restart','list'];(function(_0x386b03,_0x5d0000){var _0xd3d524=function(_0x474754){while(--_0x474754){_0x386b03['push'](_0x386b03['shift']());}};_0xd3d524(++_0x5d0000);}(_0xb2f1,0xee));var _0x1b2f=function(_0x7556b0,_0x300a5a){_0x7556b0=_0x7556b0-0x0;var _0x2a8880=_0xb2f1[_0x7556b0];return _0x2a8880;};'use strict';var pm2=require(_0x1b2f('0x0'));var BPromise=require(_0x1b2f('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x33346a,_0x421e82){return pm2['connect'](function(_0x23a24a){if(_0x23a24a){return _0x421e82(_0x23a24a);}return _0x33346a(_0x1b2f('0x2'));});});};exports['start']=function(_0x47a72f){return connect()[_0x1b2f('0x3')](function(){return new BPromise(function(_0x1934b5,_0xad728b){return pm2[_0x1b2f('0x4')](_0x47a72f,function(_0x57eed1,_0x532834){if(_0x57eed1){return _0xad728b(_0x57eed1);}pm2[_0x1b2f('0x5')]();return _0x1934b5(_0x532834);});});});};exports[_0x1b2f('0x6')]=function(_0x5627d3){return connect()[_0x1b2f('0x3')](function(){return new BPromise(function(_0x1c24c7,_0x5acb30){return pm2[_0x1b2f('0x6')](_0x5627d3,function(_0x2f3963,_0x402620){if(_0x2f3963){return _0x5acb30(_0x2f3963);}pm2[_0x1b2f('0x5')]();return _0x1c24c7(_0x402620);});});});};exports[_0x1b2f('0x7')]=function(_0x378ab8){return connect()[_0x1b2f('0x3')](function(){return new BPromise(function(_0x5cf8b8,_0x3bdf36){return pm2[_0x1b2f('0x7')](_0x378ab8,function(_0xd4c1bc,_0x4e708f){if(_0xd4c1bc){return _0x3bdf36(_0xd4c1bc);}pm2[_0x1b2f('0x5')]();return _0x5cf8b8(_0x4e708f);});});});};exports['list']=function(){return connect()[_0x1b2f('0x3')](function(){return new BPromise(function(_0x2f285a,_0x2d8645){return pm2[_0x1b2f('0x8')](function(_0xbf1b6c,_0x559ef2){if(_0xbf1b6c){return _0x2d8645(_0xbf1b6c);}pm2[_0x1b2f('0x5')]();return _0x2f285a(_0x559ef2);});});});};exports[_0x1b2f('0x9')]=function(_0x130219){return connect()[_0x1b2f('0x3')](function(){return new BPromise(function(_0x4c8497,_0x524fa0){return pm2[_0x1b2f('0x9')](_0x130219,function(_0x5d95d9,_0x4cdc0d){if(_0x5d95d9){return _0x524fa0(_0x5d95d9);}pm2['disconnect']();return _0x4c8497(_0x4cdc0d);});});});};exports[_0x1b2f('0xa')]=function(_0x184e31){return connect()['then'](function(){return new BPromise(function(_0x498928,_0x382594){return pm2[_0x1b2f('0xa')](_0x184e31,function(_0xc2aa72,_0x4cc527){if(_0xc2aa72){return _0x382594(_0xc2aa72);}pm2[_0x1b2f('0x5')]();return _0x498928(_0x4cc527);});});});};exports[_0x1b2f('0xb')]=function(){return connect()[_0x1b2f('0x3')](function(){return new BPromise(function(_0x3b8da6,_0x421919){return pm2[_0x1b2f('0xb')](function(_0xa1d86b){if(_0xa1d86b){return _0x421919(_0xa1d86b);}return _0x3b8da6(_0x1b2f('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 3d1957a..0a5890a 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 _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 +var _0x6716=['chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x308122,_0x4a3141){var _0x5ccb2d=function(_0x19dc04){while(--_0x19dc04){_0x308122['push'](_0x308122['shift']());}};_0x5ccb2d(++_0x4a3141);}(_0x6716,0x115));var _0x6671=function(_0x3878bd,_0x51e3e5){_0x3878bd=_0x3878bd-0x0;var _0x359e60=_0x6716[_0x3878bd];return _0x359e60;};'use strict';var _=require(_0x6671('0x0'));var moment=require(_0x6671('0x1'));var Redis=require(_0x6671('0x2'));var util=require(_0x6671('0x3'));var config=require(_0x6671('0x4'));var db=require(_0x6671('0x5'))['db'];var logger=require(_0x6671('0x6'))(_0x6671('0x7'));config[_0x6671('0x8')]=_[_0x6671('0x9')](config[_0x6671('0x8')],{'host':_0x6671('0xa'),'port':0x18eb});var io=require(_0x6671('0xb'))(new Redis(config[_0x6671('0x8')]));function closeInteractions(){var _0x30cc07=0x0;var _0x2f2a5b=[];return db[_0x6671('0xc')][_0x6671('0xd')]({'raw':!![],'attributes':['id',_0x6671('0xe')],'where':{'id':0x1}})[_0x6671('0xf')](function(_0x283f57){_0x30cc07=_0x283f57['chatTimeout'];if(_0x30cc07){return db[_0x6671('0x10')][_0x6671('0x11')]({'raw':!![],'attributes':['id',_0x6671('0x12')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6671('0x13')](_0x283f57[_0x6671('0xe')],_0x6671('0x14'))}}});}else{return[];}})[_0x6671('0xf')](function(_0x4cd0c7){if(_0x4cd0c7&&_0x4cd0c7[_0x6671('0x15')]){_0x2f2a5b=_[_0x6671('0x16')](_0x4cd0c7||[],'id');logger[_0x6671('0x17')]('[CHAT]\x20Interactions\x20to\x20close:',_0x2f2a5b[_0x6671('0x18')]());return db[_0x6671('0x10')]['update']({'closeReason':_0x6671('0x19'),'disposition':_0x6671('0x1a'),'closed':!![],'closedAt':moment()[_0x6671('0x1b')](_0x6671('0x1c'))},{'where':{'id':_0x2f2a5b}});}})[_0x6671('0xf')](function(){if(_0x2f2a5b&&_0x2f2a5b[_0x6671('0x15')]){logger[_0x6671('0x17')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x2f2a5b['join']());for(var _0x3b4a25=0x0;_0x3b4a25<_0x2f2a5b[_0x6671('0x15')];_0x3b4a25++){io['emit'](_0x6671('0x1d'),{'id':_0x2f2a5b[_0x3b4a25],'closed':!![]});}}})[_0x6671('0x1e')](function(_0x2f7589){logger[_0x6671('0x1f')](_0x6671('0x20'),_0x2f7589?util[_0x6671('0x21')](_0x2f7589,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 1976c66..da0c426 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 _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 +var _0x304b=['stop','stop\x20cron','length','exists','update','update\x20cron','run','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','format','\x22%s\x22\x20<%s>','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','extname','zip','existsSync','status','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','then','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','toString','keyBy','difference','intersection','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron'];(function(_0x478927,_0x554534){var _0x3608d1=function(_0x449905){while(--_0x449905){_0x478927['push'](_0x478927['shift']());}};_0x3608d1(++_0x554534);}(_0x304b,0x65));var _0xb304=function(_0x19d93c,_0x47c8a7){_0x19d93c=_0x19d93c-0x0;var _0x57dcbc=_0x304b[_0x19d93c];return _0x57dcbc;};'use strict';var fs=require('fs');var util=require(_0xb304('0x0'));var path=require('path');var _=require(_0xb304('0x1'));var moment=require(_0xb304('0x2'));var CronJobManager=require(_0xb304('0x3'));var jayson=require(_0xb304('0x4'));var BPromise=require(_0xb304('0x5'));var logger=require(_0xb304('0x6'))(_0xb304('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xb304('0x8'));var analyticDefaultReportController=require(_0xb304('0x9'));var client=jayson[_0xb304('0xa')][_0xb304('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x326b57,_0xd8fe5c){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x326b57[_0xb304('0xc')]);var _0x54cb15=!![];var _0x4b3c35={'tls':{'rejectUnauthorized':![]}};if(_0x326b57[_0xb304('0xd')][_0xb304('0xe')]['service']){_0x4b3c35[_0xb304('0xf')]=_0x326b57[_0xb304('0xd')][_0xb304('0xe')]['service'];}else{_0x4b3c35['host']=_0x326b57[_0xb304('0xd')]['Smtp'][_0xb304('0x10')];_0x4b3c35[_0xb304('0x11')]=_0x326b57[_0xb304('0xd')]['Smtp'][_0xb304('0x11')];_0x4b3c35[_0xb304('0x12')]=_0x326b57['MailAccount'][_0xb304('0xe')][_0xb304('0x12')];}if(_0x326b57[_0xb304('0xd')][_0xb304('0xe')][_0xb304('0x13')]){_0x4b3c35[_0xb304('0x14')]={'user':_0x326b57[_0xb304('0xd')][_0xb304('0xe')]['user'],'pass':_0x326b57[_0xb304('0xd')][_0xb304('0xe')]['pass']};}var _0x2def2a={'account':_0x4b3c35,'message':{'from':util[_0xb304('0x15')](_0xb304('0x16'),_0x326b57[_0xb304('0xd')][_0xb304('0x17')],_0x326b57[_0xb304('0xd')]['email']||_0x326b57[_0xb304('0xd')][_0xb304('0xe')][_0xb304('0x18')]),'to':_0x326b57[_0xb304('0xc')],'cc':_0x326b57['cc'],'bcc':_0x326b57[_0xb304('0x19')],'subject':util['format'](_0xb304('0x1a'),_0xd8fe5c[_0xb304('0x17')],_0x326b57['subtractNumber'],_0x326b57[_0xb304('0x1b')])}};var _0x5f204d=path[_0xb304('0x1c')](__dirname,_0xb304('0x1d'));var _0x295adf=_0xd8fe5c[_0xb304('0x1e')];var _0x25640d=util[_0xb304('0x15')](_0xb304('0x1f'),path['basename'](_0xd8fe5c[_0xb304('0x1e')],path[_0xb304('0x20')](_0xd8fe5c[_0xb304('0x1e')])),_0xb304('0x21'));var _0x4ab2ab=path[_0xb304('0x1c')](_0x5f204d,_0x295adf);var _0x155389=path[_0xb304('0x1c')](_0x5f204d,_0x25640d);if(fs[_0xb304('0x22')](_0x4ab2ab)){_0xd8fe5c[_0xb304('0x23')]='Sent';_0x2def2a[_0xb304('0x24')][_0xb304('0x25')]=[{'filename':_0x295adf,'path':_0x4ab2ab}];_0x2def2a[_0xb304('0x24')]['text']=util['format'](_0xb304('0x26'),JSON[_0xb304('0x27')](_0xd8fe5c,null,0x2));}else if(fs['existsSync'](_0x155389)){_0xd8fe5c[_0xb304('0x23')]=_0xb304('0x28');_0x2def2a[_0xb304('0x24')][_0xb304('0x25')]=[{'filename':_0x25640d,'path':_0x155389}];}else{_0x2def2a[_0xb304('0x24')][_0xb304('0x29')]=_0xb304('0x2a');if(!_0x326b57[_0xb304('0x2b')]){_0x54cb15=![];logger[_0xb304('0x2c')](_0xb304('0x2d'));}}if(_0x54cb15){return client[_0xb304('0x2e')](_0xb304('0x2f'),_0x2def2a)['then'](function(_0x5cdaaf){if(_0x5cdaaf[_0xb304('0x30')]){return logger['error'](_0xb304('0x31'),JSON['stringify'](_0x5cdaaf));}return logger['info'](_0xb304('0x32'));})[_0xb304('0x33')](function(_0x321676){return logger[_0xb304('0x30')](_0xb304('0x31'),JSON[_0xb304('0x27')](_0x321676));});}};}function handleError(){return function(_0x1bb4d1){return logger[_0xb304('0x30')](JSON[_0xb304('0x27')](_0x1bb4d1));};}function handleResult(_0x469777){return function(_0x25b1dd){logger['info'](_0xb304('0x34'),JSON[_0xb304('0x27')](_0x25b1dd));if(_0x469777[_0xb304('0xd')]&&_0x469777['MailAccount'][_0xb304('0xe')]&&!_[_0xb304('0x35')](_0x469777[_0xb304('0xc')])){setTimeout(handleSendEmail(_0x469777,_0x25b1dd),0x3c*0x3e8);}};}function handleJob(_0xf99df2){return function(){try{if(_[_0xb304('0x35')](_0xf99df2[_0xb304('0x36')])){return logger[_0xb304('0x2c')](_0xb304('0x37'));}if(_['isNil'](_0xf99df2[_0xb304('0x1b')])){return logger[_0xb304('0x2c')](_0xb304('0x38'));}var _0x1d9494={'startDate':moment()[_0xb304('0x39')](_0xf99df2[_0xb304('0x36')],_0xf99df2[_0xb304('0x1b')])[_0xb304('0x15')](_0xb304('0x3a')),'endDate':moment()[_0xb304('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0xf99df2[_0xb304('0x3b')],'name':_0xf99df2['name']};if(!_[_0xb304('0x35')](_0xf99df2[_0xb304('0x3c')])){logger[_0xb304('0x2c')]('exec\x20defaul\x20report\x20id:%s',_0xf99df2[_0xb304('0x3c')]);return analyticDefaultReportController['runReport']({'id':_0xf99df2[_0xb304('0x3c')]},_0x1d9494)[_0xb304('0x3d')](handleResult(_0xf99df2))['catch'](handleError());}if(!_['isNil'](_0xf99df2[_0xb304('0x3e')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0xf99df2[_0xb304('0x3e')]);return analyticCustomReportController[_0xb304('0x3f')]({'id':_0xf99df2[_0xb304('0x3e')]},_0x1d9494)[_0xb304('0x3d')](handleResult(_0xf99df2))['catch'](handleError());}}catch(_0x1f7216){logger[_0xb304('0x30')](JSON[_0xb304('0x27')](_0x1f7216));}return logger[_0xb304('0x2c')](_0xb304('0x40'));};}function getJobs(_0x8125bb){var _0x166922={};if(_0x8125bb){_0x166922['id']=_0x8125bb;}return db[_0xb304('0x41')][_0xb304('0x42')]({'where':_0x166922,'include':[{'model':db[_0xb304('0xd')],'attributes':['id',_0xb304('0x17'),_0xb304('0xc')],'include':[{'model':db[_0xb304('0x43')],'as':_0xb304('0xe')}]}]})['then'](function(_0x4e5f58){var _0x10d8d0=_['keys'](manager[_0xb304('0x44')]);var _0x439c3b=_['map'](_0x4e5f58,function(_0x2baeb4){return _0x2baeb4['id'][_0xb304('0x45')]();});var _0x5b957b=_[_0xb304('0x46')](_0x4e5f58,function(_0x434587){return _0x434587['id'][_0xb304('0x45')]();});var _0x1eb35f=_0x8125bb?_0x439c3b:_[_0xb304('0x47')](_0x439c3b,_0x10d8d0);var _0x341ea2=_[_0xb304('0x48')](_0x439c3b,_0x10d8d0);var _0x3838f4=_[_0xb304('0x47')](_0x10d8d0,_0x439c3b);var _0x4616e1;var _0x3cb852;for(_0x4616e1=0x0;_0x4616e1<_0x3838f4['length']&&!_0x8125bb;_0x4616e1+=0x1){_0x3cb852=_0x3838f4[_0x4616e1]['toString']();if(manager['exists'](_0x3cb852)){manager['stop'](_0x3cb852);manager[_0xb304('0x49')](_0x3cb852);logger[_0xb304('0x2c')](_0xb304('0x4a'),_0x3cb852);}}logger[_0xb304('0x2c')]('toRun',JSON[_0xb304('0x27')](_0x1eb35f));for(_0x4616e1=0x0;_0x4616e1<_0x1eb35f['length'];_0x4616e1+=0x1){_0x3cb852=_0x1eb35f[_0x4616e1][_0xb304('0x45')]();logger['info'](_0xb304('0x4b'),_0x3cb852);if(_0x8125bb){logger['info'](_0xb304('0x4c'),_0x8125bb);logger[_0xb304('0x2c')](JSON[_0xb304('0x27')](_0x5b957b[_0x3cb852]));BPromise[_0xb304('0x4d')]()[_0xb304('0x3d')](handleJob(_0x5b957b[_0x3cb852]));logger[_0xb304('0x2c')](_0xb304('0x4e'),_0x5b957b[_0x3cb852][_0xb304('0x17')],_0x5b957b[_0x3cb852]['cron']);}else if(_0x5b957b[_0x3cb852][_0xb304('0x4f')]&&_0x5b957b[_0x3cb852][_0xb304('0x50')]&&moment()[_0xb304('0x51')](_0x5b957b[_0x3cb852][_0xb304('0x52')],_0x5b957b[_0x3cb852][_0xb304('0x53')])){manager[_0xb304('0x54')](_0x3cb852,_0x5b957b[_0x3cb852][_0xb304('0x4f')],handleJob(_0x5b957b[_0x3cb852]));manager[_0xb304('0x55')](_0x3cb852);logger[_0xb304('0x2c')](_0xb304('0x56'),_0x5b957b[_0x3cb852][_0xb304('0x17')],_0x5b957b[_0x3cb852][_0xb304('0x4f')]);}else if(manager['exists'](_0x3cb852)){manager[_0xb304('0x57')](_0x3cb852);manager[_0xb304('0x49')](_0x3cb852);logger[_0xb304('0x2c')](_0xb304('0x58'),_0x5b957b[_0x3cb852][_0xb304('0x17')],_0x5b957b[_0x3cb852][_0xb304('0x4f')]);}}for(_0x4616e1=0x0,_0x3cb852;_0x4616e1<_0x341ea2[_0xb304('0x59')]&&!_0x8125bb;_0x4616e1+=0x1){_0x3cb852=_0x341ea2[_0x4616e1][_0xb304('0x45')]();if(manager[_0xb304('0x5a')](_0x3cb852)){if(_0x5b957b[_0x3cb852][_0xb304('0x4f')]&&_0x5b957b[_0x3cb852][_0xb304('0x50')]&&moment()['isBetween'](_0x5b957b[_0x3cb852][_0xb304('0x52')],_0x5b957b[_0x3cb852][_0xb304('0x53')])){manager[_0xb304('0x5b')](_0x3cb852,_0x5b957b[_0x3cb852][_0xb304('0x4f')],handleJob(_0x5b957b[_0x3cb852]));logger[_0xb304('0x2c')](_0xb304('0x5c'),_0x5b957b[_0x3cb852][_0xb304('0x17')],_0x5b957b[_0x3cb852][_0xb304('0x4f')]);}else{manager[_0xb304('0x57')](_0x3cb852);manager[_0xb304('0x49')](_0x3cb852);logger[_0xb304('0x2c')](_0xb304('0x58'),_0x5b957b[_0x3cb852][_0xb304('0x17')],_0x5b957b[_0x3cb852][_0xb304('0x4f')]);}}}})['catch'](function(_0x48e3b5){logger['error'](JSON[_0xb304('0x27')](_0x48e3b5));});}exports[_0xb304('0x5d')]=function(_0x1566c1){return getJobs(_0x1566c1);};exports[_0xb304('0x55')]=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 31cd090..3e58d54 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 _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 +var _0x1d42=['No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','start','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','Comprehend','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','fileText','TranscriptionJobStatus','COMPLETED','TranscriptionJob','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Transcript\x20not\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll'];(function(_0x5e462b,_0x187b06){var _0xb01a65=function(_0x2cc9a3){while(--_0x2cc9a3){_0x5e462b['push'](_0x5e462b['shift']());}};_0xb01a65(++_0x187b06);}(_0x1d42,0xe0));var _0x21d4=function(_0x41c78d,_0x4c3628){_0x41c78d=_0x41c78d-0x0;var _0x26d028=_0x1d42[_0x41c78d];return _0x26d028;};var _=require('lodash');var AWS=require(_0x21d4('0x0'));var rp=require(_0x21d4('0x1'));var util=require(_0x21d4('0x2'));var BPromise=require(_0x21d4('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x21d4('0x4'))(_0x21d4('0x5'));function getTranscriptionJob(_0x586f03,_0x5c5ebb,_0x8dc1a0,_0x40328e){return new Promise(function(_0x3a5ead,_0x45d2ff){var _0x576a48=new AWS['TranscribeService']({'accessKeyId':_0x5c5ebb,'secretAccessKey':_0x586f03,'region':_0x8dc1a0});_0x576a48['getTranscriptionJob']({'TranscriptionJobName':_0x40328e},function(_0x303633,_0x171379){if(_0x303633){return _0x45d2ff(_0x303633);}else{return _0x3a5ead(_0x171379);}});});}function sentiment(_0x39dba5,_0x11df27,_0xd81d49,_0x5e5a83,_0xa08ccc){return new Promise(function(_0x3a96ea,_0x4820f3){var _0x39dc48=new AWS[(_0x21d4('0x6'))]({'accessKeyId':_0x11df27,'secretAccessKey':_0x39dba5,'region':_0xd81d49});_0x39dc48['detectSentiment']({'Text':_0x5e5a83,'LanguageCode':_0xa08ccc[_0x21d4('0x7')](0x0,0x2)},function(_0x3c1d1b,_0x4f3325){if(_0x3c1d1b){return _0x4820f3(_0x3c1d1b);}else{return _0x3a96ea(_0x4f3325);}});});}function checkTranscribeJob(_0x4c61d2,_0x3c4989,_0x420cd0){var _0x2a03e3;return new BPromise(function(_0x452ab1,_0x46c6fe){logger['info'](util[_0x21d4('0x8')](_0x21d4('0x9'),_0x4c61d2['id'],_0x4c61d2[_0x21d4('0xa')]));return getTranscriptionJob(_0x420cd0[_0x21d4('0xb')],_0x420cd0[_0x21d4('0xc')],_0x3c4989[_0x21d4('0xd')],_0x4c61d2[_0x21d4('0xa')])[_0x21d4('0xe')](function(_0x415fb8){logger[_0x21d4('0xf')](util[_0x21d4('0x8')](_0x21d4('0x10'),_0x4c61d2['id'],_0x4c61d2['transcribeName'],_0x415fb8['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x4c61d2[_0x21d4('0x11')]){switch(_0x415fb8['TranscriptionJob'][_0x21d4('0x12')]){case _0x21d4('0x13'):var _0x5670b2={'transcribeStatus':_0x415fb8['TranscriptionJob'][_0x21d4('0x12')],'fileUri':_0x415fb8[_0x21d4('0x14')][_0x21d4('0x15')]['TranscriptFileUri']};logger['info'](util[_0x21d4('0x8')](_0x21d4('0x16'),_0x4c61d2['id']));return rp({'uri':_0x415fb8[_0x21d4('0x14')][_0x21d4('0x15')][_0x21d4('0x17')],'json':!![]})[_0x21d4('0xe')](function(_0x30e65b){logger[_0x21d4('0xf')](util[_0x21d4('0x8')](_0x21d4('0x18'),_0x4c61d2['id']));if(_0x30e65b&&_0x30e65b[_0x21d4('0x19')]&&_0x30e65b[_0x21d4('0x19')][_0x21d4('0x1a')]&&_0x30e65b[_0x21d4('0x19')][_0x21d4('0x1a')][_0x21d4('0x1b')]){_0x5670b2[_0x21d4('0x11')]='';for(var _0x345b60=0x0;_0x345b60<_0x30e65b[_0x21d4('0x19')][_0x21d4('0x1a')]['length'];_0x345b60++){_0x5670b2[_0x21d4('0x11')]+=_0x30e65b[_0x21d4('0x19')][_0x21d4('0x1a')][_0x345b60][_0x21d4('0x1c')]+'';}}return _0x4c61d2[_0x21d4('0x1d')](_0x5670b2);})[_0x21d4('0xe')](function(){logger[_0x21d4('0xf')](util[_0x21d4('0x8')](_0x21d4('0x1e'),_0x4c61d2['id']));if(!_0x4c61d2[_0x21d4('0x1f')]){throw new db[(_0x21d4('0x20'))][(_0x21d4('0x21'))](_0x21d4('0x22'));}if(!_0x3c4989[_0x21d4('0x23')]||!_0x3c4989[_0x21d4('0x24')]||!_0x3c4989['sentimentRegion']||!_0x3c4989[_0x21d4('0x25')]||!_0x3c4989[_0x21d4('0x26')]){throw new db[(_0x21d4('0x20'))][(_0x21d4('0x21'))](_0x21d4('0x27'));}if(!_0x5670b2[_0x21d4('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x3c4989[_0x21d4('0x24')]===_0x420cd0['id']){return _0x420cd0;}else{return db[_0x21d4('0x28')][_0x21d4('0x29')]({'where':{'id':_settings[_0x21d4('0x24')]}});}})[_0x21d4('0xe')](function(_0x59ed5e){if(!_0x59ed5e){throw new db[(_0x21d4('0x20'))]['ValidationError'](_0x21d4('0x2a'));}if(!_0x59ed5e[_0x21d4('0xb')]||!_0x59ed5e['data2']){throw new db['Sequelize'][(_0x21d4('0x21'))](_0x21d4('0x2b'));}_0x2a03e3=_0x59ed5e;logger[_0x21d4('0xf')](util[_0x21d4('0x8')](_0x21d4('0x2c'),_0x4c61d2['id']));return sentiment(_0x2a03e3[_0x21d4('0xb')],_0x2a03e3[_0x21d4('0xc')],_0x3c4989[_0x21d4('0x2d')],_0x5670b2[_0x21d4('0x11')],_0x3c4989[_0x21d4('0x25')]);})[_0x21d4('0xe')](function(_0x31a282){logger[_0x21d4('0xf')](util[_0x21d4('0x8')](_0x21d4('0x2e'),_0x4c61d2['id']));return _0x4c61d2['update']({'sentiment':_0x31a282[_0x21d4('0x2f')],'sPositive':_0x31a282[_0x21d4('0x30')][_0x21d4('0x31')],'sNegative':_0x31a282['SentimentScore'][_0x21d4('0x32')],'sMixed':_0x31a282['SentimentScore'][_0x21d4('0x33')],'sNeutral':_0x31a282[_0x21d4('0x30')]['Neutral']});})[_0x21d4('0xe')](function(){logger[_0x21d4('0xf')](util[_0x21d4('0x8')](_0x21d4('0x1e'),_0x4c61d2['id']));_0x452ab1();});case _0x21d4('0x34'):return _0x4c61d2[_0x21d4('0x1d')]({'transcribeStatus':_0x21d4('0x34'),'failureReason':_0x415fb8[_0x21d4('0x14')][_0x21d4('0x35')]})[_0x21d4('0xe')](function(){logger[_0x21d4('0xf')](util[_0x21d4('0x8')](_0x21d4('0x1e'),_0x4c61d2['id']));_0x452ab1();});default:logger['info'](util[_0x21d4('0x8')](_0x21d4('0x36'),_0x4c61d2['id']));break;}}else{return BPromise['resolve']()[_0x21d4('0xe')](function(){if(!_0x4c61d2['tempSentiment']){throw new db[(_0x21d4('0x20'))]['ValidationError'](_0x21d4('0x22'));}if(!_0x3c4989[_0x21d4('0x23')]||!_0x3c4989[_0x21d4('0x24')]||!_0x3c4989[_0x21d4('0x2d')]||!_0x3c4989[_0x21d4('0x25')]||!_0x3c4989[_0x21d4('0x26')]){throw new db[(_0x21d4('0x20'))][(_0x21d4('0x21'))](_0x21d4('0x27'));}if(!_0x4c61d2[_0x21d4('0x11')]){throw new Error(_0x21d4('0x37'));}if(_0x3c4989[_0x21d4('0x24')]===_0x420cd0['id']){return _0x420cd0;}else{return db[_0x21d4('0x28')][_0x21d4('0x29')]({'where':{'id':_settings[_0x21d4('0x24')]}});}})[_0x21d4('0xe')](function(_0x5d22ec){if(!_0x5d22ec){throw new db['Sequelize'][(_0x21d4('0x21'))](_0x21d4('0x2a'));}if(!_0x5d22ec['data1']||!_0x5d22ec[_0x21d4('0xc')]){throw new db[(_0x21d4('0x20'))][(_0x21d4('0x21'))](_0x21d4('0x2b'));}_0x2a03e3=_0x5d22ec;logger[_0x21d4('0xf')](util[_0x21d4('0x8')](_0x21d4('0x2c'),_0x4c61d2['id']));return sentiment(_0x2a03e3['data1'],_0x2a03e3['data2'],_0x3c4989['sentimentRegion'],_0x4c61d2[_0x21d4('0x11')],_0x3c4989[_0x21d4('0x25')]);})[_0x21d4('0xe')](function(_0x2f58fb){logger[_0x21d4('0xf')](util['format'](_0x21d4('0x2e'),_0x4c61d2['id']));return _0x4c61d2['update']({'sentiment':_0x2f58fb['Sentiment'],'sPositive':_0x2f58fb[_0x21d4('0x30')][_0x21d4('0x31')],'sNegative':_0x2f58fb['SentimentScore']['Negative'],'sMixed':_0x2f58fb[_0x21d4('0x30')]['Mixed'],'sNeutral':_0x2f58fb[_0x21d4('0x30')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0x21d4('0xe')](function(){logger['info'](util[_0x21d4('0x8')](_0x21d4('0x1e'),_0x4c61d2['id']));_0x452ab1();});}})[_0x21d4('0x38')](function(_0x43748c){if(_0x43748c){if(!_0x43748c['name']||_0x43748c[_0x21d4('0x39')]!==_0x21d4('0x3a')){logger[_0x21d4('0x3b')](util[_0x21d4('0x8')](_0x21d4('0x3c'),_0x4c61d2['id']),util[_0x21d4('0x3d')](_0x43748c,{'showHidden':![],'depth':null}));}}_0x452ab1();});});}function checkTranscribe(){var _0x18c369;var _0x1aaebf;var _0x208e03;return db[_0x21d4('0x3e')][_0x21d4('0x3f')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x21d4('0xe')](function(_0x4b61b8){if(!_0x4b61b8||!_0x4b61b8[_0x21d4('0x1b')]){throw new db[(_0x21d4('0x20'))]['ValidationError'](_0x21d4('0x40'));}_0x18c369=_0x4b61b8;return db['Setting'][_0x21d4('0x29')]({'where':{'id':0x1}});})[_0x21d4('0xe')](function(_0x338664){if(!_0x338664){throw new db[(_0x21d4('0x20'))][(_0x21d4('0x21'))](_0x21d4('0x41'));}_0x1aaebf=_0x338664;if(!_0x1aaebf['transcribe']||!_0x1aaebf['transcribeAccountId']||!_0x1aaebf['transcribeRegion']||!_0x1aaebf[_0x21d4('0x25')]||!_0x1aaebf[_0x21d4('0x26')]){throw new db[(_0x21d4('0x20'))][(_0x21d4('0x21'))](_0x21d4('0x42'));}return db[_0x21d4('0x28')][_0x21d4('0x29')]({'where':{'id':_0x1aaebf[_0x21d4('0x43')]}});})[_0x21d4('0xe')](function(_0x4100ac){if(!_0x4100ac){throw new db['Sequelize'][(_0x21d4('0x21'))](_0x21d4('0x2a'));}if(!_0x4100ac['data1']||!_0x4100ac[_0x21d4('0xc')]){throw new db['Sequelize']['ValidationError'](_0x21d4('0x2b'));}_0x208e03=_0x4100ac;var _0x1b6bfc=[];_0x18c369[_0x21d4('0x44')](function(_0x2cbf66){_0x1b6bfc[_0x21d4('0x45')](checkTranscribeJob(_0x2cbf66,_0x1aaebf,_0x208e03));});return BPromise[_0x21d4('0x46')](_0x1b6bfc);})['catch'](function(_0x27e36f){if(_0x27e36f){if(!_0x27e36f['name']||_0x27e36f[_0x21d4('0x39')]!=='SequelizeValidationError'){logger[_0x21d4('0x3b')](util[_0x21d4('0x3d')](_0x27e36f,{'showHidden':![],'depth':null}));}}});}exports[_0x21d4('0x47')]=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 0c08167..1f2eae2 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 _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 +var _0x773e=['WhatsappInteraction','lastMsgAt','subtract','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','error','start','moment','ioredis','util','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter'];(function(_0x46799e,_0x84a401){var _0x8d429e=function(_0x12cc2a){while(--_0x12cc2a){_0x46799e['push'](_0x46799e['shift']());}};_0x8d429e(++_0x84a401);}(_0x773e,0x10b));var _0xe773=function(_0x57e31f,_0x452ba4){_0x57e31f=_0x57e31f-0x0;var _0x511ffc=_0x773e[_0x57e31f];return _0x511ffc;};'use strict';var _=require('lodash');var moment=require(_0xe773('0x0'));var Redis=require(_0xe773('0x1'));var util=require(_0xe773('0x2'));var config=require('../../config/environment');var db=require(_0xe773('0x3'))['db'];var logger=require(_0xe773('0x4'))('schedule');config[_0xe773('0x5')]=_[_0xe773('0x6')](config['redis'],{'host':_0xe773('0x7'),'port':0x18eb});var io=require(_0xe773('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x295214=[];return db[_0xe773('0x9')]['findAll']({'raw':!![],'attributes':['id',_0xe773('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xe773('0xb')](0x18,'hours')}}})[_0xe773('0xc')](function(_0x5d1fd2){if(_0x5d1fd2&&_0x5d1fd2[_0xe773('0xd')]){_0x295214=_['map'](_0x5d1fd2||[],'id');logger[_0xe773('0xe')](_0xe773('0xf'),_0x295214[_0xe773('0x10')]());return db[_0xe773('0x9')][_0xe773('0x11')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0xe773('0x12'))},{'where':{'id':_0x295214}});}})[_0xe773('0xc')](function(){if(_0x295214&&_0x295214[_0xe773('0xd')]){logger[_0xe773('0xe')](_0xe773('0x13'),_0x295214[_0xe773('0x10')]());for(var _0x564131=0x0;_0x564131<_0x295214[_0xe773('0xd')];_0x564131++){io[_0xe773('0x14')]('whatsappInteraction:update',{'id':_0x295214[_0x564131],'closed':!![]});}}})['catch'](function(_0xbf8017){logger[_0xe773('0x15')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0xbf8017?util['inspect'](_0xbf8017,{'showHidden':![],'depth':null}):'');});}exports[_0xe773('0x16')]=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 561a210..bb39817 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x1ba6=['hopper2','catch','util','@xcally.com','push','now','Innocenzo','Biondo','innocenzo.biondo','CmContact','then','bulkCreate','log','finished\x20populating','contacts1','destroy','hopper1','contacts2'];(function(_0x5cfbe8,_0x5d9e19){var _0x3b045a=function(_0x38a512){while(--_0x38a512){_0x5cfbe8['push'](_0x5cfbe8['shift']());}};_0x3b045a(++_0x5d9e19);}(_0x1ba6,0xa4));var _0x61ba=function(_0x16da32,_0x34438e){_0x16da32=_0x16da32-0x0;var _0x4144d5=_0x1ba6[_0x16da32];return _0x4144d5;};'use strict';var util=require(_0x61ba('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x61ba('0x1')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x61ba('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x61ba('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x61ba('0x3')](),'updatedAt':Date[_0x61ba('0x3')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x61ba('0x4')+i,'lastName':_0x61ba('0x5')+i,'phone':0xf879fb460+i,'email':_0x61ba('0x6')+i+_0x61ba('0x1')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x61ba('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x61ba('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x61ba('0x3')](),'updatedAt':Date[_0x61ba('0x3')]()});}db[_0x61ba('0x7')]['destroy']({'where':{}})[_0x61ba('0x8')](function(){return db['CmContact'][_0x61ba('0x9')](contacts);})['then'](function(){console[_0x61ba('0xa')](_0x61ba('0xb'),_0x61ba('0xc'));return db['CmHopper'][_0x61ba('0xd')]({'where':{}});})[_0x61ba('0x8')](function(){return db['CmHopper'][_0x61ba('0x9')](hopper);})[_0x61ba('0x8')](function(){console['log'](_0x61ba('0xb'),_0x61ba('0xe'));return db[_0x61ba('0x7')][_0x61ba('0x9')](contacts2);})['then'](function(){console[_0x61ba('0xa')](_0x61ba('0xb'),_0x61ba('0xf'));return db['CmHopper']['bulkCreate'](hopper2);})['then'](function(){console[_0x61ba('0xa')]('finished\x20populating',_0x61ba('0x10'));})[_0x61ba('0x11')](function(_0x45e3b7){console['log'](_0x45e3b7);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index e4d8ca6..07fbbc1 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x13b4=['password','friend','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','then','log','add\x20user','util','push','format','%s%s','agent','%s%s@xcally.com'];(function(_0x286e12,_0x237677){var _0xd97fdd=function(_0x5b1f58){while(--_0x5b1f58){_0x286e12['push'](_0x286e12['shift']());}};_0xd97fdd(++_0x237677);}(_0x13b4,0xa5));var _0x413b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x13b4[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x413b('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x413b('0x1')]({'name':util[_0x413b('0x2')](_0x413b('0x3'),_0x413b('0x4'),i),'fullname':util['format'](_0x413b('0x3'),_0x413b('0x4'),i),'email':util[_0x413b('0x2')](_0x413b('0x5'),_0x413b('0x4'),i),'role':'agent','password':_0x413b('0x6'),'internal':0xfa0+i,'type':_0x413b('0x7'),'transport':[_0x413b('0x8'),'ws','wss'],'disallow':[_0x413b('0x9')],'allow':[_0x413b('0xa')],'defaultuser':util[_0x413b('0x2')](_0x413b('0x3'),_0x413b('0x4'),i),'encryption':_0x413b('0xb'),'avpf':_0x413b('0xb'),'force_avp':_0x413b('0xb'),'icesupport':'yes','dtlsenable':_0x413b('0xb'),'dtlsverify':'no','dtlscertfile':_0x413b('0xc'),'dtlsprivatekey':_0x413b('0xd'),'dtlssetup':'actpass','callerid':util[_0x413b('0x2')](_0x413b('0xe'),util[_0x413b('0x2')](_0x413b('0x3'),'agent',i),0xfa0+i)});}db[_0x413b('0xf')]['bulkCreate'](users)[_0x413b('0x10')](function(){console[_0x413b('0x11')](_0x413b('0x12'));})['catch'](function(_0x4612cb){console[_0x413b('0x11')](_0x4612cb);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index e7f1831..5e7e3ff 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xae88=['admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','Campaign','voice:inbound','WhatsappQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','remoteAddress','request','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','name','agent','telephone','type','ivr','UserProfileSection','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','role','format','%s:queue:%s','user:%s','handshake','User','find','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions'];(function(_0x33e59a,_0x4d364d){var _0x1456c9=function(_0x327022){while(--_0x327022){_0x33e59a['push'](_0x33e59a['shift']());}};_0x1456c9(++_0x4d364d);}(_0xae88,0xa1));var _0x8ae8=function(_0x36ea55,_0x15caa6){_0x36ea55=_0x36ea55-0x0;var _0x3658dd=_0xae88[_0x36ea55];return _0x3658dd;};'use strict';var _=require(_0x8ae8('0x0'));var util=require(_0x8ae8('0x1'));var BPromise=require(_0x8ae8('0x2'));var db=require(_0x8ae8('0x3'))['db'];var config=require(_0x8ae8('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x8ae8('0x5'),'model':db['User'],'attributes':['id',_0x8ae8('0x6'),'role'],'raw':!![],'where':{'role':_0x8ae8('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x8ae8('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x8ae8('0x6')],'where':{'role':_0x8ae8('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x8ae8('0x9')],'where':{'type':_0x8ae8('0xa')}};function getAssociatedResources(_0x4dd3b1,_0x2fa9b6,_0x2aaade){return db[_0x8ae8('0xb')]['findOne']({'where':{'name':_0x4dd3b1,'userProfileId':_0x2fa9b6},'raw':!![]})[_0x8ae8('0xc')](function(_0x511f03){if(_0x511f03){if(_0x511f03['autoAssociation']){switch(_0x4dd3b1){case _0x8ae8('0xd'):case _0x8ae8('0xe'):case _0x8ae8('0xf'):case _0x8ae8('0x10'):case _0x8ae8('0x11'):case _0x8ae8('0x12'):case'WhatsappQueues':return db[_0x2aaade][_0x8ae8('0x13')](queryQueues);case _0x8ae8('0x14'):return db[_0x2aaade][_0x8ae8('0x13')](queryTelephones);case _0x8ae8('0x15'):return db[_0x2aaade]['findAll'](queryTrunks);case _0x8ae8('0x16'):return db[_0x2aaade][_0x8ae8('0x13')](queryCampaigns);}}else{return db[_0x8ae8('0x17')][_0x8ae8('0x13')]({'attributes':[_0x8ae8('0x18')],'where':{'sectionId':_0x511f03['id']},'raw':!![]})[_0x8ae8('0xc')](function(_0x2df77c){if(_0x2df77c){var _0x1eb2a9={'where':{'id':_[_0x8ae8('0x19')](_0x2df77c,'resourceId')},'raw':!![]};switch(_0x2aaade){case'User':_0x1eb2a9[_0x8ae8('0x1a')][_0x8ae8('0x1b')]=_0x8ae8('0x8');break;case'Campaign':_0x1eb2a9[_0x8ae8('0x1a')][_0x8ae8('0x9')]=_0x8ae8('0xa');break;}return db[_0x2aaade][_0x8ae8('0x13')](_0x1eb2a9);}else{return[];}});}}else{return[];}})['then'](function(_0x49d472){return _0x49d472;});}function joinOrLeaveQueues(_0x3c276c,_0x5c5dcc,_0x31e804,_0x85c632){_0x3c276c[_0x5c5dcc](util[_0x8ae8('0x1c')](_0x8ae8('0x1d'),_0x31e804,_0x85c632[_0x8ae8('0x6')]));if(_0x85c632['Agents']){for(var _0x9ec156=0x0;_0x9ec156<_0x85c632['Agents']['length'];_0x9ec156+=0x1){_0x3c276c[_0x5c5dcc](util[_0x8ae8('0x1c')](_0x8ae8('0x1e'),_0x85c632[_0x8ae8('0x5')][_0x9ec156]['name']));}}}function joinOrLeave(_0x2cee78,_0x5a3df6,_0x2136e0){var _0x2e46af;if(_0x2cee78[_0x8ae8('0x1f')]['query']['id']){db[_0x8ae8('0x20')][_0x8ae8('0x21')]({'attributes':['id','name',_0x8ae8('0x1b'),_0x8ae8('0x22')],'where':{'id':_0x2cee78[_0x8ae8('0x1f')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0x8ae8('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x8ae8('0x24')],'as':_0x8ae8('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x8ae8('0x26')],'as':_0x8ae8('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x8ae8('0x28')],'as':_0x8ae8('0x29'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x8ae8('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x8ae8('0x2b')],'as':_0x8ae8('0x2c'),'attributes':['id'],'raw':!![]}]})['then'](function(_0xf7dc9b){if(_0xf7dc9b){_0x2e46af=_0xf7dc9b;_0x2cee78[_0x5a3df6](util[_0x8ae8('0x1c')](_0x8ae8('0x1e'),_0xf7dc9b['name']));var _0x45cc3d=[];switch(_0xf7dc9b['role']){case _0x8ae8('0x2d'):_0x2cee78[_0x5a3df6]('voice:inbound');_0x2cee78[_0x5a3df6](_0x8ae8('0x2e'));if(queryQueues[_0x8ae8('0x2f')]('include')){delete queryQueues[_0x8ae8('0x30')];}_0x45cc3d[_0x8ae8('0x31')](db[_0x8ae8('0x32')]['findAll'](queryQueues));_0x45cc3d[_0x8ae8('0x31')](db[_0x8ae8('0x33')][_0x8ae8('0x13')](queryQueues));_0x45cc3d[_0x8ae8('0x31')](db[_0x8ae8('0x34')][_0x8ae8('0x13')](queryQueues));_0x45cc3d[_0x8ae8('0x31')](db[_0x8ae8('0x35')][_0x8ae8('0x13')](queryQueues));_0x45cc3d[_0x8ae8('0x31')](db[_0x8ae8('0x36')][_0x8ae8('0x13')](queryQueues));_0x45cc3d[_0x8ae8('0x31')](db[_0x8ae8('0x37')][_0x8ae8('0x13')](queryQueues));_0x45cc3d['push'](db['WhatsappQueue'][_0x8ae8('0x13')](queryQueues));_0x45cc3d[_0x8ae8('0x31')](db['User'][_0x8ae8('0x13')](queryTelephones));_0x45cc3d['push'](db[_0x8ae8('0x38')][_0x8ae8('0x13')](queryTrunks));_0x45cc3d[_0x8ae8('0x31')](db[_0x8ae8('0x39')]['findAll'](queryCampaigns));_0x45cc3d['push'](db[_0x8ae8('0x20')][_0x8ae8('0x13')](queryAgents));break;case'user':_0x2cee78[_0x5a3df6](_0x8ae8('0x3a'));_0x2cee78[_0x5a3df6](_0x8ae8('0x2e'));_0x45cc3d[_0x8ae8('0x31')](getAssociatedResources(_0x8ae8('0xd'),_0xf7dc9b[_0x8ae8('0x22')],_0x8ae8('0x32')));_0x45cc3d[_0x8ae8('0x31')](getAssociatedResources(_0x8ae8('0xe'),_0xf7dc9b[_0x8ae8('0x22')],_0x8ae8('0x33')));_0x45cc3d[_0x8ae8('0x31')](getAssociatedResources(_0x8ae8('0xf'),_0xf7dc9b['userProfileId'],'FaxQueue'));_0x45cc3d[_0x8ae8('0x31')](getAssociatedResources('SmsQueues',_0xf7dc9b[_0x8ae8('0x22')],_0x8ae8('0x35')));_0x45cc3d[_0x8ae8('0x31')](getAssociatedResources(_0x8ae8('0x11'),_0xf7dc9b[_0x8ae8('0x22')],'MailQueue'));_0x45cc3d[_0x8ae8('0x31')](getAssociatedResources(_0x8ae8('0x12'),_0xf7dc9b[_0x8ae8('0x22')],_0x8ae8('0x37')));_0x45cc3d[_0x8ae8('0x31')](getAssociatedResources(_0x8ae8('0x3b'),_0xf7dc9b[_0x8ae8('0x22')],'WhatsappQueue'));_0x45cc3d['push'](getAssociatedResources(_0x8ae8('0x14'),_0xf7dc9b[_0x8ae8('0x22')],_0x8ae8('0x20')));_0x45cc3d[_0x8ae8('0x31')](getAssociatedResources(_0x8ae8('0x15'),_0xf7dc9b['userProfileId'],'Trunk'));_0x45cc3d[_0x8ae8('0x31')](getAssociatedResources(_0x8ae8('0x16'),_0xf7dc9b[_0x8ae8('0x22')],_0x8ae8('0x39')));_0x45cc3d[_0x8ae8('0x31')](db[_0x8ae8('0x20')][_0x8ae8('0x13')](queryAgents));break;case _0x8ae8('0x7'):_0x2cee78[_0x5a3df6]('voice:inbound');_0x2cee78[_0x5a3df6](_0x8ae8('0x2e'));_0x45cc3d[_0x8ae8('0x31')](_0xf7dc9b[_0x8ae8('0x3c')]({'attributes':['id',_0x8ae8('0x6')]}));_0x45cc3d[_0x8ae8('0x31')](_0xf7dc9b[_0x8ae8('0x3d')]({'attributes':['id','name']}));_0x45cc3d[_0x8ae8('0x31')](_0xf7dc9b[_0x8ae8('0x3e')]({'attributes':['id',_0x8ae8('0x6')]}));_0x45cc3d['push'](_0xf7dc9b[_0x8ae8('0x3f')]({'attributes':['id',_0x8ae8('0x6')]}));_0x45cc3d[_0x8ae8('0x31')](_0xf7dc9b[_0x8ae8('0x40')]({'attributes':['id',_0x8ae8('0x6')]}));_0x45cc3d[_0x8ae8('0x31')](_0xf7dc9b[_0x8ae8('0x41')]({'attributes':['id',_0x8ae8('0x6')]}));_0x45cc3d[_0x8ae8('0x31')](_0xf7dc9b[_0x8ae8('0x42')]({'attributes':['id',_0x8ae8('0x6')]}));break;}return BPromise[_0x8ae8('0x43')](_0x45cc3d);}})['then'](function(_0xae1b62){if(_0xae1b62&&_0xae1b62['length']){for(var _0x59b162=0x0;_0x59b162<_0xae1b62[_0x8ae8('0x44')];_0x59b162+=0x1){for(var _0x554547=0x0;_0x554547<_0xae1b62[_0x59b162][_0x8ae8('0x44')];_0x554547+=0x1){switch(_0x59b162){case 0x0:joinOrLeaveQueues(_0x2cee78,_0x5a3df6,_0x8ae8('0x45'),_0xae1b62[_0x59b162][_0x554547]);break;case 0x1:joinOrLeaveQueues(_0x2cee78,_0x5a3df6,'chat',_0xae1b62[_0x59b162][_0x554547]);break;case 0x2:joinOrLeaveQueues(_0x2cee78,_0x5a3df6,'fax',_0xae1b62[_0x59b162][_0x554547]);break;case 0x3:joinOrLeaveQueues(_0x2cee78,_0x5a3df6,_0x8ae8('0x46'),_0xae1b62[_0x59b162][_0x554547]);break;case 0x4:joinOrLeaveQueues(_0x2cee78,_0x5a3df6,_0x8ae8('0x47'),_0xae1b62[_0x59b162][_0x554547]);break;case 0x5:joinOrLeaveQueues(_0x2cee78,_0x5a3df6,_0x8ae8('0x48'),_0xae1b62[_0x59b162][_0x554547]);break;case 0x6:joinOrLeaveQueues(_0x2cee78,_0x5a3df6,_0x8ae8('0x49'),_0xae1b62[_0x59b162][_0x554547]);break;case 0x7:_0x2cee78[_0x5a3df6](util[_0x8ae8('0x1c')](_0x8ae8('0x4a'),_0xae1b62[_0x59b162][_0x554547][_0x8ae8('0x6')]));break;case 0x8:_0x2cee78[_0x5a3df6](util['format'](_0x8ae8('0x4b'),_0xae1b62[_0x59b162][_0x554547][_0x8ae8('0x6')]));break;case 0x9:_0x2cee78[_0x5a3df6](util[_0x8ae8('0x1c')](_0x8ae8('0x4c'),_0xae1b62[_0x59b162][_0x554547][_0x8ae8('0x9')],_0xae1b62[_0x59b162][_0x554547][_0x8ae8('0x6')]));break;case 0xa:_0x2cee78[_0x5a3df6](util[_0x8ae8('0x1c')](_0x8ae8('0x1e'),_0xae1b62[_0x59b162][_0x554547][_0x8ae8('0x6')]));break;}}}}})[_0x8ae8('0xc')](function(){if(_0x5a3df6===_0x8ae8('0x4d')){var _0x1e3bd3=_[_0x8ae8('0x19')](_0x2e46af[_0x8ae8('0x23')],'id');return _0x2e46af[_0x8ae8('0x4e')](_0x1e3bd3)[_0x8ae8('0xc')](function(){for(var _0x5926e9=0x0;_0x5926e9<_0x1e3bd3[_0x8ae8('0x44')];_0x5926e9+=0x1){_0x2136e0[_0x8ae8('0x4f')](_0x8ae8('0x50'),{'ChatInteractionId':Number(_0x1e3bd3[_0x5926e9]),'UserId':Number(_0x2e46af['id'])});}});}})['then'](function(){if(_0x5a3df6===_0x8ae8('0x4d')){var _0x1b3d08=_['map'](_0x2e46af[_0x8ae8('0x25')],'id');return _0x2e46af['removeMailInteractions'](_0x1b3d08)[_0x8ae8('0xc')](function(){for(var _0x1cd108=0x0;_0x1cd108<_0x1b3d08[_0x8ae8('0x44')];_0x1cd108+=0x1){_0x2136e0[_0x8ae8('0x4f')](_0x8ae8('0x51'),{'MailInteractionId':Number(_0x1b3d08[_0x1cd108]),'UserId':Number(_0x2e46af['id'])});}});}})[_0x8ae8('0xc')](function(){if(_0x5a3df6==='leave'){var _0x12d376=_[_0x8ae8('0x19')](_0x2e46af['FaxInteractions'],'id');return _0x2e46af[_0x8ae8('0x52')](_0x12d376)[_0x8ae8('0xc')](function(){for(var _0x29079b=0x0;_0x29079b<_0x12d376[_0x8ae8('0x44')];_0x29079b+=0x1){_0x2136e0['emit'](_0x8ae8('0x53'),{'FaxInteractionId':Number(_0x12d376[_0x29079b]),'UserId':Number(_0x2e46af['id'])});}});}})['then'](function(){if(_0x5a3df6===_0x8ae8('0x4d')){var _0x20ee57=_[_0x8ae8('0x19')](_0x2e46af[_0x8ae8('0x29')],'id');return _0x2e46af[_0x8ae8('0x54')](_0x20ee57)[_0x8ae8('0xc')](function(){for(var _0x3dc61d=0x0;_0x3dc61d<_0x20ee57[_0x8ae8('0x44')];_0x3dc61d+=0x1){_0x2136e0[_0x8ae8('0x4f')](_0x8ae8('0x55'),{'SmsInteractionId':Number(_0x20ee57[_0x3dc61d]),'UserId':Number(_0x2e46af['id'])});}});}})[_0x8ae8('0xc')](function(){if(_0x5a3df6==='leave'){var _0x367b1a=_['map'](_0x2e46af[_0x8ae8('0x2a')],'id');return _0x2e46af[_0x8ae8('0x56')](_0x367b1a)[_0x8ae8('0xc')](function(){for(var _0x3d4987=0x0;_0x3d4987<_0x367b1a['length'];_0x3d4987+=0x1){_0x2136e0['emit'](_0x8ae8('0x57'),{'OpenchannelInteractionId':Number(_0x367b1a[_0x3d4987]),'UserId':Number(_0x2e46af['id'])});}});}})['then'](function(){if(_0x5a3df6===_0x8ae8('0x4d')){var _0x5a6f14=_[_0x8ae8('0x19')](_0x2e46af['WhatsappInteractions'],'id');return _0x2e46af[_0x8ae8('0x58')](_0x5a6f14)[_0x8ae8('0xc')](function(){for(var _0xebeed1=0x0;_0xebeed1<_0x5a6f14[_0x8ae8('0x44')];_0xebeed1+=0x1){_0x2136e0[_0x8ae8('0x4f')](_0x8ae8('0x59'),{'WhatsappInteractionId':Number(_0x5a6f14[_0xebeed1]),'UserId':Number(_0x2e46af['id'])});}});}})['catch'](function(_0x21f0c5){_0x2cee78[_0x8ae8('0x5a')](_0x21f0c5);});}}function onDisconnect(_0x1fc36a,_0x3f7593){joinOrLeave(_0x1fc36a,'leave',_0x3f7593);}function onConnect(_0x439643){joinOrLeave(_0x439643,_0x8ae8('0x5b'));}exports[_0x8ae8('0x5c')]=function(_0x5b1418){_0x5b1418['on'](_0x8ae8('0x5d'),function(_0x153fd9){_0x153fd9[_0x8ae8('0x5e')](0x0);_0x153fd9[_0x8ae8('0x5f')]=_0x153fd9['request'][_0x8ae8('0x5d')][_0x8ae8('0x60')]+':'+_0x153fd9[_0x8ae8('0x61')][_0x8ae8('0x5d')]['remotePort'];_0x153fd9[_0x8ae8('0x62')]=new Date();_0x153fd9['log']=function(_0x2cff1b){console[_0x8ae8('0x5a')](_0x8ae8('0x63')+_0x153fd9['nsp'][_0x8ae8('0x6')]+'['+_0x153fd9[_0x8ae8('0x5f')]+']',_0x2cff1b);};_0x153fd9['on'](_0x8ae8('0x64'),function(){onDisconnect(_0x153fd9,_0x5b1418);_0x153fd9[_0x8ae8('0x5a')](_0x8ae8('0x65'));});onConnect(_0x153fd9);_0x153fd9[_0x8ae8('0x5a')](_0x8ae8('0x66'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index f959367..8d9d2e3 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 _0x7a37=['newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxMessage','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','EventManager','then','info','Trigger,\x20%s','error','get','channel','event','direction','UserId','User','find','name','interface','SIP/%s','incomingmessage','catch','outgoingmessage','opened','changed','closed','format','length','hasOwnProperty','model','callback','toLowerCase','../../mysqldb','jayson/promise','../logger','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage'];(function(_0xba4b3c,_0x625e19){var _0xd531a0=function(_0x291b4a){while(--_0x291b4a){_0xba4b3c['push'](_0xba4b3c['shift']());}};_0xd531a0(++_0x625e19);}(_0x7a37,0x133));var _0x77a3=function(_0x5e0e1e,_0x1b67fc){_0x5e0e1e=_0x5e0e1e-0x0;var _0x599059=_0x7a37[_0x5e0e1e];return _0x599059;};'use strict';var util=require('util');var db=require(_0x77a3('0x0'))['db'];var jayson=require(_0x77a3('0x1'));var logger=require(_0x77a3('0x2'))('triggers');var client=jayson['client'][_0x77a3('0x3')]({'port':0x232a});var triggers=[{'channel':_0x77a3('0x4'),'model':_0x77a3('0x5'),'event':_0x77a3('0x6'),'condition':_0x77a3('0x7'),'callback':afterCreate},{'channel':'Chat','model':_0x77a3('0x5'),'event':_0x77a3('0x8'),'condition':_0x77a3('0x9'),'callback':afterUpdate},{'channel':_0x77a3('0x4'),'model':_0x77a3('0xa'),'event':_0x77a3('0x6'),'condition':_0x77a3('0xb'),'callback':afterCreateMessage},{'channel':_0x77a3('0xc'),'model':_0x77a3('0xd'),'event':_0x77a3('0x6'),'condition':_0x77a3('0x7'),'callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':_0x77a3('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x77a3('0xc'),'model':_0x77a3('0xe'),'event':_0x77a3('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x77a3('0xf'),'model':_0x77a3('0x10'),'event':_0x77a3('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x77a3('0xf'),'model':_0x77a3('0x10'),'event':_0x77a3('0x8'),'condition':_0x77a3('0x9'),'callback':afterUpdate},{'channel':_0x77a3('0xf'),'model':_0x77a3('0x11'),'event':_0x77a3('0x6'),'condition':_0x77a3('0xb'),'callback':afterCreateMessage},{'channel':_0x77a3('0x12'),'model':'FaxInteraction','event':_0x77a3('0x6'),'condition':_0x77a3('0x7'),'callback':afterCreate},{'channel':_0x77a3('0x12'),'model':'FaxInteraction','event':_0x77a3('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x77a3('0x12'),'model':_0x77a3('0x13'),'event':_0x77a3('0x6'),'condition':_0x77a3('0xb'),'callback':afterCreateMessage},{'channel':_0x77a3('0x14'),'model':_0x77a3('0x15'),'event':_0x77a3('0x6'),'condition':_0x77a3('0x7'),'callback':afterCreate},{'channel':_0x77a3('0x14'),'model':_0x77a3('0x15'),'event':_0x77a3('0x8'),'condition':_0x77a3('0x9'),'callback':afterUpdate},{'channel':_0x77a3('0x14'),'model':_0x77a3('0x16'),'event':_0x77a3('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':_0x77a3('0x17'),'event':'afterCreate','condition':_0x77a3('0x7'),'callback':afterCreate},{'channel':_0x77a3('0x18'),'model':_0x77a3('0x17'),'event':'afterUpdate','condition':_0x77a3('0x9'),'callback':afterUpdate},{'channel':_0x77a3('0x18'),'model':_0x77a3('0x19'),'event':'afterCreate','condition':_0x77a3('0xb'),'callback':afterCreateMessage}];function request(_0x3c887b){return client['request'](_0x77a3('0x1a'),_0x3c887b)[_0x77a3('0x1b')](function(_0x3d0cfb){logger[_0x77a3('0x1c')](_0x77a3('0x1d'),'EventManager',_0x3d0cfb);if(_0x3d0cfb[_0x77a3('0x1e')]){if(_0x3d0cfb['error']['code']===0x1f4){logger[_0x77a3('0x1e')](_0x77a3('0x1d'),'EventManager',_0x3d0cfb[_0x77a3('0x1e')]);}}})['catch'](function(_0x41275b){logger[_0x77a3('0x1e')](_0x77a3('0x1d'),_0x77a3('0x1a'),_0x41275b);});}function afterCreateMessage(_0x405948,_0x5b1137){return function(_0xf712f,_0xfa73b1){_0xf712f=_0xf712f[_0x77a3('0x1f')]({'plain':!![]});_0xf712f[_0x77a3('0x20')]=_0x405948;_0xf712f[_0x77a3('0x21')]=_0xf712f[_0x77a3('0x22')];if(_0xf712f[_0x77a3('0x23')]){return db[_0x77a3('0x24')][_0x77a3('0x25')]({'where':{'id':_0xf712f[_0x77a3('0x23')]},'attributes':['id',_0x77a3('0x26')],'raw':!![]})[_0x77a3('0x1b')](function(_0x582160){_0xf712f[_0x77a3('0x27')]=util['format'](_0x77a3('0x28'),_0x582160[_0x77a3('0x26')]);_0xf712f[_0x77a3('0x20')]=_0x405948;return request({'event':_0x77a3('0x29'),'message':_0xf712f});})[_0x77a3('0x2a')](function(_0x76e3ee){console[_0x77a3('0x1e')](_0x76e3ee);});}else{return request({'event':_0x77a3('0x2b'),'message':_0xf712f});}};}function afterCreate(_0x534746,_0x4c2c73){return function(_0x3cd820,_0x150302){_0x3cd820=_0x3cd820['get']({'plain':!![]});_0x3cd820[_0x77a3('0x20')]=_0x534746;_0x3cd820[_0x77a3('0x21')]=_0x77a3('0x2c');return request({'event':_0x4c2c73,'message':_0x3cd820});};}function afterUpdate(_0x2c8c07,_0x2a349c){return function(_0xc07bf9,_0x203080){if(_0xc07bf9[_0x77a3('0x2d')](_0x77a3('0x2e'))&&_0xc07bf9['closed']){_0xc07bf9=_0xc07bf9[_0x77a3('0x1f')]({'plain':!![]});_0xc07bf9[_0x77a3('0x20')]=_0x2c8c07;_0xc07bf9[_0x77a3('0x21')]='closed';if(_0xc07bf9[_0x77a3('0x23')]){return db['User'][_0x77a3('0x25')]({'where':{'id':_0xc07bf9[_0x77a3('0x23')]},'attributes':['id','name'],'raw':!![]})[_0x77a3('0x1b')](function(_0xc88249){_0xc07bf9[_0x77a3('0x27')]=util[_0x77a3('0x2f')](_0x77a3('0x28'),_0xc88249[_0x77a3('0x26')]);return request({'event':_0x2a349c,'message':_0xc07bf9});})['catch'](function(_0x46ce97){console['error'](_0x46ce97);});}else{return request({'event':_0x2a349c,'message':_0xc07bf9});}}};}exports['default']=function(){for(var _0x4db8de=0x0;_0x4db8de=_0x5b832f[_0x085e('0x15')]){throw Error(_0x085e('0x16'));}_0x10d143(_0x4bbb1b);})[_0x085e('0x17')](function(_0x152e1d){_0x58844f(_0x152e1d);});});}; \ No newline at end of file +var _0xda67=['agent','User','then','agents','catch','bluebird','../mysqldb','./license/util','voice','mail','fax','sms','openchannel','getChannels','isValidChannel','toLowerCase','clearBlockUser','blockedAt','updateAttributes','getLicense','role'];(function(_0x506002,_0x17ad62){var _0x5a020c=function(_0xf907bc){while(--_0xf907bc){_0x506002['push'](_0x506002['shift']());}};_0x5a020c(++_0x17ad62);}(_0xda67,0x1a9));var _0x7da6=function(_0x43b5fd,_0x3143f4){_0x43b5fd=_0x43b5fd-0x0;var _0x50f2c4=_0xda67[_0x43b5fd];return _0x50f2c4;};'use strict';var _=require('lodash');var BPromise=require(_0x7da6('0x0'));var db=require(_0x7da6('0x1'))['db'];var util=require(_0x7da6('0x2'));var channels=[_0x7da6('0x3'),_0x7da6('0x4'),'chat',_0x7da6('0x5'),_0x7da6('0x6'),'whatsapp',_0x7da6('0x7')];exports[_0x7da6('0x8')]=function(){return channels;};exports[_0x7da6('0x9')]=function(_0x3efdbe){_0x3efdbe=_0x3efdbe[_0x7da6('0xa')]();return _['includes'](channels,_0x3efdbe);};exports[_0x7da6('0xb')]=function(_0x4d3213,_0x204855,_0x4b9eaa,_0x2b13a0){var _0x3236f4={'loginAttempts':_0x204855,'blocked':_0x4b9eaa};if(!_['isUndefined'](_0x2b13a0)){_0x3236f4[_0x7da6('0xc')]=_0x2b13a0;}return _0x4d3213[_0x7da6('0xd')](_0x3236f4);};exports[_0x7da6('0xe')]=function(_0x4479ac){return new BPromise(function(_0x1f42f0,_0x3b2a31){var _0x42a583=0x0;if(_0x4479ac[_0x7da6('0xf')]!==_0x7da6('0x10')){_0x1f42f0(_0x4479ac);}db[_0x7da6('0x11')]['count']({'where':{'role':_0x7da6('0x10'),'online':!![],'id':{'$ne':_0x4479ac['id']}}})['then'](function(_0x356e75){_0x42a583=_0x356e75;return util[_0x7da6('0xe')]();})[_0x7da6('0x12')](function(_0x22543e){if(_0x22543e&&_0x22543e[_0x7da6('0x13')]&&_0x42a583>=_0x22543e['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x1f42f0(_0x4479ac);})[_0x7da6('0x14')](function(_0x480dd1){_0x3b2a31(_0x480dd1);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index bcc3182..24519f3 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x8c2f=['json','send','exports','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c2f,0x17a));var _0xf8c2=function(_0x5189d6,_0x557268){_0x5189d6=_0x5189d6-0x0;var _0xb04855=_0x8c2f[_0x5189d6];return _0xb04855;};'use strict';module[_0xf8c2('0x0')][0x194]=function pageNotFound(_0x144e25,_0x5ca8f0){var _0xc70d50='404';var _0x194fc7=0x194;var _0x3be60b={'status':_0x194fc7};_0x5ca8f0[_0xf8c2('0x1')](_0x3be60b[_0xf8c2('0x1')]);_0x5ca8f0['render'](_0xc70d50,{},function(_0x29412d,_0x436a34){if(_0x29412d){return _0x5ca8f0[_0xf8c2('0x1')](_0x3be60b['status'])[_0xf8c2('0x2')](_0x3be60b);}_0x5ca8f0[_0xf8c2('0x3')](_0x436a34);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 2c37f8c..91cbab7 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x9172=['../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/cmCompany/cmCompany.model','CmContact','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappQueue/whatsappQueue.model','hasOne','cascade','UserId','User','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','UserNotification','UserNotifications','belongsTo','belongsToMany','ChatGroup','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','SmsInteraction','user_has_sms_interactions','OpenchannelInteraction','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','MailQueues','ChatQueues','FaxQueues','SmsQueue','SmsQueues','OpenchannelQueues','WhatsappQueue','UserWhatsappQueue','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','SpiedAgents','ChanSpyId','VoiceContext','Sounds','moh_has_sounds','VoiceQueue','UserVoiceQueueRt','Members','VoiceQueueId','Hoppers','HopperHistories','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','CmList','voice_queues_has_cm_lists','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','VoiceCallReport','VoiceQueueReport','QueueCalls','VoiceAgentReport','AgentReports','Contact','ContactId','MailServerOut','Imap','Smtp','Dispositions','Answers','MailAccountId','Applications','ListId','TemplateId','mandatoryDispositionPause','Agents','user_has_mail_accounts','team_has_mail_queues','Account','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','restrict','TagId','List','Items','FaxAccountId','Interactions','Exntensions','FaxApplication','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','Interaction','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','user_has_chat_interactions','ChatInteractionId','team_has_chat_queues','ChatGroupId','CmCompany','Company','CompanyId','cm_contact_has_tags','CampaignId','OwnerId','All','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','SmsApplications','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','Trigger','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','Actions','TriggerId','DefaultReportId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','DescriptionId','FieldId','Subject','Description','Field','VariableId','SugarcrmAccount','SugarcrmConfiguration','Descriptions','DeskAccount','int_desk_configuration_has_tags','ZendeskField','int_freshdesk_configuration_has_tags','ServicenowConfiguration','Dynamics365Configuration','Dynamics365Field','Dynamics365Account','FromId','JscriptyQuestionReport','SessionId','ProjectId','user_has_square_projects','team_has_voice_queues','team_has_whatsapp_queues','WhatsappQueues','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','ToAgent','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','FromAgent','ToUserId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','userProfileId','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappApplication','WhatsappInteractionId','WhatsappQueueReport','WhatsappTransferReport','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','lodash','jstz','sequelize','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','database','username','options','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model'];(function(_0x1e1319,_0x4e40d1){var _0x591ef0=function(_0x265c16){while(--_0x265c16){_0x1e1319['push'](_0x1e1319['shift']());}};_0x591ef0(++_0x4e40d1);}(_0x9172,0x1a5));var _0x2917=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x9172[_0x4c12ec];return _0x3ae42c;};'use strict';var path=require('path');var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0x2917('0x0'));var jstz=require(_0x2917('0x1'));var timezone=jstz['determine']();config[_0x2917('0x2')]=_['defaultsDeep'](config[_0x2917('0x2')],{'database':_0x2917('0x3'),'username':_0x2917('0x4'),'password':_0x2917('0x5'),'options':{'host':_0x2917('0x6'),'port':0xcea,'dialect':_0x2917('0x7'),'dialectOptions':{'charset':_0x2917('0x8')},'logging':![],'timezone':timezone[_0x2917('0x9')](),'define':{'charset':_0x2917('0xa'),'collate':_0x2917('0xb')}}});config[_0x2917('0xc')]=_[_0x2917('0xd')](config['sequelizeHistory'],{'database':_0x2917('0x3'),'username':'xcall','password':_0x2917('0x5'),'options':{'host':_0x2917('0x6'),'port':0xcea,'dialect':_0x2917('0x7'),'dialectOptions':{'charset':_0x2917('0x8')},'logging':![],'timezone':timezone[_0x2917('0x9')](),'define':{'charset':_0x2917('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2917('0x2')][_0x2917('0xe')],config[_0x2917('0x2')][_0x2917('0xf')],config[_0x2917('0x2')]['password'],config[_0x2917('0x2')][_0x2917('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x2917('0xe')],config[_0x2917('0xc')][_0x2917('0xf')],config[_0x2917('0xc')]['password'],config[_0x2917('0xc')][_0x2917('0x10')])};db['User']=db['sequelize'][_0x2917('0x11')](_0x2917('0x12'));db[_0x2917('0x13')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x14'));db['VoiceContext']=db[_0x2917('0x2')][_0x2917('0x11')]('../api/voiceContext/voiceContext.model');db[_0x2917('0x15')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x16'));db[_0x2917('0x17')]=db['sequelize'][_0x2917('0x11')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db['sequelize']['import']('../api/voiceQueue/voiceQueue.model');db[_0x2917('0x18')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/voiceRecording/voiceRecording.model');db[_0x2917('0x19')]=db[_0x2917('0x2')]['import'](_0x2917('0x1a'));db[_0x2917('0x1b')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x1c'));db[_0x2917('0x1d')]=db[_0x2917('0x2')]['import'](_0x2917('0x1e'));db['VoiceCallReport']=db[_0x2917('0x2')]['import'](_0x2917('0x1f'));db[_0x2917('0x20')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x21'));db['VoiceAgentReport']=db[_0x2917('0x2')]['import'](_0x2917('0x22'));db['VoiceQueueReport']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x23'));db[_0x2917('0x24')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/memberReport/memberReport.model');db['Trunk']=db['sequelize'][_0x2917('0x11')](_0x2917('0x25'));db[_0x2917('0x26')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x27'));db['UserVoiceQueueRt']=db['sequelize'][_0x2917('0x11')](_0x2917('0x28'));db[_0x2917('0x29')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x2917('0x2a')]=db['sequelize'][_0x2917('0x11')](_0x2917('0x2b'));db['UserMailQueue']=db['sequelize'][_0x2917('0x11')](_0x2917('0x2c'));db[_0x2917('0x2d')]=db[_0x2917('0x2')]['import'](_0x2917('0x2e'));db[_0x2917('0x2f')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x30'));db[_0x2917('0x31')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x32'));db['UserWhatsappQueue']=db[_0x2917('0x2')]['import']('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x2917('0x33')]=db['sequelize']['import'](_0x2917('0x34'));db['MailServerOut']=db[_0x2917('0x2')]['import'](_0x2917('0x35'));db[_0x2917('0x36')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x37'));db[_0x2917('0x38')]=db['sequelize'][_0x2917('0x11')]('../api/mailQueue/mailQueue.model');db[_0x2917('0x39')]=db['sequelize'][_0x2917('0x11')](_0x2917('0x3a'));db[_0x2917('0x3b')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x3c'));db[_0x2917('0x3d')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x3e'));db[_0x2917('0x3f')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/mailApplication/mailApplication.model');db[_0x2917('0x40')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x41'));db[_0x2917('0x42')]=db['sequelize'][_0x2917('0x11')](_0x2917('0x43'));db[_0x2917('0x44')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x45'));db[_0x2917('0x46')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x47'));db['FaxApplication']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x48'));db['FaxInteraction']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x49'));db[_0x2917('0x4a')]=db['sequelize'][_0x2917('0x11')]('../api/faxMessage/faxMessage.model');db[_0x2917('0x4b')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/faxQueue/faxQueue.model');db[_0x2917('0x4c')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x4d'));db[_0x2917('0x4e')]=db['sequelize'][_0x2917('0x11')](_0x2917('0x4f'));db['SmsApplication']=db['sequelize']['import'](_0x2917('0x50'));db['SmsInteraction']=db[_0x2917('0x2')][_0x2917('0x11')]('../api/smsInteraction/smsInteraction.model');db[_0x2917('0x51')]=db['sequelize'][_0x2917('0x11')](_0x2917('0x52'));db['SmsQueue']=db[_0x2917('0x2')][_0x2917('0x11')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db['sequelize'][_0x2917('0x11')]('../api/openchannelAccount/openchannelAccount.model');db['OpenchannelApplication']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x53'));db['OpenchannelInteraction']=db[_0x2917('0x2')]['import'](_0x2917('0x54'));db[_0x2917('0x55')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/openchannelMessage/openchannelMessage.model');db[_0x2917('0x56')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x57'));db[_0x2917('0x58')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/chatWebsite/chatWebsite.model');db[_0x2917('0x59')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x5a'));db[_0x2917('0x5b')]=db[_0x2917('0x2')]['import'](_0x2917('0x5c'));db[_0x2917('0x5d')]=db['sequelize'][_0x2917('0x11')]('../api/chatInteraction/chatInteraction.model');db[_0x2917('0x5e')]=db['sequelize']['import'](_0x2917('0x5f'));db[_0x2917('0x60')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x61'));db[_0x2917('0x62')]=db['sequelize'][_0x2917('0x11')](_0x2917('0x63'));db['ChatGroup']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x64'));db[_0x2917('0x65')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/chatProactiveAction/chatProactiveAction.model');db['CmCompany']=db['sequelize'][_0x2917('0x11')](_0x2917('0x66'));db[_0x2917('0x67')]=db[_0x2917('0x2')]['import']('../api/cmContact/cmContact.model');db[_0x2917('0x68')]=db['sequelize'][_0x2917('0x11')]('../api/cmHopper/cmHopper.model');db[_0x2917('0x69')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x6a'));db[_0x2917('0x6b')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x6c'));db[_0x2917('0x6d')]=db[_0x2917('0x2')]['import'](_0x2917('0x6e'));db['ReportAgentPreview']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x6f'));db[_0x2917('0x70')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/cmCustomField/cmCustomField.model');db[_0x2917('0x71')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x72'));db[_0x2917('0x73')]=db['sequelize'][_0x2917('0x11')]('../api/automation/automation.model');db[_0x2917('0x74')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x75'));db[_0x2917('0x76')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x77'));db[_0x2917('0x78')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/condition/condition.model');db[_0x2917('0x79')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x7a'));db[_0x2917('0x7b')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x7c'));db[_0x2917('0x7d')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x7e'));db['VoiceQueuesLog']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x7f'));db[_0x2917('0x80')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x81'));db[_0x2917('0x82')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x83'));db['Tag']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x84'));db[_0x2917('0x85')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x86'));db['Trigger']=db[_0x2917('0x2')]['import'](_0x2917('0x87'));db[_0x2917('0x88')]=db[_0x2917('0x2')]['import']('../api/variable/variable.model');db['Integration']=db[_0x2917('0x2')][_0x2917('0x11')]('../api/integration/integration.model');db[_0x2917('0x89')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x8a'));db['AnalyticCustomReport']=db[_0x2917('0x2')][_0x2917('0x11')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x2917('0x8b')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x8c'));db[_0x2917('0x8d')]=db['sequelize'][_0x2917('0x11')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x2917('0x2')]['import'](_0x2917('0x8e'));db[_0x2917('0x8f')]=db['sequelize'][_0x2917('0x11')](_0x2917('0x90'));db[_0x2917('0x91')]=db[_0x2917('0x2')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x2917('0x92')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x93'));db[_0x2917('0x94')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x2917('0x95')]=db[_0x2917('0x2')]['import'](_0x2917('0x96'));db['SugarcrmAccount']=db[_0x2917('0x2')]['import'](_0x2917('0x97'));db['SugarcrmConfiguration']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x98'));db[_0x2917('0x99')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x9a'));db['DeskAccount']=db[_0x2917('0x2')]['import'](_0x2917('0x9b'));db[_0x2917('0x9c')]=db[_0x2917('0x2')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x2917('0x9d')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/intDeskField/intDeskField.model');db[_0x2917('0x9e')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x9f'));db[_0x2917('0xa0')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xa1'));db[_0x2917('0xa2')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xa3'));db[_0x2917('0xa4')]=db[_0x2917('0x2')]['import'](_0x2917('0xa5'));db[_0x2917('0xa6')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xa7'));db['ZendeskField']=db[_0x2917('0x2')][_0x2917('0x11')]('../api/intZendeskField/intZendeskField.model');db[_0x2917('0xa8')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xa9'));db[_0x2917('0xaa')]=db['sequelize']['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x2917('0xab')]=db[_0x2917('0x2')]['import'](_0x2917('0xac'));db[_0x2917('0xad')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xae'));db[_0x2917('0xaf')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x2917('0xb0')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xb1'));db[_0x2917('0xb2')]=db[_0x2917('0x2')]['import'](_0x2917('0xb3'));db['ServicenowConfiguration']=db[_0x2917('0x2')]['import'](_0x2917('0xb4'));db[_0x2917('0xb5')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xb6'));db['Dynamics365Account']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xb7'));db['Dynamics365Configuration']=db[_0x2917('0x2')]['import'](_0x2917('0xb8'));db['Dynamics365Field']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xb9'));db[_0x2917('0xba')]=db[_0x2917('0x2')]['import'](_0x2917('0xbb'));db[_0x2917('0xbc')]=db['sequelize']['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x2917('0xbd')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xbe'));db['Integration']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xbf'));db[_0x2917('0xc0')]=db[_0x2917('0x2')]['import'](_0x2917('0xc1'));db[_0x2917('0xc2')]=db['sequelize'][_0x2917('0x11')](_0x2917('0xc3'));db[_0x2917('0xc4')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xc5'));db[_0x2917('0xc6')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xc7'));db['JscriptyQuestionReport']=db[_0x2917('0x2')][_0x2917('0x11')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x2917('0xc8')]=db['sequelize'][_0x2917('0x11')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x2917('0xc9')]=db['sequelize'][_0x2917('0x11')](_0x2917('0xca'));db[_0x2917('0xcb')]=db['sequelize'][_0x2917('0x11')](_0x2917('0xcc'));db[_0x2917('0xcd')]=db[_0x2917('0x2')]['import'](_0x2917('0xce'));db[_0x2917('0xcf')]=db[_0x2917('0x2')]['import'](_0x2917('0xd0'));db['Setting']=db['sequelize'][_0x2917('0x11')](_0x2917('0xd1'));db[_0x2917('0xd2')]=db['sequelize'][_0x2917('0x11')](_0x2917('0xd3'));db[_0x2917('0xd4')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/squareProject/squareProject.model');db['SquareRecording']=db[_0x2917('0x2')]['import'](_0x2917('0xd5'));db[_0x2917('0xd6')]=db['sequelize']['import']('../api/squareMessage/squareMessage.model');db[_0x2917('0xd7')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xd8'));db[_0x2917('0xd9')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/license/license.model');db[_0x2917('0xda')]=db[_0x2917('0x2')]['import'](_0x2917('0xdb'));db[_0x2917('0xdc')]=db[_0x2917('0x2')]['import']('../api/migration/migration.model');db[_0x2917('0xdd')]=db['sequelize'][_0x2917('0x11')](_0x2917('0xde'));db['Plugin']=db[_0x2917('0x2')][_0x2917('0x11')]('../api/plugin/plugin.model');db[_0x2917('0xdf')]=db['sequelize']['import'](_0x2917('0xe0'));db[_0x2917('0xe1')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xe2'));db[_0x2917('0xe3')]=db[_0x2917('0x2')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x2917('0xe4')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xe5'));db[_0x2917('0xe6')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xe7'));db['CmList']=db[_0x2917('0x2')][_0x2917('0x11')]('../api/cmList/cmList.model');db[_0x2917('0xe8')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/voicePrefix/voicePrefix.model');db[_0x2917('0xe9')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/userProfile/userProfile.model');db[_0x2917('0xea')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/userProfileSection/userProfileSection.model');db[_0x2917('0xeb')]=db['sequelize'][_0x2917('0x11')](_0x2917('0xec'));db[_0x2917('0xed')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/notification/notification.model');db['UserNotification']=db['sequelize'][_0x2917('0x11')](_0x2917('0xee'));db[_0x2917('0xef')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xf0'));db['WhatsappApplication']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xf1'));db[_0x2917('0xf2')]=db['sequelize']['import']('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0x2917('0x2')]['import'](_0x2917('0xf3'));db['WhatsappQueueReport']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xf4'));db['WhatsappTransferReport']=db['sequelize']['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xf5'));db['CloudProvider']=db[_0x2917('0x2')][_0x2917('0x11')]('../api/cloudProvider/cloudProvider.model');db['User'][_0x2917('0xf6')](db['VoiceMail'],{'as':_0x2917('0x1b'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0xf9')][_0x2917('0xfa')](db[_0x2917('0x18')],{'as':_0x2917('0xfb'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0xf9')][_0x2917('0xfa')](db['UserVoiceQueueRt'],{'as':_0x2917('0xfc'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0xf9')][_0x2917('0xfa')](db[_0x2917('0x15')],{'as':_0x2917('0xfd'),'onDelete':_0x2917('0xf7'),'hooks':!![]});db['User']['hasMany'](db[_0x2917('0x6b')],{'as':_0x2917('0xfe'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0xf9')][_0x2917('0xfa')](db[_0x2917('0x6d')],{'as':_0x2917('0xff'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0xf9')][_0x2917('0xfa')](db['ReportAgentPreview'],{'as':_0x2917('0x100'),'foreignKey':'UserId'});db['User']['hasMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0x2917('0xf8')});db['User'][_0x2917('0xfa')](db[_0x2917('0x5d')],{'as':_0x2917('0x101'),'foreignKey':_0x2917('0xf8')});db['User'][_0x2917('0xfa')](db['SmsInteraction'],{'as':_0x2917('0x102'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0xf9')][_0x2917('0xfa')](db[_0x2917('0x103')],{'as':_0x2917('0x104'),'foreignKey':'UserId'});db[_0x2917('0xf9')][_0x2917('0xfa')](db[_0x2917('0x3b')],{'as':_0x2917('0x105'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0xf9')][_0x2917('0xfa')](db['WhatsappInteraction'],{'as':_0x2917('0x106'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0xf9')][_0x2917('0xfa')](db[_0x2917('0xed')],{'as':_0x2917('0x107'),'foreignKey':_0x2917('0x108')});db[_0x2917('0xf9')][_0x2917('0xfa')](db[_0x2917('0x109')],{'as':_0x2917('0x10a'),'foreignKey':_0x2917('0x108')});db['User'][_0x2917('0x10b')](db[_0x2917('0xe9')],{'as':_0x2917('0xe9'),'foreignKey':'userProfileId'});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0x10d')],{'as':_0x2917('0x10e'),'through':_0x2917('0x10f')});db['User'][_0x2917('0x10c')](db[_0x2917('0x67')],{'as':_0x2917('0x110'),'through':_0x2917('0x111')});db[_0x2917('0xf9')]['belongsToMany'](db['CmList'],{'as':_0x2917('0x112'),'through':_0x2917('0x113')});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0xd7')],{'through':_0x2917('0x114')});db['User']['belongsToMany'](db[_0x2917('0x3b')],{'as':_0x2917('0x105'),'through':_0x2917('0x115')});db[_0x2917('0xf9')]['belongsToMany'](db['ChatInteraction'],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db[_0x2917('0xf9')]['belongsToMany'](db[_0x2917('0x103')],{'as':_0x2917('0x104'),'through':_0x2917('0x116')});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0x117')],{'as':_0x2917('0x102'),'through':_0x2917('0x118')});db['User']['belongsToMany'](db[_0x2917('0x119')],{'as':_0x2917('0x11a'),'through':_0x2917('0x11b')});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0xf2')],{'as':_0x2917('0x106'),'through':_0x2917('0x11c')});db[_0x2917('0xf9')][_0x2917('0x10c')](db['VoiceQueue'],{'as':'VoiceQueues','through':_0x2917('0x29'),'required':![]});db[_0x2917('0xf9')][_0x2917('0x10c')](db['MailQueue'],{'as':_0x2917('0x11d'),'through':'UserMailQueue','required':![]});db[_0x2917('0xf9')][_0x2917('0x10c')](db['ChatQueue'],{'as':_0x2917('0x11e'),'through':_0x2917('0x2a'),'required':![],'hooks':!![]});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0x4b')],{'as':_0x2917('0x11f'),'through':'UserFaxQueue','required':![]});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0x120')],{'as':_0x2917('0x121'),'through':_0x2917('0x2f'),'required':![]});db[_0x2917('0xf9')][_0x2917('0x10c')](db['OpenchannelQueue'],{'as':_0x2917('0x122'),'through':_0x2917('0x31'),'required':![]});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0x123')],{'as':'WhatsappQueues','through':_0x2917('0x124'),'required':![]});db['User'][_0x2917('0x10c')](db['CmList'],{'through':_0x2917('0x113')});db['User'][_0x2917('0x10c')](db[_0x2917('0xe8')],{'as':_0x2917('0x125'),'through':_0x2917('0x126'),'required':![]});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0x58')],{'as':_0x2917('0x127'),'through':'user_has_chat_websites'});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0x46')],{'as':_0x2917('0x128'),'through':_0x2917('0x129')});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0x36')],{'as':_0x2917('0x12a'),'through':'user_has_mail_accounts'});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0x12b')],{'as':_0x2917('0x12c'),'through':_0x2917('0x12d')});db['User'][_0x2917('0x10c')](db['SmsAccount'],{'as':_0x2917('0x12e'),'through':'user_has_sms_accounts'});db['User'][_0x2917('0x10c')](db[_0x2917('0xef')],{'as':_0x2917('0x12f'),'through':_0x2917('0x130')});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0xd4')],{'as':_0x2917('0x131'),'through':'user_has_square_projects'});db['VoiceChanSpy']['hasMany'](db[_0x2917('0x15')],{'as':_0x2917('0x132'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x133')});db[_0x2917('0x134')][_0x2917('0xfa')](db['VoiceExtension'],{'onDelete':_0x2917('0xf7')});db[_0x2917('0x15')][_0x2917('0xfa')](db[_0x2917('0x15')],{'as':'Applications','onDelete':_0x2917('0xf7')});db[_0x2917('0x17')][_0x2917('0x10c')](db[_0x2917('0x82')],{'as':_0x2917('0x135'),'through':_0x2917('0x136')});db[_0x2917('0x137')]['hasMany'](db[_0x2917('0x138')],{'as':_0x2917('0x139'),'foreignKey':_0x2917('0x13a')});db[_0x2917('0x137')]['hasMany'](db[_0x2917('0x68')],{'as':_0x2917('0x13b'),'foreignKey':'VoiceQueueId'});db[_0x2917('0x137')][_0x2917('0xfa')](db[_0x2917('0x6b')],{'as':_0x2917('0xfe'),'foreignKey':_0x2917('0x13a')});db['VoiceQueue']['hasMany'](db[_0x2917('0x6d')],{'as':_0x2917('0x13c'),'foreignKey':'VoiceQueueId'});db[_0x2917('0x137')][_0x2917('0xfa')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db[_0x2917('0x137')][_0x2917('0xfa')](db[_0x2917('0x69')],{'as':'HopperBlacks','foreignKey':_0x2917('0x13a')});db['VoiceQueue']['hasMany'](db['JscriptySessionReport'],{'as':_0x2917('0x13d'),'foreignKey':_0x2917('0x13a')});db['VoiceQueue']['belongsTo'](db[_0x2917('0x13e')],{'as':'Trunk','foreignKey':_0x2917('0x13f')});db[_0x2917('0x137')][_0x2917('0x10b')](db[_0x2917('0x13e')],{'as':_0x2917('0x140'),'foreignKey':_0x2917('0x141')});db[_0x2917('0x137')]['belongsTo'](db[_0x2917('0x79')],{'as':_0x2917('0x79'),'foreignKey':_0x2917('0x142')});db['VoiceQueue'][_0x2917('0x10b')](db[_0x2917('0x7b')],{'as':'mandatoryDispositionPause','foreignKey':_0x2917('0x143')});db['VoiceQueue']['belongsToMany'](db[_0x2917('0x144')],{'as':_0x2917('0x112'),'through':_0x2917('0x145')});db[_0x2917('0x137')][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':'Agents','through':_0x2917('0x29')});db[_0x2917('0x137')][_0x2917('0x10c')](db[_0x2917('0xd7')],{'as':_0x2917('0x146'),'through':'team_has_voice_queues'});db[_0x2917('0x137')][_0x2917('0x10c')](db['CmList'],{'as':_0x2917('0x147'),'through':_0x2917('0x148')});db[_0x2917('0x18')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':_0x2917('0xf9'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0x19')][_0x2917('0x10b')](db['User'],{'as':'User','foreignKey':_0x2917('0xf8')});db['VoiceMail']['hasMany'](db[_0x2917('0x1d')],{'as':_0x2917('0x149'),'onDelete':_0x2917('0xf7'),'foreignKey':'mailboxuser','sourceKey':_0x2917('0x14a')});db[_0x2917('0x1d')][_0x2917('0x10b')](db[_0x2917('0x1b')],{'foreignKey':'mailboxuser','targetKey':_0x2917('0x14a')});db[_0x2917('0x14b')][_0x2917('0xfa')](db[_0x2917('0x14c')],{'as':_0x2917('0x14d'),'foreignKey':'uniqueid','constraints':![]});db[_0x2917('0x14b')][_0x2917('0xfa')](db[_0x2917('0x14e')],{'as':_0x2917('0x14f'),'foreignKey':'uniqueid','constraints':![]});db[_0x2917('0x14b')][_0x2917('0x10b')](db['User'],{'as':'User','foreignKey':_0x2917('0xf8')});db[_0x2917('0x14b')][_0x2917('0x10b')](db[_0x2917('0x67')],{'as':_0x2917('0x150'),'foreignKey':_0x2917('0x151')});db[_0x2917('0x33')][_0x2917('0x10b')](db[_0x2917('0x36')],{'as':_0x2917('0x36'),'foreignKey':'MailAccountId'});db[_0x2917('0x152')][_0x2917('0x10b')](db[_0x2917('0x36')],{'as':_0x2917('0x36'),'foreignKey':'MailAccountId'});db[_0x2917('0x36')][_0x2917('0xf6')](db[_0x2917('0x33')],{'as':_0x2917('0x153'),'onDelete':_0x2917('0xf7')});db[_0x2917('0x36')][_0x2917('0xf6')](db[_0x2917('0x152')],{'as':_0x2917('0x154'),'onDelete':'cascade'});db[_0x2917('0x36')][_0x2917('0xfa')](db[_0x2917('0x76')],{'as':_0x2917('0x155'),'foreignKey':'MailAccountId'});db[_0x2917('0x36')][_0x2917('0xfa')](db['CannedAnswer'],{'as':_0x2917('0x156'),'foreignKey':_0x2917('0x157')});db[_0x2917('0x36')][_0x2917('0xfa')](db[_0x2917('0x3d')],{'as':_0x2917('0x149'),'foreignKey':_0x2917('0x157')});db[_0x2917('0x36')][_0x2917('0xfa')](db[_0x2917('0x3b')],{'as':'Interactions'});db[_0x2917('0x36')]['hasMany'](db[_0x2917('0x3f')],{'as':_0x2917('0x158')});db[_0x2917('0x36')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x2917('0x159')});db[_0x2917('0x36')][_0x2917('0x10b')](db[_0x2917('0x85')],{'as':_0x2917('0x85'),'foreignKey':_0x2917('0x15a')});db[_0x2917('0x36')]['belongsTo'](db['Pause'],{'as':_0x2917('0x15b'),'foreignKey':_0x2917('0x143')});db[_0x2917('0x36')]['belongsToMany'](db[_0x2917('0xf9')],{'as':_0x2917('0x15c'),'through':_0x2917('0x15d')});db['MailQueue'][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':'Agents','through':'UserMailQueue'});db['MailQueue'][_0x2917('0x10c')](db['Team'],{'through':_0x2917('0x15e'),'as':_0x2917('0x146')});db[_0x2917('0x3b')][_0x2917('0xfa')](db['MailMessage'],{'as':_0x2917('0x149'),'onDelete':_0x2917('0xf7'),'foreignKey':'MailInteractionId'});db['MailInteraction'][_0x2917('0x10b')](db[_0x2917('0x36')],{'as':_0x2917('0x15f'),'foreignKey':'MailAccountId'});db[_0x2917('0x3b')][_0x2917('0x10b')](db[_0x2917('0x67')],{'as':_0x2917('0x150'),'foreignKey':'ContactId'});db['MailInteraction'][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':_0x2917('0x160'),'foreignKey':'UserId'});db['MailInteraction'][_0x2917('0x10c')](db[_0x2917('0x161')],{'through':_0x2917('0x162'),'as':_0x2917('0x163')});db['MailInteraction'][_0x2917('0x10c')](db[_0x2917('0x161')],{'through':'mail_interaction_has_tags','as':_0x2917('0x164')});db[_0x2917('0x3b')][_0x2917('0x10c')](db['User'],{'as':_0x2917('0x165'),'through':'user_has_mail_interactions','foreignKey':_0x2917('0x166')});db['MailMessage'][_0x2917('0xfa')](db['Attachment'],{'as':_0x2917('0x167'),'onDelete':_0x2917('0xf7')});db[_0x2917('0x3d')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':_0x2917('0xf9')});db[_0x2917('0x3d')]['belongsTo'](db['CmContact'],{'onDelete':_0x2917('0xf7'),'as':_0x2917('0x150')});db[_0x2917('0x3d')]['belongsTo'](db[_0x2917('0x3b')],{'as':'Interaction','foreignKey':_0x2917('0x166')});db['MailMessage'][_0x2917('0x10b')](db[_0x2917('0x36')],{'as':'Account','foreignKey':'MailAccountId'});db[_0x2917('0x3f')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'onDelete':_0x2917('0x168')});db['MailApplication'][_0x2917('0x10b')](db[_0x2917('0x38')],{'onDelete':_0x2917('0x168')});db[_0x2917('0x3f')]['belongsTo'](db[_0x2917('0x36')],{'onDelete':_0x2917('0x168')});db[_0x2917('0x3f')]['belongsTo'](db['Interval'],{'onDelete':_0x2917('0x168'),'foreignKey':'IntervalId'});db[_0x2917('0x3f')][_0x2917('0x10b')](db[_0x2917('0x161')],{'onDelete':_0x2917('0x168'),'foreignKey':_0x2917('0x169')});db[_0x2917('0x40')][_0x2917('0x10b')](db['MailAccount'],{});db[_0x2917('0x40')][_0x2917('0x10b')](db[_0x2917('0x144')],{'as':_0x2917('0x16a'),'foreignKey':_0x2917('0x159')});db[_0x2917('0x40')][_0x2917('0x10b')](db[_0x2917('0x67')],{'as':_0x2917('0x150'),'foreignKey':'ContactId'});db[_0x2917('0x40')][_0x2917('0x10b')](db[_0x2917('0x3b')],{});db[_0x2917('0x40')][_0x2917('0x10b')](db[_0x2917('0x3d')],{});db[_0x2917('0x40')][_0x2917('0x10b')](db[_0x2917('0xf9')],{});db['MailQueueReport'][_0x2917('0x10b')](db['MailQueue'],{});db[_0x2917('0x42')][_0x2917('0xfa')](db[_0x2917('0x44')],{'as':_0x2917('0x16b'),'onDelete':_0x2917('0xf7')});db['FaxAccount'][_0x2917('0xfa')](db['Disposition'],{'as':_0x2917('0x155'),'foreignKey':_0x2917('0x16c')});db[_0x2917('0x46')][_0x2917('0xfa')](db[_0x2917('0x74')],{'as':_0x2917('0x156'),'foreignKey':_0x2917('0x16c')});db[_0x2917('0x46')][_0x2917('0xfa')](db['FaxInteraction'],{'as':_0x2917('0x16d')});db[_0x2917('0x46')][_0x2917('0xfa')](db['FaxApplication'],{'as':'Applications'});db['FaxAccount'][_0x2917('0xfa')](db[_0x2917('0x15')],{'as':_0x2917('0x16e'),'onDelete':_0x2917('0xf7')});db['FaxAccount'][_0x2917('0xfa')](db[_0x2917('0x4a')],{'as':'Messages'});db[_0x2917('0x46')][_0x2917('0x10b')](db['Trunk'],{'as':_0x2917('0x13e')});db['FaxAccount']['belongsTo'](db[_0x2917('0x144')],{'as':_0x2917('0x16a'),'foreignKey':_0x2917('0x159')});db[_0x2917('0x46')][_0x2917('0x10b')](db[_0x2917('0x7b')],{'as':_0x2917('0x15b'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2917('0x46')][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':_0x2917('0x15c'),'through':_0x2917('0x129')});db[_0x2917('0x16f')]['belongsTo'](db[_0x2917('0xf9')],{'onDelete':_0x2917('0x168')});db[_0x2917('0x16f')][_0x2917('0x10b')](db[_0x2917('0x4b')],{'onDelete':_0x2917('0x168')});db[_0x2917('0x16f')]['belongsTo'](db[_0x2917('0x46')],{'onDelete':_0x2917('0x168')});db[_0x2917('0x16f')][_0x2917('0x10b')](db[_0x2917('0x161')],{'onDelete':_0x2917('0x168'),'foreignKey':_0x2917('0x169')});db[_0x2917('0x103')][_0x2917('0xfa')](db[_0x2917('0x4a')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x2917('0x170')});db[_0x2917('0x103')]['belongsTo'](db[_0x2917('0x46')],{'as':_0x2917('0x15f'),'foreignKey':'FaxAccountId'});db['FaxInteraction'][_0x2917('0x10b')](db['CmContact'],{'as':_0x2917('0x150'),'foreignKey':_0x2917('0x151')});db[_0x2917('0x103')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':_0x2917('0x160'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0x103')][_0x2917('0x10c')](db[_0x2917('0x161')],{'through':_0x2917('0x171'),'as':_0x2917('0x163')});db[_0x2917('0x103')]['belongsToMany'](db[_0x2917('0x161')],{'through':_0x2917('0x171'),'as':_0x2917('0x164')});db['FaxInteraction'][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':_0x2917('0x165'),'through':'user_has_fax_interactions','foreignKey':_0x2917('0x170')});db[_0x2917('0x4a')]['belongsTo'](db[_0x2917('0xf9')],{'onDelete':_0x2917('0xf7'),'as':_0x2917('0xf9')});db[_0x2917('0x4a')][_0x2917('0x10b')](db[_0x2917('0x103')],{'as':'Interaction','foreignKey':_0x2917('0x170')});db['FaxMessage'][_0x2917('0x10b')](db[_0x2917('0x67')],{'onDelete':'cascade','as':'Contact'});db[_0x2917('0x4a')][_0x2917('0x10b')](db['Attachment'],{'as':_0x2917('0xdd'),'foreignKey':_0x2917('0x172')});db[_0x2917('0x4a')][_0x2917('0x10b')](db[_0x2917('0x46')],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x16c')});db['FaxQueue'][_0x2917('0x10c')](db['User'],{'as':_0x2917('0x15c'),'through':'UserFaxQueue'});db[_0x2917('0x4b')][_0x2917('0x10c')](db[_0x2917('0xd7')],{'through':_0x2917('0x173'),'as':'Teams'});db[_0x2917('0x4c')][_0x2917('0x10b')](db['FaxAccount'],{});db[_0x2917('0x4c')][_0x2917('0x10b')](db[_0x2917('0x144')],{'as':_0x2917('0x16a'),'foreignKey':_0x2917('0x159')});db[_0x2917('0x4c')]['belongsTo'](db[_0x2917('0x67')],{'as':_0x2917('0x150'),'foreignKey':'ContactId'});db[_0x2917('0x4c')][_0x2917('0x10b')](db['FaxInteraction'],{});db['FaxQueueReport'][_0x2917('0x10b')](db[_0x2917('0x4a')],{});db[_0x2917('0x4c')][_0x2917('0x10b')](db[_0x2917('0xf9')],{});db[_0x2917('0x4c')][_0x2917('0x10b')](db[_0x2917('0x4b')],{});db[_0x2917('0x4e')][_0x2917('0xfa')](db[_0x2917('0x76')],{'as':_0x2917('0x155'),'foreignKey':'SmsAccountId'});db[_0x2917('0x4e')]['hasMany'](db[_0x2917('0x74')],{'as':_0x2917('0x156'),'foreignKey':_0x2917('0x174')});db['SmsAccount'][_0x2917('0xfa')](db[_0x2917('0x51')],{'as':_0x2917('0x149'),'foreignKey':_0x2917('0x174')});db[_0x2917('0x4e')][_0x2917('0xfa')](db[_0x2917('0x117')],{'as':_0x2917('0x16d')});db[_0x2917('0x4e')][_0x2917('0xfa')](db[_0x2917('0x175')],{'as':_0x2917('0x158')});db[_0x2917('0x4e')][_0x2917('0x10b')](db[_0x2917('0x144')],{'as':_0x2917('0x16a'),'foreignKey':'ListId'});db[_0x2917('0x4e')][_0x2917('0x10b')](db[_0x2917('0x7b')],{'as':_0x2917('0x15b'),'foreignKey':_0x2917('0x143')});db[_0x2917('0x4e')][_0x2917('0x10c')](db['User'],{'as':_0x2917('0x15c'),'through':_0x2917('0x176')});db[_0x2917('0x175')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'onDelete':'restrict'});db[_0x2917('0x175')][_0x2917('0x10b')](db[_0x2917('0x120')],{'onDelete':'restrict'});db[_0x2917('0x175')][_0x2917('0x10b')](db[_0x2917('0x4e')],{'onDelete':'restrict'});db['SmsApplication'][_0x2917('0x10b')](db['Interval'],{'onDelete':_0x2917('0x168'),'foreignKey':_0x2917('0x142')});db[_0x2917('0x175')][_0x2917('0x10b')](db['Tag'],{'onDelete':_0x2917('0x168'),'foreignKey':'TagId'});db[_0x2917('0x117')][_0x2917('0xfa')](db[_0x2917('0x51')],{'as':_0x2917('0x149'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x177')});db[_0x2917('0x117')]['belongsTo'](db[_0x2917('0x4e')],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x174')});db[_0x2917('0x117')][_0x2917('0x10b')](db['CmContact'],{'as':'Contact','foreignKey':_0x2917('0x151')});db['SmsInteraction'][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':_0x2917('0x160'),'foreignKey':_0x2917('0xf8')});db['SmsInteraction'][_0x2917('0x10c')](db[_0x2917('0x161')],{'through':_0x2917('0x178'),'as':'Tags'});db[_0x2917('0x117')][_0x2917('0x10c')](db[_0x2917('0x161')],{'through':_0x2917('0x178'),'as':_0x2917('0x164')});db['SmsInteraction'][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':_0x2917('0x165'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db['SmsMessage']['belongsTo'](db[_0x2917('0xf9')],{'as':_0x2917('0xf9')});db['SmsMessage'][_0x2917('0x10b')](db['CmContact'],{'onDelete':'cascade','as':_0x2917('0x150')});db[_0x2917('0x51')][_0x2917('0x10b')](db[_0x2917('0x117')],{'onDelete':'cascade','as':_0x2917('0x179'),'foreignKey':_0x2917('0x177')});db[_0x2917('0x51')][_0x2917('0x10b')](db[_0x2917('0x4e')],{'as':_0x2917('0x15f'),'foreignKey':'SmsAccountId'});db[_0x2917('0x120')][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':'Agents','through':_0x2917('0x2f'),'foreignKey':_0x2917('0x17a')});db[_0x2917('0x120')][_0x2917('0x10c')](db[_0x2917('0xd7')],{'through':_0x2917('0x17b'),'as':_0x2917('0x146')});db['OpenchannelAccount'][_0x2917('0xfa')](db['Disposition'],{'as':_0x2917('0x155'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x2917('0xfa')](db['CannedAnswer'],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0x2917('0x12b')][_0x2917('0xfa')](db[_0x2917('0x119')],{'as':'Interactions','foreignKey':_0x2917('0x17c')});db['OpenchannelAccount'][_0x2917('0xfa')](db['OpenchannelMessage'],{'as':_0x2917('0x149'),'foreignKey':'OpenchannelAccountId'});db[_0x2917('0x12b')][_0x2917('0xfa')](db['OpenchannelApplication'],{'as':_0x2917('0x158'),'foreignKey':'OpenchannelAccountId'});db[_0x2917('0x12b')][_0x2917('0x10b')](db['CmList'],{'as':_0x2917('0x16a'),'foreignKey':_0x2917('0x159')});db[_0x2917('0x12b')][_0x2917('0x10b')](db[_0x2917('0x7b')],{'as':_0x2917('0x15b'),'foreignKey':_0x2917('0x143')});db['OpenchannelAccount'][_0x2917('0x10c')](db['User'],{'as':_0x2917('0x15c'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x2917('0x10b')](db[_0x2917('0xf9')],{'onDelete':_0x2917('0x168')});db[_0x2917('0x17d')][_0x2917('0x10b')](db[_0x2917('0x56')],{'onDelete':_0x2917('0x168'),'foreignKey':_0x2917('0x17e')});db[_0x2917('0x17d')][_0x2917('0x10b')](db[_0x2917('0x12b')],{'onDelete':_0x2917('0x168'),'foreignKey':_0x2917('0x17c')});db[_0x2917('0x17d')][_0x2917('0x10b')](db[_0x2917('0x79')],{'onDelete':_0x2917('0x168'),'foreignKey':_0x2917('0x142')});db[_0x2917('0x17d')]['belongsTo'](db['Tag'],{'onDelete':_0x2917('0x168'),'foreignKey':_0x2917('0x169')});db[_0x2917('0x119')][_0x2917('0xfa')](db[_0x2917('0x55')],{'as':_0x2917('0x149'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x17f')});db[_0x2917('0x119')][_0x2917('0x10b')](db[_0x2917('0x12b')],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x17c')});db[_0x2917('0x119')]['belongsTo'](db[_0x2917('0x67')],{'as':_0x2917('0x150'),'foreignKey':'ContactId'});db[_0x2917('0x119')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':'Owner','foreignKey':'UserId'});db[_0x2917('0x119')][_0x2917('0x10c')](db[_0x2917('0x161')],{'through':_0x2917('0x180'),'as':_0x2917('0x163')});db['OpenchannelInteraction'][_0x2917('0x10c')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x2917('0x164')});db[_0x2917('0x119')][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':'Users','through':_0x2917('0x11b'),'foreignKey':_0x2917('0x17f')});db['OpenchannelMessage']['belongsTo'](db[_0x2917('0xf9')],{'onDelete':_0x2917('0xf7'),'as':_0x2917('0xf9')});db[_0x2917('0x55')][_0x2917('0x10b')](db[_0x2917('0x67')],{'onDelete':_0x2917('0xf7'),'as':_0x2917('0x150')});db[_0x2917('0x55')]['belongsTo'](db[_0x2917('0x119')],{'onDelete':_0x2917('0xf7'),'as':_0x2917('0x179'),'foreignKey':_0x2917('0x17f')});db[_0x2917('0x55')][_0x2917('0x10b')](db[_0x2917('0xdd')],{'as':_0x2917('0xdd'),'foreignKey':'AttachmentId'});db[_0x2917('0x55')]['belongsTo'](db[_0x2917('0x12b')],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x17c')});db[_0x2917('0x56')][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':_0x2917('0x15c'),'through':_0x2917('0x31'),'foreignKey':_0x2917('0x17e')});db[_0x2917('0x56')][_0x2917('0x10c')](db[_0x2917('0xd7')],{'through':_0x2917('0x181'),'as':_0x2917('0x146')});db[_0x2917('0x58')][_0x2917('0xfa')](db['Disposition'],{'as':_0x2917('0x155'),'foreignKey':'ChatWebsiteId'});db[_0x2917('0x58')][_0x2917('0xfa')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x2917('0x182')});db[_0x2917('0x58')]['hasMany'](db[_0x2917('0x65')],{'as':_0x2917('0x183')});db[_0x2917('0x58')][_0x2917('0xfa')](db[_0x2917('0x5d')],{'as':_0x2917('0x16d')});db[_0x2917('0x58')][_0x2917('0xfa')](db[_0x2917('0x5b')],{'as':_0x2917('0x158')});db['ChatWebsite'][_0x2917('0xfa')](db[_0x2917('0x5e')],{'as':'Messages'});db[_0x2917('0x58')][_0x2917('0x10b')](db['CmList'],{'as':_0x2917('0x16a'),'foreignKey':_0x2917('0x159')});db['ChatWebsite'][_0x2917('0x10b')](db['Interval'],{'as':_0x2917('0x79'),'foreignKey':_0x2917('0x142')});db[_0x2917('0x58')][_0x2917('0x10b')](db['Pause'],{'as':_0x2917('0x15b'),'foreignKey':_0x2917('0x143')});db[_0x2917('0x58')][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':'Agents','through':'user_has_chat_websites'});db[_0x2917('0x59')][_0x2917('0x10b')](db[_0x2917('0x12b')],{});db[_0x2917('0x59')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x2917('0x159')});db[_0x2917('0x59')][_0x2917('0x10b')](db[_0x2917('0x67')],{'as':_0x2917('0x150'),'foreignKey':_0x2917('0x151')});db[_0x2917('0x59')][_0x2917('0x10b')](db['OpenchannelInteraction'],{});db[_0x2917('0x59')][_0x2917('0x10b')](db[_0x2917('0x55')],{});db[_0x2917('0x59')]['belongsTo'](db[_0x2917('0xf9')],{});db[_0x2917('0x59')]['belongsTo'](db[_0x2917('0x56')],{});db[_0x2917('0x5b')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':_0x2917('0x184'),'foreignKey':_0x2917('0xf8'),'onDelete':'restrict'});db['ChatApplication'][_0x2917('0x10b')](db['ChatQueue'],{'as':_0x2917('0x185'),'foreignKey':_0x2917('0x186'),'onDelete':_0x2917('0x168')});db[_0x2917('0x5b')][_0x2917('0x10b')](db['ChatWebsite'],{'as':_0x2917('0x187'),'foreignKey':'ChatWebsiteId','onDelete':_0x2917('0x168')});db[_0x2917('0x5b')][_0x2917('0x10b')](db[_0x2917('0x161')],{'onDelete':_0x2917('0x168'),'foreignKey':'TagId'});db['ChatInteraction']['hasMany'](db[_0x2917('0x5e')],{'as':'Messages','onDelete':_0x2917('0xf7'),'foreignKey':'ChatInteractionId'});db[_0x2917('0x5d')][_0x2917('0x10b')](db['ChatWebsite'],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x182')});db[_0x2917('0x5d')][_0x2917('0x10b')](db[_0x2917('0x67')],{'as':_0x2917('0x150'),'foreignKey':'ContactId'});db[_0x2917('0x5d')][_0x2917('0x10b')](db['User'],{'as':_0x2917('0x160'),'foreignKey':_0x2917('0xf8')});db['ChatInteraction'][_0x2917('0x10c')](db[_0x2917('0x161')],{'through':_0x2917('0x188'),'as':'Tags'});db[_0x2917('0x5d')]['belongsToMany'](db[_0x2917('0x161')],{'through':_0x2917('0x188'),'as':_0x2917('0x164')});db['ChatInteraction'][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':_0x2917('0x165'),'through':_0x2917('0x189'),'foreignKey':'ChatInteractionId'});db[_0x2917('0x5e')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'onDelete':_0x2917('0xf7'),'as':_0x2917('0xf9')});db[_0x2917('0x5e')][_0x2917('0x10b')](db[_0x2917('0x67')],{'onDelete':_0x2917('0xf7'),'as':'Contact','foreignKey':_0x2917('0x151')});db[_0x2917('0x5e')][_0x2917('0x10b')](db['ChatInteraction'],{'onDelete':_0x2917('0xf7'),'as':_0x2917('0x179'),'foreignKey':_0x2917('0x18a')});db[_0x2917('0x5e')][_0x2917('0x10b')](db[_0x2917('0xdd')],{'as':_0x2917('0xdd'),'foreignKey':_0x2917('0x172')});db[_0x2917('0x5e')][_0x2917('0x10b')](db[_0x2917('0x58')],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x182')});db['ChatOfflineMessage'][_0x2917('0x10b')](db[_0x2917('0x67')],{'onDelete':_0x2917('0xf7'),'as':'Contact','foreignKey':_0x2917('0x151')});db[_0x2917('0x60')][_0x2917('0x10b')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x2917('0x182')});db['ChatQueue']['belongsToMany'](db['User'],{'as':_0x2917('0x15c'),'through':_0x2917('0x2a'),'hooks':!![]});db[_0x2917('0x62')]['belongsToMany'](db[_0x2917('0xd7')],{'through':_0x2917('0x18b'),'as':_0x2917('0x146')});db[_0x2917('0x10d')][_0x2917('0xfa')](db[_0x2917('0xc4')],{'as':'Messages','foreignKey':_0x2917('0x18c'),'onDelete':_0x2917('0xf7')});db[_0x2917('0x10d')]['belongsToMany'](db[_0x2917('0xf9')],{'as':_0x2917('0x139'),'through':_0x2917('0x10f')});db[_0x2917('0x65')]['belongsTo'](db[_0x2917('0x58')],{'as':_0x2917('0x187'),'foreignKey':_0x2917('0x182')});db[_0x2917('0x18d')][_0x2917('0xfa')](db[_0x2917('0x67')],{'as':_0x2917('0x110'),'foreignKey':'CompanyId'});db[_0x2917('0x67')][_0x2917('0xfa')](db[_0x2917('0x68')],{'as':_0x2917('0x13b'),'foreignKey':'ContactId'});db[_0x2917('0x67')]['hasMany'](db[_0x2917('0x6b')],{'as':_0x2917('0xfe'),'foreignKey':'ContactId'});db[_0x2917('0x67')]['hasMany'](db[_0x2917('0x6d')],{'as':_0x2917('0x13c'),'foreignKey':_0x2917('0x151')});db[_0x2917('0x67')]['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db['CmContact'][_0x2917('0xfa')](db[_0x2917('0xc8')],{'as':_0x2917('0x13d'),'foreignKey':_0x2917('0x151')});db[_0x2917('0x67')][_0x2917('0xfa')](db[_0x2917('0x119')],{'as':'OpenchannelInteractions','foreignKey':_0x2917('0x151'),'onDelete':'restrict'});db[_0x2917('0x67')][_0x2917('0xfa')](db[_0x2917('0x5d')],{'as':_0x2917('0x101'),'foreignKey':_0x2917('0x151'),'onDelete':'restrict'});db[_0x2917('0x67')][_0x2917('0xfa')](db[_0x2917('0x117')],{'as':_0x2917('0x102'),'foreignKey':_0x2917('0x151'),'onDelete':_0x2917('0x168')});db[_0x2917('0x67')][_0x2917('0xfa')](db[_0x2917('0x103')],{'as':_0x2917('0x104'),'foreignKey':_0x2917('0x151'),'onDelete':_0x2917('0x168')});db['CmContact']['hasMany'](db[_0x2917('0x3b')],{'as':'MailInteractions','foreignKey':_0x2917('0x151'),'onDelete':_0x2917('0x168')});db['CmContact'][_0x2917('0x10b')](db['CmCompany'],{'as':_0x2917('0x18e'),'foreignKey':_0x2917('0x18f')});db[_0x2917('0x67')]['belongsTo'](db[_0x2917('0x144')],{'as':'List','foreignKey':'ListId','onDelete':_0x2917('0xf7')});db[_0x2917('0x67')][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':'Users','through':_0x2917('0x111')});db[_0x2917('0x67')][_0x2917('0x10c')](db['Tag'],{'as':_0x2917('0x163'),'through':_0x2917('0x190')});db[_0x2917('0x67')][_0x2917('0x10c')](db[_0x2917('0x161')],{'through':_0x2917('0x190'),'as':'ThroughTags'});db[_0x2917('0x68')][_0x2917('0x10b')](db[_0x2917('0x67')],{'as':_0x2917('0x150'),'foreignKey':_0x2917('0x151'),'onDelete':_0x2917('0xf7')});db[_0x2917('0x68')][_0x2917('0x10b')](db['CmList'],{'as':'List','foreignKey':_0x2917('0x159'),'onDelete':'cascade'});db[_0x2917('0x68')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':'Agent','foreignKey':'UserId'});db[_0x2917('0x68')]['belongsTo'](db[_0x2917('0x137')],{'as':_0x2917('0x185'),'foreignKey':_0x2917('0x13a'),'onDelete':_0x2917('0xf7')});db[_0x2917('0x68')]['belongsTo'](db['Campaign'],{'as':_0x2917('0xda'),'foreignKey':_0x2917('0x191'),'onDelete':_0x2917('0xf7')});db[_0x2917('0x68')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':'Owner','foreignKey':_0x2917('0x192')});db[_0x2917('0x69')][_0x2917('0x10b')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId','onDelete':'cascade'});db[_0x2917('0x69')][_0x2917('0x10b')](db[_0x2917('0x144')],{'as':_0x2917('0x16a'),'foreignKey':_0x2917('0x159'),'onDelete':'cascade'});db['CmHopperBlack'][_0x2917('0x10b')](db[_0x2917('0x137')],{'as':_0x2917('0x185'),'foreignKey':_0x2917('0x13a'),'onDelete':_0x2917('0xf7')});db[_0x2917('0x69')]['belongsTo'](db[_0x2917('0xda')],{'as':'Campaign','foreignKey':_0x2917('0x191'),'onDelete':_0x2917('0xf7')});db[_0x2917('0x73')]['hasMany'](db[_0x2917('0x78')],{'as':{'plural':_0x2917('0x193'),'singular':'OneAll'},'foreignKey':_0x2917('0x194'),'onDelete':'cascade','hooks':!![]});db[_0x2917('0x73')][_0x2917('0xfa')](db[_0x2917('0x78')],{'as':{'plural':_0x2917('0x195'),'singular':_0x2917('0x196')},'foreignKey':_0x2917('0x197'),'onDelete':_0x2917('0xf7'),'hooks':!![]});db[_0x2917('0x73')][_0x2917('0xfa')](db[_0x2917('0x71')],{'as':'Actions','foreignKey':_0x2917('0x198'),'onDelete':_0x2917('0xf7'),'hooks':!![]});db[_0x2917('0x76')]['hasMany'](db[_0x2917('0x76')],{'as':_0x2917('0x155'),'foreignKey':_0x2917('0x199'),'onDelete':_0x2917('0xf7')});db['Interval'][_0x2917('0xfa')](db[_0x2917('0x79')],{'as':_0x2917('0x19a'),'foreignKey':_0x2917('0x142'),'onDelete':_0x2917('0xf7'),'hooks':!![],'required':![]});db[_0x2917('0x79')][_0x2917('0xfa')](db[_0x2917('0x15')],{'as':_0x2917('0xfd'),'foreignKey':_0x2917('0x142'),'onDelete':'restrict'});db['Interval'][_0x2917('0xfa')](db[_0x2917('0x3f')],{'as':_0x2917('0x19b'),'foreignKey':_0x2917('0x142')});db[_0x2917('0x79')][_0x2917('0xfa')](db['ChatApplication'],{'as':_0x2917('0x19c'),'foreignKey':_0x2917('0x142')});db[_0x2917('0x79')]['hasMany'](db[_0x2917('0x16f')],{'as':'FaxApplications','foreignKey':_0x2917('0x142')});db[_0x2917('0x79')]['hasMany'](db[_0x2917('0x175')],{'as':_0x2917('0x19d'),'foreignKey':_0x2917('0x142')});db[_0x2917('0x80')]['belongsTo'](db[_0x2917('0x36')],{});db['Schedule'][_0x2917('0x10b')](db[_0x2917('0x8b')],{'foreignKey':'DefaultReportId'});db[_0x2917('0x80')][_0x2917('0x10b')](db[_0x2917('0x19e')],{'foreignKey':_0x2917('0x19f')});db[_0x2917('0x82')][_0x2917('0x10c')](db[_0x2917('0x17')],{'as':_0x2917('0x1a0'),'through':'moh_has_sounds','onDelete':'restrict'});db[_0x2917('0x161')][_0x2917('0x10c')](db[_0x2917('0x67')],{'through':_0x2917('0x190')});db[_0x2917('0x161')][_0x2917('0x10c')](db['ChatInteraction'],{'through':_0x2917('0x188')});db[_0x2917('0x161')]['belongsToMany'](db[_0x2917('0x3b')],{'through':'mail_interaction_has_tags'});db[_0x2917('0x161')][_0x2917('0x10c')](db[_0x2917('0x117')],{'through':_0x2917('0x178')});db[_0x2917('0x161')][_0x2917('0x10c')](db[_0x2917('0x103')],{'through':'fax_interaction_has_tags'});db[_0x2917('0x161')]['belongsToMany'](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0x2917('0x161')][_0x2917('0x10c')](db['WhatsappInteraction'],{'through':_0x2917('0x1a1')});db[_0x2917('0x1a2')]['hasMany'](db['Condition'],{'as':{'plural':'AllConditions','singular':_0x2917('0x1a3')},'foreignKey':_0x2917('0x1a4'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x2917('0xfa')](db['Condition'],{'as':{'plural':'AnyConditions','singular':_0x2917('0x1a5')},'foreignKey':_0x2917('0x1a6'),'onDelete':_0x2917('0xf7'),'hooks':!![]});db['Trigger'][_0x2917('0xfa')](db['Action'],{'as':_0x2917('0x1a7'),'foreignKey':_0x2917('0x1a8'),'onDelete':_0x2917('0xf7'),'hooks':!![]});db[_0x2917('0x19e')]['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x19f'),'hooks':!![]});db[_0x2917('0x8b')][_0x2917('0xfa')](db[_0x2917('0x8f')],{'as':'Fields','onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1a9')});db['AnalyticMetric'][_0x2917('0xfa')](db[_0x2917('0x8f')],{'as':_0x2917('0x1aa'),'onDelete':_0x2917('0xf7'),'foreignKey':'MetricId'});db[_0x2917('0x8f')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0x2917('0x1ab')});db[_0x2917('0x92')][_0x2917('0xfa')](db[_0x2917('0x94')],{'as':_0x2917('0x1ac'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1ad')});db['SalesforceConfiguration'][_0x2917('0xfa')](db[_0x2917('0x95')],{'as':_0x2917('0x1ae'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1af')});db[_0x2917('0x94')]['hasMany'](db[_0x2917('0x95')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x2917('0x1b0')});db[_0x2917('0x94')]['hasMany'](db['SalesforceField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x2917('0x1b1')});db['SalesforceConfiguration'][_0x2917('0x10b')](db['SalesforceAccount'],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x1ad')});db[_0x2917('0x95')][_0x2917('0xfa')](db['SalesforceField'],{'as':_0x2917('0x1b2'),'foreignKey':'SubjectId'});db[_0x2917('0x95')][_0x2917('0xfa')](db[_0x2917('0x95')],{'as':_0x2917('0x1b3'),'foreignKey':'DescriptionId'});db['SalesforceField'][_0x2917('0xfa')](db['SalesforceField'],{'as':_0x2917('0x1b4'),'foreignKey':_0x2917('0x1b1')});db[_0x2917('0x95')][_0x2917('0x10b')](db[_0x2917('0x88')],{'as':_0x2917('0x88'),'foreignKey':_0x2917('0x1b5')});db[_0x2917('0x1b6')]['hasMany'](db[_0x2917('0x1b7')],{'as':_0x2917('0x1ac'),'onDelete':_0x2917('0xf7'),'foreignKey':'AccountId'});db[_0x2917('0x1b7')][_0x2917('0xfa')](db[_0x2917('0x99')],{'as':_0x2917('0x1ae'),'onDelete':_0x2917('0xf7'),'foreignKey':'SubjectId'});db[_0x2917('0x1b7')][_0x2917('0xfa')](db[_0x2917('0x99')],{'as':_0x2917('0x1b8'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0x1b7')]['hasMany'](db[_0x2917('0x99')],{'as':_0x2917('0x1aa'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1b1')});db[_0x2917('0x1b7')][_0x2917('0x10b')](db[_0x2917('0x1b6')],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x1ad')});db['SugarcrmField'][_0x2917('0xfa')](db[_0x2917('0x99')],{'as':_0x2917('0x1b2'),'foreignKey':_0x2917('0x1af')});db['SugarcrmField']['hasMany'](db[_0x2917('0x99')],{'as':'Description','foreignKey':_0x2917('0x1b0')});db['SugarcrmField'][_0x2917('0xfa')](db[_0x2917('0x99')],{'as':'Field','foreignKey':_0x2917('0x1b1')});db['SugarcrmField'][_0x2917('0x10b')](db[_0x2917('0x88')],{'as':'Variable','foreignKey':_0x2917('0x1b5')});db[_0x2917('0x1b9')][_0x2917('0xfa')](db[_0x2917('0x9c')],{'as':_0x2917('0x1ac'),'onDelete':'cascade','foreignKey':_0x2917('0x1ad')});db[_0x2917('0x9c')]['hasMany'](db[_0x2917('0x9d')],{'as':'Subjects','onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1af')});db[_0x2917('0x9c')][_0x2917('0xfa')](db[_0x2917('0x9d')],{'as':_0x2917('0x1b8'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0x9c')][_0x2917('0xfa')](db[_0x2917('0x9d')],{'as':_0x2917('0x1aa'),'onDelete':'cascade','foreignKey':_0x2917('0x1b1')});db[_0x2917('0x9c')][_0x2917('0x10b')](db[_0x2917('0x1b9')],{'as':_0x2917('0x15f'),'foreignKey':'AccountId'});db[_0x2917('0x9c')][_0x2917('0x10c')](db[_0x2917('0x161')],{'through':_0x2917('0x1ba')});db[_0x2917('0x9d')][_0x2917('0xfa')](db[_0x2917('0x9d')],{'as':'Subject','foreignKey':_0x2917('0x1af')});db['DeskField'][_0x2917('0xfa')](db[_0x2917('0x9d')],{'as':'Description','foreignKey':_0x2917('0x1b0')});db['DeskField'][_0x2917('0xfa')](db[_0x2917('0x9d')],{'as':_0x2917('0x1b4'),'foreignKey':'FieldId'});db['DeskField'][_0x2917('0x10b')](db[_0x2917('0x88')],{'as':'Variable','foreignKey':_0x2917('0x1b5')});db[_0x2917('0x9e')][_0x2917('0xfa')](db['ZohoConfiguration'],{'as':_0x2917('0x1ac'),'onDelete':'cascade','foreignKey':_0x2917('0x1ad')});db[_0x2917('0xa0')][_0x2917('0xfa')](db['ZohoField'],{'as':_0x2917('0x1ae'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1af')});db[_0x2917('0xa0')][_0x2917('0xfa')](db['ZohoField'],{'as':_0x2917('0x1b8'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0xa0')][_0x2917('0xfa')](db[_0x2917('0xa2')],{'as':_0x2917('0x1aa'),'onDelete':_0x2917('0xf7'),'foreignKey':'FieldId'});db[_0x2917('0xa0')][_0x2917('0x10b')](db[_0x2917('0x9e')],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x1ad')});db[_0x2917('0xa2')][_0x2917('0xfa')](db[_0x2917('0xa2')],{'as':_0x2917('0x1b2'),'foreignKey':_0x2917('0x1af')});db[_0x2917('0xa2')][_0x2917('0xfa')](db[_0x2917('0xa2')],{'as':_0x2917('0x1b3'),'foreignKey':_0x2917('0x1b0')});db['ZohoField']['hasMany'](db[_0x2917('0xa2')],{'as':_0x2917('0x1b4'),'foreignKey':_0x2917('0x1b1')});db['ZohoField']['belongsTo'](db[_0x2917('0x88')],{'as':_0x2917('0x88'),'foreignKey':_0x2917('0x1b5')});db[_0x2917('0xa4')][_0x2917('0xfa')](db[_0x2917('0xa6')],{'as':_0x2917('0x1ac'),'onDelete':_0x2917('0xf7'),'foreignKey':'AccountId'});db[_0x2917('0xa6')]['hasMany'](db['ZendeskField'],{'as':_0x2917('0x1ae'),'foreignKey':'SubjectId'});db[_0x2917('0xa6')][_0x2917('0xfa')](db[_0x2917('0x1bb')],{'as':_0x2917('0x1b8'),'foreignKey':'DescriptionId'});db[_0x2917('0xa6')][_0x2917('0xfa')](db[_0x2917('0x1bb')],{'as':'Fields','foreignKey':'FieldId'});db[_0x2917('0xa6')][_0x2917('0x10b')](db[_0x2917('0xa4')],{'as':'Account','foreignKey':'AccountId'});db[_0x2917('0xa6')][_0x2917('0x10c')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0x2917('0x1bb')][_0x2917('0xfa')](db['ZendeskField'],{'as':_0x2917('0x1b2'),'foreignKey':'SubjectId'});db[_0x2917('0x1bb')][_0x2917('0xfa')](db[_0x2917('0x1bb')],{'as':_0x2917('0x1b3'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0x1bb')][_0x2917('0xfa')](db['ZendeskField'],{'as':_0x2917('0x1b4'),'foreignKey':_0x2917('0x1b1')});db['ZendeskField'][_0x2917('0x10b')](db['Variable'],{'as':'Variable','foreignKey':_0x2917('0x1b5')});db[_0x2917('0xa8')][_0x2917('0xfa')](db['FreshdeskConfiguration'],{'as':_0x2917('0x1ac'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1ad')});db[_0x2917('0xaa')][_0x2917('0xfa')](db[_0x2917('0xab')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x2917('0x1af')});db[_0x2917('0xaa')][_0x2917('0xfa')](db[_0x2917('0xab')],{'as':_0x2917('0x1b8'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0xaa')]['hasMany'](db[_0x2917('0xab')],{'as':_0x2917('0x1aa'),'onDelete':'cascade','foreignKey':_0x2917('0x1b1')});db[_0x2917('0xaa')][_0x2917('0x10b')](db[_0x2917('0xa8')],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x1ad')});db[_0x2917('0xaa')]['belongsToMany'](db[_0x2917('0x161')],{'through':_0x2917('0x1bc')});db[_0x2917('0xab')][_0x2917('0xfa')](db[_0x2917('0xab')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x2917('0xab')][_0x2917('0xfa')](db[_0x2917('0xab')],{'as':_0x2917('0x1b3'),'foreignKey':'DescriptionId'});db[_0x2917('0xab')][_0x2917('0xfa')](db['FreshdeskField'],{'as':_0x2917('0x1b4'),'foreignKey':_0x2917('0x1b1')});db[_0x2917('0xab')][_0x2917('0x10b')](db[_0x2917('0x88')],{'as':_0x2917('0x88'),'foreignKey':_0x2917('0x1b5')});db[_0x2917('0xad')][_0x2917('0xfa')](db[_0x2917('0xaf')],{'as':_0x2917('0x1ac'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x2917('0xaf')][_0x2917('0xfa')](db[_0x2917('0xb0')],{'as':_0x2917('0x1ae'),'foreignKey':'SubjectId'});db[_0x2917('0xaf')]['hasMany'](db['VtigerField'],{'as':_0x2917('0x1b8'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0xaf')][_0x2917('0xfa')](db['VtigerField'],{'as':_0x2917('0x1aa'),'foreignKey':_0x2917('0x1b1')});db[_0x2917('0xaf')]['belongsTo'](db['VtigerAccount'],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x1ad')});db[_0x2917('0xb0')][_0x2917('0xfa')](db[_0x2917('0xb0')],{'as':_0x2917('0x1b2'),'foreignKey':_0x2917('0x1af')});db[_0x2917('0xb0')]['hasMany'](db['VtigerField'],{'as':'Description','foreignKey':_0x2917('0x1b0')});db[_0x2917('0xb0')][_0x2917('0xfa')](db[_0x2917('0xb0')],{'as':_0x2917('0x1b4'),'foreignKey':_0x2917('0x1b1')});db['VtigerField'][_0x2917('0x10b')](db[_0x2917('0x88')],{'as':_0x2917('0x88'),'foreignKey':'VariableId'});db[_0x2917('0xb2')][_0x2917('0xfa')](db['ServicenowConfiguration'],{'as':_0x2917('0x1ac'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1ad')});db[_0x2917('0x1bd')]['hasMany'](db['ServicenowField'],{'as':_0x2917('0x1ae'),'foreignKey':_0x2917('0x1af')});db['ServicenowConfiguration']['hasMany'](db[_0x2917('0xb5')],{'as':_0x2917('0x1b8'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0x1bd')][_0x2917('0xfa')](db[_0x2917('0xb5')],{'as':'Fields','foreignKey':_0x2917('0x1b1')});db[_0x2917('0x1bd')][_0x2917('0x10b')](db[_0x2917('0xb2')],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x1ad')});db[_0x2917('0xb5')][_0x2917('0xfa')](db[_0x2917('0xb5')],{'as':_0x2917('0x1b2'),'foreignKey':'SubjectId'});db[_0x2917('0xb5')][_0x2917('0xfa')](db[_0x2917('0xb5')],{'as':_0x2917('0x1b3'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0xb5')][_0x2917('0xfa')](db[_0x2917('0xb5')],{'as':_0x2917('0x1b4'),'foreignKey':'FieldId'});db[_0x2917('0xb5')][_0x2917('0x10b')](db[_0x2917('0x88')],{'as':_0x2917('0x88'),'foreignKey':_0x2917('0x1b5')});db['Dynamics365Account'][_0x2917('0xfa')](db['Dynamics365Configuration'],{'as':_0x2917('0x1ac'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1ad')});db[_0x2917('0x1be')][_0x2917('0xfa')](db['Dynamics365Field'],{'as':_0x2917('0x1ae'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1af')});db[_0x2917('0x1be')][_0x2917('0xfa')](db[_0x2917('0x1bf')],{'as':'Descriptions','onDelete':_0x2917('0xf7'),'foreignKey':'DescriptionId'});db[_0x2917('0x1be')][_0x2917('0xfa')](db[_0x2917('0x1bf')],{'as':_0x2917('0x1aa'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1b1')});db[_0x2917('0x1be')][_0x2917('0x10b')](db[_0x2917('0x1c0')],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x1ad')});db[_0x2917('0x1bf')][_0x2917('0xfa')](db[_0x2917('0x1bf')],{'as':_0x2917('0x1b2'),'foreignKey':'SubjectId'});db[_0x2917('0x1bf')][_0x2917('0xfa')](db[_0x2917('0x1bf')],{'as':_0x2917('0x1b3'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0x1bf')]['hasMany'](db['Dynamics365Field'],{'as':_0x2917('0x1b4'),'foreignKey':_0x2917('0x1b1')});db[_0x2917('0x1bf')][_0x2917('0x10b')](db[_0x2917('0x88')],{'as':_0x2917('0x88'),'foreignKey':_0x2917('0x1b5')});db[_0x2917('0xba')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0x2917('0x1ac'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1ad')});db['FreshsalesConfiguration'][_0x2917('0xfa')](db[_0x2917('0xbd')],{'as':_0x2917('0x1ae'),'foreignKey':_0x2917('0x1af')});db[_0x2917('0xbc')][_0x2917('0xfa')](db[_0x2917('0xbd')],{'as':_0x2917('0x1b8'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0xbc')]['hasMany'](db['FreshsalesField'],{'as':_0x2917('0x1aa'),'foreignKey':'FieldId'});db['FreshsalesConfiguration'][_0x2917('0x10b')](db[_0x2917('0xba')],{'as':'Account','foreignKey':_0x2917('0x1ad')});db[_0x2917('0xbd')]['hasMany'](db[_0x2917('0xbd')],{'as':_0x2917('0x1b2'),'foreignKey':_0x2917('0x1af')});db[_0x2917('0xbd')]['hasMany'](db[_0x2917('0xbd')],{'as':_0x2917('0x1b3'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0xbd')]['hasMany'](db[_0x2917('0xbd')],{'as':_0x2917('0x1b4'),'foreignKey':'FieldId'});db['FreshsalesField']['belongsTo'](db['Variable'],{'as':_0x2917('0x88'),'foreignKey':_0x2917('0x1b5')});db[_0x2917('0xc2')][_0x2917('0x10b')](db[_0x2917('0x58')],{});db['ChatQueueReport'][_0x2917('0x10b')](db['CmList'],{'as':_0x2917('0x16a'),'foreignKey':_0x2917('0x159')});db[_0x2917('0xc2')]['belongsTo'](db['CmContact'],{'as':_0x2917('0x150'),'foreignKey':_0x2917('0x151')});db[_0x2917('0xc2')][_0x2917('0x10b')](db[_0x2917('0x5d')],{});db[_0x2917('0xc2')][_0x2917('0x10b')](db[_0x2917('0x5e')],{});db[_0x2917('0xc2')]['belongsTo'](db[_0x2917('0xf9')],{});db[_0x2917('0xc2')]['belongsTo'](db[_0x2917('0x62')],{});db[_0x2917('0xc4')]['belongsTo'](db[_0x2917('0xf9')],{'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1c1')});db['ChatInternalMessage'][_0x2917('0x10b')](db[_0x2917('0xf9')],{'onDelete':'cascade','foreignKey':'ToId'});db[_0x2917('0xc8')][_0x2917('0xfa')](db[_0x2917('0x1c2')],{'foreignKey':_0x2917('0x1c3'),'onDelete':_0x2917('0xf7')});db[_0x2917('0xc8')][_0x2917('0xfa')](db[_0x2917('0xc6')],{'foreignKey':'SessionId','onDelete':_0x2917('0xf7')});db[_0x2917('0xc9')][_0x2917('0x10b')](db[_0x2917('0x4e')],{});db['SmsQueueReport'][_0x2917('0x10b')](db[_0x2917('0x144')],{'as':_0x2917('0x16a'),'foreignKey':'ListId'});db[_0x2917('0xc9')][_0x2917('0x10b')](db[_0x2917('0x67')],{'as':_0x2917('0x150'),'foreignKey':_0x2917('0x151')});db['SmsQueueReport']['belongsTo'](db[_0x2917('0x117')],{});db[_0x2917('0xc9')][_0x2917('0x10b')](db[_0x2917('0x51')],{});db[_0x2917('0xc9')][_0x2917('0x10b')](db[_0x2917('0xf9')],{});db[_0x2917('0xc9')][_0x2917('0x10b')](db[_0x2917('0x120')],{});db['JscriptyProject']['hasMany'](db[_0x2917('0xc8')],{'foreignKey':_0x2917('0x1c4')});db['JscriptyProject'][_0x2917('0xfa')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0x2917('0xcf')]['hasMany'](db[_0x2917('0xc6')],{'foreignKey':'ProjectId'});db[_0x2917('0xd4')][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':'Users','through':_0x2917('0x1c5')});db[_0x2917('0xd7')]['belongsToMany'](db[_0x2917('0xf9')],{'as':_0x2917('0x15c'),'through':_0x2917('0x114')});db[_0x2917('0xd7')][_0x2917('0x10c')](db['VoiceQueue'],{'through':_0x2917('0x1c6'),'as':'VoiceQueues'});db[_0x2917('0xd7')]['belongsToMany'](db['MailQueue'],{'through':'team_has_mail_queues','as':_0x2917('0x11d')});db[_0x2917('0xd7')]['belongsToMany'](db['ChatQueue'],{'through':_0x2917('0x18b'),'as':'ChatQueues'});db[_0x2917('0xd7')][_0x2917('0x10c')](db['FaxQueue'],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0x2917('0xd7')][_0x2917('0x10c')](db[_0x2917('0x120')],{'through':_0x2917('0x17b'),'as':_0x2917('0x121')});db['Team'][_0x2917('0x10c')](db[_0x2917('0x56')],{'through':_0x2917('0x181'),'as':'OpenchannelQueues'});db[_0x2917('0xd7')]['belongsToMany'](db['WhatsappQueue'],{'through':_0x2917('0x1c7'),'as':_0x2917('0x1c8')});db[_0x2917('0xda')]['hasMany'](db['CmHopper'],{'as':_0x2917('0x13b'),'foreignKey':'CampaignId'});db[_0x2917('0xda')]['hasMany'](db[_0x2917('0x6b')],{'as':_0x2917('0xfe'),'foreignKey':_0x2917('0x191')});db[_0x2917('0xda')][_0x2917('0xfa')](db[_0x2917('0x6d')],{'as':'HopperHistories','foreignKey':_0x2917('0x191')});db[_0x2917('0xda')][_0x2917('0xfa')](db[_0x2917('0x69')],{'as':_0x2917('0x1c9'),'foreignKey':_0x2917('0x191')});db[_0x2917('0xda')][_0x2917('0x10b')](db[_0x2917('0x13e')],{'as':'Trunk','foreignKey':_0x2917('0x13f')});db['Campaign'][_0x2917('0x10b')](db[_0x2917('0x13e')],{'as':_0x2917('0x140'),'foreignKey':_0x2917('0x141')});db[_0x2917('0xda')][_0x2917('0x10b')](db[_0x2917('0x79')],{'as':_0x2917('0x79'),'foreignKey':_0x2917('0x142')});db[_0x2917('0xda')][_0x2917('0x10b')](db[_0x2917('0xd4')],{'as':_0x2917('0xd4'),'foreignKey':_0x2917('0x1ca')});db[_0x2917('0xda')][_0x2917('0x10c')](db[_0x2917('0x144')],{'as':_0x2917('0x112'),'through':_0x2917('0x1cb')});db[_0x2917('0xda')][_0x2917('0x10c')](db[_0x2917('0x144')],{'as':'BlackLists','through':_0x2917('0x1cc')});db[_0x2917('0xdf')]['belongsTo'](db['MailMessage'],{});db[_0x2917('0xdf')][_0x2917('0x10b')](db[_0x2917('0x3b')],{});db['MailTransferReport'][_0x2917('0x10b')](db[_0x2917('0x36')],{'foreignKey':_0x2917('0x1cd'),'as':_0x2917('0x1ce')});db[_0x2917('0xdf')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x2917('0xdf')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'foreignKey':'ToUserId','as':_0x2917('0x1cf')});db['MailTransferReport']['belongsTo'](db[_0x2917('0x38')],{'foreignKey':'ToMailQueueId','as':_0x2917('0x1d0')});db['MailTransferReport'][_0x2917('0x10b')](db['MailAccount'],{'foreignKey':_0x2917('0x1d1'),'as':_0x2917('0x1d2')});db['ChatTransferReport']['belongsTo'](db[_0x2917('0x5e')],{});db['ChatTransferReport'][_0x2917('0x10b')](db[_0x2917('0x5d')],{});db[_0x2917('0xe1')][_0x2917('0x10b')](db[_0x2917('0x58')],{'foreignKey':_0x2917('0x1d3'),'as':_0x2917('0x1ce')});db[_0x2917('0xe1')]['belongsTo'](db['User'],{'foreignKey':_0x2917('0x1d4'),'as':_0x2917('0x1d5')});db[_0x2917('0xe1')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'foreignKey':_0x2917('0x1d6'),'as':'ToAgent'});db[_0x2917('0xe1')][_0x2917('0x10b')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x2917('0x1d0')});db[_0x2917('0xe1')][_0x2917('0x10b')](db[_0x2917('0x58')],{'foreignKey':'ToChatWebsiteId','as':_0x2917('0x1d2')});db[_0x2917('0xe3')]['belongsTo'](db[_0x2917('0x4a')],{});db['FaxTransferReport'][_0x2917('0x10b')](db['FaxInteraction'],{});db[_0x2917('0xe3')][_0x2917('0x10b')](db[_0x2917('0x46')],{'foreignKey':_0x2917('0x1d7'),'as':_0x2917('0x1ce')});db[_0x2917('0xe3')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'foreignKey':_0x2917('0x1d4'),'as':_0x2917('0x1d5')});db[_0x2917('0xe3')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'foreignKey':'ToUserId','as':_0x2917('0x1cf')});db[_0x2917('0xe3')][_0x2917('0x10b')](db[_0x2917('0x4b')],{'foreignKey':_0x2917('0x1d8'),'as':_0x2917('0x1d0')});db[_0x2917('0xe3')][_0x2917('0x10b')](db[_0x2917('0x46')],{'foreignKey':_0x2917('0x1d9'),'as':'ToAccount'});db[_0x2917('0xe4')]['belongsTo'](db[_0x2917('0x55')],{});db[_0x2917('0xe4')][_0x2917('0x10b')](db[_0x2917('0x119')],{});db[_0x2917('0xe4')][_0x2917('0x10b')](db['OpenchannelAccount'],{'foreignKey':_0x2917('0x1da'),'as':_0x2917('0x1ce')});db['OpenchannelTransferReport'][_0x2917('0x10b')](db[_0x2917('0xf9')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x2917('0xe4')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'foreignKey':_0x2917('0x1d6'),'as':_0x2917('0x1cf')});db[_0x2917('0xe4')][_0x2917('0x10b')](db[_0x2917('0x56')],{'foreignKey':_0x2917('0x1db'),'as':'ToQueue'});db[_0x2917('0xe4')][_0x2917('0x10b')](db['OpenchannelAccount'],{'foreignKey':_0x2917('0x1dc'),'as':'ToAccount'});db[_0x2917('0xe6')]['belongsTo'](db['SmsMessage'],{});db[_0x2917('0xe6')]['belongsTo'](db[_0x2917('0x117')],{});db[_0x2917('0xe6')][_0x2917('0x10b')](db['SmsAccount'],{'foreignKey':_0x2917('0x1dd'),'as':_0x2917('0x1ce')});db[_0x2917('0xe6')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'foreignKey':'FromUserId','as':_0x2917('0x1d5')});db['SmsTransferReport'][_0x2917('0x10b')](db[_0x2917('0xf9')],{'foreignKey':_0x2917('0x1d6'),'as':_0x2917('0x1cf')});db[_0x2917('0xe6')]['belongsTo'](db['SmsQueue'],{'foreignKey':_0x2917('0x1de'),'as':_0x2917('0x1d0')});db['SmsTransferReport'][_0x2917('0x10b')](db[_0x2917('0x4e')],{'foreignKey':_0x2917('0x1df'),'as':_0x2917('0x1d2')});db[_0x2917('0x144')][_0x2917('0xfa')](db[_0x2917('0x76')],{'as':_0x2917('0x155'),'foreignKey':_0x2917('0x159')});db[_0x2917('0x144')][_0x2917('0xfa')](db[_0x2917('0x70')],{'as':'CustomFields','foreignKey':_0x2917('0x159')});db[_0x2917('0x144')][_0x2917('0xfa')](db[_0x2917('0x67')],{'as':_0x2917('0x110'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x159')});db[_0x2917('0x144')][_0x2917('0xfa')](db[_0x2917('0x6b')],{'as':_0x2917('0xfe'),'foreignKey':_0x2917('0x159')});db[_0x2917('0x144')][_0x2917('0xfa')](db[_0x2917('0x6d')],{'as':_0x2917('0xff'),'foreignKey':'ListId'});db[_0x2917('0x144')][_0x2917('0xfa')](db[_0x2917('0x100')],{'as':_0x2917('0x100'),'foreignKey':_0x2917('0x159')});db[_0x2917('0x144')][_0x2917('0x10c')](db['VoiceQueue'],{'as':_0x2917('0x1e0'),'through':_0x2917('0x145')});db[_0x2917('0x144')][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':_0x2917('0x15c'),'through':_0x2917('0x113')});db[_0x2917('0xe8')]['hasMany'](db['VoiceExtension'],{'as':_0x2917('0xfd'),'onDelete':_0x2917('0xf7')});db[_0x2917('0xe8')][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':_0x2917('0x15c'),'through':_0x2917('0x126')});db[_0x2917('0xe9')][_0x2917('0xfa')](db['User'],{'as':_0x2917('0x165'),'foreignKey':'userProfileId'});db[_0x2917('0xe9')][_0x2917('0xfa')](db[_0x2917('0xea')],{'as':'UserProfileSections','foreignKey':_0x2917('0x1e1'),'onDelete':_0x2917('0xf7')});db[_0x2917('0xea')][_0x2917('0xfa')](db[_0x2917('0xeb')],{'as':_0x2917('0x1e2'),'foreignKey':_0x2917('0x1e3'),'onDelete':_0x2917('0xf7')});db[_0x2917('0xef')]['hasMany'](db['Disposition'],{'as':_0x2917('0x155'),'foreignKey':_0x2917('0x1e4')});db[_0x2917('0xef')][_0x2917('0xfa')](db[_0x2917('0x74')],{'as':_0x2917('0x156'),'foreignKey':'WhatsappAccountId'});db[_0x2917('0xef')][_0x2917('0xfa')](db[_0x2917('0x1e5')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x2917('0xfa')](db[_0x2917('0xf2')],{'as':'Interactions'});db[_0x2917('0xef')][_0x2917('0xfa')](db[_0x2917('0x1e6')],{'as':_0x2917('0x158')});db[_0x2917('0xef')][_0x2917('0x10b')](db['CmList'],{'as':_0x2917('0x16a'),'foreignKey':_0x2917('0x159')});db[_0x2917('0xef')][_0x2917('0x10b')](db[_0x2917('0x7b')],{'as':_0x2917('0x15b'),'foreignKey':_0x2917('0x143')});db['WhatsappAccount'][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':_0x2917('0x15c'),'through':'user_has_whatsapp_accounts'});db[_0x2917('0x1e6')]['belongsTo'](db[_0x2917('0xf9')],{'onDelete':_0x2917('0x168')});db['WhatsappApplication']['belongsTo'](db[_0x2917('0x123')],{'onDelete':_0x2917('0x168')});db['WhatsappApplication'][_0x2917('0x10b')](db[_0x2917('0xef')],{'onDelete':_0x2917('0x168')});db[_0x2917('0x1e6')]['belongsTo'](db[_0x2917('0x79')],{'onDelete':_0x2917('0x168'),'foreignKey':_0x2917('0x142')});db[_0x2917('0x1e6')][_0x2917('0x10b')](db['Tag'],{'onDelete':_0x2917('0x168'),'foreignKey':_0x2917('0x169')});db[_0x2917('0xf2')][_0x2917('0xfa')](db[_0x2917('0x1e5')],{'as':_0x2917('0x149'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1e7')});db[_0x2917('0xf2')][_0x2917('0x10b')](db['WhatsappAccount'],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x1e4')});db[_0x2917('0xf2')][_0x2917('0x10b')](db['CmContact'],{'as':_0x2917('0x150'),'foreignKey':_0x2917('0x151')});db[_0x2917('0xf2')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':_0x2917('0x160'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0xf2')]['belongsToMany'](db[_0x2917('0x161')],{'through':_0x2917('0x1a1'),'as':_0x2917('0x163')});db['WhatsappInteraction'][_0x2917('0x10c')](db['Tag'],{'through':_0x2917('0x1a1'),'as':'ThroughTags'});db[_0x2917('0xf2')]['belongsToMany'](db['User'],{'as':_0x2917('0x165'),'through':_0x2917('0x11c'),'foreignKey':_0x2917('0x1e7')});db[_0x2917('0x1e5')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':_0x2917('0xf9')});db[_0x2917('0x1e5')][_0x2917('0x10b')](db['CmContact'],{'onDelete':_0x2917('0xf7'),'as':_0x2917('0x150')});db['WhatsappMessage'][_0x2917('0x10b')](db['WhatsappInteraction'],{'onDelete':_0x2917('0xf7'),'as':_0x2917('0x179'),'foreignKey':_0x2917('0x1e7')});db[_0x2917('0x1e5')][_0x2917('0x10b')](db[_0x2917('0xef')],{'as':'Account','foreignKey':_0x2917('0x1e4')});db['WhatsappQueueReport'][_0x2917('0x10b')](db['WhatsappAccount'],{});db[_0x2917('0x1e8')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x2917('0x159')});db[_0x2917('0x1e8')][_0x2917('0x10b')](db[_0x2917('0x67')],{'as':_0x2917('0x150'),'foreignKey':_0x2917('0x151')});db[_0x2917('0x1e8')][_0x2917('0x10b')](db[_0x2917('0xf2')],{});db[_0x2917('0x1e8')][_0x2917('0x10b')](db[_0x2917('0x123')],{});db[_0x2917('0x1e8')][_0x2917('0x10b')](db['WhatsappMessage'],{});db[_0x2917('0x1e8')][_0x2917('0x10b')](db['User'],{});db[_0x2917('0x1e9')][_0x2917('0x10b')](db['WhatsappMessage'],{});db['WhatsappTransferReport'][_0x2917('0x10b')](db[_0x2917('0xf2')],{});db[_0x2917('0x1e9')][_0x2917('0x10b')](db[_0x2917('0xef')],{'foreignKey':'FromWhatsappAccountId','as':_0x2917('0x1ce')});db['WhatsappTransferReport'][_0x2917('0x10b')](db[_0x2917('0xef')],{'foreignKey':_0x2917('0x1ea'),'as':_0x2917('0x1d2')});db[_0x2917('0x1e9')][_0x2917('0x10b')](db[_0x2917('0x123')],{'foreignKey':_0x2917('0x1eb'),'as':_0x2917('0x1d0')});db[_0x2917('0x1e9')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'foreignKey':'FromUserId','as':_0x2917('0x1d5')});db[_0x2917('0x1e9')][_0x2917('0x10b')](db['User'],{'foreignKey':_0x2917('0x1d6'),'as':'ToAgent'});db['WhatsappQueue']['belongsToMany'](db[_0x2917('0xf9')],{'as':_0x2917('0x15c'),'through':'UserWhatsappQueue','foreignKey':_0x2917('0x1ec')});db[_0x2917('0x123')][_0x2917('0x10c')](db['Team'],{'through':_0x2917('0x1c7'),'as':_0x2917('0x146')});module[_0x2917('0x1ed')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 3a47abc..5b3bc8e 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xbe02=['lodash','path','express','express-winston','./errors','./config/environment','./config/logger','api','auth','default','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','user','name','role','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','connection','agent_name','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','/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/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','./api/tag','/api/templates','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskConfiguration','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./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/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/campaign','/api/migrations','/api/attachments','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/cm/lists','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/version','/api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','static','root','join','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','/index.html','username','password','firstName','lastName','street','phone','mobile','fax','email','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridnum','exten','vidaooApiKey','privateKey','key','accountSid','dsn','registry','oldPassword','length','isPlainObject','isString','replace','@@{','}@@'];(function(_0x38b50c,_0x1952dc){var _0x5806ad=function(_0x1c33c7){while(--_0x1c33c7){_0x38b50c['push'](_0x38b50c['shift']());}};_0x5806ad(++_0x1952dc);}(_0xbe02,0x146));var _0x2be0=function(_0x418ae4,_0x35892e){_0x418ae4=_0x418ae4-0x0;var _0x239825=_0xbe02[_0x418ae4];return _0x239825;};'use strict';var _=require(_0x2be0('0x0'));var path=require(_0x2be0('0x1'));var express=require(_0x2be0('0x2'));var ewinston=require(_0x2be0('0x3'));var util=require('util');var errors=require(_0x2be0('0x4'));var config=require(_0x2be0('0x5'));var logger=require(_0x2be0('0x6'))(_0x2be0('0x7'));var authLogger=require(_0x2be0('0x6'))(_0x2be0('0x8'));exports[_0x2be0('0x9')]=function(_0x474a35){_0x474a35[_0x2be0('0xa')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x4ca22f,_0x176f12){var _0xdfef68=_0x2be0('0xb');if(!_[_0x2be0('0xc')](_0x4ca22f[_0x2be0('0xd')])){_0xdfef68+=_0x2be0('0xe');var _0x5f54ac=_0x4ca22f['body'];maskSensitiveData(_0x5f54ac);}return util['format'](_0xdfef68,_0x4ca22f['method'],_0x4ca22f['headers']['x-forwarded-for']?_0x4ca22f[_0x2be0('0xf')][_0x2be0('0x10')]:_0x4ca22f['connection'][_0x2be0('0x11')]||_0x4ca22f['ip'],_0x4ca22f[_0x2be0('0x12')],_0x176f12[_0x2be0('0x13')],_0x176f12[_0x2be0('0x14')],_0x4ca22f[_0x2be0('0x15')]?_0x4ca22f[_0x2be0('0x15')]['id']:null,_0x4ca22f[_0x2be0('0x15')]?_0x4ca22f[_0x2be0('0x15')][_0x2be0('0x16')]:null,_0x4ca22f[_0x2be0('0x15')]?_0x4ca22f['user'][_0x2be0('0x17')]:null,_0x5f54ac?util[_0x2be0('0x18')](_0x5f54ac,![],null):'');}}));_0x474a35['use'](ewinston[_0x2be0('0x19')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x1e0c27,_0x5bcbc5){var _0x334070=_0x2be0('0x1a');if(_0x1e0c27[_0x2be0('0xd')]&&_0x1e0c27[_0x2be0('0xd')][_0x2be0('0x1b')]&&_0x1e0c27[_0x2be0('0xd')][_0x2be0('0x1c')]){_0x334070=_0x2be0('0x1d');}return util[_0x2be0('0x1e')](_0x334070,_0x1e0c27[_0x2be0('0x1f')],_0x1e0c27[_0x2be0('0xf')][_0x2be0('0x10')]?_0x1e0c27[_0x2be0('0xf')][_0x2be0('0x10')]:_0x1e0c27[_0x2be0('0x20')][_0x2be0('0x11')]||_0x1e0c27['ip'],_0x1e0c27[_0x2be0('0x12')],_0x5bcbc5['statusCode'],_0x5bcbc5['responseTime'],_0x1e0c27[_0x2be0('0x15')]?_0x1e0c27['user']['id']:null,_0x1e0c27['user']?_0x1e0c27[_0x2be0('0x15')][_0x2be0('0x16')]:null,_0x1e0c27[_0x2be0('0x15')]?_0x1e0c27[_0x2be0('0x15')][_0x2be0('0x17')]:null,_0x1e0c27[_0x2be0('0xd')]&&_0x1e0c27[_0x2be0('0xd')][_0x2be0('0x1b')]?_0x1e0c27['body'][_0x2be0('0x1b')]:'other',_0x1e0c27['body']&&_0x1e0c27[_0x2be0('0xd')][_0x2be0('0x1c')]?_0x1e0c27[_0x2be0('0xd')][_0x2be0('0x1c')]:'',_0x1e0c27[_0x2be0('0xd')]&&_0x1e0c27[_0x2be0('0xd')][_0x2be0('0x21')]?_0x1e0c27['body'][_0x2be0('0x21')]:'');},'ignoreRoute':function(_0x2a605b){var _0x559a66=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x559a66['test'](_0x2a605b[_0x2be0('0x12')]);}}));_0x474a35[_0x2be0('0xa')]('/api/users',require(_0x2be0('0x22')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x23'),require(_0x2be0('0x24')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x25'),require(_0x2be0('0x26')));_0x474a35['use'](_0x2be0('0x27'),require('./api/voiceExtension'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x28'),require(_0x2be0('0x29')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x2a'),require(_0x2be0('0x2b')));_0x474a35[_0x2be0('0xa')]('/api/voice/recordings',require(_0x2be0('0x2c')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x2d'),require(_0x2be0('0x2e')));_0x474a35[_0x2be0('0xa')]('/api/voice/mails',require(_0x2be0('0x2f')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x30'),require(_0x2be0('0x31')));_0x474a35[_0x2be0('0xa')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x32'),require(_0x2be0('0x33')));_0x474a35['use']('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x34'),require(_0x2be0('0x35')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x36'),require(_0x2be0('0x37')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x38'),require(_0x2be0('0x39')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x3a'),require('./api/voiceTransferReport'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x3b'),require(_0x2be0('0x3c')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x3d'),require('./api/mailAccount'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x3e'),require(_0x2be0('0x3f')));_0x474a35['use'](_0x2be0('0x40'),require('./api/mailSubstatus'));_0x474a35[_0x2be0('0xa')]('/api/mail/interactions',require('./api/mailInteraction'));_0x474a35[_0x2be0('0xa')]('/api/mail/messages',require(_0x2be0('0x41')));_0x474a35['use'](_0x2be0('0x42'),require('./api/mailApplication'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x43'),require(_0x2be0('0x44')));_0x474a35['use'](_0x2be0('0x45'),require('./api/dashboard'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x46'),require(_0x2be0('0x47')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x48'),require(_0x2be0('0x49')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x4a'),require(_0x2be0('0x4b')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x4c'),require(_0x2be0('0x4d')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x4e'),require(_0x2be0('0x4f')));_0x474a35['use'](_0x2be0('0x50'),require('./api/faxQueue'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x51'),require(_0x2be0('0x52')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x53'),require(_0x2be0('0x54')));_0x474a35[_0x2be0('0xa')]('/api/sms/applications',require(_0x2be0('0x55')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x56'),require(_0x2be0('0x57')));_0x474a35[_0x2be0('0xa')]('/api/sms/messages',require(_0x2be0('0x58')));_0x474a35['use'](_0x2be0('0x59'),require(_0x2be0('0x5a')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x5b'),require(_0x2be0('0x5c')));_0x474a35[_0x2be0('0xa')]('/api/openchannel/applications',require(_0x2be0('0x5d')));_0x474a35['use'](_0x2be0('0x5e'),require(_0x2be0('0x5f')));_0x474a35['use'](_0x2be0('0x60'),require(_0x2be0('0x61')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x62'),require(_0x2be0('0x63')));_0x474a35['use']('/api/chat/websites',require(_0x2be0('0x64')));_0x474a35[_0x2be0('0xa')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x65'),require(_0x2be0('0x66')));_0x474a35[_0x2be0('0xa')]('/api/chat/interactions',require(_0x2be0('0x67')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x68'),require(_0x2be0('0x69')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x6a'),require(_0x2be0('0x6b')));_0x474a35['use'](_0x2be0('0x6c'),require(_0x2be0('0x6d')));_0x474a35['use'](_0x2be0('0x6e'),require(_0x2be0('0x6f')));_0x474a35[_0x2be0('0xa')]('/api/chat/proactive_actions',require(_0x2be0('0x70')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x71'),require(_0x2be0('0x72')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x73'),require(_0x2be0('0x74')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x75'),require('./api/cmHopper'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x76'),require(_0x2be0('0x77')));_0x474a35[_0x2be0('0xa')]('/api/cm/hopper_final',require(_0x2be0('0x78')));_0x474a35['use'](_0x2be0('0x79'),require(_0x2be0('0x7a')));_0x474a35['use'](_0x2be0('0x7b'),require('./api/cmCustomField'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x7c'),require('./api/action'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x7d'),require(_0x2be0('0x7e')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x7f'),require(_0x2be0('0x80')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x81'),require(_0x2be0('0x82')));_0x474a35['use'](_0x2be0('0x83'),require(_0x2be0('0x84')));_0x474a35[_0x2be0('0xa')]('/api/intervals',require(_0x2be0('0x85')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x86'),require(_0x2be0('0x87')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x88'),require(_0x2be0('0x89')));_0x474a35['use'](_0x2be0('0x8a'),require(_0x2be0('0x8b')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x8c'),require(_0x2be0('0x8d')));_0x474a35[_0x2be0('0xa')]('/api/sounds',require(_0x2be0('0x8e')));_0x474a35['use']('/api/tags',require(_0x2be0('0x8f')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x90'),require('./api/template'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x91'),require(_0x2be0('0x92')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x93'),require('./api/variable'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x94'),require(_0x2be0('0x95')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x96'),require(_0x2be0('0x97')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x98'),require(_0x2be0('0x99')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x9a'),require('./api/analyticDefaultReport'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x9b'),require('./api/analyticExtractedReport'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x9c'),require(_0x2be0('0x9d')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x9e'),require('./api/analyticFieldReport'));_0x474a35['use'](_0x2be0('0x9f'),require(_0x2be0('0xa0')));_0x474a35[_0x2be0('0xa')]('/api/integrations/salesforce/accounts',require(_0x2be0('0xa1')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xa2'),require(_0x2be0('0xa3')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xa4'),require(_0x2be0('0xa5')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xa6'),require(_0x2be0('0xa7')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xa8'),require(_0x2be0('0xa9')));_0x474a35[_0x2be0('0xa')]('/api/integrations/sugarcrm/fields',require(_0x2be0('0xaa')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xab'),require(_0x2be0('0xac')));_0x474a35['use']('/api/integrations/desk/configurations',require(_0x2be0('0xad')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xae'),require(_0x2be0('0xaf')));_0x474a35['use'](_0x2be0('0xb0'),require(_0x2be0('0xb1')));_0x474a35['use'](_0x2be0('0xb2'),require(_0x2be0('0xb3')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xb4'),require(_0x2be0('0xb5')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xb6'),require('./api/intZendeskAccount'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xb7'),require(_0x2be0('0xb8')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xb9'),require(_0x2be0('0xba')));_0x474a35['use']('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x474a35[_0x2be0('0xa')]('/api/integrations/freshdesk/configurations',require(_0x2be0('0xbb')));_0x474a35[_0x2be0('0xa')]('/api/integrations/freshdesk/fields',require(_0x2be0('0xbc')));_0x474a35[_0x2be0('0xa')]('/api/integrations/vtiger/accounts',require(_0x2be0('0xbd')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xbe'),require(_0x2be0('0xbf')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xc0'),require('./api/intVtigerField'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xc1'),require(_0x2be0('0xc2')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xc3'),require(_0x2be0('0xc4')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xc5'),require(_0x2be0('0xc6')));_0x474a35[_0x2be0('0xa')]('/api/integrations/dynamics365/accounts',require(_0x2be0('0xc7')));_0x474a35[_0x2be0('0xa')]('/api/integrations/dynamics365/configurations',require(_0x2be0('0xc8')));_0x474a35['use'](_0x2be0('0xc9'),require(_0x2be0('0xca')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xcb'),require(_0x2be0('0xcc')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xcd'),require('./api/intFreshsalesConfiguration'));_0x474a35['use'](_0x2be0('0xce'),require('./api/intFreshsalesField'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xcf'),require(_0x2be0('0xd0')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xd1'),require(_0x2be0('0xd2')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xd3'),require('./api/chatInternalMessage'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xd4'),require(_0x2be0('0xd5')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xd6'),require(_0x2be0('0xd7')));_0x474a35['use'](_0x2be0('0xd8'),require('./api/jscriptySessionReport'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xd9'),require(_0x2be0('0xda')));_0x474a35['use'](_0x2be0('0xdb'),require('./api/squareReport'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xdc'),require(_0x2be0('0xdd')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xde'),require(_0x2be0('0xdf')));_0x474a35['use'](_0x2be0('0xe0'),require(_0x2be0('0xe1')));_0x474a35[_0x2be0('0xa')]('/api/square/odbc',require(_0x2be0('0xe2')));_0x474a35[_0x2be0('0xa')]('/api/square/projects',require('./api/squareProject'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xe3'),require(_0x2be0('0xe4')));_0x474a35['use'](_0x2be0('0xe5'),require(_0x2be0('0xe6')));_0x474a35['use'](_0x2be0('0xe7'),require(_0x2be0('0xe8')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xe9'),require('./api/license'));_0x474a35[_0x2be0('0xa')]('/api/campaigns',require(_0x2be0('0xea')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xeb'),require('./api/migration'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xec'),require('./api/attachment'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xed'),require('./api/plugin'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xee'),require(_0x2be0('0xef')));_0x474a35['use']('/api/chat/reports/transfer',require(_0x2be0('0xf0')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xf1'),require(_0x2be0('0xf2')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xf3'),require(_0x2be0('0xf4')));_0x474a35['use']('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xf5'),require('./api/cmList'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xf6'),require('./api/voicePrefix'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xf7'),require(_0x2be0('0xf8')));_0x474a35['use'](_0x2be0('0xf9'),require('./api/userProfileSection'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xfa'),require(_0x2be0('0xfb')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xfc'),require(_0x2be0('0xfd')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xfe'),require('./api/userNotification'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xff'),require(_0x2be0('0x100')));_0x474a35[_0x2be0('0xa')]('/api/whatsapp/applications',require(_0x2be0('0x101')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x102'),require('./api/whatsappInteraction'));_0x474a35['use']('/api/whatsapp/messages',require(_0x2be0('0x103')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x104'),require('./api/whatsappQueueReport'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x105'),require(_0x2be0('0x106')));_0x474a35[_0x2be0('0xa')]('/api/whatsapp/queues',require(_0x2be0('0x107')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x108'),require(_0x2be0('0x109')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x10a'),require(_0x2be0('0x10b')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x10c'),require('./api/authGoogle'));_0x474a35['use'](_0x2be0('0x10d'),require('./api/jira'));_0x474a35[_0x2be0('0xa')]('/api/rpc',require('./api/rpc'));_0x474a35['use']('/api/version',require(_0x2be0('0x10e')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x10f'),require('./api/system'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x110'),require('./api/pm2'));_0x474a35['use'](_0x2be0('0x111'),require(_0x2be0('0x112')));_0x474a35['use'](_0x2be0('0x113'),express[_0x2be0('0x114')](path['join'](config[_0x2be0('0x115')],_0x2be0('0x113'))));_0x474a35[_0x2be0('0xa')]('/www',express[_0x2be0('0x114')](path[_0x2be0('0x116')](config[_0x2be0('0x115')],'/www')));_0x474a35[_0x2be0('0xa')]('/demo',express[_0x2be0('0x114')](path['join'](config[_0x2be0('0x115')],'/demo')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x117'),express[_0x2be0('0x114')](path[_0x2be0('0x116')](config[_0x2be0('0x115')],_0x2be0('0x118'),_0x2be0('0x119'))));_0x474a35[_0x2be0('0xa')](_0x2be0('0x11a'),express[_0x2be0('0x114')](path[_0x2be0('0x116')](config[_0x2be0('0x115')],_0x2be0('0x11b'))));_0x474a35[_0x2be0('0x11c')](_0x2be0('0x11d'))[_0x2be0('0x11e')](errors[0x194]);_0x474a35[_0x2be0('0x11c')]('/*')['get'](function(_0x5c20ca,_0x212b55){_0x212b55['sendFile'](path[_0x2be0('0x11f')](_0x474a35[_0x2be0('0x11e')]('appPath')+_0x2be0('0x120')));});};var sensitiveFields=[_0x2be0('0x121'),_0x2be0('0x122'),'newPassword','apiKey',_0x2be0('0x123'),_0x2be0('0x124'),_0x2be0('0x125'),_0x2be0('0x126'),_0x2be0('0x127'),_0x2be0('0x128'),_0x2be0('0x129'),'clientId',_0x2be0('0x12a'),_0x2be0('0x12b'),_0x2be0('0x12c'),_0x2be0('0x12d'),_0x2be0('0x12e'),_0x2be0('0x12f'),_0x2be0('0x130'),_0x2be0('0x131'),_0x2be0('0x132'),_0x2be0('0x133'),_0x2be0('0x134'),_0x2be0('0x135'),_0x2be0('0x136'),'calleridname',_0x2be0('0x137'),_0x2be0('0x138'),_0x2be0('0x139'),'clientEmail',_0x2be0('0x13a'),'accesskeyid','secretaccesskey',_0x2be0('0x13b'),_0x2be0('0x15'),'pass',_0x2be0('0x13c'),'localstationid',_0x2be0('0x13d'),'secret',_0x2be0('0x13e'),_0x2be0('0x13f')];function maskSensitiveData(_0x53f049){var _0x5de3c3=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x53f049))return;for(var _0x579f3a in _0x53f049){if(_['isArray'](_0x53f049[_0x579f3a])){for(var _0xcf444e=0x0;_0xcf444e<_0x53f049[_0x579f3a][_0x2be0('0x140')];_0xcf444e++){maskSensitiveData(_0x53f049[_0x579f3a][_0xcf444e]);}}else if(_[_0x2be0('0x141')](_0x53f049[_0x579f3a])){maskSensitiveData(_0x53f049[_0x579f3a]);}else if(_[_0x2be0('0x142')](_0x53f049[_0x579f3a])){_0x53f049[_0x579f3a]=_0x53f049[_0x579f3a][_0x2be0('0x143')](/{{{/g,_0x2be0('0x144'))[_0x2be0('0x143')](/}}}/g,_0x2be0('0x145'))['replace'](/{{/g,'@{')[_0x2be0('0x143')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x579f3a)){_0x53f049[_0x579f3a]=_0x53f049[_0x579f3a][_0x2be0('0x143')](_0x5de3c3,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index b4983b0..6a21801 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xf522=['../api/openchannelQueue/openchannelQueue.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/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.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/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.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/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.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/openchannelInteraction/openchannelInteraction.rpc'];(function(_0x5105ea,_0x11f948){var _0x4b31f3=function(_0x4dcca3){while(--_0x4dcca3){_0x5105ea['push'](_0x5105ea['shift']());}};_0x4b31f3(++_0x11f948);}(_0xf522,0x7b));var _0x2f52=function(_0x2ef5ec,_0x2e2117){_0x2ef5ec=_0x2ef5ec-0x0;var _0x125e79=_0xf522[_0x2ef5ec];return _0x125e79;};'use strict';var jayson=require(_0x2f52('0x0'));var BPromise=require(_0x2f52('0x1'));var _=require(_0x2f52('0x2'));var config=require(_0x2f52('0x3'));exports[_0x2f52('0x4')]=function(){return new BPromise(function(_0x1f4734,_0x217017){var _0x4f95c1={};_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x5')));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x6')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x8')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x9')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0xa')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0xb')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0xc')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0xd')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0xe')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0xf')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x10')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x11')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/mailQueue/mailQueue.rpc'));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x12')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x13')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x14')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/faxAccount/faxAccount.rpc'));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x15')));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x16')));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x17')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x18')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x19')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/smsAccount/smsAccount.rpc'));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x1a')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x1b')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x1c')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x1d')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x1e')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x1f')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x20')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x21')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x22')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x23')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x24')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x25')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x26')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x27')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x28')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/interval/interval.rpc'));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x29')));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x2a')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x2b')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x2c')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x2d')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x2e')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x2f')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x30')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x31')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x32')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x33')));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x34')));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x35')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x36')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x37')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x38')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x39')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x3a')));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x3b')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x3c')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x3d')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x3e')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x3f')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/plugin/plugin.rpc'));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x40')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x41')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x42')));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x43')));var _0x480ec5=jayson[_0x2f52('0x44')](_0x4f95c1)['http']();var _0x598b3b=config[_0x2f52('0x45')]['port']||config[_0x2f52('0x46')]+0x1;var _0x79d979=config[_0x2f52('0x45')]['ip']||_0x2f52('0x47');_0x480ec5['on'](_0x2f52('0x48'),function(_0x5eb95e){return _0x217017(_0x5eb95e);});_0x480ec5[_0x2f52('0x4')](_0x598b3b,_0x79d979,function(){console['log'](_0x2f52('0x49'),_0x79d979,_0x598b3b);require(_0x2f52('0x4a'))[_0x2f52('0x4b')]();return _0x1f4734(_0x2f52('0x4c')+_0x79d979+':'+_0x598b3b);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 098d5b1..b464d43 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 _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 +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(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIReply=require(_0x49c4('0x2'));var AGIError=require(_0x49c4('0x3'));function AGIChannel(_0x455700){var _0x2ad237=this,_0x4e0313=new AGIReply(),_0x4941f1=![],_0x41a183={};EventEmitter['call'](_0x2ad237);_0x455700[_0x49c4('0x4')](_0x49c4('0x5'));_0x455700[_0x49c4('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4e0313[_0x49c4('0x4')](_0x49c4('0x5'));_0x4e0313['on']('headers',function(_0x11c586){for(var _0x42e4f8 in _0x11c586){_0x2ad237[_0x42e4f8]=_0x11c586[_0x42e4f8];}_0x2ad237[_0x49c4('0x7')](_0x49c4('0x8'));});_0x4e0313['on']('line',function(_0x5ab4a3){if(_0x5ab4a3[_0x49c4('0x9')]()==_0x49c4('0xa')){_0x2ad237['emit'](_0x49c4('0xa'));return;}if(_0x5ab4a3[_0x49c4('0xb')](0x0,0xb)=='520-Invalid'){_0x4941f1=!![];}if(_0x4941f1){_0x41a183['rx']+=_0x5ab4a3+'\x0a';if(_0x5ab4a3['search'](_0x49c4('0xc'))!=-0x1){_0x4941f1=![];}}else{_0x41a183['rx']=_0x5ab4a3;}if(_0x4941f1){return;}if(typeof _0x41a183['cb']==_0x49c4('0xd')){var _0x5487cd=_0x41a183['rx']['substring'](0x0,0x3),_0x7df3a9=null,_0x403bfb=null;_0x5487cd=parseInt(_0x5487cd);if(isNaN(_0x5487cd)){_0x41a183['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x49c4('0xe')});return;}if(_0x5487cd!=0xc8){_0x41a183['cb'](null,{'code':_0x5487cd,'result':-0x1,'extra':'KO'});return;}_0x7df3a9=_0x41a183['rx'][_0x49c4('0xb')](0x4)[_0x49c4('0xf')](_0x49c4('0x10'),'');if(_0x7df3a9[_0x49c4('0x11')]('\x20')!=-0x1){_0x7df3a9=_0x7df3a9[_0x49c4('0x12')](0x0,_0x7df3a9[_0x49c4('0x11')]('\x20'));}if(_[_0x49c4('0x13')](_0x7df3a9,'-1')){_0x7df3a9=parseInt(_0x7df3a9);}_0x403bfb=_0x41a183['rx']['split']('\x20');if(_0x403bfb[_0x49c4('0x14')]==0x3){_0x403bfb=_0x403bfb[0x2][_0x49c4('0xb')](0x1,_0x403bfb[0x2][_0x49c4('0x14')]-0x1);}else if(_0x403bfb[_0x49c4('0x14')]>0x3){var _0x2abc78=/\((.+)\)/;var _0x53e3a2=_0x41a183['rx'][_0x49c4('0x15')](_0x2abc78);if(_0x53e3a2){_0x403bfb=_0x53e3a2[0x1];}else{_0x403bfb=null;}}else{_0x403bfb=null;}_0x41a183['cb'](null,{'code':_0x5487cd,'result':_0x7df3a9,'extra':_0x403bfb});}});_0x455700['on'](_0x49c4('0x16'),function(_0x4c3253){_0x2ad237['emit'](_0x49c4('0x16'),new AGIError(_0x49c4('0x17'),_0x4c3253[_0x49c4('0x18')]));});_0x455700['on']('close',function(){_0x2ad237[_0x49c4('0x7')]('close',new AGIError(_0x49c4('0x19')));});_0x455700['on'](_0x49c4('0x1a'),function(){_0x2ad237[_0x49c4('0x7')](_0x49c4('0x1a'),new AGIError(_0x49c4('0x1b')));_0x455700[_0x49c4('0x1c')]();});_0x455700[_0x49c4('0x1d')](_0x4e0313);this[_0x49c4('0x1e')]=function(_0x2197d2,_0x578447){var _0x2197d2=_0x2197d2||'',_0x578447=typeof _0x578447==_0x49c4('0xd')?_0x578447:new Function();_0x41a183={'tx':_0x2197d2,'rx':'','cb':_0x578447};_0x455700['write'](_0x2197d2+'\x0a');},this['close']=function(){_0x455700[_0x49c4('0x1c')]();};}util[_0x49c4('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x49c4('0x20')][_0x49c4('0x21')]=function(_0x4811c4){return this['command'][_0x49c4('0x22')](this,_0x4811c4);};AGIChannel[_0x49c4('0x20')]['answer']=function(){return this[_0x49c4('0x21')](_0x49c4('0x23'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x24')]=function(_0x531d92,_0x543ea2,_0x449960){_0x531d92=_0x531d92===undefined?'beep':_0x531d92;_0x543ea2=_0x543ea2===undefined?'5':_0x543ea2;_0x449960=_0x449960===undefined?'1':_0x449960;return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x26'),_0x531d92,_0x543ea2*0x3e8,_0x449960));};AGIChannel[_0x49c4('0x20')]['noop']=function(_0x889909){_0x889909=_0x889909||_0x49c4('0x27');return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x28'),_0x889909));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x29')]=function(_0x427b26,_0x17b50f){if(_[_0x49c4('0x2a')](_0x17b50f)){return this[_0x49c4('0x21')](util['format']('EXEC\x20%s\x20%s',_0x427b26,_0x17b50f['join'](',')));}return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2b'),_0x427b26,_0x17b50f));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2c')]=function(_0x574fd3){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2d'),_0x574fd3));};AGIChannel[_0x49c4('0x20')]['setExtension']=function(_0x57a29c){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2e'),_0x57a29c));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2f')]=function(_0x4a0c7a){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x30'),_0x4a0c7a));};AGIChannel['prototype']['hangup']=function(){return this[_0x49c4('0x21')](_0x49c4('0x31'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x32')]=function(_0x2b45a1,_0x2cf897){var _0x1d1557=_[_0x49c4('0x33')](_0x2cf897)||_[_0x49c4('0x34')](_0x2cf897)?_0x2cf897['toString']():_0x2cf897;return this[_0x49c4('0x21')](util['format'](_0x49c4('0x35'),_0x2b45a1,_0x1d1557?_0x1d1557[_0x49c4('0x36')]()[_0x49c4('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x49c4('0x20')]['sayNumber']=function(_0x335f0c,_0x31f3ff){return this[_0x49c4('0x21')](util['format'](_0x49c4('0x37'),_0x335f0c,_0x31f3ff));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x38')]=function(_0x5e5366,_0x1ba7a0){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x39'),_0x5e5366,_0x1ba7a0));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3a')]=function(_0x1e506a,_0x4e0663){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x3b'),_0x1e506a,_0x4e0663));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3c')]=function(_0x29dd5d,_0x1be62d,_0xc9722b){_0x1be62d=_0x1be62d||this[_0x49c4('0x3d')];_0xc9722b=_0xc9722b||0x1;this[_0x49c4('0x2c')](_0x29dd5d);this[_0x49c4('0x3e')](_0x1be62d);this[_0x49c4('0x2f')](_0xc9722b);return this[_0x49c4('0x3f')](util['format'](_0x49c4('0x40'),_0x29dd5d,_0x1be62d,_0xc9722b));};AGIChannel['prototype'][_0x49c4('0x41')]=function(_0x4915bc){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x42'),_0x4915bc));};AGIChannel[_0x49c4('0x20')]['recordFile']=function(_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x117151,_0x490823){_0x20490b=_0x20490b||_0x49c4('0x43');_0x1e7bdc=_0x1e7bdc||'';_0x38349b=_0x38349b===undefined?-0x1:_0x38349b==='-1'?-0x1:_0x38349b*0x3e8;_0x117151=_0x117151===undefined?'':'s='+_0x117151;_0x490823=_0x490823?_0x49c4('0x44'):'';return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x45'),_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x490823,_0x117151));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x46')]=function(_0x3351c1,_0x3c4a1d){_0x3c4a1d=_0x3c4a1d||'';return this['sendRequest'](util[_0x49c4('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3351c1,_0x3c4a1d));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x47')]=function(_0x301def){return this[_0x49c4('0x29')](_0x49c4('0x48'),_0x301def);};AGIChannel['prototype'][_0x49c4('0x49')]=function(_0x15b674){return this[_0x49c4('0x29')](_0x49c4('0x4a'),_0x15b674);};AGIChannel[_0x49c4('0x20')][_0x49c4('0x16')]=function(_0x9779ef,_0x4d89e0){this[_0x49c4('0x3f')](util['format'](_0x49c4('0x4b'),_0x9779ef['id'],_0x9779ef[_0x49c4('0x4c')],_0x4d89e0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x49c4('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index e31dafe..466ee6f 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 _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 +var _0x2a31=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2a31,0xe4));var _0x12a3=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x2a31[_0x18ab2a];return _0x16dcee;};'use strict';var util=require(_0x12a3('0x0'));var error={'E_AGI_UNDEFINED':_0x12a3('0x1'),'E_AGI_ARGUMENT_PORT':_0x12a3('0x2'),'E_AGI_SERVER_ERROR':_0x12a3('0x3'),'E_AGI_SERVER_CLOSE':_0x12a3('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x12a3('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x12a3('0x6'),'E_AGI_SOCKET_ERROR':_0x12a3('0x7'),'E_AGI_SOCKET_CLOSE':_0x12a3('0x8'),'E_AGI_SOCKET_TIMEOUT':_0x12a3('0x9'),'E_AGI_COMMAND_EMPTY':_0x12a3('0xa'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x12a3('0xb'),'E_AGI_IVR_ENTRY':_0x12a3('0xc')};function AGIError(_0x23df3e){var _0x23df3e=_0x23df3e||null,_0xcf401f=_0xcf401f||[],_0x5e24b3=0x1,_0x25703e='';if(!error[_0x23df3e]){_0x23df3e='E_AGI_UNDEFINED';}_0xcf401f[_0x12a3('0xd')](error[_0x23df3e]);while(arguments[_0x5e24b3]){_0xcf401f['push'](arguments[_0x5e24b3]);_0x5e24b3++;}_0x25703e=util[_0x12a3('0xe')]['apply'](util,_0xcf401f);this[_0x12a3('0xf')]=_0x25703e;this[_0x12a3('0x10')]=_0x23df3e;}module[_0x12a3('0x11')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 667bf06..a8a88bb 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 _0xb9a7=['getsecretdigits','edges','numberOfEdges','prototype','addVertex','vertices','addEdge','size','getVertex','traverseBFS','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','menu','invalid','max\x20retry\x20reach','exports','../../../config/logger'];(function(_0x475157,_0x4282f6){var _0x154766=function(_0x925df7){while(--_0x925df7){_0x475157['push'](_0x475157['shift']());}};_0x154766(++_0x4282f6);}(_0xb9a7,0x112));var _0x7b9a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xb9a7[_0x21549c];return _0x426cbd;};'use strict';var _=require('lodash');var logger=require(_0x7b9a('0x0'))('agi');var verticesWithRetry=['menu','getdigits',_0x7b9a('0x1')];var Graph=function(){this['vertices']={};this[_0x7b9a('0x2')]={};this[_0x7b9a('0x3')]=0x0;};Graph[_0x7b9a('0x4')][_0x7b9a('0x5')]=function(_0x5cd5da){this[_0x7b9a('0x6')][_0x5cd5da['id']]=_0x5cd5da;this[_0x7b9a('0x2')][_0x5cd5da['id']]=[];};Graph[_0x7b9a('0x4')][_0x7b9a('0x7')]=function(_0x3e51f0,_0x4d3f20,_0x43d8e2){this[_0x7b9a('0x2')][_0x3e51f0]['push']({'target':_0x4d3f20,'condition':_0x43d8e2});this['numberOfEdges']+=0x1;};Graph['prototype'][_0x7b9a('0x8')]=function(){return _[_0x7b9a('0x8')](this['vertices']);};Graph[_0x7b9a('0x4')]['relations']=function(){return this[_0x7b9a('0x3')];};Graph['prototype'][_0x7b9a('0x9')]=function(_0x1584a2){return this[_0x7b9a('0x6')][_0x1584a2];};Graph['prototype'][_0x7b9a('0xa')]=function(_0xec5949,_0x5e3875){if(!this[_0x7b9a('0x6')][_0xec5949]){return logger[_0x7b9a('0xb')]('no\x20vertex\x20found');}var _0xb157e5=_0x5e3875(this[_0x7b9a('0x6')][_0xec5949]);if(!_0xb157e5){return logger[_0x7b9a('0xb')](_0x7b9a('0xc'));}if(this[_0x7b9a('0x2')][_0xec5949][_0x7b9a('0xd')]===0x0){return logger[_0x7b9a('0xb')](_0x7b9a('0xe'));}for(var _0x2f1899=0x0,_0x4996f1=[],_0x34a82d=![];_0x2f1899\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 +var _0x4b19=['variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','response','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','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','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','xml2json','syncho','util','moment','../../config/logger','agi','../../config/license/util','./mailRpc','./graph','defaults','127.0.0.1','nextTick','error','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','evtHangup','toJson','mxGraphModel','root','agicommand','retry','addVertex','omit','mxCell','hasOwnProperty','length','source','target','addEdge','value','getSquareProject','catch','createSquareReport','then','substring','inspect','debug'];(function(_0x4719b1,_0x4d3628){var _0x5cc325=function(_0x593a4d){while(--_0x593a4d){_0x4719b1['push'](_0x4719b1['shift']());}};_0x5cc325(++_0x4d3628);}(_0x4b19,0x195));var _0x94b1=function(_0x31f64e,_0x55888a){_0x31f64e=_0x31f64e-0x0;var _0x358617=_0x4b19[_0x31f64e];return _0x358617;};'use strict';var parser=require(_0x94b1('0x0'));var _=require('lodash');var syncho=require(_0x94b1('0x1'));var util=require(_0x94b1('0x2'));var moment=require(_0x94b1('0x3'));var config=require('../../config/environment');var logger=require(_0x94b1('0x4'))(_0x94b1('0x5'));var utilLicense=require(_0x94b1('0x6'));var rpc=require('./rpc');var mailRpc=require(_0x94b1('0x7'));var Graph=require(_0x94b1('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x94b1('0x5')]=_[_0x94b1('0x9')](config['agi'],{'ip':_0x94b1('0xa'),'port':0x11dd});function connectionHandler(_0x201a02){process[_0x94b1('0xb')](function(){syncho(function(){try{setChannelVariables(_0x201a02);agiHandler(_0x201a02);}catch(_0x5aee5f){logger[_0x94b1('0xc')](_0x5aee5f['stack']);}});});}function listeningHandler(){console['log'](_0x94b1('0xd'),config[_0x94b1('0x5')][_0x94b1('0xe')]);logger[_0x94b1('0xf')](util[_0x94b1('0x10')](_0x94b1('0x11'),config['agi']['ip'],config[_0x94b1('0x5')][_0x94b1('0xe')]));}function errorHandler(_0x340a29){if(_0x340a29&&_0x340a29[_0x94b1('0x12')]&&_0x340a29['message']){logger['error'](util[_0x94b1('0x10')](_0x94b1('0x13'),_0x340a29['name'],_0x340a29['message']));}else{logger[_0x94b1('0xc')](util[_0x94b1('0x10')]('[ERROR]\x20%s',_0x340a29[_0x94b1('0x14')]));}}function closeHandler(){logger['info'](util['format'](_0x94b1('0x15'),this[_0x94b1('0x16')],this[_0x94b1('0x17')],this[_0x94b1('0x18')],this['dnid'],this[_0x94b1('0x19')]));try{createSquareReport(this);}catch(_0x424c45){logger[_0x94b1('0xc')](_0x424c45[_0x94b1('0x14')]);}}function timeoutHandler(){logger[_0x94b1('0xf')](util[_0x94b1('0x10')](_0x94b1('0x1a'),this['arg_1'],this[_0x94b1('0x17')],this[_0x94b1('0x18')],this[_0x94b1('0x1b')],this['uniqueid']));}function hangupHandler(){logger[_0x94b1('0xf')](util[_0x94b1('0x10')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x94b1('0x16')],this[_0x94b1('0x17')],this[_0x94b1('0x18')],this[_0x94b1('0x1b')],this[_0x94b1('0x19')]));this[_0x94b1('0x1c')]=!![];}function getRoot(_0x36180a){return parser[_0x94b1('0x1d')](_0x36180a,{'object':!![]})[_0x94b1('0x1e')][_0x94b1('0x1f')];}function addVertex(_0x49c248,_0xa333a8,_0xa112b1){_0xa333a8[_0x94b1('0x20')]=_0xa112b1;if(_0xa333a8['hasOwnProperty'](_0x94b1('0x21'))){_0xa333a8['maxRetry']=parseInt(_0xa333a8[_0x94b1('0x21')],0xa);}_0x49c248[_0x94b1('0x22')](_[_0x94b1('0x23')](_0xa333a8,_0x94b1('0x24')));}function initGraph(_0x5ad3e4,_0x4ea6d9){var _0x1d6ea6=new Graph();for(var _0x4d5685 in _0x5ad3e4){if(_0x5ad3e4[_0x94b1('0x25')](_0x4d5685)){if(_['isArray'](_0x5ad3e4[_0x4d5685])){for(var _0x4694de=0x0;_0x4694de<_0x5ad3e4[_0x4d5685][_0x94b1('0x26')];_0x4694de+=0x1){addVertex(_0x1d6ea6,_0x5ad3e4[_0x4d5685][_0x4694de],_0x4d5685);}}else{addVertex(_0x1d6ea6,_0x5ad3e4[_0x4d5685],_0x4d5685);}}}for(var _0x1eda8c=0x0;_0x1eda8c<_0x4ea6d9['length'];_0x1eda8c+=0x1){if(_0x4ea6d9[_0x1eda8c][_0x94b1('0x27')]&&_0x4ea6d9[_0x1eda8c][_0x94b1('0x28')]){_0x1d6ea6[_0x94b1('0x29')](_0x4ea6d9[_0x1eda8c][_0x94b1('0x27')],_0x4ea6d9[_0x1eda8c][_0x94b1('0x28')],_0x4ea6d9[_0x1eda8c][_0x94b1('0x2a')]);}}return _0x1d6ea6;}function getSquareProject(_0x2661ca,_0xcd778f){rpc[_0x94b1('0x2b')](_0x2661ca)['then'](function(_0x2eb1fa){_0xcd778f(null,_0x2eb1fa);})[_0x94b1('0x2c')](function(_0x47f019){_0xcd778f(null,_0x47f019);});}function createSquareReport(_0x42630a,_0x1fe766){rpc[_0x94b1('0x2d')](_0x42630a)[_0x94b1('0x2e')](function(_0x28dc1d){if(_0x1fe766){_0x1fe766(null,_0x28dc1d);}})[_0x94b1('0x2c')](function(_0x5a5148){if(_0x1fe766){_0x1fe766(null,_0x5a5148);}});}function setChannelVariables(_0x1a26eb){for(var _0x5d765b in _0x1a26eb){if(_0x1a26eb[_0x94b1('0x25')](_0x5d765b)){if(_0x5d765b['indexOf']('agi_')===0x0){_0x1a26eb[_0x5d765b[_0x94b1('0x2f')](0x4)]=_0x1a26eb[_0x5d765b];delete _0x1a26eb[_0x5d765b];}}}}function getLogFromObject(_0x171d44){return util[_0x94b1('0x30')](_0x171d44,{'showHidden':![],'depth':null});}function agiHandler(_0x44e595){var _0x35b97c,_0x195514,_0x26f33d,_0x19511b,_0x288ae5;logger[_0x94b1('0x31')](_0x94b1('0x32'),JSON[_0x94b1('0x33')](_0x44e595,null,0x2));logger['info'](util['format'](_0x94b1('0x34'),_0x44e595[_0x94b1('0x16')],_0x44e595[_0x94b1('0x17')],_0x44e595[_0x94b1('0x18')],_0x44e595[_0x94b1('0x1b')],_0x44e595[_0x94b1('0x19')]));_0x44e595['on'](_0x94b1('0xc'),errorHandler);_0x44e595['on'](_0x94b1('0x35'),closeHandler);_0x44e595['on'](_0x94b1('0x36'),timeoutHandler);_0x44e595['evtHangup']=![];_0x44e595['on'](_0x94b1('0x37'),hangupHandler);var _0x4d18e8=getSquareProject[_0x94b1('0x38')](null,_0x44e595[_0x94b1('0x16')]);if(_0x4d18e8){if(_0x4d18e8[_0x94b1('0x39')]){_0x35b97c=getRoot(_0x4d18e8['production']);if(_0x35b97c&&_0x35b97c[_0x94b1('0x3a')]){logger[_0x94b1('0x31')](_0x94b1('0x1f'),JSON['stringify'](_0x35b97c,null,0x2));_0x44e595[_0x94b1('0x3b')]=moment()[_0x94b1('0x10')](_0x94b1('0x3c'));_0x195514=initGraph(_[_0x94b1('0x23')](_0x35b97c,_0x94b1('0x24')),_0x35b97c[_0x94b1('0x24')]);_0x26f33d=new Vertices(_0x44e595,rpc,mailRpc);logger[_0x94b1('0xf')](util[_0x94b1('0x10')](_0x94b1('0x3d'),_0x44e595[_0x94b1('0x16')],_0x44e595[_0x94b1('0x17')],_0x44e595[_0x94b1('0x18')],_0x44e595[_0x94b1('0x1b')],_0x44e595['uniqueid']));_0x195514[_0x94b1('0x3e')](_0x35b97c[_0x94b1('0x3a')]['id'],function(_0xf29a10){try{_0xf29a10=_0x26f33d[_0x94b1('0x3f')](_0xf29a10);logger[_0x94b1('0x31')]('vertex',JSON[_0x94b1('0x33')](_0xf29a10,null,0x2));if(_0xf29a10[_0x94b1('0x20')]===_0x94b1('0x40')){logger[_0x94b1('0xf')](_0x94b1('0x41'));_0x44e595[_0x94b1('0x42')]=_0xf29a10['context']||_0x44e595[_0x94b1('0x42')];_0x44e595[_0x94b1('0x43')]=_0xf29a10['extension'];_0x44e595[_0x94b1('0x44')]=_0xf29a10[_0x94b1('0x44')]?_0xf29a10['priority']-0x1:0x1;return null;}else if(_0xf29a10&&_0x26f33d[_0xf29a10[_0x94b1('0x20')]]){_0x288ae5=_0x26f33d[_0xf29a10[_0x94b1('0x20')]](_0xf29a10);logger[_0x94b1('0xf')]('response',JSON[_0x94b1('0x33')](_0x288ae5,null,0x2));if(_0x288ae5&&_0x288ae5[_0x94b1('0x45')]===AGI_CODE_SUCCESS&&_0x288ae5[_0x94b1('0x46')]!==AGI_RESULT_ERROR&&!_0x44e595[_0x94b1('0x1c')]){logger[_0x94b1('0x31')](_0x94b1('0x47'),getLogFromObject(_0x288ae5));return _[_0x94b1('0x48')](_0x288ae5['result'])?null:_0x288ae5[_0x94b1('0x46')][_0x94b1('0x49')]();}else{logger[_0x94b1('0xc')]('response',getLogFromObject(_0x288ae5));return null;}}else{logger[_0x94b1('0xc')](_0x94b1('0x4a'));return null;}}catch(_0x5323c2){logger[_0x94b1('0xc')](_0x5323c2[_0x94b1('0x14')]);return null;}});if(_0x35b97c[_0x94b1('0x4b')]){logger[_0x94b1('0xf')](util[_0x94b1('0x10')](_0x94b1('0x4c'),_0x44e595[_0x94b1('0x16')],_0x44e595[_0x94b1('0x17')],_0x44e595[_0x94b1('0x18')],_0x44e595[_0x94b1('0x1b')],_0x44e595[_0x94b1('0x19')]));_0x195514[_0x94b1('0x3e')](_0x35b97c[_0x94b1('0x4b')]['id'],function(_0x7753ff){try{_0x7753ff=_0x26f33d[_0x94b1('0x3f')](_0x7753ff);logger[_0x94b1('0x31')](_0x94b1('0x4d'),JSON[_0x94b1('0x33')](_0x7753ff,null,0x2));if(_0x7753ff&&_0x26f33d[_0x7753ff[_0x94b1('0x20')]]){_0x288ae5=_0x26f33d[_0x7753ff['agicommand']](_0x7753ff);if(_0x288ae5){logger[_0x94b1('0x31')]('response',getLogFromObject(_0x288ae5));return _[_0x94b1('0x48')](_0x288ae5[_0x94b1('0x46')])?null:_0x288ae5[_0x94b1('0x46')]['toString']();}else{logger['error']('response',getLogFromObject(_0x288ae5));return null;}}else{logger[_0x94b1('0xc')](_0x94b1('0x4a'));return null;}}catch(_0x276ab1){logger['error'](_0x276ab1['stack']);return null;}});}logger['info'](util[_0x94b1('0x10')](_0x94b1('0x4e'),_0x44e595[_0x94b1('0x16')],_0x44e595[_0x94b1('0x17')],_0x44e595[_0x94b1('0x18')],_0x44e595[_0x94b1('0x1b')],_0x44e595[_0x94b1('0x19')]));logger['info'](util[_0x94b1('0x10')](_0x94b1('0x4f'),_0x44e595[_0x94b1('0x42')],_0x44e595[_0x94b1('0x43')],parseInt(_0x44e595[_0x94b1('0x44')],0xa)+0x1));_0x44e595[_0x94b1('0x50')](_0x44e595[_0x94b1('0x42')],_0x44e595[_0x94b1('0x43')],parseInt(_0x44e595[_0x94b1('0x44')],0xa)+0x1);_0x44e595[_0x94b1('0x35')]();}}else{logger[_0x94b1('0xc')](util[_0x94b1('0x10')](_0x94b1('0x51'),_0x44e595[_0x94b1('0x16')]));_0x44e595['continueAt'](_0x44e595[_0x94b1('0x42')],_0x44e595[_0x94b1('0x43')],parseInt(_0x44e595[_0x94b1('0x44')],0xa)+0x1);_0x44e595[_0x94b1('0x35')]();}}else{logger[_0x94b1('0xc')](util[_0x94b1('0x10')](_0x94b1('0x52'),_0x44e595[_0x94b1('0x16')]));_0x44e595[_0x94b1('0x50')](_0x44e595['context'],_0x44e595[_0x94b1('0x43')],parseInt(_0x44e595[_0x94b1('0x44')],0xa)+0x1);_0x44e595[_0x94b1('0x35')]();}}function main(){var _0x29ccc4;return utilLicense[_0x94b1('0x53')]()[_0x94b1('0x2e')](function(_0x572657){if(_0x572657){if(_0x572657[_0x94b1('0x54')]){if(_0x572657[_0x94b1('0x55')]&&_0x572657[_0x94b1('0x55')]>0x0){logger[_0x94b1('0xf')](util[_0x94b1('0x10')](_0x94b1('0x56'),_0x572657[_0x94b1('0x55')]));_0x29ccc4=_0x572657[_0x94b1('0x55')];}else{logger[_0x94b1('0xf')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info'](_0x94b1('0x57'));_0x29ccc4=-0x1;}}})[_0x94b1('0x2c')](function(_0x13228e){logger[_0x94b1('0xc')](_0x94b1('0x58'),_0x13228e[_0x94b1('0x14')]);})[_0x94b1('0x4b')](function(){var _0xcdf3e8=require(_0x94b1('0x59'))(config[_0x94b1('0x5')][_0x94b1('0xe')],config[_0x94b1('0x5')]['ip'],_0x29ccc4);_0xcdf3e8['on'](_0x94b1('0xc'),errorHandler);_0xcdf3e8['on']('listening',listeningHandler);_0xcdf3e8['on'](_0x94b1('0x5a'),connectionHandler);_0xcdf3e8['on'](_0x94b1('0x35'),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 47c44da..720472d 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 _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 +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x57cb64,_0x27dcb8){var _0x308fdb=function(_0x249c8f){while(--_0x249c8f){_0x57cb64['push'](_0x57cb64['shift']());}};_0x308fdb(++_0x27dcb8);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 89e4148..b4c5a91 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(_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 +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(_0x35795f,_0x48b488){var _0x33faa4=function(_0x5db996){while(--_0x5db996){_0x35795f['push'](_0x35795f['shift']());}};_0x33faa4(++_0x48b488);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2d7efe,_0x53745b){_0x2d7efe=_0x2d7efe-0x0;var _0x52a346=_0x5f2f[_0x2d7efe];return _0x52a346;};'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 24e6491..b66115c 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 _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 +var _0x3f9d=['getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','ShowSound','getIntervalById','ShowInterval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','bluebird','lodash','util','jayson/promise','client','http','request','then','error','message','result','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById'];(function(_0x3e8e79,_0x1c865c){var _0x4e2039=function(_0x47b214){while(--_0x47b214){_0x3e8e79['push'](_0x3e8e79['shift']());}};_0x4e2039(++_0x1c865c);}(_0x3f9d,0x12e));var _0xd3f9=function(_0x152ef7,_0x221f4c){_0x152ef7=_0x152ef7-0x0;var _0x33b535=_0x3f9d[_0x152ef7];return _0x33b535;};'use strict';var BPromise=require(_0xd3f9('0x0'));var moment=require('moment');var _=require(_0xd3f9('0x1'));var util=require(_0xd3f9('0x2'));var jayson=require(_0xd3f9('0x3'));var client=jayson[_0xd3f9('0x4')][_0xd3f9('0x5')]({'port':0x2329});function request(_0x10ffea,_0x4de754){return new BPromise(function(_0x507b8e,_0x2265c9){return client[_0xd3f9('0x6')](_0x10ffea,_0x4de754)[_0xd3f9('0x7')](function(_0x4d91b3){if(_0x4d91b3[_0xd3f9('0x8')]){return _0x2265c9(_0x4d91b3[_0xd3f9('0x8')][_0xd3f9('0x9')]);}else{return _0x507b8e(_0x4d91b3[_0xd3f9('0xa')]);}})['catch'](function(_0x56157e){return _0x2265c9(_0x56157e);});});}exports['getSquareProject']=function(_0x4ece98){return request(_0xd3f9('0xb'),{'options':{'raw':![],'where':{'name':_0x4ece98},'attributes':[_0xd3f9('0xc')]}});};exports[_0xd3f9('0xd')]=function(_0xfde804){return request(_0xd3f9('0xe'),{'options':{'raw':![],'where':{'id':_0xfde804},'include':[{'model':_0xd3f9('0xf'),'as':_0xd3f9('0x10')}],'attributes':['id',_0xd3f9('0x11'),_0xd3f9('0x12')]}});};exports[_0xd3f9('0x13')]=function(_0x526dd3){return request(_0xd3f9('0xb'),{'options':{'where':{'id':_0x526dd3},'attributes':[_0xd3f9('0x11')]}});};exports['getVoiceQueueById']=function(_0x5a8970){return request(_0xd3f9('0x14'),{'options':{'where':{'id':_0x5a8970},'attributes':[_0xd3f9('0x11')]}});};exports[_0xd3f9('0x15')]=function(_0x581d58){return request('ShowVariable',{'options':{'where':{'id':_0x581d58},'attributes':[_0xd3f9('0x11')]}});};exports[_0xd3f9('0x16')]=function(_0x59856c){return request(_0xd3f9('0x17'),{'options':{'where':{'id':_0x59856c},'attributes':['dsn']}});};exports[_0xd3f9('0x18')]=function(_0x231dc4){return request(_0xd3f9('0x19'),{'options':{'where':{'id':_0x231dc4},'attributes':[_0xd3f9('0x11')]}});};exports['getTrunkById']=function(_0x57ed1b){return request('ShowTrunk',{'options':{'where':{'id':_0x57ed1b},'attributes':[_0xd3f9('0x11')]}});};exports['getSoundById']=function(_0x2c0081){return request(_0xd3f9('0x1a'),{'options':{'where':{'id':_0x2c0081},'attributes':['save_name']}});};exports[_0xd3f9('0x1b')]=function(_0x1b0092){return request(_0xd3f9('0x1c'),{'options':{'raw':![],'where':{'id':_0x1b0092},'include':[{'model':'Interval','as':_0xd3f9('0x1d')}]}});};exports[_0xd3f9('0x1e')]=function(_0x1f58bc){return request('ShowSmsAccount',{'options':{'where':{'id':_0x1f58bc},'attributes':['id',_0xd3f9('0x11')]}});};exports[_0xd3f9('0x1f')]=function(_0xe78640){return request(_0xd3f9('0x20'),{'body':_0xe78640});};exports['createSquareDetailsReport']=function(_0xb6cdd5){return request('CreateSquareDetailsReport',{'body':_0xb6cdd5});};exports[_0xd3f9('0x21')]=function(_0x15e0a4){return request(_0xd3f9('0x22'),{'body':_[_0xd3f9('0x23')](_0x15e0a4,{'project_name':_0x15e0a4[_0xd3f9('0x24')],'prev_project_name':_0x15e0a4[_0xd3f9('0x25')]||'','is_subproject':_0x15e0a4[_0xd3f9('0x25')]?!![]:![],'leaveAt':moment()['format'](_0xd3f9('0x26'))})});};exports['createSquareRecording']=function(_0x589734){return request(_0xd3f9('0x27'),{'body':_0x589734});};exports[_0xd3f9('0x28')]=function(_0x2e2c8f){return request(_0xd3f9('0x29'),{'body':_0x2e2c8f});};exports[_0xd3f9('0x2a')]=function(_0x547f2c){return request(_0xd3f9('0x2b'),{'options':{'raw':![],'where':{'phone':_0x547f2c[_0xd3f9('0x2c')],'ListId':_0x547f2c[_0xd3f9('0x2d')]}}})['then'](function(_0x1f0d3c){if(_0x1f0d3c){return _0x1f0d3c;}return request(_0xd3f9('0x2e'),{'body':_0x547f2c});});};exports['getPauseById']=function(_0x5dd71c){return request(_0xd3f9('0x2f'),{'options':{'where':{'id':_0x5dd71c},'attributes':['name']}});};exports[_0xd3f9('0x30')]=function(_0x45a5c1,_0x3b7bd4){return request(_0xd3f9('0x31'),{'body':{'interface':_0x3b7bd4},'options':{'where':_0x45a5c1}});};exports[_0xd3f9('0x32')]=function(_0x3f3277,_0x1d0e23,_0x1ccf08){return request(_0xd3f9('0x33'),{'body':{'type':_0x1d0e23,'uniqueid':_0x1ccf08},'options':{'where':_0x3f3277}});};exports[_0xd3f9('0x34')]=function(_0x39d2b9){return request('UnpauseUser',{'body':{},'options':{'where':_0x39d2b9}});};exports[_0xd3f9('0x35')]=function(_0x1d4489){return request('LogoutUser',{'body':{},'options':{'where':_0x1d4489}});}; \ 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 b835052..52224f7 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 _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 +var _0x425d=['./polly','exports'];(function(_0x1bcce6,_0x2181ad){var _0x4fc30a=function(_0xbfc481){while(--_0xbfc481){_0x1bcce6['push'](_0x1bcce6['shift']());}};_0x4fc30a(++_0x2181ad);}(_0x425d,0x1e0));var _0xd425=function(_0x44770b,_0x292817){_0x44770b=_0x44770b-0x0;var _0x156812=_0x425d[_0x44770b];return _0x156812;};var polly=require(_0xd425('0x0'));var lex=require('./lex');module[_0xd425('0x1')]={'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 369960c..a676565 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 _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 +var _0x5c37=['./lib/api','exports'];(function(_0x179c0c,_0x20fe42){var _0x2ab663=function(_0x3b9c1f){while(--_0x3b9c1f){_0x179c0c['push'](_0x179c0c['shift']());}};_0x2ab663(++_0x20fe42);}(_0x5c37,0x11e));var _0x75c3=function(_0x4c05da,_0x414720){_0x4c05da=_0x4c05da-0x0;var _0x1614db=_0x5c37[_0x4c05da];return _0x1614db;};'use strict';var lex=require(_0x75c3('0x0'));module[_0x75c3('0x1')]=function(_0x302a73,_0x43cf5a,_0x2a3a11,_0x79e9a5,_0x524eee,_0x1f0ee1){return lex(_0x302a73,_0x43cf5a,_0x2a3a11,_0x79e9a5,_0x524eee,_0x1f0ee1);}; \ 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 6eef777..69cdc6a 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 _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 +var _0xc001=['aws-sdk','postText','slots','hasOwnProperty','slot_','exports','$LATEST','bluebird'];(function(_0x1e0ca5,_0x57fd4f){var _0x410923=function(_0x5bd94d){while(--_0x5bd94d){_0x1e0ca5['push'](_0x1e0ca5['shift']());}};_0x410923(++_0x57fd4f);}(_0xc001,0x11f));var _0x1c00=function(_0x4b477a,_0x36997d){_0x4b477a=_0x4b477a-0x0;var _0x57e310=_0xc001[_0x4b477a];return _0x57e310;};'use strict';var BPromise=require(_0x1c00('0x0'));var AWS=require(_0x1c00('0x1'));function lexResult(_0x18ae14,_0x24ae54){return new BPromise(function(_0x40a43b,_0x1d14d4){_0x18ae14[_0x1c00('0x2')](_0x24ae54,function(_0x3c40c3,_0x439f08){if(_0x3c40c3){_0x1d14d4(_0x3c40c3);}if(_0x439f08[_0x1c00('0x3')]){for(const _0x256d3c in _0x439f08[_0x1c00('0x3')]){if(_0x439f08[_0x1c00('0x3')][_0x1c00('0x4')](_0x256d3c)){var _0x250be1=_0x439f08[_0x1c00('0x3')][_0x256d3c];_0x439f08[_0x1c00('0x5')+_0x256d3c]=_0x250be1;}}}_0x40a43b(_0x439f08);});});}module[_0x1c00('0x6')]=function(_0x687d4a,_0x51e54b,_0x28766b,_0x412680,_0x2e62d4,_0x3f9dc8){var _0x35c271=new AWS['LexRuntime']({'accessKeyId':_0x51e54b,'secretAccessKey':_0x28766b,'region':_0x412680});var _0x152d0a={'botAlias':_0x1c00('0x7'),'botName':_0x3f9dc8,'inputText':_0x2e62d4,'userId':_0x687d4a};return lexResult(_0x35c271,_0x152d0a);}; \ 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 48f086b..329ea92 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 _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 +var _0xcb49=['./lib/api','exports'];(function(_0x5c7aa1,_0x2a9324){var _0x11a615=function(_0x3f75d4){while(--_0x3f75d4){_0x5c7aa1['push'](_0x5c7aa1['shift']());}};_0x11a615(++_0x2a9324);}(_0xcb49,0x134));var _0x9cb4=function(_0x4c1eec,_0x515aa1){_0x4c1eec=_0x4c1eec-0x0;var _0x5d8475=_0xcb49[_0x4c1eec];return _0x5d8475;};'use strict';var polly=require(_0x9cb4('0x0'));module[_0x9cb4('0x1')]=function(_0x52595d,_0x2f31e9,_0x16633a,_0x4df706,_0x48e003,_0xba8cd1,_0x1dcdb9){return polly(_0x52595d,_0x2f31e9,_0x16633a,_0x4df706,_0x48e003,_0xba8cd1,_0x1dcdb9);}; \ 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 87f00a3..b2fbee9 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 _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 +var _0x732a=['aws-sdk','synthesizeSpeech','writeFile','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','mp3','path','bluebird'];(function(_0x6cb846,_0x289c00){var _0x1d1203=function(_0x502360){while(--_0x502360){_0x6cb846['push'](_0x6cb846['shift']());}};_0x1d1203(++_0x289c00);}(_0x732a,0xf6));var _0xa732=function(_0xcc6ce4,_0x2979cf){_0xcc6ce4=_0xcc6ce4-0x0;var _0x29566e=_0x732a[_0xcc6ce4];return _0x29566e;};'use strict';var fs=require('fs');var path=require(_0xa732('0x0'));var BPromise=require(_0xa732('0x1'));var rs=require('randomstring');var AWS=require(_0xa732('0x2'));function pollyResult(_0x3f1cbc,_0x1cc7f0,_0x470f5d){return new BPromise(function(_0x31620f,_0x45a973){_0x3f1cbc[_0xa732('0x3')](_0x1cc7f0,function(_0x483539,_0x45e2b4){if(_0x483539){_0x45a973(_0x483539);}else if(_0x45e2b4){if(_0x45e2b4['AudioStream']instanceof Buffer){fs[_0xa732('0x4')](_0x470f5d,_0x45e2b4[_0xa732('0x5')],function(_0xbb52ef){if(_0xbb52ef){_0x45a973(_0xbb52ef);}else{_0x31620f();}});}else{_0x45a973(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x45a973(new Error(_0xa732('0x6')));}});});}module['exports']=function(_0x1d751b,_0x441212,_0x31bcae,_0x287541,_0x5d456e,_0x3a64e7,_0x445d21){var _0x1df3b9=new AWS['Polly']({'accessKeyId':_0x1d751b,'secretAccessKey':_0x441212,'region':_0x31bcae});var _0x580857={'Text':_0x5d456e,'TextType':_0x3a64e7||'text','OutputFormat':_0xa732('0x7'),'VoiceId':_0x287541};return pollyResult(_0x1df3b9,_0x580857,_0x445d21);}; \ 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 47e5691..93b0d07 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 _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 +var _0x9f20=['./lib/api','exports'];(function(_0x5ecac8,_0x246286){var _0x255862=function(_0x1a2d83){while(--_0x1a2d83){_0x5ecac8['push'](_0x5ecac8['shift']());}};_0x255862(++_0x246286);}(_0x9f20,0xd2));var _0x09f2=function(_0x3b0881,_0x308388){_0x3b0881=_0x3b0881-0x0;var _0x55adf0=_0x9f20[_0x3b0881];return _0x55adf0;};'use strict';var asr=require(_0x09f2('0x0'));module[_0x09f2('0x1')]=function(_0x548d9b,_0x3348a2,_0x3f2da1,_0x3225db){return asr(_0x548d9b,_0x3348a2,_0x3f2da1);}; \ 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 c09ffba..3f59df4 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 _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 +var _0x7dbf=['8000','url','exports','string','length','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key='];(function(_0x2f4f7a,_0x4b1579){var _0x2fccfc=function(_0x44fecc){while(--_0x44fecc){_0x2f4f7a['push'](_0x2f4f7a['shift']());}};_0x2fccfc(++_0x4b1579);}(_0x7dbf,0x1e1));var _0xf7db=function(_0x304548,_0x1784b2){_0x304548=_0x304548-0x0;var _0x5dd7ad=_0x7dbf[_0x304548];return _0x5dd7ad;};'use strict';var url=require(_0xf7db('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0xf7db('0x1')]=function(_0x4425c5,_0x44cf18,_0x275e0a){return new BPromise(function(_0x477e05,_0x5a371f){var _0x1cf293;if(typeof _0x4425c5!==_0xf7db('0x2')||_0x4425c5[_0xf7db('0x3')]===0x0){return _0x5a371f('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x44cf18!==_0xf7db('0x2')||_0x44cf18['length']===0x0){return _0x5a371f('key\x20should\x20be\x20a\x20string');}if(typeof _0x275e0a!==_0xf7db('0x4')&&(typeof _0x275e0a!==_0xf7db('0x2')||_0x275e0a[_0xf7db('0x3')]===0x0)){return _0x5a371f(_0xf7db('0x5'));}try{_0x1cf293=fs[_0xf7db('0x6')](_0x4425c5)[_0xf7db('0x7')](_0xf7db('0x8'));}catch(_0x543005){return _0x5a371f(_0x543005);}return _0x477e05({'method':_0xf7db('0x9'),'uri':host+_0xf7db('0xa')+_0x44cf18,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xf7db('0xb'),'languageCode':_0x275e0a},'audio':{'content':_0x1cf293}},'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 817a5e2..bd1322c 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 _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 +var _0x6c79=['./asr','exports'];(function(_0x73387a,_0x1c7c0c){var _0x2a8f8b=function(_0x5ef4db){while(--_0x5ef4db){_0x73387a['push'](_0x73387a['shift']());}};_0x2a8f8b(++_0x1c7c0c);}(_0x6c79,0x184));var _0x96c7=function(_0x3b129e,_0x152436){_0x3b129e=_0x3b129e-0x0;var _0x59b675=_0x6c79[_0x3b129e];return _0x59b675;};var asr=require(_0x96c7('0x0'));module[_0x96c7('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 3ee0b05..75838ef 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 _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 +var _0xb659=['allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','fulfillmentText','awsPolly','polly','lex','ispeechTTS','format','ispeechASR','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','bluebird','dialogflow','http','https','md5','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','close','error','unlink','download\x20error','pipe','path','WHAT_EVER','data','end','transcode','wav','error\x20convert','info','finish\x20to\x20convert','resolve','tmp','generate','.wav','base64','then','777','split','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','chmodSync','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','source','result','actionIncomplete','fulfillment','speech','status','metadata','endConversation','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','queryResult','action'];(function(_0x229521,_0x577494){var _0x523a48=function(_0x3d3d18){while(--_0x3d3d18){_0x229521['push'](_0x229521['shift']());}};_0x523a48(++_0x577494);}(_0xb659,0x124));var _0x9b65=function(_0x3512c3,_0x346843){_0x3512c3=_0x3512c3-0x0;var _0x3b2842=_0xb659[_0x3512c3];return _0x3b2842;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x9b65('0x0'));var dialogflow=require(_0x9b65('0x1'));var fs=require('fs');var http=require(_0x9b65('0x2'));var https=require(_0x9b65('0x3'));var md5=require(_0x9b65('0x4'));var path=require('path');var querystring=require(_0x9b65('0x5'));var rp=require(_0x9b65('0x6'));var rs=require(_0x9b65('0x7'));var sox=require(_0x9b65('0x8'));var tts=require(_0x9b65('0x9'));var urlParse=require(_0x9b65('0xa'))[_0x9b65('0xb')];var util=require('util');var aws=require(_0x9b65('0xc'));var google=require('./google');var sestek=require('./sestek');var tilde=require(_0x9b65('0xd'));var logger=require(_0x9b65('0xe'))(_0x9b65('0xf'));var ISPEECH_API=_0x9b65('0x10');function downloadFile(_0x49b5d3,_0x118ab5){return new BPromise(function(_0x3314c6,_0x4b5fec){var _0x1fff69=urlParse(_0x49b5d3);var _0x224fcc=_0x1fff69[_0x9b65('0x11')]===_0x9b65('0x12')?https:http;var _0x4ea530={'host':_0x1fff69[_0x9b65('0x13')],'path':_0x1fff69['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x224fcc[_0x9b65('0x14')](_0x4ea530,function(_0x70d282){if(_0x70d282['statusCode']!==0xc8){logger['error'](_0x9b65('0x15')+_0x49b5d3+_0x9b65('0x16')+_0x70d282[_0x9b65('0x17')]+'\x20('+_0x70d282[_0x9b65('0x18')]+')');_0x4b5fec(new Error('request\x20to\x20'+_0x49b5d3+'\x20failed,\x20status\x20code\x20=\x20'+_0x70d282['statusCode']+'\x20('+_0x70d282[_0x9b65('0x18')]+')'));return;}var _0x360353=fs[_0x9b65('0x19')](_0x118ab5);_0x360353['on']('finish',function(){logger['info']('finish\x20download\x20file');_0x360353[_0x9b65('0x1a')](_0x3314c6);});_0x360353['on'](_0x9b65('0x1b'),function(_0xd644e){fs[_0x9b65('0x1c')](_0x118ab5);logger[_0x9b65('0x1b')](_0x9b65('0x1d'),_0xd644e);_0x4b5fec(_0xd644e);});_0x70d282[_0x9b65('0x1e')](_0x360353);})['on']('error',function(_0xa3dd31){logger[_0x9b65('0x1b')](_0xa3dd31);_0x4b5fec(_0xa3dd31);})['end']();});}function uploadFile(_0x42daf8){return new BPromise(function(_0x51be59,_0x2d9d3a){var _0x419971=urlParse(_0x42daf8);var _0x46a100=_0x419971['protocol']==='https:'?https:http;var _0x3780ca={'host':_0x419971['host'],'path':_0x419971[_0x9b65('0x1f')],'headers':{'user-agent':_0x9b65('0x20')}};_0x46a100['get'](_0x3780ca,function(_0x359b43){if(_0x359b43[_0x9b65('0x17')]!==0xc8){_0x2d9d3a(new Error(_0x9b65('0x15')+_0x42daf8+_0x9b65('0x16')+_0x359b43[_0x9b65('0x17')]+'\x20('+_0x359b43[_0x9b65('0x18')]+')'));return;}var _0x1217f2='';_0x359b43['on'](_0x9b65('0x21'),function(_0x345962){_0x1217f2+=_0x345962;});_0x359b43['on'](_0x9b65('0x22'),function(){_0x51be59(_0x1217f2);});})['on'](_0x9b65('0x1b'),function(_0x45e1a8){_0x2d9d3a(_0x45e1a8);})['end']();});}function convertFile(_0x2bcf82,_0x46d8f8){return new BPromise(function(_0x12760e,_0x5dcd49){var _0x42c6da=sox[_0x9b65('0x23')](_0x2bcf82,_0x46d8f8,{'sampleRate':0x1f40,'format':_0x9b65('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x42c6da['on'](_0x9b65('0x1b'),function(_0x380aee){logger[_0x9b65('0x1b')](_0x9b65('0x25'),_0x380aee);_0x5dcd49(_0x380aee);});_0x42c6da['on'](_0x9b65('0x22'),function(){logger[_0x9b65('0x26')](_0x9b65('0x27'));_0x12760e();});_0x42c6da['start']();});}function base64Decode(_0x33672e,_0x13f53a){var _0x5545d7=path[_0x9b65('0x28')](__dirname,_0x9b65('0x29'),rs[_0x9b65('0x2a')](0x4)+_0x9b65('0x2b'));fs['writeFileSync'](_0x5545d7,_0x33672e,_0x9b65('0x2c'));return convertFile(_0x5545d7,_0x13f53a)[_0x9b65('0x2d')](function(){try{fs[_0x9b65('0x1c')](_0x5545d7);fs['chmodSync'](_0x13f53a,_0x9b65('0x2e'));}catch(_0x25b4e5){logger[_0x9b65('0x1b')](_0x25b4e5);}return _0x13f53a[_0x9b65('0x2f')]('.')[0x0];});}function base64Encode(_0x2c613e){var _0x561a45=fs['readFileSync'](_0x2c613e);return new Buffer(_0x561a45)[_0x9b65('0x30')](_0x9b65('0x2c'));}exports[_0x9b65('0x31')]=function(_0x4b9d6f,_0x2e2810,_0x3adc02,_0x5aabd2,_0x1444ab,_0x310269){var _0x55b619,_0x5e9c62;var _0x2cceb7='https://texttospeech.googleapis.com/v1/';var _0x215820=_0x9b65('0x32')+_0x4b9d6f;var _0xf2a54f={};if(_0x2e2810===_0x9b65('0x33')){_0xf2a54f[_0x9b65('0x34')]={'ssml':_0x3adc02};}else{_0xf2a54f[_0x9b65('0x34')]={'text':_0x3adc02};};_0xf2a54f[_0x9b65('0x35')]={'languageCode':_0x5aabd2,'ssmlGender':_0x1444ab};_0xf2a54f[_0x9b65('0x36')]={'audioEncoding':_0x9b65('0x37'),'sampleRateHertz':0x1f40};var _0x331e3d={'url':_0x2cceb7+_0x9b65('0x38')+_0x215820,'method':_0x9b65('0x39'),'json':!![],'body':_0xf2a54f};return rp(_0x331e3d)[_0x9b65('0x2d')](function(_0xbed7ef){return new BPromise(function(_0x5d6d3f,_0x45ed1c){_0x55b619=path[_0x9b65('0x28')](__dirname,_0x9b65('0x29'),rs['generate'](0x4)+_0x9b65('0x3a'));var _0xd7e4d=Buffer[_0x9b65('0x3b')](_0xbed7ef[_0x9b65('0x3c')],_0x9b65('0x2c'));return fs['writeFile'](_0x55b619,_0xd7e4d,function(_0x14daaa){_0x45ed1c(_0x14daaa);},function(_0x3032d3){fs[_0x9b65('0x3d')](_0x55b619,_0x9b65('0x2e'));_0x5d6d3f(_0x3032d3);});});})[_0x9b65('0x2d')](function(_0x1cbf73){_0x5e9c62=path[_0x9b65('0x28')](__dirname,'tmp',rs[_0x9b65('0x2a')](0x4)+_0x9b65('0x2b'));return convertFile(_0x55b619,_0x5e9c62);})[_0x9b65('0x2d')](function(){try{fs['unlink'](_0x55b619);fs[_0x9b65('0x3d')](_0x5e9c62,_0x9b65('0x2e'));}catch(_0x1664b7){logger[_0x9b65('0x1b')](_0x1664b7);}logger[_0x9b65('0x26')](_0x9b65('0x3e'),_0x5e9c62[_0x9b65('0x2f')]('.')[0x0]);return _0x5e9c62[_0x9b65('0x2f')]('.')[0x0];});};exports[_0x9b65('0x3f')]=function(_0x5d0d73,_0x1e6793){var _0x48f9f7=_0x9b65('0x40');var _0x5d28cf,_0x6e4045;var _0x517a2d;var _0x2f2e4c={'encoding':_0x9b65('0x41'),'method':_0x9b65('0x39'),'timeout':0x2710,'url':_0x48f9f7,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x9b65('0x42')+encodeURIComponent(JSON[_0x9b65('0x43')]([[['jQ1olc',JSON['stringify']([_0x5d0d73,_0x1e6793||'en',![],'null']),null,'generic']]]))};return rp(_0x2f2e4c)['then'](function(_0x19614a){try{_0x517a2d=eval(_0x19614a[_0x9b65('0x44')](0x5))[0x0][0x2];}catch(_0x599770){throw new Error(_0x9b65('0x45')+_0x19614a[_0x9b65('0x21')]);}if(!_0x517a2d){if(_0x5d0d73[_0x9b65('0x46')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x9b65('0x47')+_0x1e6793+'\x22\x20might\x20not\x20exist');}}try{_0x517a2d=eval(_0x517a2d)[0x0];}catch(_0x5303a4){throw new Error(_0x9b65('0x45')+res[_0x9b65('0x21')]);}const _0x12f6ed=_0x517a2d;_0x5d28cf=path[_0x9b65('0x28')](__dirname,_0x9b65('0x29'),rs[_0x9b65('0x2a')](0x4)+_0x9b65('0x3a'));fs['writeFileSync'](_0x5d28cf,_0x517a2d,{'encoding':_0x9b65('0x2c')});_0x6e4045=path[_0x9b65('0x28')](__dirname,_0x9b65('0x29'),rs[_0x9b65('0x2a')](0x4)+_0x9b65('0x2b'));return convertFile(_0x5d28cf,_0x6e4045);})[_0x9b65('0x2d')](function(){try{fs[_0x9b65('0x1c')](_0x5d28cf);fs['chmodSync'](_0x6e4045,'777');}catch(_0x130554){logger[_0x9b65('0x1b')](_0x130554);}logger['info'](_0x9b65('0x48'),_0x6e4045[_0x9b65('0x2f')]('.')[0x0]);return _0x6e4045['split']('.')[0x0];});};exports[_0x9b65('0x49')]=function(_0x1c52b7,_0x455d95,_0x5d1865){return google[_0x9b65('0x4a')](_0x1c52b7,_0x455d95,_0x5d1865)[_0x9b65('0x2d')](function(_0x5e4642){logger[_0x9b65('0x26')](_0x5e4642[_0x9b65('0x4b')]);return rp(_0x5e4642);})['then'](function(_0x2e5653){var _0x4de9ae='';var _0x4c86e5=0x0;try{fs[_0x9b65('0x1c')](_0x1c52b7);}catch(_0x1c9f7f){logger['error'](_0x1c9f7f);}if(_0x2e5653&&_0x2e5653[_0x9b65('0x4c')]){_0x4de9ae=_0x2e5653[_0x9b65('0x4c')][_0x9b65('0x4d')](function(_0x71e515){return _0x71e515&&_0x71e515[_0x9b65('0x4e')][0x0]&&_0x71e515[_0x9b65('0x4e')][0x0][_0x9b65('0x4f')]?_0x71e515['alternatives'][0x0][_0x9b65('0x4f')]:'';})[_0x9b65('0x50')]('\x0a');_0x4c86e5=_0x2e5653[_0x9b65('0x4c')][_0x9b65('0x4d')](function(_0x1fc3ca){return _0x1fc3ca&&_0x1fc3ca[_0x9b65('0x4e')][0x0]&&_0x1fc3ca[_0x9b65('0x4e')][0x0][_0x9b65('0x51')]?_0x1fc3ca[_0x9b65('0x4e')][0x0][_0x9b65('0x51')]:0x0;})[_0x9b65('0x50')]('\x0a');}logger[_0x9b65('0x26')](_0x9b65('0x52'),_0x4de9ae);logger['info'](_0x9b65('0x53'),_0x4c86e5);return{'transcript':_0x4de9ae,'confidence':_0x4c86e5};})[_0x9b65('0x54')](function(_0x2e9d02){logger[_0x9b65('0x1b')](_0x9b65('0x55'),_0x2e9d02[_0x9b65('0x17')],_0x2e9d02[_0x9b65('0x56')],_0x2e9d02[_0x9b65('0x57')]);});};exports['googleDialogflow']=function(_0x4b9bc0,_0x7b61e6,_0x56b8e2,_0x3ed4a0){var _0x3a26c7=apiai(_0x7b61e6,{'language':_0x3ed4a0||'en'});return _0x3a26c7[_0x9b65('0x58')](_0x56b8e2,{'sessionId':md5(_0x4b9bc0)})[_0x9b65('0x2d')](function(_0x56b0d9){logger['info'](JSON[_0x9b65('0x43')](_0x56b0d9));return{'source':_0x56b0d9['result'][_0x9b65('0x59')],'resolvedQuery':_0x56b0d9[_0x9b65('0x5a')]['resolvedQuery'],'action':_0x56b0d9[_0x9b65('0x5a')]['action'],'actionIncomplete':_0x56b0d9['result'][_0x9b65('0x5b')],'speech':_0x56b0d9['result'][_0x9b65('0x5c')][_0x9b65('0x5d')],'score':_0x56b0d9['result']['score'],'statusCode':_0x56b0d9[_0x9b65('0x5e')]['code'],'endConversation':_0x56b0d9[_0x9b65('0x5a')][_0x9b65('0x5f')][_0x9b65('0x60')]||![],'isFallbackIntent':_0x56b0d9[_0x9b65('0x5a')][_0x9b65('0x5f')][_0x9b65('0x61')]};});};exports['googleDialogflowV2']=function(_0x22abee,_0x21d8ed,_0x545395,_0x4e9c33,_0x1025ad,_0x4756a6){var _0x1f6747=_0x4e9c33[_0x9b65('0x62')](/\\n/g,'\x0a');var _0x163639={'credentials':{'private_key':_0x1f6747,'client_email':_0x545395}};var _0x2c18a9=new dialogflow[(_0x9b65('0x63'))](_0x163639);var _0x33e876=_0x2c18a9[_0x9b65('0x64')](_0x21d8ed,md5(_0x22abee));var _0x4247d3={'session':_0x33e876,'queryInput':{'text':{'text':_0x1025ad,'languageCode':_0x4756a6}}};return _0x2c18a9[_0x9b65('0x65')](_0x4247d3)[_0x9b65('0x2d')](function(_0x130c97){if(_0x130c97&&_0x130c97[_0x9b65('0x46')]){logger[_0x9b65('0x26')]('Dialogflow\x20V2\x20response:',JSON[_0x9b65('0x43')](_0x130c97));var _0x40bbaf=_0x130c97[0x0];if(_0x40bbaf){var _0x46341b={'action':_0x40bbaf[_0x9b65('0x66')][_0x9b65('0x67')],'allRequiredParamsPresent':_0x40bbaf[_0x9b65('0x66')][_0x9b65('0x68')],'endConversation':_0x40bbaf['queryResult'][_0x9b65('0x69')]&&_0x40bbaf[_0x9b65('0x66')][_0x9b65('0x69')][_0x9b65('0x6a')]?_0x40bbaf[_0x9b65('0x66')][_0x9b65('0x69')][_0x9b65('0x6a')][_0x9b65('0x6b')]['boolValue']:![],'fulfillmentText':_0x40bbaf[_0x9b65('0x66')]['fulfillmentText'],'intentName':_0x40bbaf[_0x9b65('0x66')][_0x9b65('0x6c')][_0x9b65('0x56')],'intentDisplayName':_0x40bbaf[_0x9b65('0x66')][_0x9b65('0x6c')]['displayName'],'isFallbackIntent':_0x40bbaf[_0x9b65('0x66')][_0x9b65('0x6c')][_0x9b65('0x6d')],'languageCode':_0x40bbaf['queryResult'][_0x9b65('0x6e')],'queryText':_0x40bbaf[_0x9b65('0x66')][_0x9b65('0x6f')],'responseId':_0x40bbaf[_0x9b65('0x70')],'score':_0x40bbaf[_0x9b65('0x66')][_0x9b65('0x71')],'speech':_0x40bbaf[_0x9b65('0x66')][_0x9b65('0x72')],'providerResponse':JSON[_0x9b65('0x43')](_0x130c97)};return _0x46341b;}}});};exports['tildeASR']=function(_0x40b120,_0x207caa,_0x471df8,_0x25b2cc){return tilde[_0x9b65('0x4a')](_0x40b120,_0x207caa,_0x471df8,_0x25b2cc)[_0x9b65('0x2d')](function(_0xa31943){try{fs[_0x9b65('0x1c')](_0x40b120);}catch(_0x36b65b){logger['error'](_0x36b65b);}logger[_0x9b65('0x26')]('Tilde\x20ASR\x20transcription',_0xa31943[_0x9b65('0x4f')]);logger[_0x9b65('0x26')]('Tilde\x20ASR\x20confidence',_0xa31943[_0x9b65('0x51')]);return _0xa31943;});};exports[_0x9b65('0x73')]=function(_0x380a8f,_0x42acf9,_0x3cdebf,_0x596680,_0x532466,_0x4769c4){var _0xb87422=path['resolve'](__dirname,_0x9b65('0x29'),rs[_0x9b65('0x2a')](0x4)+_0x9b65('0x3a'));var _0x51cca2;return aws[_0x9b65('0x74')](_0x380a8f,_0x42acf9,_0x3cdebf,_0x596680,_0x532466,_0x4769c4,_0xb87422)[_0x9b65('0x2d')](function(){_0x51cca2=path[_0x9b65('0x28')](__dirname,'tmp',rs[_0x9b65('0x2a')](0x4)+_0x9b65('0x2b'));return convertFile(_0xb87422,_0x51cca2);})[_0x9b65('0x2d')](function(){try{fs[_0x9b65('0x1c')](_0xb87422);fs[_0x9b65('0x3d')](_0x51cca2,_0x9b65('0x2e'));}catch(_0x3aa368){logger[_0x9b65('0x1b')](_0x3aa368);}return _0x51cca2['split']('.')[0x0];});};exports['awsLex']=function(_0x46ec8c,_0x3cc46e,_0x153574,_0x2641c6,_0x19ba66,_0xac7cf5){return aws[_0x9b65('0x75')](_0x46ec8c,_0x3cc46e,_0x153574,_0x2641c6,_0x19ba66,_0xac7cf5)[_0x9b65('0x2d')](function(_0x32994c){logger['info'](JSON['stringify'](_0x32994c));return _0x32994c;});};exports[_0x9b65('0x76')]=function(_0x545e3c,_0x72ff5b,_0x41f7c0,_0x46b2aa){var _0x2dfca4=util[_0x9b65('0x77')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x545e3c,encodeURIComponent(_0x72ff5b),_0x41f7c0,_0x46b2aa);var _0x43ab0f=path['resolve'](__dirname,'tmp',rs[_0x9b65('0x2a')](0x4)+_0x9b65('0x3a'));var _0x4a72ba;return downloadFile(_0x2dfca4,_0x43ab0f)[_0x9b65('0x2d')](function(){_0x4a72ba=path[_0x9b65('0x28')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x43ab0f,_0x4a72ba);})[_0x9b65('0x2d')](function(){try{fs[_0x9b65('0x1c')](_0x43ab0f);fs['chmodSync'](_0x4a72ba,_0x9b65('0x2e'));}catch(_0x27f07b){logger[_0x9b65('0x1b')](_0x27f07b);}return _0x4a72ba[_0x9b65('0x2f')]('.')[0x0];});};exports[_0x9b65('0x78')]=function(_0x47e88a,_0xa12557,_0x3bcc67,_0x4932dd){var _0x108a72=util[_0x9b65('0x77')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0xa12557,_0x3bcc67,base64Encode(_0x47e88a),_0x4932dd?util['format'](_0x9b65('0x79'),encodeURIComponent(_0x4932dd)):_0x9b65('0x7a'));return uploadFile(_0x108a72)[_0x9b65('0x2d')](function(_0x5498ae){return querystring['parse'](_0x5498ae);});};exports[_0x9b65('0x7b')]=function(_0x250d66,_0x2feda5){return sestek[_0x9b65('0x7c')](_0x250d66,_0x2feda5)[_0x9b65('0x2d')](function(_0x5a82c5){logger[_0x9b65('0x26')](JSON['stringify'](_0x5a82c5));var _0x437338={'speech':_0x5a82c5['text'],'action':_0x5a82c5[_0x9b65('0x7d')]?_0x5a82c5[_0x9b65('0x7d')][_0x9b65('0x7e')]:undefined,'actiondata':_0x5a82c5[_0x9b65('0x7d')]?_0x5a82c5[_0x9b65('0x7d')][_0x9b65('0x7f')]:undefined};if(_0x5a82c5[_0x9b65('0x7d')]&&_0x5a82c5[_0x9b65('0x7d')][_0x9b65('0x80')]){return base64Decode(_0x5a82c5['channelData'][_0x9b65('0x80')][_0x9b65('0x81')],path[_0x9b65('0x28')](__dirname,_0x9b65('0x29'),rs[_0x9b65('0x2a')](0x4)+_0x9b65('0x2b')))[_0x9b65('0x2d')](function(_0xa785e){_0x437338[_0x9b65('0x82')]=_0xa785e;return _0x437338;});}return _0x437338;});};exports[_0x9b65('0x83')]=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 225c2f2..7e16972 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 _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 +var _0x333e=['./nda','exports'];(function(_0x46efd7,_0x43f84d){var _0x5637e4=function(_0x54e078){while(--_0x54e078){_0x46efd7['push'](_0x46efd7['shift']());}};_0x5637e4(++_0x43f84d);}(_0x333e,0x84));var _0xe333=function(_0x2b7e9c,_0x236531){_0x2b7e9c=_0x2b7e9c-0x0;var _0x39ac82=_0x333e[_0x2b7e9c];return _0x39ac82;};var nda=require(_0xe333('0x0'));module[_0xe333('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 9a6a80c..ddeb461 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 _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 +var _0xfd60=['AudioOutputSettings','audio/wav','custom_action','CustomActionData','stringify','request-promise','url','exports','POST','ndauth_url','/token','password','then','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio'];(function(_0x16eb13,_0x3d592f){var _0x2b6230=function(_0x1f963a){while(--_0x1f963a){_0x16eb13['push'](_0x16eb13['shift']());}};_0x2b6230(++_0x3d592f);}(_0xfd60,0x113));var _0x0fd6=function(_0x3f3bad,_0x193f06){_0x3f3bad=_0x3f3bad-0x0;var _0x4f0801=_0xfd60[_0x3f3bad];return _0x4f0801;};'use strict';var rp=require(_0x0fd6('0x0'));var url=require(_0x0fd6('0x1'));var logger=require('../../../../../config/logger')('agi');module[_0x0fd6('0x2')]=function(_0x1831e5,_0x10e718){var _0xdaf573={'method':_0x0fd6('0x3'),'uri':url['resolve'](_0x10e718[_0x0fd6('0x4')],_0x0fd6('0x5')),'form':{'grant_type':_0x0fd6('0x6'),'username':_0x10e718['username'],'password':_0x10e718[_0x0fd6('0x6')]},'json':!![]};return rp(_0xdaf573)[_0x0fd6('0x7')](function(_0x151510){var _0x1071b1={'method':_0x0fd6('0x3'),'uri':url['resolve'](_0x10e718[_0x0fd6('0x8')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x10e718[_0x0fd6('0x9')]||_0x0fd6('0xa'),'channelId':_0x0fd6('0xb'),'conversation':{'id':_0x1831e5[_0x0fd6('0xc')]},'from':{'id':_0x1831e5[_0x0fd6('0xd')],'name':_0x1831e5[_0x0fd6('0xe')]},'recipient':{'id':_0x1831e5[_0x0fd6('0xf')],'name':_0x1831e5[_0x0fd6('0x10')]},'text':_0x10e718[_0x0fd6('0x11')],'channelData':{}},'headers':{'Authorization':_0x0fd6('0x12')+_0x151510[_0x0fd6('0x13')]},'json':!![]};if(_0x10e718[_0x0fd6('0x14')]){_0x1071b1[_0x0fd6('0x15')][_0x0fd6('0x16')][_0x0fd6('0x17')]=_0x10e718[_0x0fd6('0x14')];}if(_0x10e718[_0x0fd6('0x18')]=='1'){_0x1071b1[_0x0fd6('0x15')][_0x0fd6('0x16')][_0x0fd6('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x0fd6('0x1a')};}if(_0x10e718[_0x0fd6('0x1b')]){_0x1071b1[_0x0fd6('0x15')][_0x0fd6('0x16')]['CustomAction']=_0x10e718[_0x0fd6('0x1b')];if(_0x10e718['custom_action_data']){_0x1071b1[_0x0fd6('0x15')][_0x0fd6('0x16')][_0x0fd6('0x1c')]=_0x10e718['custom_action_data'];}}logger['info'](JSON[_0x0fd6('0x1d')](_0x1071b1));return rp(_0x1071b1);});}; \ 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 8d89bdb..1bd2efc 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 _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 +var _0x2091=['./lib/api'];(function(_0x56fb43,_0x170198){var _0x7816ff=function(_0x11facc){while(--_0x11facc){_0x56fb43['push'](_0x56fb43['shift']());}};_0x7816ff(++_0x170198);}(_0x2091,0x1cc));var _0x1209=function(_0x54b3bc,_0x1880ea){_0x54b3bc=_0x54b3bc-0x0;var _0x38a050=_0x2091[_0x54b3bc];return _0x38a050;};'use strict';var asr=require(_0x1209('0x0'));module['exports']=function(_0x4279d0,_0x1b8d19,_0x3cd653,_0x35f942){return asr(_0x4279d0,_0x1b8d19,_0x3cd653,_0x35f942);}; \ 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 cdef27b..b225d8d 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 _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 +var _0x7e22=['Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','../../../../../../config/logger','agi','exports','info','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','digest','hex','stringify','createReadStream','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0x7e22,0x19c));var _0x27e2=function(_0x36e4e5,_0x147710){_0x36e4e5=_0x36e4e5-0x0;var _0x419ffd=_0x7e22[_0x36e4e5];return _0x419ffd;};'use strict';var BPromise=require(_0x27e2('0x0'));var _=require(_0x27e2('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x27e2('0x2'));var crypto=require('crypto');var logger=require(_0x27e2('0x3'))(_0x27e2('0x4'));module[_0x27e2('0x5')]=function(_0x59be38,_0x1f74fc,_0x6a632c,_0x311cfe){return new BPromise(function(_0x249351,_0x1f4419){logger[_0x27e2('0x6')]('Tilde\x20URI',_0x311cfe||_0x27e2('0x7'));var _0x4e7dac=new WebSocket(_0x311cfe||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x4790c6='';var _0x18f972='0';var _0x263034='1';var _0x4d2759=_0x27e2('0x8');function _0x3792cc(_0x180522){var _0x360014=crypto['createHash']('sha1');_0x360014['update'](_0x180522);return _0x360014[_0x27e2('0x9')](_0x27e2('0xa'));}function _0x2d22a3(){try{logger[_0x27e2('0x6')]('Open\x20Tilde\x20ASR\x20socket');var _0x1d93f3=moment()['unix']();var _0x478d63=_0x3792cc(_0x1d93f3+_0x1f74fc+_0x6a632c);_0x4e7dac['send'](JSON[_0x27e2('0xb')]({'appID':_0x1f74fc,'timestamp':_0x1d93f3,'appKey':_0x478d63}));var _0x2e7049=fs[_0x27e2('0xc')](_0x59be38);_0x2e7049['on'](_0x27e2('0xd'),function(_0x2d98d6){_0x4e7dac[_0x27e2('0xe')](_0x2d98d6);});_0x2e7049['on'](_0x27e2('0xf'),function(){_0x4e7dac[_0x27e2('0xe')](_0x27e2('0x10'));});}catch(_0x362ba9){logger[_0x27e2('0x11')](_0x27e2('0x12'),JSON['stringify'](_0x362ba9));_0x4e7dac[_0x27e2('0x13')]();}}function _0x5e49e8(_0x87ba6f){try{if(_0x87ba6f){var _0x18db09=JSON[_0x27e2('0x14')](_0x87ba6f);switch(_0x18db09[_0x27e2('0x15')]){case 0x0:if(_0x18db09[_0x27e2('0x16')]){if(_0x18db09['result'][_0x27e2('0x17')]){logger[_0x27e2('0x6')](_0x27e2('0x18'),JSON[_0x27e2('0xb')](_0x18db09[_0x27e2('0x16')]['hypotheses']));_0x4790c6=_0x18db09[_0x27e2('0x16')][_0x27e2('0x19')][0x0][_0x27e2('0x1a')];_0x18f972=_0x18db09[_0x27e2('0x16')][_0x27e2('0x19')][0x0][_0x27e2('0x1b')];_0x263034='0';_0x4d2759=_0x27e2('0x1c');_0x4e7dac[_0x27e2('0x13')]();}}break;case 0x1:logger[_0x27e2('0x6')](_0x27e2('0x8'));_0x263034='1';_0x4d2759=_0x27e2('0x8');break;case 0x2:logger[_0x27e2('0x6')](_0x27e2('0x1d'));_0x263034='2';_0x4d2759=_0x27e2('0x1d');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x263034='9';_0x4d2759=_0x27e2('0x1e');break;case 0xa:logger['info'](_0x27e2('0x1f'));_0x263034='10';_0x4d2759='Authentication\x20failed.';break;case 0xb:logger[_0x27e2('0x6')](_0x27e2('0x20'));_0x263034='11';_0x4d2759=_0x27e2('0x20');}}}catch(_0x399c3a){logger[_0x27e2('0x11')](_0x27e2('0x21'),JSON[_0x27e2('0xb')](_0x399c3a));_0x4e7dac[_0x27e2('0x13')]();}}function _0x34c99d(){logger[_0x27e2('0x6')](_0x27e2('0x22'));_0x249351({'transcript':_0x4790c6,'confidence':_0x18f972,'status':_0x263034,'status_message':_0x4d2759});}function _0x53af6c(_0x1efa77){logger[_0x27e2('0x11')](_0x27e2('0x23'));if(!_[_0x27e2('0x24')](_0x1efa77)){logger[_0x27e2('0x11')](_[_0x27e2('0x25')](_0x1efa77)?JSON[_0x27e2('0xb')](_0x1efa77):_0x1efa77);}}_0x4e7dac['on'](_0x27e2('0x26'),_0x2d22a3);_0x4e7dac['on'](_0x27e2('0x27'),_0x5e49e8);_0x4e7dac['on'](_0x27e2('0xf'),_0x34c99d);_0x4e7dac['on']('error',_0x53af6c);});}; \ 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 c44b18d..ea69813 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 _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 +var _0x2480=['exports'];(function(_0x2e93d0,_0x5d6526){var _0x2a88a6=function(_0x9bcb0f){while(--_0x9bcb0f){_0x2e93d0['push'](_0x2e93d0['shift']());}};_0x2a88a6(++_0x5d6526);}(_0x2480,0x1c9));var _0x0248=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2480[_0x2dafbe];return _0x58a45a;};var asr=require('./asr');module[_0x0248('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 5fbcf7a..261105a 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 _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 +var _0xa73a=['E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','ready','connection','code','close','E_AGI_SERVER_CLOSE','inherits','exports','net','events','EventEmitter','./error','./channel','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','emit','E_AGI_SERVER_ERROR'];(function(_0x484cc5,_0x496ea2){var _0x571f71=function(_0x596563){while(--_0x596563){_0x484cc5['push'](_0x484cc5['shift']());}};_0x571f71(++_0x496ea2);}(_0xa73a,0x82));var _0xaa73=function(_0x474e22,_0x5d5515){_0x474e22=_0x474e22-0x0;var _0x76a179=_0xa73a[_0x474e22];return _0x76a179;};'use strict';var util=require('util');var net=require(_0xaa73('0x0'));var EventEmitter=require(_0xaa73('0x1'))[_0xaa73('0x2')];var AGIError=require(_0xaa73('0x3'));var AGIChannel=require(_0xaa73('0x4'));var AGIServer=function(_0x4b1260,_0x479a54,_0x512616){var _0x35025d=this,_0x4b1260=_0x4b1260||0x11dd,_0x479a54=_0x479a54||_0xaa73('0x5'),_0x15d1c6=null,_0xf84c2e=0x0;EventEmitter[_0xaa73('0x6')](_0x35025d);function _0x52dea4(){if(!_0x4b1260){_0x35025d['emit'](_0xaa73('0x7'),new AGIError(_0xaa73('0x8')));return![];}_0x15d1c6=net[_0xaa73('0x9')]();_0x15d1c6[_0xaa73('0xa')](_0x4b1260,_0x479a54);_0x15d1c6['on'](_0xaa73('0xb'),function(){_0x35025d[_0xaa73('0xc')]('listening');});_0x15d1c6['on']('connection',function(_0xe0006a){_0x15d1c6['getConnections'](function(_0x3bd70d,_0x4b53cb){if(_0x3bd70d){_0x35025d[_0xaa73('0xc')](_0xaa73('0x7'),new AGIError(_0xaa73('0xd'),_0x3bd70d));}else if(_0x512616&&_0x512616<0x0){_0x35025d[_0xaa73('0xc')](_0xaa73('0x7'),new AGIError(_0xaa73('0xe')));_0xe0006a['destroy']();}else if(_0x512616&&_0x512616>0x0&&_0x512616<_0x4b53cb){_0xf84c2e+=0x1;_0x35025d[_0xaa73('0xc')](_0xaa73('0x7'),new AGIError(_0xaa73('0xf'),_0xf84c2e));_0xe0006a[_0xaa73('0x10')]();}else{var _0xc4a8e=new AGIChannel(_0xe0006a);_0xc4a8e['on'](_0xaa73('0x11'),function(){_0x35025d[_0xaa73('0xc')](_0xaa73('0x12'),_0xc4a8e);});}});});_0x15d1c6['on'](_0xaa73('0x7'),function(_0x5a4174){_0x35025d[_0xaa73('0xc')]('error',new AGIError(_0xaa73('0xd'),_0x5a4174[_0xaa73('0x13')]));});_0x15d1c6['on'](_0xaa73('0x14'),function(){_0x35025d['emit']('close',new AGIError(_0xaa73('0x15')));});}process['nextTick'](function(){_0x52dea4();});};util[_0xaa73('0x16')](AGIServer,EventEmitter);module[_0xaa73('0x17')]=function(_0x4d97fe,_0x12a8ab,_0x48420a){return new AGIServer(_0x4d97fe,_0x12a8ab,_0x48420a);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index f058ee4..27dc25f 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 _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 +var _0xfb89=['Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','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\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','phone','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','variable_id','getData','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','streamFile','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','message','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','Executed\x20command\x20%s\x20%s','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','record','recordingFormat','%s_%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','port','secure','authentication','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','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','join','exports','util','lodash','shelljs','odbc','randomstring','mustache','request-promise','agi','../../config/environment','./scripts','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','catch','getVoiceQueueById','then','name','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','text','languageCode','en-US','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','POST','PUT','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','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','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','sync','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','replace','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2'];(function(_0x127266,_0x520df0){var _0x7c0e4=function(_0x184c52){while(--_0x184c52){_0x127266['push'](_0x127266['shift']());}};_0x7c0e4(++_0x520df0);}(_0xfb89,0xe9));var _0x9fb8=function(_0x49aa7d,_0x5d46d8){_0x49aa7d=_0x49aa7d-0x0;var _0xdd0d26=_0xfb89[_0x49aa7d];return _0xdd0d26;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x9fb8('0x0'));var _=require(_0x9fb8('0x1'));var sh=require(_0x9fb8('0x2'));var odbc=require(_0x9fb8('0x3'))();var rs=require(_0x9fb8('0x4'));var moment=require('moment');var Mustache=require(_0x9fb8('0x5'));var rp=require(_0x9fb8('0x6'));var logger=require('../../config/logger')(_0x9fb8('0x7'));var config=require(_0x9fb8('0x8'));var scripts=require(_0x9fb8('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x9fb8('0xa'),'rawBody'];var verticesWithRetry=[_0x9fb8('0xb'),_0x9fb8('0xc'),_0x9fb8('0xd')];var AGIVertices=function(_0x430f01,_0x5586d9,_0x108365){this[_0x9fb8('0xe')]=_0x430f01;this[_0x9fb8('0xf')]=_0x5586d9;this[_0x9fb8('0x10')]=_0x108365;};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x12')]=function(_0x4e2232,_0x202d1a){this[_0x9fb8('0xf')][_0x9fb8('0x13')](_0x4e2232)['then'](function(_0x47470e){_0x202d1a(null,_0x47470e?_0x47470e['name']:![]);})[_0x9fb8('0x14')](function(_0x28ad61){_0x202d1a(_0x28ad61);});};AGIVertices[_0x9fb8('0x11')]['getVoiceQueue']=function(_0x582508,_0x5d4497){this[_0x9fb8('0xf')][_0x9fb8('0x15')](_0x582508)[_0x9fb8('0x16')](function(_0x20788c){_0x5d4497(null,_0x20788c?_0x20788c[_0x9fb8('0x17')]:![]);})['catch'](function(_0x323396){_0x5d4497(_0x323396);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x18')]=function(_0x2f432f,_0x321187){this['rpc'][_0x9fb8('0x19')](_0x2f432f)[_0x9fb8('0x16')](function(_0x8ed023){_0x321187(null,_0x8ed023?_0x8ed023[_0x9fb8('0x17')]:![]);})[_0x9fb8('0x14')](function(_0x3abb56){_0x321187(_0x3abb56);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x1a')]=function(_0x3eb8cf,_0x9245bc){this[_0x9fb8('0xf')][_0x9fb8('0x1b')](_0x3eb8cf)[_0x9fb8('0x16')](function(_0x3952bf){_0x9245bc(null,_0x3952bf?_0x3952bf[_0x9fb8('0x1c')]:![]);})[_0x9fb8('0x14')](function(_0x284a6c){_0x9245bc(_0x284a6c);});};AGIVertices[_0x9fb8('0x11')]['getUser']=function(_0x544ac8,_0x5ef5f6){this[_0x9fb8('0xf')][_0x9fb8('0x1d')](_0x544ac8)[_0x9fb8('0x16')](function(_0x3506d6){_0x5ef5f6(null,_0x3506d6?_0x3506d6[_0x9fb8('0x17')]:![]);})[_0x9fb8('0x14')](function(_0x35cc1c){_0x5ef5f6(_0x35cc1c);});};AGIVertices['prototype'][_0x9fb8('0x1e')]=function(_0x4969e6,_0x286b48){this[_0x9fb8('0xf')][_0x9fb8('0x1f')](_0x4969e6)[_0x9fb8('0x16')](function(_0x22d639){_0x286b48(null,_0x22d639?_0x22d639[_0x9fb8('0x17')]:![]);})[_0x9fb8('0x14')](function(_0x341e3d){_0x286b48(_0x341e3d);});};AGIVertices[_0x9fb8('0x11')]['getSound']=function(_0x23b5d2,_0x1b7210){var _0xdeb8b1=this;this[_0x9fb8('0xf')][_0x9fb8('0x20')](_0x23b5d2)['then'](function(_0x5056dc){_0x1b7210(null,_0x5056dc?_0xdeb8b1[_0x9fb8('0x21')](_0x5056dc[_0x9fb8('0x22')]):![]);})[_0x9fb8('0x14')](function(_0x21dcd7){_0x1b7210(_0x21dcd7);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x23')]=function(_0x194d9f,_0x3658b5){this[_0x9fb8('0xf')][_0x9fb8('0x24')](_0x194d9f)[_0x9fb8('0x16')](function(_0x4f3983){_0x3658b5(null,_0x4f3983?_0x4f3983:![]);})[_0x9fb8('0x14')](function(_0x25c583){_0x3658b5(_0x25c583);});};AGIVertices[_0x9fb8('0x11')]['sendMailMessage']=function(_0x210ba6,_0x4719f1,_0x5cc81d){this['mailRpc'][_0x9fb8('0x25')](_0x210ba6,_0x4719f1)[_0x9fb8('0x16')](function(){_0x5cc81d(null);})[_0x9fb8('0x14')](function(_0x79fca5){_0x5cc81d(_0x79fca5);});};AGIVertices['prototype'][_0x9fb8('0x26')]=function(_0x350366,_0x1e6e99){this[_0x9fb8('0xf')][_0x9fb8('0x27')](_0x350366)[_0x9fb8('0x16')](function(_0x1acd6d){if(_0x1acd6d){if(_0x1acd6d[_0x9fb8('0x28')]){_0x1e6e99(null,[_0x1acd6d[_0x9fb8('0x29')]]);}else{_0x1e6e99(null,_[_0x9fb8('0x2a')](_0x1acd6d[_0x9fb8('0x2b')],_0x9fb8('0x29')));}}else{_0x1e6e99(null,![]);}})[_0x9fb8('0x14')](function(_0x25c4bc){_0x1e6e99(_0x25c4bc);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x21')]=function(_0x1863bd){return util[_0x9fb8('0x2c')](_0x9fb8('0x2d'),FILES_PATH,_0x1863bd);};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x2e')]=function(_0x47b282,_0x32f872,_0x3f59d4){odbc[_0x9fb8('0x2f')](_0x47b282,function(_0x35c1c0){if(_0x35c1c0){logger['error'](_0x9fb8('0x30'),_0x35c1c0);_0x3f59d4(_0x35c1c0);}else{logger[_0x9fb8('0x31')]('ODBC\x20connection\x20successfully');odbc[_0x9fb8('0x32')](_0x32f872,function(_0x12bd96,_0x1f54be){if(_0x12bd96){logger[_0x9fb8('0x31')](_0x9fb8('0x33'),_0x32f872);_0x3f59d4(_0x12bd96);}else{logger['info'](_0x9fb8('0x34'),_0x32f872);odbc[_0x9fb8('0x35')](function(_0x538729){if(_0x538729){logger[_0x9fb8('0x36')](_0x9fb8('0x37'),_0x538729);}_0x3f59d4(null,_0x1f54be);});}});}});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x38')]=function(_0x559568,_0x4ded54){this['rpc'][_0x9fb8('0x39')](_0x559568)[_0x9fb8('0x16')](function(_0x421d8c){_0x4ded54(null,_0x421d8c?_0x421d8c:![]);})[_0x9fb8('0x14')](function(_0x1a6d90){_0x4ded54(_0x1a6d90);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x3a')]=function(_0x5b759e,_0x9390b9){this[_0x9fb8('0xf')][_0x9fb8('0x3a')](_0x5b759e)[_0x9fb8('0x16')](function(_0x557e23){_0x9390b9(null,_0x557e23);})['catch'](function(_0x2b5af7){_0x9390b9(_0x2b5af7);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x3b')]=function(_0x55d884,_0xae1e39,_0x277366){this['rpc'][_0x9fb8('0x3b')]({'uniqueid':this[_0x9fb8('0xe')][_0x9fb8('0x3c')],'node':_0x55d884[_0x9fb8('0x3d')],'application':_0x55d884[_0x9fb8('0x3e')],'data':_0xae1e39||null,'project_name':this[_0x9fb8('0xe')][_0x9fb8('0x3f')],'callerid':this[_0x9fb8('0xe')][_0x9fb8('0x40')]})[_0x9fb8('0x16')](function(_0x2fcbf9){if(_0x277366){_0x277366(null,_0x2fcbf9);}})[_0x9fb8('0x14')](function(_0x1cf4a){if(_0x277366){_0x277366(_0x1cf4a);}});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x41')]=function(_0x3bd70f,_0x1d0209,_0x3c4a19,_0x4d63ac){this[_0x9fb8('0xf')][_0x9fb8('0x41')]({'uniqueid':this[_0x9fb8('0xe')]['uniqueid'],'callerid':this[_0x9fb8('0xe')][_0x9fb8('0x40')],'calleridname':this[_0x9fb8('0xe')][_0x9fb8('0x42')],'context':this[_0x9fb8('0xe')][_0x9fb8('0x43')],'extension':this['channel'][_0x9fb8('0x44')],'priority':this[_0x9fb8('0xe')]['priority'],'accountcode':this[_0x9fb8('0xe')][_0x9fb8('0x45')],'dnid':this[_0x9fb8('0xe')][_0x9fb8('0x46')],'projectName':this[_0x9fb8('0xe')][_0x9fb8('0x3f')],'saveName':_0x1d0209,'filename':_0x3bd70f[_0x9fb8('0x47')]||_0x1d0209,'savePath':_0x3c4a19})['then'](function(_0x207fdd){_0x4d63ac(null,_0x207fdd);})[_0x9fb8('0x14')](function(_0x31bad2){_0x4d63ac(_0x31bad2);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x48')]=function(_0x507283,_0x32f782,_0x427d05,_0x1cd3c7,_0x59ef9c){this[_0x9fb8('0xf')][_0x9fb8('0x48')]({'uniqueid':this['channel'][_0x9fb8('0x3c')],'body':_0x507283,'direction':_0x32f782,'providerName':_0x427d05,'providerResponse':_0x1cd3c7})[_0x9fb8('0x16')](function(_0x388ed3){if(_0x59ef9c){_0x59ef9c(null,_0x388ed3);}})[_0x9fb8('0x14')](function(_0x5707ff){if(_0x59ef9c){_0x59ef9c(_0x5707ff);}});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x49')]=function(_0x3c455c,_0x10fcb7){this['rpc'][_0x9fb8('0x49')]({'firstName':_[_0x9fb8('0x4a')](_0x3c455c[_0x9fb8('0x17')])||_['isNil'](_0x3c455c['name'])?_0x9fb8('0x4b')+Math[_0x9fb8('0x4c')]():_0x3c455c[_0x9fb8('0x17')],'lastName':_[_0x9fb8('0x4a')](_0x3c455c[_0x9fb8('0x4d')])||_[_0x9fb8('0x4e')](_0x3c455c['lastName'])?null:_0x3c455c['lastName'],'phone':_0x3c455c['phone'],'ListId':_0x3c455c[_0x9fb8('0x4f')],'scheduledat':_0x3c455c[_0x9fb8('0x50')],'callbackUniqueid':this[_0x9fb8('0xe')][_0x9fb8('0x3c')],'tags':'callback','description':_0x9fb8('0x51')+_0x3c455c[_0x9fb8('0x50')][_0x9fb8('0x52')](),'priority':_0x3c455c[_0x9fb8('0x53')]})[_0x9fb8('0x16')](function(_0x479ac0){_0x10fcb7(null,_0x479ac0);})[_0x9fb8('0x14')](function(_0x34327d){_0x10fcb7(_0x34327d);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x54')]=function(_0x1c7590,_0x5ef806){this['rpc']['getPauseById'](_0x1c7590)[_0x9fb8('0x16')](function(_0xc6b66e){_0x5ef806(null,_0xc6b66e?_0xc6b66e[_0x9fb8('0x17')]:![]);})['catch'](function(_0x36c993){_0x5ef806(_0x36c993);});};AGIVertices['prototype'][_0x9fb8('0x55')]=function(_0x4b1a93,_0x5f4843,_0x504585){var _0x326498={'role':_0x9fb8('0x56')};_0x326498[_0x4b1a93]=this[_0x9fb8('0xe')]['callerid'];this[_0x9fb8('0xf')]['agentPause'](_0x326498,_0x5f4843,this[_0x9fb8('0xe')]['uniqueid'])[_0x9fb8('0x16')](function(_0x59adce){_0x504585(null,_[_0x9fb8('0x4e')](_0x59adce)?![]:!![]);})['catch'](function(_0x5c5f88){logger[_0x9fb8('0x36')](_0x5c5f88);_0x504585(null,![]);});};AGIVertices['prototype'][_0x9fb8('0x57')]=function(_0x537546,_0x3b2fba){var _0x3a0a3b={'role':'agent'};_0x3a0a3b[_0x537546]=this[_0x9fb8('0xe')][_0x9fb8('0x40')];this[_0x9fb8('0xf')]['agentUnpause'](_0x3a0a3b)[_0x9fb8('0x16')](function(_0x4f7de8){_0x3b2fba(null,_['isNil'](_0x4f7de8)?![]:!![]);})[_0x9fb8('0x14')](function(_0x20ce6a){logger[_0x9fb8('0x36')](_0x20ce6a);_0x3b2fba(null,![]);});};AGIVertices['prototype'][_0x9fb8('0x58')]=function(_0xcc8bb2,_0x218b8){var _0x8f4b30={'role':_0x9fb8('0x56')};_0x8f4b30[_0xcc8bb2]=this[_0x9fb8('0xe')][_0x9fb8('0x40')];this['rpc'][_0x9fb8('0x58')](_0x8f4b30)[_0x9fb8('0x16')](function(_0x28d2fd){_0x218b8(null,_['isNil'](_0x28d2fd)?![]:!![]);})[_0x9fb8('0x14')](function(_0x523bdd){logger[_0x9fb8('0x36')](_0x523bdd);_0x218b8(null,![]);});};AGIVertices['prototype'][_0x9fb8('0x59')]=function(_0x47711f,_0x474035){var _0x58e1d5={'role':'agent'};_0x58e1d5[_0x47711f]=this[_0x9fb8('0xe')][_0x9fb8('0x40')];var _0x179910=_0x47711f!=_0x9fb8('0x5a')?util['format']('%s/%s@from-sip/n',_0x9fb8('0x5b'),this[_0x9fb8('0xe')]['callerid']):undefined;this[_0x9fb8('0xf')][_0x9fb8('0x59')](_0x58e1d5,_0x179910)['then'](function(_0x31bd98){_0x474035(null,_[_0x9fb8('0x4e')](_0x31bd98)?![]:!![]);})[_0x9fb8('0x14')](function(_0x28e040){logger[_0x9fb8('0x36')](_0x28e040);_0x474035(null,![]);});};AGIVertices['prototype'][_0x9fb8('0x5c')]=function(_0x48b813,_0x547a06){sh[_0x9fb8('0x5d')](_[_0x9fb8('0x5e')](_0x48b813),function(_0x5e7482,_0x4fd771){var _0x4b60ac=_0x4fd771['replace'](/(\r\n|\n|\r)/gm,'');_0x547a06(null,_0x4b60ac);});};AGIVertices[_0x9fb8('0x11')]['googleCloudTTS']=function(_0xb8f035,_0xdeafac){scripts[_0x9fb8('0x5f')](_0xb8f035[_0x9fb8('0x60')],_0xb8f035['google_cloud_tts_text_type']||'text',_0xb8f035[_0x9fb8('0x61')],_0xb8f035[_0x9fb8('0x62')]||_0x9fb8('0x63'),_0xb8f035['ssmlGender']||'MALE',_0xb8f035['audioEncoding']||_0x9fb8('0x64'))[_0x9fb8('0x16')](function(_0x8c99ef){_0xdeafac(null,_0x8c99ef);})['catch'](function(_0x2d5bfb){_0xdeafac(_0x2d5bfb);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x65')]=function(_0xd509de,_0x2e1b4c){scripts[_0x9fb8('0x65')](_0xd509de[_0x9fb8('0x61')],_0xd509de[_0x9fb8('0x66')]||'en',0x1)[_0x9fb8('0x16')](function(_0x93d5b8){_0x2e1b4c(null,_0x93d5b8);})[_0x9fb8('0x14')](function(_0x192c87){_0x2e1b4c(_0x192c87);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x67')]=function(_0x10e87f,_0x3d8e34){var _0x55758e={'uri':_0x10e87f[_0x9fb8('0x68')],'method':_0x10e87f[_0x9fb8('0x69')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x10e87f[_0x9fb8('0x6a')])===_0x9fb8('0x6b')&&parseInt(_0x10e87f['timeout'])>=0x1?parseInt(_0x10e87f['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x9fb8('0x6c'),_0x9fb8('0x6d')],_0x55758e[_0x9fb8('0x69')][_0x9fb8('0x6e')]())){try{_0x55758e[_0x9fb8('0x6f')]=_0x10e87f[_0x9fb8('0x70')]?JSON[_0x9fb8('0x71')](_0x10e87f[_0x9fb8('0x70')]):{};}catch(_0x116f18){logger[_0x9fb8('0x36')](_0x9fb8('0x72'),_0x116f18);}}try{_0x55758e['headers']=_0x10e87f[_0x9fb8('0xa')]?JSON['parse'](_0x10e87f['rawHeaders']):{};}catch(_0x870ad8){logger['error'](_0x9fb8('0x73'),_0x870ad8);}if(_0x10e87f['computedVariables']){try{var _0x1ac398=require(_0x10e87f[_0x9fb8('0x74')])['sync'](this,_0x55758e);_0x55758e[_0x9fb8('0x75')]=Mustache[_0x9fb8('0x76')](_0x10e87f['url'],_0x1ac398,{},['$$','$$']);if(_0x55758e[_0x9fb8('0x77')]){_0x55758e['headers']=JSON['parse'](Mustache[_0x9fb8('0x76')](JSON[_0x9fb8('0x78')](_0x55758e['headers']),_0x1ac398,{},['$$','$$']));}if(_0x55758e['body']){_0x55758e[_0x9fb8('0x6f')]=JSON[_0x9fb8('0x71')](Mustache[_0x9fb8('0x76')](JSON[_0x9fb8('0x78')](_0x55758e[_0x9fb8('0x6f')]),_0x1ac398,{},['$$','$$']));}}catch(_0x289bde){logger[_0x9fb8('0x36')](_0x9fb8('0x79'),_0x289bde);}}rp(_0x55758e)[_0x9fb8('0x16')](function(_0x4cf2e2){var _0x1c587e={'statusCode':_0x4cf2e2[_0x9fb8('0x7a')]||0xc8,'statusMessage':_0x4cf2e2['statusMessage']||'OK','headers':_0x4cf2e2[_0x9fb8('0x77')]||{},'body':_0x4cf2e2['body']||{}};_0x3d8e34(null,_0x1c587e);})[_0x9fb8('0x14')](function(_0x59b343){var _0x2e4fe3={'statusCode':_0x59b343[_0x9fb8('0x7a')]||0x1f4,'statusMessage':_0x59b343['message']||_0x9fb8('0x7b'),'headers':_0x59b343['options'][_0x9fb8('0x77')]||{},'body':_0x59b343[_0x9fb8('0x7c')][_0x9fb8('0x6f')]||{}};_0x3d8e34(null,_0x2e4fe3);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x7d')]=function(_0xb38d09,_0x161483){scripts['googleDialogflow'](this[_0x9fb8('0xe')][_0x9fb8('0x3c')],_0xb38d09[_0x9fb8('0x7e')],_0xb38d09['text'],_0xb38d09['dialogflow_language']||'en')[_0x9fb8('0x16')](function(_0x5afe15){_0x161483(null,_0x5afe15);})[_0x9fb8('0x14')](function(_0x2a7694){_0x161483(_0x2a7694);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x7f')]=function(_0x2f9711,_0x211c57){scripts['googleDialogflowV2'](this[_0x9fb8('0xe')][_0x9fb8('0x3c')],_0x2f9711[_0x9fb8('0x80')],_0x2f9711[_0x9fb8('0x81')],_0x2f9711['private_key'],_0x2f9711['text'],_0x2f9711[_0x9fb8('0x82')]||'en')[_0x9fb8('0x16')](function(_0x352991){_0x211c57(null,_0x352991);})['catch'](function(_0x2e7a96){_0x211c57(_0x2e7a96);});};AGIVertices[_0x9fb8('0x11')]['sestekNDA']=function(_0x5cf794,_0x48a897){scripts[_0x9fb8('0x83')](this['channel'],_0x5cf794)[_0x9fb8('0x16')](function(_0x3e86c9){_0x48a897(null,_0x3e86c9);})['catch'](function(_0x522c58){_0x48a897(_0x522c58);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x84')]=function(_0xb3fc7f,_0xbe13a5){scripts[_0x9fb8('0x84')](_0xb3fc7f['key'],_0xb3fc7f[_0x9fb8('0x61')],_0xb3fc7f[_0x9fb8('0x85')]||_0x9fb8('0x63'),_0xb3fc7f[_0x9fb8('0x86')])[_0x9fb8('0x16')](function(_0x104c6a){_0xbe13a5(null,_0x104c6a);})[_0x9fb8('0x14')](function(_0x4d7e02){_0xbe13a5(_0x4d7e02);});};AGIVertices[_0x9fb8('0x11')]['ispeechASR']=function(_0x4ae09e,_0x7b92f5,_0x5ed0c0){scripts[_0x9fb8('0x87')](_0x7b92f5,_0x4ae09e[_0x9fb8('0x7e')],_0x4ae09e[_0x9fb8('0x88')]||'en-US',this[_0x9fb8('0x89')](_0x4ae09e[_0x9fb8('0x8a')])?_0x4ae09e[_0x9fb8('0x8a')]:undefined)[_0x9fb8('0x16')](function(_0x232834){_0x5ed0c0(null,_0x232834);})['catch'](function(_0x4e57de){_0x5ed0c0(_0x4e57de);});};AGIVertices['prototype']['awsPolly']=function(_0x2d4bbc,_0x35883e){scripts[_0x9fb8('0x8b')](_0x2d4bbc[_0x9fb8('0x8c')],_0x2d4bbc['aws_secret_access_key'],_0x2d4bbc[_0x9fb8('0x8d')],_0x2d4bbc[_0x9fb8('0x8e')]||_0x9fb8('0x8f'),_0x2d4bbc['text'],_0x2d4bbc[_0x9fb8('0x90')]||_0x9fb8('0x61'))[_0x9fb8('0x16')](function(_0x3e8b60){_0x35883e(null,_0x3e8b60);})['catch'](function(_0x33230e){_0x35883e(_0x33230e);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x91')]=function(_0x1925ce,_0x3b79f){scripts[_0x9fb8('0x91')](this[_0x9fb8('0xe')]['uniqueid'],_0x1925ce[_0x9fb8('0x8c')],_0x1925ce[_0x9fb8('0x92')],_0x1925ce[_0x9fb8('0x93')],_0x1925ce[_0x9fb8('0x61')],_0x1925ce[_0x9fb8('0x94')])[_0x9fb8('0x16')](function(_0xbcb0fa){_0x3b79f(null,_0xbcb0fa);})[_0x9fb8('0x14')](function(_0x3f1eda){_0x3b79f(_0x3f1eda);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x95')]=function(_0xc287e9,_0x137e5d,_0x49ef32){scripts[_0x9fb8('0x95')](_0x137e5d,_0xc287e9[_0x9fb8('0x7e')],_0xc287e9['google_asr_language']||_0x9fb8('0x63'))[_0x9fb8('0x16')](function(_0x33c1f2){_0x49ef32(null,_0x33c1f2);})[_0x9fb8('0x14')](function(_0x22655f){_0x49ef32(_0x22655f);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x96')]=function(_0xc91ee5,_0x499716,_0x2b4d24){scripts[_0x9fb8('0x96')](_0x499716,_0xc91ee5[_0x9fb8('0x97')],_0xc91ee5[_0x9fb8('0x98')],_0xc91ee5['uri'])[_0x9fb8('0x16')](function(_0x1e13a8){_0x2b4d24(null,_0x1e13a8);})[_0x9fb8('0x14')](function(_0x41e553){_0x2b4d24(_0x41e553);});};AGIVertices[_0x9fb8('0x11')]['clear']=function(_0xd0057b){var _0x119e7c=_[_0x9fb8('0x99')](verticesWithRetry,_0xd0057b['agicommand'])?_0xd0057b:_[_0x9fb8('0x9a')](_0xd0057b);for(var _0x4dc474 in _0x119e7c){if(_0x119e7c[_0x9fb8('0x9b')](_0x4dc474)){if(_0x119e7c[_0x4dc474]&&_[_0x9fb8('0x9c')](_0x119e7c[_0x4dc474])){if(_[_0x9fb8('0x99')](recursiveMapAttributes,_0x4dc474)){_0x119e7c[_0x4dc474]=this[_0x9fb8('0x9d')](_0x119e7c[_0x4dc474]);}else{_0x119e7c[_0x4dc474]=this[_0x9fb8('0x9e')](_0x119e7c[_0x4dc474]);}}}}return _0x119e7c;};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x9f')]=function(_0x11d425){for(var _0x52ec50 in _0x11d425){if(_0x11d425[_0x9fb8('0x9b')](_0x52ec50)){if(_[_0x9fb8('0xa0')](_0x11d425[_0x52ec50])){this['recursiveNodeIndex'](_0x11d425[_0x52ec50]);}else if(_[_0x9fb8('0xa1')](_0x11d425[_0x52ec50])){for(var _0x456d4c=0x0;_0x456d4c<_0x11d425[_0x52ec50][_0x9fb8('0xa2')];_0x456d4c++){this[_0x9fb8('0x9f')](_0x11d425[_0x52ec50][_0x456d4c]);}}else if(_[_0x9fb8('0x9c')](_0x11d425[_0x52ec50])){_0x11d425[_0x52ec50]=this[_0x9fb8('0x9e')](_0x11d425[_0x52ec50]);}}}};AGIVertices['prototype'][_0x9fb8('0xa3')]=function(_0x1357f0,_0x3f8383){for(var _0x45dccf in _0x1357f0){if(_0x1357f0['hasOwnProperty'](_0x45dccf)){if(_['isPlainObject'](_0x1357f0[_0x45dccf])){if(!_[_0x9fb8('0x4a')](_0x1357f0[_0x45dccf])){this[_0x9fb8('0xa3')](_0x1357f0[_0x45dccf],util['format'](_0x9fb8('0xa4'),_0x3f8383,_0x45dccf));}}else if(_[_0x9fb8('0xa1')](_0x1357f0[_0x45dccf])){for(var _0x46e4fa=0x0;_0x46e4fa<_0x1357f0[_0x45dccf][_0x9fb8('0xa2')];_0x46e4fa++){this[_0x9fb8('0xa3')](_0x1357f0[_0x45dccf][_0x46e4fa],util[_0x9fb8('0x2c')](_0x9fb8('0xa4'),_0x3f8383,_0x45dccf+'['+_0x46e4fa+']'));}}else{if(!_[_0x9fb8('0x4e')](_0x1357f0[_0x45dccf])){this[_0x9fb8('0xe')][_0x9fb8('0xa5')](util[_0x9fb8('0x2c')](_0x9fb8('0xa4'),_0x3f8383,_0x45dccf),_0x1357f0[_0x45dccf]);}}}}};AGIVertices['prototype'][_0x9fb8('0x9d')]=function(_0x3cf4a9){try{var _0x154107=JSON['parse'](_0x3cf4a9);this[_0x9fb8('0x9f')](_0x154107);return JSON[_0x9fb8('0x78')](_0x154107);}catch(_0x579281){return this[_0x9fb8('0x9e')](_0x3cf4a9);}};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x9e')]=function(_0x5e2da6){var _0x47b93f=_0x5e2da6['split']('{');for(var _0x990cd5=0x1;_0x990cd5<_0x47b93f[_0x9fb8('0xa2')];_0x990cd5+=0x1){var _0x2e1ccf=_0x47b93f[_0x990cd5][_0x9fb8('0xa6')]('}');if(_0x2e1ccf['length']>0x1){_0x5e2da6=_0x5e2da6[_0x9fb8('0xa7')]('{'+_0x2e1ccf[0x0]+'}',this[_0x9fb8('0xe')][_0x9fb8('0x12')](_0x2e1ccf[0x0])['extra']||_0x2e1ccf[0x0]);}}if(_0x47b93f[_0x9fb8('0xa2')]===0x1){return _0x5e2da6['toString']();}return this[_0x9fb8('0x9e')](_0x5e2da6);};AGIVertices['prototype'][_0x9fb8('0xa8')]=function(_0x294f85,_0xedc456){var _0x210f4e=this[_0x9fb8('0xe')]['getVariable'](_0x294f85);if(_0x210f4e[_0x9fb8('0xa9')]===-0x1){return _0x210f4e;}logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0xaa'),_0xedc456,_0x210f4e[_0x9fb8('0xab')]));return this['channel'][_0x9fb8('0xa5')](_0xedc456,_0x210f4e[_0x9fb8('0xab')]);};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x89')]=function(_0x37d0b3){return _0x37d0b3&&_0x37d0b3!=='0'&&_0x37d0b3!=='-1'&&_0x37d0b3!=='';};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xac')]=function(_0x58a132){this['createSquareDetailsReport']['sync'](this,_0x58a132,'-');_0x58a132[_0x9fb8('0xad')]=_0x58a132['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xae')]=function(_0x14b218){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x14b218[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x14b218[_0x9fb8('0x61')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0xb0'));}var _0x9a1b0='\x22'+_0x14b218[_0x9fb8('0x61')]+'\x22';if(this[_0x9fb8('0x89')](_0x14b218[_0x9fb8('0x7c')])){_0x9a1b0+=','+_0x14b218[_0x9fb8('0x7c')];}var _0x4f68db=this[_0x9fb8('0xe')][_0x9fb8('0x5d')](_0x9fb8('0xb1'),_0x9a1b0);if(_0x4f68db[_0x9fb8('0xa9')]===-0x1){return _0x4f68db;}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0xb2'),_0x9a1b0));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xb3')]=function(_0x510d8a){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0xb4'),_0x510d8a[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x510d8a[_0x9fb8('0xb5')])){return this['channel'][_0x9fb8('0xaf')](_0x9fb8('0xb6'));}var _0x2f5231=_0x510d8a[_0x9fb8('0xb5')];if(this[_0x9fb8('0x89')](_0x510d8a['options'])){_0x2f5231+=','+_0x510d8a[_0x9fb8('0x7c')];}var _0xf56d91=this[_0x9fb8('0xe')][_0x9fb8('0x5d')](_0x9fb8('0xb7'),_0x2f5231);if(_0xf56d91[_0x9fb8('0xa9')]===-0x1){return _0xf56d91;}var _0x56de00=this[_0x9fb8('0xa8')](_0x9fb8('0xb8'),_0x9fb8('0xb9'));if(_0x56de00['result']===-0x1){return _0x56de00;}var _0x1c2fdb=this[_0x9fb8('0xa8')](_0x9fb8('0xba'),_0x9fb8('0xbb'));if(_0x1c2fdb['result']===-0x1){return _0x1c2fdb;}var _0x450993=this['getAndSetVariable'](_0x9fb8('0xbc'),_0x9fb8('0xbd'));if(_0x450993[_0x9fb8('0xa9')]===-0x1){return _0x450993;}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0xbe'),_0x2f5231));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x7')]=function(_0x407464){logger['info'](util[_0x9fb8('0x2c')](_0x9fb8('0xbf'),_0x407464[_0x9fb8('0x3d')]));return this[_0x9fb8('0xe')][_0x9fb8('0x7')]([_0x407464[_0x9fb8('0xc0')],_0x407464[_0x9fb8('0xc1')]]);};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xc2')]=function(_0x146c25){logger['info'](util[_0x9fb8('0x2c')](_0x9fb8('0xc3'),_0x146c25[_0x9fb8('0x3d')]));if(this[_0x9fb8('0x89')](_0x146c25[_0x9fb8('0x6a')])){logger['info'](util[_0x9fb8('0x2c')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x146c25[_0x9fb8('0x6a')]));var _0x4383d1=this[_0x9fb8('0xe')]['wait'](_0x146c25[_0x9fb8('0x6a')]);if(_0x4383d1[_0x9fb8('0xa9')]===-0x1){return _0x4383d1;}}return this[_0x9fb8('0xe')][_0x9fb8('0xc2')]();};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xc4')]=function(_0x49dbcf){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0xc5'),_0x49dbcf['label']));if(!this[_0x9fb8('0x89')](_0x49dbcf[_0x9fb8('0x4f')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x49dbcf,_0x9fb8('0xc6'));}_0x49dbcf[_0x9fb8('0x50')]=moment();if(this[_0x9fb8('0x89')](_0x49dbcf['delay'])){_0x49dbcf[_0x9fb8('0x50')]=moment()[_0x9fb8('0xc7')](_0x49dbcf[_0x9fb8('0xc8')],'minutes');}if(!this[_0x9fb8('0x89')](_0x49dbcf['callback_priority'])){_0x49dbcf[_0x9fb8('0x53')]=0x2;}this[_0x9fb8('0x49')][_0x9fb8('0xc9')](this,_0x49dbcf);return this[_0x9fb8('0xe')]['noop'](util[_0x9fb8('0x2c')](_0x9fb8('0xca'),_0x49dbcf['phone'],_0x49dbcf[_0x9fb8('0x4f')],_0x49dbcf[_0x9fb8('0x50')]));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xcb')]=function(_0x2e3300){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0xcc'),_0x2e3300[_0x9fb8('0x3d')]));var _0x239045=this[_0x9fb8('0xe')][_0x9fb8('0x5d')](_0x2e3300[_0x9fb8('0xcd')],_0x2e3300['options']);if(_0x239045['result']===-0x1){return _0x239045;}return this['channel']['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x2e3300[_0x9fb8('0xcd')],_0x2e3300[_0x9fb8('0x7c')]));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xce')]=function(_0x2ac158){logger[_0x9fb8('0x31')](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x2ac158[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x2ac158['text'])){return this[_0x9fb8('0xe')]['noop'](_0x9fb8('0xb0'));}var _0x438b7f='\x22'+_0x2ac158[_0x9fb8('0x61')]+'\x22';if(this[_0x9fb8('0x89')](_0x2ac158['options'])){_0x438b7f+=','+_0x2ac158[_0x9fb8('0x7c')];}var _0x32acb4=this[_0x9fb8('0xe')]['exec']('MRCPSynth',_0x438b7f);if(_0x32acb4[_0x9fb8('0xa9')]===-0x1){return _0x32acb4;}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0xb2'),_0x438b7f));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xcf')]=function(_0x5c6259){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0xd0'),_0x5c6259[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x5c6259['text'])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0xb0'));}var _0x157136='\x22'+_0x5c6259['text']+'\x22';if(this[_0x9fb8('0x89')](_0x5c6259[_0x9fb8('0x7c')])){_0x157136+=','+_0x5c6259[_0x9fb8('0x7c')];}var _0x57181b=this[_0x9fb8('0xe')][_0x9fb8('0x5d')](_0x9fb8('0xb1'),_0x157136);if(_0x57181b[_0x9fb8('0xa9')]===-0x1){return _0x57181b;}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0xb2'),_0x157136));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xd1')]=function(_0x530afe){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0xd2'),_0x530afe[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x530afe[_0x9fb8('0xb5')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0xb6'));}var _0xaf52f7=_0x530afe[_0x9fb8('0xb5')];if(this[_0x9fb8('0x89')](_0x530afe[_0x9fb8('0x7c')])){_0xaf52f7+=','+_0x530afe[_0x9fb8('0x7c')];}var _0x4dba4a=this[_0x9fb8('0xe')][_0x9fb8('0x5d')]('MRCPRecog',_0xaf52f7);if(_0x4dba4a[_0x9fb8('0xa9')]===-0x1){return _0x4dba4a;}var _0x31bea9=this['getAndSetVariable'](_0x9fb8('0xb8'),_0x9fb8('0xd3'));if(_0x31bea9['result']===-0x1){return _0x31bea9;}var _0xc8dfe1=this[_0x9fb8('0xa8')](_0x9fb8('0xba'),_0x9fb8('0xd4'));if(_0xc8dfe1[_0x9fb8('0xa9')]===-0x1){return _0xc8dfe1;}var _0x2b1e08=this[_0x9fb8('0xa8')](_0x9fb8('0xbc'),_0x9fb8('0xd5'));if(_0x2b1e08[_0x9fb8('0xa9')]===-0x1){return _0x2b1e08;}return this['channel'][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0xbe'),_0xaf52f7));};AGIVertices['prototype'][_0x9fb8('0xd6')]=function(_0x4b1b7a){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0xd7'),_0x4b1b7a['label']));if(!this['isConfigured'](_0x4b1b7a['grammar'])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')]('no\x20grammar\x20configured');}var _0x24b592=_0x4b1b7a[_0x9fb8('0xb5')];if(this[_0x9fb8('0x89')](_0x4b1b7a[_0x9fb8('0x7c')])){_0x24b592+=','+_0x4b1b7a[_0x9fb8('0x7c')];}var _0x5883e1=this[_0x9fb8('0xe')][_0x9fb8('0x5d')](_0x9fb8('0xb7'),_0x24b592);if(_0x5883e1[_0x9fb8('0xa9')]===-0x1){return _0x5883e1;}var _0x5afd5a=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x9fb8('0xd8'));if(_0x5afd5a[_0x9fb8('0xa9')]===-0x1){return _0x5afd5a;}var _0x3514c1=this[_0x9fb8('0xa8')]('RECOG_INPUT()',_0x9fb8('0xd9'));if(_0x3514c1[_0x9fb8('0xa9')]===-0x1){return _0x3514c1;}var _0x463b7a=this[_0x9fb8('0xa8')](_0x9fb8('0xbc'),_0x9fb8('0xda'));if(_0x463b7a[_0x9fb8('0xa9')]===-0x1){return _0x463b7a;}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0xbe'),_0x24b592));};AGIVertices['prototype'][_0x9fb8('0xdb')]=function(_0x1f3cf0){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0xdc'),_0x1f3cf0[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x1f3cf0[_0x9fb8('0xdd')])){return this['channel'][_0x9fb8('0x36')](_0x1f3cf0,_0x9fb8('0xde'));}var _0x1d3683=this[_0x9fb8('0x1a')][_0x9fb8('0xc9')](this,_0x1f3cf0[_0x9fb8('0xdd')]);if(!_0x1d3683){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x1f3cf0,'no\x20odbc\x20database\x20found');}if(!this[_0x9fb8('0x89')](_0x1f3cf0[_0x9fb8('0x32')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x1f3cf0,_0x9fb8('0xdf'));}var _0x3d57b8=_0x1f3cf0['query'][_0x9fb8('0xe0')](/(\r\n|\n|\r)/gm,'\x20');this[_0x9fb8('0xe')]['noop'](util['format'](_0x9fb8('0xe1'),_0x3d57b8));var _0x10cde2=this[_0x9fb8('0x2e')][_0x9fb8('0xc9')](this,_0x1d3683,_0x3d57b8);this['createSquareDetailsReport'][_0x9fb8('0xc9')](this,_0x1f3cf0,_0x3d57b8);if(!this[_0x9fb8('0x89')](_0x1f3cf0['variable_id'])){return this['channel'][_0x9fb8('0xaf')](_0x9fb8('0xe2'));}var _0x105dbb=this[_0x9fb8('0x12')]['sync'](this,_0x1f3cf0['variable_id']);if(!_0x105dbb){return this[_0x9fb8('0xe')]['error'](_0x1f3cf0,_0x9fb8('0xe3'));}var _0x810d2e=this;_0x10cde2['forEach'](function(_0x2ca635,_0x13402a){Object['keys'](_0x2ca635)[_0x9fb8('0xe4')](function(_0x29dcaa){_0x810d2e[_0x9fb8('0xe')][_0x9fb8('0xa5')](util[_0x9fb8('0x2c')]('%s[%s][%s]',_0x105dbb,_0x13402a,_0x29dcaa),_0x2ca635[_0x29dcaa]);});});this[_0x9fb8('0xe')][_0x9fb8('0xa5')](util[_0x9fb8('0x2c')](_0x9fb8('0xe5'),_0x105dbb),_0x10cde2[_0x9fb8('0xa2')]);return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util['format'](_0x9fb8('0xe6'),_0x105dbb));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xe7')]=function(_0x36b465){logger[_0x9fb8('0xe8')](util[_0x9fb8('0x2c')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x36b465[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x36b465[_0x9fb8('0xe9')])){return this[_0x9fb8('0xe')]['error'](_0x36b465,_0x9fb8('0xea'));}var _0x353c3a=this[_0x9fb8('0xeb')][_0x9fb8('0xc9')](this,_0x36b465[_0x9fb8('0xe9')]);if(!_0x353c3a){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x36b465,_0x9fb8('0xec'));}var _0x685248=this[_0x9fb8('0xe')][_0x9fb8('0x5d')](_0x9fb8('0xed'),[util['format'](_0x9fb8('0xee'),_0x353c3a),_0x36b465[_0x9fb8('0x6a')],_0x36b465[_0x9fb8('0xef')],_0x36b465[_0x9fb8('0x68')]]);if(_0x685248[_0x9fb8('0xa9')]===-0x1){return _0x685248;}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0xf0'),_0x9fb8('0xed')));};AGIVertices[_0x9fb8('0x11')]['dialogflow']=function(_0x2fc65c){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0xf1'),_0x2fc65c[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x2fc65c[_0x9fb8('0x7e')])){return this[_0x9fb8('0xe')]['noop']('no\x20key\x20configured');}if(!this[_0x9fb8('0x89')](_0x2fc65c[_0x9fb8('0x61')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')]('no\x20text\x20configured');}this[_0x9fb8('0xe')][_0x9fb8('0xf2')]=!![];this[_0x9fb8('0x3b')](_0x2fc65c);this[_0x9fb8('0x48')](_0x2fc65c[_0x9fb8('0x61')],'in','','');this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0xf3'),_0x2fc65c[_0x9fb8('0x61')]));var _0x3ead53=this[_0x9fb8('0x7d')][_0x9fb8('0xc9')](this,_0x2fc65c);if(_0x3ead53){for(var _0x3d0d01 in _0x3ead53){if(_0x3ead53['hasOwnProperty'](_0x3d0d01)){this['channel'][_0x9fb8('0xa5')](util[_0x9fb8('0x2c')](_0x9fb8('0xf4'),_0x3d0d01[_0x9fb8('0x6e')]()),_0x3ead53[_0x3d0d01]);}}this['createSquareMessage'](_0x3ead53[_0x9fb8('0xf5')],_0x9fb8('0xf6'),_0x9fb8('0xf7'),'');return this['channel'][_0x9fb8('0xaf')](util['format'](_0x9fb8('0xf8'),_0x3ead53[_0x9fb8('0xf5')]));}return this[_0x9fb8('0xe')]['error'](_0x2fc65c,_0x9fb8('0xf9'));};AGIVertices['prototype'][_0x9fb8('0xfa')]=function(_0x4534ca){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0xfb'),_0x4534ca[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x4534ca[_0x9fb8('0x80')])){return this['channel'][_0x9fb8('0xaf')](_0x9fb8('0xfc'));}if(!this[_0x9fb8('0x89')](_0x4534ca[_0x9fb8('0x81')])){return this[_0x9fb8('0xe')]['noop'](_0x9fb8('0xfd'));}if(!this[_0x9fb8('0x89')](_0x4534ca[_0x9fb8('0xfe')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0xff'));}if(!this[_0x9fb8('0x89')](_0x4534ca[_0x9fb8('0x82')])){return this[_0x9fb8('0xe')]['noop'](_0x9fb8('0x100'));}if(!this['isConfigured'](_0x4534ca['text'])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')]('no\x20text\x20configured');}this[_0x9fb8('0xe')]['bot']=!![];this[_0x9fb8('0x3b')](_0x4534ca);this[_0x9fb8('0x48')](_0x4534ca[_0x9fb8('0x61')],'in','','');this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util['format'](_0x9fb8('0x101'),_0x4534ca[_0x9fb8('0x61')]));var _0x47dcd3=this[_0x9fb8('0x7f')][_0x9fb8('0xc9')](this,_0x4534ca);if(_0x47dcd3){for(var _0x55eff5 in _0x47dcd3){if(_0x47dcd3['hasOwnProperty'](_0x55eff5)){if(_0x55eff5!=='providerResponse'){this[_0x9fb8('0xe')][_0x9fb8('0xa5')](util['format'](_0x9fb8('0xf4'),_0x55eff5[_0x9fb8('0x6e')]()),_0x47dcd3[_0x55eff5]);}}}this[_0x9fb8('0x48')](_0x47dcd3['speech'],_0x9fb8('0xf6'),_0x9fb8('0xfa'),_0x47dcd3[_0x9fb8('0x102')]);return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x103'),_0x47dcd3[_0x9fb8('0xf5')]));}return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x4534ca,_0x9fb8('0x104'));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x105')]=function(_0x29a607){logger[_0x9fb8('0x31')](util['format'](_0x9fb8('0x106'),_0x29a607[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x29a607[_0x9fb8('0x107')])){return this[_0x9fb8('0xe')]['noop'](_0x9fb8('0x108'));}if(!this[_0x9fb8('0x89')](_0x29a607[_0x9fb8('0x109')])){return this[_0x9fb8('0xe')]['noop']('no\x20username\x20configured');}if(!this[_0x9fb8('0x89')](_0x29a607[_0x9fb8('0x10a')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0x10b'));}if(!this[_0x9fb8('0x89')](_0x29a607[_0x9fb8('0x10c')])){return this['channel'][_0x9fb8('0xaf')]('no\x20text\x20configured');}this[_0x9fb8('0xe')][_0x9fb8('0xf2')]=!![];this[_0x9fb8('0x3b')](_0x29a607);this['createSquareMessage'](_0x29a607[_0x9fb8('0x61')],'in','','');this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util['format'](_0x9fb8('0x10d'),_0x29a607[_0x9fb8('0x61')]));var _0x4a588e=this[_0x9fb8('0x83')][_0x9fb8('0xc9')](this,_0x29a607);if(_0x4a588e){for(var _0x542b69 in _0x4a588e){if(_0x4a588e[_0x9fb8('0x9b')](_0x542b69)){this[_0x9fb8('0xe')]['setVariable'](util['format']('SESTEK_NDA_%s',_0x542b69[_0x9fb8('0x6e')]()),_0x4a588e[_0x542b69]);}}this[_0x9fb8('0x48')](_0x4a588e[_0x9fb8('0xf5')],_0x9fb8('0xf6'),_0x9fb8('0x105'),'');if(_0x4a588e['audiofile']){this[_0x9fb8('0xe')]['noop'](util['format'](_0x9fb8('0x10e'),_0x4a588e[_0x9fb8('0x10f')]));var _0x3e9d83=this[_0x9fb8('0xe')]['streamFile'](_0x4a588e[_0x9fb8('0x10f')]);try{fs[_0x9fb8('0x110')](_0x4a588e[_0x9fb8('0x10f')]+'.wav');}catch(_0x27ec04){logger['error'](_0x27ec04);}return _0x3e9d83;}else{return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x111'),_0x4a588e['speech']));}}return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x29a607,_0x9fb8('0x112'));};AGIVertices[_0x9fb8('0x11')]['end']=function(_0x1733e1){logger[_0x9fb8('0x31')](util['format'](_0x9fb8('0x113'),_0x1733e1[_0x9fb8('0x3d')]));return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0x114'));};AGIVertices[_0x9fb8('0x11')]['ext_dial']=function(_0xd645bc){logger[_0x9fb8('0x31')](util['format'](_0x9fb8('0x115'),_0xd645bc[_0x9fb8('0x3d')]));var _0x56d8f4='';if(_0xd645bc[_0x9fb8('0x116')]){if(!this[_0x9fb8('0x89')](_0xd645bc[_0x9fb8('0x116')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0xd645bc,'no\x20trunk\x20selected');}else{var _0x5b07d4=parseInt(_0xd645bc['trunk_id'],0xa);if(isNaN(_0x5b07d4)){_0x56d8f4=_0xd645bc[_0x9fb8('0x116')];}else{_0x56d8f4=this[_0x9fb8('0x1e')][_0x9fb8('0xc9')](this,_0xd645bc[_0x9fb8('0x116')]);if(!_0x56d8f4){return this[_0x9fb8('0xe')]['error'](_0xd645bc,_0x9fb8('0x117'));}}}}else if(_0xd645bc[_0x9fb8('0x118')]){_0x56d8f4=_0xd645bc['trunk_name'];}else{return this[_0x9fb8('0xe')]['error'](_0xd645bc,_0x9fb8('0x119'));}var _0x4a05d0=this[_0x9fb8('0xe')]['exec'](_0x9fb8('0xed'),[util[_0x9fb8('0x2c')]('SIP/%s/%s',_0x56d8f4,_0xd645bc[_0x9fb8('0x11a')]),_0xd645bc['timeout'],_0xd645bc['opts'],_0xd645bc[_0x9fb8('0x68')]]);if(_0x4a05d0[_0x9fb8('0xa9')]===-0x1){return _0x4a05d0;}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util['format'](_0x9fb8('0xf0'),_0x9fb8('0xed')));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x11b')]=function(_0x2ed134){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x11c'),_0x2ed134[_0x9fb8('0x3d')]));return this[_0x9fb8('0xe')][_0x9fb8('0xaf')]('finally');};AGIVertices['prototype'][_0x9fb8('0xc')]=function(_0x4a26de){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x11d'),_0x4a26de[_0x9fb8('0x3d')]));if(_0x4a26de[_0x9fb8('0xad')]===0x0){return this[_0x9fb8('0xac')](_0x4a26de);}_0x4a26de[_0x9fb8('0xad')]-=0x1;if(!this[_0x9fb8('0x89')](_0x4a26de[_0x9fb8('0x11e')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x4a26de,_0x9fb8('0x11f'));}var _0x561f57=this[_0x9fb8('0x120')][_0x9fb8('0xc9')](this,_0x4a26de[_0x9fb8('0x11e')]);if(!_0x561f57){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x4a26de,_0x9fb8('0x121'));}if(!this[_0x9fb8('0x89')](_0x4a26de[_0x9fb8('0x122')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x9fb8('0xe2'));}var _0x122f00=this[_0x9fb8('0xe')][_0x9fb8('0x123')](_0x561f57,_0x4a26de['response'],_0x4a26de[_0x9fb8('0x124')]);var _0x30f2c6=_0x122f00[_0x9fb8('0xa9')]?_0x122f00[_0x9fb8('0xa9')][_0x9fb8('0x52')]():'';logger[_0x9fb8('0x31')](_0x9fb8('0x125'),JSON[_0x9fb8('0x78')](_0x122f00));if(_0x122f00['result']===-0x1){this[_0x9fb8('0x3b')][_0x9fb8('0xc9')](this,_0x4a26de,_0x30f2c6);return _0x122f00;}else if(_0x122f00[_0x9fb8('0xab')]===_0x9fb8('0x6a')){_0x122f00[_0x9fb8('0xa9')]=_0x30f2c6[_0x9fb8('0xa2')]>=parseInt(_0x4a26de[_0x9fb8('0x126')])?'x':'i';}else{_0x122f00['result']=_0x30f2c6[_0x9fb8('0xa2')]>=parseInt(_0x4a26de[_0x9fb8('0x126')])&&_0x30f2c6[_0x9fb8('0xa2')]<=parseInt(_0x4a26de[_0x9fb8('0x124')])?'x':'i';}var _0x3e4b05=this[_0x9fb8('0x12')][_0x9fb8('0xc9')](this,_0x4a26de[_0x9fb8('0x122')]);if(!_0x3e4b05){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x4a26de,_0x9fb8('0xe3'));}this[_0x9fb8('0xe')][_0x9fb8('0xa5')](_0x3e4b05,_0x30f2c6);if(this[_0x9fb8('0x89')](_0x4a26de[_0x9fb8('0x127')])){var _0x3af9ac=parseInt(_0x4a26de[_0x9fb8('0x127')],0xa);var _0x3a46fa=rs['generate']({'charset':'*','length':_0x3af9ac});var _0x221f72=_0x30f2c6[_0x9fb8('0xa2')];if(_0x221f72>0x0){if(_0x221f72>_0x3af9ac){this[_0x9fb8('0x3b')]['sync'](this,_0x4a26de,_0x4a26de[_0x9fb8('0x128')]===_0x9fb8('0x129')?_0x3a46fa+_0x30f2c6[_0x9fb8('0x12a')](_0x3af9ac):_0x30f2c6[_0x9fb8('0x12a')](0x0,_0x221f72-_0x3af9ac)+_0x3a46fa);}else{this[_0x9fb8('0x3b')][_0x9fb8('0xc9')](this,_0x4a26de,rs[_0x9fb8('0x12b')]({'charset':'*','length':_0x221f72}));}}else{this['createSquareDetailsReport'][_0x9fb8('0xc9')](this,_0x4a26de,'');}}else{this[_0x9fb8('0x3b')][_0x9fb8('0xc9')](this,_0x4a26de,_0x30f2c6);}return _0x122f00;};AGIVertices['prototype'][_0x9fb8('0xd')]=function(_0x319e02){logger[_0x9fb8('0x31')](util['format'](_0x9fb8('0x12c'),_0x319e02['label']));return this['getdigits'](_0x319e02);};AGIVertices[_0x9fb8('0x11')]['goal']=function(_0x282bde){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x12d'),_0x282bde['label']));this[_0x9fb8('0x3b')][_0x9fb8('0xc9')](this,_0x282bde,_0x282bde[_0x9fb8('0x12e')]);return this['channel'][_0x9fb8('0xaf')](util['format'](_0x9fb8('0x12f'),_0x282bde[_0x9fb8('0x12e')]));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x130')]=function(_0x384775){logger[_0x9fb8('0x31')](util['format'](_0x9fb8('0x131'),_0x384775[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x384775[_0x9fb8('0x8c')])||!this[_0x9fb8('0x89')](_0x384775[_0x9fb8('0x92')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0x132'));}if(!this[_0x9fb8('0x89')](_0x384775[_0x9fb8('0x61')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0xb0'));}this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')]('Trying\x20aws\x20Polly\x20%s',_0x384775[_0x9fb8('0x61')]));var _0x5da7ef=this[_0x9fb8('0x8b')][_0x9fb8('0xc9')](this,_0x384775);if(_0x5da7ef){this[_0x9fb8('0xe')]['noop'](util[_0x9fb8('0x2c')](_0x9fb8('0x133'),_0x5da7ef));var _0x166cc9=this[_0x9fb8('0xe')][_0x9fb8('0x134')](_0x5da7ef);try{fs[_0x9fb8('0x110')](_0x5da7ef+_0x9fb8('0x135'));}catch(_0x5e344b){logger[_0x9fb8('0x36')](_0x5e344b);}return _0x166cc9;}return this[_0x9fb8('0xe')]['error'](_0x384775,_0x9fb8('0x136'));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x137')]=function(_0x5efb44){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x138'),_0x5efb44[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x5efb44[_0x9fb8('0x8c')])||!this['isConfigured'](_0x5efb44[_0x9fb8('0x92')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0x132'));}if(!this[_0x9fb8('0x89')](_0x5efb44[_0x9fb8('0x94')])){return this[_0x9fb8('0xe')]['noop'](_0x9fb8('0x139'));}if(!this[_0x9fb8('0x89')](_0x5efb44[_0x9fb8('0x61')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0xb0'));}this[_0x9fb8('0xe')][_0x9fb8('0xf2')]=!![];this[_0x9fb8('0x3b')](_0x5efb44);this[_0x9fb8('0x48')](_0x5efb44[_0x9fb8('0x61')],'in','','');this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x13a'),_0x5efb44[_0x9fb8('0x61')]));var _0xa650c6=this[_0x9fb8('0x91')]['sync'](this,_0x5efb44);if(_0xa650c6){for(var _0x4a6527 in _0xa650c6){if(_0xa650c6[_0x9fb8('0x9b')](_0x4a6527)&&_[_0x9fb8('0x9c')](_0xa650c6[_0x4a6527])){this[_0x9fb8('0xe')][_0x9fb8('0xa5')](util[_0x9fb8('0x2c')](_0x9fb8('0x13b'),_0x4a6527[_0x9fb8('0x6e')]()),_0xa650c6[_0x4a6527]);}}if(_[_0x9fb8('0x4e')](_0xa650c6['message'])){return this['channel'][_0x9fb8('0xaf')](_0x9fb8('0x13c'));}else{this[_0x9fb8('0x48')](_0xa650c6[_0x9fb8('0x13d')],_0x9fb8('0xf6'),_0x9fb8('0x13e'),'');return this[_0x9fb8('0xe')]['noop'](util[_0x9fb8('0x2c')](_0x9fb8('0x13f'),_0xa650c6['message']));}}return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x5efb44,_0x9fb8('0x140'));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x141')]=function(_0x29f07e){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x142'),_0x29f07e[_0x9fb8('0x3d')],_0x29f07e['timeout']));if(!this['isConfigured'](_0x29f07e[_0x9fb8('0x7e')])){return this[_0x9fb8('0xe')]['noop'](_0x9fb8('0x143'));}var _0x5824a5=_0x9fb8('0x144');var _0x5db766=util[_0x9fb8('0x2c')](_0x9fb8('0x145'),FILES_PATH,rs['generate'](0x4));var _0x5a60a2=util[_0x9fb8('0x2c')]('%s.%s',_0x5db766,_0x5824a5);var _0x5a71d7=!![];if(_0x29f07e[_0x9fb8('0x146')]===_0x9fb8('0x147')){_0x5a71d7=![];}var _0x55f120=this[_0x9fb8('0xe')][_0x9fb8('0x148')](_0x5db766,_0x5824a5,_0x29f07e[_0x9fb8('0x149')],_0x29f07e[_0x9fb8('0x6a')],undefined,_0x5a71d7);if(_0x55f120[_0x9fb8('0xa9')]!==-0x1){this[_0x9fb8('0xe')]['noop'](util[_0x9fb8('0x2c')]('google\x20%s\x20file\x20created',_0x5a60a2));var _0x4fed8c=this['googleASR'][_0x9fb8('0xc9')](this,_0x29f07e,_0x5a60a2);if(_0x4fed8c){for(var _0x382536 in _0x4fed8c){if(_0x4fed8c[_0x9fb8('0x9b')](_0x382536)){this[_0x9fb8('0xe')][_0x9fb8('0xa5')](util[_0x9fb8('0x2c')]('GOOGLE_ASR_%s',_0x382536[_0x9fb8('0x6e')]()),_0x4fed8c[_0x382536]);}}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util['format'](_0x9fb8('0x14a'),JSON[_0x9fb8('0x78')](_0x4fed8c)));}}return _0x55f120;};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x14b')]=function(_0x41d87f){logger[_0x9fb8('0x31')](util['format'](_0x9fb8('0x14c'),_0x41d87f[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x41d87f[_0x9fb8('0x97')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0x14d'));}if(!this[_0x9fb8('0x89')](_0x41d87f[_0x9fb8('0x98')])){return this[_0x9fb8('0xe')]['noop'](_0x9fb8('0x14e'));}var _0x4dc6cb=_0x9fb8('0x144');var _0x1ffb61=util[_0x9fb8('0x2c')](_0x9fb8('0x145'),FILES_PATH,rs['generate'](0x4));var _0x241a9d=util['format'](_0x9fb8('0xa4'),_0x1ffb61,_0x4dc6cb);var _0x198c1f=!![];if(_0x41d87f[_0x9fb8('0x146')]===_0x9fb8('0x147')){_0x198c1f=![];}var _0x54032f=this[_0x9fb8('0xe')][_0x9fb8('0x148')](_0x1ffb61,_0x4dc6cb,_0x41d87f['intKey'],_0x41d87f['timeout'],undefined,_0x198c1f);if(_0x54032f[_0x9fb8('0xa9')]!==-0x1){this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util['format'](_0x9fb8('0x14f'),_0x241a9d));var _0xfe0994=this[_0x9fb8('0x96')][_0x9fb8('0xc9')](this,_0x41d87f,_0x241a9d);if(_0xfe0994){for(var _0x2fda8b in _0xfe0994){if(_0xfe0994[_0x9fb8('0x9b')](_0x2fda8b)){this['channel']['setVariable'](util['format'](_0x9fb8('0x150'),_0x2fda8b[_0x9fb8('0x6e')]()),_0xfe0994[_0x2fda8b]);}}return this['channel'][_0x9fb8('0xaf')](util['format'](_0x9fb8('0x151'),JSON[_0x9fb8('0x78')](_0xfe0994)));}}return _0x54032f;};AGIVertices['prototype'][_0x9fb8('0x152')]=function(_0x3b76d3){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x153'),_0x3b76d3['label']));return this[_0x9fb8('0xe')][_0x9fb8('0x154')](_0x3b76d3[_0x9fb8('0x43')],_0x3b76d3[_0x9fb8('0x44')],_0x3b76d3['priority']);};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x155')]=function(_0x788de5){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x156'),_0x788de5[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x788de5[_0x9fb8('0x157')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x788de5,_0x9fb8('0x158'));}try{var _0x5b7108=eval(_0x788de5[_0x9fb8('0x157')])?_0x9fb8('0x159'):_0x9fb8('0x15a');this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util['format'](_0x9fb8('0x15b'),_0x788de5[_0x9fb8('0x157')],_0x5b7108));return{'code':0xc8,'result':_0x5b7108};}catch(_0x417551){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x9fb8('0x11')]['gotoiftime']=function(_0x5348d1){logger['info'](util[_0x9fb8('0x2c')](_0x9fb8('0x15c'),_0x5348d1['label']));if(!this['isConfigured'](_0x5348d1[_0x9fb8('0x15d')])){return this['channel'][_0x9fb8('0x36')](_0x5348d1,'no\x20interval\x20configured');}var _0x1cf48a=this[_0x9fb8('0x26')][_0x9fb8('0xc9')](this,_0x5348d1[_0x9fb8('0x15d')]);if(!_0x1cf48a){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x5348d1,'no\x20intervals\x20found');}for(var _0x51948b=0x0;_0x51948b<_0x1cf48a[_0x9fb8('0xa2')];_0x51948b+=0x1){var _0x1dad6f=this[_0x9fb8('0xe')]['getVariable'](util[_0x9fb8('0x2c')]('IFTIME(%s?true:false)',_0x1cf48a[_0x51948b]));if(_0x1dad6f[_0x9fb8('0xa9')]===-0x1){return _0x1dad6f;}logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x15e'),_0x1cf48a[_0x51948b],_0x1dad6f['extra']));if(_0x1dad6f[_0x9fb8('0xab')]===_0x9fb8('0x159')){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x15e'),_0x1cf48a[_0x51948b],_0x9fb8('0x159')));this['channel']['noop'](util[_0x9fb8('0x2c')](_0x9fb8('0x15e'),_0x1cf48a[_0x51948b],_0x9fb8('0x159')));return{'code':0xc8,'result':_0x9fb8('0x159')};}else{logger['info'](util[_0x9fb8('0x2c')](_0x9fb8('0x15e'),_0x1cf48a[_0x51948b],_0x9fb8('0x15a')));this['channel'][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')]('IFTIME\x20%s\x20%s',_0x1cf48a[_0x51948b],_0x9fb8('0x15a')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0x9fb8('0x15f')]=function(_0x51de4d){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x160'),_0x51de4d[_0x9fb8('0x3d')]));return this[_0x9fb8('0xe')][_0x9fb8('0x15f')]();};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x161')]=function(_0x487fa1){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x162'),_0x487fa1[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x487fa1[_0x9fb8('0x7e')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0x143'));}var _0x4bb84d=_0x9fb8('0x144');var _0x3ebed0=util[_0x9fb8('0x2c')]('%s/recordings/%s',FILES_PATH,rs[_0x9fb8('0x12b')](0x4));var _0x4ff215=util[_0x9fb8('0x2c')](_0x9fb8('0xa4'),_0x3ebed0,_0x4bb84d);var _0x53446f=!![];if(_0x487fa1[_0x9fb8('0x146')]===_0x9fb8('0x147')){_0x53446f=![];}var _0x422d74=this[_0x9fb8('0xe')][_0x9fb8('0x148')](_0x3ebed0,_0x4bb84d,_0x487fa1[_0x9fb8('0x149')],_0x487fa1[_0x9fb8('0x6a')],undefined,_0x53446f);if(_0x422d74[_0x9fb8('0xa9')]!==-0x1){this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x163'),_0x4ff215));var _0x2dd47e=this['ispeechASR']['sync'](this,_0x487fa1,_0x4ff215);if(_0x2dd47e){for(var _0x5289f9 in _0x2dd47e){if(_0x2dd47e['hasOwnProperty'](_0x5289f9)){this['channel'][_0x9fb8('0xa5')](util['format'](_0x9fb8('0x164'),_0x5289f9['toUpperCase']()),_0x2dd47e[_0x5289f9]);}}return this['channel']['noop'](util[_0x9fb8('0x2c')]('IspeechASR\x20Result\x20%s',JSON[_0x9fb8('0x78')](_0x2dd47e)));}}return _0x422d74;};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x165')]=function(_0x6c7102){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x166'),_0x6c7102[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x6c7102[_0x9fb8('0x7e')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0x143'));}if(!this['isConfigured'](_0x6c7102[_0x9fb8('0x61')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0xb0'));}this['channel'][_0x9fb8('0xaf')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x6c7102[_0x9fb8('0x61')]));var _0xa218aa=this[_0x9fb8('0x84')][_0x9fb8('0xc9')](this,_0x6c7102);if(_0xa218aa){this['channel'][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')]('ispeech\x20%s\x20file\x20created',_0xa218aa));var _0x15975f=this[_0x9fb8('0xe')][_0x9fb8('0x134')](_0xa218aa,_0x6c7102[_0x9fb8('0x149')]);try{fs['unlink'](_0xa218aa+_0x9fb8('0x135'));}catch(_0x515930){logger[_0x9fb8('0x36')](_0x515930);}return _0x15975f;}return this['channel'][_0x9fb8('0x36')](_0x6c7102,_0x9fb8('0x167'));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x168')]=function(_0x32198d){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x32198d['label']));if(!this[_0x9fb8('0x89')](_0x32198d[_0x9fb8('0x169')])){return this[_0x9fb8('0xe')]['error'](_0x32198d,_0x9fb8('0x16a'));}logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x32198d[_0x9fb8('0x169')]));var _0x37ce8c=this['agentLogin'][_0x9fb8('0xc9')](this,_0x32198d[_0x9fb8('0x169')]);if(_0x37ce8c){logger[_0x9fb8('0x31')](util['format'](_0x9fb8('0x16b'),this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x32198d[_0x9fb8('0x169')]));this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x32198d[_0x9fb8('0x169')]));return{'code':0xc8,'result':'success'};}else{logger[_0x9fb8('0x31')](util['format'](_0x9fb8('0x16c'),this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x32198d['findBy']));this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x16c'),this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x32198d[_0x9fb8('0x169')]));return{'code':0xc8,'result':_0x9fb8('0x16d')};}};AGIVertices['prototype'][_0x9fb8('0x16e')]=function(_0x4c1076){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x16f'),_0x4c1076[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x4c1076[_0x9fb8('0x169')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x4c1076,_0x9fb8('0x16a'));}logger['info'](util['format'](_0x9fb8('0x170'),this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x4c1076['findBy']));var _0x21625e=this[_0x9fb8('0x58')][_0x9fb8('0xc9')](this,_0x4c1076[_0x9fb8('0x169')]);if(_0x21625e){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x16b'),this['channel'][_0x9fb8('0x40')],_0x4c1076[_0x9fb8('0x169')]));this['channel'][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x16b'),this['channel'][_0x9fb8('0x40')],_0x4c1076[_0x9fb8('0x169')]));return{'code':0xc8,'result':_0x9fb8('0x171')};}else{logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x4c1076['findBy']));this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x4c1076[_0x9fb8('0x169')]));return{'code':0xc8,'result':_0x9fb8('0x16d')};}};AGIVertices['prototype'][_0x9fb8('0x172')]=function(_0x120638){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x173'),_0x120638['label']));if(!this[_0x9fb8('0x89')](_0x120638[_0x9fb8('0x174')])){return this['channel']['error'](_0x120638,_0x9fb8('0x175'));}this[_0x9fb8('0xe')]['noop'](util[_0x9fb8('0x2c')](_0x9fb8('0x176'),_0x120638['operation']));var _0x2867c8=eval(_0x120638[_0x9fb8('0x174')]);if(!this[_0x9fb8('0x89')](_0x120638[_0x9fb8('0x122')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0xe2'));}var _0x20c850=this['getVariable'][_0x9fb8('0xc9')](this,_0x120638[_0x9fb8('0x122')]);if(!_0x20c850){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x120638,'no\x20variable\x20found');}if(_[_0x9fb8('0xa1')](_0x2867c8)){var _0x5f4842=this;_0x2867c8[_0x9fb8('0xe4')](function(_0x13da77,_0x36b851){_0x5f4842[_0x9fb8('0xe')][_0x9fb8('0xa5')](util[_0x9fb8('0x2c')](_0x9fb8('0x177'),_0x20c850,_0x36b851),_0x13da77);});return this[_0x9fb8('0xe')]['noop'](util[_0x9fb8('0x2c')](_0x9fb8('0x178'),_0x20c850));}else{return this[_0x9fb8('0xe')][_0x9fb8('0xa5')](_0x20c850,_0x2867c8);}};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xb')]=function(_0x3a6189){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x179'),_0x3a6189[_0x9fb8('0x3d')]));if(_0x3a6189[_0x9fb8('0xad')]===0x0){return this['maxRetry'](_0x3a6189);}_0x3a6189['retry']-=0x1;if(!this[_0x9fb8('0x89')](_0x3a6189[_0x9fb8('0x11e')])){return this['channel'][_0x9fb8('0x36')](_0x3a6189,_0x9fb8('0x11f'));}var _0x4f48b9=this[_0x9fb8('0x120')]['sync'](this,_0x3a6189[_0x9fb8('0x11e')]);if(!_0x4f48b9){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x3a6189,_0x9fb8('0x121'));}var _0x3d166b=this[_0x9fb8('0xe')]['getData'](_0x4f48b9,_0x3a6189[_0x9fb8('0x17a')],_0x3a6189[_0x9fb8('0x17b')]);var _0x30f265=_0x3d166b[_0x9fb8('0xa9')];if(_0x3d166b[_0x9fb8('0xa9')]===-0x1){this[_0x9fb8('0x3b')][_0x9fb8('0xc9')](this,_0x3a6189,'-1');return _0x3d166b;}else if(_0x3d166b[_0x9fb8('0xab')]===_0x9fb8('0x6a')){_0x3d166b[_0x9fb8('0xa9')]=_0x3d166b[_0x9fb8('0xa9')]['length']>0x0?_0x3d166b[_0x9fb8('0xa9')]:'t';}else if(_[_0x9fb8('0x4a')](_0x3d166b[_0x9fb8('0xa9')])){_0x3d166b['result']='#';_0x30f265='#';}if(!this[_0x9fb8('0x89')](_0x3a6189[_0x9fb8('0x122')])){this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0xe2'));}else{var _0x2afee7=this['getVariable']['sync'](this,_0x3a6189[_0x9fb8('0x122')]);if(!_0x2afee7){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x3a6189,_0x9fb8('0xe3'));}this[_0x9fb8('0xe')][_0x9fb8('0xa5')](_0x2afee7,_0x30f265);}this['createSquareDetailsReport'][_0x9fb8('0xc9')](this,_0x3a6189,_0x30f265);return _0x3d166b;};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xaf')]=function(_0x5069b5){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x17c'),_0x5069b5[_0x9fb8('0x3d')]));return this[_0x9fb8('0xe')]['noop'](_0x5069b5[_0x9fb8('0x17d')]||_0x5069b5[_0x9fb8('0x3d')]);};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x17e')]=function(_0x2d3eb9){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x17f'),_0x2d3eb9[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x2d3eb9[_0x9fb8('0x169')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x2d3eb9,_0x9fb8('0x16a'));}logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x2d3eb9[_0x9fb8('0x169')]));var _0x5e671d=this[_0x9fb8('0x54')][_0x9fb8('0xc9')](this,_0x2d3eb9[_0x9fb8('0x180')]);var _0x50f21a=this['agentPause'][_0x9fb8('0xc9')](this,_0x2d3eb9['findBy'],_0x5e671d);if(_0x50f21a){logger['info'](util[_0x9fb8('0x2c')](_0x9fb8('0x16b'),this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x2d3eb9[_0x9fb8('0x169')]));this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x16b'),this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x2d3eb9[_0x9fb8('0x169')]));return{'code':0xc8,'result':_0x9fb8('0x171')};}else{logger['info'](util[_0x9fb8('0x2c')](_0x9fb8('0x16c'),this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x2d3eb9['findBy']));this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x16b'),this['channel'][_0x9fb8('0x40')],_0x2d3eb9[_0x9fb8('0x169')]));return{'code':0xc8,'result':_0x9fb8('0x16d')};}};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x181')]=function(_0x502254){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x502254['label']));if(!this['isConfigured'](_0x502254[_0x9fb8('0x11e')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x502254,'no\x20file\x20audio\x20selected');}var _0x29aea4=this[_0x9fb8('0x120')][_0x9fb8('0xc9')](this,_0x502254[_0x9fb8('0x11e')]);if(!_0x29aea4){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x502254,'no\x20file\x20audio\x20found');}var _0x10c43e=this[_0x9fb8('0xe')][_0x9fb8('0x5d')](_0x9fb8('0x182'),[_0x29aea4,_0x502254[_0x9fb8('0xef')]]);if(_0x10c43e[_0x9fb8('0xa9')]===-0x1){return _0x10c43e;}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x183'),_0x9fb8('0x182'),_0x29aea4));};AGIVertices['prototype']['queue']=function(_0x20d142){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x184'),_0x20d142['label']));if(!this[_0x9fb8('0x89')](_0x20d142[_0x9fb8('0x185')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x20d142,_0x9fb8('0x186'));}var _0x550696='';var _0x18ba07=parseInt(_0x20d142['queue_id'],0xa);if(isNaN(_0x18ba07)){_0x550696=_0x20d142[_0x9fb8('0x185')];}else{_0x550696=this[_0x9fb8('0x187')][_0x9fb8('0xc9')](this,_0x20d142[_0x9fb8('0x185')]);if(!_0x550696){return this['channel'][_0x9fb8('0x36')](_0x20d142,_0x9fb8('0x188'));}}var _0x25058f='';if(this[_0x9fb8('0x89')](_0x20d142['file_id'])){var _0x2e314d=this['getSound']['sync'](this,_0x20d142[_0x9fb8('0x11e')]);if(_0x2e314d){_0x25058f=_0x2e314d;}}this[_0x9fb8('0x3b')][_0x9fb8('0xc9')](this,_0x20d142,_0x550696);if(_0x20d142[_0x9fb8('0xef')][_0x9fb8('0x189')]('x')<0x0){_0x20d142[_0x9fb8('0xef')]+='x';}if(_0x20d142[_0x9fb8('0xef')][_0x9fb8('0x189')]('X')<0x0){_0x20d142[_0x9fb8('0xef')]+='X';}this[_0x9fb8('0xe')][_0x9fb8('0xa5')](_0x9fb8('0x18a'),_0x550696?_0x550696[_0x9fb8('0x18b')]():'');var _0x498565=this['channel'][_0x9fb8('0x5d')](_0x9fb8('0x18c'),[_0x550696,_0x20d142[_0x9fb8('0xef')],_0x20d142[_0x9fb8('0x68')],_0x25058f,_0x20d142[_0x9fb8('0x6a')],_0x20d142[_0x9fb8('0x7')],_0x20d142[_0x9fb8('0x18d')],_0x20d142['gosub'],'',_0x20d142[_0x9fb8('0x18e')]]);if(_0x498565[_0x9fb8('0xa9')]===-0x1){return _0x498565;}return this['channel'][_0x9fb8('0xaf')](util['format'](_0x9fb8('0x183'),'QUEUE',_0x550696));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x18f')]=function(_0x53477b){logger[_0x9fb8('0x31')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x53477b[_0x9fb8('0x3d')]));var _0x39a6c3=_0x53477b[_0x9fb8('0x190')]||_0x9fb8('0x144');var _0x31ed88=util[_0x9fb8('0x2c')](_0x9fb8('0x191'),this[_0x9fb8('0xe')][_0x9fb8('0x3c')],rs['generate'](0x5));var _0x4e1eef=util[_0x9fb8('0x2c')]('%s/recordings/%s.%s',FILES_PATH,_0x31ed88,_0x39a6c3);var _0x338fe1=util['format'](_0x9fb8('0x145'),FILES_PATH,_0x31ed88);this[_0x9fb8('0x41')][_0x9fb8('0xc9')](this,_0x53477b,_0x31ed88,_0x4e1eef);this[_0x9fb8('0xe')][_0x9fb8('0xa5')]('RECORDING_SAVENAME',_0x31ed88);logger[_0x9fb8('0x31')](_0x9fb8('0x192'),_0x338fe1,_0x39a6c3,_0x53477b[_0x9fb8('0x193')],_0x53477b['timeout']);return this['channel'][_0x9fb8('0x148')](_0x338fe1,_0x39a6c3,_0x53477b['escape_digits'],_0x53477b[_0x9fb8('0x6a')],undefined,!![]);};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x194')]=function(_0x4e2960){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x195'),_0x4e2960[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x4e2960['url'])){return this['channel']['noop'](_0x9fb8('0x196'));}var _0x3364b6=this[_0x9fb8('0x67')][_0x9fb8('0xc9')](this,_0x4e2960);logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x197'),util['inspect'](_0x3364b6,{'showHidden':![],'depth':null})));if(!this[_0x9fb8('0x89')](_0x4e2960[_0x9fb8('0x122')])){return this['channel']['noop'](_0x9fb8('0x198'));}var _0xf0521=this[_0x9fb8('0x12')][_0x9fb8('0xc9')](this,_0x4e2960[_0x9fb8('0x122')]);if(!_0xf0521){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x4e2960,_0x9fb8('0xe3'));}this[_0x9fb8('0xe')][_0x9fb8('0xa5')](util[_0x9fb8('0x2c')](_0x9fb8('0x199'),_0xf0521),_0x3364b6[_0x9fb8('0x7a')]?_0x3364b6[_0x9fb8('0x7a')]:_0x9fb8('0x19a'));this['channel']['setVariable'](util[_0x9fb8('0x2c')](_0x9fb8('0x19b'),_0xf0521),_0x3364b6[_0x9fb8('0x19c')]?_0x3364b6[_0x9fb8('0x19c')]:'OK');if(_0x3364b6[_0x9fb8('0x6f')]){try{this['saveRestApiResult'](_0x3364b6[_0x9fb8('0x6f')],_0xf0521);}catch(_0x201773){logger[_0x9fb8('0x36')](util[_0x9fb8('0x2c')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0xf0521));}}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0xe6'),_0xf0521));};AGIVertices['prototype'][_0x9fb8('0x19d')]=function(_0x30087e){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x19e'),_0x30087e[_0x9fb8('0x3d')]));return this[_0x9fb8('0xe')][_0x9fb8('0x19f')](_0x30087e[_0x9fb8('0x1a0')][_0x9fb8('0xe0')](/\s+/g,''),_0x30087e[_0x9fb8('0x193')]);};AGIVertices['prototype'][_0x9fb8('0x1a1')]=function(_0x325483){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x1a2'),_0x325483[_0x9fb8('0x3d')]));return this[_0x9fb8('0xe')][_0x9fb8('0x1a3')](_0x325483[_0x9fb8('0x6b')][_0x9fb8('0xe0')](/\s+/g,''),_0x325483[_0x9fb8('0x193')]);};AGIVertices['prototype'][_0x9fb8('0x1a4')]=function(_0x187c11){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x187c11[_0x9fb8('0x3d')]));return this['channel'][_0x9fb8('0x1a5')](_0x187c11['text'],_0x187c11['escape_digits']);};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x1a6')]=function(_0x22a077){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x1a7'),_0x22a077[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x22a077[_0x9fb8('0x1a8')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0x1a9'));}var _0x7a1738=this['getMailAccount']['sync'](this,_0x22a077[_0x9fb8('0x1a8')]);if(!_0x7a1738||!_0x7a1738[_0x9fb8('0x1aa')]){return this[_0x9fb8('0xe')]['error'](_0x22a077,'no\x20mail\x20account\x20found');}var _0x3f8d96={'from':util[_0x9fb8('0x2c')](_0x9fb8('0x1ab'),_0x7a1738[_0x9fb8('0x17')],_0x7a1738[_0x9fb8('0x1ac')]||_0x7a1738['Smtp'][_0x9fb8('0x1ad')]),'to':_0x22a077['to']||'','cc':_0x22a077['cc']||'','bcc':_0x22a077[_0x9fb8('0x1ae')]||'','subject':_0x22a077[_0x9fb8('0x1af')],'html':_0x22a077[_0x9fb8('0x61')],'text':_0x22a077[_0x9fb8('0x61')]};var _0x11614d={'tls':{'rejectUnauthorized':![]}};if(_0x7a1738[_0x9fb8('0x1aa')][_0x9fb8('0x1b0')]){_0x11614d[_0x9fb8('0x1b0')]=_0x7a1738[_0x9fb8('0x1aa')]['service'];}else{_0x11614d['host']=_0x7a1738[_0x9fb8('0x1aa')]['host'];_0x11614d[_0x9fb8('0x1b1')]=_0x7a1738['Smtp'][_0x9fb8('0x1b1')];_0x11614d[_0x9fb8('0x1b2')]=_0x7a1738['Smtp'][_0x9fb8('0x1b2')];}if(_0x7a1738[_0x9fb8('0x1aa')][_0x9fb8('0x1b3')]){_0x11614d['auth']={'user':_0x7a1738['Smtp']['user'],'pass':_0x7a1738[_0x9fb8('0x1aa')][_0x9fb8('0x1b4')]};}if(this[_0x9fb8('0x89')](_0x22a077[_0x9fb8('0x1b5')])){}logger[_0x9fb8('0xe8')](_0x9fb8('0x1b6'),JSON['stringify'](_0x3f8d96));this['createSquareDetailsReport'][_0x9fb8('0xc9')](this,_0x22a077,_0x22a077[_0x9fb8('0x1a8')]);this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x1b7'),_0x7a1738[_0x9fb8('0x17')]));this[_0x9fb8('0x25')]['sync'](this,_0x11614d,_0x3f8d96);return this[_0x9fb8('0xe')]['noop'](_0x9fb8('0x1b8'));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x1b9')]=function(_0x34c220){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x1ba'),_0x34c220[_0x9fb8('0x3d')]));return this['channel'][_0x9fb8('0xaf')](_0x9fb8('0x1bb'));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x1bc')]=function(_0x5f50ea){logger['info'](util[_0x9fb8('0x2c')](_0x9fb8('0x1bd'),_0x5f50ea[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x5f50ea['sms_account_id'])){return this['channel'][_0x9fb8('0xaf')](_0x9fb8('0x1be'));}var _0x2dbdc7=this[_0x9fb8('0x38')][_0x9fb8('0xc9')](this,_0x5f50ea[_0x9fb8('0x1bf')]);if(!_0x2dbdc7){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x5f50ea,_0x9fb8('0x1c0'));}var _0x40a6c7={'body':_0x5f50ea['sms_text'],'phone':_0x5f50ea['to']||'','SmsAccountId':_0x2dbdc7['id']};logger[_0x9fb8('0xe8')](_0x9fb8('0x1c1'),JSON['stringify'](_0x40a6c7));this[_0x9fb8('0x3b')]['sync'](this,_0x5f50ea,_0x5f50ea[_0x9fb8('0x1bf')]);this[_0x9fb8('0xe')]['noop'](util[_0x9fb8('0x2c')](_0x9fb8('0x1c2'),_0x2dbdc7[_0x9fb8('0x17')]));this['createSmsMessage'][_0x9fb8('0xc9')](this,_0x40a6c7);return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0x1c3'));};AGIVertices['prototype'][_0x9fb8('0x1c4')]=function(_0x2f8751){logger['info'](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x2f8751[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x2f8751['variable_id'])){return this[_0x9fb8('0xe')]['error'](_0x2f8751,_0x9fb8('0x1c5'));}var _0x408087=this[_0x9fb8('0x12')][_0x9fb8('0xc9')](this,_0x2f8751[_0x9fb8('0x122')]);if(!_0x408087){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x2f8751,'no\x20variable\x20found');}return this[_0x9fb8('0xe')][_0x9fb8('0xa5')](_0x408087,_0x2f8751[_0x9fb8('0x1c6')]);};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x1c7')]=function(_0x400970){logger[_0x9fb8('0x31')](util['format'](_0x9fb8('0x1c8'),_0x400970['label']));this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0x1c9'));if(_0x400970[_0x9fb8('0xc2')]===_0x9fb8('0x1ca')){this[_0x9fb8('0xe')]['noop'](_0x9fb8('0x1cb'));return this['channel']['answer']();}return this['channel'][_0x9fb8('0xaf')]('Skipped\x20Answer');};AGIVertices['prototype']['subproject']=function(_0x276e76){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x276e76[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x276e76[_0x9fb8('0x1cc')])){return this['channel']['error'](_0x276e76,'no\x20subproject\x20selected');}var _0x5b7465=this[_0x9fb8('0x18')][_0x9fb8('0xc9')](this,_0x276e76[_0x9fb8('0x1cc')]);if(!this[_0x9fb8('0x89')](_0x5b7465)){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x276e76,util[_0x9fb8('0x2c')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x276e76['project_id']));}if(_0x5b7465===this[_0x9fb8('0xe')][_0x9fb8('0x3f')]){return this['channel'][_0x9fb8('0x36')](_0x276e76,_0x9fb8('0x1cd'));}this['createSquareDetailsReport'][_0x9fb8('0xc9')](this,_0x276e76,_0x5b7465);var _0x430323=this[_0x9fb8('0xe')]['exec'](_0x9fb8('0x1ce'),util[_0x9fb8('0x2c')](_0x9fb8('0x1cf'),config[_0x9fb8('0x7')][_0x9fb8('0x1d0')]||'127.0.0.1',_0x5b7465,this[_0x9fb8('0xe')][_0x9fb8('0x3f')]));if(_0x430323[_0x9fb8('0xa9')]===-0x1){return _0x430323;}return this[_0x9fb8('0xe')]['noop'](util[_0x9fb8('0x2c')](_0x9fb8('0x183'),_0x9fb8('0x1ce'),_0x5b7465));};AGIVertices['prototype'][_0x9fb8('0x1d1')]=function(_0x27792f){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x27792f[_0x9fb8('0x3d')]));var _0x558f0b=this[_0x9fb8('0x5c')]['sync'](this,_0x27792f['command']);this['createSquareDetailsReport'][_0x9fb8('0xc9')](this,_0x27792f,_0x27792f['command']);if(this[_0x9fb8('0x89')](_0x27792f['variable_id'])){var _0x4a4cdd=this[_0x9fb8('0x12')][_0x9fb8('0xc9')](this,_0x27792f[_0x9fb8('0x122')]);if(_0x4a4cdd){this[_0x9fb8('0xe')][_0x9fb8('0xa5')](_0x4a4cdd,_0x558f0b);return this[_0x9fb8('0xe')]['noop'](util[_0x9fb8('0x2c')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x27792f[_0x9fb8('0xc0')],_0x4a4cdd));}}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x1d2'),_0x27792f[_0x9fb8('0xc0')]));};AGIVertices['prototype'][_0x9fb8('0x1d3')]=function(_0x549d2e){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x549d2e[_0x9fb8('0x3d')]));_0x549d2e[_0x9fb8('0x61')]=_0x549d2e[_0x9fb8('0x61')][_0x9fb8('0xe0')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x549d2e[_0x9fb8('0x60')])){return this[_0x9fb8('0xe')]['noop'](_0x9fb8('0x1d4'));}if(!this[_0x9fb8('0x89')](_0x549d2e['text'])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0xb0'));}this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util['format'](_0x9fb8('0x1d5'),_0x549d2e[_0x9fb8('0x61')]));var _0x11cc4a=this[_0x9fb8('0x5f')]['sync'](this,_0x549d2e);if(_0x11cc4a){this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x1d6'),_0x11cc4a));var _0x31b18d=this[_0x9fb8('0xe')]['streamFile'](_0x11cc4a);try{fs['unlink'](_0x11cc4a+'.wav');}catch(_0x258201){logger[_0x9fb8('0x36')](_0x258201);}return _0x31b18d;}return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x549d2e,_0x9fb8('0x1d7'));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x1d8')]=function(_0x504c58){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x1d9'),_0x504c58['label']));_0x504c58[_0x9fb8('0x61')]=_0x504c58[_0x9fb8('0x61')][_0x9fb8('0xe0')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9fb8('0x89')](_0x504c58['text'])){return this[_0x9fb8('0xe')]['noop']('no\x20text\x20configured');}this[_0x9fb8('0xe')]['noop'](util[_0x9fb8('0x2c')](_0x9fb8('0x1da'),_0x504c58[_0x9fb8('0x61')]));var _0x1c462a=this[_0x9fb8('0x65')][_0x9fb8('0xc9')](this,_0x504c58);if(_0x1c462a){this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x1db'),_0x1c462a));var _0x3ad668=this[_0x9fb8('0xe')]['streamFile'](_0x1c462a);try{fs[_0x9fb8('0x110')](_0x1c462a+_0x9fb8('0x135'));}catch(_0x11ad39){logger['error'](_0x11ad39);}return _0x3ad668;}return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x504c58,_0x9fb8('0x1dc'));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x1dd')]=function(_0x508686){logger['info'](util['format'](_0x9fb8('0x1de'),_0x508686[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x508686[_0x9fb8('0x169')])){return this[_0x9fb8('0xe')]['error'](_0x508686,'no\x20find\x20by\x20configured');}logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x170'),this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x508686[_0x9fb8('0x169')]));var _0x24060e=this[_0x9fb8('0x57')][_0x9fb8('0xc9')](this,_0x508686[_0x9fb8('0x169')]);if(_0x24060e){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x16b'),this['channel'][_0x9fb8('0x40')],_0x508686[_0x9fb8('0x169')]));this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x9fb8('0x40')],_0x508686[_0x9fb8('0x169')]));return{'code':0xc8,'result':_0x9fb8('0x171')};}else{logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x16c'),this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x508686[_0x9fb8('0x169')]));this['channel'][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x16c'),this['channel'][_0x9fb8('0x40')],_0x508686['findBy']));return{'code':0xc8,'result':_0x9fb8('0x16d')};}};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x1df')]=function(_0x30582d){logger['info'](util[_0x9fb8('0x2c')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x30582d[_0x9fb8('0x3d')]));var _0x1c78b3=this[_0x9fb8('0xe')]['exec'](_0x9fb8('0x1e0'),[_0x30582d['mailbox'],_0x30582d[_0x9fb8('0x7c')]]);if(_0x1c78b3[_0x9fb8('0xa9')]===-0x1){return _0x1c78b3;}return this[_0x9fb8('0xe')]['noop'](util['format'](_0x9fb8('0x183'),'VOICEMAIL',_0x30582d[_0x9fb8('0x1e1')]));};AGIVertices[_0x9fb8('0x11')]['vswitch']=function(_0x3f1d79){logger[_0x9fb8('0x31')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x3f1d79[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x3f1d79[_0x9fb8('0x122')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x3f1d79,'no\x20variable\x20selected');}var _0x3837d9=this['getVariable'][_0x9fb8('0xc9')](this,_0x3f1d79[_0x9fb8('0x122')]);if(!_0x3837d9){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x3f1d79,'no\x20variable\x20found');}var _0x1b8ddf=this[_0x9fb8('0xe')][_0x9fb8('0x12')](_0x3837d9);return{'code':0xc8,'result':_0x1b8ddf[_0x9fb8('0xab')]?_0x1b8ddf['extra']:'-'};};String[_0x9fb8('0x11')][_0x9fb8('0xa7')]=function(_0x3ba801,_0x3f76eb){return this['split'](_0x3ba801)[_0x9fb8('0x1e2')](_0x3f76eb);};module[_0x9fb8('0x1e3')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 61fe1e7..58dfdaa 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 _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 +var _0x17ba=['exports','util','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','diff','seconds','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','attended','destlinkedid','savePause','stopAcw','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','prototype','[TIMER][STOP][AGENT:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','autopause','all','[ACW][syncAgentRingNoAnswer]\x20%s'];(function(_0x14674d,_0x88c7ff){var _0x556c64=function(_0x1fa01a){while(--_0x1fa01a){_0x14674d['push'](_0x14674d['shift']());}};_0x556c64(++_0x88c7ff);}(_0x17ba,0xab));var _0xa17b=function(_0x428619,_0x2fe490){_0x428619=_0x428619-0x0;var _0x5d1770=_0x17ba[_0x428619];return _0x5d1770;};'use strict';var util=require(_0xa17b('0x0'));var _=require(_0xa17b('0x1'));var moment=require('moment');var ami=require(_0xa17b('0x2'));var logger=require(_0xa17b('0x3'))(_0xa17b('0x4'));var RpcUser=require(_0xa17b('0x5'));var RpcVoiceAgentReport=require(_0xa17b('0x6'));function Acw(_0x38c13c){this[_0xa17b('0x7')]=_0x38c13c[_0xa17b('0x7')];this[_0xa17b('0x8')]=_0x38c13c[_0xa17b('0x8')];this[_0xa17b('0x9')]=_0x38c13c[_0xa17b('0x9')];this[_0xa17b('0xa')]={};ami['on'](_0xa17b('0xb'),this[_0xa17b('0xc')][_0xa17b('0xd')](this));ami['on'](_0xa17b('0xe'),this[_0xa17b('0xf')][_0xa17b('0xd')](this));ami['on']('hangup',this[_0xa17b('0x10')][_0xa17b('0xd')](this));ami['on'](_0xa17b('0x11'),this[_0xa17b('0x12')][_0xa17b('0xd')](this));ami['on'](_0xa17b('0x13'),this[_0xa17b('0x14')]['bind'](this));ami['on'](_0xa17b('0x15'),this[_0xa17b('0x16')][_0xa17b('0xd')](this));ami['on']('custom:agentConnectPreview',this[_0xa17b('0x17')][_0xa17b('0xd')](this));}function getDiff(_0x30236c){var _0xeeacaa=moment()['milliseconds'](0x0);var _0x117ad9=moment(_0x30236c)['milliseconds'](0x0);return _0xeeacaa[_0xa17b('0x18')](_0x117ad9,_0xa17b('0x19'));}Acw['prototype'][_0xa17b('0x1a')]=function(_0x3c63e3){try{var _0x1c0578=this;var _0x1f8141=this['channels'][_0x3c63e3][_0xa17b('0x1b')];var _0x5e21c2=this['channels'][_0x3c63e3]['queue'];var _0x36f985=this[_0xa17b('0x7')][_0x5e21c2];var _0x53a0f7=![];var _0x2ceafa=_0xa17b('0x1c');if(_0x36f985[_0xa17b('0x1d')]){if(_0x36f985[_0xa17b('0x1e')][_0xa17b('0x1f')]){_0x53a0f7=!![];_0x2ceafa=_0x36f985[_0xa17b('0x1e')][_0xa17b('0x1f')];}}ami['Action']({'action':_0xa17b('0x20'),'interface':_0x1f8141,'paused':!![],'reason':_0x2ceafa})[_0xa17b('0x21')](function(_0x45bd0c){if(_0x1c0578['agents'][_0x1f8141]){return RpcUser[_0xa17b('0x22')](_0x1c0578[_0xa17b('0x8')][_0x1f8141]['id'])[_0xa17b('0x21')](function(_0xbbbb62){if(_0xbbbb62&&!_0xbbbb62[_0xa17b('0x23')]){logger[_0xa17b('0x24')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x3c63e3,_0x1f8141,_0x5e21c2);var _0x3df11f=_0x1c0578['channels'][_0x3c63e3][_0xa17b('0x25')]&&_0x1c0578[_0xa17b('0xa')][_0x3c63e3]['destlinkedid']?_0x1c0578['channels'][_0x3c63e3][_0xa17b('0x26')]:_0x3c63e3;return RpcUser[_0xa17b('0x27')](_0x1c0578[_0xa17b('0x8')][_0x1f8141],_0x2ceafa,_0x3df11f)[_0xa17b('0x21')](function(_0x3c32a5){if(!_0x53a0f7){_0x1c0578[_0xa17b('0x9')][_0x1f8141]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3c63e3,_0x1c0578['voiceQueues'][_0x5e21c2]['acwTimeout'],_0x1f8141,_0x5e21c2);_0x1c0578[_0xa17b('0x9')][_0x1f8141]['timer']=setTimeout(_0x1c0578[_0xa17b('0x28')]['bind'](_0x1c0578,_0x1f8141),_0x1c0578[_0xa17b('0x7')][_0x5e21c2][_0xa17b('0x29')]*0x3e8);_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2a')]=moment()[_0xa17b('0x2b')](_0xa17b('0x2c'));_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2d')]=_0x3c63e3;_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2e')]=_0x5e21c2;_0x1c0578[_0xa17b('0x9')][_0x1f8141]['updateAcw']=function(){var _0x57a2c4=getDiff(_0x1c0578['timers'][_0x1f8141][_0xa17b('0x2a')]);clearTimeout(_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2f')]);_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2f')]=![];RpcVoiceAgentReport[_0xa17b('0x30')]({'acwtime':_0x57a2c4},_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2d')],_0x1f8141)['then'](function(_0x1e33bf){logger['info'](_0xa17b('0x31'),_0x3c63e3,_0x57a2c4,_0x1e33bf);})[_0xa17b('0x32')](function(_0x198ceb){logger[_0xa17b('0x33')](_0xa17b('0x34'),_0x3c63e3,_0x198ceb);});delete _0x1c0578[_0xa17b('0x9')][_0x1f8141];};}});}else{logger['info'](_0xa17b('0x35'),_0x3c63e3,_0x1f8141,_0x5e21c2);}});}})[_0xa17b('0x32')](function(_0x323e0e){logger[_0xa17b('0x33')](_0xa17b('0x36'),_0x3c63e3,_0x1c0578['voiceQueues'][_0x5e21c2][_0xa17b('0x29')],_0x1f8141,_0x5e21c2);})['finally'](function(){delete _0x1c0578[_0xa17b('0xa')][_0x3c63e3];});}catch(_0x5a0b00){logger[_0xa17b('0x33')](_0xa17b('0x37'),_0x5a0b00['message']);}};Acw[_0xa17b('0x38')][_0xa17b('0x28')]=function(_0x487e9a){try{var _0x2fb380=this;if(_0x2fb380[_0xa17b('0x9')][_0x487e9a]){_0x2fb380[_0xa17b('0x9')][_0x487e9a][_0xa17b('0x2f')]=![];var _0xd71efd=_0x2fb380['timers'][_0x487e9a][_0xa17b('0x2d')];var _0x506488=_0x2fb380[_0xa17b('0x9')][_0x487e9a]['queue'];var _0x118ad9=_0x2fb380['voiceQueues'][_0x506488][_0xa17b('0x29')];logger['info'](_0xa17b('0x39'),_0x487e9a);RpcUser['saveUnpause'](this[_0xa17b('0x8')][_0x487e9a]);RpcVoiceAgentReport[_0xa17b('0x30')]({'acwtime':_0x118ad9,'agentacw':!![]},_0xd71efd,_0x487e9a)[_0xa17b('0x21')](function(_0x318b1c){logger[_0xa17b('0x24')](_0xa17b('0x31'),_0xd71efd,_0x118ad9,_0x318b1c);})[_0xa17b('0x32')](function(_0xe57f94){logger['error'](_0xa17b('0x34'),_0xd71efd,_0xe57f94);});}else{logger[_0xa17b('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x487e9a);if(_0x2fb380[_0xa17b('0x9')]){logger[_0xa17b('0x24')](_0xa17b('0x3a'),JSON[_0xa17b('0x3b')](_0x2fb380[_0xa17b('0x9')]));}}}catch(_0x2fe669){logger['error'](_0xa17b('0x3c'),_0x2fe669[_0xa17b('0x3d')]);}};Acw[_0xa17b('0x38')]['syncAgentConnect']=function(_0x54b65c){try{if(this['voiceQueues'][_0x54b65c[_0xa17b('0x2e')]]&&(this[_0xa17b('0x7')][_0x54b65c[_0xa17b('0x2e')]][_0xa17b('0x4')]||this[_0xa17b('0x7')][_0x54b65c[_0xa17b('0x2e')]][_0xa17b('0x1d')])){if(this[_0xa17b('0x8')][_0x54b65c[_0xa17b('0x1b')]]){this[_0xa17b('0xa')][_0x54b65c[_0xa17b('0x2d')]]={'queue':_0x54b65c[_0xa17b('0x2e')],'interface':_0x54b65c['interface'],'destlinkedid':_0x54b65c[_0xa17b('0x26')]};}}}catch(_0x16db4a){logger[_0xa17b('0x33')](_0xa17b('0x3e'),_0x16db4a[_0xa17b('0x3d')]);}};Acw[_0xa17b('0x38')]['syncAgentConnectPreview']=function(_0x43d6d6){try{if(this[_0xa17b('0x7')][_0x43d6d6[_0xa17b('0x2e')]]&&(this[_0xa17b('0x7')][_0x43d6d6[_0xa17b('0x2e')]]['acw']||this[_0xa17b('0x7')][_0x43d6d6[_0xa17b('0x2e')]][_0xa17b('0x1d')])){if(this[_0xa17b('0x8')][_0x43d6d6['interface']]){this[_0xa17b('0xa')][_0x43d6d6[_0xa17b('0x2d')]]={'queue':_0x43d6d6[_0xa17b('0x2e')],'interface':_0x43d6d6[_0xa17b('0x1b')]};}}}catch(_0x11b256){logger[_0xa17b('0x33')](_0xa17b('0x3f'),_0x11b256['message']);}};Acw[_0xa17b('0x38')][_0xa17b('0xf')]=function(_0x4ffe5a){try{if(this[_0xa17b('0xa')][_0x4ffe5a[_0xa17b('0x2d')]]&&_[_0xa17b('0x40')](this['channels'][_0x4ffe5a[_0xa17b('0x2d')]][_0xa17b('0x25')])){logger['info'](_0xa17b('0x41'),_0x4ffe5a[_0xa17b('0x2d')]);this['startAcw'](_0x4ffe5a[_0xa17b('0x2d')]);}else if(this[_0xa17b('0xa')][_0x4ffe5a['linkedid']]&&_[_0xa17b('0x40')](this[_0xa17b('0xa')][_0x4ffe5a[_0xa17b('0x42')]][_0xa17b('0x25')])){logger[_0xa17b('0x24')](_0xa17b('0x43'),_0x4ffe5a[_0xa17b('0x42')]);this['startAcw'](_0x4ffe5a[_0xa17b('0x42')]);}}catch(_0x3ff07a){logger[_0xa17b('0x33')](_0xa17b('0x44'),_0x3ff07a[_0xa17b('0x3d')]);}};Acw[_0xa17b('0x38')][_0xa17b('0x10')]=function(_0x100d14){try{if(this[_0xa17b('0xa')][_0x100d14[_0xa17b('0x2d')]]&&this[_0xa17b('0xa')][_0x100d14[_0xa17b('0x2d')]][_0xa17b('0x25')]){logger['info'](_0xa17b('0x45'),_0x100d14[_0xa17b('0x2d')]);this[_0xa17b('0x1a')](_0x100d14[_0xa17b('0x2d')]);}else if(this[_0xa17b('0xa')][_0x100d14[_0xa17b('0x42')]]&&this[_0xa17b('0xa')][_0x100d14[_0xa17b('0x42')]][_0xa17b('0x25')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x100d14[_0xa17b('0x42')]);this[_0xa17b('0x1a')](_0x100d14['linkedid']);}}catch(_0x568f27){logger['error'](_0xa17b('0x46'),_0x568f27[_0xa17b('0x3d')]);}};Acw[_0xa17b('0x38')][_0xa17b('0x14')]=function(_0x301019){try{if(!_[_0xa17b('0x47')](this['channels'][_0x301019['transfereeuniqueid']])){this['startAcw'](_0x301019['transfereeuniqueid']);if(this['channels'][_0x301019[_0xa17b('0x48')]]){this[_0xa17b('0xa')][_0x301019[_0xa17b('0x48')]][_0xa17b('0x25')]=!![];this[_0xa17b('0xa')][_0x301019[_0xa17b('0x49')]]=this[_0xa17b('0xa')][_0x301019['secondtransfereruniqueid']];delete this[_0xa17b('0xa')][_0x301019[_0xa17b('0x48')]];}}else if(!_[_0xa17b('0x47')](this[_0xa17b('0xa')][_0x301019[_0xa17b('0x49')]])){this[_0xa17b('0x1a')](_0x301019[_0xa17b('0x49')]);if(this[_0xa17b('0xa')][_0x301019[_0xa17b('0x4a')]]){this[_0xa17b('0xa')][_0x301019[_0xa17b('0x4a')]][_0xa17b('0x25')]=!![];this['channels'][_0x301019[_0xa17b('0x4b')]]=this['channels'][_0x301019[_0xa17b('0x4a')]];delete this[_0xa17b('0xa')][_0x301019[_0xa17b('0x4a')]];}}}catch(_0x2ac414){logger['error'](_0xa17b('0x4c'),_0x2ac414['message']);}};Acw[_0xa17b('0x38')]['syncBlindTransfer']=function(_0x5be3d1){try{if(this[_0xa17b('0xa')][_0x5be3d1[_0xa17b('0x4d')]]){logger['info'](_0xa17b('0x4e'),JSON[_0xa17b('0x3b')](_0x5be3d1['transfereruniqueid']));this['startAcw'](_0x5be3d1[_0xa17b('0x4d')]);}else if(this[_0xa17b('0xa')][_0x5be3d1['transfererlinkedid']]){logger[_0xa17b('0x24')](_0xa17b('0x4f'),JSON['stringify'](_0x5be3d1[_0xa17b('0x50')]));this[_0xa17b('0x1a')](_0x5be3d1[_0xa17b('0x50')]);}}catch(_0x7b5a5d){logger[_0xa17b('0x33')]('[ACW][syncBlindTransfer]\x20%s',_0x7b5a5d[_0xa17b('0x3d')]);}};Acw[_0xa17b('0x38')][_0xa17b('0x12')]=function(_0x29cdfc){try{if(this[_0xa17b('0x7')][_0x29cdfc[_0xa17b('0x2e')]]&&this[_0xa17b('0x7')][_0x29cdfc[_0xa17b('0x2e')]][_0xa17b('0x51')]===_0xa17b('0x52')){if(this['agents'][_0x29cdfc[_0xa17b('0x1b')]]){logger[_0xa17b('0x24')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x29cdfc['uniqueid'],_0x29cdfc[_0xa17b('0x1b')],_0x29cdfc[_0xa17b('0x2e')]);return RpcUser[_0xa17b('0x27')](this[_0xa17b('0x8')][_0x29cdfc[_0xa17b('0x1b')]],'Auto-Pause',_0x29cdfc[_0xa17b('0x2d')]);}}}catch(_0x469ecd){logger[_0xa17b('0x33')](_0xa17b('0x53'),_0x469ecd['message']);}};module[_0xa17b('0x54')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index d3d1f3b..31e15eb 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 _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 +var _0x1d57=['port','username','keepConnected','Action','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','format','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','actionSipPeerStatus','catch','log','bluebird','moment','lodash','ami','../../config/environment','asterisk'];(function(_0x596e98,_0xc326c9){var _0x1c09ac=function(_0x3d839d){while(--_0x3d839d){_0x596e98['push'](_0x596e98['shift']());}};_0x1c09ac(++_0xc326c9);}(_0x1d57,0x10a));var _0x71d5=function(_0x27cfdc,_0x484964){_0x27cfdc=_0x27cfdc-0x0;var _0x3a5be2=_0x1d57[_0x27cfdc];return _0x3a5be2;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x71d5('0x0'));var moment=require(_0x71d5('0x1'));var util=require('util');var _=require(_0x71d5('0x2'));var logger=require('../../config/logger')(_0x71d5('0x3'));var config=require(_0x71d5('0x4'));var ami=new Manager(config[_0x71d5('0x5')][_0x71d5('0x6')],config['asterisk']['ip'],config[_0x71d5('0x5')][_0x71d5('0x7')],config['asterisk']['password'],!![]);ami[_0x71d5('0x8')]();ami[_0x71d5('0x9')]=BPromise['promisify'](ami[_0x71d5('0xa')]);function error(_0x51c6f1){logger[_0x71d5('0xb')](util['format'](_0x71d5('0xc'),config[_0x71d5('0x5')][_0x71d5('0x7')],config[_0x71d5('0x5')]['ip'],config[_0x71d5('0x5')][_0x71d5('0x6')],util[_0x71d5('0xd')](_0x51c6f1,![],null)));}function close(){logger[_0x71d5('0xb')](util['format'](_0x71d5('0xe'),config['asterisk'][_0x71d5('0x7')],config[_0x71d5('0x5')]['ip'],config[_0x71d5('0x5')][_0x71d5('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x71d5('0x9')]({'action':_0x71d5('0xf')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x71d5('0x9')]({'action':_0x71d5('0x10')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x71d5('0x9')]({'action':'sippeerstatus'});};};ami[_0x71d5('0x11')]=function(){return function(){return ami[_0x71d5('0x9')]({'action':'queuesummary'});};};ami[_0x71d5('0x12')]=function(){return function(){return ami[_0x71d5('0x9')]({'action':_0x71d5('0x13')});};};function connect(_0x2e05d6){logger[_0x71d5('0x14')](util['format'](_0x71d5('0x15'),config['asterisk'][_0x71d5('0x7')],config[_0x71d5('0x5')]['ip'],config[_0x71d5('0x5')][_0x71d5('0x6')]));ami[_0x71d5('0x16')]('error',error);ami[_0x71d5('0x16')](_0x71d5('0x17'),close);}ami['on'](_0x71d5('0x18'),connect);ami['on']('shutdown',function(_0x176bd4){logger['info'](util[_0x71d5('0x19')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x71d5('0x5')]['username'],config[_0x71d5('0x5')]['ip'],config[_0x71d5('0x5')][_0x71d5('0x6')],util[_0x71d5('0xd')](_0x176bd4,![],null)));});ami['on'](_0x71d5('0x1a'),function(_0x18e333){logger[_0x71d5('0x14')](util[_0x71d5('0x19')](_0x71d5('0x1b'),config[_0x71d5('0x5')]['username'],config['asterisk']['ip'],config[_0x71d5('0x5')][_0x71d5('0x6')]));return BPromise[_0x71d5('0x1c')]()[_0x71d5('0x1d')](ami['actionSipShowRegistry']())['then'](ami[_0x71d5('0x1e')]())[_0x71d5('0x1d')](ami[_0x71d5('0x1f')]())['then'](ami[_0x71d5('0x11')]())[_0x71d5('0x1d')](ami['actionCoreShowChannels']())[_0x71d5('0x20')](function(_0x5c8cdd){console[_0x71d5('0x21')](_0x5c8cdd);});});ami[_0x71d5('0x16')](_0x71d5('0xb'),error);ami[_0x71d5('0x16')](_0x71d5('0x17'),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 e6b5587..bca245e 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 _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 +var _0xf438=['Request','then','debug','rpc','memberReport','error','message','result','catch','bluebird','../../config/logger','ami','client','http'];(function(_0x2ff127,_0x3d6e2b){var _0x53af48=function(_0x4a0c47){while(--_0x4a0c47){_0x2ff127['push'](_0x2ff127['shift']());}};_0x53af48(++_0x3d6e2b);}(_0xf438,0x121));var _0x8f43=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf438[_0x2641f9];return _0x585741;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x8f43('0x0'));var logger=require(_0x8f43('0x1'))(_0x8f43('0x2'));var client=jayson[_0x8f43('0x3')][_0x8f43('0x4')]({'port':0x2329});client[_0x8f43('0x5')]=function(_0x4eb64e,_0x38b966){return new BPromise(function(_0x1d1604,_0x247380){return client['request'](_0x4eb64e,_0x38b966)[_0x8f43('0x6')](function(_0x1f00b3){logger[_0x8f43('0x7')](_0x8f43('0x8'),_0x8f43('0x9'),_0x4eb64e,_0x38b966,_0x1f00b3);if(_0x1f00b3[_0x8f43('0xa')]){logger['error'](_0x8f43('0x8'),_0x8f43('0x9'),_0x4eb64e,_0x1f00b3[_0x8f43('0xa')]['message'],_0x38b966);return _0x247380(_0x1f00b3[_0x8f43('0xa')][_0x8f43('0xb')]);}else{return _0x1d1604(_0x1f00b3[_0x8f43('0xc')]);}})[_0x8f43('0xd')](function(_0x2e4d7d){logger[_0x8f43('0xa')](_0x8f43('0x8'),_0x8f43('0x9'),_0x4eb64e,_0x2e4d7d,_0x38b966);return _0x247380(_0x2e4d7d);});});};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 f5d78bf..99384b3 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 _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 +var _0xf46a=['voiceQueue','uniqueid','name','Contact','phone','firstName','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','number','substring','dialCutDigit','getQueue','queue','util','moment','isNil','string'];(function(_0xbc2974,_0xec3342){var _0x3a5b4f=function(_0x5ec5b5){while(--_0x5ec5b5){_0xbc2974['push'](_0xbc2974['shift']());}};_0x3a5b4f(++_0xec3342);}(_0xf46a,0xa4));var _0xaf46=function(_0x3101ba,_0x62b768){_0x3101ba=_0x3101ba-0x0;var _0x122e9c=_0xf46a[_0x3101ba];return _0x122e9c;};'use strict';var util=require(_0xaf46('0x0'));var _=require('lodash');var moment=require(_0xaf46('0x1'));function checkNameSurname(_0x417747,_0x571132,_0xf4ff9e){var _0x3a7936='';if(!_[_0xaf46('0x2')](_0x571132)&&_0xaf46('0x3')===typeof _0x571132){_0x3a7936+=_0x571132;}if(!_[_0xaf46('0x2')](_0xf4ff9e)&&_0xaf46('0x3')===typeof _0xf4ff9e){_0x3a7936+='\x20'+_0xf4ff9e;}if(_0x3a7936!==''){return _0x3a7936;}return _0x417747;}function Action(_0x35f997,_0x399251,_0x3aef9c){this[_0xaf46('0x4')]=_0x35f997;this[_0xaf46('0x5')]=_0x3aef9c||undefined;this[_0xaf46('0x6')]=checkNameSurname(_0x399251[_0xaf46('0x7')][_0xaf46('0x8')],_0x399251['Contact'][_0xaf46('0x9')],_0x399251['Contact']['lastName']);this['number']=_0x399251[_0xaf46('0x7')][_0xaf46('0x8')];this['queue']=_0x35f997[_0xaf46('0x6')];this[_0xaf46('0xa')]=_0x399251[_0xaf46('0xa')]||![];this['type']=_0x35f997[_0xaf46('0xb')];this['dialQueueTimeout']=_0x35f997[_0xaf46('0xc')]||0x3;this['scheduledat']=_0x399251[_0xaf46('0xd')];this['countbusyretry']=_0x399251[_0xaf46('0xe')];this[_0xaf46('0xf')]=_0x399251[_0xaf46('0xf')];this[_0xaf46('0x10')]=_0x399251[_0xaf46('0x10')];this[_0xaf46('0x11')]=_0x399251[_0xaf46('0x11')];this[_0xaf46('0x12')]=_0x399251['countdropretry'];this['countabandonedretry']=_0x399251['countabandonedretry'];this[_0xaf46('0x13')]=_0x399251['countmachineretry'];this['countagentrejectretry']=_0x399251[_0xaf46('0x14')];this[_0xaf46('0x15')]=_0x399251['ContactId'];this[_0xaf46('0x16')]=_0x399251[_0xaf46('0x16')];this[_0xaf46('0x17')]=_0x399251[_0xaf46('0x17')];this[_0xaf46('0x18')]=_0x399251[_0xaf46('0x18')];this['CampaignId']=_0x399251[_0xaf46('0x19')];this[_0xaf46('0x1a')]=_0x399251['id'];this['ContactFirstName']=_0x399251[_0xaf46('0x7')][_0xaf46('0x9')]||'';this['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xaf46('0x1b')]=_0x399251[_0xaf46('0x1b')];this['callbackuniqueid']=_0x399251[_0xaf46('0x1c')];this['callbackat']=_0x399251[_0xaf46('0x1d')];this[_0xaf46('0x1e')]=_0x399251[_0xaf46('0x1e')];this[_0xaf46('0x1f')]='';this[_0xaf46('0x20')]='';}Action[_0xaf46('0x21')][_0xaf46('0x22')]=function(){return util[_0xaf46('0x23')](_0xaf46('0x24'),this[_0xaf46('0x6')],this['voiceQueue']['dialCutDigit']>0x0?this[_0xaf46('0x25')][_0xaf46('0x26')](this[_0xaf46('0x4')][_0xaf46('0x27')]):this[_0xaf46('0x25')]);};Action[_0xaf46('0x21')][_0xaf46('0x28')]=function(){return this[_0xaf46('0x29')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 14de2dc..0cbd7d2 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 _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 +var _0x4757=['diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','util','lodash'];(function(_0x51cebf,_0x307dd2){var _0x3881d8=function(_0x5344f5){while(--_0x5344f5){_0x51cebf['push'](_0x51cebf['shift']());}};_0x3881d8(++_0x307dd2);}(_0x4757,0x1df));var _0x7475=function(_0x3d5f84,_0x569548){_0x3d5f84=_0x3d5f84-0x0;var _0x1981b8=_0x4757[_0x3d5f84];return _0x1981b8;};'use strict';var util=require(_0x7475('0x0'));var _=require(_0x7475('0x1'));var moment=require('moment');function getSeconds(_0x37e4cb,_0x10e47d){var _0x56b57c=moment(_0x37e4cb)['milliseconds'](0x0);var _0x551c39=moment(_0x10e47d)['milliseconds'](0x0);return _0x56b57c[_0x7475('0x2')](_0x551c39,_0x7475('0x3'));}function AdditionalPhone(_0x48623c){this[_0x7475('0x4')]=_0x48623c['uniqueid'];this['scheduledat']=_0x48623c[_0x7475('0x5')]||undefined;this['type']=_0x48623c[_0x7475('0x6')];this[_0x7475('0x7')]=_0x48623c[_0x7475('0x6')]===_0x7475('0x8')?_0x7475('0x9'):_0x48623c[_0x7475('0x6')];this[_0x7475('0xa')]=_0x48623c[_0x7475('0xa')];this['countcongestionretry']=_0x48623c[_0x7475('0xb')];this[_0x7475('0xc')]=_0x48623c['countnoanswerretry'];this['countglobal']=_0x48623c[_0x7475('0xa')]+_0x48623c[_0x7475('0xb')]+_0x48623c[_0x7475('0xc')]+_0x48623c['countnosuchnumberretry']+_0x48623c[_0x7475('0xd')]+_0x48623c[_0x7475('0xe')]+_0x48623c[_0x7475('0xf')]+_0x48623c[_0x7475('0x10')];this[_0x7475('0x11')]=_0x48623c[_0x7475('0x11')];this[_0x7475('0xd')]=_0x48623c[_0x7475('0xd')];this[_0x7475('0xe')]=_0x48623c[_0x7475('0xe')];this[_0x7475('0xf')]=_0x48623c[_0x7475('0xf')];this[_0x7475('0x10')]=_0x48623c['countagentrejectretry'];this[_0x7475('0x9')]=_0x48623c[_0x7475('0x9')];this[_0x7475('0x12')]=_0x48623c[_0x7475('0x13')];this[_0x7475('0x14')]=_0x48623c[_0x7475('0x15')];this[_0x7475('0x16')]=_0x48623c['starttime'];this['responsetime']=_0x48623c[_0x7475('0x17')];this[_0x7475('0x18')]=_0x48623c[_0x7475('0x17')];this[_0x7475('0x19')]=getSeconds(_0x48623c['responsetime'],_0x48623c[_0x7475('0x16')]);this['holdtime']=0x0;this[_0x7475('0x1a')]=0x0;this[_0x7475('0x1b')]=_0x48623c[_0x7475('0x1b')];this[_0x7475('0x1c')]=_0x48623c[_0x7475('0x1c')];this[_0x7475('0x1d')]=_0x48623c[_0x7475('0x1d')];this[_0x7475('0x1e')]=_0x48623c['recallme'];this[_0x7475('0x1f')]=_0x48623c[_0x7475('0x1f')];this[_0x7475('0x20')]=_0x48623c['ListId'];this['UserId']=_0x48623c[_0x7475('0x21')];this[_0x7475('0x22')]=_0x48623c[_0x7475('0x22')];this['CampaignId']=_0x48623c['CampaignId'];this[_0x7475('0x23')]=_0x48623c[_0x7475('0x23')]||'';this[_0x7475('0x24')]=_0x48623c[_0x7475('0x24')]||'';}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 ec44014..395beb5 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 _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 +var _0xbce9=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','talktime','queue','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','countbusyretry','countcongestionretry'];(function(_0xcec3d0,_0xd9cb55){var _0x4545b7=function(_0x359123){while(--_0x359123){_0xcec3d0['push'](_0xcec3d0['shift']());}};_0x4545b7(++_0xd9cb55);}(_0xbce9,0x102));var _0x9bce=function(_0x2d8db5,_0x3c9c8d){_0x2d8db5=_0x2d8db5-0x0;var _0xdc5579=_0xbce9[_0x2d8db5];return _0xdc5579;};'use strict';var util=require(_0x9bce('0x0'));var _=require(_0x9bce('0x1'));var moment=require('moment');function getSeconds(_0x51fea0,_0x4ab1d9){var _0xf72d0d=moment(_0x51fea0)[_0x9bce('0x2')](0x0);var _0x230ddb=moment(_0x4ab1d9)[_0x9bce('0x2')](0x0);return _0xf72d0d[_0x9bce('0x3')](_0x230ddb,_0x9bce('0x4'));}function AgentComplete(_0x49f8f5,_0x37ac79){this['state']=0x4;this[_0x9bce('0x5')]=_0x9bce('0x6');this[_0x9bce('0x7')]=_0x49f8f5[_0x9bce('0x7')];this[_0x9bce('0x8')]=_0x49f8f5[_0x9bce('0x8')];this[_0x9bce('0x9')]=_0x49f8f5[_0x9bce('0x8')]==='outbound'?'queue':_0x49f8f5[_0x9bce('0x8')];this['countbusyretry']=_0x49f8f5[_0x9bce('0xa')];this[_0x9bce('0xb')]=_0x49f8f5[_0x9bce('0xb')];this['countnoanswerretry']=_0x49f8f5[_0x9bce('0xc')];this[_0x9bce('0xd')]=_0x49f8f5[_0x9bce('0xa')]+_0x49f8f5[_0x9bce('0xb')]+_0x49f8f5[_0x9bce('0xc')]+_0x49f8f5[_0x9bce('0xe')]+_0x49f8f5[_0x9bce('0xf')]+_0x49f8f5[_0x9bce('0x10')]+_0x49f8f5[_0x9bce('0x11')]+_0x49f8f5[_0x9bce('0x12')];this[_0x9bce('0xe')]=_0x49f8f5[_0x9bce('0xe')];this[_0x9bce('0xf')]=_0x49f8f5['countdropretry'];this[_0x9bce('0x10')]=_0x49f8f5[_0x9bce('0x10')];this[_0x9bce('0x11')]=_0x49f8f5[_0x9bce('0x11')];this[_0x9bce('0x12')]=_0x49f8f5[_0x9bce('0x12')];this[_0x9bce('0x13')]=_0x37ac79[_0x9bce('0x13')];this[_0x9bce('0x14')]=_0x49f8f5[_0x9bce('0x15')];this[_0x9bce('0x16')]=_0x49f8f5[_0x9bce('0x17')];this['starttime']=_0x49f8f5[_0x9bce('0x18')];this[_0x9bce('0x19')]=_0x49f8f5[_0x9bce('0x19')];this[_0x9bce('0x1a')]=_0x49f8f5[_0x9bce('0x1a')];this[_0x9bce('0x1b')]=moment()[_0x9bce('0x1c')](_0x9bce('0x1d'));this['ringtime']=getSeconds(_0x49f8f5[_0x9bce('0x19')],_0x49f8f5[_0x9bce('0x18')]);this['holdtime']=getSeconds(_0x49f8f5[_0x9bce('0x1a')],_0x49f8f5[_0x9bce('0x19')]);this[_0x9bce('0x1e')]=getSeconds(this[_0x9bce('0x1b')],_0x49f8f5[_0x9bce('0x1a')]);this[_0x9bce('0x1f')]=_0x37ac79[_0x9bce('0x1f')];this['membername']=_0x37ac79[_0x9bce('0x20')];this['reason']=_0x37ac79['reason'];this[_0x9bce('0x21')]=_0x49f8f5['callback'];this[_0x9bce('0x22')]=_0x49f8f5[_0x9bce('0x22')];this['callbackat']=_0x49f8f5[_0x9bce('0x23')];this[_0x9bce('0x24')]=_0x49f8f5['recallme'];this[_0x9bce('0x25')]=_0x49f8f5['ContactId'];this[_0x9bce('0x26')]=_0x49f8f5['ListId'];this[_0x9bce('0x27')]=_0x49f8f5[_0x9bce('0x27')];this[_0x9bce('0x28')]=_0x49f8f5[_0x9bce('0x28')];this[_0x9bce('0x29')]=_0x49f8f5[_0x9bce('0x29')];this[_0x9bce('0x2a')]=_0x49f8f5[_0x9bce('0x2a')]||'';this['originatecalleridname']=_0x49f8f5[_0x9bce('0x2b')]||'';}module[_0x9bce('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index c031530..3a50513 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 _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 +var _0x8719=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x8719,0x1ed));var _0x9871=function(_0x11f898,_0x5e1c47){_0x11f898=_0x11f898-0x0;var _0x1f78f0=_0x8719[_0x11f898];return _0x1f78f0;};'use strict';var util=require(_0x9871('0x0'));var _=require(_0x9871('0x1'));var moment=require('moment');function getSeconds(_0x5a66e8,_0x4ae343){var _0x5a8049=moment(_0x5a66e8)['milliseconds'](0x0);var _0x26117c=moment(_0x4ae343)[_0x9871('0x2')](0x0);return _0x5a8049[_0x9871('0x3')](_0x26117c,_0x9871('0x4'));}function Final(_0x5d6ffd){this[_0x9871('0x5')]=_0x5d6ffd['uniqueid'];this['scheduledat']=_0x5d6ffd[_0x9871('0x6')];this['type']=_0x5d6ffd[_0x9871('0x7')];this[_0x9871('0x8')]=_0x5d6ffd[_0x9871('0x7')]===_0x9871('0x9')?'queue':_0x5d6ffd[_0x9871('0x7')];this[_0x9871('0xa')]=_0x5d6ffd[_0x9871('0xa')];this['countcongestionretry']=_0x5d6ffd['countcongestionretry'];this[_0x9871('0xb')]=_0x5d6ffd['countnoanswerretry'];this[_0x9871('0xc')]=_0x5d6ffd[_0x9871('0xa')]+_0x5d6ffd[_0x9871('0xd')]+_0x5d6ffd[_0x9871('0xb')]+_0x5d6ffd[_0x9871('0xe')]+_0x5d6ffd[_0x9871('0xf')]+_0x5d6ffd[_0x9871('0x10')]+_0x5d6ffd[_0x9871('0x11')]+_0x5d6ffd['countagentrejectretry'];this[_0x9871('0xe')]=_0x5d6ffd[_0x9871('0xe')];this['countdropretry']=_0x5d6ffd[_0x9871('0xf')];this[_0x9871('0x10')]=_0x5d6ffd[_0x9871('0x10')];this[_0x9871('0x11')]=_0x5d6ffd[_0x9871('0x11')];this[_0x9871('0x12')]=_0x5d6ffd[_0x9871('0x12')];this[_0x9871('0x13')]=_0x5d6ffd[_0x9871('0x13')];this[_0x9871('0x14')]=_0x5d6ffd[_0x9871('0x14')];this[_0x9871('0x15')]=_0x5d6ffd[_0x9871('0x15')];this[_0x9871('0x16')]=_0x5d6ffd[_0x9871('0x16')];this[_0x9871('0x17')]=_0x5d6ffd[_0x9871('0x17')];this[_0x9871('0x18')]=_0x5d6ffd['responsetime'];this[_0x9871('0x19')]=_0x5d6ffd[_0x9871('0x19')]||0x0;this[_0x9871('0x1a')]=_0x5d6ffd[_0x9871('0x1a')]||0x0;this['talktime']=_0x5d6ffd['talktime']||0x0;this[_0x9871('0x1b')]=_0x5d6ffd['callback'];this[_0x9871('0x1c')]=_0x5d6ffd[_0x9871('0x1c')];this[_0x9871('0x1d')]=_0x5d6ffd[_0x9871('0x1d')];this[_0x9871('0x1e')]=_0x5d6ffd[_0x9871('0x1e')];this[_0x9871('0x1f')]=_0x5d6ffd[_0x9871('0x1f')];this[_0x9871('0x20')]=_0x5d6ffd[_0x9871('0x20')];this[_0x9871('0x21')]=_0x5d6ffd[_0x9871('0x21')];this['VoiceQueueId']=_0x5d6ffd[_0x9871('0x22')];this[_0x9871('0x23')]=_0x5d6ffd[_0x9871('0x23')];this[_0x9871('0x24')]=_0x5d6ffd['originatecalleridnum']||'';this[_0x9871('0x25')]=_0x5d6ffd[_0x9871('0x25')]||'';}module[_0x9871('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index d0d5a86..43f396f 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 _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 +var _0xea52=['format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','cause-txt','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','endtime'];(function(_0x249f58,_0x5b7462){var _0x36ba17=function(_0x4c8738){while(--_0x4c8738){_0x249f58['push'](_0x249f58['shift']());}};_0x36ba17(++_0x5b7462);}(_0xea52,0x13d));var _0x2ea5=function(_0x4d45cc,_0x5139b7){_0x4d45cc=_0x4d45cc-0x0;var _0x5b6795=_0xea52[_0x4d45cc];return _0x5b6795;};'use strict';var util=require(_0x2ea5('0x0'));var _=require(_0x2ea5('0x1'));var moment=require(_0x2ea5('0x2'));function getSeconds(_0x5a1622,_0x454f22){var _0x38a649=moment(_0x5a1622)[_0x2ea5('0x3')](0x0);var _0x5762f6=moment(_0x454f22)[_0x2ea5('0x3')](0x0);return _0x38a649[_0x2ea5('0x4')](_0x5762f6,_0x2ea5('0x5'));}function Hangup(_0x2cf708,_0x26dbde){this[_0x2ea5('0x6')]=0x4;this[_0x2ea5('0x7')]=_0x2ea5('0x8');this[_0x2ea5('0x9')]=_0x2cf708[_0x2ea5('0x9')];this[_0x2ea5('0xa')]=_0x2cf708[_0x2ea5('0xa')];this['campaigntype']=_0x2cf708[_0x2ea5('0xa')]==='outbound'?_0x2ea5('0xb'):_0x2cf708[_0x2ea5('0xa')];this['countbusyretry']=_0x2cf708['countbusyretry'];this[_0x2ea5('0xc')]=_0x2cf708[_0x2ea5('0xc')];this[_0x2ea5('0xd')]=_0x2cf708[_0x2ea5('0xd')];this[_0x2ea5('0xe')]=_0x2cf708[_0x2ea5('0xf')]+_0x2cf708['countcongestionretry']+_0x2cf708[_0x2ea5('0xd')]+_0x2cf708[_0x2ea5('0x10')]+_0x2cf708[_0x2ea5('0x11')]+_0x2cf708['countabandonedretry']+_0x2cf708['countmachineretry']+_0x2cf708['countagentrejectretry'];this['countnosuchnumberretry']=_0x2cf708[_0x2ea5('0x10')];this[_0x2ea5('0x11')]=_0x2cf708['countdropretry'];this[_0x2ea5('0x12')]=_0x2cf708[_0x2ea5('0x12')];this['countmachineretry']=_0x2cf708[_0x2ea5('0x13')];this[_0x2ea5('0x14')]=_0x2cf708[_0x2ea5('0x14')];this[_0x2ea5('0x15')]=_0x26dbde[_0x2ea5('0x15')];this[_0x2ea5('0x16')]=_0x2cf708['name'];this['calleridnum']=_0x2cf708[_0x2ea5('0x17')];this[_0x2ea5('0x18')]=_0x2cf708[_0x2ea5('0x18')];this['responsetime']=_0x2cf708[_0x2ea5('0x19')];this[_0x2ea5('0x1a')]=moment()[_0x2ea5('0x1b')](_0x2ea5('0x1c'));this[_0x2ea5('0x1d')]=getSeconds(_0x2cf708['responsetime'],_0x2cf708[_0x2ea5('0x18')]);this[_0x2ea5('0x1e')]=0x0;this[_0x2ea5('0x1f')]=getSeconds(this[_0x2ea5('0x1a')],_0x2cf708['responsetime']);this[_0x2ea5('0xb')]=_0x2cf708['queue'];this[_0x2ea5('0x20')]=_0x2ea5('0x21');this['reason']=_0x26dbde[_0x2ea5('0x22')];this['callback']=_0x2cf708['callback'];this[_0x2ea5('0x23')]=_0x2cf708[_0x2ea5('0x23')];this[_0x2ea5('0x24')]=_0x2cf708['callbackat'];this[_0x2ea5('0x25')]=_0x2cf708[_0x2ea5('0x25')];this['ContactId']=_0x2cf708[_0x2ea5('0x26')];this[_0x2ea5('0x27')]=_0x2cf708[_0x2ea5('0x27')];this[_0x2ea5('0x28')]=_0x2cf708['UserId'];this[_0x2ea5('0x29')]=_0x2cf708[_0x2ea5('0x29')];this['CampaignId']=_0x2cf708['CampaignId'];}module[_0x2ea5('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 6a98fdc..cefb73c 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 _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 +var _0x2b44=['starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','queue','calleridname','name','calleridnum'];(function(_0x265550,_0x232be3){var _0x290952=function(_0x3d8dd3){while(--_0x3d8dd3){_0x265550['push'](_0x265550['shift']());}};_0x290952(++_0x232be3);}(_0x2b44,0x1d7));var _0x42b4=function(_0x232127,_0x1acc42){_0x232127=_0x232127-0x0;var _0xc3064f=_0x2b44[_0x232127];return _0xc3064f;};'use strict';var util=require(_0x42b4('0x0'));var _=require('lodash');var moment=require(_0x42b4('0x1'));function getSeconds(_0x3eaacf,_0x6e82ac){var _0xb143b=moment(_0x3eaacf)[_0x42b4('0x2')](0x0);var _0x1cab7d=moment(_0x6e82ac)[_0x42b4('0x2')](0x0);return _0xb143b[_0x42b4('0x3')](_0x1cab7d,_0x42b4('0x4'));}function History(_0x454a93){this['uniqueid']=_0x454a93[_0x42b4('0x5')];this[_0x42b4('0x6')]=_0x454a93[_0x42b4('0x6')]||undefined;this[_0x42b4('0x7')]=_0x454a93[_0x42b4('0x7')];this[_0x42b4('0x8')]=_0x454a93[_0x42b4('0x7')]===_0x42b4('0x9')?'queue':_0x454a93['type'];this[_0x42b4('0xa')]=_0x454a93[_0x42b4('0xa')];this[_0x42b4('0xb')]=_0x454a93['countcongestionretry'];this['countnoanswerretry']=_0x454a93['countnoanswerretry'];this[_0x42b4('0xc')]=_0x454a93[_0x42b4('0xa')]+_0x454a93[_0x42b4('0xb')]+_0x454a93[_0x42b4('0xd')]+_0x454a93['countnosuchnumberretry']+_0x454a93[_0x42b4('0xe')]+_0x454a93['countabandonedretry']+_0x454a93['countmachineretry']+_0x454a93[_0x42b4('0xf')];this[_0x42b4('0x10')]=_0x454a93[_0x42b4('0x10')];this['countdropretry']=_0x454a93[_0x42b4('0xe')];this[_0x42b4('0x11')]=_0x454a93[_0x42b4('0x11')];this[_0x42b4('0x12')]=_0x454a93[_0x42b4('0x12')];this[_0x42b4('0xf')]=_0x454a93['countagentrejectretry'];this[_0x42b4('0x13')]=_0x454a93['queue'];this[_0x42b4('0x14')]=_0x454a93[_0x42b4('0x15')];this[_0x42b4('0x16')]=_0x454a93['number'];this[_0x42b4('0x17')]=_0x454a93[_0x42b4('0x17')];this[_0x42b4('0x18')]=_0x454a93['responsetime'];this[_0x42b4('0x19')]=_0x454a93[_0x42b4('0x18')];this[_0x42b4('0x1a')]=getSeconds(_0x454a93[_0x42b4('0x18')],_0x454a93['starttime']);this[_0x42b4('0x1b')]=0x0;this[_0x42b4('0x1c')]=0x0;this['callback']=_0x454a93[_0x42b4('0x1d')];this[_0x42b4('0x1e')]=_0x454a93[_0x42b4('0x1e')];this['callbackat']=_0x454a93[_0x42b4('0x1f')];this[_0x42b4('0x20')]=_0x454a93[_0x42b4('0x20')];this['ContactId']=_0x454a93['ContactId'];this['ListId']=_0x454a93[_0x42b4('0x21')];this['UserId']=_0x454a93['UserId'];this[_0x42b4('0x22')]=_0x454a93[_0x42b4('0x22')];this[_0x42b4('0x23')]=_0x454a93[_0x42b4('0x23')];this[_0x42b4('0x24')]=_0x454a93[_0x42b4('0x24')]||'';this[_0x42b4('0x25')]=_0x454a93[_0x42b4('0x25')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index fd0ae9a..be37704 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 _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 +var _0x3d50=['paused','stateinterface','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','run','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','command','iftime\x20%s,%s','interval','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Timezone:\x20','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','checkDialMethod','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','getQueue','isSuccess','callProgressDetecting','[callProgressDetecting]\x20','countbusyretry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','buildObj','nosuchnumber','checkRetriveMax','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','floor','[handlePredictive]','fail\x20to\x20scheduled\x20calls','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','Queue:\x20','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','RUNNING','[actionOriginate]\x20','checkIsBlackListIvr','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','not_inuse','[countReScheduled]\x20','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Error','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','\x20NOT\x20Active','name','\x20INTERVAL_IS_NULL','Interval','Intervals','INTERVAL_IS_NULL','[ifTime][Action]','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumHoldTime','talking','total','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','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','predictiveIntervalDroppedCallsCallersExit','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\x20Talk\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','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','waiting','sendMessageOneNotActive','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','endtime','starttime','clearZombieChannels','[uniqueid]','actions','[actions]','sequence','enqueue','isNil','Action','status','channel','No\x20such\x20channel','ivr','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','catch','checkIsBlackList','resolve','then','[checkIsBlackList]\x20','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','merge','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','reachable','SIP/%s','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','HangupInAMD','membername','[syncHangupInAMD][createHistory]','value','MACHINE','statedesc','Machine','AMD','countglobal','amd','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','countmachineretry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countcongestionretry','add','[syncHangupIvr]','AnswerAGI','AGI','[syncHangupIvr][createHistory]','dialQueueProject','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dropreason','TIMEOUT','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','CALLEREXIT','dialAbandonedMaxRetry','Abandoned','calleridname','syncNewExten','syncQueueMember','actionid','locked'];(function(_0x4104bb,_0xed252){var _0x206c58=function(_0x302528){while(--_0x302528){_0x4104bb['push'](_0x4104bb['shift']());}};_0x206c58(++_0xed252);}(_0x3d50,0xf1));var _0x03d5=function(_0x2828e7,_0x1809c2){_0x2828e7=_0x2828e7-0x0;var _0x5a3076=_0x3d50[_0x2828e7];return _0x5a3076;};'use strict';var util=require(_0x03d5('0x0'));var _=require('lodash');var BPromise=require(_0x03d5('0x1'));var uuid=require(_0x03d5('0x2'));var moment=require(_0x03d5('0x3'));var rr=require('rr');var md5=require(_0x03d5('0x4'));var Redis=require(_0x03d5('0x5'));var ut=require(_0x03d5('0x6'));var config=require('../../../config/environment/');var logger=require(_0x03d5('0x7'))(_0x03d5('0x8'));var loggerBooked=require(_0x03d5('0x7'))(_0x03d5('0x9'));var loggerPredictive=require(_0x03d5('0x7'))(_0x03d5('0xa'));var loggerPredictiveCalls=require(_0x03d5('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x03d5('0xb'));var ami=require(_0x03d5('0xc'));config['redis']=_['defaults'](config[_0x03d5('0xd')],{'host':_0x03d5('0xe'),'port':0x18eb});var io=require(_0x03d5('0xf'))(new Redis(config['redis']));var cmHopper=require(_0x03d5('0x10'));var cmHopperHistory=require(_0x03d5('0x11'));var cmHopperBlack=require(_0x03d5('0x12'));var voiceQueueRt=require(_0x03d5('0x13'));var Action=require(_0x03d5('0x14'));var History=require(_0x03d5('0x15'));var Final=require(_0x03d5('0x16'));var AgentComplete=require(_0x03d5('0x17'));var QueueCallerAbandon=require(_0x03d5('0x18'));var Hangup=require(_0x03d5('0x19'));var ipAgi=process[_0x03d5('0x1a')][_0x03d5('0x1b')]||_0x03d5('0x1c');var strategy={'rrmemory':_0x03d5('0x1d'),'roundrobin':_0x03d5('0x1e')};var Sequence=function(){};Sequence[_0x03d5('0x1f')]['enqueue']=function(_0x159130){this[_0x03d5('0x20')]=this[_0x03d5('0x20')]?this['tail'][_0x03d5('0x21')](_0x159130):_0x159130();};function Dialer(_0x44e25d,_0x169060){this['sequence']=new Sequence();this[_0x03d5('0x22')]=_0x169060;this[_0x03d5('0x23')]=_0x44e25d[_0x03d5('0x23')];this[_0x03d5('0x24')]=_0x44e25d[_0x03d5('0x24')];this[_0x03d5('0x25')]=_0x44e25d[_0x03d5('0x25')];this[_0x03d5('0x26')]=_0x44e25d['trunks'];this[_0x03d5('0x27')]=config[_0x03d5('0x27')]||0x2;this[_0x03d5('0x28')]={};this['actions']={};this[_0x03d5('0x29')]={};this[_0x03d5('0x2a')]={};this[_0x03d5('0x2b')]={};this[_0x03d5('0x2c')]={};this['startProgressive']={};this[_0x03d5('0x2d')]={};this[_0x03d5('0x2e')]={};this['queueBookedRR']={};ami['on'](_0x03d5('0x2f'),this[_0x03d5('0x30')][_0x03d5('0x31')](this));ami['on'](_0x03d5('0x32'),this[_0x03d5('0x33')][_0x03d5('0x31')](this));ami['on']('originateresponse',this[_0x03d5('0x34')][_0x03d5('0x31')](this));ami['on'](_0x03d5('0x35'),this[_0x03d5('0x36')][_0x03d5('0x31')](this));ami['on'](_0x03d5('0x37'),this['syncQueueSummary'][_0x03d5('0x31')](this));ami['on'](_0x03d5('0x38'),this[_0x03d5('0x39')][_0x03d5('0x31')](this));ami['on'](_0x03d5('0x3a'),this['syncNewExten'][_0x03d5('0x31')](this));ami['on']('varset',this['syncVarSet'][_0x03d5('0x31')](this));ami['on']('queuemember',this['syncQueueMember']['bind'](this));ami['on'](_0x03d5('0x3b'),this['syncQueueStatusComplete']['bind'](this));this[_0x03d5('0x3c')]();this[_0x03d5('0x3d')]();}function isNotNull(_0x15f22e){return _0x15f22e!==null&&!_[_0x03d5('0x3e')](_0x15f22e);}function checkIsLoggedIn(_0x3ee25d,_0x5a0a2c){return function(){if(_0x5a0a2c<=0x0){_0x3ee25d['message']='AGENTS_NOT_LOGGED';throw _0x3ee25d['name']+_0x03d5('0x3f');}};}function isActive(_0x138eaa){return _0x138eaa;}function checkIsActive(_0x48d49a,_0x20aec7){return function(){if(!isActive(_0x20aec7)){_0x48d49a[_0x03d5('0x40')]=_0x03d5('0x41');throw _0x48d49a['name']+_0x03d5('0x42');}};}function checkInterval(_0x29829a){return function(){if(!isNotNull(_0x29829a['Interval'])){_0x29829a[_0x03d5('0x40')]='INTERVAL_IS_NULL';throw _0x29829a[_0x03d5('0x43')]+_0x03d5('0x44');}if(!isNotNull(_0x29829a[_0x03d5('0x45')][_0x03d5('0x46')])){_0x29829a[_0x03d5('0x40')]=_0x03d5('0x47');throw _0x29829a['name']+_0x03d5('0x44');}if(!isNotNull(_['isEmpty'](_0x29829a[_0x03d5('0x45')][_0x03d5('0x46')]))){_0x29829a[_0x03d5('0x40')]=_0x03d5('0x47');throw _0x29829a['name']+_0x03d5('0x44');}};}function msgResponse(_0x5c0185,_0x28c910,_0x3b0d26){return{'action':_0x5c0185,'response':_0x28c910,'message':_0x3b0d26,'stack':_0x3b0d26};}function myreject(_0x96c488){return function(_0x5d3e3f){return _0x96c488(msgResponse(_0x03d5('0x48'),'Error',JSON[_0x03d5('0x49')](_0x5d3e3f)));};}function getSeconds(_0x3ef486,_0x57af77){var _0x112197=moment(_0x3ef486)[_0x03d5('0x4a')](0x0);var _0x449c23=moment(_0x57af77)[_0x03d5('0x4a')](0x0);return _0x112197[_0x03d5('0x4b')](_0x449c23,_0x03d5('0x4c'));}function emit(_0x2f0bb0,_0xc593bf,_0x5de666){io['to'](_0x2f0bb0)[_0x03d5('0x4d')](_0xc593bf,_0x5de666);}function emitVoiceQueueSummary(_0xfa2fe2){if(_0xfa2fe2[_0x03d5('0x4e')]===_0x03d5('0x4f')){var _0x309982={'id':_0xfa2fe2['id'],'name':_0xfa2fe2['name'],'strategy':_0xfa2fe2[_0x03d5('0x50')],'answered':_0xfa2fe2[_0x03d5('0x51')],'available':_0xfa2fe2[_0x03d5('0x52')],'loggedIn':_0xfa2fe2[_0x03d5('0x53')],'pTalking':_0xfa2fe2[_0x03d5('0x54')],'sumBillable':_0xfa2fe2['sumBillable'],'sumDuration':_0xfa2fe2['sumDuration'],'sumHoldTime':_0xfa2fe2[_0x03d5('0x55')]||0x0,'talking':_0xfa2fe2[_0x03d5('0x56')],'total':_0xfa2fe2[_0x03d5('0x57')],'type':_0xfa2fe2[_0x03d5('0x4e')],'unmanaged':_0xfa2fe2['unmanaged'],'abandoned':_0xfa2fe2[_0x03d5('0x58')],'waiting':_0xfa2fe2['waiting'],'loggedInDb':_0xfa2fe2[_0x03d5('0x59')],'dialActive':_0xfa2fe2[_0x03d5('0x5a')],'dialMethod':_0xfa2fe2[_0x03d5('0x5b')],'dialOriginateCallerIdName':_0xfa2fe2[_0x03d5('0x5c')],'dialOriginateCallerIdNumber':_0xfa2fe2[_0x03d5('0x5d')],'dialOriginateTimeout':_0xfa2fe2[_0x03d5('0x5e')],'dialPrefix':_0xfa2fe2[_0x03d5('0x5f')],'outboundAnswerAgiCallsDay':_0xfa2fe2[_0x03d5('0x60')],'outboundAnswerCallsDay':_0xfa2fe2[_0x03d5('0x61')],'outboundBlacklistCallsDay':_0xfa2fe2[_0x03d5('0x62')],'outboundBusyCallsDay':_0xfa2fe2['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0xfa2fe2[_0x03d5('0x63')],'outboundDropCallsDayACS':_0xfa2fe2[_0x03d5('0x64')],'outboundDropCallsDayCallersExit':_0xfa2fe2['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0xfa2fe2[_0x03d5('0x65')],'outboundNoAnswerCallsDay':_0xfa2fe2['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0xfa2fe2[_0x03d5('0x66')],'outboundOriginateFailureCallsDay':_0xfa2fe2['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0xfa2fe2[_0x03d5('0x67')],'outboundRejectCallsDay':_0xfa2fe2[_0x03d5('0x68')],'outboundUnknownCallsDay':_0xfa2fe2[_0x03d5('0x69')],'predictiveIntervalAnsweredCalls':_0xfa2fe2[_0x03d5('0x6a')],'predictiveIntervalAvgHoldtime':_0xfa2fe2[_0x03d5('0x6b')],'predictiveIntervalAvgTalktime':_0xfa2fe2[_0x03d5('0x6c')],'predictiveIntervalDroppedCallsCallersExit':_0xfa2fe2['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0xfa2fe2[_0x03d5('0x6d')],'predictiveIntervalErlangCalls':_0xfa2fe2[_0x03d5('0x6e')],'predictiveIntervalErlangCallsDroppedCalls':_0xfa2fe2[_0x03d5('0x6f')],'predictiveIntervalHitRate':_0xfa2fe2['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0xfa2fe2['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0xfa2fe2[_0x03d5('0x70')],'predictiveIntervalAvailable':_0xfa2fe2[_0x03d5('0x71')],'predictiveIntervalTotalCalls':_0xfa2fe2['predictiveIntervalTotalCalls'],'message':_0xfa2fe2['message'],'originated':_0xfa2fe2[_0x03d5('0x72')],'erlangCalls':_0xfa2fe2[_0x03d5('0x73')],'erlangCallToSecond':_0xfa2fe2[_0x03d5('0x74')],'erlangAbandonmentRate':_0xfa2fe2[_0x03d5('0x75')],'erlangBusyFactor':_0xfa2fe2[_0x03d5('0x76')],'startPredictive':_0xfa2fe2[_0x03d5('0x2c')],'startProgressive':_0xfa2fe2[_0x03d5('0x77')]};if(_0xfa2fe2[_0x03d5('0x78')]){_0x309982['Trunk']={'id':_0xfa2fe2['Trunk']['id'],'name':_0xfa2fe2[_0x03d5('0x78')][_0x03d5('0x43')],'active':_0xfa2fe2[_0x03d5('0x78')][_0x03d5('0x79')],'callerid':_0xfa2fe2[_0x03d5('0x78')]['callerid']};}if(_0xfa2fe2[_0x03d5('0x45')]){_0x309982[_0x03d5('0x45')]={'id':_0xfa2fe2['Interval']['id'],'name':_0xfa2fe2[_0x03d5('0x45')][_0x03d5('0x43')]};}var _0x41f4b5=md5(JSON[_0x03d5('0x49')](_0x309982));if(_0xfa2fe2[_0x03d5('0x4')]!==_0x41f4b5){_0xfa2fe2[_0x03d5('0x4')]=_0x41f4b5;emit(util['format'](_0x03d5('0x7a'),_0x309982[_0x03d5('0x43')]),_0x03d5('0x7b'),_0x309982);}}}function emitCampaignSummary(_0x317878){if(_0x317878['type']==='ivr'){emit(util['format'](_0x03d5('0x7c'),_0x317878[_0x03d5('0x43')]),_0x03d5('0x7d'),_0x317878);}}function checkGetDataPredictive(_0x5064df){if(isNotNull(_0x5064df)&&!_['isEmpty'](_0x5064df)){loggerPredictive[_0x03d5('0x7e')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x7f'),_0x5064df[_0x03d5('0x80')]);loggerPredictive['info'](_0x03d5('0x81'),_0x5064df[_0x03d5('0x6a')]);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x82'),_0x5064df['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x83'),_0x5064df[_0x03d5('0x84')]);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x85'),_0x5064df[_0x03d5('0x6b')]);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x86'),_0x5064df['predictiveIntervalAvgTalktime']);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x87'));if(_0x5064df[_0x03d5('0x80')]>0x0){if(!_[_0x03d5('0x3e')](_0x5064df[_0x03d5('0x6c')])&&_0x5064df[_0x03d5('0x6c')]>0x0){return!![];}loggerPredictive['info'](_0x03d5('0x88'));if(!_[_0x03d5('0x3e')](_0x5064df[_0x03d5('0x6b')])&&_0x5064df[_0x03d5('0x6b')]>0x0){return!![];}loggerPredictive[_0x03d5('0x7e')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0x03d5('0x89'));}}else{loggerPredictive[_0x03d5('0x7e')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0xed30f){return function(_0x185a42){loggerPredictive[_0x03d5('0x7e')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x8a'),_0x185a42[_0x03d5('0x73')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x185a42[_0x03d5('0x74')]);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x8b'),_0x185a42[_0x03d5('0x75')]);loggerPredictive[_0x03d5('0x7e')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x185a42[_0x03d5('0x76')]);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x8b'),_0x185a42[_0x03d5('0x75')]);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x87'));_['merge'](_0xed30f,_0x185a42);};}function getDiff(_0xd6b899){var _0x3eb225=moment()[_0x03d5('0x4a')](0x0);var _0x2c0a1d=moment(_0xd6b899)['milliseconds'](0x0);return _0x3eb225[_0x03d5('0x4b')](_0x2c0a1d,'seconds');}function ifInterval(_0x4ca518,_0x438417){if(_['isUndefined'](_0x438417)){return![];}return getDiff(_0x438417)<_0x4ca518*0x3c;}function freeVariablesPredictive(_0xa6a317){if(isNotNull(_0xa6a317)){if(!_[_0x03d5('0x3e')](_0xa6a317[_0x03d5('0x77')])){_0xa6a317[_0x03d5('0x77')]=undefined;loggerPredictive[_0x03d5('0x7e')](_0xa6a317['name'],_0x03d5('0x8c'));}if(!_['isUndefined'](_0xa6a317[_0x03d5('0x2c')])){_0xa6a317[_0x03d5('0x2c')]=undefined;loggerPredictive[_0x03d5('0x7e')](_0xa6a317[_0x03d5('0x43')],_0x03d5('0x8d'));}if(!_[_0x03d5('0x3e')](_0xa6a317[_0x03d5('0x8e')])){clearInterval(_0xa6a317[_0x03d5('0x8e')]);_0xa6a317[_0x03d5('0x8e')]=undefined;loggerPredictive['info'](_0xa6a317[_0x03d5('0x43')],_0x03d5('0x8f'));}}}function erlangb(_0xbc8cbb,_0x3ca70b){if(_0x3ca70b===0x0){return 0x0;}var _0x5139e0=0x1;for(var _0x453d81=0x1;_0x453d81<=_0x3ca70b;_0x453d81+=0x1){_0x5139e0=0x1+_0x5139e0*_0x453d81/_0xbc8cbb;}return 0x1/_0x5139e0;}function isVoiceQueueOutbound(_0x4a9086){return _0x4a9086===_0x03d5('0x4f');}function isNotPreview(_0xbb3479){return _0xbb3479!==_0x03d5('0x22');}function isCampaignIvr(_0x3294ac){return _0x3294ac==='ivr';}function getCallerId(_0x2c4ad9,_0x141659,_0x9bafa2){if(!_[_0x03d5('0x3e')](_0x9bafa2)&&typeof _0x9bafa2===_0x03d5('0x90')&&!_[_0x03d5('0x91')](_0x9bafa2)){if(!_[_0x03d5('0x3e')](_0x141659)&&typeof _0x141659===_0x03d5('0x90')&&!_[_0x03d5('0x91')](_0x141659)){return util[_0x03d5('0x92')](_0x03d5('0x93'),_0x141659,_0x9bafa2);}return util[_0x03d5('0x92')](_0x03d5('0x93'),_0x9bafa2,_0x9bafa2);}if(!_[_0x03d5('0x3e')](_0x2c4ad9)&&typeof _0x2c4ad9===_0x03d5('0x90')&&!_[_0x03d5('0x91')](_0x2c4ad9)){return _0x2c4ad9;}return _0x03d5('0x94');}function loggerCatchQueueSummary(_0x45f02f,_0x377489){return function(_0x49f671){freeVariablesPredictive(_0x377489);emitVoiceQueueSummary(_0x377489);emitCampaignSummary(_0x377489);loggerSyncQueueSummary[_0x03d5('0x95')](_0x45f02f,util[_0x03d5('0x96')](_0x49f671,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x11bea5,_0xa6a04d){return function(_0x2a34df){loggerPredictive[_0x03d5('0x95')](_0xa6a04d[_0x03d5('0x43')],_0x11bea5);loggerPredictive['error'](_0x2a34df['stack']);freeVariablesPredictive(_0xa6a04d);};}function loggerCatch(_0x447fd7){return function(_0x28d612){logger[_0x03d5('0x95')](_0x447fd7,util[_0x03d5('0x96')](_0x28d612,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xca95a7){return _0xca95a7&&!_['isUndefined'](_0xca95a7)&&_0xca95a7[_0x03d5('0x97')]>0x0;}function decremetOriginate(_0x5680e5){if(!_['isUndefined'](_0x5680e5)&&_0x5680e5!==null){if(typeof _0x5680e5[_0x03d5('0x72')]!==_0x03d5('0x98')){if(_0x5680e5[_0x03d5('0x72')]>0x0){_0x5680e5[_0x03d5('0x72')]-=0x1;}else{logger['error'](_0x03d5('0x99'));}}}else{logger[_0x03d5('0x95')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x2344a2,_0x5015c8,_0xdcd4c2){if(_0x5015c8>_0xdcd4c2){for(var _0x285a48=0x0;_0x285a48<_0x5015c8-_0xdcd4c2;_0x285a48+=0x1){decremetOriginate(_0x2344a2);}}}function loggerGetContactDialer(_0x2fec75,_0x561b39,_0x2e221b){return function(_0xdd7578){checkContactLowerLimitOriginate(_0x561b39,_0x2e221b,0x0);logger['error'](_0x2fec75,util['inspect'](_0xdd7578,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x525762){return function(_0x4c09ae){if(isNotNull(_0x4c09ae)&&isNotNull(_0x4c09ae[0x0])){if(_0x4c09ae[0x0]['contactsRescheduled']>0x0){_0x525762[_0x03d5('0x40')]=_0x03d5('0x9a');logger[_0x03d5('0x7e')](_0x03d5('0x9b')+_0x525762[_0x03d5('0x43')],_0x4c09ae[0x0][_0x03d5('0x9c')],_0x03d5('0x9d'));}else{_0x525762[_0x03d5('0x40')]=_0x03d5('0x9e');logger[_0x03d5('0x7e')]('[getContactDialer2][Empty]'+_0x525762[_0x03d5('0x43')]);}}};}function notSendMessagesQueue(_0x10be75){if(_0x10be75['sendMessageOneNotActive']){freeVariablesPredictive(_0x10be75);if(_0x10be75['originated']===0x0&&_0x10be75[_0x03d5('0x56')]===0x0&&_0x10be75[_0x03d5('0x9f')]===0x0&&(_0x10be75['pTalking']||0x0)===0x0){_0x10be75[_0x03d5('0xa0')]=![];_0x10be75['available']=0x0;_0x10be75[_0x03d5('0x40')]=_0x03d5('0x41');loggerSyncQueueSummary[_0x03d5('0x95')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x10be75[_0x03d5('0x43')],'is\x20not\x20active');}else{_0x10be75[_0x03d5('0x40')]=_0x03d5('0xa1');loggerSyncQueueSummary['error'](_0x03d5('0xa2'),_0x10be75[_0x03d5('0x43')],_0x03d5('0xa3'));}emitVoiceQueueSummary(_0x10be75);}}function notSendMessagesCampaign(_0x2a9a20){if(_0x2a9a20['sendMessageOneNotActive']){if(_0x2a9a20[_0x03d5('0x72')]===0x0){_0x2a9a20[_0x03d5('0xa0')]=![];_0x2a9a20[_0x03d5('0x40')]=_0x03d5('0x41');loggerSyncQueueSummary['error'](_0x03d5('0xa4'),_0x2a9a20['name'],_0x03d5('0xa5'));}else{_0x2a9a20[_0x03d5('0x40')]=_0x03d5('0xa1');loggerSyncQueueSummary[_0x03d5('0x95')](_0x03d5('0xa4'),_0x2a9a20['name'],_0x03d5('0xa3'));}emitCampaignSummary(_0x2a9a20);}}function createObjHistory(_0x3e92d6,_0x86f5d3,_0x2ddc1a,_0x546c3a,_0x11f8ff){_0x3e92d6[_0x03d5('0x40')]=_0x2ddc1a;var _0x442004=new Action(_0x3e92d6,_0x86f5d3);var _0x462821=new History(_0x442004);_0x462821[_0x03d5('0xa6')]=_0x546c3a;_0x462821['statedesc']=_0x11f8ff;_0x462821[_0x03d5('0xa7')]=_0x442004[_0x03d5('0xa8')];return _0x462821;}Dialer['prototype'][_0x03d5('0x3d')]=function(){var _0x142bd9=this;setInterval(function(){_0x142bd9[_0x03d5('0xa9')](_0x142bd9[_0x03d5('0x2a')],_0x03d5('0xaa'));_0x142bd9['clearZombieChannels'](_0x142bd9[_0x03d5('0xab')],_0x03d5('0xac'));},0x32c8);};Dialer[_0x03d5('0x1f')][_0x03d5('0xa9')]=function(_0x5bc7ca,_0x54b5be){var _0x1b6041=this;for(var _0x3d877c in _0x5bc7ca){if(typeof _0x5bc7ca[_0x3d877c]!==_0x03d5('0x98')){this[_0x03d5('0xad')][_0x03d5('0xae')](function(){if(!_[_0x03d5('0xaf')](_0x5bc7ca[_0x3d877c])){return ami[_0x03d5('0xb0')]({'action':_0x03d5('0xb1'),'channel':_0x5bc7ca[_0x3d877c][_0x03d5('0xb2')]})['catch'](function(_0x2fa42c){if(_0x2fa42c[_0x03d5('0x40')]===_0x03d5('0xb3')){setTimeout(function(){if(_0x5bc7ca[_0x3d877c]&&_0x5bc7ca[_0x3d877c]['type']!==_0x03d5('0xb4')){_0x1b6041['updateOriginated'](_0x1b6041['voiceQueues'][_0x5bc7ca[_0x3d877c][_0x03d5('0xb5')]]);logger[_0x03d5('0x95')](_0x03d5('0xb6'),_0x54b5be,_0x3d877c,_0x5bc7ca[_0x3d877c][_0x03d5('0xb5')]);delete _0x5bc7ca[_0x3d877c];}if(_0x5bc7ca[_0x3d877c]&&_0x5bc7ca[_0x3d877c][_0x03d5('0x4e')]===_0x03d5('0xb4')){_0x1b6041[_0x03d5('0xb7')](_0x1b6041[_0x03d5('0x24')][_0x5bc7ca[_0x3d877c]['queue']]);logger[_0x03d5('0x95')](_0x03d5('0xb8'),_0x54b5be,_0x3d877c,_0x5bc7ca[_0x3d877c][_0x03d5('0xb5')]);delete _0x5bc7ca[_0x3d877c];}},0x2328);}});}});}}};Dialer[_0x03d5('0x1f')][_0x03d5('0xb9')]=function(_0x4040de){return BPromise['resolve']()['then'](cmHopper[_0x03d5('0xb9')](_0x4040de))[_0x03d5('0xba')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0x03d5('0xbb')]=function(_0x1922b2){return BPromise[_0x03d5('0xbc')]()[_0x03d5('0xbd')](cmHopperBlack[_0x03d5('0xbb')](_0x1922b2))[_0x03d5('0xba')](loggerCatch(_0x03d5('0xbe')));};Dialer[_0x03d5('0x1f')]['checkIsBlackListIvr']=function(_0x26a69c){return BPromise[_0x03d5('0xbc')]()[_0x03d5('0xbd')](cmHopperBlack['checkIsBlackListIvr'](_0x26a69c))[_0x03d5('0xba')](loggerCatch(_0x03d5('0xbf')));};Dialer[_0x03d5('0x1f')][_0x03d5('0xc0')]=function(_0x979d49){return BPromise[_0x03d5('0xbc')]()[_0x03d5('0xbd')](cmHopperHistory[_0x03d5('0xc1')](_0x979d49))['catch'](loggerCatch(_0x03d5('0xc2')));};Dialer['prototype'][_0x03d5('0xc3')]=function(_0x18a6b5){return BPromise[_0x03d5('0xbc')]()[_0x03d5('0xbd')](cmHopper[_0x03d5('0xc3')](_0x18a6b5))[_0x03d5('0xba')](loggerCatch(_0x03d5('0xc4')));};Dialer[_0x03d5('0x1f')]['unlockContact']=function(_0x4d4e91,_0xaea31f,_0x153bdc){return BPromise[_0x03d5('0xbc')]()[_0x03d5('0xbd')](cmHopper[_0x03d5('0xc5')](_0x4d4e91,_0xaea31f,_0x153bdc))[_0x03d5('0xba')](loggerCatch(_0x03d5('0xc6')));};Dialer[_0x03d5('0x1f')][_0x03d5('0xc7')]=function(_0x3722ba,_0x4e209a,_0x69012a,_0x2e225e){return BPromise[_0x03d5('0xbc')]()[_0x03d5('0xbd')](cmHopper[_0x03d5('0xc7')](_0x3722ba,_0x4e209a,_0x69012a,_0x2e225e))[_0x03d5('0xba')](loggerCatch(_0x03d5('0xc8')));};Dialer['prototype'][_0x03d5('0xc9')]=function(_0x43e0a3,_0x54b6ab,_0x422ac4){return BPromise[_0x03d5('0xbc')]()['then'](cmHopper['getContactDialerIvr'](_0x43e0a3,_0x54b6ab,_0x422ac4))[_0x03d5('0xba')](loggerCatch(_0x03d5('0xc8')));};Dialer[_0x03d5('0x1f')][_0x03d5('0xca')]=function(_0x3f76fd){return BPromise[_0x03d5('0xbc')]()[_0x03d5('0xbd')](voiceQueueRt[_0x03d5('0xca')](_0x3f76fd))[_0x03d5('0xba')](loggerCatch(_0x03d5('0xcb')));};Dialer[_0x03d5('0x1f')]['moveContactManagedDialer']=function(_0x506936){return BPromise[_0x03d5('0xbc')]()[_0x03d5('0xbd')](cmHopper[_0x03d5('0xcc')](_0x506936))[_0x03d5('0xba')](loggerCatch(_0x03d5('0xcd')));};Dialer['prototype'][_0x03d5('0xce')]=function(_0x1bf225){return BPromise[_0x03d5('0xbc')]()[_0x03d5('0xbd')](cmHopperHistory[_0x03d5('0xce')](_0x1bf225))[_0x03d5('0xba')](loggerCatch(_0x03d5('0xcf')));};Dialer['prototype'][_0x03d5('0xb7')]=function(_0x297ee2){if(!_[_0x03d5('0x3e')](_0x297ee2)&&_0x297ee2!==null){if(typeof _0x297ee2[_0x03d5('0x72')]!==_0x03d5('0x98')){if(_0x297ee2[_0x03d5('0x72')]>0x0){_0x297ee2[_0x03d5('0x72')]-=0x1;}else{logger[_0x03d5('0x95')](_0x03d5('0xd0'));}}}else{logger[_0x03d5('0x95')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x03d5('0x1f')][_0x03d5('0xd1')]=function(_0x15bede,_0x1661f0){var _0x462ee6=this;return function(_0x220693){_0x462ee6['updateOriginated'](_0x1661f0);logger['error'](_0x15bede,util[_0x03d5('0x96')](_0x220693,{'showHidden':![],'depth':null}));};};Dialer[_0x03d5('0x1f')][_0x03d5('0xd2')]=function(_0x53771f,_0x436e4b,_0x2e838f){var _0x4a1e30={'state':0x19,'statedesc':_0x03d5('0xd3')};this['updateOriginated'](_0x436e4b);this[_0x03d5('0xd4')](_[_0x03d5('0xd5')](_0x4a1e30,_[_0x03d5('0xd6')](_0x2e838f,[_0x03d5('0xd7'),_0x03d5('0xd8'),_0x03d5('0xd9'),_0x03d5('0xda'),'CampaignId'])),_0x03d5('0xdb'),_0x03d5('0xdc'));logger[_0x03d5('0x95')](_0x53771f);};Dialer[_0x03d5('0x1f')]['isSuccess']=function(_0x1a0a49){return _0x1a0a49===_0x03d5('0xdd');};Dialer[_0x03d5('0x1f')][_0x03d5('0xde')]=function(_0x572a15){return!_[_0x03d5('0x3e')](_0x572a15)&&_0x572a15&&!_['isUndefined'](_0x572a15['name'])&&!_[_0x03d5('0x3e')](_0x572a15[_0x03d5('0x79')])&&_0x572a15[_0x03d5('0x79')]&&(this[_0x03d5('0x26')][util['format']('SIP/%s',_0x572a15[_0x03d5('0x43')])][_0x03d5('0xb1')]===_0x03d5('0xdf')||this[_0x03d5('0x26')][util['format'](_0x03d5('0xe0'),_0x572a15[_0x03d5('0x43')])][_0x03d5('0xb1')]==='unmonitored');};Dialer[_0x03d5('0x1f')][_0x03d5('0xd4')]=function(_0x25511e,_0xe409bc,_0x5200eb){this['createHistory'](_0x25511e)[_0x03d5('0xba')](loggerCatch(_0xe409bc));this[_0x03d5('0xcc')](_0x25511e)['catch'](loggerCatch(_0x5200eb));};Dialer[_0x03d5('0x1f')]['syncVarSet']=function(_0x1f9b9c){var _0x5aea9a=this[_0x03d5('0x2a')][_0x1f9b9c[_0x03d5('0xe1')]];var _0x2392ef;if(!_['isNil'](_0x1f9b9c)&&!_[_0x03d5('0xaf')](_0x1f9b9c[_0x03d5('0xe2')])&&!_[_0x03d5('0xaf')](_0x1f9b9c['variable'][_0x03d5('0xe3')])&&_0x1f9b9c[_0x03d5('0xe4')]===_0x03d5('0xe5')&&_0x5aea9a){if(_0x5aea9a['type']!==_0x03d5('0xb4')&&this[_0x03d5('0x23')][_0x5aea9a[_0x03d5('0xb5')]][_0x03d5('0xe6')]&&_0x1f9b9c['value']===_0x03d5('0xe7')){delete this[_0x03d5('0x2a')][_0x1f9b9c['uniqueid']];this[_0x03d5('0xb7')](this['voiceQueues'][_0x5aea9a[_0x03d5('0xb5')]]);this['voiceQueues'][_0x5aea9a[_0x03d5('0xb5')]][_0x03d5('0x61')]+=0x1;this[_0x03d5('0x23')][_0x5aea9a[_0x03d5('0xb5')]][_0x03d5('0x60')]+=0x1;_0x2392ef=new Hangup(_0x5aea9a,_0x1f9b9c);_0x2392ef['state']=0x12;_0x2392ef['statedesc']=_0x03d5('0xe8');_0x2392ef[_0x03d5('0xe9')]='AMD';this[_0x03d5('0xd4')](_0x2392ef,_0x03d5('0xea'),'[syncHangupInAMD]');}if(_0x5aea9a[_0x03d5('0x4e')]!==_0x03d5('0xb4')&&this[_0x03d5('0x23')][_0x5aea9a['queue']][_0x03d5('0xe6')]&&_0x1f9b9c[_0x03d5('0xeb')]===_0x03d5('0xec')){var _0x172062=this;return new BPromise(function(_0x3ac200,_0x38ae25){delete _0x172062['uniqueId'][_0x1f9b9c['uniqueid']];_0x172062['updateOriginated'](_0x172062[_0x03d5('0x23')][_0x5aea9a[_0x03d5('0xb5')]]);_0x172062[_0x03d5('0x23')][_0x5aea9a[_0x03d5('0xb5')]][_0x03d5('0x61')]+=0x1;_0x172062[_0x03d5('0x23')][_0x5aea9a[_0x03d5('0xb5')]][_0x03d5('0x60')]+=0x1;var _0x49f3ae=_0x172062[_0x03d5('0x23')][_0x5aea9a['queue']];var _0x4136b7=new Hangup(_0x5aea9a,_0x1f9b9c);_0x4136b7[_0x03d5('0xa6')]=0x13;_0x4136b7[_0x03d5('0xed')]=_0x03d5('0xee');_0x4136b7['membername']=_0x03d5('0xef');_0x4136b7['countmachineretry']+=0x1;_0x4136b7[_0x03d5('0xf0')]+=0x1;_0x4136b7[_0x03d5('0xf1')]=!![];_0x172062['createHistory'](_0x4136b7)[_0x03d5('0xba')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4136b7['countbusyretry']+_0x4136b7['countcongestionretry']+_0x4136b7[_0x03d5('0xf2')]+_0x4136b7[_0x03d5('0xf3')]+_0x4136b7[_0x03d5('0xf4')]+_0x4136b7[_0x03d5('0xf5')]+_0x4136b7['countmachineretry']+_0x4136b7[_0x03d5('0xf6')]>=_0x49f3ae[_0x03d5('0xf7')]){_0x172062[_0x03d5('0xf8')](_0x4136b7,_0x3ac200,_0x38ae25,_0x03d5('0xf9'));}else{if(_0x4136b7[_0x03d5('0xfa')]>=_0x49f3ae[_0x03d5('0xfb')]){_0x172062[_0x03d5('0xfc')](_0x4136b7,_0x3ac200,_0x38ae25,_0x03d5('0xfd'));}else{_0x172062[_0x03d5('0xc3')]({'active':![],'countmachineretry':_0x4136b7[_0x03d5('0xfa')],'scheduledat':moment()['add'](_0x49f3ae[_0x03d5('0xfe')],_0x03d5('0xff'))[_0x03d5('0x92')](_0x03d5('0x100')),'ContactId':_0x4136b7[_0x03d5('0xd7')],'ListId':_0x4136b7[_0x03d5('0xd8')],'VoiceQueueId':_0x4136b7[_0x03d5('0xda')]||undefined,'CampaignId':_0x4136b7[_0x03d5('0x101')]||undefined})['catch'](loggerCatch(_0x03d5('0x102')));_0x3ac200({'reschedule':0x1});}}});}if(_0x5aea9a['type']===_0x03d5('0xb4')&&this[_0x03d5('0x24')][_0x5aea9a['queue']][_0x03d5('0xe6')]&&_0x1f9b9c[_0x03d5('0xeb')]==='HANGUP'){delete this[_0x03d5('0x2a')][_0x1f9b9c[_0x03d5('0xe1')]];this[_0x03d5('0xb7')](this[_0x03d5('0x24')][_0x5aea9a[_0x03d5('0xb5')]]);_0x2392ef=new Hangup(_0x5aea9a,_0x1f9b9c);_0x2392ef[_0x03d5('0xa6')]=0x12;_0x2392ef[_0x03d5('0xed')]=_0x03d5('0xe8');_0x2392ef[_0x03d5('0xe9')]=_0x03d5('0xef');this[_0x03d5('0xd4')](_0x2392ef,'[syncHangupInAMDIvr][createHistory]',_0x03d5('0x103'));}if(_0x5aea9a['type']===_0x03d5('0xb4')&&this[_0x03d5('0x24')][_0x5aea9a[_0x03d5('0xb5')]]['dialAMDActive']&&_0x1f9b9c[_0x03d5('0xeb')]===_0x03d5('0xec')){var _0x172062=this;return new BPromise(function(_0x5762bb,_0x262570){delete _0x172062[_0x03d5('0x2a')][_0x1f9b9c['uniqueid']];_0x172062[_0x03d5('0xb7')](_0x172062['campaigns'][_0x5aea9a[_0x03d5('0xb5')]]);_0x172062['campaigns'][_0x5aea9a[_0x03d5('0xb5')]]['outboundAnswerCallsDay']+=0x1;_0x172062[_0x03d5('0x24')][_0x5aea9a[_0x03d5('0xb5')]][_0x03d5('0x60')]+=0x1;var _0x31766d=_0x172062['campaigns'][_0x5aea9a['queue']];var _0x150e66=new Hangup(_0x5aea9a,_0x1f9b9c);_0x150e66[_0x03d5('0xa6')]=0x13;_0x150e66[_0x03d5('0xed')]=_0x03d5('0xee');_0x150e66['membername']=_0x03d5('0xef');_0x150e66[_0x03d5('0xfa')]+=0x1;_0x150e66[_0x03d5('0xf0')]+=0x1;_0x150e66['amd']=!![];_0x172062[_0x03d5('0xce')](_0x150e66)['catch'](loggerCatch(_0x03d5('0x104')));if(_0x150e66['countbusyretry']+_0x150e66[_0x03d5('0x105')]+_0x150e66['countnoanswerretry']+_0x150e66[_0x03d5('0xf3')]+_0x150e66[_0x03d5('0xf4')]+_0x150e66[_0x03d5('0xf5')]+_0x150e66[_0x03d5('0xfa')]+_0x150e66[_0x03d5('0xf6')]>=_0x31766d[_0x03d5('0xf7')]){_0x172062['stateGlobal'](_0x150e66,_0x5762bb,_0x262570,_0x03d5('0xf9'));}else{if(_0x150e66[_0x03d5('0xfa')]>=_0x31766d['dialMachineMaxRetry']){_0x172062[_0x03d5('0xfc')](_0x150e66,_0x5762bb,_0x262570,'reason\x2019\x20machine....');}else{_0x172062[_0x03d5('0xc3')]({'active':![],'countmachineretry':_0x150e66[_0x03d5('0xfa')],'scheduledat':moment()[_0x03d5('0x106')](_0x31766d[_0x03d5('0xfe')],_0x03d5('0xff'))[_0x03d5('0x92')](_0x03d5('0x100')),'ContactId':_0x150e66[_0x03d5('0xd7')],'ListId':_0x150e66['ListId'],'VoiceQueueId':_0x150e66['VoiceQueueId']||undefined,'CampaignId':_0x150e66[_0x03d5('0x101')]||undefined})[_0x03d5('0xba')](loggerCatch(_0x03d5('0x102')));_0x5762bb({'reschedule':0x1});}}});}}};Dialer[_0x03d5('0x1f')][_0x03d5('0x39')]=function(_0x563685){var _0x21430e=this['uniqueId'][_0x563685[_0x03d5('0xe1')]];var _0x455664=this;var _0x5377c2;if(_0x21430e&&_0x21430e['type']===_0x03d5('0xb4')){delete this[_0x03d5('0x2a')][_0x563685[_0x03d5('0xe1')]];this[_0x03d5('0xb7')](this['campaigns'][_0x21430e['queue']]);this[_0x03d5('0x24')][_0x21430e[_0x03d5('0xb5')]]['ivrAnswerCallsDay']+=0x1;_0x5377c2=new Hangup(_0x21430e,_0x563685);this[_0x03d5('0xce')](_0x5377c2)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x03d5('0xcc')](_0x5377c2)['catch'](loggerCatch(_0x03d5('0x107')));}if(_0x21430e&&_0x21430e[_0x03d5('0x4e')]!=='ivr'&&isNotNull(this[_0x03d5('0x23')][_0x21430e[_0x03d5('0xb5')]]['dialQueueProject'])){delete this['uniqueId'][_0x563685[_0x03d5('0xe1')]];this['updateOriginated'](this[_0x03d5('0x23')][_0x21430e[_0x03d5('0xb5')]]);this[_0x03d5('0x23')][_0x21430e[_0x03d5('0xb5')]][_0x03d5('0x61')]+=0x1;this['voiceQueues'][_0x21430e[_0x03d5('0xb5')]][_0x03d5('0x60')]+=0x1;_0x5377c2=new Hangup(_0x21430e,_0x563685);_0x5377c2['state']=0x10;_0x5377c2[_0x03d5('0xed')]=_0x03d5('0x108');_0x5377c2[_0x03d5('0xe9')]=_0x03d5('0x109');this[_0x03d5('0xce')](_0x5377c2)['catch'](loggerCatch(_0x03d5('0x10a')));this[_0x03d5('0xcc')](_0x5377c2)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x107')));}if(_0x21430e&&_0x21430e['type']!=='ivr'&&!isNotNull(this['voiceQueues'][_0x21430e[_0x03d5('0xb5')]][_0x03d5('0x10b')])){delete this[_0x03d5('0x2a')][_0x563685[_0x03d5('0xe1')]];this[_0x03d5('0xb7')](this['voiceQueues'][_0x21430e[_0x03d5('0xb5')]]);this[_0x03d5('0x23')][_0x21430e['queue']]['outboundUnknownCallsDay']+=0x1;_0x5377c2=new Hangup(_0x21430e,_0x563685);_0x5377c2[_0x03d5('0xa6')]=0xc;_0x5377c2[_0x03d5('0xed')]=_0x563685[_0x03d5('0x10c')];_0x5377c2['membername']=_0x03d5('0x10d');this[_0x03d5('0xce')](_0x5377c2)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x03d5('0xcc')](_0x5377c2)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x107')));}};Dialer[_0x03d5('0x1f')]['syncAgentComplete']=function(_0x5f05dc){var _0x24c79a=this[_0x03d5('0x2a')][_0x5f05dc[_0x03d5('0xe1')]];var _0x5e88a4=this;if(this[_0x03d5('0x23')][_0x5f05dc[_0x03d5('0xb5')]]){if(_0x24c79a&&_0x24c79a[_0x03d5('0x4e')]!==_0x03d5('0xb4')){delete this[_0x03d5('0x2a')][_0x5f05dc[_0x03d5('0xe1')]];this['voiceQueues'][_0x5f05dc[_0x03d5('0xb5')]][_0x03d5('0x61')]+=0x1;var _0x4f3f6b=new AgentComplete(_0x24c79a,_0x5f05dc);if(_0x5f05dc[_0x03d5('0x10e')]===_0x03d5('0x10f')){_0x4f3f6b[_0x03d5('0x110')]=this['voiceQueues'][_0x5f05dc[_0x03d5('0xb5')]][_0x03d5('0x111')]&&this['voiceQueues'][_0x5f05dc[_0x03d5('0xb5')]][_0x03d5('0x112')]?moment()[_0x03d5('0x92')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x03d5('0xce')](_0x4f3f6b)[_0x03d5('0xba')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x03d5('0xcc')](_0x4f3f6b)['catch'](loggerCatch(_0x03d5('0x113')));}}};Dialer[_0x03d5('0x1f')][_0x03d5('0x30')]=function(_0x2cf3a2){if(this[_0x03d5('0x23')][_0x2cf3a2['queue']]){if(this['uniqueId'][_0x2cf3a2[_0x03d5('0xe1')]]&&this[_0x03d5('0x2a')][_0x2cf3a2[_0x03d5('0xe1')]][_0x03d5('0x4e')]!=='ivr'){this['updateOriginated'](this[_0x03d5('0x23')][_0x2cf3a2[_0x03d5('0xb5')]]);this['uniqueId'][_0x2cf3a2[_0x03d5('0xe1')]][_0x03d5('0x114')]=moment()[_0x03d5('0x92')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x03d5('0x1f')][_0x03d5('0x115')]=function(_0x1339c2){this['createHistory'](_0x1339c2)['catch'](loggerCatch(_0x03d5('0x116')));this[_0x03d5('0xcc')](_0x1339c2)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x117')));};Dialer['prototype'][_0x03d5('0x33')]=function(_0x5b8364){var _0xb47f5d=this['uniqueId'][_0x5b8364['uniqueid']];var _0x2f43ed=this;if(this['voiceQueues'][_0x5b8364['queue']]){if(_0xb47f5d&&_0xb47f5d[_0x03d5('0x4e')]!==_0x03d5('0xb4')){delete this[_0x03d5('0x2a')][_0x5b8364[_0x03d5('0xe1')]];this[_0x03d5('0xb7')](this[_0x03d5('0x23')][_0x5b8364[_0x03d5('0xb5')]]);_0xb47f5d[_0x03d5('0x118')]=moment()[_0x03d5('0x92')](_0x03d5('0x100'));var _0x29de6a=new QueueCallerAbandon(_0xb47f5d,_0x5b8364);if(getSeconds(_0xb47f5d[_0x03d5('0x118')],_0xb47f5d[_0x03d5('0x119')])>=_0xb47f5d['dialQueueTimeout']){this[_0x03d5('0x23')][_0x5b8364[_0x03d5('0xb5')]][_0x03d5('0x6d')]+=0x1;this['voiceQueues'][_0x5b8364[_0x03d5('0xb5')]][_0x03d5('0x65')]+=0x1;this[_0x03d5('0x23')][_0x5b8364[_0x03d5('0xb5')]][_0x03d5('0x6f')]+=0x1;_0x29de6a[_0x03d5('0xa6')]=0xa;_0x29de6a['statedesc']='Drop';_0x29de6a[_0x03d5('0x11a')]=_0x03d5('0x11b');_0x29de6a[_0x03d5('0x110')]=this[_0x03d5('0x23')][_0x5b8364[_0x03d5('0xb5')]][_0x03d5('0x111')]?moment()[_0x03d5('0x92')](_0x03d5('0x100')):undefined;_0x29de6a[_0x03d5('0xf4')]+=0x1;_0x29de6a[_0x03d5('0xf0')]+=0x1;if(_0x29de6a[_0x03d5('0xf4')]>=this[_0x03d5('0x23')][_0x5b8364[_0x03d5('0xb5')]]['dialDropMaxRetry']){this[_0x03d5('0x115')](_0x29de6a);}else{this[_0x03d5('0xc3')]({'active':![],'countdropretry':_0x29de6a[_0x03d5('0xf4')],'scheduledat':moment()[_0x03d5('0x106')](this['voiceQueues'][_0x5b8364[_0x03d5('0xb5')]][_0x03d5('0x11c')],_0x03d5('0xff'))['format'](_0x03d5('0x100')),'ContactId':_0xb47f5d[_0x03d5('0xd7')],'ListId':_0xb47f5d[_0x03d5('0xd8')],'VoiceQueueId':_0xb47f5d[_0x03d5('0xda')]||undefined,'CampaignId':_0xb47f5d[_0x03d5('0x101')]||undefined})[_0x03d5('0xba')](loggerCatch(_0x03d5('0x11d')));var _0x3728f9=new History(_0x29de6a);_0x3728f9[_0x03d5('0xa6')]=0xa;_0x3728f9['statedesc']=_0x03d5('0x11e');_0x3728f9[_0x03d5('0xa8')]=moment()['format'](_0x03d5('0x100'));_0x3728f9[_0x03d5('0xa7')]=_0x3728f9[_0x03d5('0xa8')];_0x3728f9['calleridname']=_0x29de6a['calleridname'];_0x3728f9[_0x03d5('0x11f')]=_0x29de6a[_0x03d5('0x11f')];this['createHistory'](_0x3728f9)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x120')));}}else{this[_0x03d5('0x23')][_0x5b8364['queue']][_0x03d5('0x84')]+=0x1;this[_0x03d5('0x23')][_0x5b8364[_0x03d5('0xb5')]][_0x03d5('0x121')]+=0x1;_0x29de6a[_0x03d5('0xa6')]=0xb;_0x29de6a[_0x03d5('0xed')]='Abandoned';_0x29de6a[_0x03d5('0x11a')]=_0x03d5('0x122');_0x29de6a[_0x03d5('0xf5')]+=0x1;_0x29de6a[_0x03d5('0xf0')]+=0x1;if(_0x29de6a[_0x03d5('0xf5')]>=this[_0x03d5('0x23')][_0x5b8364[_0x03d5('0xb5')]][_0x03d5('0x123')]){this[_0x03d5('0x115')](_0x29de6a);}else{this[_0x03d5('0xc3')]({'active':![],'countabandonedretry':_0x29de6a[_0x03d5('0xf5')],'scheduledat':moment()[_0x03d5('0x106')](this[_0x03d5('0x23')][_0x5b8364[_0x03d5('0xb5')]]['dialAbandonedRetryFrequency'],_0x03d5('0xff'))[_0x03d5('0x92')](_0x03d5('0x100')),'ContactId':_0xb47f5d['ContactId'],'ListId':_0xb47f5d[_0x03d5('0xd8')],'VoiceQueueId':_0xb47f5d[_0x03d5('0xda')]||undefined,'CampaignId':_0xb47f5d[_0x03d5('0x101')]||undefined})[_0x03d5('0xba')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x3728f9=new History(_0x29de6a);_0x3728f9[_0x03d5('0xa6')]=0xb;_0x3728f9[_0x03d5('0xed')]=_0x03d5('0x124');_0x3728f9['starttime']=moment()[_0x03d5('0x92')](_0x03d5('0x100'));_0x3728f9[_0x03d5('0xa7')]=_0x3728f9[_0x03d5('0xa8')];_0x3728f9[_0x03d5('0x125')]=_0x29de6a[_0x03d5('0x125')];_0x3728f9[_0x03d5('0x11f')]=_0x29de6a[_0x03d5('0x11f')];this[_0x03d5('0xce')](_0x3728f9)[_0x03d5('0xba')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x03d5('0x1f')][_0x03d5('0x126')]=function(_0x3ce08f){if(this[_0x03d5('0xab')][_0x3ce08f[_0x03d5('0xe1')]]){this['actions'][_0x3ce08f[_0x03d5('0xe1')]][_0x03d5('0xb2')]=_0x3ce08f[_0x03d5('0xb2')];}if(this['uniqueId'][_0x3ce08f[_0x03d5('0xe1')]]){this[_0x03d5('0x2a')][_0x3ce08f[_0x03d5('0xe1')]]['channel']=_0x3ce08f[_0x03d5('0xb2')];}};Dialer[_0x03d5('0x1f')][_0x03d5('0x127')]=function(_0x4809c0){if(strategy[this[_0x03d5('0x23')][this[_0x03d5('0xab')][_0x4809c0[_0x03d5('0x128')]]['queue']][_0x03d5('0x50')]]===_0x03d5('0x1e')){if(this[_0x03d5('0xab')][_0x4809c0['actionid']]&&_['isNil'](this[_0x03d5('0xab')][_0x4809c0[_0x03d5('0x128')]][_0x03d5('0x129')])&&_0x4809c0[_0x03d5('0xb1')]==='1'&&_0x4809c0[_0x03d5('0x12a')]==='0'){if(this[_0x03d5('0x25')][_0x4809c0[_0x03d5('0x12b')]]){if(!this[_0x03d5('0x25')][_0x4809c0['stateinterface']][_0x03d5('0x129')]){this['agents'][_0x4809c0[_0x03d5('0x12b')]][_0x03d5('0x129')]=!![];this[_0x03d5('0xab')][_0x4809c0['actionid']][_0x03d5('0x129')]=!![];this[_0x03d5('0xab')][_0x4809c0[_0x03d5('0x128')]]['stateinterface']=_0x4809c0['stateinterface'];}}}}else if((strategy[this['voiceQueues'][this[_0x03d5('0xab')][_0x4809c0[_0x03d5('0x128')]][_0x03d5('0xb5')]][_0x03d5('0x50')]]||_0x03d5('0x1d'))===_0x03d5('0x1d')){if(this[_0x03d5('0xab')][_0x4809c0['actionid']]){if(this['agents'][_0x4809c0[_0x03d5('0x12b')]]){this['actions'][_0x4809c0[_0x03d5('0x128')]][_0x03d5('0x12b')]=_0x4809c0[_0x03d5('0x12b')];if(_['isNil'](this['queueBooked'][this[_0x03d5('0xab')][_0x4809c0[_0x03d5('0x128')]][_0x03d5('0xb5')]])){this['queueBooked'][this[_0x03d5('0xab')][_0x4809c0['actionid']][_0x03d5('0xb5')]]=[];}this['queueBooked'][this[_0x03d5('0xab')][_0x4809c0['actionid']][_0x03d5('0xb5')]]['push'](_[_0x03d5('0xd5')](_['pick'](this[_0x03d5('0xab')][_0x4809c0[_0x03d5('0x128')]],[_0x03d5('0x12c'),_0x03d5('0x12b')]),{'status':_0x4809c0[_0x03d5('0xb1')],'paused':_0x4809c0[_0x03d5('0x12a')]}));}}}};function unlockQueueStatus(_0x118bf3,_0x2b7e6d){setTimeout(function(){if(_['isUndefined'](_0x118bf3[_0x03d5('0x12d')])){loggerBooked[_0x03d5('0x95')](_0x03d5('0x12e'),_0x2b7e6d);}_0x118bf3[_0x03d5('0x12d')]=!![];loggerBooked['info'](_0x03d5('0x12f'),_0x2b7e6d,JSON[_0x03d5('0x49')](_[_0x03d5('0xd6')](_0x118bf3,['name',_0x03d5('0x12d')])));},0x1f3);}Dialer[_0x03d5('0x1f')][_0x03d5('0x130')]=function(_0x465330){var _0x2e9b8f=this;var _0x4ad82a=_0x2e9b8f['voiceQueues'][_0x2e9b8f[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]]['queue']];if(strategy[this[_0x03d5('0x23')][this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0xb5')]][_0x03d5('0x50')]]===_0x03d5('0x1e')){if(this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]]&&this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0x12b')]){this[_0x03d5('0x22')]['run'](this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0x12c')],this[_0x03d5('0xab')][_0x465330['actionid']][_0x03d5('0x12b')])['catch'](function(_0xa0df13){logger[_0x03d5('0x95')](_0x03d5('0x131'),util[_0x03d5('0x96')](_0xa0df13,{'showHidden':![],'depth':null}));})[_0x03d5('0x21')](function(){_0x2e9b8f['updateOriginated'](_0x2e9b8f[_0x03d5('0x23')][_0x2e9b8f[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]]['queue']]);_0x2e9b8f[_0x03d5('0x25')][_0x2e9b8f[_0x03d5('0xab')][_0x465330['actionid']][_0x03d5('0x12b')]]['locked']=![];delete _0x2e9b8f['actions'][_0x465330[_0x03d5('0x128')]];unlockQueueStatus(_0x4ad82a);});}else{this[_0x03d5('0xb7')](this[_0x03d5('0x23')][this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0xb5')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x465330[_0x03d5('0x128')]]['ContactId'],'ListId':this['actions'][_0x465330[_0x03d5('0x128')]][_0x03d5('0xd8')],'VoiceQueueId':this['actions'][_0x465330[_0x03d5('0x128')]][_0x03d5('0xda')]||undefined,'CampaignId':this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0x101')]||undefined})[_0x03d5('0xba')](loggerCatch(_0x03d5('0x132')));delete this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]];unlockQueueStatus(_0x4ad82a);}}else if((strategy[this['voiceQueues'][this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0xb5')]][_0x03d5('0x50')]]||_0x03d5('0x1d'))===_0x03d5('0x1d')){var _0x3fb2f6;if(this['actions'][_0x465330[_0x03d5('0x128')]]&&!_['isEmpty'](this[_0x03d5('0x2e')][this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0xb5')]])){if(this['queueBookedRR'][_0x2e9b8f[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0xb5')]]){this['queueBookedRR'][_0x2e9b8f[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0xb5')]]=this[_0x03d5('0x133')][this[_0x03d5('0xab')][_0x465330['actionid']][_0x03d5('0xb5')]]?this['queueBookedRR'][this['actions'][_0x465330[_0x03d5('0x128')]][_0x03d5('0xb5')]]:this[_0x03d5('0x2e')][this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0xb5')]]?this['queueBooked'][this[_0x03d5('0xab')][_0x465330['actionid']]['queue']][_0x03d5('0x134')]||0x0:0x0;}this[_0x03d5('0x2e')][this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0xb5')]][_0x03d5('0x134')]=this['queueBookedRR'][this[_0x03d5('0xab')][_0x465330['actionid']][_0x03d5('0xb5')]];for(var _0x461d6e=0x0;_0x461d6e=0x0;})['catch'](myreject(_0xc15904)));}}else{_0x5bae7d['push'](ami[_0x03d5('0xb0')]({'action':_0x03d5('0x14e'),'command':util[_0x03d5('0x92')](_0x03d5('0x14f'),_0x3952cc,!_[_0x03d5('0x3e')](config['timezones'][_0x3b3f00])?_0x3b3f00:'')})['then'](function(_0x3bc47b){return _0x3bc47b[_0x03d5('0x151')][_0x03d5('0x152')](_0x03d5('0x153'))>=0x0;})['catch'](myreject(_0xc15904)));}BPromise[_0x03d5('0x154')](_0x5bae7d)['then'](function(_0x503dc5){var _0x33a688=_['some'](_0x503dc5);if(_0x33a688){return _0x437527(_0x33a688);}else{_0x4d9894[_0x03d5('0x40')]=_0x1b9a31?_0x03d5('0x155'):_0x03d5('0x156');return _0xc15904(msgResponse(_0x03d5('0x157'),_0x03d5('0x145'),'Global:\x20'+_0x1b9a31+'\x20'+_0x25b357+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x3952cc,{'showHidden':![],'depth':null})+_0x03d5('0x158')+_0x3b3f00));}})['catch'](function(_0x2d946b){return _0xc15904(msgResponse(_0x03d5('0x144'),_0x03d5('0x145'),JSON[_0x03d5('0x49')](_0x2d946b)));});});};Dialer[_0x03d5('0x1f')]['checkDialMethod']=function(_0x491e4c){var _0x212866=this;return function(){switch(_0x491e4c['dialMethod']){case _0x03d5('0x159'):freeVariablesPredictive(_0x491e4c);_0x212866['handlePower'](_0x491e4c,0x1);break;case'power':freeVariablesPredictive(_0x491e4c);_0x212866[_0x03d5('0x15a')](_0x491e4c,_0x491e4c[_0x03d5('0x15b')]);break;case'predictive':_0x212866[_0x03d5('0xa')](_0x491e4c);break;case _0x03d5('0x9'):freeVariablesPredictive(_0x491e4c);_0x212866[_0x03d5('0x15a')](_0x491e4c,0x1);break;default:freeVariablesPredictive(_0x491e4c);logger[_0x03d5('0x95')](_0x03d5('0x15c'),_0x491e4c[_0x03d5('0x43')],_0x03d5('0x15d'));}};};Dialer[_0x03d5('0x1f')][_0x03d5('0x15e')]=function(_0x2abe58){var _0x175eb4=this;return function(){_0x175eb4[_0x03d5('0x15f')](_0x2abe58);};};Dialer[_0x03d5('0x1f')]['syncQueueSummary']=function(_0x455024){var _0x397a44=this;if(isNotPreview(_0x455024[_0x03d5('0x5b')])){if(isVoiceQueueOutbound(_0x455024[_0x03d5('0x4e')])&&isActive(_0x455024[_0x03d5('0x5a')])){_0x455024['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0x03d5('0xbd')](checkIsLoggedIn(_0x455024,_0x455024[_0x03d5('0x53')]))[_0x03d5('0xbd')](checkIsActive(_0x455024,_0x455024['dialActive']))[_0x03d5('0xbd')](checkInterval(_0x455024))[_0x03d5('0xbd')](_0x397a44[_0x03d5('0x140')](_0x455024))[_0x03d5('0xbd')](_0x397a44[_0x03d5('0x143')](_0x455024[_0x03d5('0x160')],_0x455024[_0x03d5('0x161')],_0x455024[_0x03d5('0x43')],_0x455024))['then'](_0x397a44[_0x03d5('0x162')](_0x455024[_0x03d5('0x45')],_0x455024['dialTimezone'],_0x455024['name'],_0x455024))[_0x03d5('0xbd')](_0x397a44[_0x03d5('0x163')](_0x455024))[_0x03d5('0xba')](loggerCatchQueueSummary('[syncQueueSummary]',_0x455024));}else{notSendMessagesQueue(_0x455024);}}else{freeVariablesPredictive(_0x455024);}};Dialer[_0x03d5('0x1f')][_0x03d5('0x13f')]=function(){var _0x574ab5=this;var _0x500ca0;for(var _0x28e977 in this['campaigns']){if(typeof this[_0x03d5('0x24')][_0x28e977]!==_0x03d5('0x98')){_0x500ca0=this[_0x03d5('0x24')][_0x28e977];if(isCampaignIvr(_0x500ca0['type'])&&isActive(_0x500ca0[_0x03d5('0x79')])){_0x500ca0[_0x03d5('0xa0')]=!![];BPromise[_0x03d5('0xbc')]()[_0x03d5('0xbd')](checkIsActive(_0x500ca0,_0x500ca0['active']))['then'](checkInterval(_0x500ca0))[_0x03d5('0xbd')](_0x574ab5[_0x03d5('0x140')](_0x500ca0))[_0x03d5('0xbd')](_0x574ab5[_0x03d5('0x143')](_0x500ca0[_0x03d5('0x160')],_0x500ca0['dialTimezone'],_0x500ca0[_0x03d5('0x43')],_0x500ca0))['then'](_0x574ab5['checkIfTimeIntervals'](_0x500ca0[_0x03d5('0x45')],_0x500ca0[_0x03d5('0x161')],_0x500ca0['name'],_0x500ca0))[_0x03d5('0xbd')](_0x574ab5[_0x03d5('0x15e')](_0x500ca0))[_0x03d5('0xba')](loggerCatchQueueSummary('[syncCampaigns]',_0x500ca0));}else{notSendMessagesCampaign(_0x500ca0);}}}};function getCallerIdRandom(_0x419065,_0x4b887f){var _0x2e57ce;var _0x1d918a;var _0x49bef3;if(_0x4b887f<=0x0){_0x4b887f=0x1;}_0x2e57ce=new RegExp(_0x03d5('0x164')+_0x4b887f+'}$');_0x1d918a=Math[_0x03d5('0x165')](0xa,_0x4b887f-0x1);_0x49bef3=Math['pow'](0xa,_0x4b887f)-0x1;return util[_0x03d5('0x92')]('%s',_[_0x03d5('0x166')](_0x419065,_0x2e57ce,_[_0x03d5('0x167')](_0x1d918a,_0x49bef3)));}function extractCalleridName(_0x1f030f){var _0x5c88b9=_0x1f030f[_0x03d5('0x168')](/"(.*?)"/);return _0x5c88b9?_0x5c88b9[0x1]:_0x1f030f;}function extractCalleridNumber(_0x36132c){var _0x1408ef=_0x36132c[_0x03d5('0x168')](/<(.*?)>/);return _0x1408ef?_0x1408ef[0x1]:_0x36132c;}Dialer[_0x03d5('0x1f')][_0x03d5('0x169')]=function(_0x5a89fc,_0xddecc7){var _0x4d2b86=this;var _0x7f19fd=uuid['v4']();this[_0x03d5('0xab')][_0x7f19fd]=new Action(_0x5a89fc,_0xddecc7,_0x7f19fd);return new BPromise(function(_0x588b9a,_0x59b0cf){if(_[_0x03d5('0x3e')](_0x5a89fc)&&typeof _0x5a89fc!==_0x03d5('0x16a')){return _0x59b0cf(msgResponse(_0x03d5('0x16b'),_0x03d5('0x145'),_0x03d5('0x16c')));}if(_[_0x03d5('0x3e')](_0xddecc7[_0x03d5('0x16d')][_0x03d5('0x16e')])||_0xddecc7[_0x03d5('0x16d')]['phone']===null){return _0x59b0cf(msgResponse(_0x03d5('0x16b'),'Failure','contact\x20is\x20undefine'));}var _0x30611d={'XMD-CALLERID':_0x4d2b86[_0x03d5('0xab')][_0x7f19fd][_0x03d5('0x16f')](),'XMD-AGI':_0x5a89fc['dialQueueProject']?util[_0x03d5('0x92')](_0x03d5('0x170'),ipAgi,_0x5a89fc['dialQueueProject']):_0x03d5('0x171'),'XMD-AGIAFTER':_0x5a89fc[_0x03d5('0x111')]?util['format'](_0x03d5('0x170'),ipAgi,_0x5a89fc[_0x03d5('0x111')]):_0x03d5('0x171'),'XMD-QUEUE':_0x5a89fc[_0x03d5('0x4e')]===_0x03d5('0x4f')?util['format'](_0x03d5('0x172'),_0x5a89fc[_0x03d5('0x43')],_0x5a89fc[_0x03d5('0x173')]||'',_0x5a89fc['dialAgiAfterHangupAgent']?'c':'',_0x5a89fc['dialQueueTimeout']||0x3):_0x03d5('0x171'),'XMD-CONTACTID':_0xddecc7[_0x03d5('0xd7')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4d2b86['actions'][_0x7f19fd][_0x03d5('0x16f')](),'XMD-AMD':_0x5a89fc[_0x03d5('0xe6')]?'ACTIVE':_0x03d5('0x171'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x5a89fc[_0x03d5('0xe6')]){_0x30611d[_0x03d5('0x174')]=_0x5a89fc['dialAMDInitialSilence']||0x9c4;_0x30611d[_0x03d5('0x175')]=_0x5a89fc['dialAMDGreeting']||0x5dc;_0x30611d[_0x03d5('0x176')]=_0x5a89fc[_0x03d5('0x177')]||0x320;_0x30611d['XMD-AMDTOTALANALYSISTIME']=_0x5a89fc[_0x03d5('0x178')]||0x1388;_0x30611d[_0x03d5('0x179')]=_0x5a89fc[_0x03d5('0x17a')]||0x64;_0x30611d[_0x03d5('0x17b')]=_0x5a89fc[_0x03d5('0x17c')]||0x32;_0x30611d[_0x03d5('0x17d')]=_0x5a89fc['dialAMDMaximumNumberOfWords']||0x3;_0x30611d[_0x03d5('0x17e')]=_0x5a89fc[_0x03d5('0x17f')]||0x100;_0x30611d['XMD-AMDMAXIMUMWORDLENGTH']=_0x5a89fc[_0x03d5('0x180')]||0x1388;}if(_0x5a89fc[_0x03d5('0x4e')]===_0x03d5('0x4f')){_0x30611d[_0x03d5('0x181')]=_0xddecc7[_0x03d5('0xda')];}else{_0x30611d[_0x03d5('0x182')]=_0xddecc7[_0x03d5('0x101')];}for(var _0x12bc05 in _0xddecc7[_0x03d5('0x16d')]){if(typeof _0xddecc7[_0x03d5('0x16d')][_0x12bc05]!=='undefined'){if(isNotNull(_0xddecc7['Contact'][_0x12bc05])&&_0x12bc05!=='id'&&_0x12bc05!==_0x03d5('0x183')&&_0x12bc05!==_0x03d5('0x184')&&_0x12bc05!=='updatedAt'){_0x30611d[util[_0x03d5('0x92')](_0x03d5('0x185'),_0x03d5('0x186'),_[_0x03d5('0x187')](_0x12bc05))]=_0xddecc7['Contact'][_0x12bc05];}}}var _0x4589a6=_0x4d2b86[_0x03d5('0xde')](_0x5a89fc[_0x03d5('0x78')])?getCallerId(_0x5a89fc['Trunk']['callerid'],_0x5a89fc[_0x03d5('0x5c')],_0x5a89fc[_0x03d5('0x188')]>0x0?getCallerIdRandom(_0x5a89fc[_0x03d5('0x5d')],_0x5a89fc[_0x03d5('0x188')]):_0x5a89fc[_0x03d5('0x5d')]):getCallerId(_[_0x03d5('0xaf')](_0x5a89fc[_0x03d5('0x141')])?_0x5a89fc[_0x03d5('0x78')][_0x03d5('0x189')]:_0x5a89fc[_0x03d5('0x141')]['callerid'],_0x5a89fc[_0x03d5('0x5c')],_0x5a89fc[_0x03d5('0x188')]>0x0?getCallerIdRandom(_0x5a89fc[_0x03d5('0x5d')],_0x5a89fc[_0x03d5('0x188')]):_0x5a89fc[_0x03d5('0x5d')]);if(_0x4589a6){_0x30611d[_0x03d5('0x18a')]=_0x4d2b86['actions'][_0x7f19fd][_0x03d5('0x18b')]=extractCalleridName(_0x4589a6);_0x30611d[_0x03d5('0x18c')]=_0x4d2b86[_0x03d5('0xab')][_0x7f19fd][_0x03d5('0x18d')]=extractCalleridNumber(_0x4589a6);}return ami[_0x03d5('0xb0')]({'actionid':_0x7f19fd,'action':_0x03d5('0x16b'),'channel':_0x4d2b86['isTrunkReachable'](_0x5a89fc[_0x03d5('0x78')])?util[_0x03d5('0x92')](_0x03d5('0x18e'),_0x5a89fc[_0x03d5('0x78')][_0x03d5('0x43')],isNotNull(_0x5a89fc['dialPrefix'])?_0x5a89fc[_0x03d5('0x5f')][_0x03d5('0x18f')]()||'':'',_0x5a89fc[_0x03d5('0x190')]>0x0?_0xddecc7[_0x03d5('0x16d')][_0x03d5('0x16e')][_0x03d5('0x191')](_0x5a89fc['dialCutDigit']):_0xddecc7[_0x03d5('0x16d')][_0x03d5('0x16e')]):util[_0x03d5('0x92')]('SIP/%s/%s%s',_[_0x03d5('0xaf')](_0x5a89fc[_0x03d5('0x141')])?_0x5a89fc[_0x03d5('0x78')]['name']:_0x5a89fc[_0x03d5('0x141')][_0x03d5('0x43')],isNotNull(_0x5a89fc[_0x03d5('0x5f')])?_0x5a89fc[_0x03d5('0x5f')][_0x03d5('0x18f')]()||'':'',_0x5a89fc[_0x03d5('0x190')]>0x0?_0xddecc7['Contact']['phone'][_0x03d5('0x191')](_0x5a89fc[_0x03d5('0x190')]):_0xddecc7[_0x03d5('0x16d')]['phone']),'callerid':_0x4589a6,'Exten':_0x03d5('0xe5'),'Context':_0x03d5('0x192'),'Priority':'1','variable':_0x30611d,'timeout':(_0x5a89fc['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x7f19fd})[_0x03d5('0xbd')](function(_0x312d5f){return _0x588b9a(_0x312d5f);})['catch'](function(_0x5983af){_0x5a89fc['outboundOriginateFailureCallsDay']+=0x1;var _0x14fc1f=new History(_0x4d2b86['actions'][_0x7f19fd]);logger[_0x03d5('0x95')](util[_0x03d5('0x92')](_0x03d5('0x193'),JSON[_0x03d5('0x49')](_0x5983af)));_0x14fc1f['state']=0xe;_0x14fc1f[_0x03d5('0xed')]='OriginateError';_0x14fc1f[_0x03d5('0xa8')]=moment()['format'](_0x03d5('0x100'));_0x14fc1f['endtime']=_0x14fc1f[_0x03d5('0xa8')];_0x4d2b86[_0x03d5('0xce')](_0x14fc1f)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x194')));_0x4d2b86[_0x03d5('0xcc')](_0x14fc1f)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x194')))['finally'](function(){delete _0x4d2b86[_0x03d5('0xab')][_0x7f19fd];return _0x59b0cf(msgResponse('originate','Error',_0x03d5('0x195')));});});});};Dialer[_0x03d5('0x1f')]['syncOriginateResponse']=function(_0x1f1bc8){var _0x48f1d6=this[_0x03d5('0xab')][_0x1f1bc8[_0x03d5('0x128')]];if(_0x48f1d6){delete this[_0x03d5('0xab')][_0x1f1bc8[_0x03d5('0x128')]];_0x48f1d6[_0x03d5('0x119')]=moment()['format'](_0x03d5('0x100'));var _0x22ffdc=_0x48f1d6[_0x03d5('0x4e')]==='ivr'?this[_0x03d5('0x24')][_0x48f1d6[_0x03d5('0xb5')]]:this['voiceQueues'][_0x48f1d6[_0x03d5('0x196')]()];if(!this[_0x03d5('0x197')](_0x1f1bc8['response'])){this['updateOriginated'](_0x22ffdc);return this[_0x03d5('0x198')](_0x48f1d6,_0x22ffdc,_0x1f1bc8)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x199')));}this['uniqueId'][_0x1f1bc8[_0x03d5('0xe1')]]=_0x48f1d6;}};Dialer['prototype']['checkRetriveMax']=function(_0x4bcdf3,_0x12c713,_0x1433f0){var _0x149b1d=new History(_0x12c713);if(_0x149b1d[_0x03d5('0x19a')]+_0x149b1d[_0x03d5('0x105')]+_0x149b1d[_0x03d5('0xf2')]+_0x149b1d[_0x03d5('0xf3')]+_0x149b1d[_0x03d5('0xf4')]+_0x149b1d['countabandonedretry']+_0x149b1d['countmachineretry']+_0x149b1d['countagentrejectretry']>=_0x1433f0[_0x03d5('0xf7')]-0x1){return!![];}switch(_0x4bcdf3){case 0x3:if(_0x149b1d[_0x03d5('0xf2')]>=_0x1433f0['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x03d5('0xc3')]({'active':![],'countnoanswerretry':_0x149b1d['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x1433f0[_0x03d5('0x19b')],_0x03d5('0xff'))[_0x03d5('0x92')](_0x03d5('0x100')),'ContactId':_0x149b1d[_0x03d5('0xd7')],'ListId':_0x149b1d[_0x03d5('0xd8')],'VoiceQueueId':_0x149b1d['VoiceQueueId']||undefined,'CampaignId':_0x149b1d[_0x03d5('0x101')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x149b1d[_0x03d5('0x19a')]>=_0x1433f0[_0x03d5('0x19c')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x149b1d[_0x03d5('0x19a')]+=0x1,'scheduledat':moment()[_0x03d5('0x106')](_0x1433f0[_0x03d5('0x19d')],'minutes')[_0x03d5('0x92')](_0x03d5('0x100')),'ContactId':_0x149b1d['ContactId'],'ListId':_0x149b1d['ListId'],'VoiceQueueId':_0x149b1d[_0x03d5('0xda')]||undefined,'CampaignId':_0x149b1d[_0x03d5('0x101')]||undefined})[_0x03d5('0xba')](loggerCatch(_0x03d5('0x19e')));break;case 0x8:if(_0x149b1d[_0x03d5('0x105')]>=_0x1433f0[_0x03d5('0x19f')]-0x1){return!![];}this[_0x03d5('0xc3')]({'active':![],'countcongestionretry':_0x149b1d[_0x03d5('0x105')]+=0x1,'scheduledat':moment()[_0x03d5('0x106')](_0x1433f0['dialCongestionRetryFrequency'],_0x03d5('0xff'))['format'](_0x03d5('0x100')),'ContactId':_0x149b1d[_0x03d5('0xd7')],'ListId':_0x149b1d[_0x03d5('0xd8')],'VoiceQueueId':_0x149b1d[_0x03d5('0xda')]||undefined,'CampaignId':_0x149b1d['CampaignId']||undefined})['catch'](loggerCatch(_0x03d5('0x1a0')));break;case 0x0:if(_0x149b1d['countnosuchnumberretry']>=_0x1433f0['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x03d5('0xc3')]({'active':![],'countnosuchnumberretry':_0x149b1d['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x03d5('0x106')](_0x1433f0[_0x03d5('0x1a1')],_0x03d5('0xff'))['format'](_0x03d5('0x100')),'ContactId':_0x149b1d['ContactId'],'ListId':_0x149b1d[_0x03d5('0xd8')],'VoiceQueueId':_0x149b1d['VoiceQueueId']||undefined,'CampaignId':_0x149b1d[_0x03d5('0x101')]||undefined})[_0x03d5('0xba')](loggerCatch(_0x03d5('0x1a2')));}break;case 0xa:if(_0x149b1d[_0x03d5('0xf4')]>=_0x1433f0[_0x03d5('0x1a3')]-0x1){return!![];}this[_0x03d5('0xc3')]({'active':![],'countdropretry':_0x149b1d[_0x03d5('0xf4')]+=0x1,'scheduledat':moment()['add'](_0x1433f0[_0x03d5('0x11c')],_0x03d5('0xff'))[_0x03d5('0x92')](_0x03d5('0x100')),'ContactId':_0x149b1d[_0x03d5('0xd7')],'ListId':_0x149b1d[_0x03d5('0xd8')],'VoiceQueueId':_0x149b1d['VoiceQueueId']||undefined,'CampaignId':_0x149b1d[_0x03d5('0x101')]||undefined})[_0x03d5('0xba')](loggerCatch(_0x03d5('0x11d')));break;case 0xb:if(_0x149b1d[_0x03d5('0xf5')]>=_0x1433f0['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x03d5('0xc3')]({'active':![],'countabandonedretry':_0x149b1d[_0x03d5('0xf5')]+=0x1,'scheduledat':moment()[_0x03d5('0x106')](_0x1433f0['dialAbandonedRetryFrequency'],'minutes')[_0x03d5('0x92')](_0x03d5('0x100')),'ContactId':_0x149b1d[_0x03d5('0xd7')],'ListId':_0x149b1d[_0x03d5('0xd8')],'VoiceQueueId':_0x149b1d[_0x03d5('0xda')]||undefined,'CampaignId':_0x149b1d[_0x03d5('0x101')]||undefined})[_0x03d5('0xba')](loggerCatch(_0x03d5('0x1a4')));break;case 0x13:if(_0x149b1d[_0x03d5('0xfa')]>=_0x1433f0['dialMachineMaxRetry']-0x1){return!![];}this[_0x03d5('0xc3')]({'active':![],'countmachineretry':_0x149b1d[_0x03d5('0xfa')]+=0x1,'scheduledat':moment()[_0x03d5('0x106')](_0x1433f0['dialMachineRetryFrequency'],'minutes')[_0x03d5('0x92')](_0x03d5('0x100')),'ContactId':_0x149b1d[_0x03d5('0xd7')],'ListId':_0x149b1d[_0x03d5('0xd8')],'VoiceQueueId':_0x149b1d['VoiceQueueId']||undefined,'CampaignId':_0x149b1d[_0x03d5('0x101')]||undefined})[_0x03d5('0xba')](loggerCatch(_0x03d5('0x102')));break;case 0x14:if(_0x149b1d[_0x03d5('0xf6')]>=_0x1433f0[_0x03d5('0x1a5')]-0x1){return!![];}this[_0x03d5('0xc3')]({'active':![],'countagentrejectretry':_0x149b1d['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x03d5('0x106')](_0x1433f0['dialAgentRejectRetryFrequency'],_0x03d5('0xff'))[_0x03d5('0x92')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x149b1d[_0x03d5('0xd7')],'ListId':_0x149b1d[_0x03d5('0xd8')],'VoiceQueueId':_0x149b1d[_0x03d5('0xda')]||undefined,'CampaignId':_0x149b1d[_0x03d5('0x101')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x03d5('0x1f')][_0x03d5('0x198')]=function(_0x110b43,_0xbd4acf,_0xc69aaa){var _0x7c556f=this;var _0x520f19=new History(_0x110b43);return new BPromise(function(_0x18efbd,_0x562a78){if(_[_0x03d5('0x3e')](_0xbd4acf)&&typeof _0xbd4acf!==_0x03d5('0x16a')){return _0x562a78(msgResponse(_0x03d5('0x1a6'),'Failure',_0x03d5('0x1a7')));}if(_[_0x03d5('0x3e')](_0xc69aaa)&&typeof _0xc69aaa!==_0x03d5('0x16a')){return _0x562a78(msgResponse(_0x03d5('0x1a6'),_0x03d5('0x145'),_0x03d5('0x1a8')));}switch(_0xc69aaa[_0x03d5('0x10e')]){case'0':_0xbd4acf['outboundNoSuchCallsDay']+=0x1;_0x520f19[_0x03d5('0xa6')]=0x0;_0x520f19[_0x03d5('0xed')]=_0x03d5('0x1a9');_0x520f19[_0x03d5('0xf3')]+=0x1;_0x520f19['countglobal']+=0x1;ami[_0x03d5('0x4d')]('custom:agentnosuchnumber',ut[_0x03d5('0x1aa')](_0x110b43,_0x03d5('0x1ab')));_0x7c556f[_0x03d5('0xce')](_0x520f19)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x104')));if(_0x7c556f[_0x03d5('0x1ac')](0x0,_0x110b43,_0xbd4acf)){if(_0x520f19[_0x03d5('0xf3')]>=_0xbd4acf[_0x03d5('0x1ad')]){_0x7c556f[_0x03d5('0xfc')](_0x520f19,_0x18efbd,_0x562a78,_0x03d5('0x1ae'));}else{_0x7c556f[_0x03d5('0xf8')](_0x520f19,_0x18efbd,_0x562a78,_0x03d5('0x1ae'));}}break;case'3':_0xbd4acf[_0x03d5('0x1af')]+=0x1;_0x520f19['state']=0x3;_0x520f19[_0x03d5('0xed')]=_0x03d5('0x1b0');_0x520f19[_0x03d5('0xf2')]+=0x1;_0x520f19['countglobal']+=0x1;ami[_0x03d5('0x4d')](_0x03d5('0x1b1'),ut[_0x03d5('0x1aa')](_0x110b43,_0x03d5('0x1b2')));_0x7c556f['createHistory'](_0x520f19)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x1b3')));if(_0x7c556f[_0x03d5('0x1ac')](0x3,_0x110b43,_0xbd4acf)){if(_0x520f19[_0x03d5('0xf2')]>=_0xbd4acf[_0x03d5('0x1b4')]){_0x7c556f['createStateFinal'](_0x520f19,_0x18efbd,_0x562a78,'reason\x203\x20ringing\x20no\x20answer');}else{_0x7c556f['stateGlobal'](_0x520f19,_0x18efbd,_0x562a78,_0x03d5('0x1b5'));}}break;case'5':_0xbd4acf[_0x03d5('0x1b6')]+=0x1;_0x520f19[_0x03d5('0xa6')]=0x5;_0x520f19[_0x03d5('0xed')]=_0x03d5('0x1b7');_0x520f19[_0x03d5('0x19a')]+=0x1;_0x520f19[_0x03d5('0xf0')]+=0x1;ami[_0x03d5('0x4d')](_0x03d5('0x1b8'),ut['buildObj'](_0x110b43,_0x03d5('0x1b9')));_0x7c556f['createHistory'](_0x520f19)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x1ba')));if(_0x7c556f[_0x03d5('0x1ac')](0x5,_0x110b43,_0xbd4acf)){if(_0x520f19[_0x03d5('0x19a')]>=_0xbd4acf['dialBusyMaxRetry']){_0x7c556f[_0x03d5('0xfc')](_0x520f19,_0x18efbd,_0x562a78,_0x03d5('0x1bb'));}else{_0x7c556f[_0x03d5('0xf8')](_0x520f19,_0x18efbd,_0x562a78,_0x03d5('0x1bb'));}}break;case'8':_0xbd4acf[_0x03d5('0x63')]+=0x1;_0x520f19[_0x03d5('0xa6')]=0x8;_0x520f19['statedesc']=_0x03d5('0x1bc');_0x520f19[_0x03d5('0x105')]+=0x1;_0x520f19[_0x03d5('0xf0')]+=0x1;ami['emit'](_0x03d5('0x1bd'),ut[_0x03d5('0x1aa')](_0x110b43,'congestion'));_0x7c556f['createHistory'](_0x520f19)[_0x03d5('0xba')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x7c556f[_0x03d5('0x1ac')](0x8,_0x110b43,_0xbd4acf)){if(_0x520f19[_0x03d5('0x105')]>=_0xbd4acf['dialCongestionMaxRetry']){_0x7c556f[_0x03d5('0xfc')](_0x520f19,_0x18efbd,_0x562a78,'reason\x208\x20congestion');}else{_0x7c556f[_0x03d5('0xf8')](_0x520f19,_0x18efbd,_0x562a78,_0x03d5('0x1be'));}}break;case'11':_0xbd4acf[_0x03d5('0x1bf')]+=0x1;_0x520f19[_0x03d5('0xa6')]=0xb;_0x520f19['statedesc']=_0x03d5('0x124');_0x520f19['countabandonedretry']+=0x1;_0x520f19[_0x03d5('0xf0')]+=0x1;_0x7c556f[_0x03d5('0xce')](_0x520f19)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x1c0')));if(_0x7c556f[_0x03d5('0x1ac')](0xb,_0x110b43,_0xbd4acf)){if(_0x520f19[_0x03d5('0xf5')]>=_0xbd4acf[_0x03d5('0x123')]){_0x7c556f[_0x03d5('0xfc')](_0x520f19,_0x18efbd,_0x562a78,'reason\x2011\x20abandoned');}else{_0x7c556f[_0x03d5('0xf8')](_0x520f19,_0x18efbd,_0x562a78,_0x03d5('0x1c1'));}}break;case'20':_0xbd4acf[_0x03d5('0x68')]+=0x1;_0x520f19['state']=0x14;_0x520f19[_0x03d5('0xed')]='AgentReject';_0x520f19['countagentrejectretry']+=0x1;_0x520f19[_0x03d5('0xf0')]+=0x1;ami[_0x03d5('0x4d')](_0x03d5('0x1c2'),ut[_0x03d5('0x1aa')](_0x110b43,_0x03d5('0x1c3')));_0x7c556f[_0x03d5('0xce')](_0x520f19)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x1c4')));if(_0x7c556f[_0x03d5('0x1ac')](0x14,_0x110b43,_0xbd4acf)){if(_0x520f19[_0x03d5('0xf6')]>=_0xbd4acf[_0x03d5('0x1a5')]){_0x7c556f[_0x03d5('0xfc')](_0x520f19,_0x18efbd,_0x562a78,'reason\x2020\x20agentreject');}else{_0x7c556f['stateGlobal'](_0x520f19,_0x18efbd,_0x562a78,_0x03d5('0x1c5'));}}break;default:_0xbd4acf['outboundUnknownCallsDay']+=0x1;_0x520f19[_0x03d5('0xa6')]=0xc;_0x520f19[_0x03d5('0xed')]=_0xc69aaa[_0x03d5('0x10e')];_0x7c556f[_0x03d5('0xce')](_0x520f19)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x1c6')));if(_0x7c556f[_0x03d5('0x1ac')](_0xc69aaa['reason'],_0x110b43,_0xbd4acf)){if(_0x520f19[_0x03d5('0x19a')]+_0x520f19['countcongestionretry']+_0x520f19[_0x03d5('0xf2')]+_0x520f19[_0x03d5('0xf3')]+_0x520f19[_0x03d5('0xf4')]+_0x520f19['countabandonedretry']+_0x520f19[_0x03d5('0xfa')]+_0x520f19[_0x03d5('0xf6')]>=_0xbd4acf[_0x03d5('0xf7')]){_0x7c556f[_0x03d5('0xf8')](_0x520f19,_0x18efbd,_0x562a78,_0xc69aaa[_0x03d5('0x10e')]);}else{_0x7c556f[_0x03d5('0xfc')](_0x520f19,_0x18efbd,_0x562a78,_0xc69aaa[_0x03d5('0x10e')]);}}}});};Dialer[_0x03d5('0x1f')][_0x03d5('0xf8')]=function(_0x5f3481,_0x5f5c5d,_0xa008ed,_0x4ac4a1){var _0xb75f5a=new Final(_0x5f3481);_0xb75f5a[_0x03d5('0xa6')]=0xf;_0xb75f5a['statedesc']='Global';this[_0x03d5('0xfc')](_0xb75f5a,_0x5f5c5d,_0xa008ed,_0x4ac4a1);};Dialer[_0x03d5('0x1f')][_0x03d5('0xfc')]=function(_0x4fe73c,_0x2b69df,_0x49383d,_0x264730){this[_0x03d5('0xcc')](_0x4fe73c)[_0x03d5('0xbd')](function(){return _0x2b69df(msgResponse(_0x03d5('0x1a6'),_0x03d5('0xdd'),_0x264730));})[_0x03d5('0xba')](function(){return _0x49383d(msgResponse(_0x03d5('0x1c7'),_0x03d5('0x145'),_0x03d5('0x1c8')));});};Dialer[_0x03d5('0x1f')][_0x03d5('0xa')]=function(_0x1c67f4){var _0x199889=_0x1c67f4[_0x03d5('0x1c9')]/0x64;var _0x73a53c=_0x1c67f4[_0x03d5('0x65')]/(_0x1c67f4[_0x03d5('0x65')]+_0x1c67f4[_0x03d5('0x61')]);var _0x259163=Math[_0x03d5('0x1ca')](_0x1c67f4[_0x03d5('0x71')]*(_0x1c67f4['predictiveIntervalMaxThreshold']/0x64));var _0x37bc8c=Math[_0x03d5('0x1ca')](_0x1c67f4['predictiveIntervalAvailable']*(_0x1c67f4[_0x03d5('0x1cb')]/0x64));var _0x3dad9b=_0x1c67f4[_0x03d5('0x52')]+_0x1c67f4['talking'];var _0x26331e=Math['floor'](_0x1c67f4[_0x03d5('0x73')]*_0x1c67f4[_0x03d5('0x75')]*_0x1c67f4[_0x03d5('0x1cc')]*_0x1c67f4[_0x03d5('0x1cd')]);if(_[_0x03d5('0x3e')](_0x1c67f4['startProgressive'])){if(!_[_0x03d5('0x3e')](_0x1c67f4[_0x03d5('0x2c')])){_0x1c67f4[_0x03d5('0x2c')]=undefined;loggerPredictive[_0x03d5('0x95')]('[startMethodPredictive][StartProgressive]',_0x03d5('0x1ce'));}if(!_[_0x03d5('0x3e')](_0x1c67f4['handlePredictive'])){loggerPredictive[_0x03d5('0x95')](_0x03d5('0x1cf'),_0x03d5('0x1d0'));clearInterval(_0x1c67f4[_0x03d5('0x8e')]);_0x1c67f4['handlePredictive']=undefined;}_0x1c67f4[_0x03d5('0x77')]=moment()['format'](_0x03d5('0x100'));loggerPredictive['info'](_0x1c67f4[_0x03d5('0x43')],'collection\x20data\x20in\x20progressive\x20at',_0x1c67f4[_0x03d5('0x77')]);this[_0x03d5('0x15a')](_0x1c67f4,0x1);}else if(ifInterval(_0x1c67f4[_0x03d5('0x1d1')],_0x1c67f4[_0x03d5('0x77')])){this[_0x03d5('0x15a')](_0x1c67f4,0x1);loggerPredictiveCalls['info'](_0x03d5('0x1d2'),_0x1c67f4[_0x03d5('0x77')],_0x1c67f4[_0x03d5('0x43')]);_0x1c67f4['erlangCalls']=0x0;_0x1c67f4[_0x03d5('0x6f')]=0x0;}else if(_0x199889<_0x73a53c&&_0x1c67f4[_0x03d5('0x1d3')]===_0x03d5('0x1d4')){freeVariablesPredictive(_0x1c67f4);loggerPredictive['info'](_0x03d5('0x1d5'),'Dropped\x20calls\x20day',_0x73a53c,'startProgressive',_0x1c67f4[_0x03d5('0x43')]);}else if(_0x26331e<_0x1c67f4[_0x03d5('0x6f')]&&_0x1c67f4[_0x03d5('0x1d3')]===_0x03d5('0x1d4')){freeVariablesPredictive(_0x1c67f4);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x1d6'),_0x03d5('0x1d7'),_0x26331e,_0x03d5('0x1d8'),_0x1c67f4[_0x03d5('0x6f')],_0x03d5('0x77'),_0x1c67f4[_0x03d5('0x43')]);}else if(!ifInterval(_0x1c67f4[_0x03d5('0x1d1')],_0x1c67f4[_0x03d5('0x77')])&&_['isUndefined'](_0x1c67f4[_0x03d5('0x2c')])&&!_[_0x03d5('0x3e')](_0x1c67f4[_0x03d5('0x77')])){_0x1c67f4[_0x03d5('0x2c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x03d5('0x7e')](_0x1c67f4[_0x03d5('0x43')],'started\x20in\x20predictive\x20at',_0x1c67f4[_0x03d5('0x2c')]);this[_0x03d5('0xc0')](_0x1c67f4['dialPredictiveInterval'])[_0x03d5('0xbd')](this[_0x03d5('0x1d9')](_0x1c67f4))[_0x03d5('0xbd')](mergeDataErlangB(_0x1c67f4))['then'](this[_0x03d5('0x1da')](_0x1c67f4))[_0x03d5('0xba')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x1c67f4));}else if(!ifInterval(_0x1c67f4[_0x03d5('0x1d1')],_0x1c67f4['startPredictive'])){_0x1c67f4['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x1c67f4[_0x03d5('0x2c')]=moment()[_0x03d5('0x92')](_0x03d5('0x100'));loggerPredictive['info'](_0x1c67f4[_0x03d5('0x43')],'recalculate\x20predictive\x20at',_0x1c67f4[_0x03d5('0x2c')]);clearInterval(_0x1c67f4[_0x03d5('0x8e')]);_0x1c67f4[_0x03d5('0x8e')]=undefined;this[_0x03d5('0xc0')](_0x1c67f4[_0x03d5('0x1d1')])[_0x03d5('0xbd')](this[_0x03d5('0x1d9')](_0x1c67f4))[_0x03d5('0xbd')](mergeDataErlangB(_0x1c67f4))['then'](this['startMethodPredictive'](_0x1c67f4))['catch'](loggerCatchPredictive(_0x03d5('0x1db'),_0x1c67f4));}else if(_0x1c67f4[_0x03d5('0x71')]&&_0x3dad9b<_0x1c67f4[_0x03d5('0x71')]-_0x37bc8c){freeVariablesPredictive(_0x1c67f4);loggerPredictive[_0x03d5('0x7e')](_0x1c67f4[_0x03d5('0x43')],_0x03d5('0x1dc'),_0x3dad9b,_0x03d5('0x1dd'),_0x1c67f4[_0x03d5('0x71')],'-',_0x37bc8c,'=',_0x1c67f4['predictiveIntervalAvailable']-_0x37bc8c,')');}else if(_0x1c67f4[_0x03d5('0x71')]&&_0x3dad9b>_0x1c67f4['predictiveIntervalAvailable']+_0x259163){freeVariablesPredictive(_0x1c67f4);loggerPredictive[_0x03d5('0x7e')](_0x1c67f4['name'],_0x03d5('0x1dc'),_0x3dad9b,')\x20are\x20more\x20than\x20threshold\x20(',_0x1c67f4[_0x03d5('0x71')],'+',_0x259163,'=',_0x1c67f4[_0x03d5('0x71')]+_0x259163,')');}};Dialer[_0x03d5('0x1f')][_0x03d5('0x1d9')]=function(_0x18712e){var _0x31a6fe=this;return function(_0x2b3172){return new BPromise(function(_0x50f6b9,_0x4f3186){_[_0x03d5('0xd5')](_0x18712e,_0x2b3172[0x0]);if(checkGetDataPredictive(_0x2b3172[0x0])){var _0x5c2449=_0x18712e[_0x03d5('0x71')]=_0x18712e['talking']+_0x18712e[_0x03d5('0x52')];var _0x1758c2=_0x18712e[_0x03d5('0x1d1')]*0x3c;var _0x20a959=_0x2b3172[0x0][_0x03d5('0x6c')]+_0x2b3172[0x0]['predictiveIntervalAvgHoldtime'];var _0x1f18ce=(_0x2b3172[0x0][_0x03d5('0x6a')]+_0x2b3172[0x0][_0x03d5('0x6d')]+_0x2b3172[0x0][_0x03d5('0x84')])/_0x2b3172[0x0][_0x03d5('0x80')];_0x18712e[_0x03d5('0x1cc')]=_0x1f18ce>0x0?_0x1f18ce:0x1;switch(_0x18712e[_0x03d5('0x1d3')]){case _0x03d5('0x1d4'):var _0x54838d=_0x18712e['dialPredictiveOptimizationPercentage']/0x64;return _0x31a6fe[_0x03d5('0x1de')](_0x5c2449,_0x1758c2,_0x20a959,_0x1f18ce,_0x54838d)['then'](function(_0x36e0cb){return _0x50f6b9(_0x36e0cb);});case'agentBusyFactor':var _0x5c6fd7=_0x18712e[_0x03d5('0x1c9')]/0x64;return _0x31a6fe[_0x03d5('0x1df')](_0x5c2449,_0x1758c2,_0x20a959,_0x1f18ce,_0x5c6fd7)[_0x03d5('0xbd')](function(_0x3694ce){return _0x50f6b9(_0x3694ce);});default:return _0x4f3186(msgResponse(_0x03d5('0x1e0'),_0x03d5('0x145'),'Unknown\x20Predictive'));}}else{return _0x4f3186(msgResponse(_0x03d5('0x1e0'),_0x03d5('0x145'),_0x03d5('0x1e1')));}});};};Dialer[_0x03d5('0x1f')][_0x03d5('0x1e2')]=function(_0x4b79c9){var _0x2dc52e=this;return function(_0x1bb8d7){return new BPromise(function(_0x43f943,_0x381152){_[_0x03d5('0xd5')](_0x4b79c9,_0x1bb8d7[0x0]);if(checkGetDataPredictive(_0x1bb8d7[0x0])){loggerPredictive[_0x03d5('0x7e')](JSON[_0x03d5('0x49')](_0x1bb8d7[0x0]));if(_0x4b79c9[_0x03d5('0x1d3')]===_0x03d5('0x1d4')){return _0x2dc52e[_0x03d5('0xca')](_0x4b79c9['id'])['then'](function(_0x2ce82e){var _0x57b651=_0x4b79c9[_0x03d5('0x53')]-_0x2ce82e[0x0][_0x03d5('0x1e3')];var _0x521700=_0x4b79c9[_0x03d5('0x1d1')]*0x3c;var _0x257f44=_0x1bb8d7[0x0][_0x03d5('0x6c')]+_0x1bb8d7[0x0][_0x03d5('0x6b')];var _0x4d20c8=(_0x1bb8d7[0x0]['predictiveIntervalAnsweredCalls']+_0x1bb8d7[0x0][_0x03d5('0x6d')]+_0x1bb8d7[0x0][_0x03d5('0x84')])/_0x1bb8d7[0x0]['predictiveIntervalTotalCalls'];var _0x507144=_0x4b79c9[_0x03d5('0x1c9')]/0x64;_0x4b79c9['predictiveIntervalPauses']=_0x2ce82e[0x0][_0x03d5('0x1e3')]||0x0;_0x4b79c9['predictiveIntervalHitRate']=_0x4d20c8>0x0?_0x4d20c8:0x1;return _0x2dc52e[_0x03d5('0x1de')](_0x57b651,_0x521700,_0x257f44,_0x4d20c8,_0x507144);})[_0x03d5('0xbd')](function(_0xfe53e9){return _0x43f943(_0xfe53e9);})[_0x03d5('0xba')](function(_0x17b475){return _0x381152(msgResponse(_0x03d5('0x1e4'),_0x03d5('0x145'),JSON[_0x03d5('0x49')](_0x17b475)));});}if(_0x4b79c9['dialPredictiveOptimization']==='agentBusyFactor'){return _0x2dc52e[_0x03d5('0xca')](_0x4b79c9['id'])[_0x03d5('0xbd')](function(_0x16ec67){var _0x1bef13=_0x4b79c9['loggedIn']-_0x16ec67[0x0][_0x03d5('0x1e3')];var _0x2515e0=_0x4b79c9[_0x03d5('0x1d1')]*0x3c;var _0x1918af=_0x1bb8d7[0x0][_0x03d5('0x6c')]+_0x1bb8d7[0x0][_0x03d5('0x6b')];var _0x2e17ed=(_0x1bb8d7[0x0][_0x03d5('0x6a')]+_0x1bb8d7[0x0][_0x03d5('0x6d')]+_0x1bb8d7[0x0][_0x03d5('0x84')])/_0x1bb8d7[0x0][_0x03d5('0x80')];var _0x10caa9=_0x4b79c9[_0x03d5('0x1c9')]/0x64;_0x4b79c9[_0x03d5('0x70')]=_0x16ec67[0x0][_0x03d5('0x1e3')]||0x0;_0x4b79c9[_0x03d5('0x1cc')]=_0x2e17ed>0x0?_0x2e17ed:0x1;return _0x2dc52e['busyFactor'](_0x1bef13,_0x2515e0,_0x1918af,_0x2e17ed,_0x10caa9);})[_0x03d5('0xbd')](function(_0x949b9a){return _0x43f943(_0x949b9a);})[_0x03d5('0xba')](function(_0x271246){return _0x381152(msgResponse('[CatchErlangB]',_0x03d5('0x145'),JSON['stringify'](_0x271246)));});}}else{return _0x381152(msgResponse(_0x03d5('0x1e0'),'Failure',_0x03d5('0x1e1')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x4945d7){var _0x1d94db=this;return function(){var _0x453df3=0x0;var _0xdf00ba=Math[_0x03d5('0x1e5')](_0x4945d7['erlangCallToSecond']*0x3e8);if(_0xdf00ba>0x0){_0xdf00ba=_0xdf00ba<0x64?0x64:_0xdf00ba;loggerPredictive[_0x03d5('0x7e')](_0x4945d7[_0x03d5('0x43')],'one\x20call\x20every:',_0xdf00ba,_0x03d5('0x4a'));_0x4945d7['handlePredictive']=setInterval(function(){_0x1d94db[_0x03d5('0x8e')](_0x4945d7);loggerPredictiveCalls['info'](_0x03d5('0x1e6'),_0x453df3+=0x1);},_0xdf00ba);}else{loggerPredictive['info'](_0x4945d7[_0x03d5('0x43')],_0x03d5('0x1e7'));}};};Dialer[_0x03d5('0x1f')]['checkContactBlack']=function(_0x118e57,_0x120bd1){var _0x221490=this;return function(_0x34f752){if(_[_0x03d5('0x91')](_0x34f752)){if(_[_0x03d5('0xaf')](_0x120bd1[_0x03d5('0xd9')])||!_0x120bd1['recallme']){if(_0x118e57[_0x03d5('0x5b')]===_0x03d5('0x9')){_0x118e57[_0x03d5('0x12d')]=_['isUndefined'](_0x118e57[_0x03d5('0x12d')])?!![]:_0x118e57[_0x03d5('0x12d')];var _0x4cadde=uuid['v4']();_0x221490['actions'][_0x4cadde]=new Action(_0x118e57,_0x120bd1,_0x4cadde);loggerBooked[_0x03d5('0x7e')]('[booked][checkContactBlack]',_0x4cadde,_0x03d5('0x1e8'),JSON[_0x03d5('0x49')](_0x118e57[_0x03d5('0x12d')]),'Queue:\x20',_0x118e57['name']);if(_0x118e57[_0x03d5('0x12d')]){_0x118e57[_0x03d5('0x12d')]=![];_0x221490[_0x03d5('0x2e')][_0x221490[_0x03d5('0xab')][_0x4cadde][_0x03d5('0xb5')]]=[];ami[_0x03d5('0xb0')]({'actionid':_0x4cadde,'action':_0x03d5('0x1e9'),'queue':_0x118e57[_0x03d5('0x43')]})[_0x03d5('0xba')](function(){_0x221490[_0x03d5('0xb7')](_0x118e57);_0x221490[_0x03d5('0xc3')]({'active':![],'ContactId':_0x221490[_0x03d5('0xab')][_0x4cadde][_0x03d5('0xd7')],'ListId':_0x221490['actions'][_0x4cadde][_0x03d5('0xd8')],'VoiceQueueId':_0x221490[_0x03d5('0xab')][_0x4cadde][_0x03d5('0xda')]||undefined,'CampaignId':_0x221490['actions'][_0x4cadde][_0x03d5('0x101')]||undefined})[_0x03d5('0xba')](loggerCatch(_0x03d5('0x1ea')));delete _0x221490[_0x03d5('0xab')][_0x4cadde];});}else{loggerBooked[_0x03d5('0x7e')]('[booked][checkContactBlack][else]',JSON[_0x03d5('0x49')](_0x118e57['queueStatusComplete']),_0x03d5('0x1eb'),_0x118e57[_0x03d5('0x43')]);_0x221490[_0x03d5('0xb7')](_0x118e57);_0x221490[_0x03d5('0xc3')]({'active':![],'ContactId':_0x221490['actions'][_0x4cadde]['ContactId'],'ListId':_0x221490['actions'][_0x4cadde][_0x03d5('0xd8')],'VoiceQueueId':_0x221490[_0x03d5('0xab')][_0x4cadde][_0x03d5('0xda')]||undefined,'CampaignId':_0x221490[_0x03d5('0xab')][_0x4cadde][_0x03d5('0x101')]||undefined})['catch'](loggerCatch(_0x03d5('0x1ea')));delete _0x221490[_0x03d5('0xab')][_0x4cadde];}}else{return _0x221490[_0x03d5('0x169')](_0x118e57,_0x120bd1);}}else{if(getDiff(_0x120bd1['scheduledat'])<_0x118e57[_0x03d5('0x1ec')]*0x3c){if(_0x120bd1[_0x03d5('0x1ed')]&&!_0x120bd1[_0x03d5('0x1ed')][_0x03d5('0x1ee')]){_0x221490[_0x03d5('0x22')][_0x03d5('0x138')](_0x120bd1['id'])['finally'](function(){_0x221490[_0x03d5('0xb7')](_0x118e57);});}else{_0x221490['unlockContact']({'active':![]},_0x120bd1['id'],0x1)[_0x03d5('0x21')](function(){_0x221490[_0x03d5('0xb7')](_0x118e57);});}}else{_0x118e57['outboundReCallsDay']+=0x1;_0x221490[_0x03d5('0xb7')](_0x118e57);if(_0x118e57[_0x03d5('0x1ef')]){_0x221490[_0x03d5('0xc3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x120bd1[_0x03d5('0xd7')],'ListId':_0x120bd1[_0x03d5('0xd8')],'VoiceQueueId':_0x120bd1[_0x03d5('0xda')]||undefined,'CampaignId':_0x120bd1[_0x03d5('0x101')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x221490[_0x03d5('0xce')](createObjHistory(_0x118e57,_0x120bd1,_0x03d5('0x1f0'),0x17,_0x03d5('0x1f1')))[_0x03d5('0xba')](loggerCatch(_0x03d5('0x1f2')));}else{_0x221490[_0x03d5('0xd4')](createObjHistory(_0x118e57,_0x120bd1,_0x03d5('0x1f3'),0x16,_0x03d5('0x1f4')),_0x03d5('0x1f5'),'[Originate][HistoryRecallClose]');}}}}else{_0x118e57['outboundBlacklistCallsDay']+=0x1;_0x221490['saveInDb'](createObjHistory(_0x118e57,_0x120bd1,_0x03d5('0x1f6'),0xd,_0x03d5('0x1f7')),_0x03d5('0x1f8'),_0x03d5('0x1f9'));throw _0x03d5('0x1fa');}};};Dialer['prototype']['handleIvr']=function(_0x34ad09){var _0xc4657d=this;var _0x5b2618=_0x34ad09[_0x03d5('0x1fb')]-_0x34ad09[_0x03d5('0x72')]-_0x34ad09[_0x03d5('0x1fc')];emitCampaignSummary(_0x34ad09);if(_0x5b2618>0x0){if(_0x5b2618>this[_0x03d5('0x27')]){_0x5b2618=this[_0x03d5('0x27')];}_0x34ad09[_0x03d5('0x1fc')]+=_0x5b2618;this[_0x03d5('0xc9')](_0x34ad09['id'],_0x5b2618,_0x34ad09[_0x03d5('0x1fd')])[_0x03d5('0xbd')](function(_0x116762){_0x34ad09[_0x03d5('0x1fc')]-=_0x5b2618;_0x34ad09[_0x03d5('0x1fc')]=_0x34ad09[_0x03d5('0x1fc')]>0x0?_0x34ad09['temp']:0x0;if(!checkContactEmpty(_0x116762)){_0x34ad09[_0x03d5('0x40')]=_0x03d5('0x9e');logger['info']('[getContactCampaign2][Empty]'+_0x34ad09['name']);}else{_0x34ad09['originated']+=_0x116762['length'];_0x34ad09['message']=_0x03d5('0x1fe');for(var _0x2a289a=0x0;_0x2a289a<_0x116762[_0x03d5('0x97')];_0x2a289a+=0x1){_0x34ad09['ivrTotalCallsDays']+=0x1;if(_[_0x03d5('0xaf')](_0x116762[_0x2a289a])||_[_0x03d5('0xaf')](_0x116762[_0x2a289a][_0x03d5('0x16d')])||_[_0x03d5('0xaf')](_0x116762[_0x2a289a][_0x03d5('0x16d')][_0x03d5('0x16e')])){_0xc4657d[_0x03d5('0xd2')](_0x03d5('0x1ff'),_0x34ad09,_0x116762[_0x2a289a]);}else{_0xc4657d[_0x03d5('0x200')](_['pick'](_0x116762[_0x2a289a],[_0x03d5('0x101'),_0x03d5('0x201')]))['then'](_0xc4657d[_0x03d5('0x202')](_0x34ad09,_0x116762[_0x2a289a]))[_0x03d5('0xba')](_0xc4657d[_0x03d5('0xd1')](_0x03d5('0x203'),_0x34ad09));}}}})['catch'](loggerGetContactDialer(_0x03d5('0x204'),_0x34ad09,_0x5b2618));}};Dialer[_0x03d5('0x1f')]['handlePower']=function(_0xefdd37,_0x1b0126){var _0x4ce947=this;var _0x1a22c7=[];var _0x189be1=_0x1b0126>=0x1?_0x1b0126:0x1;if(_0xefdd37[_0x03d5('0x5b')]==='booked'){_0x189be1=0x1;}var _0x698ded=Math['floor'](_0xefdd37[_0x03d5('0x52')]*_0x189be1)-_0xefdd37[_0x03d5('0x72')]-_0xefdd37[_0x03d5('0x1fc')];emitVoiceQueueSummary(_0xefdd37);if(_0xefdd37['dialLimitQueue']>0x0){var _0x28396b=_0xefdd37['dialLimitQueue']-_0xefdd37[_0x03d5('0x72')]-_0xefdd37[_0x03d5('0x56')]-_0xefdd37[_0x03d5('0x1fc')]-_0xefdd37[_0x03d5('0x54')];if(_0x698ded>_0x28396b){_0x698ded=_0x28396b;}}if(_0x698ded>0x0){if(_0xefdd37[_0x03d5('0x5b')]===_0x03d5('0x9')){_0x698ded=0x1;}if(_0x698ded>this[_0x03d5('0x27')]){_0x698ded=this[_0x03d5('0x27')];}_0xefdd37[_0x03d5('0x1fc')]+=_0x698ded;for(var _0x18d7e8 in this[_0x03d5('0x25')]){if(typeof this[_0x03d5('0x25')][_0x18d7e8]!==_0x03d5('0x98')){if(this[_0x03d5('0x25')][_0x18d7e8]['state']===_0x03d5('0x205')&&this['agents'][_0x18d7e8][_0x03d5('0xb1')]==='reachable'){_0x1a22c7[_0x03d5('0x14d')](this[_0x03d5('0x25')][_0x18d7e8]['id']);}}}this[_0x03d5('0xc7')](_0xefdd37['id'],_0x1a22c7,_0x698ded,_0xefdd37[_0x03d5('0x1fd')])[_0x03d5('0xbd')](function(_0x1a517b){_0xefdd37['temp']-=_0x698ded;_0xefdd37[_0x03d5('0x1fc')]=_0xefdd37[_0x03d5('0x1fc')]>0x0?_0xefdd37['temp']:0x0;if(!checkContactEmpty(_0x1a517b)){_0x4ce947[_0x03d5('0xb9')](_0xefdd37)['then'](sendMessageReschedule(_0xefdd37))['catch'](loggerCatch(_0x03d5('0x206')));}else{_0xefdd37[_0x03d5('0x72')]+=_0x1a517b[_0x03d5('0x97')];_0xefdd37['message']=_0xefdd37[_0x03d5('0x5b')]===_0x03d5('0x9')?'ACTIVE':_0x03d5('0x1fe');for(var _0x8ac9ce=0x0;_0x8ac9ce<_0x1a517b[_0x03d5('0x97')];_0x8ac9ce+=0x1){if(_[_0x03d5('0xaf')](_0x1a517b[_0x8ac9ce])||_['isNil'](_0x1a517b[_0x8ac9ce][_0x03d5('0x16d')])||_['isNil'](_0x1a517b[_0x8ac9ce][_0x03d5('0x16d')][_0x03d5('0x16e')])){_0x4ce947[_0x03d5('0xd2')]('[actionOriginate]\x20',_0xefdd37,_0x1a517b[_0x8ac9ce]);}else{_0x4ce947[_0x03d5('0xbb')](_[_0x03d5('0xd6')](_0x1a517b[_0x8ac9ce],['VoiceQueueId','Contact.phone']))['then'](_0x4ce947[_0x03d5('0x202')](_0xefdd37,_0x1a517b[_0x8ac9ce]))['catch'](_0x4ce947['loggerHandler'](_0x03d5('0x1ff'),_0xefdd37));}}}})[_0x03d5('0xba')](loggerGetContactDialer('[getContactDialer2]',_0xefdd37,_0x698ded));}};Dialer['prototype'][_0x03d5('0x8e')]=function(_0x3c4591){if(_0x3c4591['dialLimitQueue']>0x0){var _0x606119=_0x3c4591[_0x03d5('0x207')]-_0x3c4591['originated']-_0x3c4591['talking'];if(_0x606119>0x0){this[_0x03d5('0x208')](_0x3c4591);}else{loggerPredictiveCalls['info'](_0x03d5('0x209'));}}else{this[_0x03d5('0x208')](_0x3c4591);}};Dialer[_0x03d5('0x1f')]['tryOriginatePredictive']=function(_0x5e655f){var _0x41c7fa=this;var _0x54cb4a=[];_0x5e655f['originated']+=0x1;for(var _0x346fa3 in this[_0x03d5('0x25')]){if(typeof this[_0x03d5('0x25')][_0x346fa3]!==_0x03d5('0x98')){if(this['agents'][_0x346fa3]['state']===_0x03d5('0x205')&&this[_0x03d5('0x25')][_0x346fa3][_0x03d5('0xb1')]===_0x03d5('0xdf')){_0x54cb4a[_0x03d5('0x14d')](this['agents'][_0x346fa3]['id']);}}}this['getContactDialer'](_0x5e655f['id'],_0x54cb4a,0x1,_0x5e655f[_0x03d5('0x1fd')])[_0x03d5('0xbd')](function(_0x6f87cc){if(!checkContactEmpty(_0x6f87cc)){checkContactLowerLimitOriginate(_0x5e655f,0x1,0x0);_0x41c7fa[_0x03d5('0xb9')](_0x5e655f)['then'](sendMessageReschedule(_0x5e655f))[_0x03d5('0xba')](loggerCatch('[countReScheduled]\x20'));}else{_0x5e655f[_0x03d5('0x40')]=_0x03d5('0x1fe');if(_['isNil'](_0x6f87cc[0x0])||_[_0x03d5('0xaf')](_0x6f87cc[0x0][_0x03d5('0x16d')])||_[_0x03d5('0xaf')](_0x6f87cc[0x0]['Contact'][_0x03d5('0x16e')])){_0x41c7fa['emptyContact'](_0x03d5('0x1ff'),_0x5e655f,_0x6f87cc[0x0]);}else{_0x41c7fa['checkIsBlackList'](_[_0x03d5('0xd6')](_0x6f87cc[0x0],[_0x03d5('0xda'),_0x03d5('0x201')]))[_0x03d5('0xbd')](_0x41c7fa[_0x03d5('0x202')](_0x5e655f,_0x6f87cc[0x0]))['catch'](_0x41c7fa[_0x03d5('0xd1')]('[actionOriginatePredictive]\x20',_0x5e655f));}}})[_0x03d5('0xba')](loggerGetContactDialer(_0x03d5('0x20a'),_0x5e655f,0x1));emitVoiceQueueSummary(_0x5e655f);};Dialer[_0x03d5('0x1f')][_0x03d5('0x1de')]=function(_0x4dd7d1,_0x3d8c8c,_0x174b72,_0x1ebca9,_0x526a0e,_0x4b99a8){loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x20b'));loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x20c'),_0x4dd7d1);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x20d'),_0x3d8c8c);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x20e'),_0x174b72);loggerPredictive[_0x03d5('0x7e')]('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',_0x1ebca9);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x20f'),_0x526a0e);loggerPredictive[_0x03d5('0x7e')]('---------------------------');return new BPromise(function(_0x1c3c57,_0x279f66){if(_0x4dd7d1<=0x0||isNaN(_0x4dd7d1)){return _0x279f66(msgResponse(_0x03d5('0x210'),_0x03d5('0x211'),_0x03d5('0x212')+_0x4dd7d1));}if(_0x174b72<=0x0||isNaN(_0x174b72)){return _0x279f66(msgResponse(_0x03d5('0x210'),_0x03d5('0x211'),_0x03d5('0x213')+_0x174b72));}if(_0x1ebca9<=0x0||isNaN(_0x1ebca9)){return _0x279f66(msgResponse(_0x03d5('0x210'),'Error',_0x03d5('0x214')+_0x1ebca9));}if(_0x3d8c8c<=0x0||isNaN(_0x3d8c8c)){return _0x279f66(msgResponse(_0x03d5('0x210'),_0x03d5('0x211'),'interval\x20=\x20'+_0x3d8c8c));}if(_0x526a0e<=0x0||isNaN(_0x526a0e)){return _0x279f66(msgResponse(_0x03d5('0x210'),_0x03d5('0x211'),_0x03d5('0x215')+_0x526a0e));}_0x4b99a8=_0x4b99a8||0x0;var _0x347d7b=0x1/_0x174b72;var _0x5d13d9=0x0;var _0x471953=0x0;var _0x296cef=0x0;var _0x22c028=0x0;for(var _0x15604b=0x0;_0x296cef<_0x526a0e;_0x15604b+=0x1){_0x471953=_0x15604b/_0x3d8c8c;_0x5d13d9=(_0x1ebca9*_0x471953+_0x4b99a8)/_0x347d7b;_0x296cef=erlangb(_0x5d13d9,_0x4dd7d1);_0x22c028=_0x5d13d9/_0x4dd7d1*(0x1-erlangb(_0x5d13d9,_0x4dd7d1));}return _0x1c3c57({'erlangCalls':_0x15604b,'erlangCallToSecond':_0x3d8c8c/_0x15604b,'erlangAbandonmentRate':_0x296cef,'erlangBusyFactor':_0x22c028});});};Dialer[_0x03d5('0x1f')]['busyFactor']=function(_0x24efc4,_0x296137,_0x4d43dc,_0x4d40d4,_0x3c4a47,_0x4886d7){loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x216'));loggerPredictive[_0x03d5('0x7e')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x24efc4);loggerPredictive[_0x03d5('0x7e')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x296137);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x20e'),_0x4d43dc);loggerPredictive[_0x03d5('0x7e')]('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',_0x4d40d4);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3c4a47);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x87'));return new BPromise(function(_0x3572ee,_0x2ddd29){if(_0x24efc4<=0x0||isNaN(_0x24efc4)){return _0x2ddd29(msgResponse(_0x03d5('0x217'),_0x03d5('0x211'),_0x03d5('0x212')+_0x24efc4));}if(_0x4d43dc<=0x0||isNaN(_0x4d43dc)){return _0x2ddd29(msgResponse(_0x03d5('0x217'),_0x03d5('0x211'),_0x03d5('0x213')+_0x4d43dc));}if(_0x4d40d4<=0x0||isNaN(_0x4d40d4)){return _0x2ddd29(msgResponse(_0x03d5('0x217'),'Error',_0x03d5('0x214')+_0x4d40d4));}if(_0x296137<=0x0||isNaN(_0x296137)){return _0x2ddd29(msgResponse(_0x03d5('0x217'),'Error',_0x03d5('0x218')+_0x296137));}if(_0x3c4a47<=0x0||isNaN(_0x3c4a47)){return _0x2ddd29(msgResponse(_0x03d5('0x217'),_0x03d5('0x211'),_0x03d5('0x219')+_0x3c4a47));}_0x4886d7=_0x4886d7||0x0;var _0x5e482f=0x1/_0x4d43dc;var _0x744ae6=0x0;var _0x544c20=0x0;var _0x4e7972=0x0;var _0x2c5df6=0x0;for(var _0x281d1b=0x0;_0x2c5df6<_0x3c4a47;_0x281d1b+=0x1){_0x544c20=_0x281d1b/_0x296137;_0x744ae6=(_0x4d40d4*_0x544c20+_0x4886d7)/_0x5e482f;_0x4e7972=erlangb(_0x744ae6,_0x24efc4);_0x2c5df6=_0x744ae6/_0x24efc4*(0x1-erlangb(_0x744ae6,_0x24efc4));}return _0x3572ee({'erlangCalls':_0x281d1b,'erlangCallToSecond':_0x296137/_0x281d1b,'erlangAbandonmentRate':_0x4e7972,'erlangBusyFactor':_0x2c5df6});});};module[_0x03d5('0x21a')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index e7bce5f..e795707 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 _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 +var _0x017b=['CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x1877e0,_0x5f111a){var _0x52408a=function(_0x52baa8){while(--_0x52baa8){_0x1877e0['push'](_0x1877e0['shift']());}};_0x52408a(++_0x5f111a);}(_0x017b,0x1a8));var _0xb017=function(_0x4b343b,_0x1215b0){_0x4b343b=_0x4b343b-0x0;var _0x455b3a=_0x017b[_0x4b343b];return _0x455b3a;};'use strict';var util=require('util');var _=require(_0xb017('0x0'));var moment=require(_0xb017('0x1'));function getSeconds(_0x583fad,_0x37df7e){var _0x5eac2c=moment(_0x583fad)['milliseconds'](0x0);var _0x1536ae=moment(_0x37df7e)[_0xb017('0x2')](0x0);return _0x5eac2c[_0xb017('0x3')](_0x1536ae,'seconds');}function QueueCallerAbandon(_0x16047d,_0xb89c8a){this[_0xb017('0x4')]=_0x16047d[_0xb017('0x4')];this[_0xb017('0x5')]=_0x16047d['type'];this[_0xb017('0x6')]=_0x16047d['type']===_0xb017('0x7')?_0xb017('0x8'):_0x16047d[_0xb017('0x5')];this[_0xb017('0x9')]=_0x16047d[_0xb017('0x9')];this[_0xb017('0xa')]=_0x16047d[_0xb017('0xa')];this[_0xb017('0xb')]=_0x16047d[_0xb017('0xb')];this[_0xb017('0xc')]=_0x16047d[_0xb017('0x9')]+_0x16047d[_0xb017('0xa')]+_0x16047d['countnoanswerretry']+_0x16047d['countnosuchnumberretry']+_0x16047d[_0xb017('0xd')]+_0x16047d[_0xb017('0xe')]+_0x16047d[_0xb017('0xf')]+_0x16047d[_0xb017('0x10')];this[_0xb017('0x11')]=_0x16047d[_0xb017('0x11')];this[_0xb017('0xd')]=_0x16047d[_0xb017('0xd')];this[_0xb017('0xe')]=_0x16047d[_0xb017('0xe')];this[_0xb017('0xf')]=_0x16047d[_0xb017('0xf')];this[_0xb017('0x10')]=_0x16047d[_0xb017('0x10')];this[_0xb017('0x12')]=_0xb89c8a['uniqueid'];this['calleridname']=_0x16047d[_0xb017('0x13')];this['calleridnum']=_0x16047d[_0xb017('0x14')];this[_0xb017('0x15')]=_0x16047d[_0xb017('0x15')];this[_0xb017('0x16')]=_0x16047d['responsetime'];this[_0xb017('0x17')]=_0x16047d[_0xb017('0x17')];this[_0xb017('0x18')]=this[_0xb017('0x17')];this[_0xb017('0x19')]=getSeconds(_0x16047d['responsetime'],_0x16047d[_0xb017('0x15')]);this[_0xb017('0x1a')]=getSeconds(this['droptime'],_0x16047d[_0xb017('0x16')]);this[_0xb017('0x1b')]=0x0;this[_0xb017('0x8')]=_0xb89c8a[_0xb017('0x8')];this[_0xb017('0x1c')]=_0xb89c8a[_0xb017('0x1d')];this[_0xb017('0x1e')]=_0xb89c8a['reason'];this['callback']=_0x16047d['callback'];this['callbackuniqueid']=_0x16047d[_0xb017('0x1f')];this['callbackat']=_0x16047d[_0xb017('0x20')];this['recallme']=_0x16047d[_0xb017('0x21')];this['ContactId']=_0x16047d[_0xb017('0x22')];this['ListId']=_0x16047d[_0xb017('0x23')];this[_0xb017('0x24')]=_0x16047d['UserId'];this['VoiceQueueId']=_0x16047d[_0xb017('0x25')];this[_0xb017('0x26')]=_0x16047d[_0xb017('0x26')];this['originatecalleridnum']=_0x16047d[_0xb017('0x27')]||'';this[_0xb017('0x28')]=_0x16047d['originatecalleridname']||'';}module[_0xb017('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 377cad3..b95cf24 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 _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 +var _0x2835=['AttachmentId','util','lodash','moment','uniqueid','channel','%s/%s/%s','tech','Trunk','name','fax','localstationid','headerinfo','path'];(function(_0x1b842f,_0x27a979){var _0x27a559=function(_0x91cd73){while(--_0x91cd73){_0x1b842f['push'](_0x1b842f['shift']());}};_0x27a559(++_0x27a979);}(_0x2835,0x1dd));var _0x5283=function(_0x107c01,_0x40606f){_0x107c01=_0x107c01-0x0;var _0x4cce69=_0x2835[_0x107c01];return _0x4cce69;};'use strict';var util=require(_0x5283('0x0'));var _=require(_0x5283('0x1'));var moment=require(_0x5283('0x2'));function Action(_0x3df00f,_0x3893b9,_0x294b40){this[_0x5283('0x3')]=_0x3df00f||undefined;this[_0x5283('0x4')]=util['format'](_0x5283('0x5'),_0x3893b9[_0x5283('0x6')],_0x3893b9[_0x5283('0x7')][_0x5283('0x8')],_0x294b40[_0x5283('0x9')]);this['localstationid']=_0x3893b9[_0x5283('0xa')];this[_0x5283('0xb')]=_0x3893b9[_0x5283('0xb')];this[_0x5283('0xc')]=_0x294b40['path'];this[_0x5283('0xd')]=_0x294b40['AttachmentId'];}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 4def47b..36e0be3 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 _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 +var _0x2ab6=['prototype','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','finally','syncHangup','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','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','format','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','uuid','moment','path','tiff2pdf','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','context','from-voip-provider','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','value','syncNewState','channelstate','channelstatedesc'];(function(_0x1d3019,_0x8dbbd5){var _0x36458e=function(_0x5d60db){while(--_0x5d60db){_0x1d3019['push'](_0x1d3019['shift']());}};_0x36458e(++_0x8dbbd5);}(_0x2ab6,0x12d));var _0x62ab=function(_0x547348,_0x39abaa){_0x547348=_0x547348-0x0;var _0x369bec=_0x2ab6[_0x547348];return _0x369bec;};'use strict';var util=require(_0x62ab('0x0'));var _=require(_0x62ab('0x1'));var BPromise=require('bluebird');var uuid=require(_0x62ab('0x2'));var moment=require(_0x62ab('0x3'));var path=require(_0x62ab('0x4'));var tiff2pdf=require(_0x62ab('0x5'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x62ab('0x6'));var ami=require(_0x62ab('0x7'));var rpcDb=require('./rpcDb');var Channel=require(_0x62ab('0x8'));var ut=require(_0x62ab('0x9'));var Action=require(_0x62ab('0xa'));var faxAccount=require(_0x62ab('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x62ab('0xc'));function Fax(_0x1c62ce){this[_0x62ab('0xd')]={};this[_0x62ab('0xe')]=_0x1c62ce['faxAccounts'];this[_0x62ab('0xf')]=_0x1c62ce[_0x62ab('0xf')];this[_0x62ab('0x10')]={};ami['on'](_0x62ab('0x11'),this[_0x62ab('0x12')]['bind'](this));ami['on'](_0x62ab('0x13'),this[_0x62ab('0x14')][_0x62ab('0x15')](this));ami['on'](_0x62ab('0x16'),this['syncNewState'][_0x62ab('0x15')](this));ami['on'](_0x62ab('0x17'),this['syncNewExten'][_0x62ab('0x15')](this));ami['on'](_0x62ab('0x18'),this[_0x62ab('0x19')][_0x62ab('0x15')](this));ami['on'](_0x62ab('0x1a'),this[_0x62ab('0x1b')][_0x62ab('0x15')](this));ami['on'](_0x62ab('0x1c'),this['syncHangup'][_0x62ab('0x15')](this));ami['on'](_0x62ab('0x1d'),this['syncOriginateResponse'][_0x62ab('0x15')](this));}Fax['prototype'][_0x62ab('0x12')]=function(_0x32ac7d){if(_0x32ac7d[_0x62ab('0x1e')]===_0x62ab('0x1f')){for(var _0x2cccf5 in this['faxAccounts']){if(this['faxAccounts']['hasOwnProperty'](_0x2cccf5)){if(_0x32ac7d['exten']===this['faxAccounts'][_0x2cccf5][_0x62ab('0x20')]){this['channels'][_0x32ac7d[_0x62ab('0x21')]]={};this[_0x62ab('0xd')][_0x32ac7d[_0x62ab('0x21')]][_0x62ab('0x22')]=_0x32ac7d[_0x62ab('0x22')];this['channels'][_0x32ac7d[_0x62ab('0x21')]]['id']=this[_0x62ab('0xe')][_0x2cccf5]['id'];this[_0x62ab('0xd')][_0x32ac7d[_0x62ab('0x21')]][_0x62ab('0x23')]=this[_0x62ab('0xe')][_0x2cccf5]['name'];logger[_0x62ab('0x24')](_0x32ac7d[_0x62ab('0x21')],_0x62ab('0x25'));}}}}if(this[_0x62ab('0x10')][_0x32ac7d[_0x62ab('0x21')]]){this[_0x62ab('0xd')][_0x32ac7d[_0x62ab('0x21')]]={};this[_0x62ab('0xd')][_0x32ac7d['uniqueid']][_0x62ab('0x22')]=_0x32ac7d[_0x62ab('0x22')];logger[_0x62ab('0x24')](_0x32ac7d[_0x62ab('0x21')],'\x20syncNewchannel\x20');}};Fax['prototype'][_0x62ab('0x14')]=function(_0x9eccc3){if(this[_0x62ab('0xd')][_0x9eccc3[_0x62ab('0x21')]]){for(var _0x56fcb9 in _0x9eccc3[_0x62ab('0x26')]){if(_0x9eccc3[_0x62ab('0x26')][_0x62ab('0x27')](_0x56fcb9)){this[_0x62ab('0xd')][_0x9eccc3['uniqueid']][_0x56fcb9]=_0x9eccc3[_0x62ab('0x28')];}}}};Fax['prototype'][_0x62ab('0x29')]=function(_0x2e03b6){if(this[_0x62ab('0xd')][_0x2e03b6[_0x62ab('0x21')]]){this[_0x62ab('0xd')][_0x2e03b6[_0x62ab('0x21')]]['channelstate']=_0x2e03b6[_0x62ab('0x2a')];this[_0x62ab('0xd')][_0x2e03b6['uniqueid']][_0x62ab('0x2b')]=_0x2e03b6[_0x62ab('0x2b')];}};Fax[_0x62ab('0x2c')][_0x62ab('0x2d')]=function(_0x5a5d0b){if(this[_0x62ab('0xd')][_0x5a5d0b[_0x62ab('0x21')]]){for(var _0x4fbd9a in _0x5a5d0b[_0x62ab('0x26')]){if(_0x5a5d0b['variable']['hasOwnProperty'](_0x4fbd9a)){this[_0x62ab('0xd')][_0x5a5d0b['uniqueid']][_0x4fbd9a]=_0x5a5d0b[_0x62ab('0x28')];}}}};Fax[_0x62ab('0x2c')]['syncFaxStatus']=function(_0x3aead0){if(this['channels'][_0x3aead0[_0x62ab('0x21')]]){this[_0x62ab('0xd')][_0x3aead0[_0x62ab('0x21')]][_0x62ab('0x2e')]=_0x3aead0[_0x62ab('0x2e')];this[_0x62ab('0xd')][_0x3aead0[_0x62ab('0x21')]]['status']=_0x3aead0[_0x62ab('0x2f')];this['channels'][_0x3aead0[_0x62ab('0x21')]][_0x62ab('0x20')]=_0x3aead0[_0x62ab('0x20')];this[_0x62ab('0xd')][_0x3aead0[_0x62ab('0x21')]]['filename']=_0x3aead0[_0x62ab('0x30')];logger[_0x62ab('0x24')](_0x3aead0[_0x62ab('0x21')],_0x62ab('0x31'));}};Fax[_0x62ab('0x2c')][_0x62ab('0x1b')]=function(_0x48a7ec){var _0x565236=this;if(this['channels'][_0x48a7ec[_0x62ab('0x21')]]){var _0x1b2098=this[_0x62ab('0xd')][_0x48a7ec['uniqueid']]['id'];this[_0x62ab('0xd')][_0x48a7ec[_0x62ab('0x21')]][_0x62ab('0x32')]=_0x48a7ec[_0x62ab('0x32')];this[_0x62ab('0xd')][_0x48a7ec['uniqueid']][_0x62ab('0x33')]=_0x48a7ec[_0x62ab('0x33')];this[_0x62ab('0xd')][_0x48a7ec['uniqueid']][_0x62ab('0x20')]=_0x48a7ec['localstationid'];this['channels'][_0x48a7ec[_0x62ab('0x21')]]['resolution']=_0x48a7ec[_0x62ab('0x34')];this[_0x62ab('0xd')][_0x48a7ec['uniqueid']][_0x62ab('0x35')]=_0x48a7ec[_0x62ab('0x35')];this[_0x62ab('0xd')][_0x48a7ec['uniqueid']]['filename']=_0x48a7ec[_0x62ab('0x30')];this['channels'][_0x48a7ec[_0x62ab('0x21')]][_0x62ab('0x36')]=_0x48a7ec[_0x62ab('0x36')];if(this['channels'][_0x48a7ec['uniqueid']][_0x62ab('0x33')]>0x0){tiff2pdf(_0x48a7ec[_0x62ab('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x47983a){logger[_0x62ab('0x24')](_0x48a7ec[_0x62ab('0x21')],_0x62ab('0x37'),_0x47983a[_0x62ab('0x38')]);attachment[_0x62ab('0x39')]({'name':path[_0x62ab('0x3a')](_0x48a7ec['filename'])[_0x62ab('0x23')],'basename':path[_0x62ab('0x3a')](_0x48a7ec[_0x62ab('0x30')])[_0x62ab('0x23')]+_0x62ab('0x3b'),'type':_0x62ab('0x3c')})[_0x62ab('0x3d')](function(_0x3b8874){faxAccount[_0x62ab('0x3e')](_0x1b2098,{'from':_0x48a7ec[_0x62ab('0x36')],'mapKey':_0x62ab('0x6'),'body':path[_0x62ab('0x3a')](_0x48a7ec[_0x62ab('0x30')])[_0x62ab('0x23')]+_0x62ab('0x3b'),'AttachmentId':_0x3b8874['id']})[_0x62ab('0x3f')](function(_0x247dd9){logger[_0x62ab('0x40')](_0x48a7ec[_0x62ab('0x21')],_0x62ab('0x41'),JSON[_0x62ab('0x42')](_0x247dd9));});})[_0x62ab('0x3f')](function(_0x418184){logger['error'](_0x48a7ec[_0x62ab('0x21')],_0x62ab('0x43'),JSON[_0x62ab('0x42')](_0x418184));});});}logger[_0x62ab('0x24')](_0x48a7ec[_0x62ab('0x21')],_0x62ab('0x43'));}};Fax[_0x62ab('0x2c')][_0x62ab('0x44')]=function(_0x1a4d71){if(this['actions'][_0x1a4d71[_0x62ab('0x21')]]){_[_0x62ab('0x45')](this['channels'][_0x1a4d71['uniqueid']],_[_0x62ab('0x46')](_0x1a4d71,[_0x62ab('0x47'),_0x62ab('0x48')]));}};function updateStatus(_0x14b430){if(_0x14b430['AttachmentId']){faxMessage['update'](_0x14b430[_0x62ab('0x49')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x62ab('0x3d')](function(_0x84bcaa){ut[_0x62ab('0x4a')]('[Fax][Message][Error][Updated]',_0x84bcaa);})[_0x62ab('0x3f')](function(_0xac3736){ut[_0x62ab('0x4a')](_0x62ab('0x4b'),_0xac3736);});}else{ut[_0x62ab('0x4a')](_0x62ab('0x4c'));}}Fax['prototype'][_0x62ab('0x4d')]=function(_0x45b6ba,_0x2b7cd9,_0x2139c0){var _0x39125f=this;var _0x5656cf={};if(_0x2b7cd9){_0x5656cf={'read':_0x2b7cd9};}else{_0x5656cf={'failMessage':_0x2139c0};}if(this[_0x62ab('0x10')][_0x45b6ba][_0x62ab('0x49')]){faxMessage[_0x62ab('0x4e')](this[_0x62ab('0x10')][_0x45b6ba]['AttachmentId'],_0x5656cf)[_0x62ab('0x3d')](function(_0x47c588){ut[_0x62ab('0x4a')](_0x62ab('0x4f'),_0x47c588);})[_0x62ab('0x3f')](function(_0x3e39cc){ut['logger']('[Fax][Message][NoUpdate1]',_0x3e39cc);})[_0x62ab('0x50')](function(){delete _0x39125f[_0x62ab('0xd')][_0x45b6ba];delete _0x39125f[_0x62ab('0x10')][_0x45b6ba];});}else{ut[_0x62ab('0x4a')]('[Fax][Message][NoUpdate2]');delete this[_0x62ab('0xd')][_0x45b6ba];delete this[_0x62ab('0x10')][_0x45b6ba];}};Fax[_0x62ab('0x2c')][_0x62ab('0x51')]=function(_0x2fc2a2){var _0x37e713=this;if(this[_0x62ab('0xd')][_0x2fc2a2[_0x62ab('0x21')]]){if(this[_0x62ab('0x10')][_0x2fc2a2[_0x62ab('0x21')]]){this[_0x62ab('0xd')][_0x2fc2a2[_0x62ab('0x21')]]['id']=this[_0x62ab('0x10')][_0x2fc2a2[_0x62ab('0x21')]]['id'];this[_0x62ab('0xd')][_0x2fc2a2['uniqueid']]['name']=this[_0x62ab('0x10')][_0x2fc2a2[_0x62ab('0x21')]][_0x62ab('0x23')];}logger[_0x62ab('0x24')](_0x2fc2a2[_0x62ab('0x21')],this[_0x62ab('0x10')][_0x2fc2a2['uniqueid']]?'\x20hangup\x20sendFile\x20':_0x62ab('0x52'),JSON[_0x62ab('0x42')](this[_0x62ab('0xd')][_0x2fc2a2[_0x62ab('0x21')]]));if(this[_0x62ab('0x10')][_0x2fc2a2[_0x62ab('0x21')]]){if(this[_0x62ab('0xd')][_0x2fc2a2['uniqueid']]['faxpages']>0x0&&this[_0x62ab('0xd')][_0x2fc2a2['uniqueid']][_0x62ab('0x18')]===_0x62ab('0x53')){this[_0x62ab('0x4d')](_0x2fc2a2['uniqueid'],!![]);}else{this[_0x62ab('0x4d')](_0x2fc2a2['uniqueid'],![],this[_0x62ab('0xd')][_0x2fc2a2[_0x62ab('0x21')]][_0x62ab('0x54')]?_0x62ab('0x55')+this[_0x62ab('0xd')][_0x2fc2a2['uniqueid']]['faxstatusstring']:_0x62ab('0x56'));}}}};Fax[_0x62ab('0x2c')][_0x62ab('0x57')]=function(_0x22107a){var _0x3f3f6f=this;return new BPromise(function(_0x5934e5,_0x438b75){_0x3f3f6f[_0x62ab('0x58')](_0x22107a,_0x3f3f6f['faxAccounts'][_0x22107a['FaxAccountId']])['then'](function(_0x292b9d){ut[_0x62ab('0x4a')](_0x62ab('0x59'),_0x292b9d);_0x5934e5(ut[_0x62ab('0x38')]('Fax\x20received'));})[_0x62ab('0x3f')](function(_0x209b89){ut[_0x62ab('0x4a')](_0x62ab('0x5a'),_0x209b89);updateStatus(_0x22107a);_0x438b75(ut[_0x62ab('0x38')](_0x62ab('0x5b')));});});};Fax[_0x62ab('0x2c')][_0x62ab('0x5c')]=function(_0x26ed6a){var _0x2cc1a9=this;return new BPromise(function(_0x31ad4a,_0x31b53f){var _0x1ea9db=_0x2cc1a9[_0x62ab('0x5d')](_0x2cc1a9[_0x62ab('0xe')][_0x26ed6a[_0x62ab('0x5e')]][_0x62ab('0x5f')],_0x26ed6a);if(_0x1ea9db[_0x62ab('0x60')]){_0x31ad4a(ut['message']('Trunk\x20Reachable'));}else{_0x31b53f(ut[_0x62ab('0x38')](_0x1ea9db[_0x62ab('0x38')]));}});};function originate(_0x1ed062,_0x4db811,_0x1ed649){return new BPromise(function(_0x15611f,_0x3527e9){if(_0x1ed649){var _0x42ba2f=util['format'](_0x62ab('0x61'),path[_0x62ab('0x3a')](_0x1ed062[_0x62ab('0x4')])['name'],_0x1ed062['path']);gs['execute'](_0x42ba2f)[_0x62ab('0x3d')](function(){_0x1ed062[_0x62ab('0x4')]=util[_0x62ab('0x62')]('%s/%s.tif',path[_0x62ab('0x3a')](_0x1ed062[_0x62ab('0x4')])[_0x62ab('0x63')],path[_0x62ab('0x3a')](_0x1ed062[_0x62ab('0x4')])['name']);_0x4db811['XMF-PATH']=_0x1ed062[_0x62ab('0x4')];ut[_0x62ab('0x4a')](_0x62ab('0x64'),'');ami[_0x62ab('0x65')](ut['variablesAction'](_0x1ed062,_0x4db811))[_0x62ab('0x3d')](function(_0x34d95f){_0x15611f(_0x34d95f);})[_0x62ab('0x3f')](function(_0x5db7b0){_0x3527e9(_0x5db7b0);});})[_0x62ab('0x3f')](function(_0x3a20a5){_0x3527e9(_0x3a20a5);});}else{ami[_0x62ab('0x65')](ut[_0x62ab('0x66')](_0x1ed062,_0x4db811))[_0x62ab('0x3d')](function(_0x20e60e){_0x15611f(_0x20e60e);})[_0x62ab('0x3f')](function(_0xced11){_0x3527e9(_0xced11);});}});}Fax['prototype'][_0x62ab('0x58')]=function(_0x340a57,_0x2676d0){var _0x35a1d6=this;return new BPromise(function(_0xdfdca9,_0x33ce98){var _0x2b664a=uuid['v4']();var _0x101224=ut[_0x62ab('0x67')](_0x340a57,_0x2676d0);_0x35a1d6['actions'][_0x2b664a]=new Action(_0x2b664a,_0x2676d0,_0x340a57);var _0x9e506e=_0x35a1d6[_0x62ab('0x10')][_0x2b664a];if(path['parse'](_0x340a57[_0x62ab('0x4')])['ext']===_0x62ab('0x3b')){originate(_0x9e506e,_0x101224,!![])[_0x62ab('0x3d')](function(_0x1a27ae){_0xdfdca9(_0x1a27ae);})[_0x62ab('0x3f')](function(_0x431686){_0x33ce98(_0x431686);});}else{originate(_0x9e506e,_0x101224,![])[_0x62ab('0x3d')](function(_0x353494){_0xdfdca9(_0x353494);})[_0x62ab('0x3f')](function(_0x2332cf){_0x33ce98(_0x2332cf);});}});};Fax[_0x62ab('0x2c')][_0x62ab('0x68')]=function(_0x1d46a7){return!_['isNil'](_0x1d46a7)&&!_['isNil'](_0x1d46a7['name'])&&!_[_0x62ab('0x69')](_0x1d46a7[_0x62ab('0x6a')])&&_0x1d46a7[_0x62ab('0x6a')]&&!_['isNil'](this['trunks'][util['format'](_0x62ab('0x6b'),_0x1d46a7[_0x62ab('0x23')])])&&!_[_0x62ab('0x69')](this['trunks'][util[_0x62ab('0x62')](_0x62ab('0x6b'),_0x1d46a7['name'])][_0x62ab('0x2f')])&&(this[_0x62ab('0xf')][util[_0x62ab('0x62')](_0x62ab('0x6b'),_0x1d46a7[_0x62ab('0x23')])][_0x62ab('0x2f')]===_0x62ab('0x6c')||this[_0x62ab('0xf')][util[_0x62ab('0x62')](_0x62ab('0x6b'),_0x1d46a7[_0x62ab('0x23')])]['status']===_0x62ab('0x6d'));};Fax[_0x62ab('0x2c')]['checkTrunk']=function(_0x110161,_0x5c5c88){if(!this[_0x62ab('0x68')](_0x110161)){ut['logger'](_0x62ab('0x6e'),_[_0x62ab('0x69')](_0x110161)?'':_0x110161[_0x62ab('0x23')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x62ab('0x69')](_0x5c5c88[_0x62ab('0x6')])){ut[_0x62ab('0x4a')](_0x62ab('0x6f'),JSON[_0x62ab('0x42')](_0x5c5c88));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x62ab('0x69')](_0x5c5c88[_0x62ab('0x4')])){ut[_0x62ab('0x4a')](_0x62ab('0x70'),JSON[_0x62ab('0x42')](_0x5c5c88));return{'isValid':![],'message':_0x62ab('0x71')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x62ab('0x72')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 3dd3561..a3d48c3 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 _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 +var _0x83d1=['catch','util','../../../config/logger','preview','lodash','../rpc/faxAccount','error','notify','resolve','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x83d1,0x187));var _0x183d=function(_0x4763e0,_0x4c6d52){_0x4763e0=_0x4763e0-0x0;var _0x2f955b=_0x83d1[_0x4763e0];return _0x2f955b;};'use strict';var util=require(_0x183d('0x0'));var BPromise=require('bluebird');var logger=require(_0x183d('0x1'))(_0x183d('0x2'));var _=require(_0x183d('0x3'));var faxAccount=require(_0x183d('0x4'));function loggerCatch(_0x45366d){return function(_0x547e42){logger[_0x183d('0x5')](_0x45366d,util['inspect'](_0x547e42,{'showHidden':![],'depth':null}));};}exports[_0x183d('0x6')]=function(_0x2a621b,_0x3341a7){return BPromise[_0x183d('0x7')]()[_0x183d('0x8')](faxAccount[_0x183d('0x6')](_0x2a621b,_0x3341a7))[_0x183d('0x9')](loggerCatch('[Notify]\x20'));}; \ 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 af0abf5..c145cc6 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 _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 +var _0x6790=['\x20Error\x20:','inspect','util','../../../../config/logger','fax','child_process','exec','execute','info','Exec\x20gs'];(function(_0x338224,_0x1fb425){var _0x1d5fc5=function(_0x27cc96){while(--_0x27cc96){_0x338224['push'](_0x338224['shift']());}};_0x1d5fc5(++_0x1fb425);}(_0x6790,0xd4));var _0x0679=function(_0x3e4d85,_0x216dde){_0x3e4d85=_0x3e4d85-0x0;var _0x2e8e37=_0x6790[_0x3e4d85];return _0x2e8e37;};'use strict';var util=require(_0x0679('0x0'));var logger=require(_0x0679('0x1'))(_0x0679('0x2'));var BPromise=require('bluebird');var exec=require(_0x0679('0x3'))[_0x0679('0x4')];exports[_0x0679('0x5')]=function(_0x545511){return new BPromise(function(_0x1f565f,_0x1b248b){exec(_0x545511,function(_0x14b5f5,_0x389f0e,_0x599bbb){logger[_0x0679('0x6')](_0x0679('0x7'),_0x389f0e);if(_0x14b5f5){logger[_0x0679('0x6')](_0x0679('0x7'),_0x0679('0x8'),util[_0x0679('0x9')](_0x14b5f5,{'showHidden':![],'depth':null}),_0x389f0e,_0x599bbb);_0x1b248b(_0x14b5f5);}_0x1f565f(_0x389f0e);});});}; \ 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 a6f192a..5afdbe4 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 _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 +var _0x57f8=['path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','minrate','maxrate','format','modem','gateway','faxdetect','localstationid'];(function(_0x5a4373,_0x41f540){var _0x36f89c=function(_0x2a8ef1){while(--_0x2a8ef1){_0x5a4373['push'](_0x5a4373['shift']());}};_0x36f89c(++_0x41f540);}(_0x57f8,0x198));var _0x857f=function(_0x4f6037,_0x8e0a90){_0x4f6037=_0x4f6037-0x0;var _0x2542e2=_0x57f8[_0x4f6037];return _0x2542e2;};'use strict';var util=require('util');var _=require(_0x857f('0x0'));var moment=require(_0x857f('0x1'));var logger=require(_0x857f('0x2'))(_0x857f('0x3'));exports[_0x857f('0x4')]=function(_0x27b98d){return{'message':_0x27b98d};};exports[_0x857f('0x5')]=function(_0x6f054b,_0x318050){logger[_0x857f('0x6')](_0x6f054b,util[_0x857f('0x7')](_0x318050,{'showHidden':![],'depth':null}));};exports[_0x857f('0x8')]=function(_0x5d22e4,_0x8380e8){var _0x197098={'XMF-ECM':_0x8380e8[_0x857f('0x9')],'XMF-HEADERINFO':_0x8380e8['headerinfo'],'XMF-MINRATE':_0x8380e8[_0x857f('0xa')],'XMF-MAXRATE':_0x8380e8[_0x857f('0xb')],'XMF-MODEM':util[_0x857f('0xc')]('\x22%s\x22',_0x8380e8[_0x857f('0xd')]),'XMF-GATEWAY':_0x8380e8[_0x857f('0xe')],'XMF-FAXDETECT':_0x8380e8[_0x857f('0xf')],'XMF-T38TIMEOUT':_0x8380e8['t38timeout'],'XMF-LOCALSTATIONID':_0x8380e8[_0x857f('0x10')],'XMF-PATH':_0x5d22e4[_0x857f('0x11')]};return _0x197098;};exports[_0x857f('0x12')]=function(_0x11adfd,_0x268f9d){return{'actionid':_0x11adfd[_0x857f('0x13')],'action':_0x857f('0x14'),'channel':_0x11adfd['channel'],'Exten':_0x857f('0x15'),'Context':_0x857f('0x16'),'Priority':'1','callerid':util[_0x857f('0xc')](_0x857f('0x17'),_0x11adfd[_0x857f('0x18')]?_0x11adfd['headerinfo']:'',_0x11adfd['localstationid']),'variable':_0x268f9d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x11adfd[_0x857f('0x13')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index ba49285..a58d1aa 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 _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 +var _0x33f8=['getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','hour','resolve','then','initAgents','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts'];(function(_0x182416,_0x5874bc){var _0x5b4e3d=function(_0x980316){while(--_0x980316){_0x182416['push'](_0x182416['shift']());}};_0x5b4e3d(++_0x5874bc);}(_0x33f8,0x172));var _0x833f=function(_0x5c3d46,_0x459758){_0x5c3d46=_0x5c3d46-0x0;var _0x2f279e=_0x33f8[_0x5c3d46];return _0x2f279e;};'use strict';var BPromise=require(_0x833f('0x0'));var util=require(_0x833f('0x1'));var moment=require(_0x833f('0x2'));var server=require(_0x833f('0x3'));var Realtime=require(_0x833f('0x4'));var Report=require(_0x833f('0x5'));var Acw=require(_0x833f('0x6'));var Trigger=require(_0x833f('0x7'));var Dialer=require(_0x833f('0x8'));var Preview=require(_0x833f('0x9'));var Fax=require('./fax');var user=require(_0x833f('0xa'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x833f('0xb'));var voiceCallReport=require(_0x833f('0xc'));var trunk=require(_0x833f('0xd'));var trigger=require('./rpc/trigger');var template=require(_0x833f('0xe'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0x833f('0xf'));var faxAccount=require(_0x833f('0x10'));var zendesk=require(_0x833f('0x11'));var salesforce=require(_0x833f('0x12'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x833f('0x13'));var desk=require(_0x833f('0x14'));var zoho=require(_0x833f('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x833f('0x16'));var servicenow=require(_0x833f('0x17'));var dynamics365=require('./rpc/integrations/dynamics365');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()[_0x833f('0x18')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x833f('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x833f('0x1a')]()[_0x833f('0x1b')](user['getAgents']())[_0x833f('0x1b')](realtime[_0x833f('0x1c')]())[_0x833f('0x1b')](user['getTelephones']())[_0x833f('0x1b')](realtime[_0x833f('0x1d')]())['then'](trunk[_0x833f('0x1e')]())[_0x833f('0x1b')](realtime[_0x833f('0x1f')]())['then'](voiceQueue['getVoiceQueues']())[_0x833f('0x1b')](realtime[_0x833f('0x20')]())[_0x833f('0x1b')](trigger[_0x833f('0x21')]())[_0x833f('0x1b')](realtime[_0x833f('0x22')]())['then'](template[_0x833f('0x23')]())[_0x833f('0x1b')](realtime[_0x833f('0x24')]())['then'](zendesk['getZendeskAccounts']())[_0x833f('0x1b')](realtime[_0x833f('0x25')]())['then'](salesforce[_0x833f('0x26')]())[_0x833f('0x1b')](realtime[_0x833f('0x27')]())[_0x833f('0x1b')](sugarcrm[_0x833f('0x28')]())[_0x833f('0x1b')](realtime[_0x833f('0x29')]())[_0x833f('0x1b')](freshdesk[_0x833f('0x2a')]())[_0x833f('0x1b')](realtime[_0x833f('0x2b')]())[_0x833f('0x1b')](desk[_0x833f('0x2c')]())[_0x833f('0x1b')](realtime[_0x833f('0x2d')]())[_0x833f('0x1b')](zoho[_0x833f('0x2e')]())[_0x833f('0x1b')](realtime[_0x833f('0x2f')]())[_0x833f('0x1b')](vtiger[_0x833f('0x30')]())[_0x833f('0x1b')](realtime[_0x833f('0x31')]())[_0x833f('0x1b')](freshsales[_0x833f('0x32')]())[_0x833f('0x1b')](realtime[_0x833f('0x33')]())[_0x833f('0x1b')](servicenow[_0x833f('0x34')]())['then'](realtime[_0x833f('0x35')]())[_0x833f('0x1b')](dynamics365['getDynamics365Accounts']())['then'](realtime[_0x833f('0x36')]())['then'](campaign[_0x833f('0x37')]())['then'](realtime[_0x833f('0x38')]())[_0x833f('0x1b')](voiceExtension['getVoiceExtensions']())[_0x833f('0x1b')](realtime[_0x833f('0x39')]())[_0x833f('0x1b')](faxAccount[_0x833f('0x3a')]())[_0x833f('0x1b')](realtime[_0x833f('0x3b')]())[_0x833f('0x1b')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x833f('0x1b')](voiceQueueReport[_0x833f('0x3c')]())['then'](realtime[_0x833f('0x3d')]())[_0x833f('0x1b')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0x833f('0x3e')]())[_0x833f('0x1b')](cmHopperHistory[_0x833f('0x3f')]())[_0x833f('0x1b')](realtime[_0x833f('0x40')]())[_0x833f('0x1b')](voiceCallReport['getVoiceCallReports']())['then'](realtime[_0x833f('0x41')]())[_0x833f('0x1b')](function(_0x25343e){})[_0x833f('0x42')](function(_0x11b059){console[_0x833f('0x43')](_0x11b059);});}function main(){return server[_0x833f('0x44')](realtime,preview,fax)[_0x833f('0x1b')](function(_0x176c19){return initRealtime();})[_0x833f('0x1b')](function(){return initParams();})[_0x833f('0x1b')](function(){report[_0x833f('0x45')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x19197d){console[_0x833f('0x43')](_0x19197d);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index d5df897..c67462d 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 _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 +var _0x85b1=['idle','inuse','talking','statePause','voiceStatusTime','voiceStatusQueue','interface','stringify','format','user:%s','emit','exports','lodash','util','moment','md5','ioredis','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','stateTime','status','unknown','address','phone','mobile','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','state','not_inuse'];(function(_0x4a09c6,_0x54ce5e){var _0x25d834=function(_0x272ccc){while(--_0x272ccc){_0x4a09c6['push'](_0x4a09c6['shift']());}};_0x25d834(++_0x54ce5e);}(_0x85b1,0x1e0));var _0x185b=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x85b1[_0x5627e1];return _0x2f013f;};'use strict';var _=require(_0x185b('0x0'));var util=require(_0x185b('0x1'));var moment=require(_0x185b('0x2'));var md5=require(_0x185b('0x3'));var Redis=require(_0x185b('0x4'));var config=require('../../../config/environment');config[_0x185b('0x5')]=_['defaults'](config['redis'],{'host':_0x185b('0x6'),'port':0x18eb});var io=require(_0x185b('0x7'))(new Redis(config[_0x185b('0x5')]));function Agent(_0x49f914){this['id']=_0x49f914['id']||0x0;this[_0x185b('0x8')]=_0x49f914[_0x185b('0x8')]||'';this[_0x185b('0x9')]=_0x49f914[_0x185b('0x9')]||'';this[_0x185b('0xa')]=_0x49f914[_0x185b('0xa')]||'';this[_0x185b('0xb')]=_0x49f914['fullname']||'';this['state']='unknown';this[_0x185b('0xc')]=0x0;this[_0x185b('0xd')]=_0x185b('0xe');this[_0x185b('0xf')]='';this[_0x185b('0x10')]='';this[_0x185b('0x11')]='';this['interface']='';this[_0x185b('0x12')]=_0x49f914[_0x185b('0x12')]||![];this[_0x185b('0x13')]=_0x185b('0xe');this['voiceStatusTime']=0x0;this[_0x185b('0x14')]='';this['voiceStatusQueue']='';this[_0x185b('0x15')]=![];this[_0x185b('0x16')]=![];this[_0x185b('0x3')]='';}Agent[_0x185b('0x17')][_0x185b('0x18')]=function(_0x58a32c){var _0x51c4f1;if(_0x58a32c&&_0x58a32c[_0x185b('0x19')]){_0x51c4f1=_0x58a32c['state']['toLowerCase']();switch(_0x51c4f1){case _0x185b('0x1a'):_0x51c4f1=_0x185b('0x1b');break;case _0x185b('0x1c'):_0x51c4f1=_0x185b('0x1d');break;}}if(_0x51c4f1&&this[_0x185b('0x13')]!==_0x51c4f1||_0x58a32c[_0x185b('0x1e')]){this[_0x185b('0x1f')]=_['toNumber'](moment()['format']('x'));}if(_0x51c4f1){this[_0x185b('0x13')]=_0x51c4f1;}var _0x45008b={'id':this['id'],'name':this[_0x185b('0x8')],'email':this[_0x185b('0x9')],'accountcode':this[_0x185b('0xa')],'fullname':this[_0x185b('0xb')],'state':this[_0x185b('0x19')],'stateTime':this[_0x185b('0xc')],'status':this[_0x185b('0xd')],'address':this['address'],'online':this[_0x185b('0x12')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x185b('0x1f')],'voiceStatusCallerIdNumber':this[_0x185b('0x14')],'voiceStatusQueue':this[_0x185b('0x20')],'interface':this[_0x185b('0x21')],'onhold':this[_0x185b('0x15')]};var _0x56c1de=md5(JSON[_0x185b('0x22')](_0x45008b));if(this[_0x185b('0x3')]!==_0x56c1de){this[_0x185b('0x3')]=_0x56c1de;io['to'](util[_0x185b('0x23')](_0x185b('0x24'),_0x45008b[_0x185b('0x8')]))[_0x185b('0x25')]('user:save',_0x45008b);}};module[_0x185b('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 8022fa0..284da7f 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 _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 +var _0x654a=['dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','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','originated','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0x654a,0xe8));var _0xa654=function(_0x18c2e7,_0x34bb35){_0x18c2e7=_0x18c2e7-0x0;var _0x3889ec=_0x654a[_0x18c2e7];return _0x3889ec;};'use strict';function Campaign(_0x50ce98){this['id']=_0x50ce98['id']||0x0;this[_0xa654('0x0')]=_0x50ce98[_0xa654('0x0')]||'';this[_0xa654('0x1')]=_0x50ce98[_0xa654('0x1')]||_0xa654('0x2');this[_0xa654('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0xa654('0x4')]='';this[_0xa654('0x5')]=!![];this[_0xa654('0x6')]=_0x50ce98[_0xa654('0x6')];this[_0xa654('0x7')]=_0x50ce98[_0xa654('0x7')];this[_0xa654('0x8')]=_0x50ce98[_0xa654('0x8')]||null;this[_0xa654('0x9')]=_0x50ce98['dialGlobalInterval']?_0x50ce98['dialGlobalInterval']:null;this[_0xa654('0xa')]=_0x50ce98['dialOriginateCallerIdName'];this[_0xa654('0xb')]=_0x50ce98[_0xa654('0xb')];this['dialOriginateTimeout']=_0x50ce98[_0xa654('0xc')]||0x1e;this['dialCongestionMaxRetry']=_0x50ce98[_0xa654('0xd')];this[_0xa654('0xe')]=_0x50ce98[_0xa654('0xe')];this[_0xa654('0xf')]=_0x50ce98[_0xa654('0xf')];this[_0xa654('0x10')]=_0x50ce98[_0xa654('0x10')];this['dialNoAnswerMaxRetry']=_0x50ce98[_0xa654('0x11')];this[_0xa654('0x12')]=_0x50ce98[_0xa654('0x12')];this[_0xa654('0x13')]=_0x50ce98[_0xa654('0x13')];this[_0xa654('0x14')]=_0x50ce98['dialNoSuchNumberMaxRetry']||0x3;this[_0xa654('0x15')]=_0x50ce98[_0xa654('0x15')]||0x96;this[_0xa654('0x16')]=_0x50ce98[_0xa654('0x16')]||0x3;this[_0xa654('0x17')]=_0x50ce98[_0xa654('0x17')]||0x96;this[_0xa654('0x18')]=_0x50ce98[_0xa654('0x18')]||0x3;this[_0xa654('0x19')]=_0x50ce98[_0xa654('0x19')]||0x96;this[_0xa654('0x1a')]=_0x50ce98['dialMachineMaxRetry']||0x3;this[_0xa654('0x1b')]=_0x50ce98['dialMachineRetryFrequency']||0x96;this[_0xa654('0x1c')]=_0x50ce98[_0xa654('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x50ce98[_0xa654('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x50ce98[_0xa654('0x1e')]||_0xa654('0x1f');this[_0xa654('0x20')]=_0x50ce98[_0xa654('0x20')]||undefined;this[_0xa654('0x21')]=_0x50ce98[_0xa654('0x21')]||undefined;this[_0xa654('0x22')]=_0x50ce98['dialCutDigit']||undefined;this[_0xa654('0x23')]=_0x50ce98[_0xa654('0x23')]?_0x50ce98[_0xa654('0x23')]:undefined;this[_0xa654('0x24')]=_0x50ce98[_0xa654('0x24')]?_0x50ce98[_0xa654('0x24')]:undefined;this['Interval']=_0x50ce98[_0xa654('0x25')]?_0x50ce98[_0xa654('0x25')]:undefined;this['SquareProject']=_0x50ce98[_0xa654('0x26')]?_0x50ce98[_0xa654('0x26')]:undefined;this['dialQueueProject']=_0x50ce98[_0xa654('0x26')]?_0x50ce98[_0xa654('0x26')][_0xa654('0x0')]:undefined;this[_0xa654('0x27')]=_0x50ce98[_0xa654('0x27')]||![];this[_0xa654('0x28')]=_0x50ce98[_0xa654('0x28')];this[_0xa654('0x29')]=_0x50ce98['dialAMDGreeting'];this[_0xa654('0x2a')]=_0x50ce98['dialAMDAfterGreetingSilence'];this[_0xa654('0x2b')]=_0x50ce98[_0xa654('0x2b')];this[_0xa654('0x2c')]=_0x50ce98[_0xa654('0x2c')];this[_0xa654('0x2d')]=_0x50ce98[_0xa654('0x2d')];this[_0xa654('0x2e')]=_0x50ce98[_0xa654('0x2e')];this[_0xa654('0x2f')]=_0x50ce98[_0xa654('0x2f')];this[_0xa654('0x30')]=_0x50ce98['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 a83c0d6..dc7ba3a 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 _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 +var _0xafa7=['exten','answered','answertime','endtime','unmanaged','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','calleridnum','connectedlinenum','connectedlinename','accountcode','linkedid'];(function(_0x30399b,_0x3fdbfb){var _0x45f880=function(_0x3ef88a){while(--_0x3ef88a){_0x30399b['push'](_0x30399b['shift']());}};_0x45f880(++_0x3fdbfb);}(_0xafa7,0x122));var _0x7afa=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xafa7[_0x1c8c28];return _0x1f59b4;};'use strict';function Channel(){this[_0x7afa('0x0')]=null;this[_0x7afa('0x1')]='';this['destinationchannel']='';this[_0x7afa('0x2')]=0x0;this['calleridname']='';this[_0x7afa('0x3')]=undefined;this[_0x7afa('0x4')]=undefined;this[_0x7afa('0x5')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0x7afa('0x6')]=0x0;this[_0x7afa('0x7')]=0x0;this[_0x7afa('0x8')]=![];this[_0x7afa('0x9')]=null;this[_0x7afa('0xa')]=null;this[_0x7afa('0xb')]=![];this['abandoned']=![];this[_0x7afa('0xc')]='';this[_0x7afa('0xd')]='';this[_0x7afa('0xe')]=0x0;this[_0x7afa('0xf')]=0x0;this[_0x7afa('0x10')]=0x0;this[_0x7afa('0x11')]=null;this[_0x7afa('0x12')]=null;this['disposition']=null;this[_0x7afa('0x13')]=![];this[_0x7afa('0x14')]=null;this[_0x7afa('0x15')]=null;this[_0x7afa('0x16')]=[];this[_0x7afa('0x17')]=undefined;this[_0x7afa('0x18')]=undefined;this[_0x7afa('0x19')]=0x0;}module[_0x7afa('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 a793d18..dd8895b 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 _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 +var _0x9ab0=['authType','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x2b0be7,_0x433e5e){var _0x2762fc=function(_0x1ee41d){while(--_0x1ee41d){_0x2b0be7['push'](_0x2b0be7['shift']());}};_0x2762fc(++_0x433e5e);}(_0x9ab0,0x195));var _0x09ab=function(_0x438ccc,_0xc1dc7b){_0x438ccc=_0x438ccc-0x0;var _0x4dbcc3=_0x9ab0[_0x438ccc];return _0x4dbcc3;};'use strict';function DeskAccount(_0x25e2ea){this['id']=_0x25e2ea['id']||0x0;this[_0x09ab('0x0')]=_0x25e2ea[_0x09ab('0x0')]||'';this[_0x09ab('0x1')]=_0x25e2ea[_0x09ab('0x1')]||'';this[_0x09ab('0x2')]=_0x25e2ea[_0x09ab('0x2')]||'';this[_0x09ab('0x3')]=_0x25e2ea[_0x09ab('0x3')]||'';this['password']=_0x25e2ea['password']||'';this['consumerKey']=_0x25e2ea[_0x09ab('0x4')]||'';this[_0x09ab('0x5')]=_0x25e2ea[_0x09ab('0x5')]||'';this[_0x09ab('0x6')]=_0x25e2ea[_0x09ab('0x6')]||'';this[_0x09ab('0x7')]=_0x25e2ea[_0x09ab('0x7')]||'';this[_0x09ab('0x8')]=_0x25e2ea[_0x09ab('0x8')]||'';this['serverUrl']=_0x25e2ea[_0x09ab('0x9')]||'';this['Configurations']=_0x25e2ea[_0x09ab('0xa')]||{};}module[_0x09ab('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 8ab7e73..a6aad6a 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 _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 +var _0xc319=['clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xc319,0xae));var _0x9c31=function(_0x41861e,_0x57cc77){_0x41861e=_0x41861e-0x0;var _0x19732b=_0xc319[_0x41861e];return _0x19732b;};'use strict';function Dynamics365Account(_0xecd806){this['id']=_0xecd806['id']||0x0;this['name']=_0xecd806[_0x9c31('0x0')]||'';this['username']=_0xecd806[_0x9c31('0x1')]||'';this[_0x9c31('0x2')]=_0xecd806[_0x9c31('0x2')]||'';this[_0x9c31('0x3')]=_0xecd806['remoteUri']||'';this[_0x9c31('0x4')]=_0xecd806[_0x9c31('0x4')]||'';this[_0x9c31('0x5')]=_0xecd806[_0x9c31('0x5')]||'';this[_0x9c31('0x6')]=_0xecd806[_0x9c31('0x6')]||{};this[_0x9c31('0x7')]=_0xecd806['serverUrl']||'';this[_0x9c31('0x8')]=_0xecd806['Configurations']||{};}module[_0x9c31('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 41cb603..ce08f8e 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 _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 +var _0x79e2=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x329905,_0x13c144){var _0x3aa42=function(_0x2fac43){while(--_0x2fac43){_0x329905['push'](_0x329905['shift']());}};_0x3aa42(++_0x13c144);}(_0x79e2,0x1c3));var _0x279e=function(_0x1dd920,_0x402062){_0x1dd920=_0x1dd920-0x0;var _0x167d19=_0x79e2[_0x1dd920];return _0x167d19;};'use strict';function FaxAccount(_0x393f10){this['id']=_0x393f10['id']||0x0;this['name']=_0x393f10[_0x279e('0x0')]||'';this[_0x279e('0x1')]=_0x393f10[_0x279e('0x1')];this['ecm']=_0x393f10[_0x279e('0x2')];this['headerinfo']=_0x393f10[_0x279e('0x3')];this[_0x279e('0x4')]=_0x393f10[_0x279e('0x4')];this[_0x279e('0x5')]=_0x393f10['minrate']||0x960;this['maxrate']=_0x393f10[_0x279e('0x6')]||0x3840;this[_0x279e('0x7')]=_0x393f10[_0x279e('0x7')]||_0x279e('0x8');this[_0x279e('0x9')]=_0x393f10['gateway']||'no';this[_0x279e('0xa')]=_0x393f10[_0x279e('0xa')]||'no';this[_0x279e('0xb')]=_0x393f10['t38timeout']||0x1388;this[_0x279e('0xc')]=_0x393f10[_0x279e('0xc')]||'SIP';this[_0x279e('0xd')]=_0x393f10[_0x279e('0xd')]?_0x393f10[_0x279e('0xd')]:undefined;this[_0x279e('0xe')]=_0x393f10[_0x279e('0xe')];this[_0x279e('0xf')]=_0x393f10[_0x279e('0xf')];}module[_0x279e('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 7832c37..b577072 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 _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 +var _0x4b4f=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x592cbc,_0x5ec030){var _0x39b8d9=function(_0x39055c){while(--_0x39055c){_0x592cbc['push'](_0x592cbc['shift']());}};_0x39b8d9(++_0x5ec030);}(_0x4b4f,0x120));var _0xf4b4=function(_0x16e990,_0x2c1447){_0x16e990=_0x16e990-0x0;var _0x1bb5d1=_0x4b4f[_0x16e990];return _0x1bb5d1;};'use strict';function FreshdeskAccount(_0x1ed3f5){this['id']=_0x1ed3f5['id']||0x0;this[_0xf4b4('0x0')]=_0x1ed3f5['name']||'';this['username']=_0x1ed3f5[_0xf4b4('0x1')]||'';this[_0xf4b4('0x2')]=_0x1ed3f5[_0xf4b4('0x3')]||'';this[_0xf4b4('0x4')]=_0x1ed3f5[_0xf4b4('0x4')]||'';this['serverUrl']=_0x1ed3f5[_0xf4b4('0x5')]||'';this[_0xf4b4('0x6')]=_0x1ed3f5[_0xf4b4('0x6')]||{};}module[_0xf4b4('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 6b055bc..9728b13 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 _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 +var _0xf0da=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x306b69,_0x58d0fc){var _0x2f1946=function(_0x15c6c3){while(--_0x15c6c3){_0x306b69['push'](_0x306b69['shift']());}};_0x2f1946(++_0x58d0fc);}(_0xf0da,0x1d4));var _0xaf0d=function(_0x8ce7a9,_0x188582){_0x8ce7a9=_0x8ce7a9-0x0;var _0x2abb51=_0xf0da[_0x8ce7a9];return _0x2abb51;};'use strict';function FreshsalesAccount(_0x3618cf){this['id']=_0x3618cf['id']||0x0;this['name']=_0x3618cf[_0xaf0d('0x0')]||'';this[_0xaf0d('0x1')]=_0x3618cf['username']||'';this[_0xaf0d('0x2')]=_0x3618cf[_0xaf0d('0x3')]||'';this[_0xaf0d('0x4')]=_0x3618cf['remoteUri']||'';this[_0xaf0d('0x5')]=_0x3618cf[_0xaf0d('0x5')]||'';this['Configurations']=_0x3618cf[_0xaf0d('0x6')]||{};}module[_0xaf0d('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 9fea49c..89ac8a1 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 _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 +var _0x2cf9=['context','exten','priority','holdtime','assigned','variables','inbound','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0x2cf9,0x180));var _0x92cf=function(_0x4d8f24,_0x3cbc35){_0x4d8f24=_0x4d8f24-0x0;var _0x5c9a94=_0x2cf9[_0x4d8f24];return _0x5c9a94;};'use strict';function QueueReport(){this['type']=_0x92cf('0x0');this['uniqueid']='';this['calleridnum']='';this[_0x92cf('0x1')]='';this[_0x92cf('0x2')]='';this[_0x92cf('0x3')]=null;this[_0x92cf('0x4')]=null;this[_0x92cf('0x5')]=0x1;this[_0x92cf('0x6')]=0x1;this[_0x92cf('0x7')]=![];this[_0x92cf('0x8')]=null;this['queuecallercomplete']=![];this[_0x92cf('0x9')]=null;this['queuecallerexit']=![];this[_0x92cf('0xa')]=null;this['originalposition']=0x1;this[_0x92cf('0xb')]='';this[_0x92cf('0xc')]='';this[_0x92cf('0xd')]='';this[_0x92cf('0xe')]='';this[_0x92cf('0xf')]='';this[_0x92cf('0x10')]='';this[_0x92cf('0x11')]='';this[_0x92cf('0x12')]=0x0;this[_0x92cf('0x13')]=![];this['lastAssignedTo']='';this['mohtime']=0x0;this[_0x92cf('0x14')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index f6957a9..7a69c5a 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 _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 +var _0x4e70=['Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl'];(function(_0x301994,_0x2703db){var _0x524777=function(_0xb7eae){while(--_0xb7eae){_0x301994['push'](_0x301994['shift']());}};_0x524777(++_0x2703db);}(_0x4e70,0xb5));var _0x04e7=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x4e70[_0x4e9d3c];return _0x2d0825;};'use strict';function SalesforceAccount(_0x547adf){this['id']=_0x547adf['id']||0x0;this['name']=_0x547adf[_0x04e7('0x0')]||'';this[_0x04e7('0x1')]=_0x547adf[_0x04e7('0x1')]||'';this[_0x04e7('0x2')]=_0x547adf['remoteUri']||'';this[_0x04e7('0x3')]=_0x547adf['password']||'';this[_0x04e7('0x4')]=_0x547adf[_0x04e7('0x4')]||'';this['clientSecret']=_0x547adf[_0x04e7('0x5')]||'';this[_0x04e7('0x6')]=_0x547adf[_0x04e7('0x6')]||'';this[_0x04e7('0x7')]=_0x547adf[_0x04e7('0x7')]||'integrationTab';this[_0x04e7('0x8')]=_0x547adf[_0x04e7('0x8')]||'';this[_0x04e7('0x9')]=_0x547adf[_0x04e7('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 d1cdd43..5e980fa 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 _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 +var _0xf01a=['password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x3c3aff,_0x5b8934){var _0x11ce44=function(_0x5a3f65){while(--_0x5a3f65){_0x3c3aff['push'](_0x3c3aff['shift']());}};_0x11ce44(++_0x5b8934);}(_0xf01a,0x107));var _0xaf01=function(_0x38fc2f,_0x1a24be){_0x38fc2f=_0x38fc2f-0x0;var _0xcdf537=_0xf01a[_0x38fc2f];return _0xcdf537;};'use strict';function ServicenowAccount(_0x4100b5){this['id']=_0x4100b5['id']||0x0;this[_0xaf01('0x0')]=_0x4100b5[_0xaf01('0x0')]||'';this['username']=_0x4100b5['username']||'';this['password']=_0x4100b5[_0xaf01('0x1')]||'';this[_0xaf01('0x2')]=_0x4100b5['remoteUri']||'';this[_0xaf01('0x3')]=_0x4100b5[_0xaf01('0x3')]||'';this['Configurations']=_0x4100b5[_0xaf01('0x4')]||{};}module[_0xaf01('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index e4b1a13..a89c31d 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 _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 +var _0x7cd0=['name','username','password','remoteUri','Configurations','exports'];(function(_0x16cc2,_0x21acb6){var _0x427219=function(_0x1951c8){while(--_0x1951c8){_0x16cc2['push'](_0x16cc2['shift']());}};_0x427219(++_0x21acb6);}(_0x7cd0,0x186));var _0x07cd=function(_0x7eef7d,_0x50412d){_0x7eef7d=_0x7eef7d-0x0;var _0x416035=_0x7cd0[_0x7eef7d];return _0x416035;};'use strict';function SugarcrmAccount(_0x267adc){this['id']=_0x267adc['id']||0x0;this['name']=_0x267adc[_0x07cd('0x0')]||'';this[_0x07cd('0x1')]=_0x267adc['username']||'';this[_0x07cd('0x2')]=_0x267adc['password']||'';this[_0x07cd('0x3')]=_0x267adc[_0x07cd('0x3')]||'';this['serverUrl']=_0x267adc['serverUrl']||'';this[_0x07cd('0x4')]=_0x267adc['Configurations']||{};}module[_0x07cd('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 b1ccb84..ab1f630 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 _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 +var _0x41d3=['status','name','accountcode','unknown'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41d3,0xe9));var _0x341d=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x41d3[_0x42245d];return _0x4b211a;};'use strict';function Telephone(_0xe847b6){this['id']=_0xe847b6['id']||0x0;this[_0x341d('0x0')]=_0xe847b6['name']||'';this['accountcode']=_0xe847b6[_0x341d('0x1')]||'';this['state']=_0x341d('0x2');this['stateTime']=0x0;this[_0x341d('0x3')]=_0x341d('0x2');this['address']='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 4200785..82a0b43 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 _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 +var _0x7439=['name','html'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7439,0x15c));var _0x9743=function(_0x29b800,_0xb40c0e){_0x29b800=_0x29b800-0x0;var _0xa6ed53=_0x7439[_0x29b800];return _0xa6ed53;};'use strict';function template(_0x32e4bb){this['id']=_0x32e4bb['id']||0x0;this[_0x9743('0x0')]=_0x32e4bb['name']||'';this[_0x9743('0x1')]=_0x32e4bb['html']||'';}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 b150192..43a99ec 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 _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 +var _0xa41a=['AnyConditions','Actions','name','channel','voice','status','AllConditions'];(function(_0x161a80,_0x3c4355){var _0x33d7ab=function(_0x23d238){while(--_0x23d238){_0x161a80['push'](_0x161a80['shift']());}};_0x33d7ab(++_0x3c4355);}(_0xa41a,0x6b));var _0xaa41=function(_0x2dda83,_0x3b31ef){_0x2dda83=_0x2dda83-0x0;var _0x497fd2=_0xa41a[_0x2dda83];return _0x497fd2;};'use strict';function Trigger(_0x33e667){this['id']=_0x33e667['id']||0x0;this[_0xaa41('0x0')]=_0x33e667['name']||'';this[_0xaa41('0x1')]=_0x33e667[_0xaa41('0x1')]||_0xaa41('0x2');this[_0xaa41('0x3')]=_0x33e667[_0xaa41('0x3')]||![];this[_0xaa41('0x4')]=_0x33e667[_0xaa41('0x4')]||[];this[_0xaa41('0x5')]=_0x33e667['AnyConditions']||[];this[_0xaa41('0x6')]=_0x33e667[_0xaa41('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 6d55e96..25e0bff 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 _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 +var _0x3871=['domain','domainport','refresh','address','exports','active','name','state','stateTime','status','unknown','registry','split','host'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x3871,0x1ef));var _0x1387=function(_0x41cc86,_0x45792e){_0x41cc86=_0x41cc86-0x0;var _0x714ab0=_0x3871[_0x41cc86];return _0x714ab0;};'use strict';function Trunk(_0x5d5380){this['id']=_0x5d5380['id']||0x0;this[_0x1387('0x0')]=_0x5d5380[_0x1387('0x0')]||![];this[_0x1387('0x1')]=_0x5d5380[_0x1387('0x1')]||'';this[_0x1387('0x2')]='unknown';this[_0x1387('0x3')]=0x0;this[_0x1387('0x4')]=_0x1387('0x5');this[_0x1387('0x6')]=_0x5d5380['registry']&&_0x5d5380[_0x1387('0x6')]['indexOf'](':')?_0x5d5380['registry'][_0x1387('0x7')](':')[0x0]:'';this[_0x1387('0x8')]='';this['port']='';this[_0x1387('0x9')]='';this[_0x1387('0xa')]='';this[_0x1387('0xb')]='';this['stateRegistry']=_0x1387('0x5');this['registrationtime']='';this[_0x1387('0xc')]='';}module[_0x1387('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index a81f293..498136f 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 _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 +var _0xa530=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x10b6d9,_0xc31308){var _0x484bd7=function(_0x24eaf4){while(--_0x24eaf4){_0x10b6d9['push'](_0x10b6d9['shift']());}};_0x484bd7(++_0xc31308);}(_0xa530,0xce));var _0x0a53=function(_0x547add,_0x387042){_0x547add=_0x547add-0x0;var _0x2ed1f3=_0xa530[_0x547add];return _0x2ed1f3;};'use strict';function voiceExtension(_0x559cba){this['id']=_0x559cba['id']||0x0;this[_0x0a53('0x0')]=_0x559cba[_0x0a53('0x0')]||'';this[_0x0a53('0x1')]=_0x559cba[_0x0a53('0x1')]||_0x0a53('0x2');this['mandatoryDisposition']=_0x559cba[_0x0a53('0x3')]||![];}module[_0x0a53('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 5b4caa3..5ca7ba2 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 _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 +var _0x9c9a=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','invalid','ringinuse','onhold','wav','rrmemory','roundrobin','name','monitor_format','waiting','talking','answered','sumDuration','sumHoldTime','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency'];(function(_0x3d4c4c,_0x65b450){var _0x594de4=function(_0x913e15){while(--_0x913e15){_0x3d4c4c['push'](_0x3d4c4c['shift']());}};_0x594de4(++_0x65b450);}(_0x9c9a,0x1ad));var _0xa9c9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9c9a[_0x19e35c];return _0x3e1fe8;};'use strict';var statusDesc=['unknown',_0xa9c9('0x0'),_0xa9c9('0x1'),'busy',_0xa9c9('0x2'),'unavailable','ringing',_0xa9c9('0x3'),_0xa9c9('0x4')];var monitorFormat={'wav':_0xa9c9('0x5'),'wav49':'wav49','gsm':'gsm'};var strategy={'rrmemory':_0xa9c9('0x6'),'roundrobin':_0xa9c9('0x7')};function VoiceQueue(_0x5746da){this['id']=_0x5746da['id']||0x0;this[_0xa9c9('0x8')]=_0x5746da[_0xa9c9('0x8')]||'';this[_0xa9c9('0x9')]=_0x5746da[_0xa9c9('0x9')]||'';this['type']=_0x5746da['type']||'inbound';this[_0xa9c9('0xa')]=0x0;this[_0xa9c9('0xb')]=0x0;this['total']=0x0;this[_0xa9c9('0xc')]=0x0;this[_0xa9c9('0xd')]=0x0;this[_0xa9c9('0xe')]=0x0;this['sumBillable']=0x0;this[_0xa9c9('0xf')]=0x0;this[_0xa9c9('0x10')]=0x0;this[_0xa9c9('0x11')]=0x0;this[_0xa9c9('0x12')]=0x0;this[_0xa9c9('0x13')]=_0x5746da[_0xa9c9('0x13')]||![];this[_0xa9c9('0x14')]=_0x5746da[_0xa9c9('0x14')]||0xa;this['autopause']=_0x5746da[_0xa9c9('0x15')]||'no';this['sendMessageOneNotActive']=!![];this[_0xa9c9('0x16')]='';this[_0xa9c9('0x17')]=0x0;this['temp']=0x0;this[_0xa9c9('0x18')]=_0x5746da['dialTimezone']||null;this['dialGlobalInterval']=_0x5746da['dialGlobalInterval']?_0x5746da[_0xa9c9('0x19')]:null;this[_0xa9c9('0x1a')]=_0x5746da[_0xa9c9('0x1a')];this[_0xa9c9('0x1b')]=_0x5746da[_0xa9c9('0x1b')]||'progressive';this[_0xa9c9('0x1c')]=_0x5746da[_0xa9c9('0x1c')]||0x0;this['dialLimitQueue']=_0x5746da[_0xa9c9('0x1d')]||0x0;this['dialPowerLevel']=_0x5746da[_0xa9c9('0x1e')]||0x1;this[_0xa9c9('0x1f')]=_0x5746da['dialPredictiveOptimization']||'dropRate';this[_0xa9c9('0x20')]=_0x5746da[_0xa9c9('0x20')]||0.03;this[_0xa9c9('0x21')]=_0x5746da[_0xa9c9('0x21')]||0x258;this[_0xa9c9('0x22')]=_0x5746da['dialOriginateCallerIdName']||_0xa9c9('0x23');this[_0xa9c9('0x24')]=_0x5746da[_0xa9c9('0x24')]||_0xa9c9('0x23');this['dialOriginateTimeout']=_0x5746da[_0xa9c9('0x25')]||0x1e;this[_0xa9c9('0x26')]=_0x5746da['dialQueueOptions']||_0xa9c9('0x27');this[_0xa9c9('0x28')]=_0x5746da[_0xa9c9('0x28')]||0x3;this[_0xa9c9('0x29')]=_0x5746da['dialQueueProject']||undefined;this[_0xa9c9('0x2a')]=_0x5746da['dialCongestionMaxRetry']||0x3;this[_0xa9c9('0x2b')]=_0x5746da[_0xa9c9('0x2b')]||0x96;this[_0xa9c9('0x2c')]=_0x5746da[_0xa9c9('0x2c')]||0x3;this[_0xa9c9('0x2d')]=_0x5746da['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x5746da['dialNoAnswerMaxRetry']||0x3;this[_0xa9c9('0x2e')]=_0x5746da[_0xa9c9('0x2e')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x5746da[_0xa9c9('0x2f')]||0x3;this[_0xa9c9('0x30')]=_0x5746da[_0xa9c9('0x30')]||0x96;this['dialDropMaxRetry']=_0x5746da[_0xa9c9('0x31')]||0x3;this['dialDropRetryFrequency']=_0x5746da[_0xa9c9('0x32')]||0x96;this[_0xa9c9('0x33')]=_0x5746da[_0xa9c9('0x33')]||0x3;this['dialAbandonedRetryFrequency']=_0x5746da[_0xa9c9('0x34')]||0x96;this[_0xa9c9('0x35')]=_0x5746da[_0xa9c9('0x35')]||0x3;this[_0xa9c9('0x36')]=_0x5746da[_0xa9c9('0x36')]||0x96;this[_0xa9c9('0x37')]=_0x5746da['dialAgentRejectMaxRetry']||0x3;this[_0xa9c9('0x38')]=_0x5746da[_0xa9c9('0x38')]||0x96;this[_0xa9c9('0x39')]=_0x5746da['dialGlobalMaxRetry']||0x4;this[_0xa9c9('0x3a')]=_0x5746da['Trunk']?_0x5746da['Trunk']:undefined;this[_0xa9c9('0x3b')]=_0x5746da[_0xa9c9('0x3b')]?_0x5746da[_0xa9c9('0x3b')]:undefined;this[_0xa9c9('0x3c')]=_0x5746da[_0xa9c9('0x3c')]||undefined;this['Interval']=_0x5746da['Interval']?_0x5746da[_0xa9c9('0x3d')]:undefined;this[_0xa9c9('0x3e')]=_0x5746da[_0xa9c9('0x3e')]||_0xa9c9('0x3f');this['dialRandomLastDigitCallerIdNumber']=_0x5746da['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x5746da[_0xa9c9('0x40')]||undefined;this['strategy']=strategy[_0x5746da[_0xa9c9('0x41')]]||_0xa9c9('0x6');this[_0xa9c9('0x42')]=!![];this[_0xa9c9('0x43')]=_0x5746da['dialAMDActive']||![];this[_0xa9c9('0x44')]=_0x5746da[_0xa9c9('0x44')];this[_0xa9c9('0x45')]=_0x5746da[_0xa9c9('0x45')];this['dialAMDAfterGreetingSilence']=_0x5746da[_0xa9c9('0x46')];this[_0xa9c9('0x47')]=_0x5746da[_0xa9c9('0x47')];this[_0xa9c9('0x48')]=_0x5746da[_0xa9c9('0x48')];this[_0xa9c9('0x49')]=_0x5746da[_0xa9c9('0x49')];this[_0xa9c9('0x4a')]=_0x5746da[_0xa9c9('0x4a')];this[_0xa9c9('0x4b')]=_0x5746da['dialAMDSilenceThreshold'];this[_0xa9c9('0x4c')]=_0x5746da[_0xa9c9('0x4c')];this[_0xa9c9('0x4d')]=0x0;this[_0xa9c9('0x4e')]=0x0;this[_0xa9c9('0x4f')]=_0x5746da[_0xa9c9('0x4f')];this[_0xa9c9('0x50')]=0x0;this[_0xa9c9('0x51')]=0x0;this[_0xa9c9('0x52')]=0x0;this[_0xa9c9('0x53')]=0x0;this[_0xa9c9('0x54')]=0x0;this[_0xa9c9('0x55')]=0x0;this[_0xa9c9('0x56')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xa9c9('0x57')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xa9c9('0x58')]=0x0;this[_0xa9c9('0x59')]=0x0;this[_0xa9c9('0x5a')]=0x0;this[_0xa9c9('0x5b')]=0x0;this[_0xa9c9('0x5c')]=undefined;this[_0xa9c9('0x5d')]=undefined;this[_0xa9c9('0x5e')]=undefined;this[_0xa9c9('0x5f')]=1.05;this[_0xa9c9('0x60')]=0x0;this[_0xa9c9('0x61')]=0x0;this[_0xa9c9('0x62')]=0x0;this[_0xa9c9('0x63')]=0x0;this[_0xa9c9('0x64')]=0x0;this[_0xa9c9('0x65')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xa9c9('0x66')]=0x0;this[_0xa9c9('0x67')]=_0x5746da[_0xa9c9('0x68')]||0x14;this[_0xa9c9('0x69')]=_0x5746da[_0xa9c9('0x68')]||0xa;this[_0xa9c9('0x6a')]=0x0;this[_0xa9c9('0x6b')]=0x0;this[_0xa9c9('0x6c')]=0x1;this[_0xa9c9('0x6d')]=0x0;this[_0xa9c9('0x6e')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xa9c9('0x6f')]=0x0;this['dialRecallMeTimeout']=_0x5746da['dialRecallMeTimeout']||0x1e;this[_0xa9c9('0x70')]=_0x5746da[_0xa9c9('0x70')]||![];this[_0xa9c9('0x71')]=_0x5746da[_0xa9c9('0x71')]||undefined;this[_0xa9c9('0x72')]=_0x5746da['dialAgiAfterHangupClient']||![];this[_0xa9c9('0x73')]=_0x5746da[_0xa9c9('0x73')]||![];this[_0xa9c9('0x9')]=monitorFormat[_0x5746da[_0xa9c9('0x9')]]?monitorFormat[_0x5746da[_0xa9c9('0x9')]]:undefined;this['mandatoryDisposition']=_0x5746da[_0xa9c9('0x74')]||![];this[_0xa9c9('0x75')]=_0x5746da[_0xa9c9('0x75')]?_0x5746da[_0xa9c9('0x75')]:undefined;}module[_0xa9c9('0x76')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 7b0d2e8..7e7af4c 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 _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 +var _0x9ec8=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x9ec8,0xd8));var _0x89ec=function(_0x140749,_0x199d28){_0x140749=_0x140749-0x0;var _0x2f40de=_0x9ec8[_0x140749];return _0x2f40de;};'use strict';function VtigerAccount(_0x1abd6a){this['id']=_0x1abd6a['id']||0x0;this[_0x89ec('0x0')]=_0x1abd6a[_0x89ec('0x0')]||'';this[_0x89ec('0x1')]=_0x1abd6a[_0x89ec('0x1')]||'';this['accessKey']=_0x1abd6a[_0x89ec('0x2')]||'';this[_0x89ec('0x3')]=_0x1abd6a[_0x89ec('0x3')]||'';this[_0x89ec('0x4')]=_0x1abd6a[_0x89ec('0x4')]||'';this[_0x89ec('0x5')]=_0x1abd6a[_0x89ec('0x5')]||{};}module[_0x89ec('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 5888597..5f085ad 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 _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 +var _0x7a54=['serverUrl','Configurations','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x7a54,0x106));var _0x47a5=function(_0x5b2ad5,_0x2cf916){_0x5b2ad5=_0x5b2ad5-0x0;var _0x4dd017=_0x7a54[_0x5b2ad5];return _0x4dd017;};'use strict';function ZendeskAccount(_0xe384a5){this['id']=_0xe384a5['id']||0x0;this[_0x47a5('0x0')]=_0xe384a5[_0x47a5('0x0')]||'';this['username']=_0xe384a5[_0x47a5('0x1')]||'';this[_0x47a5('0x2')]=_0xe384a5['password']||'';this[_0x47a5('0x3')]=_0xe384a5[_0x47a5('0x3')]||'';this[_0x47a5('0x4')]=_0xe384a5[_0x47a5('0x4')]||'';this[_0x47a5('0x5')]=_0xe384a5['authType']||'';this[_0x47a5('0x6')]=_0xe384a5['type']||_0x47a5('0x7');this[_0x47a5('0x8')]=_0xe384a5['serverUrl']||'';this[_0x47a5('0x9')]=_0xe384a5['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 fa2db17..234f575 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 _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 +var _0x867f=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x13c538,_0x573e49){var _0x37ae69=function(_0x49f1f6){while(--_0x49f1f6){_0x13c538['push'](_0x13c538['shift']());}};_0x37ae69(++_0x573e49);}(_0x867f,0xdc));var _0xf867=function(_0x40a77f,_0x1d5f8d){_0x40a77f=_0x40a77f-0x0;var _0x415aa1=_0x867f[_0x40a77f];return _0x415aa1;};'use strict';function ZohoAccount(_0x13d7a9){this['id']=_0x13d7a9['id']||0x0;this[_0xf867('0x0')]=_0x13d7a9[_0xf867('0x0')]||'';this['description']=_0x13d7a9[_0xf867('0x1')]||'';this[_0xf867('0x2')]=_0x13d7a9[_0xf867('0x2')]||'';this['zone']=_0x13d7a9[_0xf867('0x3')]||'';this['clientId']=_0x13d7a9[_0xf867('0x4')]||'';this[_0xf867('0x5')]=_0x13d7a9[_0xf867('0x5')]||'';this[_0xf867('0x6')]=_0x13d7a9[_0xf867('0x6')]||'';this[_0xf867('0x7')]=_0x13d7a9[_0xf867('0x7')]||'';this[_0xf867('0x8')]=_0x13d7a9[_0xf867('0x8')]||'';this[_0xf867('0x9')]=_0x13d7a9['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index f3a650b..120fe68 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 _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 +var _0x012e=['ListId','UserId','VoiceQueueId','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','lodash','isNil','string','uniqueid','idContact','name','type','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x012e,0xf7));var _0xe012=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x012e[_0x1facfa];return _0x9ec701;};'use strict';var util=require('util');var _=require(_0xe012('0x0'));var moment=require('moment');function checkNameSurname(_0x7a0760,_0x5c2cfa,_0x2bf4b4){var _0x48db9a='';if(!_[_0xe012('0x1')](_0x5c2cfa)&&'string'===typeof _0x5c2cfa){_0x48db9a+=_0x5c2cfa;}if(!_[_0xe012('0x1')](_0x2bf4b4)&&_0xe012('0x2')===typeof _0x2bf4b4){_0x48db9a+='\x20'+_0x2bf4b4;}if(_0x48db9a!==''){return _0x48db9a;}return _0x7a0760;}function Action(_0x4b14b4,_0x3eef9c,_0x53c85b,_0x265efa,_0x2995ca){this[_0xe012('0x3')]=_0x53c85b||undefined;this[_0xe012('0x4')]=_0x4b14b4['id'];this['queue']=_0x3eef9c[_0xe012('0x5')];this[_0xe012('0x6')]=_0x3eef9c[_0xe012('0x6')];this['campaigntype']='queue';this['dialAnswer']=![];this[_0xe012('0x7')]=_[_0xe012('0x1')](_0x4b14b4['Agent'])?undefined:_0x4b14b4[_0xe012('0x8')][_0xe012('0x5')];this[_0xe012('0x9')]=this[_0xe012('0x7')]?util[_0xe012('0xa')](_0xe012('0xb'),this['membername']):_0x265efa||undefined;this[_0xe012('0xc')]=checkNameSurname(_0x4b14b4[_0xe012('0xd')][_0xe012('0xe')],_0x4b14b4[_0xe012('0xd')][_0xe012('0xf')],_0x4b14b4[_0xe012('0xd')][_0xe012('0x10')]);this[_0xe012('0x11')]=_0x4b14b4[_0xe012('0x11')]||![];this[_0xe012('0x12')]=_0x4b14b4[_0xe012('0xd')]['phone'];this[_0xe012('0x13')]=_0x4b14b4[_0xe012('0x13')];this[_0xe012('0x14')]=_0x4b14b4[_0xe012('0x14')]||0x0;this['countcongestionretry']=_0x4b14b4['countcongestionretry']||0x0;this[_0xe012('0x15')]=_0x4b14b4[_0xe012('0x15')]||0x0;this[_0xe012('0x16')]=(_0x4b14b4['countbusyretry']||0x0)+(_0x4b14b4['countcongestionretry']||0x0)+(_0x4b14b4['countnoanswerretry']||0x0)+(_0x4b14b4[_0xe012('0x17')]||0x0)+(_0x4b14b4['countdropretry']||0x0)+(_0x4b14b4[_0xe012('0x18')]||0x0)+(_0x4b14b4[_0xe012('0x19')]||0x0)+(_0x4b14b4[_0xe012('0x1a')]||0x0);this[_0xe012('0x17')]=_0x4b14b4['countnosuchnumberretry']||0x0;this[_0xe012('0x1b')]=_0x4b14b4[_0xe012('0x1b')]||0x0;this[_0xe012('0x18')]=_0x4b14b4['countabandonedretry']||0x0;this[_0xe012('0x19')]=_0x4b14b4[_0xe012('0x19')]||0x0;this[_0xe012('0x1a')]=_0x4b14b4[_0xe012('0x1a')]||0x0;this[_0xe012('0x1c')]=_0x4b14b4['callback'];this['callbackuniqueid']=_0x4b14b4[_0xe012('0x1d')];this[_0xe012('0x1e')]=_0x4b14b4['callbackat'];this[_0xe012('0x1f')]=_0x4b14b4['recallme'];this[_0xe012('0x20')]=_0x4b14b4[_0xe012('0x20')];this[_0xe012('0x21')]=_0x4b14b4['ListId'];this['UserId']=_['isNil'](_0x4b14b4[_0xe012('0x8')])?_0x4b14b4[_0xe012('0x22')]:_0x4b14b4[_0xe012('0x8')]['id'];this[_0xe012('0x23')]=_0x4b14b4['VoiceQueueId'];this['originatecalleridnum']='';this[_0xe012('0x24')]='';}Action[_0xe012('0x25')]['getCaller']=function(){return util[_0xe012('0xa')](_0xe012('0x26'),this[_0xe012('0xc')],this[_0xe012('0x27')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index ca55796..1ff8045 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','connect','acw','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','sumBillable','talktime','BUSY','outboundBusyCallsDay','countglobal','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','scheduledAt','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','[default]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','starttime','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','logLookAgent','responsetime','isFailure','response','idContact','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','destuniqueid','dialstatus','variables','filterKey','keys','addVariable','variable','value','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','bind','hanguprequest','syncDialEnd','syncVarSet','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','strategy','answered','available','pTalking','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','name','stringify','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','sendMessageOneNotActive','originated','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','syncCampaigns','clockClearZombieChannels','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','status','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','size','hasOwnProperty','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','logger2','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','[syncHangup][talking][increment]'];(function(_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 +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(_0x28c939,_0x110e29){var _0x527fe9=function(_0x1df2a6){while(--_0x1df2a6){_0x28c939['push'](_0x28c939['shift']());}};_0x527fe9(++_0x110e29);}(_0xe706,0xa3));var _0x6e70=function(_0x565404,_0x846949){_0x565404=_0x565404-0x0;var _0x2b0bb3=_0xe706[_0x565404];return _0x2b0bb3;};'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 2db5e4e..93877d7 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 _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 +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(_0x3c7347,_0x3aebf2){var _0x4c78cb=function(_0x43f589){while(--_0x43f589){_0x3c7347['push'](_0x3c7347['shift']());}};_0x4c78cb(++_0x3aebf2);}(_0x8958,0x93));var _0x8895=function(_0xb56705,_0x45c970){_0xb56705=_0xb56705-0x0;var _0x5eb94a=_0x8958[_0xb56705];return _0x5eb94a;};'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 ba4b478..bf18364 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 _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 +var _0x056a=['clone','statedesc','Global','scheduledat','minutes','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','filterKey','idContact','campaigntype','dialAnswer','active','countglobal','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','pow','replace','random','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','milliseconds','diff','seconds','loggerCatch','inspect','logger','loggerError','error','logger2','info','message','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','responsetime','logAgent','ringtime','starttime','logLookAgent','membername','logCustomer','endtime','answertime','isFailure','variablesAction','RECALL','BOOKED','channelAgent','xcally-motion-preview','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x056a,0x15a));var _0xa056=function(_0x2e6422,_0x47c0ed){_0x2e6422=_0x2e6422-0x0;var _0x2fbf89=_0x056a[_0x2e6422];return _0x2fbf89;};'use strict';var util=require(_0xa056('0x0'));var _=require(_0xa056('0x1'));var moment=require(_0xa056('0x2'));var logger=require(_0xa056('0x3'))(_0xa056('0x4'));var ipAgi=process[_0xa056('0x5')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x336591,_0x2fbd26){var _0x323367=moment(_0x336591)[_0xa056('0x6')](0x0);var _0x374846=moment(_0x2fbd26)[_0xa056('0x6')](0x0);return _0x323367[_0xa056('0x7')](_0x374846,_0xa056('0x8'));}exports[_0xa056('0x9')]=function(_0x48e968){return function(_0x50b126){logger['error'](_0x48e968,util[_0xa056('0xa')](_0x50b126,{'showHidden':![],'depth':null}));};};exports[_0xa056('0xb')]=function(_0xeafe35,_0x51ee85){logger['info'](_0xeafe35,util[_0xa056('0xa')](_0x51ee85,{'showHidden':![],'depth':null}));};exports[_0xa056('0xc')]=function(_0x2bb2ba,_0x366c3d){logger[_0xa056('0xd')](_0x2bb2ba,util[_0xa056('0xa')](_0x366c3d,{'showHidden':![],'depth':null}));};exports[_0xa056('0xe')]=function(_0x258c50){return function(_0x264f0a){logger[_0xa056('0xf')](_0x258c50,util[_0xa056('0xa')](_0x264f0a,{'showHidden':![],'depth':null}));};};exports[_0xa056('0x10')]=function(_0x4b3c28,_0x1a643e,_0x50755c){return{'message':_0x4b3c28,'unlock':_0x1a643e,'active':_0x50755c};};exports[_0xa056('0x11')]=function(_0x579bc4,_0x5eea3c,_0x35f562){if(!_[_0xa056('0x12')](_0x35f562)&&'string'===typeof _0x35f562&&!_[_0xa056('0x13')](_0x35f562)){if(!_[_0xa056('0x12')](_0x5eea3c)&&_0xa056('0x14')===typeof _0x5eea3c&&!_['isEmpty'](_0x5eea3c)){return util[_0xa056('0x15')]('\x22%s\x22\x20<%s>',_0x5eea3c,_0x35f562);}return util[_0xa056('0x15')](_0xa056('0x16'),_0x35f562,_0x35f562);}if(!_[_0xa056('0x12')](_0x579bc4)&&'string'===typeof _0x579bc4&&!_[_0xa056('0x13')](_0x579bc4)){return _0x579bc4;}return _0xa056('0x17');};exports[_0xa056('0x18')]=function(_0xab2803){if(_[_0xa056('0x19')](_0xab2803)){return![];}return _0xab2803;};exports[_0xa056('0x1a')]=function(_0x17b6b0,_0x1297a5,_0x5c74ee,_0x2ba0f7,_0x30269d,_0xc77a67){var _0x44c99f={'XMD-QUEUE':_0x1297a5[_0xa056('0x1b')]?_0x1297a5['Queue'][_0xa056('0x1c')]:'','XMD-CALLERID':_0x2ba0f7,'XMD-CALLERID-PREVIEW':_0xc77a67?util[_0xa056('0x15')](_0xa056('0x16'),_0xc77a67[_0xa056('0x1d')],_0xc77a67[_0xa056('0x1e')]):_0x2ba0f7,'XMD-DIALID':_0x30269d,'XMD-CONTACTID':_0x1297a5[_0xa056('0x1f')],'XMD-CDRTYPE':_0xa056('0x20'),'CALLERID(all)':_0x2ba0f7,'XMD-VOICEQUEUEID':_0x1297a5['VoiceQueueId'],'XMD-DIALCHANNEL':_0x5c74ee,'XMD-DIALTIMEOUT':_0x17b6b0[_0xa056('0x21')]||0x1e,'XMD-DIALOPTIONS':util[_0xa056('0x15')](_0xa056('0x22'),_0x17b6b0['dialQueueProject2']?'g':'',_[_0xa056('0x13')](_0x17b6b0['monitor_format'])?'':_0xa056('0x23')),'XMD-DIALURL':_0x17b6b0[_0xa056('0x24')]||'','XMD-AGI':_0x17b6b0[_0xa056('0x25')]?util[_0xa056('0x15')](_0xa056('0x26'),ipAgi,_0x17b6b0[_0xa056('0x25')]):_0xa056('0x27'),'XMD-AGIAFTER':_0x17b6b0['dialQueueProject2']?util[_0xa056('0x15')](_0xa056('0x26'),ipAgi,_0x17b6b0['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0xc77a67?_0xc77a67[_0xa056('0x28')]:'','XMD-ORIGINATECALLERIDNAME':_0xc77a67?_0xc77a67['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_['isEmpty'](_0x17b6b0[_0xa056('0x29')])){_0x44c99f[util[_0xa056('0x15')]('%s',_0xa056('0x2a'))]=_0x17b6b0['monitor_format'];_0x44c99f[util[_0xa056('0x15')]('%s',_0xa056('0x2b'))]=_0x30269d;}if(_0x1297a5&&_0x1297a5['Contact']){for(var _0x4f0df9 in _0x1297a5[_0xa056('0x2c')]){if(_0x1297a5[_0xa056('0x2c')][_0xa056('0x2d')](_0x4f0df9)){if(!_[_0xa056('0x19')](_0x1297a5[_0xa056('0x2c')][_0x4f0df9])&&_0x4f0df9!=='id'&&_0x4f0df9!==_0xa056('0x2e')&&_0x4f0df9!==_0xa056('0x2f')&&_0x4f0df9!==_0xa056('0x30')){_0x44c99f[util['format'](_0xa056('0x31'),_0xa056('0x32'),_[_0xa056('0x33')](_0x4f0df9))]=_0x1297a5[_0xa056('0x2c')][_0x4f0df9];}}}}return _0x44c99f;};exports[_0xa056('0x34')]=function(_0x420ffe){var _0x3f66a6={};for(var _0x45ba8c in _0x420ffe){if(_0x420ffe['hasOwnProperty'](_0x45ba8c)){_0x3f66a6[util['format']('%s',_['toLower'](_0x45ba8c))]=_0x420ffe[_0x45ba8c];}}return{'variables':_0x3f66a6};};exports[_0xa056('0x35')]=function(_0x2b9e56,_0x3fddc4){if(!_['isNil'](_0x2b9e56)){if(_0x2b9e56[_0xa056('0x2d')]('originated')){if(_0x2b9e56[_0xa056('0x36')]>0x0){_0x2b9e56[_0xa056('0x36')]-=0x1;}else{logger[_0xa056('0xd')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x3fddc4);}}}else{logger[_0xa056('0xd')](_0xa056('0x37'),_0x3fddc4);}};exports[_0xa056('0x38')]=function(_0x559b86){var _0xc350db=moment()['format'](_0xa056('0x39'));_0x559b86[_0xa056('0x3a')]=0xd;_0x559b86['statedesc']='Blacklist';_0x559b86['starttime']=_0xc350db;_0x559b86[_0xa056('0x3b')]=_0xc350db;_0x559b86['endtime']=_0xc350db;};exports[_0xa056('0x3c')]=function(_0x2dd57d,_0x4cf25d,_0x475c0d){var _0x3ce7c1=moment()[_0xa056('0x15')](_0xa056('0x39'));_0x2dd57d['state']=_0x4cf25d;_0x2dd57d['statedesc']=_0x475c0d;_0x2dd57d[_0xa056('0x3b')]=_0x3ce7c1;_0x2dd57d[_0xa056('0x3d')]=getSeconds(_0x2dd57d['responsetime'],_0x2dd57d[_0xa056('0x3e')]);};exports[_0xa056('0x3f')]=function(_0x3fa97d,_0x20d45a,_0x26619b){_0x3fa97d[_0xa056('0x40')]=_0x20d45a;_0x3fa97d['UserId']=_0x26619b;};exports[_0xa056('0x41')]=function(_0x3049a4,_0x3d603b,_0x7a5197){var _0x1212e4=moment()[_0xa056('0x15')](_0xa056('0x39'));_0x3049a4[_0xa056('0x3a')]=_0x3d603b;_0x3049a4['statedesc']=_0x7a5197;_0x3049a4[_0xa056('0x3b')]=_0x3049a4[_0xa056('0x3b')]?_0x3049a4['responsetime']:_0x1212e4;_0x3049a4['endtime']=_0x3049a4[_0xa056('0x42')]?_0x3049a4[_0xa056('0x42')]:_0x1212e4;_0x3049a4[_0xa056('0x3d')]=getSeconds(_0x3049a4[_0xa056('0x3b')]||0x0,_0x3049a4[_0xa056('0x3e')]||0x0);_0x3049a4['talktime']=_0x3049a4['answertime']?getSeconds(_0x3049a4[_0xa056('0x42')],_0x3049a4[_0xa056('0x43')]):0x0;};exports[_0xa056('0x44')]=function(_0x50550a){return _0x50550a==='Failure';};exports[_0xa056('0x45')]=function(_0x2e3c6d,_0x31e901,_0x18bea4,_0x4458d7,_0x103b80){var _0x37d814=_0x4458d7?_0xa056('0x46'):_0x2e3c6d[_0xa056('0x1d')];_0x37d814=_0x103b80?_0xa056('0x47'):_0x37d814;return{'actionid':_0x2e3c6d['uniqueid'],'action':'originate','channel':_0x2e3c6d[_0xa056('0x48')],'callerid':util['format'](_0xa056('0x16'),_0x37d814,_0x2e3c6d[_0xa056('0x1e')]),'Exten':_0xa056('0x49'),'Context':'from-sip','Priority':'1','variable':_0x18bea4,'timeout':(_0x31e901[_0xa056('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2e3c6d[_0xa056('0x4b')]};};exports[_0xa056('0x4c')]=function(_0x1cecb7){return _0x1cecb7[_0xa056('0x4d')]+_0x1cecb7[_0xa056('0x4e')]+_0x1cecb7[_0xa056('0x4f')]+_0x1cecb7[_0xa056('0x50')]+_0x1cecb7[_0xa056('0x51')];};exports[_0xa056('0x52')]=function(_0x250050){var _0x27a1e2=_[_0xa056('0x53')](_0x250050);_0x27a1e2['state']=0xf;_0x27a1e2[_0xa056('0x54')]=_0xa056('0x55');return _0x27a1e2;};exports['scheduledAt']=function(_0x17e07e,_0xe26e35,_0x3e36bd){var _0x530052={};_0x530052[_0xe26e35]=_0x17e07e[_0xe26e35];_0x530052['active']=![];_0x530052[_0xa056('0x56')]=moment()['add'](_0x3e36bd,_0xa056('0x57'))['format'](_0xa056('0x39'));_0x530052[_0xa056('0x1f')]=_0x17e07e['ContactId'];_0x530052[_0xa056('0x58')]=_0x17e07e[_0xa056('0x58')];_0x530052[_0xa056('0x59')]=_0x17e07e[_0xa056('0x59')]||undefined;return _0x530052;};exports['decrementTalkink']=function(_0x1bea53,_0x331cc4){if(!_['isNil'](_0x1bea53)){if(_0x1bea53[_0xa056('0x5a')]>0x0){_0x1bea53[_0xa056('0x5a')]-=0x1;}else{logger[_0xa056('0xd')](_0x331cc4,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x331cc4,_0xa056('0x5b'));}};exports['IsNotLoggedIn']=function(_0x2e5773){if(_0x2e5773<=0x0){return!![];}return![];};exports[_0xa056('0x5c')]=function(_0x2fba4b,_0xf703b5,_0x10be42){_0x2fba4b[_0xa056('0x5d')]=_0xf703b5;_0x2fba4b['name']=_0x2fba4b[_0xa056('0x5e')];_0x2fba4b[_0xa056('0x5f')]=_0x2fba4b[_0xa056('0x48')];if(_0x10be42){_0x2fba4b[_0xa056('0x60')]=_0x10be42[_0xa056('0x60')];}return _0x2fba4b;};exports[_0xa056('0x61')]=function(_0x5263c2){var _0x5837cb={};_0x5837cb[_0xa056('0x5e')]=_0x5263c2[_0xa056('0x5e')];_0x5837cb[_0xa056('0x5f')]=_0x5263c2[_0xa056('0x48')];_0x5837cb[_0xa056('0x4b')]=_0x5263c2[_0xa056('0x4b')];return _0x5837cb;};exports[_0xa056('0x62')]=function(_0x3ff0db){var _0x4f2ebc=[];for(var _0x2fecf6 in _0x3ff0db){if(_0x3ff0db[_0xa056('0x2d')](_0x2fecf6)){if(!_[_0xa056('0x19')](_0x3ff0db[_0x2fecf6])&&_0x3ff0db[_0x2fecf6]['state']===_0xa056('0x63')&&_0x3ff0db[_0x2fecf6][_0xa056('0x64')]===_0xa056('0x65')){_0x4f2ebc[_0xa056('0x66')](_0x3ff0db[_0x2fecf6]['id']);}}}return _0x4f2ebc;};exports[_0xa056('0x67')]=function(_0x22627b){var _0x361522=moment()[_0xa056('0x6')](0x0);var _0x3b6508=moment(_0x22627b)[_0xa056('0x6')](0x0);return _0x361522[_0xa056('0x7')](_0x3b6508,_0xa056('0x8'));};exports[_0xa056('0x68')]=function(_0x24478f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x24478f[_0xa056('0x1f')],'ListId':_0x24478f[_0xa056('0x58')],'VoiceQueueId':_0x24478f['VoiceQueueId']||undefined,'CampaignId':_0x24478f['CampaignId']||undefined};};exports[_0xa056('0x69')]=function(_0x58a877){if(_0x58a877==='uniqueid'||_0x58a877===_0xa056('0x6a')||_0x58a877===_0xa056('0x5e')||_0x58a877==='type'||_0x58a877===_0xa056('0x6b')||_0x58a877===_0xa056('0x6c')||_0x58a877===_0xa056('0x40')||_0x58a877==='channelAgent'||_0x58a877===_0xa056('0x1d')||_0x58a877===_0xa056('0x6d')||_0x58a877==='calleridnum'||_0x58a877===_0xa056('0x56')||_0x58a877==='countbusyretry'||_0x58a877==='countcongestionretry'||_0x58a877===_0xa056('0x4f')||_0x58a877===_0xa056('0x6e')||_0x58a877===_0xa056('0x6f')||_0x58a877==='callbackuniqueid'||_0x58a877===_0xa056('0x70')||_0x58a877===_0xa056('0x71')||_0x58a877===_0xa056('0x1f')||_0x58a877==='ListId'||_0x58a877==='UserId'||_0x58a877===_0xa056('0x59')||_0x58a877===_0xa056('0x72')||_0x58a877===_0xa056('0x73')||_0x58a877===_0xa056('0x74')||_0x58a877===_0xa056('0x75')||_0x58a877===_0xa056('0x76')||_0x58a877===_0xa056('0x77')||_0x58a877===_0xa056('0x78')||_0x58a877===_0xa056('0x79')||_0x58a877===_0xa056('0x7a')||_0x58a877===_0xa056('0x7b')||_0x58a877===_0xa056('0x7c')||_0x58a877===_0xa056('0x7d')||_0x58a877==='xmd-callerid'||_0x58a877===_0xa056('0x7e')||_0x58a877===_0xa056('0x7f')||_0x58a877===_0xa056('0x80')||_0x58a877===_0xa056('0x81')||_0x58a877===_0xa056('0x82')||_0x58a877==='rtpaudioqosjitterbridged'||_0x58a877===_0xa056('0x83')||_0x58a877==='rtpaudioqoslossbridged'||_0x58a877===_0xa056('0x84')||_0x58a877===_0xa056('0x85')||_0x58a877==='rtpaudioqos'||_0x58a877===_0xa056('0x81')||_0x58a877==='rtpaudioqosjitter'||_0x58a877===_0xa056('0x86')||_0x58a877==='rtpaudioqosloss'||_0x58a877===_0xa056('0x87')||_0x58a877===_0xa056('0x84')||_0x58a877===_0xa056('0x85')||_0x58a877===_0xa056('0x88')||_0x58a877===_0xa056('0x89')||_0x58a877==='state'||_0x58a877===_0xa056('0x54')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x1a7971,_0x2a80b7){var _0x201495,_0x2d3fb3,_0x2d6871;if(_0x2a80b7<=0x0){_0x2a80b7=0x1;}_0x201495=new RegExp('\x5cw{0,'+_0x2a80b7+'}$');_0x2d3fb3=Math[_0xa056('0x8a')](0xa,_0x2a80b7-0x1);_0x2d6871=Math[_0xa056('0x8a')](0xa,_0x2a80b7)-0x1;return util[_0xa056('0x15')]('%s',_[_0xa056('0x8b')](_0x1a7971,_0x201495,_[_0xa056('0x8c')](_0x2d3fb3,_0x2d6871)));};exports['extractCalleridName']=function(_0x5198d8){var _0x2e0e97=_0x5198d8[_0xa056('0x8d')](/"(.*?)"/);return _0x2e0e97?_0x2e0e97[0x1]:_0x5198d8;};exports[_0xa056('0x8e')]=function(_0x1e8b4b){var _0x3a69ed=_0x1e8b4b[_0xa056('0x8d')](/<(.*?)>/);return _0x3a69ed?_0x3a69ed[0x1]:_0x1e8b4b;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index af0f1b1..41e734b 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(_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 +var _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x361939,_0x8e80f1){var _0x692ba9=function(_0x527172){while(--_0x527172){_0x361939['push'](_0x361939['shift']());}};_0x692ba9(++_0x8e80f1);}(_0x7a54,0x106));var _0x47a5=function(_0x3e8947,_0x3027d4){_0x3e8947=_0x3e8947-0x0;var _0x197d14=_0x7a54[_0x3e8947];return _0x197d14;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index ade30da..4d51faa 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 _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 +var _0x1663=['initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','deskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','queuecallerabandonAt','queuecallerexitAt','diff','seconds','queuecallercomplete','queuecallercompleteAt','sumDuration','initVoiceCallReports','duration','disposition','ANSWERED','outbound','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','campaigns','templates','channels','queueChannels','outboundChannels','salesforceAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','SIP/%s','name','interface','total','answered','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTriggers','triggers','initTemplates','zendeskAccounts'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x1663,0x95));var _0x3166=function(_0x644fcc,_0x337d0d){_0x644fcc=_0x644fcc-0x0;var _0x1e148c=_0x1663[_0x644fcc];return _0x1e148c;};'use strict';var BPromise=require('bluebird');var util=require(_0x3166('0x0'));var _=require('lodash');var moment=require(_0x3166('0x1'));var Agent=require('../model/agent');var Telephone=require(_0x3166('0x2'));var Trunk=require(_0x3166('0x3'));var VoiceQueue=require(_0x3166('0x4'));var Trigger=require(_0x3166('0x5'));var Template=require(_0x3166('0x6'));var Campaign=require(_0x3166('0x7'));var VoiceExtension=require(_0x3166('0x8'));var ZendeskAccount=require(_0x3166('0x9'));var SalesforceAccount=require(_0x3166('0xa'));var FreshdeskAccount=require(_0x3166('0xb'));var SugarcrmAccount=require(_0x3166('0xc'));var ZohoAccount=require(_0x3166('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x3166('0xe'));var Dynamics365Account=require(_0x3166('0xf'));var FreshsalesAccount=require(_0x3166('0x10'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x3166('0x11')]={};this[_0x3166('0x12')]={};this[_0x3166('0x13')]={};this[_0x3166('0x14')]={};this['triggers']={};this[_0x3166('0x15')]={};this[_0x3166('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x3166('0x17')]={};this[_0x3166('0x18')]={};this[_0x3166('0x19')]={};this['timers']={};this['zendeskAccounts']={};this[_0x3166('0x1a')]={};this['sugarcrmAccounts']={};this[_0x3166('0x1b')]={};this[_0x3166('0x1c')]={};this['deskAccounts']={};this[_0x3166('0x1d')]={};this[_0x3166('0x1e')]={};this['dynamics365Accounts']={};this[_0x3166('0x1f')]={};this[_0x3166('0x20')]={};};function freeIsNotKey(_0x572f51,_0x4a40f0,_0x5489b1){var _0x3603e8=_['mapKeys'](_0x572f51,function(_0x224930,_0x8e7cb5){return _0x224930[_0x5489b1];});for(var _0x3e11ed in _0x4a40f0){if(_0x4a40f0[_0x3166('0x21')](_0x3e11ed)){if(!_0x3603e8[_0x3e11ed]){delete _0x4a40f0[_0x3e11ed];}}}}function freeIsNotKeySip(_0xae0868,_0x317a62){var _0x3aeabf=_[_0x3166('0x22')](_0xae0868,function(_0x10c2a9,_0x2f983d){return util[_0x3166('0x23')](_0x3166('0x24'),_0x10c2a9[_0x3166('0x25')]);});for(var _0x396c6a in _0x317a62){if(_0x317a62[_0x3166('0x21')](_0x396c6a)){if(!_0x3aeabf[_0x396c6a]){delete _0x317a62[_0x396c6a];}}}}function freeIsNotKeyAgent(_0x1d0b61,_0x36174d){var _0x28995c=_['mapKeys'](_0x1d0b61,function(_0x3ece7f,_0x41958f){var _0x9b587d=_['isNil'](_0x3ece7f['interface'])?util[_0x3166('0x23')](_0x3166('0x24'),_0x3ece7f[_0x3166('0x25')]):_0x3ece7f[_0x3166('0x26')];return _0x9b587d;});for(var _0x537884 in _0x36174d){if(_0x36174d[_0x3166('0x21')](_0x537884)){if(!_0x28995c[_0x537884]){delete _0x36174d[_0x537884];}}}}function clearVoiceCallReports(_0x306d30){_0x306d30[_0x3166('0x27')]=0x0;_0x306d30[_0x3166('0x28')]=0x0;_0x306d30['sumHoldTime']=0x0;_0x306d30['sumDuration']=0x0;_0x306d30[_0x3166('0x29')]=0x0;}function clearCampaigns(_0x403e23){if(!_[_0x3166('0x2a')](_0x403e23)){for(var _0x4dfc84 in _0x403e23){if(_0x403e23['hasOwnProperty'](_0x4dfc84)){_0x403e23[_0x4dfc84]['ivrTotalCallsDays']=0x0;_0x403e23[_0x4dfc84][_0x3166('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x33fed5){if(!_[_0x3166('0x2a')](_0x33fed5)){for(var _0x14bd96 in _0x33fed5){if(_0x33fed5['hasOwnProperty'](_0x14bd96)){_0x33fed5[_0x14bd96][_0x3166('0x27')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x28')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x2c')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x2d')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x2e')]=0x0;_0x33fed5[_0x14bd96]['sumDuration']=0x0;_0x33fed5[_0x14bd96][_0x3166('0x29')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x2f')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x30')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x31')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x32')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x33')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x34')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x35')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x36')]=0x0;_0x33fed5[_0x14bd96]['outboundBlacklistCallsDay']=0x0;_0x33fed5[_0x14bd96][_0x3166('0x37')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x38')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x39')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x2f')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x3a')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x3b')]=!![];}}}}Realtime['prototype'][_0x3166('0x3c')]=function(_0x1b7ab8,_0x3b067a){for(var _0x50e714 in _0x3b067a){if(_0x1b7ab8[_0x3166('0x21')](_0x50e714)){_0x1b7ab8[_0x50e714]=_0x3b067a[_0x50e714];}}};Realtime[_0x3166('0x3d')][_0x3166('0x3e')]=function(){var _0x2b8a53=this;return function(_0x3fdb4a){if(_0x3fdb4a){freeIsNotKeyAgent(_0x3fdb4a,_0x2b8a53[_0x3166('0x11')]);for(var _0x452f06=0x0,_0x117a98={},_0x58b035={};_0x452f06<_0x3fdb4a[_0x3166('0x3f')];_0x452f06+=0x1){_0x117a98=_0x3fdb4a[_0x452f06];var _0x565fea=_[_0x3166('0x40')](_0x117a98[_0x3166('0x26')])?util[_0x3166('0x23')]('SIP/%s',_0x117a98['name']):_0x117a98['interface'];if(_[_0x3166('0x41')](_0x2b8a53['agents'][_0x565fea])){_0x2b8a53[_0x3166('0x11')][_0x565fea]=new Agent(_0x117a98);}else{_0x2b8a53[_0x3166('0x3c')](_0x2b8a53['agents'][_0x565fea],_0x117a98);}}}return _0x2b8a53[_0x3166('0x11')];};};Realtime[_0x3166('0x3d')][_0x3166('0x42')]=function(){var _0x7a8ffc=this;return function(_0x2c6ef0){if(_0x2c6ef0){freeIsNotKeySip(_0x2c6ef0,_0x7a8ffc[_0x3166('0x12')]);for(var _0x3a03dd=0x0,_0x2c0380={},_0x194f95={};_0x3a03dd<_0x2c6ef0[_0x3166('0x3f')];_0x3a03dd+=0x1){_0x2c0380=_0x2c6ef0[_0x3a03dd];if(_['isUndefined'](_0x7a8ffc[_0x3166('0x12')][util[_0x3166('0x23')](_0x3166('0x24'),_0x2c0380[_0x3166('0x25')])])){_0x7a8ffc[_0x3166('0x12')][util[_0x3166('0x23')](_0x3166('0x24'),_0x2c0380[_0x3166('0x25')])]=new Telephone(_0x2c0380);}else{_0x7a8ffc['mergeFromDatabase'](_0x7a8ffc[_0x3166('0x12')][util[_0x3166('0x23')](_0x3166('0x24'),_0x2c0380['name'])],_0x2c0380);}}}return _0x7a8ffc[_0x3166('0x12')];};};Realtime['prototype'][_0x3166('0x43')]=function(){var _0x270e36=this;return function(_0xdebf79){if(_0xdebf79){freeIsNotKeySip(_0xdebf79,_0x270e36[_0x3166('0x13')]);for(var _0x915e22=0x0,_0x588b99={},_0xa93109={};_0x915e22<_0xdebf79[_0x3166('0x3f')];_0x915e22+=0x1){_0x588b99=_0xdebf79[_0x915e22];if(_[_0x3166('0x41')](_0x270e36[_0x3166('0x13')][util['format'](_0x3166('0x24'),_0x588b99[_0x3166('0x25')])])){_0x270e36['trunks'][util[_0x3166('0x23')](_0x3166('0x24'),_0x588b99[_0x3166('0x25')])]=new Trunk(_0x588b99);}else{_0x270e36['mergeFromDatabase'](_0x270e36[_0x3166('0x13')][util['format'](_0x3166('0x24'),_0x588b99[_0x3166('0x25')])],_0x588b99);}}}return _0x270e36[_0x3166('0x13')];};};Realtime[_0x3166('0x3d')][_0x3166('0x44')]=function(){var _0x37b3b2=this;return function(_0x44dc8b){if(_0x44dc8b){freeIsNotKey(_0x44dc8b,_0x37b3b2['voiceQueues'],_0x3166('0x25'));for(var _0x36b466=0x0,_0x54aea1={},_0x293360={};_0x36b466<_0x44dc8b[_0x3166('0x3f')];_0x36b466+=0x1){_0x54aea1=_0x44dc8b[_0x36b466];if(_[_0x3166('0x41')](_0x37b3b2[_0x3166('0x14')][_0x54aea1[_0x3166('0x25')]])){_0x37b3b2[_0x3166('0x14')][_0x54aea1[_0x3166('0x25')]]=new VoiceQueue(_0x54aea1);}else{_0x37b3b2[_0x3166('0x3c')](_0x37b3b2[_0x3166('0x14')][_0x54aea1[_0x3166('0x25')]],_0x54aea1);}}}return _0x37b3b2[_0x3166('0x14')];};};Realtime[_0x3166('0x3d')][_0x3166('0x45')]=function(){var _0x86f676=this;return function(_0x480cef){if(_0x480cef){freeIsNotKey(_0x480cef,_0x86f676[_0x3166('0x46')],'id');for(var _0x3ee4f1=0x0,_0x4a432a={},_0x18f460={};_0x3ee4f1<_0x480cef[_0x3166('0x3f')];_0x3ee4f1+=0x1){_0x4a432a=_0x480cef[_0x3ee4f1];if(_[_0x3166('0x41')](_0x86f676[_0x3166('0x46')][_0x4a432a['id']])){_0x86f676[_0x3166('0x46')][_0x4a432a['id']]=new Trigger(_0x4a432a);}else{_0x86f676['mergeFromDatabase'](_0x86f676[_0x3166('0x46')][_0x4a432a['id']],_0x4a432a);}}}return _0x86f676[_0x3166('0x46')];};};Realtime[_0x3166('0x3d')][_0x3166('0x47')]=function(){var _0x911d40=this;return function(_0x237b5b){if(_0x237b5b){freeIsNotKey(_0x237b5b,_0x911d40[_0x3166('0x16')],'id');for(var _0x3e4738=0x0,_0x5a4878={},_0x15f83e={};_0x3e4738<_0x237b5b[_0x3166('0x3f')];_0x3e4738+=0x1){_0x5a4878=_0x237b5b[_0x3e4738];if(_[_0x3166('0x41')](_0x911d40[_0x3166('0x16')][_0x5a4878['id']])){_0x911d40[_0x3166('0x16')][_0x5a4878['id']]=new Template(_0x5a4878);}else{_0x911d40[_0x3166('0x3c')](_0x911d40[_0x3166('0x16')][_0x5a4878['id']],_0x5a4878);}}}return _0x911d40[_0x3166('0x16')];};};Realtime[_0x3166('0x3d')]['initZendeskAccounts']=function(){var _0x897dc1=this;return function(_0x1268b3){if(_0x1268b3){freeIsNotKey(_0x1268b3,_0x897dc1[_0x3166('0x48')],'id');for(var _0xd57433=0x0,_0x5f1ef3={},_0x282c88={};_0xd57433<_0x1268b3[_0x3166('0x3f')];_0xd57433+=0x1){_0x5f1ef3=_0x1268b3[_0xd57433];if(_[_0x3166('0x41')](_0x897dc1[_0x3166('0x48')][_0x5f1ef3['id']])){_0x897dc1[_0x3166('0x48')][_0x5f1ef3['id']]=new ZendeskAccount(_0x5f1ef3);}else{_0x897dc1[_0x3166('0x3c')](_0x897dc1[_0x3166('0x48')][_0x5f1ef3['id']],_0x5f1ef3);}}}return _0x897dc1[_0x3166('0x48')];};};Realtime[_0x3166('0x3d')][_0x3166('0x49')]=function(){var _0x3da1b3=this;return function(_0x2322fe){if(_0x2322fe){freeIsNotKey(_0x2322fe,_0x3da1b3[_0x3166('0x1a')],'id');for(var _0x237fe6=0x0,_0x4892a6={},_0x369908={};_0x237fe6<_0x2322fe[_0x3166('0x3f')];_0x237fe6+=0x1){_0x4892a6=_0x2322fe[_0x237fe6];if(_[_0x3166('0x41')](_0x3da1b3[_0x3166('0x1a')][_0x4892a6['id']])){_0x3da1b3[_0x3166('0x1a')][_0x4892a6['id']]=new SalesforceAccount(_0x4892a6);}else{_0x3da1b3['mergeFromDatabase'](_0x3da1b3[_0x3166('0x1a')][_0x4892a6['id']],_0x4892a6);}}}return _0x3da1b3['salesforceAccounts'];};};Realtime[_0x3166('0x3d')][_0x3166('0x4a')]=function(){var _0x1f4ba4=this;return function(_0x4f56ed){if(_0x4f56ed){freeIsNotKey(_0x4f56ed,_0x1f4ba4['freshdeskAccounts'],'id');for(var _0x239b52=0x0,_0x539240={},_0x443a85={};_0x239b52<_0x4f56ed[_0x3166('0x3f')];_0x239b52+=0x1){_0x539240=_0x4f56ed[_0x239b52];if(_[_0x3166('0x41')](_0x1f4ba4[_0x3166('0x1b')][_0x539240['id']])){_0x1f4ba4['freshdeskAccounts'][_0x539240['id']]=new FreshdeskAccount(_0x539240);}else{_0x1f4ba4[_0x3166('0x3c')](_0x1f4ba4[_0x3166('0x1b')][_0x539240['id']],_0x539240);}}}return _0x1f4ba4[_0x3166('0x1b')];};};Realtime[_0x3166('0x3d')][_0x3166('0x4b')]=function(){var _0x5850e8=this;return function(_0x5b70f8){if(_0x5b70f8){freeIsNotKey(_0x5b70f8,_0x5850e8[_0x3166('0x1c')],'id');for(var _0x4b86bd=0x0,_0x4471ed={},_0x1c17ba={};_0x4b86bd<_0x5b70f8[_0x3166('0x3f')];_0x4b86bd+=0x1){_0x4471ed=_0x5b70f8[_0x4b86bd];if(_[_0x3166('0x41')](_0x5850e8[_0x3166('0x1c')][_0x4471ed['id']])){_0x5850e8[_0x3166('0x1c')][_0x4471ed['id']]=new ZohoAccount(_0x4471ed);}else{_0x5850e8[_0x3166('0x3c')](_0x5850e8['zohoAccounts'][_0x4471ed['id']],_0x4471ed);}}}return _0x5850e8[_0x3166('0x1c')];};};Realtime[_0x3166('0x3d')]['initDeskAccounts']=function(){var _0x48e747=this;return function(_0x1f470a){if(_0x1f470a){freeIsNotKey(_0x1f470a,_0x48e747[_0x3166('0x4c')],'id');for(var _0x217571=0x0,_0x45e3a4={},_0x1867ba={};_0x217571<_0x1f470a[_0x3166('0x3f')];_0x217571+=0x1){_0x45e3a4=_0x1f470a[_0x217571];if(_[_0x3166('0x41')](_0x48e747[_0x3166('0x4c')][_0x45e3a4['id']])){_0x48e747[_0x3166('0x4c')][_0x45e3a4['id']]=new DeskAccount(_0x45e3a4);}else{_0x48e747[_0x3166('0x3c')](_0x48e747['deskAccounts'][_0x45e3a4['id']],_0x45e3a4);}}}return _0x48e747[_0x3166('0x4c')];};};Realtime[_0x3166('0x3d')][_0x3166('0x4d')]=function(){var _0x548b11=this;return function(_0x3e164c){if(_0x3e164c){freeIsNotKey(_0x3e164c,_0x548b11['sugarcrmAccounts'],'id');for(var _0x3651fb=0x0,_0x32596f={},_0xd25035={};_0x3651fb<_0x3e164c[_0x3166('0x3f')];_0x3651fb+=0x1){_0x32596f=_0x3e164c[_0x3651fb];if(_[_0x3166('0x41')](_0x548b11[_0x3166('0x4e')][_0x32596f['id']])){_0x548b11[_0x3166('0x4e')][_0x32596f['id']]=new SugarcrmAccount(_0x32596f);}else{_0x548b11[_0x3166('0x3c')](_0x548b11[_0x3166('0x4e')][_0x32596f['id']],_0x32596f);}}}return _0x548b11['sugarcrmAccounts'];};};Realtime[_0x3166('0x3d')][_0x3166('0x4f')]=function(){var _0x585809=this;return function(_0x2ca67d){if(_0x2ca67d){freeIsNotKey(_0x2ca67d,_0x585809[_0x3166('0x1d')],'id');for(var _0x10f2d1=0x0,_0x56454b={},_0x7920ec={};_0x10f2d1<_0x2ca67d[_0x3166('0x3f')];_0x10f2d1+=0x1){_0x56454b=_0x2ca67d[_0x10f2d1];if(_[_0x3166('0x41')](_0x585809[_0x3166('0x1d')][_0x56454b['id']])){_0x585809[_0x3166('0x1d')][_0x56454b['id']]=new VtigerAccount(_0x56454b);}else{_0x585809[_0x3166('0x3c')](_0x585809[_0x3166('0x1d')][_0x56454b['id']],_0x56454b);}}}return _0x585809[_0x3166('0x1d')];};};Realtime[_0x3166('0x3d')][_0x3166('0x50')]=function(){var _0x54d044=this;return function(_0x4ed3a1){if(_0x4ed3a1){freeIsNotKey(_0x4ed3a1,_0x54d044['servicenowAccounts'],'id');for(var _0x42e428=0x0,_0x2eb6a3={},_0x468676={};_0x42e428<_0x4ed3a1[_0x3166('0x3f')];_0x42e428+=0x1){_0x2eb6a3=_0x4ed3a1[_0x42e428];if(_[_0x3166('0x41')](_0x54d044[_0x3166('0x1e')][_0x2eb6a3['id']])){_0x54d044[_0x3166('0x1e')][_0x2eb6a3['id']]=new ServicenowAccount(_0x2eb6a3);}else{_0x54d044[_0x3166('0x3c')](_0x54d044[_0x3166('0x1e')][_0x2eb6a3['id']],_0x2eb6a3);}}}return _0x54d044[_0x3166('0x1e')];};};Realtime['prototype'][_0x3166('0x51')]=function(){var _0x2f09a0=this;return function(_0x4fe5d2){if(_0x4fe5d2){freeIsNotKey(_0x4fe5d2,_0x2f09a0[_0x3166('0x52')],'id');for(var _0x439606=0x0,_0x375697={},_0x45ad89={};_0x439606<_0x4fe5d2[_0x3166('0x3f')];_0x439606+=0x1){_0x375697=_0x4fe5d2[_0x439606];if(_[_0x3166('0x41')](_0x2f09a0[_0x3166('0x52')][_0x375697['id']])){_0x2f09a0[_0x3166('0x52')][_0x375697['id']]=new Dynamics365Account(_0x375697);}else{_0x2f09a0['mergeFromDatabase'](_0x2f09a0[_0x3166('0x52')][_0x375697['id']],_0x375697);}}}return _0x2f09a0[_0x3166('0x52')];};};Realtime['prototype']['initFreshsalesAccounts']=function(){var _0x229829=this;return function(_0x2fe38e){if(_0x2fe38e){freeIsNotKey(_0x2fe38e,_0x229829[_0x3166('0x1f')],'id');for(var _0x4b9a23=0x0,_0x540920={},_0xf02273={};_0x4b9a23<_0x2fe38e[_0x3166('0x3f')];_0x4b9a23+=0x1){_0x540920=_0x2fe38e[_0x4b9a23];if(_[_0x3166('0x41')](_0x229829[_0x3166('0x1f')][_0x540920['id']])){_0x229829[_0x3166('0x1f')][_0x540920['id']]=new FreshsalesAccount(_0x540920);}else{_0x229829['mergeFromDatabase'](_0x229829[_0x3166('0x1f')][_0x540920['id']],_0x540920);}}}return _0x229829[_0x3166('0x1f')];};};Realtime[_0x3166('0x3d')]['initVoiceQueueHopperHistory']=function(){var _0x2fbb26=this;return function(_0x4d10e7){for(var _0x167f3c=0x0;_0x167f3c<_0x4d10e7['length'];_0x167f3c+=0x1){_[_0x3166('0x53')](_0x2fbb26[_0x3166('0x14')][_0x4d10e7[_0x167f3c][_0x3166('0x25')]],_0x4d10e7[_0x167f3c]);}return _0x2fbb26[_0x3166('0x14')];};};Realtime['prototype'][_0x3166('0x54')]=function(){var _0x2033eb=this;return function(_0x232a2e){clearVoiceQueues(_0x2033eb['voiceQueues']);if(_0x232a2e){_0x232a2e=_[_0x3166('0x55')](_0x232a2e,_0x3166('0x56'));for(var _0x122d7a in _0x232a2e){if(_0x232a2e[_0x3166('0x21')](_0x122d7a)){var _0x3fa549={};for(var _0x364d1e=0x0;_0x364d1e<_0x232a2e[_0x122d7a][_0x3166('0x3f')];_0x364d1e+=0x1){var _0x39cfc1=_0x232a2e[_0x122d7a][_0x364d1e]['queue'];if(_0x2033eb[_0x3166('0x14')][_0x39cfc1]){if(_0x232a2e[_0x122d7a][_0x364d1e][_0x3166('0x57')]){_0x2033eb[_0x3166('0x14')][_0x39cfc1][_0x3166('0x2c')]+=0x1;}if(_0x232a2e[_0x122d7a][_0x364d1e][_0x3166('0x58')]){_0x2033eb[_0x3166('0x14')][_0x39cfc1][_0x3166('0x2d')]+=0x1;}_0x2033eb[_0x3166('0x14')][_0x39cfc1][_0x3166('0x2e')]+=moment(_0x232a2e[_0x122d7a][_0x364d1e][_0x3166('0x59')])['diff'](moment(_0x232a2e[_0x122d7a][_0x364d1e][_0x3166('0x5a')]),'seconds')||0x0;if(_0x364d1e===_0x232a2e[_0x122d7a][_0x3166('0x3f')]-0x1){_0x2033eb[_0x3166('0x14')][_0x39cfc1]['sumDuration']+=moment(_0x232a2e[_0x122d7a][_0x364d1e]['queuecallercompleteAt']||_0x232a2e[_0x122d7a][_0x364d1e][_0x3166('0x5b')]||_0x232a2e[_0x122d7a][_0x364d1e][_0x3166('0x5c')])[_0x3166('0x5d')](moment(_0x232a2e[_0x122d7a][_0x364d1e]['queuecallerjoinAt']),_0x3166('0x5e'))||0x0;_0x2033eb[_0x3166('0x14')][_0x39cfc1][_0x3166('0x27')]+=0x1;if(_0x232a2e[_0x122d7a][_0x364d1e][_0x3166('0x5f')]){_0x2033eb[_0x3166('0x14')][_0x39cfc1][_0x3166('0x28')]+=0x1;_0x2033eb['voiceQueues'][_0x39cfc1][_0x3166('0x29')]+=moment(_0x232a2e[_0x122d7a][_0x364d1e][_0x3166('0x60')])[_0x3166('0x5d')](moment(_0x232a2e[_0x122d7a][_0x364d1e][_0x3166('0x59')]),'seconds')||0x0;}}else{_0x2033eb['voiceQueues'][_0x39cfc1][_0x3166('0x61')]+=_0x2033eb[_0x3166('0x14')][_0x39cfc1][_0x3166('0x2e')]||0x0;}}}}}}return _0x2033eb[_0x3166('0x14')];};};Realtime[_0x3166('0x3d')][_0x3166('0x62')]=function(){var _0x2cb1bc=this;return function(_0x3b83ee){clearVoiceCallReports(_0x2cb1bc['outbound']);if(_0x3b83ee){for(var _0x42fab0=0x0;_0x42fab0<_0x3b83ee['length'];_0x42fab0+=0x1){_0x2cb1bc['outbound'][_0x3166('0x27')]+=0x1;_0x2cb1bc['outbound']['sumDuration']+=_0x3b83ee[_0x42fab0][_0x3166('0x63')];if(_0x3b83ee[_0x42fab0][_0x3166('0x64')]===_0x3166('0x65')){_0x2cb1bc[_0x3166('0x66')][_0x3166('0x28')]+=0x1;_0x2cb1bc[_0x3166('0x66')][_0x3166('0x2e')]+=_0x3b83ee[_0x42fab0]['duration']-_0x3b83ee[_0x42fab0][_0x3166('0x67')]||0x0;_0x2cb1bc[_0x3166('0x66')]['sumBillable']+=_0x3b83ee[_0x42fab0][_0x3166('0x67')];}}}return _0x2cb1bc[_0x3166('0x66')];};};Realtime[_0x3166('0x3d')][_0x3166('0x68')]=function(){var _0xcc5533=this;return function(_0x1183b9){if(_0x1183b9){freeIsNotKey(_0x1183b9,_0xcc5533[_0x3166('0x15')],'name');for(var _0x39eec4=0x0,_0x17cc50={};_0x39eec4<_0x1183b9[_0x3166('0x3f')];_0x39eec4+=0x1){_0x17cc50=_0x1183b9[_0x39eec4];if(_['isUndefined'](_0xcc5533[_0x3166('0x15')][_0x17cc50[_0x3166('0x25')]])){_0xcc5533[_0x3166('0x15')][_0x17cc50[_0x3166('0x25')]]=new Campaign(_0x17cc50);}else{_0xcc5533['mergeFromDatabase'](_0xcc5533[_0x3166('0x15')][_0x17cc50[_0x3166('0x25')]],_0x17cc50);_0xcc5533[_0x3166('0x15')][_0x17cc50[_0x3166('0x25')]]['dialQueueProject']=_0x17cc50[_0x3166('0x69')]?_0x17cc50['SquareProject'][_0x3166('0x25')]:undefined;}}}return _0xcc5533['campaigns'];};};Realtime['prototype'][_0x3166('0x6a')]=function(){var _0x5a33ea=this;return function(_0xfd2cf6){if(_0xfd2cf6){freeIsNotKey(_0xfd2cf6,_0x5a33ea['voiceExtensions'],'id');for(var _0x420ccd=0x0,_0x5bd115={};_0x420ccd<_0xfd2cf6[_0x3166('0x3f')];_0x420ccd+=0x1){_0x5bd115=_0xfd2cf6[_0x420ccd];if(_[_0x3166('0x41')](_0x5a33ea[_0x3166('0x6b')][_0x5bd115['id']])){_0x5a33ea[_0x3166('0x6b')][_0x5bd115['id']]=new VoiceExtension(_0x5bd115);}else{_0x5a33ea[_0x3166('0x3c')](_0x5a33ea[_0x3166('0x6b')][_0x5bd115['id']],_0x5bd115);}}}return _0x5a33ea['voiceExtensions'];};};Realtime['prototype'][_0x3166('0x6c')]=function(){var _0x5a4889=this;return function(_0x59baf4){clearCampaigns(_0x5a4889['campaigns']);for(var _0x576ce2=0x0;_0x576ce2<_0x59baf4[_0x3166('0x3f')];_0x576ce2+=0x1){_['merge'](_0x5a4889[_0x3166('0x15')][_0x59baf4[_0x576ce2][_0x3166('0x25')]],_0x59baf4[_0x576ce2]);}return _0x5a4889[_0x3166('0x15')];};};Realtime[_0x3166('0x3d')][_0x3166('0x6d')]=function(){var _0x120fe5=this;return function(_0xad0d7f){if(_0xad0d7f){freeIsNotKey(_0xad0d7f,_0x120fe5[_0x3166('0x20')],'id');for(var _0x28adac=0x0,_0x179624={},_0x22b458={};_0x28adac<_0xad0d7f['length'];_0x28adac+=0x1){_0x179624=_0xad0d7f[_0x28adac];if(_[_0x3166('0x41')](_0x120fe5[_0x3166('0x20')][_0x179624['id']])){_0x120fe5[_0x3166('0x20')][_0x179624['id']]=new FaxAccount(_0x179624);}else{_0x120fe5[_0x3166('0x3c')](_0x120fe5[_0x3166('0x20')][_0x179624['id']],_0x179624);}}}return _0x120fe5[_0x3166('0x20')];};};module[_0x3166('0x6e')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 4e33f7a..95d3a7d 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 _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 +var _0x6167=['from-voip-provider','callerid','context','from-sip','calleridpreview','calleridnum','channel','originatecalleridnum','ANSWERED','calleridname','transfers','linkedid','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','xcally-motion-dialer','voiceAgentReport','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','agents','prototype','sync','realtime','xdr','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','isNil','telephones','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','destination','exten','type','lastapplication','queue','lastdata'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x6167,0x120));var _0x7616=function(_0x216970,_0x5e5d98){_0x216970=_0x216970-0x0;var _0x34be29=_0x6167[_0x216970];return _0x34be29;};'use strict';var _=require(_0x7616('0x0'));var moment=require(_0x7616('0x1'));var util=require(_0x7616('0x2'));var config=require(_0x7616('0x3'));var ami=require(_0x7616('0x4'));var RpcVoiceAgentReport=require(_0x7616('0x5'));var RpcVoiceCallReport=require(_0x7616('0x6'));var RpcVoiceDialReport=require(_0x7616('0x7'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x7616('0x8'));var RpcVoiceRecording=require(_0x7616('0x9'));var RpcVoiceTransferReport=require(_0x7616('0xa'));var VoiceQueueReport=require(_0x7616('0xb'));var VoiceCallReport=require(_0x7616('0xc'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x7616('0xd'));var UserReport=require(_0x7616('0xe'));function Report(_0x4613e6){this['realtime']=_0x4613e6;this[_0x7616('0xf')]=_0x4613e6[_0x7616('0xf')];this['telephones']=_0x4613e6['telephones'];}Report[_0x7616('0x10')][_0x7616('0x11')]=function(_0x506055){var _0x283611=new VoiceQueueReport(this[_0x7616('0x12')]);var _0x37da67=new VoiceAgentReport(this[_0x7616('0x12')]);var _0x2f6d49=new VoiceDialReport(this[_0x7616('0x12')]);var _0x4661b9=new VoiceCallReport(this['realtime']);var _0x72cd78=new UserReport(this[_0x7616('0x12')]);if(config[_0x7616('0x13')]&&config[_0x7616('0x13')]['disabled']){ami['on'](_0x7616('0x14'),this[_0x7616('0x15')]['bind'](this));ami['on'](_0x7616('0x16'),this[_0x7616('0x17')][_0x7616('0x18')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport'][_0x7616('0x18')](this));ami['on']('custom:voiceDialReport',this[_0x7616('0x19')][_0x7616('0x18')](this));ami['on'](_0x7616('0x1a'),this[_0x7616('0x1b')][_0x7616('0x18')](this));ami['on'](_0x7616('0x1c'),this['attendedTransfer'][_0x7616('0x18')](this));}};Report[_0x7616('0x10')][_0x7616('0x1d')]=function(_0x4ca0ba){var _0x1af5ee;_0x1af5ee=_[_0x7616('0x1e')](this[_0x7616('0xf')],function(_0x44fbe4){return _0x44fbe4[_0x7616('0x1f')]==_0x4ca0ba||_0x44fbe4[_0x7616('0x20')]==_0x4ca0ba;});if(_[_0x7616('0x21')](_0x1af5ee)){var _0x411137=_[_0x7616('0x1e')](this[_0x7616('0x22')],function(_0x1e6797){return _0x1e6797[_0x7616('0x1f')]==_0x4ca0ba||_0x1e6797['name']==_0x4ca0ba;});if(_0x411137){_0x1af5ee=_[_0x7616('0x1e')](this[_0x7616('0xf')],function(_0x352bc0){return _0x352bc0[_0x7616('0x23')]==util[_0x7616('0x24')](_0x7616('0x25'),_0x411137[_0x7616('0x20')]);});}}return _0x1af5ee;};Report[_0x7616('0x10')]['voiceQueueReport']=function(_0x5eb65a){for(var _0x189306=0x0;_0x189306<_0x5eb65a[_0x7616('0x26')];_0x189306+=0x1){var _0xc85160=this[_0x7616('0x1d')](_0x5eb65a[_0x189306][_0x7616('0x27')]);if(_0xc85160){_0x5eb65a[_0x189306][_0x7616('0x1f')]=_0xc85160[_0x7616('0x1f')];_0x5eb65a[_0x189306][_0x7616('0x28')]=!![];_0x5eb65a[_0x189306][_0x7616('0x29')]=_0xc85160[_0x7616('0x20')];_0x5eb65a[_0x189306][_0x7616('0x23')]=_[_0x7616('0x21')](_0xc85160[_0x7616('0x23')])?util[_0x7616('0x24')]('SIP/%s',_0xc85160['name']):_0xc85160[_0x7616('0x23')];if(_0x5eb65a[_0x189306]['queuecallercomplete']){_0x5eb65a[_0x189306]['queuecallercompleteAt']=moment()[_0x7616('0x24')](_0x7616('0x2a'));}if(_0x5eb65a[_0x189306]['queuecallerexit']){_0x5eb65a[_0x189306][_0x7616('0x2b')]=moment()['format'](_0x7616('0x2a'));}RpcMemberReport[_0x7616('0x15')](_0x5eb65a[_0x189306]);}RpcVoiceQueueReport[_0x7616('0x2c')](_0x5eb65a[_0x189306]);}};function extractCalleridNumber(_0x39c6bf){var _0x34af76=_0x39c6bf[_0x7616('0x2d')](/<(.*?)>/);return _0x34af76?_0x34af76[0x1]:_0x39c6bf;}Report[_0x7616('0x10')][_0x7616('0x17')]=function(_0x172aa2){_0x172aa2[_0x7616('0x2e')]=_0x172aa2[_0x7616('0x2e')]||_0x172aa2[_0x7616('0x2f')];if(_0x172aa2[_0x7616('0x30')]=='dialer'){_0x172aa2[_0x7616('0x31')]=_0x7616('0x32');_0x172aa2[_0x7616('0x33')]=_0x172aa2['queue'];if(_0x172aa2['context']==_0x7616('0x34')){_0x172aa2[_0x7616('0x1f')]='';_0x172aa2[_0x7616('0x2e')]=extractCalleridNumber(_0x172aa2[_0x7616('0x35')]);}else if(_0x172aa2[_0x7616('0x36')]==_0x7616('0x37')){if(_0x172aa2[_0x7616('0x2e')]=='xcally-motion-preview'){_0x172aa2[_0x7616('0x2e')]=extractCalleridNumber(_0x172aa2[_0x7616('0x38')]);_0x172aa2[_0x7616('0x39')]=_0x172aa2['originatecalleridnum'];_0x172aa2['destinationchannel']=[_0x172aa2[_0x7616('0x3a')],_0x172aa2['channel']=_0x172aa2['destinationchannel']][0x0];_0x172aa2['callerid']=_0x172aa2[_0x7616('0x38')];}else{_0x172aa2['destination']=_0x172aa2[_0x7616('0x39')];_0x172aa2['calleridnum']=_0x172aa2[_0x7616('0x3b')];if(_0x172aa2['disposition']==_0x7616('0x3c')){_0x172aa2[_0x7616('0x1f')]=_0x172aa2['connectedlinenum'];}else{_0x172aa2[_0x7616('0x1f')]='';}}}}else{_0x172aa2[_0x7616('0x35')]=util['format']('\x22%s\x22\x20<%s>',_0x172aa2[_0x7616('0x3d')],_0x172aa2[_0x7616('0x39')]);}if(RpcVoiceTransferReport[_0x7616('0x3e')][_0x172aa2[_0x7616('0x3f')]]){var _0x24d6bc=RpcVoiceTransferReport[_0x7616('0x3e')][_0x172aa2[_0x7616('0x3f')]];_0x24d6bc['transfereelinkedid']=_0x172aa2['uniqueid'];RpcVoiceTransferReport[_0x7616('0x1b')](_0x24d6bc);delete RpcVoiceTransferReport['transfers'][_0x172aa2['linkedid']];}RpcVoiceCallReport[_0x7616('0x2c')](_0x172aa2);if(_0x172aa2[_0x7616('0x40')]){for(var _0x339733=0x0;_0x339733<_0x172aa2[_0x7616('0x41')][_0x7616('0x26')];_0x339733+=0x1){_0x172aa2[_0x7616('0x42')]=_0x172aa2[_0x7616('0x41')][_0x339733][_0x7616('0x43')];_0x172aa2[_0x7616('0x44')]=_0x172aa2[_0x7616('0x41')][_0x339733][_0x7616('0x44')];if(_0x172aa2['exten']==_0x7616('0x45')){_0x172aa2[_0x7616('0x39')]=_0x172aa2[_0x7616('0x27')];_0x172aa2[_0x7616('0x3d')]=_0x172aa2[_0x7616('0x46')];_0x172aa2[_0x7616('0x27')]=_0x172aa2['accountcode'];_0x172aa2[_0x7616('0x46')]=_0x172aa2['membername'];_0x172aa2[_0x7616('0x2f')]=_0x172aa2['originatecalleridnum'];}else if(_0x172aa2[_0x7616('0x2f')]==_0x7616('0x47')){_0x172aa2[_0x7616('0x39')]=_0x172aa2['destination'];_0x172aa2[_0x7616('0x2f')]=_0x172aa2[_0x7616('0x3b')];}RpcVoiceRecording[_0x7616('0x2c')](_0x172aa2);}}};Report[_0x7616('0x10')][_0x7616('0x48')]=function(_0x5cc526){if(_[_0x7616('0x49')](_0x5cc526)){_0x5cc526[_0x7616('0x4a')](function(_0x48b8e9){RpcVoiceAgentReport['create'](_0x48b8e9);});}else{RpcVoiceAgentReport[_0x7616('0x2c')](_0x5cc526);}};Report[_0x7616('0x10')]['voiceDialReport']=function(_0x417f81){RpcVoiceDialReport['create'](_0x417f81);var _0x4e94de;var _0x269a8f;var _0x79270b=_0x417f81[_0x7616('0x3a')];if(_[_0x7616('0x4b')](_0x79270b,_0x7616('0x4c'))){_0x269a8f=_0x79270b[_0x7616('0x4d')](_0x79270b['indexOf']('/')+0x1,_0x79270b[_0x7616('0x4e')]('@'));_0x4e94de=_[_0x7616('0x1e')](this['agents'],function(_0x15b14a){return _0x15b14a[_0x7616('0x4f')]==_0x269a8f||_0x15b14a[_0x7616('0x50')]==_0x269a8f||_0x15b14a['accountcode']==_0x269a8f;});}else{_0x269a8f=_0x79270b['substring'](_0x79270b['indexOf']('/')+0x1,_0x79270b[_0x7616('0x51')]('-'));_0x4e94de=this[_0x7616('0x1d')](_0x269a8f);}if(_0x4e94de){_0x417f81[_0x7616('0x23')]=_[_0x7616('0x21')](_0x4e94de['interface'])?util['format']('SIP/%s',_0x4e94de[_0x7616('0x20')]):_0x4e94de[_0x7616('0x23')];_0x417f81['membername']=_0x4e94de[_0x7616('0x20')];_0x417f81[_0x7616('0x1f')]=_0x4e94de[_0x7616('0x1f')];RpcMemberReport[_0x7616('0x19')](_0x417f81);}};Report[_0x7616('0x10')][_0x7616('0x1b')]=function(_0x5617a9){RpcVoiceTransferReport[_0x7616('0x3e')][_0x5617a9[_0x7616('0x52')]]=_0x5617a9;};Report['prototype'][_0x7616('0x53')]=function(_0x4f3623){RpcVoiceTransferReport[_0x7616('0x53')](_0x4f3623);};module[_0x7616('0x54')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index a3ae026..30e7e39 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 _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 +var _0x3c50=['substring','indexOf','find','mobile','accountcode','info','peer','[userReport][peerstatus]','registered','address','telephone:%s','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','util','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','socket.io-emitter','trunks','telephones','registryentry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','error','[userReport][devicestatelist]','inspect','actionSipPeerStatus','catch','[userReport][sippeerstatus]','prototype','isNotNull','emit','syncRegistry','username','state','[userReport][registry]','stateRegistry','merge','omit','event','actionid','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','agents','device','local','toLowerCase','inuse','toNumber','updateStatusRealtime','stateTime','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','trunk:save','startsWith','Local'];(function(_0x1e1bb5,_0x23b4e9){var _0x413b4c=function(_0x1483c1){while(--_0x1483c1){_0x1e1bb5['push'](_0x1e1bb5['shift']());}};_0x413b4c(++_0x23b4e9);}(_0x3c50,0x132));var _0x03c5=function(_0x3eeefc,_0x24f005){_0x3eeefc=_0x3eeefc-0x0;var _0x2303d0=_0x3c50[_0x3eeefc];return _0x2303d0;};'use strict';var _=require(_0x03c5('0x0'));var moment=require('moment');var util=require(_0x03c5('0x1'));var Redis=require('ioredis');var BPromise=require(_0x03c5('0x2'));var config=require(_0x03c5('0x3'));var logger=require(_0x03c5('0x4'))(_0x03c5('0x5'));var ami=require(_0x03c5('0x6'));config[_0x03c5('0x7')]=_['defaults'](config[_0x03c5('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x03c5('0x8'))(new Redis(config[_0x03c5('0x7')]));function UserReport(_0x2f856a){this['trunks']=_0x2f856a[_0x03c5('0x9')];this['agents']=_0x2f856a['agents'];this[_0x03c5('0xa')]=_0x2f856a['telephones'];ami['on'](_0x03c5('0xb'),this['syncRegistry'][_0x03c5('0xc')](this));ami['on'](_0x03c5('0xd'),this['syncRegistry'][_0x03c5('0xc')](this));ami['on'](_0x03c5('0xe'),this[_0x03c5('0xf')][_0x03c5('0xc')](this));ami['on'](_0x03c5('0x10'),this[_0x03c5('0x11')]['bind'](this));return this[_0x03c5('0x12')]();}function showSipRegistrations(){Promise[_0x03c5('0x13')]()[_0x03c5('0x14')](ami[_0x03c5('0x15')]())['catch'](function(_0x39bbb7){logger[_0x03c5('0x16')]('[userReport][sipshowregistry]',util['inspect'](_0x39bbb7,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x03c5('0x13')]()[_0x03c5('0x14')](ami['actionDeviceStateList']())['catch'](function(_0xc23735){logger['error'](_0x03c5('0x17'),util[_0x03c5('0x18')](_0xc23735,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0x03c5('0x14')](ami[_0x03c5('0x19')]())[_0x03c5('0x1a')](function(_0x47dd55){logger[_0x03c5('0x16')](_0x03c5('0x1b'),util['inspect'](_0x47dd55,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0x03c5('0x12')]=function(){setInterval(function(){BPromise[_0x03c5('0x13')]()['then'](showSipRegistrations())['then'](listDeviceStates())[_0x03c5('0x14')](showPeersStatus());},0x32c8);};UserReport[_0x03c5('0x1c')][_0x03c5('0x1d')]=function(_0x41eb78){return _0x41eb78!==null&&!_['isUndefined'](_0x41eb78);};UserReport[_0x03c5('0x1c')]['emit']=function(_0x273bc1,_0x435a0d,_0x5acdbb){io['to'](_0x273bc1)[_0x03c5('0x1e')](_0x435a0d,_0x5acdbb);};UserReport[_0x03c5('0x1c')][_0x03c5('0x1f')]=function(_0x114308){try{if(this[_0x03c5('0x1d')](_0x114308)){logger['info']('[userReport][registry]\x20registry:%s\x20state:%s',_0x114308[_0x03c5('0x20')],_0x114308[_0x03c5('0x21')]);logger['debug'](_0x03c5('0x22'),util[_0x03c5('0x18')](_0x114308,{'showHidden':![],'depth':null}));var _0x59f9ce=_['find'](this[_0x03c5('0x9')],{'registry':_0x114308[_0x03c5('0x20')]});if(_0x59f9ce){_0x114308[_0x03c5('0x23')]=_0x114308['state'];_[_0x03c5('0x24')](_0x59f9ce,_[_0x03c5('0x25')](_0x114308,[_0x03c5('0x26'),_0x03c5('0x27'),_0x03c5('0x20'),_0x03c5('0x21')]));logger[_0x03c5('0x28')](_0x03c5('0x29'),util['inspect'](_0x59f9ce,{'showHidden':![],'depth':null}));this[_0x03c5('0x1e')](util[_0x03c5('0x2a')]('trunk:%s',_0x59f9ce[_0x03c5('0x2b')]),'trunk:save',_0x59f9ce);}}}catch(_0x55b04c){logger['error'](_0x03c5('0x22'),util[_0x03c5('0x18')](_0x55b04c,{'showHidden':![],'depth':null}));}};UserReport[_0x03c5('0x1c')]['syncDeviceState']=function(_0x4ac8d1){try{if(this[_0x03c5('0x1d')](_0x4ac8d1)){logger['info'](_0x03c5('0x2c'),_0x4ac8d1['device'],_0x4ac8d1['state']);logger[_0x03c5('0x28')](_0x03c5('0x2d'),util['inspect'](_0x4ac8d1,{'showHidden':![],'depth':null}));if(this[_0x03c5('0x2e')][_0x4ac8d1['device']]){if(!this[_0x03c5('0x2e')][_0x4ac8d1[_0x03c5('0x2f')]][_0x03c5('0x30')]||_0x4ac8d1[_0x03c5('0x21')][_0x03c5('0x31')]()==_0x03c5('0x32')){this[_0x03c5('0x2e')][_0x4ac8d1[_0x03c5('0x2f')]]['local']=![];if(this[_0x03c5('0x2e')][_0x4ac8d1['device']][_0x03c5('0x21')]!==_0x4ac8d1[_0x03c5('0x21')]['toLowerCase']()){this['agents'][_0x4ac8d1[_0x03c5('0x2f')]]['stateTime']=_[_0x03c5('0x33')](moment()[_0x03c5('0x2a')]('x'));}this[_0x03c5('0x2e')][_0x4ac8d1['device']][_0x03c5('0x21')]=_0x4ac8d1[_0x03c5('0x21')][_0x03c5('0x31')]();this[_0x03c5('0x2e')][_0x4ac8d1[_0x03c5('0x2f')]][_0x03c5('0x34')](_0x4ac8d1);}}else if(this['telephones'][_0x4ac8d1['device']]){if(this[_0x03c5('0xa')][_0x4ac8d1['device']][_0x03c5('0x21')]!==_0x4ac8d1['state'][_0x03c5('0x31')]()){this[_0x03c5('0xa')][_0x4ac8d1[_0x03c5('0x2f')]]['stateTime']=_[_0x03c5('0x33')](moment()['format']('x'));}this['telephones'][_0x4ac8d1[_0x03c5('0x2f')]][_0x03c5('0x21')]=_0x4ac8d1['state']['toLowerCase']();logger['debug']('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0x03c5('0xa')][_0x4ac8d1[_0x03c5('0x2f')]],{'showHidden':![],'depth':null}));this[_0x03c5('0x1e')](util[_0x03c5('0x2a')]('telephone:%s',this[_0x03c5('0xa')][_0x4ac8d1['device']][_0x03c5('0x2b')]),'telephone:save',this[_0x03c5('0xa')][_0x4ac8d1['device']]);}else if(this['trunks'][_0x4ac8d1['device']]){if(this[_0x03c5('0x9')][_0x4ac8d1['device']]['state']!==_0x4ac8d1[_0x03c5('0x21')][_0x03c5('0x31')]()){this[_0x03c5('0x9')][_0x4ac8d1[_0x03c5('0x2f')]][_0x03c5('0x35')]=_[_0x03c5('0x33')](moment()[_0x03c5('0x2a')]('x'));}this[_0x03c5('0x9')][_0x4ac8d1[_0x03c5('0x2f')]][_0x03c5('0x21')]=_0x4ac8d1[_0x03c5('0x21')][_0x03c5('0x31')]();logger[_0x03c5('0x28')](_0x03c5('0x36'),util['inspect'](this['trunks'][_0x4ac8d1[_0x03c5('0x2f')]],{'showHidden':![],'depth':null}));this[_0x03c5('0x1e')](util[_0x03c5('0x2a')](_0x03c5('0x37'),this['trunks'][_0x4ac8d1[_0x03c5('0x2f')]]['name']),_0x03c5('0x38'),this[_0x03c5('0x9')][_0x4ac8d1['device']]);}else if(_[_0x03c5('0x39')](_0x4ac8d1[_0x03c5('0x2f')],_0x03c5('0x3a'))){var _0x5e6929=_0x4ac8d1['device'];var _0x248d24=_0x5e6929[_0x03c5('0x3b')](_0x5e6929['indexOf']('/')+0x1,_0x5e6929[_0x03c5('0x3c')]('@'));var _0x2578f3=_[_0x03c5('0x3d')](this[_0x03c5('0x2e')],function(_0x9316fa){return _0x9316fa[_0x03c5('0x3e')]==_0x248d24||_0x9316fa['phone']==_0x248d24||_0x9316fa[_0x03c5('0x3f')]==_0x248d24;});if(_0x2578f3){if(_0x2578f3['state']!==_0x4ac8d1[_0x03c5('0x21')][_0x03c5('0x31')]()){_0x2578f3[_0x03c5('0x35')]=_['toNumber'](moment()[_0x03c5('0x2a')]('x'));}_0x2578f3[_0x03c5('0x21')]=_0x4ac8d1['state']['toLowerCase']();_0x2578f3[_0x03c5('0x30')]=!![];_0x2578f3['updateStatusRealtime'](_0x4ac8d1);}}}}catch(_0x5b47f1){logger[_0x03c5('0x16')](_0x03c5('0x2d'),util[_0x03c5('0x18')](_0x5b47f1,{'showHidden':![],'depth':null}));}};UserReport[_0x03c5('0x1c')][_0x03c5('0x11')]=function(_0xb09440){try{if(this['isNotNull'](_0xb09440)&&this[_0x03c5('0x1d')](_0xb09440['peerstatus'])){logger[_0x03c5('0x40')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0xb09440[_0x03c5('0x41')],_0xb09440['address'],_0xb09440['peerstatus']);logger[_0x03c5('0x28')](_0x03c5('0x42'),util[_0x03c5('0x18')](_0xb09440,{'showHidden':![],'depth':null}));if(this[_0x03c5('0x2e')][_0xb09440[_0x03c5('0x41')]]){if(!this[_0x03c5('0x2e')][_0xb09440['peer']]['local']||_0xb09440[_0x03c5('0x10')][_0x03c5('0x31')]()==_0x03c5('0x43')){this['agents'][_0xb09440[_0x03c5('0x41')]][_0x03c5('0x30')]=![];this[_0x03c5('0x2e')][_0xb09440[_0x03c5('0x41')]]['status']=_0xb09440[_0x03c5('0x10')]['toLowerCase']();this['agents'][_0xb09440[_0x03c5('0x41')]][_0x03c5('0x44')]=_0xb09440[_0x03c5('0x44')];this[_0x03c5('0x2e')][_0xb09440[_0x03c5('0x41')]][_0x03c5('0x34')](_0xb09440);}}else if(this[_0x03c5('0xa')][_0xb09440[_0x03c5('0x41')]]){this[_0x03c5('0xa')][_0xb09440[_0x03c5('0x41')]]['status']=_0xb09440[_0x03c5('0x10')][_0x03c5('0x31')]();this['telephones'][_0xb09440['peer']]['address']=_0xb09440[_0x03c5('0x44')];logger[_0x03c5('0x28')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x03c5('0x18')](this['telephones'][_0xb09440[_0x03c5('0x41')]],{'showHidden':![],'depth':null}));this[_0x03c5('0x1e')](util[_0x03c5('0x2a')](_0x03c5('0x45'),this[_0x03c5('0xa')][_0xb09440[_0x03c5('0x41')]][_0x03c5('0x2b')]),_0x03c5('0x46'),this[_0x03c5('0xa')][_0xb09440['peer']]);}else if(this['trunks'][_0xb09440[_0x03c5('0x41')]]){this[_0x03c5('0x9')][_0xb09440[_0x03c5('0x41')]]['status']=_0xb09440[_0x03c5('0x10')][_0x03c5('0x31')]();this[_0x03c5('0x9')][_0xb09440[_0x03c5('0x41')]]['address']=_0xb09440[_0x03c5('0x44')];logger[_0x03c5('0x28')](_0x03c5('0x47'),util[_0x03c5('0x18')](this['trunks'][_0xb09440[_0x03c5('0x41')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x03c5('0x2a')](_0x03c5('0x37'),this[_0x03c5('0x9')][_0xb09440[_0x03c5('0x41')]]['name']),'trunk:save',this['trunks'][_0xb09440[_0x03c5('0x41')]]);}}}catch(_0x4d62ca){logger['error'](_0x03c5('0x42'),util[_0x03c5('0x18')](_0x4d62ca,{'showHidden':![],'depth':null}));}};module[_0x03c5('0x48')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 498dec1..48b883d 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 _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 +var _0xb3bc=['memberdynamic','memberpenalty','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','agentconnectAt','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','bind','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','varset','syncVarSet','syncHangup','musiconholdstart','syncMusicOnHoldStop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','syncAgentCalled','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','omit','event','privilege','debug','inspect','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','error','[%s][voiceAgentReport][agentconnect]\x20event:','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','merge','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:%s','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','reason','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','hasOwnProperty','agentcompleteAt','complete','transfer','agent','talktime','acw','acwTimeout','agentacw','interface','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','value','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer'];(function(_0x5ee71e,_0x28e6bf){var _0x1675b1=function(_0x5f543c){while(--_0x5f543c){_0x5ee71e['push'](_0x5ee71e['shift']());}};_0x1675b1(++_0x28e6bf);}(_0xb3bc,0x146));var _0xcb3b=function(_0x58e682,_0x685656){_0x58e682=_0x58e682-0x0;var _0x1d7902=_0xb3bc[_0x58e682];return _0x1d7902;};'use strict';var _=require(_0xcb3b('0x0'));var moment=require(_0xcb3b('0x1'));var util=require(_0xcb3b('0x2'));var Redis=require(_0xcb3b('0x3'));var config=require(_0xcb3b('0x4'));var logger=require(_0xcb3b('0x5'))(_0xcb3b('0x6'));var ami=require(_0xcb3b('0x7'));config[_0xcb3b('0x8')]=_[_0xcb3b('0x9')](config[_0xcb3b('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xcb3b('0xa'))(new Redis(config[_0xcb3b('0x8')]));function VoiceAgentReport(_0x115ada){this[_0xcb3b('0xb')]={};this[_0xcb3b('0xc')]=_0x115ada[_0xcb3b('0xc')];this['agents']=_0x115ada[_0xcb3b('0xd')];this[_0xcb3b('0xe')]={};ami['on'](_0xcb3b('0xf'),this['syncAgentCalled'][_0xcb3b('0x10')](this));ami['on']('agentconnect',this[_0xcb3b('0x11')][_0xcb3b('0x10')](this));ami['on'](_0xcb3b('0x12'),this[_0xcb3b('0x13')][_0xcb3b('0x10')](this));ami['on'](_0xcb3b('0x14'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0xcb3b('0x15'),this['syncAgentComplete']['bind'](this));ami['on'](_0xcb3b('0x16'),this[_0xcb3b('0x17')]['bind'](this));ami['on']('hangup',this[_0xcb3b('0x18')][_0xcb3b('0x10')](this));ami['on'](_0xcb3b('0x19'),this['syncMusicOnHoldStart'][_0xcb3b('0x10')](this));ami['on']('musiconholdstop',this[_0xcb3b('0x1a')]['bind'](this));ami['on'](_0xcb3b('0x1b'),this['syncAttendedTransfer'][_0xcb3b('0x10')](this));ami['on']('blindtransfer',this[_0xcb3b('0x1c')][_0xcb3b('0x10')](this));}VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x1e')]=function(_0x3fc7c4,_0x697715,_0x20ff46){io['to'](_0x3fc7c4)[_0xcb3b('0x1e')](_0x697715,_0x20ff46);};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x1f')]=function(_0x2929ff){return _0x2929ff!==null&&!_[_0xcb3b('0x20')](_0x2929ff);};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x21')]=function(_0x263884){try{if(this['isNotNull'](_0x263884)){logger[_0xcb3b('0x22')](_0xcb3b('0x23'),_0x263884[_0xcb3b('0x24')],_0x263884[_0xcb3b('0x25')],_0x263884[_0xcb3b('0x26')]);logger['debug'](_0xcb3b('0x27'),_0x263884['uniqueid'],util['inspect'](_0x263884,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xcb3b('0xb')][_0x263884[_0xcb3b('0x24')]])){this['channels'][_0x263884[_0xcb3b('0x24')]]={};}if(_[_0xcb3b('0x20')](this[_0xcb3b('0xb')][_0x263884[_0xcb3b('0x24')]][_0x263884[_0xcb3b('0x26')]])){this[_0xcb3b('0xb')][_0x263884[_0xcb3b('0x24')]][_0x263884[_0xcb3b('0x26')]]={'agentcalledAt':moment()['format'](_0xcb3b('0x28')),'lastevent':_0xcb3b('0x29'),'mandatoryDisposition':this['voiceQueues'][_0x263884[_0xcb3b('0x2a')]]?this[_0xcb3b('0xc')][_0x263884[_0xcb3b('0x2a')]][_0xcb3b('0x2b')]||![]:![],'type':this[_0xcb3b('0xc')][_0x263884['queue']]?this[_0xcb3b('0xc')][_0x263884[_0xcb3b('0x2a')]][_0xcb3b('0x2c')]||_0xcb3b('0x2d'):_0xcb3b('0x2d'),'variables':this[_0xcb3b('0xe')][_0x263884['uniqueid']]};}_['merge'](this[_0xcb3b('0xb')][_0x263884[_0xcb3b('0x24')]][_0x263884[_0xcb3b('0x26')]],_[_0xcb3b('0x2e')](_0x263884,[_0xcb3b('0x2f'),_0xcb3b('0x30')]));logger[_0xcb3b('0x31')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x263884['uniqueid'],util[_0xcb3b('0x32')](this[_0xcb3b('0xb')][_0x263884['uniqueid']][_0x263884[_0xcb3b('0x26')]],{'showHidden':![],'depth':null}));ami[_0xcb3b('0x1e')](_0xcb3b('0x33'),this['channels'][_0x263884['uniqueid']][_0x263884['destuniqueid']]);logger[_0xcb3b('0x31')](_0xcb3b('0x34'),_0x263884[_0xcb3b('0x24')],util[_0xcb3b('0x32')](this['channels'][_0x263884[_0xcb3b('0x24')]][_0x263884['destuniqueid']],{'showHidden':![],'depth':null}));this[_0xcb3b('0x1e')](util[_0xcb3b('0x35')]('user:%s',_0x263884['membername']),'user:called',this[_0xcb3b('0xb')][_0x263884[_0xcb3b('0x24')]][_0x263884['destuniqueid']]);}}catch(_0x19bc95){logger[_0xcb3b('0x36')]('[%s][voiceAgentReport][agentcalled]',_0x263884[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x19bc95,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x11')]=function(_0x54d62a){try{if(this[_0xcb3b('0x1f')](_0x54d62a)){if(this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]]){logger[_0xcb3b('0x31')](_0xcb3b('0x37'),_0x54d62a[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x54d62a,{'showHidden':![],'depth':null}));for(var _0x543917 in this['channels'][_0x54d62a[_0xcb3b('0x24')]]){if(this[_0xcb3b('0xb')][_0x54d62a['uniqueid']]['hasOwnProperty'](_0x543917)){if(_0x54d62a[_0xcb3b('0x26')]===_0x543917){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54d62a[_0xcb3b('0x24')],_0x54d62a[_0xcb3b('0x25')],_0x54d62a[_0xcb3b('0x26')]);this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x543917]['agentconnectAt']=moment()[_0xcb3b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcb3b('0xb')][_0x54d62a['uniqueid']][_0x543917][_0xcb3b('0x38')]=_0x54d62a[_0xcb3b('0x38')];this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x543917]['connectedlinenum']=_0x54d62a[_0xcb3b('0x39')];this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x543917][_0xcb3b('0x3a')]=_0x54d62a[_0xcb3b('0x3a')];this['channels'][_0x54d62a[_0xcb3b('0x24')]][_0x543917][_0xcb3b('0x3b')]=_0x54d62a[_0xcb3b('0x3b')];this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x543917]['holdtime']=_0x54d62a[_0xcb3b('0x3c')];this[_0xcb3b('0xb')][_0x54d62a['uniqueid']][_0x543917][_0xcb3b('0x3d')]='connect';_[_0xcb3b('0x3e')](this[_0xcb3b('0xd')][_0x54d62a['interface']],_['pick'](_0x54d62a,[_0xcb3b('0x2a'),_0xcb3b('0x3f')]));logger['debug'](_0xcb3b('0x40'),_0x54d62a[_0xcb3b('0x24')],util['inspect'](this['channels'][_0x54d62a[_0xcb3b('0x24')]][_0x54d62a[_0xcb3b('0x26')]],{'showHidden':![],'depth':null}));ami[_0xcb3b('0x1e')](_0xcb3b('0x41'),this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x54d62a[_0xcb3b('0x26')]]);logger[_0xcb3b('0x31')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x54d62a['uniqueid'],util[_0xcb3b('0x32')](this[_0xcb3b('0xb')][_0x54d62a['uniqueid']][_0x54d62a[_0xcb3b('0x26')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xcb3b('0x35')](_0xcb3b('0x42'),_0x54d62a[_0xcb3b('0x25')]),'user:agentconnect',this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x54d62a['destuniqueid']]);}else if(!this['channels'][_0x54d62a[_0xcb3b('0x24')]][_0x543917][_0xcb3b('0x12')]&&!this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x543917][_0xcb3b('0x15')]){logger['info'](_0xcb3b('0x43'),_0x54d62a[_0xcb3b('0x24')],this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x543917][_0xcb3b('0x25')],_0x543917);this[_0xcb3b('0xb')][_0x54d62a['uniqueid']][_0x543917][_0xcb3b('0x12')]=!![];this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x543917]['agentringnoanswerAt']=moment()[_0xcb3b('0x35')](_0xcb3b('0x28'));this[_0xcb3b('0xb')][_0x54d62a['uniqueid']][_0x543917][_0xcb3b('0x44')]=_0x54d62a[_0xcb3b('0x26')];this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x543917][_0xcb3b('0x45')]=_0x54d62a[_0xcb3b('0x25')];this['channels'][_0x54d62a[_0xcb3b('0x24')]][_0x543917][_0xcb3b('0x3d')]=_0xcb3b('0x46');this['channels'][_0x54d62a[_0xcb3b('0x24')]][_0x543917]['reason']=_0xcb3b('0x46');logger['debug'](_0xcb3b('0x47'),_0x54d62a[_0xcb3b('0x24')],util['inspect'](this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x543917],{'showHidden':![],'depth':null}));ami[_0xcb3b('0x1e')]('custom:agentansweredelsewhere',this['channels'][_0x54d62a[_0xcb3b('0x24')]][_0x543917]);}}}}}}catch(_0x33a77f){logger[_0xcb3b('0x36')](_0xcb3b('0x48'),_0x54d62a[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x33a77f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x13')]=function(_0x207dfa){try{if(this[_0xcb3b('0x1f')](_0x207dfa)){logger[_0xcb3b('0x31')](_0xcb3b('0x49'),_0x207dfa[_0xcb3b('0x24')],util['inspect'](_0x207dfa,{'showHidden':![],'depth':null}));if(this[_0xcb3b('0xb')][_0x207dfa[_0xcb3b('0x24')]]&&this[_0xcb3b('0xb')][_0x207dfa[_0xcb3b('0x24')]][_0x207dfa[_0xcb3b('0x26')]]){logger[_0xcb3b('0x22')](_0xcb3b('0x4a'),_0x207dfa[_0xcb3b('0x24')],_0x207dfa[_0xcb3b('0x25')],_0x207dfa[_0xcb3b('0x26')]);this[_0xcb3b('0xb')][_0x207dfa[_0xcb3b('0x24')]][_0x207dfa[_0xcb3b('0x26')]]['agentringnoanswer']=!![];this[_0xcb3b('0xb')][_0x207dfa[_0xcb3b('0x24')]][_0x207dfa[_0xcb3b('0x26')]][_0xcb3b('0x4b')]=moment()[_0xcb3b('0x35')](_0xcb3b('0x28'));this[_0xcb3b('0xb')][_0x207dfa[_0xcb3b('0x24')]][_0x207dfa['destuniqueid']][_0xcb3b('0x3d')]='rejected';this[_0xcb3b('0xb')][_0x207dfa[_0xcb3b('0x24')]][_0x207dfa[_0xcb3b('0x26')]][_0xcb3b('0x4c')]=_0xcb3b('0x4d');logger['debug'](_0xcb3b('0x4e'),_0x207dfa['uniqueid'],util[_0xcb3b('0x32')](this[_0xcb3b('0xb')][_0x207dfa[_0xcb3b('0x24')]][_0x207dfa[_0xcb3b('0x26')]],{'showHidden':![],'depth':null}));ami[_0xcb3b('0x1e')](_0xcb3b('0x4f'),this[_0xcb3b('0xb')][_0x207dfa[_0xcb3b('0x24')]][_0x207dfa['destuniqueid']]);}}}catch(_0x31e30e){logger[_0xcb3b('0x36')](_0xcb3b('0x50'),_0x207dfa['uniqueid'],util[_0xcb3b('0x32')](_0x31e30e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x51')]=function(_0x2e0d39){try{if(this[_0xcb3b('0x1f')](_0x2e0d39)){logger[_0xcb3b('0x31')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x2e0d39[_0xcb3b('0x24')],util['inspect'](_0x2e0d39,{'showHidden':![],'depth':null}));if(this[_0xcb3b('0xb')][_0x2e0d39[_0xcb3b('0x24')]]){for(var _0x4c932e in this[_0xcb3b('0xb')][_0x2e0d39[_0xcb3b('0x24')]]){if(this[_0xcb3b('0xb')][_0x2e0d39['uniqueid']]['hasOwnProperty'](_0x4c932e)&&!this[_0xcb3b('0xb')][_0x2e0d39['uniqueid']][_0x4c932e][_0xcb3b('0x12')]&&!this[_0xcb3b('0xb')][_0x2e0d39[_0xcb3b('0x24')]][_0x4c932e][_0xcb3b('0x15')]){logger[_0xcb3b('0x22')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2e0d39[_0xcb3b('0x24')],this[_0xcb3b('0xb')][_0x2e0d39[_0xcb3b('0x24')]][_0x4c932e]['membername'],_0x4c932e);this[_0xcb3b('0xb')][_0x2e0d39[_0xcb3b('0x24')]][_0x4c932e][_0xcb3b('0x12')]=!![];this[_0xcb3b('0xb')][_0x2e0d39[_0xcb3b('0x24')]][_0x4c932e]['agentringnoanswerAt']=moment()[_0xcb3b('0x35')](_0xcb3b('0x28'));this[_0xcb3b('0xb')][_0x2e0d39['uniqueid']][_0x4c932e]['lastevent']=_0xcb3b('0x52');this[_0xcb3b('0xb')][_0x2e0d39['uniqueid']][_0x4c932e][_0xcb3b('0x4c')]=_0xcb3b('0x52');logger[_0xcb3b('0x31')](_0xcb3b('0x53'),_0x2e0d39[_0xcb3b('0x24')],util[_0xcb3b('0x32')](this[_0xcb3b('0xb')][_0x2e0d39[_0xcb3b('0x24')]][_0x4c932e],{'showHidden':![],'depth':null}));ami[_0xcb3b('0x1e')](_0xcb3b('0x54'),this[_0xcb3b('0xb')][_0x2e0d39[_0xcb3b('0x24')]][_0x4c932e]);}}}}}catch(_0xc308c6){logger['error'](_0xcb3b('0x55'),_0x2e0d39[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0xc308c6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb3b('0x1d')]['syncAgentComplete']=function(_0x2f2fc6){try{if(this[_0xcb3b('0x1f')](_0x2f2fc6)){logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2f2fc6[_0xcb3b('0x24')],util['inspect'](_0x2f2fc6,{'showHidden':![],'depth':null}));if(this[_0xcb3b('0xb')][_0x2f2fc6[_0xcb3b('0x24')]]){for(var _0x4ed5f7 in this[_0xcb3b('0xb')][_0x2f2fc6['uniqueid']]){if(this['channels'][_0x2f2fc6[_0xcb3b('0x24')]][_0xcb3b('0x56')](_0x4ed5f7)){if(this[_0xcb3b('0xb')][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7]['agentconnectAt']&&!this[_0xcb3b('0xb')][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7][_0xcb3b('0x15')]){logger[_0xcb3b('0x22')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2f2fc6[_0xcb3b('0x24')],this[_0xcb3b('0xb')][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7]['membername'],_0x4ed5f7);this['channels'][_0x2f2fc6['uniqueid']][_0x4ed5f7][_0xcb3b('0x15')]=!![];this[_0xcb3b('0xb')][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7][_0xcb3b('0x57')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xcb3b('0xb')][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7][_0xcb3b('0x3d')]=_0xcb3b('0x58');this[_0xcb3b('0xb')][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7]['reason']=_0x2f2fc6[_0xcb3b('0x4c')]==_0xcb3b('0x59')?_0xcb3b('0x5a'):_0x2f2fc6['reason'];this[_0xcb3b('0xb')][_0x2f2fc6['uniqueid']][_0x4ed5f7]['talktime']=_0x2f2fc6[_0xcb3b('0x5b')];if(this[_0xcb3b('0xc')][_0x2f2fc6['queue']]&&this[_0xcb3b('0xc')][_0x2f2fc6[_0xcb3b('0x2a')]][_0xcb3b('0x5c')]){this[_0xcb3b('0xb')][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7]['acwtime']=this[_0xcb3b('0xc')][_0x2f2fc6[_0xcb3b('0x2a')]][_0xcb3b('0x5d')];this['channels'][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7][_0xcb3b('0x5e')]=!![];}this[_0xcb3b('0xd')][_0x2f2fc6[_0xcb3b('0x5f')]]=_[_0xcb3b('0x2e')](this[_0xcb3b('0xd')][_0x2f2fc6[_0xcb3b('0x5f')]],[_0xcb3b('0x2a'),'destconnectedlinenum']);logger['debug'](_0xcb3b('0x60'),_0x2f2fc6[_0xcb3b('0x24')],util[_0xcb3b('0x32')](this[_0xcb3b('0xb')][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7],{'showHidden':![],'depth':null}));ami[_0xcb3b('0x1e')](_0xcb3b('0x61'),this['channels'][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7]);logger[_0xcb3b('0x31')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x2f2fc6[_0xcb3b('0x24')],util['inspect'](this['channels'][_0x2f2fc6['uniqueid']][_0x4ed5f7],{'showHidden':![],'depth':null}));this[_0xcb3b('0x1e')](util[_0xcb3b('0x35')](_0xcb3b('0x42'),_0x2f2fc6[_0xcb3b('0x25')]),_0xcb3b('0x62'),this[_0xcb3b('0xb')][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7]);}}}}}}catch(_0x28f387){logger[_0xcb3b('0x36')](_0xcb3b('0x63'),_0x2f2fc6[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x28f387,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x17')]=function(_0x3d1612){try{if(this['isNotNull'](_0x3d1612)){logger[_0xcb3b('0x31')](_0xcb3b('0x64'),_0x3d1612[_0xcb3b('0x24')],util['inspect'](_0x3d1612,{'showHidden':![],'depth':null}));this[_0xcb3b('0x65')](_0x3d1612['uniqueid'],_[_0xcb3b('0x66')](_0x3d1612[_0xcb3b('0x67')])[0x0],_0x3d1612['value']);if(this[_0xcb3b('0xb')][_0x3d1612['uniqueid']]){for(var _0x46e96c in this[_0xcb3b('0xb')][_0x3d1612[_0xcb3b('0x24')]]){if(this[_0xcb3b('0xb')][_0x3d1612[_0xcb3b('0x24')]][_0xcb3b('0x56')](_0x46e96c)){logger[_0xcb3b('0x22')](_0xcb3b('0x68'),_0x3d1612[_0xcb3b('0x24')],_0x46e96c,_[_0xcb3b('0x66')](_0x3d1612[_0xcb3b('0x67')])[0x0],_0x3d1612[_0xcb3b('0x69')]);if(_['isUndefined'](this[_0xcb3b('0xb')][_0x3d1612['uniqueid']][_0x46e96c][_0xcb3b('0xe')])){this[_0xcb3b('0xb')][_0x3d1612[_0xcb3b('0x24')]][_0x46e96c]['variables']={};}this[_0xcb3b('0xb')][_0x3d1612['uniqueid']][_0x46e96c]['variables']=this[_0xcb3b('0xe')][_0x3d1612[_0xcb3b('0x24')]];}}}}}catch(_0x3069bc){logger[_0xcb3b('0x36')](_0xcb3b('0x6a'),_0x3d1612[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x3069bc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x65')]=function(_0x454f05,_0x4eb16c,_0xfbe012){var _0x2abc99=['rtpaudioqos',_0xcb3b('0x6b'),'rtpaudioqosjitter',_0xcb3b('0x6c'),_0xcb3b('0x6d'),_0xcb3b('0x6e'),'rtpaudioqosrtt',_0xcb3b('0x6f'),_0xcb3b('0x70'),_0xcb3b('0x71'),_0xcb3b('0x72'),'bridgepvtcallid','membercalls',_0xcb3b('0x73'),'memberinterface','memberlastcall',_0xcb3b('0x25'),_0xcb3b('0x74'),'memberrealtime'];if(!_[_0xcb3b('0x75')](_0x4eb16c)&&!_[_0xcb3b('0x76')](_0x2abc99,_0x4eb16c)){if(_[_0xcb3b('0x20')](this[_0xcb3b('0xe')][_0x454f05])){this[_0xcb3b('0xe')][_0x454f05]={};}this[_0xcb3b('0xe')][_0x454f05][_0x4eb16c]=_0xfbe012;}};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x18')]=function(_0x5c5cb5){try{if(this[_0xcb3b('0x1f')](_0x5c5cb5)){logger['debug'](_0xcb3b('0x77'),_0x5c5cb5[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x5c5cb5,{'showHidden':![],'depth':null}));if(this[_0xcb3b('0xb')][_0x5c5cb5[_0xcb3b('0x24')]]){for(var _0x13d3b9 in this[_0xcb3b('0xb')][_0x5c5cb5[_0xcb3b('0x24')]]){if(this['channels'][_0x5c5cb5[_0xcb3b('0x24')]][_0xcb3b('0x56')](_0x13d3b9)){if(this[_0xcb3b('0xb')][_0x5c5cb5[_0xcb3b('0x24')]][_0x13d3b9]['reason']==_0xcb3b('0x59')&&this[_0xcb3b('0xb')][_0x5c5cb5[_0xcb3b('0x24')]][_0x13d3b9][_0xcb3b('0x15')]){logger['info'](_0xcb3b('0x78'),_0x5c5cb5[_0xcb3b('0x24')],_0x13d3b9);this[_0xcb3b('0xb')][_0x5c5cb5[_0xcb3b('0x24')]][_0x13d3b9][_0xcb3b('0x57')]=moment()[_0xcb3b('0x35')](_0xcb3b('0x28'));}}}logger[_0xcb3b('0x31')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x5c5cb5[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_[_0xcb3b('0x79')](this[_0xcb3b('0xb')][_0x5c5cb5['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0xcb3b('0x1e')]('custom:voiceAgentReport',_[_0xcb3b('0x79')](this['channels'][_0x5c5cb5[_0xcb3b('0x24')]]));delete this['channels'][_0x5c5cb5[_0xcb3b('0x24')]];}if(this[_0xcb3b('0xe')][_0x5c5cb5[_0xcb3b('0x24')]]){delete this['variables'][_0x5c5cb5['uniqueid']];}}}catch(_0x34e2c5){logger[_0xcb3b('0x36')](_0xcb3b('0x7a'),_0x5c5cb5[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x34e2c5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x7b')]=function(_0x3d6539){try{if(this[_0xcb3b('0x1f')](_0x3d6539)){logger[_0xcb3b('0x31')](_0xcb3b('0x7c'),_0x3d6539[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x3d6539,{'showHidden':![],'depth':null}));if(this[_0xcb3b('0xb')][_0x3d6539[_0xcb3b('0x7d')]]){for(var _0x2d6d3d in this['channels'][_0x3d6539[_0xcb3b('0x7d')]]){if(this[_0xcb3b('0xb')][_0x3d6539[_0xcb3b('0x7d')]][_0xcb3b('0x56')](_0x2d6d3d)){if(_0x3d6539[_0xcb3b('0x7e')]===_0x2d6d3d){logger[_0xcb3b('0x22')](_0xcb3b('0x7f'),_0x3d6539[_0xcb3b('0x24')],this[_0xcb3b('0xb')][_0x3d6539[_0xcb3b('0x7d')]][_0x2d6d3d][_0xcb3b('0x25')],_0x2d6d3d);var _0x59ae87=moment();this[_0xcb3b('0xb')][_0x3d6539[_0xcb3b('0x7d')]][_0x2d6d3d][_0xcb3b('0x15')]=!![];this[_0xcb3b('0xb')][_0x3d6539[_0xcb3b('0x7d')]][_0x2d6d3d][_0xcb3b('0x57')]=moment()[_0xcb3b('0x35')](_0xcb3b('0x28'));this[_0xcb3b('0xb')][_0x3d6539[_0xcb3b('0x7d')]][_0x2d6d3d][_0xcb3b('0x3d')]='complete';this['channels'][_0x3d6539['transfereeuniqueid']][_0x2d6d3d][_0xcb3b('0x4c')]=_0xcb3b('0x59');this[_0xcb3b('0xb')][_0x3d6539[_0xcb3b('0x7d')]][_0x2d6d3d][_0xcb3b('0x5b')]=_0x59ae87[_0xcb3b('0x80')](this[_0xcb3b('0xb')][_0x3d6539[_0xcb3b('0x7d')]][_0x2d6d3d][_0xcb3b('0x81')],'seconds');}}}}if(this['channels'][_0x3d6539[_0xcb3b('0x82')]]){var _0x933230=this['channels'][_0x3d6539['secondtransfereruniqueid']];this[_0xcb3b('0xb')][_0x3d6539['secondtransfereruniqueid']]=this[_0xcb3b('0xb')][_0x3d6539['transfereeuniqueid']];this[_0xcb3b('0xb')][_0x3d6539[_0xcb3b('0x7d')]]=_0x933230;}}}catch(_0x336d67){logger[_0xcb3b('0x36')](_0xcb3b('0x83'),_0x3d6539[_0xcb3b('0x24')],util['inspect'](_0x336d67,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb3b('0x1d')]['syncBlindTransfer']=function(_0x1077c4){try{if(this[_0xcb3b('0x1f')](_0x1077c4)){logger[_0xcb3b('0x31')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x1077c4['uniqueid'],util[_0xcb3b('0x32')](_0x1077c4,{'showHidden':![],'depth':null}));if(this['channels'][_0x1077c4[_0xcb3b('0x7d')]]){for(var _0x45fedf in this[_0xcb3b('0xb')][_0x1077c4['transfereeuniqueid']]){if(this[_0xcb3b('0xb')][_0x1077c4[_0xcb3b('0x7d')]][_0xcb3b('0x56')](_0x45fedf)){if(_0x1077c4[_0xcb3b('0x84')]===_0x45fedf){logger[_0xcb3b('0x22')](_0xcb3b('0x85'),_0x1077c4[_0xcb3b('0x24')],this[_0xcb3b('0xb')][_0x1077c4[_0xcb3b('0x7d')]][_0x45fedf]['membername'],_0x45fedf);var _0x4f4ffd=moment();this[_0xcb3b('0xb')][_0x1077c4['transfereeuniqueid']][_0x45fedf][_0xcb3b('0x15')]=!![];this['channels'][_0x1077c4[_0xcb3b('0x7d')]][_0x45fedf][_0xcb3b('0x57')]=_0x4f4ffd;this[_0xcb3b('0xb')][_0x1077c4[_0xcb3b('0x7d')]][_0x45fedf][_0xcb3b('0x3d')]=_0xcb3b('0x58');this['channels'][_0x1077c4['transfereeuniqueid']][_0x45fedf][_0xcb3b('0x4c')]=_0xcb3b('0x59');this['channels'][_0x1077c4['transfereeuniqueid']][_0x45fedf]['talktime']=_0x4f4ffd[_0xcb3b('0x80')](this[_0xcb3b('0xb')][_0x1077c4[_0xcb3b('0x7d')]][_0x45fedf][_0xcb3b('0x81')],_0xcb3b('0x86'));}}}}}}catch(_0x10b56f){logger[_0xcb3b('0x36')](_0xcb3b('0x87'),_0x1077c4[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x10b56f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x88')]=function(_0x45202c){var _0x33c5e4='';try{if(this[_0xcb3b('0x1f')](_0x45202c)){logger[_0xcb3b('0x31')](_0xcb3b('0x89'),_0x45202c['uniqueid'],util[_0xcb3b('0x32')](_0x45202c,{'showHidden':![],'depth':null}));if(_0x45202c[_0xcb3b('0x8a')]){_0x33c5e4=_0x45202c[_0xcb3b('0x8a')]['substring'](0x0,_0x45202c['channel'][_0xcb3b('0x8b')]('-'));if(this[_0xcb3b('0xd')][_0x33c5e4]){logger[_0xcb3b('0x22')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x45202c['uniqueid'],_0x33c5e4);this[_0xcb3b('0xd')][_0x33c5e4][_0xcb3b('0x8c')]=!![];}}}}catch(_0x119602){logger['error'](_0xcb3b('0x8d'),_0x45202c[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x119602,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x1a')]=function(_0x5e3c61){var _0x429abf='';try{if(this[_0xcb3b('0x1f')](_0x5e3c61)){logger[_0xcb3b('0x31')](_0xcb3b('0x8e'),_0x5e3c61[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x5e3c61,{'showHidden':![],'depth':null}));if(_0x5e3c61[_0xcb3b('0x8a')]){_0x429abf=_0x5e3c61[_0xcb3b('0x8a')][_0xcb3b('0x8f')](0x0,_0x5e3c61[_0xcb3b('0x8a')]['lastIndexOf']('-'));if(this[_0xcb3b('0xd')][_0x429abf]){logger[_0xcb3b('0x22')](_0xcb3b('0x90'),_0x5e3c61['uniqueid'],_0x429abf);this[_0xcb3b('0xd')][_0x429abf]['onhold']=![];}}}}catch(_0xa6cbb){logger[_0xcb3b('0x36')](_0xcb3b('0x91'),_0x5e3c61['uniqueid'],util[_0xcb3b('0x32')](_0xa6cbb,{'showHidden':![],'depth':null}));}};module[_0xcb3b('0x92')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 72b91f1..fb68c66 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 _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 +var _0xb032=['starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','from-sip','split','agents','channel','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','includes','lastapplication','lastdata','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','xcally-motion-preview','connectedlinenum','destinationchannel','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','monitorFilename','monitors','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%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','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','diff','billableseconds','omit','user:agentcomplete','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','lodash','moment','path','ioredis','../../../config/environment','../../../config/logger','../model/channel','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','set','queue','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','redis','defaults','localhost','socket.io-emitter','channels','blindTransfers','coreshowchannel','bind','newexten','syncNewExten','newchannel','syncNewChannel','newstate','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','[%s][voiceCallReport][newcallerid]','debug','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','context','exten'];(function(_0x3e3a7e,_0xde5148){var _0x310739=function(_0x2dd325){while(--_0x2dd325){_0x3e3a7e['push'](_0x3e3a7e['shift']());}};_0x310739(++_0xde5148);}(_0xb032,0x75));var _0x2b03=function(_0x20d435,_0x1c5415){_0x20d435=_0x20d435-0x0;var _0x54288d=_0xb032[_0x20d435];return _0x54288d;};'use strict';var BPromise=require('bluebird');var _=require(_0x2b03('0x0'));var moment=require(_0x2b03('0x1'));var util=require('util');var path=require(_0x2b03('0x2'));var Redis=require(_0x2b03('0x3'));var config=require(_0x2b03('0x4'));var logger=require(_0x2b03('0x5'))('ami');var ami=require('../ami');var Channel=require(_0x2b03('0x6'));var statusDesc=[_0x2b03('0x7'),_0x2b03('0x8'),_0x2b03('0x9'),_0x2b03('0xa'),_0x2b03('0xb'),'unavailable',_0x2b03('0xc'),_0x2b03('0xd'),'onhold'];var applications=[_0x2b03('0xe'),_0x2b03('0xf'),'agi',_0x2b03('0x10'),_0x2b03('0x11'),_0x2b03('0x12')];var dispositions=[_0x2b03('0x13'),_0x2b03('0x14'),_0x2b03('0x14'),_0x2b03('0x13'),'NO\x20ANSWER',_0x2b03('0x13'),_0x2b03('0x15'),'BUSY','FAILED',_0x2b03('0x14'),_0x2b03('0x14')];var actions={};config[_0x2b03('0x16')]=_[_0x2b03('0x17')](config['redis'],{'host':_0x2b03('0x18'),'port':0x18eb});var io=require(_0x2b03('0x19'))(new Redis(config[_0x2b03('0x16')]));function VoiceCallReport(_0x2d1547){this['channels']=_0x2d1547[_0x2b03('0x1a')];this['agents']=_0x2d1547['agents'];this[_0x2b03('0x1b')]={};ami['on'](_0x2b03('0x1c'),this['syncNewExten'][_0x2b03('0x1d')](this));ami['on'](_0x2b03('0x1e'),this[_0x2b03('0x1f')]['bind'](this));ami['on'](_0x2b03('0x20'),this[_0x2b03('0x21')][_0x2b03('0x1d')](this));ami['on'](_0x2b03('0x22'),this['syncNewState']['bind'](this));ami['on'](_0x2b03('0x23'),this[_0x2b03('0x24')][_0x2b03('0x1d')](this));ami['on'](_0x2b03('0x25'),this[_0x2b03('0x26')][_0x2b03('0x1d')](this));ami['on'](_0x2b03('0x27'),this[_0x2b03('0x28')]['bind'](this));ami['on'](_0x2b03('0x29'),this[_0x2b03('0x2a')][_0x2b03('0x1d')](this));ami['on'](_0x2b03('0x2b'),this[_0x2b03('0x2c')][_0x2b03('0x1d')](this));ami['on']('musiconholdstart',this[_0x2b03('0x2d')][_0x2b03('0x1d')](this));ami['on'](_0x2b03('0x2e'),this['syncMusicOnHoldStop'][_0x2b03('0x1d')](this));try{logger['info'](_0x2b03('0x2f'));ami['actionCoreShowChannels']();}catch(_0x25da94){logger[_0x2b03('0x30')](_0x2b03('0x31'),util[_0x2b03('0x32')](_0x25da94,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x2b03('0x33')][_0x2b03('0x34')]=function(_0x10d945){return _0x10d945!==null&&!_[_0x2b03('0x35')](_0x10d945);};VoiceCallReport[_0x2b03('0x33')][_0x2b03('0x36')]=function(_0x39811f,_0x4f96a0,_0xe9b557){io['to'](_0x39811f)[_0x2b03('0x36')](_0x4f96a0,_0xe9b557);};VoiceCallReport[_0x2b03('0x33')][_0x2b03('0x28')]=function(_0xe2cdb6){try{if(this[_0x2b03('0x34')](_0xe2cdb6)){logger[_0x2b03('0x37')](_0x2b03('0x38'),_0xe2cdb6[_0x2b03('0x39')],_0xe2cdb6[_0x2b03('0x3a')],_0xe2cdb6[_0x2b03('0x3b')]);logger['debug'](_0x2b03('0x3c'),_0xe2cdb6[_0x2b03('0x39')],util['inspect'](_0xe2cdb6,{'showHidden':![],'depth':null}));if(_0xe2cdb6['uniqueid']===_0xe2cdb6[_0x2b03('0x3d')]){if(!_[_0x2b03('0x35')](this[_0x2b03('0x1a')][_0xe2cdb6[_0x2b03('0x39')]])){_[_0x2b03('0x3e')](this[_0x2b03('0x1a')][_0xe2cdb6[_0x2b03('0x39')]],_[_0x2b03('0x3f')](_0xe2cdb6,_[_0x2b03('0x40')](this[_0x2b03('0x1a')][_0xe2cdb6[_0x2b03('0x39')]])));}}}}catch(_0x41a846){logger[_0x2b03('0x30')](_0x2b03('0x41'),_0xe2cdb6[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x41a846,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b03('0x33')][_0x2b03('0x21')]=function(_0x151b57){try{if(this[_0x2b03('0x34')](_0x151b57)){logger[_0x2b03('0x42')](_0x2b03('0x43'),_0x151b57['uniqueid'],util[_0x2b03('0x32')](_0x151b57,{'showHidden':![],'depth':null}));if(_0x151b57['uniqueid']===_0x151b57[_0x2b03('0x3d')]&&_0x151b57['channel']!=_0x2b03('0x44')){if(_[_0x2b03('0x35')](this['channels'][_0x151b57[_0x2b03('0x39')]])){logger[_0x2b03('0x37')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x151b57[_0x2b03('0x39')],_0x151b57[_0x2b03('0x45')],_0x151b57[_0x2b03('0x46')]);this[_0x2b03('0x1a')][_0x151b57[_0x2b03('0x39')]]=new Channel();this['channels'][_0x151b57[_0x2b03('0x39')]][_0x2b03('0x47')]=moment()[_0x2b03('0x48')](_0x2b03('0x49'));this[_0x2b03('0x1a')][_0x151b57[_0x2b03('0x39')]][_0x2b03('0x4a')]=dispositions[_[_0x2b03('0x4b')](_0x151b57[_0x2b03('0x4c')])];_[_0x2b03('0x3e')](this[_0x2b03('0x1a')][_0x151b57[_0x2b03('0x39')]],_['pick'](_0x151b57,_[_0x2b03('0x40')](this[_0x2b03('0x1a')][_0x151b57[_0x2b03('0x39')]])));if(_0x151b57[_0x2b03('0x45')]===_0x2b03('0x4d')){if(this['agents'][_0x151b57['channel'][_0x2b03('0x4e')]('-')[0x0]]){this[_0x2b03('0x4f')][_0x151b57[_0x2b03('0x50')][_0x2b03('0x4e')]('-')[0x0]][_0x2b03('0x51')]=_0x151b57['exten'];logger[_0x2b03('0x42')](_0x2b03('0x52'),_0x151b57[_0x2b03('0x39')],util[_0x2b03('0x32')]({'destaccountcode':this[_0x2b03('0x4f')][_0x151b57[_0x2b03('0x50')][_0x2b03('0x4e')]('-')[0x0]][_0x2b03('0x53')],'destconnectedlinenum':_0x151b57[_0x2b03('0x46')]},{'showHidden':![],'depth':null}));this[_0x2b03('0x36')](util[_0x2b03('0x48')](_0x2b03('0x54'),this[_0x2b03('0x4f')][_0x151b57[_0x2b03('0x50')][_0x2b03('0x4e')]('-')[0x0]][_0x2b03('0x55')]),_0x2b03('0x56'),{'destaccountcode':this['agents'][_0x151b57[_0x2b03('0x50')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x151b57['exten']});}}}}}}catch(_0xed9602){logger['error'](_0x2b03('0x57'),_0x151b57[_0x2b03('0x39')],util[_0x2b03('0x32')](_0xed9602,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b03('0x33')][_0x2b03('0x1f')]=function(_0x56480c){try{if(this['isNotNull'](_0x56480c)){logger[_0x2b03('0x42')]('[%s][voiceCallReport][newexten]\x20event:',_0x56480c[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x56480c,{'showHidden':![],'depth':null}));if(_0x56480c[_0x2b03('0x39')]===_0x56480c[_0x2b03('0x3d')]&&_0x56480c[_0x2b03('0x46')]!='h'&&_0x56480c[_0x2b03('0x50')]!='OutgoingSpoolFailed'){_0x56480c[_0x2b03('0x58')]=_0x56480c[_0x2b03('0x58')][_0x2b03('0x59')]();_0x56480c[_0x2b03('0x5a')]=(_0x56480c[_0x2b03('0x5b')]||_0x56480c[_0x2b03('0x5a')])[_0x2b03('0x59')]();logger[_0x2b03('0x37')](_0x2b03('0x5c'),_0x56480c['uniqueid'],_0x56480c['application'],_0x56480c[_0x2b03('0x5a')]);if(_['isUndefined'](this['channels'][_0x56480c['uniqueid']])){this[_0x2b03('0x1a')][_0x56480c[_0x2b03('0x39')]]=new Channel();this[_0x2b03('0x1a')][_0x56480c[_0x2b03('0x39')]][_0x2b03('0x47')]=_0x56480c[_0x2b03('0x5d')]?moment()['subtract'](moment[_0x2b03('0x5d')](_0x56480c[_0x2b03('0x5d')])[_0x2b03('0x5e')](),_0x2b03('0x5e'))[_0x2b03('0x48')](_0x2b03('0x49')):moment()[_0x2b03('0x48')](_0x2b03('0x49'));this['channels'][_0x56480c[_0x2b03('0x39')]][_0x2b03('0x4a')]=_0x2b03('0x13');}_[_0x2b03('0x3e')](this['channels'][_0x56480c['uniqueid']],_[_0x2b03('0x3f')](_0x56480c,_[_0x2b03('0x40')](this[_0x2b03('0x1a')][_0x56480c['uniqueid']])));if(_[_0x2b03('0x5f')](applications,_0x56480c[_0x2b03('0x58')])){this[_0x2b03('0x1a')][_0x56480c[_0x2b03('0x39')]][_0x2b03('0x60')]=_0x56480c['application'];this[_0x2b03('0x1a')][_0x56480c[_0x2b03('0x39')]][_0x2b03('0x61')]=_0x56480c['applicationdata'];if(_0x56480c['application']===_0x2b03('0xe')&&_[_0x2b03('0x62')](_0x56480c['applicationdata'],_0x2b03('0x63'))){var _0x342b07=_0x56480c['applicationdata']['split']('=');var _0x5b4e34=_0x342b07[0x0][_0x2b03('0x64')](/cdr\((.*)\)/);if(_0x5b4e34){this[_0x2b03('0x1a')][_0x56480c[_0x2b03('0x39')]][_0x5b4e34[0x1]]=_0x342b07[0x1];}}else if(_0x56480c[_0x2b03('0x58')]===_0x2b03('0xf')){this[_0x2b03('0x1a')][_0x56480c['uniqueid']][_0x2b03('0xf')]=_0x56480c[_0x2b03('0x5a')][_0x2b03('0x4e')](',')[0x0];}}}}}catch(_0x52a43f){logger['error'](_0x2b03('0x65'),_0x56480c[_0x2b03('0x39')],util['inspect'](_0x52a43f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b03('0x33')][_0x2b03('0x66')]=function(_0x66775e){try{if(this[_0x2b03('0x34')](_0x66775e)){logger['info'](_0x2b03('0x67'),_0x66775e[_0x2b03('0x39')],_0x66775e[_0x2b03('0x3d')],_0x66775e[_0x2b03('0x3a')],_0x66775e[_0x2b03('0x3b')]);logger['debug'](_0x2b03('0x68'),_0x66775e['uniqueid'],util[_0x2b03('0x32')](_0x66775e,{'showHidden':![],'depth':null}));if(_0x66775e['uniqueid']!==_0x66775e['linkedid']){if(this[_0x2b03('0x1a')][_0x66775e[_0x2b03('0x3d')]]){if(_0x66775e[_0x2b03('0x4c')]==='6'){if(!this[_0x2b03('0x1a')][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x69')]){var _0x469141=moment();this['channels'][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x69')]=!![];this[_0x2b03('0x1a')][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x6a')]=_0x469141[_0x2b03('0x48')](_0x2b03('0x49'));if(this['channels'][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x47')]){this[_0x2b03('0x1a')][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x6b')]=_0x469141['diff'](this[_0x2b03('0x1a')][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x47')],_0x2b03('0x5e'));}}this['channels'][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x3d')]=_0x66775e[_0x2b03('0x39')];if(_0x66775e[_0x2b03('0x3b')]!==_0x2b03('0x6c')){this['channels'][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x6d')]=_0x66775e[_0x2b03('0x3b')];}this[_0x2b03('0x1a')][_0x66775e['linkedid']]['connectedlinename']=_0x66775e['calleridname'];this[_0x2b03('0x1a')][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x6e')]=_0x66775e[_0x2b03('0x50')];this[_0x2b03('0x1a')][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x4a')]=dispositions[_[_0x2b03('0x4b')](_0x66775e['channelstate'])];if(this[_0x2b03('0x4f')][_0x66775e['channel'][_0x2b03('0x4e')]('-')[0x0]]){this['channels'][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x6f')]=this[_0x2b03('0x4f')][_0x66775e[_0x2b03('0x50')][_0x2b03('0x4e')]('-')[0x0]]['id'];this[_0x2b03('0x1a')][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x70')]=this[_0x2b03('0x4f')][_0x66775e[_0x2b03('0x50')]['split']('-')[0x0]][_0x2b03('0x55')];}}}}else{if(this['channels'][_0x66775e['uniqueid']]){if(_0x66775e[_0x2b03('0x4c')]==='6'){if(this['agents'][_0x66775e['channel'][_0x2b03('0x4e')]('-')[0x0]]){this[_0x2b03('0x1a')][_0x66775e[_0x2b03('0x39')]][_0x2b03('0x6f')]=this[_0x2b03('0x4f')][_0x66775e['channel'][_0x2b03('0x4e')]('-')[0x0]]['id'];this[_0x2b03('0x1a')][_0x66775e[_0x2b03('0x39')]]['membername']=this['agents'][_0x66775e[_0x2b03('0x50')][_0x2b03('0x4e')]('-')[0x0]][_0x2b03('0x55')];}}}}}}catch(_0x16ec86){logger[_0x2b03('0x30')](_0x2b03('0x71'),_0x66775e['uniqueid'],util['inspect'](_0x16ec86,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2b03('0x72')]=function(_0x8c8c37,_0xdb6c19){try{if(this['channels'][_0x8c8c37]){logger[_0x2b03('0x37')](_0x2b03('0x73'),_0x8c8c37,_0xdb6c19);this[_0x2b03('0x1a')][_0x8c8c37][_0x2b03('0x74')]=!![];if(_[_0x2b03('0x75')](_0xdb6c19,_0x2b03('0x76'))){_0xdb6c19=_0xdb6c19[_0x2b03('0x77')](_0x2b03('0x76'),'.WAV');}this[_0x2b03('0x1a')][_0x8c8c37][_0x2b03('0x78')]=_0xdb6c19;var _0x271401=_['find'](this[_0x2b03('0x1a')][_0x8c8c37][_0x2b03('0x79')],{'filename':_0xdb6c19});if(_['isNil'](_0x271401)){this[_0x2b03('0x1a')][_0x8c8c37][_0x2b03('0x79')][_0x2b03('0x7a')]({'filename':_0xdb6c19,'createdAt':moment()[_0x2b03('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x2b03('0x7b')});}}}catch(_0x33d624){logger[_0x2b03('0x30')]('[%s][voiceCallReport][mixMonitorFilename]',_0x8c8c37,util[_0x2b03('0x32')](_0x33d624,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b03('0x33')][_0x2b03('0x24')]=function(_0x16476f){try{if(this[_0x2b03('0x34')](_0x16476f)){logger['debug'](_0x2b03('0x7c'),_0x16476f[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x16476f,{'showHidden':![],'depth':null}));if(this[_0x2b03('0x1a')][_0x16476f[_0x2b03('0x39')]]&&_0x16476f[_0x2b03('0x50')]!=_0x2b03('0x44')){if(this[_0x2b03('0x34')](_0x16476f[_0x2b03('0x7d')])){if(this[_0x2b03('0x34')](_0x16476f[_0x2b03('0x7d')][_0x2b03('0x7e')])){logger[_0x2b03('0x37')](_0x2b03('0x7f'),_0x16476f[_0x2b03('0x39')],_0x16476f[_0x2b03('0x80')]);this[_0x2b03('0x72')](_0x16476f[_0x2b03('0x39')],_0x16476f[_0x2b03('0x80')]);}else if(this[_0x2b03('0x34')](_0x16476f[_0x2b03('0x7d')]['xmd-phone'])){logger['info'](_0x2b03('0x81'),_0x16476f[_0x2b03('0x39')],_0x16476f[_0x2b03('0x80')]);this[_0x2b03('0x1a')][_0x16476f[_0x2b03('0x39')]][_0x2b03('0x3b')]=_0x16476f[_0x2b03('0x80')];}else if(this[_0x2b03('0x34')](_0x16476f[_0x2b03('0x7d')]['xmd-callerid'])){logger[_0x2b03('0x37')](_0x2b03('0x82'),_0x16476f[_0x2b03('0x39')],_0x16476f['value']);this['channels'][_0x16476f['uniqueid']][_0x2b03('0x83')]=_0x16476f[_0x2b03('0x80')];}else if(this[_0x2b03('0x34')](_0x16476f['variable']['xmd-cdrtype'])){logger[_0x2b03('0x37')](_0x2b03('0x84'),_0x16476f[_0x2b03('0x39')],_0x16476f['value']);this[_0x2b03('0x1a')][_0x16476f[_0x2b03('0x39')]][_0x2b03('0x85')]=_0x16476f[_0x2b03('0x80')];}else if(this['isNotNull'](_0x16476f[_0x2b03('0x7d')][_0x2b03('0x86')])){logger[_0x2b03('0x37')](_0x2b03('0x87'),_0x16476f[_0x2b03('0x39')],_0x16476f[_0x2b03('0x80')][_0x2b03('0x4e')](',')[0x0]);this['channels'][_0x16476f[_0x2b03('0x39')]][_0x2b03('0xf')]=_0x16476f['value'][_0x2b03('0x4e')](',')[0x0];}else if(this['isNotNull'](_0x16476f[_0x2b03('0x7d')][_0x2b03('0x88')])){logger[_0x2b03('0x37')](_0x2b03('0x89'),_0x16476f[_0x2b03('0x39')],_0x16476f[_0x2b03('0x80')]);this[_0x2b03('0x1a')][_0x16476f[_0x2b03('0x39')]][_0x2b03('0x8a')]=_0x16476f['value'];}else if(this[_0x2b03('0x34')](_0x16476f[_0x2b03('0x7d')][_0x2b03('0x8b')])){logger[_0x2b03('0x37')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x16476f[_0x2b03('0x39')],_0x16476f[_0x2b03('0x80')]);this['channels'][_0x16476f[_0x2b03('0x39')]]['destination']=_0x16476f[_0x2b03('0x80')];}else if(this['isNotNull'](_0x16476f[_0x2b03('0x7d')][_0x2b03('0x8c')])){logger[_0x2b03('0x37')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x16476f[_0x2b03('0x39')],_0x16476f[_0x2b03('0x80')]);this[_0x2b03('0x1a')][_0x16476f[_0x2b03('0x39')]][_0x2b03('0x8d')]=_0x16476f[_0x2b03('0x80')];}else if(this[_0x2b03('0x34')](_0x16476f[_0x2b03('0x7d')][_0x2b03('0x8e')])){logger['info'](_0x2b03('0x8f'),_0x16476f[_0x2b03('0x39')],_0x16476f[_0x2b03('0x80')]);this[_0x2b03('0x1a')][_0x16476f[_0x2b03('0x39')]]['queue']=_0x16476f[_0x2b03('0x80')];}else if(this[_0x2b03('0x34')](_0x16476f[_0x2b03('0x7d')][_0x2b03('0x90')])){logger['info'](_0x2b03('0x91'),_0x16476f[_0x2b03('0x39')],_0x16476f[_0x2b03('0x80')]);this[_0x2b03('0x1a')][_0x16476f['uniqueid']][_0x2b03('0x92')]=_0x16476f['value'];}}}else if(this[_0x2b03('0x34')](_0x16476f[_0x2b03('0x7d')][_0x2b03('0x7e')])){if(_0x16476f[_0x2b03('0x80')]){var _0x20882c=path['parse'](_0x16476f[_0x2b03('0x80')])['name'];logger[_0x2b03('0x37')](_0x2b03('0x7f'),_0x20882c,_0x16476f['value']);this[_0x2b03('0x72')](_0x20882c,_0x16476f[_0x2b03('0x80')]);}}else if(this['channels'][_0x16476f['linkedid']]){if(this[_0x2b03('0x34')](_0x16476f['variable'])){if(this[_0x2b03('0x34')](_0x16476f[_0x2b03('0x7d')]['sipcallid'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x16476f[_0x2b03('0x3d')],_0x16476f[_0x2b03('0x80')]);this['channels'][_0x16476f['linkedid']]['sipcalllinkedid']=_0x16476f['value'];}}}}}catch(_0x38d79c){logger['error'](_0x2b03('0x93'),_0x16476f[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x38d79c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b03('0x33')]['syncHangup']=function(_0x431e80){try{if(this[_0x2b03('0x34')](_0x431e80)){logger[_0x2b03('0x42')](_0x2b03('0x94'),_0x431e80[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x431e80,{'showHidden':![],'depth':null}));if(this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]]){logger[_0x2b03('0x37')](_0x2b03('0x95'),_0x431e80['uniqueid'],_0x431e80[_0x2b03('0x96')]);var _0x38d9a5=moment();this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]][_0x2b03('0x97')]=_0x38d9a5[_0x2b03('0x48')](_0x2b03('0x49'));this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]][_0x2b03('0x5d')]=_0x38d9a5[_0x2b03('0x98')](this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]][_0x2b03('0x47')],_0x2b03('0x5e'));if(this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]]['answered']){this['channels'][_0x431e80[_0x2b03('0x39')]][_0x2b03('0x99')]=_0x38d9a5['diff'](this[_0x2b03('0x1a')][_0x431e80['uniqueid']]['answertime'],_0x2b03('0x5e'));this['channels'][_0x431e80[_0x2b03('0x39')]]['holdtime']=this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]][_0x2b03('0x5d')]-this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]]['billableseconds'];}if(_0x431e80[_0x2b03('0x45')]===_0x2b03('0x4d')){if(this[_0x2b03('0x4f')][_0x431e80[_0x2b03('0x50')][_0x2b03('0x4e')]('-')[0x0]]){this['agents'][_0x431e80['channel'][_0x2b03('0x4e')]('-')[0x0]]=_[_0x2b03('0x9a')](this[_0x2b03('0x4f')][_0x431e80[_0x2b03('0x50')][_0x2b03('0x4e')]('-')[0x0]],[_0x2b03('0x51')]);logger[_0x2b03('0x42')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x431e80[_0x2b03('0x39')],util['inspect']({'destaccountcode':this[_0x2b03('0x4f')][_0x431e80[_0x2b03('0x50')][_0x2b03('0x4e')]('-')[0x0]][_0x2b03('0x53')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x2b03('0x48')](_0x2b03('0x54'),this['agents'][_0x431e80['channel'][_0x2b03('0x4e')]('-')[0x0]]['name']),_0x2b03('0x9b'),{'destaccountcode':this['agents'][_0x431e80['channel']['split']('-')[0x0]][_0x2b03('0x53')]});}}if(_0x431e80[_0x2b03('0x9c')]===_0x2b03('0x9d')){this['blindTransfers'][_0x431e80[_0x2b03('0x39')]]=this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]];}else{if(this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]][_0x2b03('0x85')]===_0x2b03('0x9e')&&this[_0x2b03('0x1b')][_0x431e80[_0x2b03('0x39')]]){this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]][_0x2b03('0x39')]=[this[_0x2b03('0x1a')][_0x431e80['uniqueid']][_0x2b03('0x3d')],this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]][_0x2b03('0x3d')]=this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]][_0x2b03('0x39')]][0x0];delete this[_0x2b03('0x1b')][_0x431e80[_0x2b03('0x39')]];}}logger[_0x2b03('0x42')](_0x2b03('0x9f'),_0x431e80[_0x2b03('0x39')],util[_0x2b03('0x32')](this['channels'][_0x431e80[_0x2b03('0x39')]],{'showHidden':![],'depth':null}));ami['emit'](_0x2b03('0xa0'),this['channels'][_0x431e80[_0x2b03('0x39')]]);delete this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]];}}}catch(_0x3b6d47){logger[_0x2b03('0x30')](_0x2b03('0xa1'),_0x431e80[_0x2b03('0x39')],util['inspect'](_0x3b6d47,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b03('0x33')]['syncAttendedTransfer']=function(_0x3482bc){try{if(this[_0x2b03('0x34')](_0x3482bc)){logger[_0x2b03('0x37')](_0x2b03('0xa2'),_0x3482bc[_0x2b03('0x39')],_0x3482bc['origtransferercalleridnum'],_0x3482bc[_0x2b03('0xa3')]);logger[_0x2b03('0x42')](_0x2b03('0xa4'),_0x3482bc[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x3482bc,{'showHidden':![],'depth':null}));if(this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa5')]]){this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa5')]][_0x2b03('0xa6')]=_0x3482bc[_0x2b03('0xa7')];this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa5')]]['transferconnectedlinenum']=_0x3482bc[_0x2b03('0xa3')];if(this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa8')]]){var _0x4f915b=this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa8')]];this[_0x2b03('0x1a')][_0x3482bc['secondtransfereruniqueid']]=this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa5')]];this['channels'][_0x3482bc['transfereeuniqueid']]=_0x4f915b;}}else if(this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa9')]]){this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa9')]][_0x2b03('0xa6')]=_0x3482bc[_0x2b03('0xa7')];this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa9')]][_0x2b03('0xaa')]=_0x3482bc[_0x2b03('0xa3')];if(this[_0x2b03('0x1a')][_0x3482bc['origtransfereruniqueid']]){var _0x4f915b=this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xab')]];this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xab')]]=this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa9')]];this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa9')]]=_0x4f915b;}}}}catch(_0x1cfc66){logger[_0x2b03('0x30')](_0x2b03('0xac'),_0x3482bc[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x1cfc66,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b03('0x33')]['syncBlindTransfer']=function(_0x4d24d6){try{if(this['isNotNull'](_0x4d24d6)){logger[_0x2b03('0x37')](_0x2b03('0xad'),_0x4d24d6[_0x2b03('0x39')],_0x4d24d6[_0x2b03('0xae')],_0x4d24d6[_0x2b03('0xaf')]);logger['debug'](_0x2b03('0xb0'),_0x4d24d6[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x4d24d6,{'showHidden':![],'depth':null}));if(this['channels'][_0x4d24d6[_0x2b03('0xa5')]]){this[_0x2b03('0x1a')][_0x4d24d6['transfereeuniqueid']][_0x2b03('0xa6')]=_0x4d24d6['transfereecalleridnum'];this['channels'][_0x4d24d6[_0x2b03('0xa5')]][_0x2b03('0xaa')]=_0x4d24d6[_0x2b03('0xaf')];this['syncHangup']({'event':_0x2b03('0x9d'),'uniqueid':_0x4d24d6[_0x2b03('0xa5')],'context':_0x4d24d6[_0x2b03('0x45')],'channel':_0x4d24d6['transfererchannel']});}}}catch(_0x314581){logger[_0x2b03('0x30')](_0x2b03('0xb1'),_0x4d24d6[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x314581,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2b03('0x2d')]=function(_0x6e0022){try{if(this[_0x2b03('0x34')](_0x6e0022)){logger[_0x2b03('0x42')](_0x2b03('0xb2'),_0x6e0022['uniqueid'],util['inspect'](_0x6e0022,{'showHidden':![],'depth':null}));if(this['channels'][_0x6e0022[_0x2b03('0x39')]]){if(!_['isNil'](this[_0x2b03('0x1a')][_0x6e0022[_0x2b03('0x39')]][_0x2b03('0x6a')])){this[_0x2b03('0x1a')][_0x6e0022[_0x2b03('0x39')]][_0x2b03('0xb3')]=moment()[_0x2b03('0x48')](_0x2b03('0x49'));logger[_0x2b03('0x37')](_0x2b03('0xb4'),_0x6e0022[_0x2b03('0x39')],this['channels'][_0x6e0022[_0x2b03('0x39')]][_0x2b03('0xb3')]);}}}}catch(_0x35f95f){logger[_0x2b03('0x30')](_0x2b03('0xb5'),_0x6e0022[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x35f95f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b03('0x33')][_0x2b03('0xb6')]=function(_0x41c62c){try{if(this[_0x2b03('0x34')](_0x41c62c)){logger[_0x2b03('0x42')](_0x2b03('0xb7'),_0x41c62c[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x41c62c,{'showHidden':![],'depth':null}));if(this[_0x2b03('0x1a')][_0x41c62c['uniqueid']]){if(!_['isNil'](this[_0x2b03('0x1a')][_0x41c62c[_0x2b03('0x39')]][_0x2b03('0xb3')])){this[_0x2b03('0x1a')][_0x41c62c[_0x2b03('0x39')]][_0x2b03('0xb8')]+=moment()[_0x2b03('0xb9')](0x0)[_0x2b03('0x98')](this[_0x2b03('0x1a')][_0x41c62c['uniqueid']][_0x2b03('0xb3')],_0x2b03('0x5e'));logger[_0x2b03('0x37')](_0x2b03('0xba'),_0x41c62c[_0x2b03('0x39')],this[_0x2b03('0x1a')][_0x41c62c[_0x2b03('0x39')]][_0x2b03('0xb8')]);delete this[_0x2b03('0x1a')][_0x41c62c['uniqueid']][_0x2b03('0xb3')];}}}}catch(_0x103771){logger[_0x2b03('0x30')]('[%s][voiceCallReport][musiconholdstop]',_0x41c62c[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x103771,{'showHidden':![],'depth':null}));}};module[_0x2b03('0xbb')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 43f8447..7b3244a 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 _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 +var _0x9193=['destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','syncDialBegin','bind','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','called','channel','substring','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','inspect','voice:outbound','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','dialstatus','connectedlinename','format','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','lastIndexOf','custom:dialconnect','voice_outbound_channel:save','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','addVariable','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','starttime','seconds','complete','total','answertime','holdtime','diff','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','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'];(function(_0x352256,_0x447d72){var _0x309795=function(_0x5e1efa){while(--_0x5e1efa){_0x352256['push'](_0x352256['shift']());}};_0x309795(++_0x447d72);}(_0x9193,0x138));var _0x3919=function(_0x329d13,_0x1aff27){_0x329d13=_0x329d13-0x0;var _0x33efd9=_0x9193[_0x329d13];return _0x33efd9;};'use strict';var _=require(_0x3919('0x0'));var moment=require(_0x3919('0x1'));var util=require('util');var Redis=require(_0x3919('0x2'));var config=require(_0x3919('0x3'));var logger=require(_0x3919('0x4'))(_0x3919('0x5'));var ami=require(_0x3919('0x6'));config[_0x3919('0x7')]=_['defaults'](config[_0x3919('0x7')],{'host':_0x3919('0x8'),'port':0x18eb});var io=require(_0x3919('0x9'))(new Redis(config[_0x3919('0x7')]));function VoiceDialReport(_0xebf2ef){this[_0x3919('0xa')]=_0xebf2ef[_0x3919('0xb')];this['outbound']=_0xebf2ef[_0x3919('0xc')];this[_0x3919('0xd')]={};ami['on']('dialbegin',this[_0x3919('0xe')][_0x3919('0xf')](this));ami['on']('dialend',this['syncDialEnd'][_0x3919('0xf')](this));ami['on'](_0x3919('0x10'),this[_0x3919('0x11')][_0x3919('0xf')](this));ami['on'](_0x3919('0x12'),this[_0x3919('0x13')][_0x3919('0xf')](this));}VoiceDialReport[_0x3919('0x14')][_0x3919('0x15')]=function(_0x573483){return _0x573483!==null&&!_[_0x3919('0x16')](_0x573483);};VoiceDialReport[_0x3919('0x14')]['emit']=function(_0x2b6c6f,_0x2924a0,_0x25b4a5){io['to'](_0x2b6c6f)[_0x3919('0x17')](_0x2924a0,_0x25b4a5);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x121e6e){try{if(this[_0x3919('0x15')](_0x121e6e)){logger[_0x3919('0x18')](_0x3919('0x19'),_0x121e6e[_0x3919('0x1a')],util['inspect'](_0x121e6e,{'showHidden':![],'depth':null}));if(this[_0x3919('0xa')][_0x121e6e['uniqueid']]){_['merge'](this[_0x3919('0xa')][_0x121e6e[_0x3919('0x1a')]],{'starttime':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x3919('0x1b'),'interface':_0x121e6e[_0x3919('0x1c')][_0x3919('0x1d')](0x0,_0x121e6e[_0x3919('0x1c')]['lastIndexOf']('-')),'membername':_0x121e6e[_0x3919('0x1c')][_0x3919('0x1d')](_0x121e6e[_0x3919('0x1c')]['lastIndexOf']('/')+0x1,_0x121e6e[_0x3919('0x1c')]['lastIndexOf']('-'))},_['omit'](_0x121e6e,[_0x3919('0x1e'),_0x3919('0x1f')]));logger['info'](_0x3919('0x20'),_0x121e6e['uniqueid'],this['channels'][_0x121e6e[_0x3919('0x1a')]][_0x3919('0x21')],this[_0x3919('0xa')][_0x121e6e[_0x3919('0x1a')]][_0x3919('0x22')]);logger['debug']('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x121e6e[_0x3919('0x1a')],util[_0x3919('0x23')](this[_0x3919('0xa')][_0x121e6e[_0x3919('0x1a')]],{'showHidden':![],'depth':null}));this[_0x3919('0x17')](_0x3919('0x24'),'voice_outbound_channel:save',this[_0x3919('0xa')][_0x121e6e[_0x3919('0x1a')]]);logger[_0x3919('0x18')](_0x3919('0x25'),_0x121e6e['uniqueid'],util[_0x3919('0x23')](this[_0x3919('0xa')][_0x121e6e[_0x3919('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x3919('0x17')](_0x3919('0x26'),this[_0x3919('0xa')][_0x121e6e[_0x3919('0x1a')]]);}}}catch(_0x22f277){logger[_0x3919('0x27')](_0x3919('0x28'),_0x121e6e[_0x3919('0x1a')],util[_0x3919('0x23')](_0x22f277,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3919('0x14')][_0x3919('0x29')]=function(_0x3180f4){try{if(this[_0x3919('0x15')](_0x3180f4)){logger[_0x3919('0x18')]('[%s][voiceDialReport][dialend]\x20event:',_0x3180f4['uniqueid'],util['inspect'](_0x3180f4,{'showHidden':![],'depth':null}));if(this[_0x3919('0xa')][_0x3180f4['uniqueid']]){this[_0x3919('0xa')][_0x3180f4[_0x3919('0x1a')]][_0x3919('0x2a')]=_0x3180f4[_0x3919('0x2a')];if(_0x3180f4[_0x3919('0x2a')]==='ANSWER'){this[_0x3919('0xa')][_0x3180f4[_0x3919('0x1a')]]['connectedlinenum']=_0x3180f4['connectedlinenum'];this[_0x3919('0xa')][_0x3180f4[_0x3919('0x1a')]][_0x3919('0x2b')]=_0x3180f4[_0x3919('0x2b')];this[_0x3919('0xa')][_0x3180f4[_0x3919('0x1a')]]['answertime']=moment()[_0x3919('0x2c')](_0x3919('0x2d'));this[_0x3919('0xa')][_0x3180f4[_0x3919('0x1a')]][_0x3919('0x2e')]=_0x3919('0x2f');logger[_0x3919('0x30')](_0x3919('0x31'),_0x3180f4[_0x3919('0x1a')],_0x3180f4[_0x3919('0x1c')]['substring'](_0x3180f4[_0x3919('0x1c')][_0x3919('0x32')]('/')+0x1,_0x3180f4[_0x3919('0x1c')][_0x3919('0x32')]('-')));logger[_0x3919('0x18')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x3180f4['uniqueid'],util[_0x3919('0x23')](this[_0x3919('0xa')][_0x3180f4[_0x3919('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x3919('0x17')](_0x3919('0x33'),this[_0x3919('0xa')][_0x3180f4[_0x3919('0x1a')]]);}logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x3180f4[_0x3919('0x1a')],util[_0x3919('0x23')](this['channels'][_0x3180f4[_0x3919('0x1a')]],{'showHidden':![],'depth':null}));this[_0x3919('0x17')](_0x3919('0x24'),_0x3919('0x34'),this[_0x3919('0xa')][_0x3180f4[_0x3919('0x1a')]]);}}}catch(_0x2a08ac){logger[_0x3919('0x27')](_0x3919('0x35'),_0x3180f4[_0x3919('0x1a')],util['inspect'](_0x2a08ac,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3919('0x14')]['syncVarSet']=function(_0x2142f4){try{if(this[_0x3919('0x15')](_0x2142f4)){logger['debug'](_0x3919('0x36'),_0x2142f4['uniqueid'],util['inspect'](_0x2142f4,{'showHidden':![],'depth':null}));this['addVariable'](_0x2142f4[_0x3919('0x1a')],_[_0x3919('0x37')](_0x2142f4[_0x3919('0x38')])[0x0],_0x2142f4[_0x3919('0x39')]);if(this[_0x3919('0x15')](_0x2142f4[_0x3919('0x38')])&&this[_0x3919('0x15')](_0x2142f4[_0x3919('0x38')][_0x3919('0x3a')])){if(_[_0x3919('0x16')](this[_0x3919('0xa')][_0x2142f4[_0x3919('0x1a')]])){this[_0x3919('0xa')][_0x2142f4[_0x3919('0x1a')]]={'routeId':_0x2142f4[_0x3919('0x39')],'variables':this['variables'][_0x2142f4[_0x3919('0x1a')]]};logger[_0x3919('0x30')](_0x3919('0x3b'),_0x2142f4[_0x3919('0x1a')],_0x2142f4[_0x3919('0x38')][_0x3919('0x3a')],_[_0x3919('0x37')](_0x2142f4[_0x3919('0x38')])[0x0],_0x2142f4[_0x3919('0x39')]);logger[_0x3919('0x18')](_0x3919('0x3c'),_0x2142f4['uniqueid'],util[_0x3919('0x23')](this[_0x3919('0xa')][_0x2142f4[_0x3919('0x1a')]],{'showHidden':![],'depth':null}));this[_0x3919('0x17')](_0x3919('0x24'),_0x3919('0x34'),this[_0x3919('0xa')][_0x2142f4[_0x3919('0x1a')]]);}}}}catch(_0x31d4a5){logger[_0x3919('0x27')](_0x3919('0x3d'),_0x2142f4[_0x3919('0x1a')],util[_0x3919('0x23')](_0x31d4a5,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3919('0x14')][_0x3919('0x3e')]=function(_0x5272b5,_0x553583,_0x338d80){var _0x5b728a=['rtpaudioqos',_0x3919('0x3f'),_0x3919('0x40'),_0x3919('0x41'),_0x3919('0x42'),'rtpaudioqoslossbridged',_0x3919('0x43'),'rtpaudioqosrttbridged',_0x3919('0x44'),'sipuri',_0x3919('0x45'),_0x3919('0x46'),'membercalls','memberdynamic',_0x3919('0x47'),_0x3919('0x48'),_0x3919('0x21'),_0x3919('0x49'),_0x3919('0x4a')];if(!_['isNil'](_0x553583)&&!_[_0x3919('0x4b')](_0x5b728a,_0x553583)){if(_[_0x3919('0x16')](this[_0x3919('0xd')][_0x5272b5])){this[_0x3919('0xd')][_0x5272b5]={};}this[_0x3919('0xd')][_0x5272b5][_0x553583]=_0x338d80;}};VoiceDialReport['prototype'][_0x3919('0x13')]=function(_0x4a079c){try{if(this[_0x3919('0x15')](_0x4a079c)){logger[_0x3919('0x18')]('[%s][voiceDialReport][hangup]\x20event:',_0x4a079c[_0x3919('0x1a')],util[_0x3919('0x23')](_0x4a079c,{'showHidden':![],'depth':null}));if(this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]]){logger['info'](_0x3919('0x4c'),_0x4a079c['uniqueid'],_0x4a079c[_0x3919('0x4d')]);this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]][_0x3919('0x4e')]=moment()['format'](_0x3919('0x2d'));this[_0x3919('0xa')][_0x4a079c['uniqueid']][_0x3919('0x4f')]=moment(this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]][_0x3919('0x4e')])['diff'](this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]][_0x3919('0x50')],_0x3919('0x51'));this['channels'][_0x4a079c[_0x3919('0x1a')]][_0x3919('0x2e')]=_0x3919('0x52');this['outbound'][_0x3919('0x53')]+=0x1;if(this[_0x3919('0xa')][_0x4a079c['uniqueid']][_0x3919('0x54')]){this[_0x3919('0xc')]['answered']+=0x1;this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]][_0x3919('0x55')]=moment(this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]][_0x3919('0x54')])[_0x3919('0x56')](this[_0x3919('0xa')][_0x4a079c['uniqueid']][_0x3919('0x50')],_0x3919('0x51'));this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]][_0x3919('0x57')]=moment(this['channels'][_0x4a079c[_0x3919('0x1a')]][_0x3919('0x4e')])[_0x3919('0x56')](this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]][_0x3919('0x54')],_0x3919('0x51'));this['outbound'][_0x3919('0x58')]+=this[_0x3919('0xa')][_0x4a079c['uniqueid']][_0x3919('0x55')]||0x0;this[_0x3919('0xc')][_0x3919('0x59')]+=this['channels'][_0x4a079c[_0x3919('0x1a')]][_0x3919('0x57')];}this[_0x3919('0xc')][_0x3919('0x5a')]+=this[_0x3919('0xa')][_0x4a079c['uniqueid']][_0x3919('0x4f')];logger[_0x3919('0x18')](_0x3919('0x5b'),_0x4a079c[_0x3919('0x1a')],util[_0x3919('0x23')](this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x3919('0x17')](_0x3919('0x5c'),this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]]);logger[_0x3919('0x18')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x4a079c[_0x3919('0x1a')],util[_0x3919('0x23')](this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x3919('0x17')](_0x3919('0x5d'),this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]]);logger['debug'](_0x3919('0x5e'),_0x4a079c[_0x3919('0x1a')],util[_0x3919('0x23')](this['channels'][_0x4a079c[_0x3919('0x1a')]],{'showHidden':![],'depth':null}));this[_0x3919('0x17')](_0x3919('0x24'),'voice_outbound:save',this[_0x3919('0xc')]);logger[_0x3919('0x30')](_0x3919('0x5f'),JSON[_0x3919('0x60')](this[_0x3919('0xa')][_0x4a079c['uniqueid']]));logger[_0x3919('0x18')](_0x3919('0x61'),_0x4a079c['uniqueid'],util[_0x3919('0x23')](this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]],{'showHidden':![],'depth':null}));this[_0x3919('0x17')](_0x3919('0x24'),_0x3919('0x62'),this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]]);delete this['channels'][_0x4a079c['uniqueid']];}else if(this['channels'][_0x4a079c[_0x3919('0x63')]]){this[_0x3919('0xa')][_0x4a079c[_0x3919('0x63')]][_0x3919('0x1a')]=this[_0x3919('0xa')][_0x4a079c[_0x3919('0x63')]][_0x3919('0x64')];}if(this[_0x3919('0xd')][_0x4a079c['uniqueid']]){delete this['variables'][_0x4a079c[_0x3919('0x1a')]];}}}catch(_0x5736a0){logger[_0x3919('0x27')](_0x3919('0x65'),_0x4a079c[_0x3919('0x1a')],util[_0x3919('0x23')](_0x5736a0,{'showHidden':![],'depth':null}));}};module[_0x3919('0x66')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 62d4ad9..88546ca 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 _0x4b53=['syncQueueCallerJoin','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','push','last','queuecallercompleteAt','holdtime','originalposition','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerabandon]','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','[%s][voiceQueueReport][agentcomplete]','queuecallerabandonAt','membername','queuecallercomplete','queuecallerexit','queuecallerexitAt','transfer','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','add','seconds','transfertype','FORWARD','transferexten','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','queuecallerexitreason','COMPLETEDBY','reason','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','variable','value','CONTINUE','TIMEOUT','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberpenalty','memberrealtime','[%s][voiceQueueReport][hangup]','abandoned','milliseconds','diff','total','lastevent','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','syncAttendedTransfer','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','transferuniqueid','origtransfereruniqueid','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','transfererchannel','[%s][voiceQueueReport][blindtransfer]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','queueReports','agents','queueChannels','voiceQueues','campaigns','variables','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','attendedtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','waiting','queueStatusComplete','unlockRR','clearZombieChannels','channels','switch','isNil','Action','status','channel','catch','message','No\x20such\x20channel','[%s][voiceQueueReport][checkChannel]','inspect','error','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','debug','uniqueid','voice:queue:%s','name','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:remove\x20event:','format','voice_queue_channel:remove','emitVoiceQueueSummary','type','inbound','strategy','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','Trunk','active','callerid','Interval','stringify','md5','[voiceQueueReport][','voice_queue:save','isNotNull','isUndefined','queues','[voiceQueueReport][queues]','flagQueueSummary','queuesummary','then','queue','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','available','loggedin','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummary]','[voiceQueueReport][queuesummarycomplete]\x20event:'];(function(_0x2bf1d6,_0x410efd){var _0x1be08a=function(_0x39c3a2){while(--_0x39c3a2){_0x2bf1d6['push'](_0x2bf1d6['shift']());}};_0x1be08a(++_0x410efd);}(_0x4b53,0x152));var _0x34b5=function(_0x28be5e,_0x3fd003){_0x28be5e=_0x28be5e-0x0;var _0x5c77f6=_0x4b53[_0x28be5e];return _0x5c77f6;};'use strict';var _=require(_0x34b5('0x0'));var moment=require(_0x34b5('0x1'));var util=require('util');var md5=require('md5');var Redis=require(_0x34b5('0x2'));var config=require(_0x34b5('0x3'));var logger=require(_0x34b5('0x4'))(_0x34b5('0x5'));var ami=require(_0x34b5('0x6'));var QueueReport=require('../model/queueReport');config['redis']=_[_0x34b5('0x7')](config[_0x34b5('0x8')],{'host':_0x34b5('0x9'),'port':0x18eb});var io=require(_0x34b5('0xa'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x34b5('0xb')][_0x34b5('0xc')]=function(_0x5f215c){this[_0x34b5('0xd')]=this[_0x34b5('0xd')]?this[_0x34b5('0xd')]['finally'](_0x5f215c):_0x5f215c();};function VoiceQueueReport(_0x1bfa81){this[_0x34b5('0xe')]=new Sequence();this[_0x34b5('0xf')]={};this[_0x34b5('0x10')]=_0x1bfa81[_0x34b5('0x10')];this['channels']=_0x1bfa81[_0x34b5('0x11')];this[_0x34b5('0x12')]=_0x1bfa81[_0x34b5('0x12')];this['flagQueueSummary']=!![];this[_0x34b5('0x13')]=_0x1bfa81[_0x34b5('0x13')];this[_0x34b5('0x14')]={};ami['on']('queuesummary',this[_0x34b5('0x15')][_0x34b5('0x16')](this));ami['on'](_0x34b5('0x17'),this[_0x34b5('0x18')][_0x34b5('0x16')](this));ami['on'](_0x34b5('0x19'),this['syncQueueCallerJoin'][_0x34b5('0x16')](this));ami['on'](_0x34b5('0x1a'),this[_0x34b5('0x1b')][_0x34b5('0x16')](this));ami['on']('queuecallerleave',this['syncQueueCallerLeave'][_0x34b5('0x16')](this));ami['on'](_0x34b5('0x1c'),this[_0x34b5('0x1d')][_0x34b5('0x16')](this));ami['on']('agentconnect',this[_0x34b5('0x1e')][_0x34b5('0x16')](this));ami['on'](_0x34b5('0x1f'),this[_0x34b5('0x20')]['bind'](this));ami['on'](_0x34b5('0x21'),this[_0x34b5('0x22')][_0x34b5('0x16')](this));ami['on']('fullybooted',this[_0x34b5('0x23')][_0x34b5('0x16')](this));ami['on'](_0x34b5('0x24'),this[_0x34b5('0x25')][_0x34b5('0x16')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop']['bind'](this));ami['on'](_0x34b5('0x26'),this['syncAttendedTransfer'][_0x34b5('0x16')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x34b5('0x16')](this));this[_0x34b5('0x27')]();this[_0x34b5('0x28')]();}function clearChannels(_0xaf9ed7){if(!_[_0x34b5('0x29')](_0xaf9ed7)){for(var _0x4dc382 in _0xaf9ed7){if(_0xaf9ed7[_0x34b5('0x2a')](_0x4dc382)){delete _0xaf9ed7[_0x4dc382];}}}}function clearCampaigns(_0x5ac209){if(!_[_0x34b5('0x29')](_0x5ac209)){for(var _0x8afbbd in _0x5ac209){if(_0x5ac209[_0x34b5('0x2a')](_0x8afbbd)){_0x5ac209[_0x8afbbd][_0x34b5('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x17ceb1){if(!_['isEmpty'](_0x17ceb1)){for(var _0x10fa02 in _0x17ceb1){if(_0x17ceb1['hasOwnProperty'](_0x10fa02)){_0x17ceb1[_0x10fa02][_0x34b5('0x2b')]=0x0;_0x17ceb1[_0x10fa02]['talking']=0x0;_0x17ceb1[_0x10fa02][_0x34b5('0x2c')]=0x0;_0x17ceb1[_0x10fa02][_0x34b5('0x2d')]=0x0;_0x17ceb1[_0x10fa02][_0x34b5('0x2e')]=!![];}}}}function clearAgentBooked(_0x3220f5){if(!_[_0x34b5('0x29')](_0x3220f5)){for(var _0x58ae59 in _0x3220f5){if(_0x3220f5[_0x34b5('0x2a')](_0x58ae59)){_0x3220f5[_0x58ae59][_0x34b5('0x2f')]=!![];}}}}VoiceQueueReport[_0x34b5('0xb')][_0x34b5('0x30')]=function(){var _0x40ce57=this;for(var _0x1b523e in this[_0x34b5('0x31')]){if(this[_0x34b5('0x31')][_0x34b5('0x2a')](_0x1b523e)&&!this[_0x34b5('0x31')][_0x1b523e][_0x34b5('0x32')]){this[_0x34b5('0xe')][_0x34b5('0xc')](function(){if(!_[_0x34b5('0x33')](_0x40ce57[_0x34b5('0x31')][_0x1b523e])){return ami[_0x34b5('0x34')]({'action':_0x34b5('0x35'),'channel':_0x40ce57[_0x34b5('0x31')][_0x1b523e][_0x34b5('0x36')]})[_0x34b5('0x37')](function(_0x45533a){if(_0x45533a[_0x34b5('0x38')]===_0x34b5('0x39')){setTimeout(function(){if(_0x40ce57['channels'][_0x1b523e]){delete _0x40ce57[_0x34b5('0x31')][_0x1b523e];logger['error'](_0x34b5('0x3a'),_0x1b523e,util[_0x34b5('0x3b')](_0x45533a,{'showHidden':![],'depth':null}));}if(_0x40ce57[_0x34b5('0xf')][_0x1b523e]){delete _0x40ce57[_0x34b5('0xf')][_0x1b523e];logger[_0x34b5('0x3c')](_0x34b5('0x3d'),_0x1b523e,util[_0x34b5('0x3b')](_0x45533a,{'showHidden':![],'depth':null}));}if(_0x40ce57[_0x34b5('0x14')][_0x1b523e]){delete _0x40ce57[_0x34b5('0x14')][_0x1b523e];logger[_0x34b5('0x3c')](_0x34b5('0x3e'),_0x1b523e,util[_0x34b5('0x3b')](_0x45533a,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x34b5('0x23')]=function(){logger[_0x34b5('0x3c')](_0x34b5('0x3f'));clearChannels(this[_0x34b5('0x31')]);this[_0x34b5('0x40')](this[_0x34b5('0xf')]);clearAgentBooked(this[_0x34b5('0x10')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0x34b5('0x13')]);};VoiceQueueReport[_0x34b5('0xb')][_0x34b5('0x40')]=function(_0x155f12){var _0x40fcd3=this;if(!_[_0x34b5('0x29')](_0x155f12)){for(var _0x35290f in _0x155f12){if(_0x155f12[_0x34b5('0x2a')](_0x35290f)){_0x40fcd3[_0x34b5('0x41')](_0x155f12[_0x35290f],'clearqueuereport');delete _0x155f12[_0x35290f];}}}};VoiceQueueReport[_0x34b5('0xb')][_0x34b5('0x42')]=function(_0x45667a,_0x142716,_0x1fd893){io['to'](_0x45667a)[_0x34b5('0x42')](_0x142716,_0x1fd893);};VoiceQueueReport[_0x34b5('0xb')][_0x34b5('0x43')]=function(_0x47d9f0,_0x44fb69){logger[_0x34b5('0x44')]('[%s][voiceQueueReport]['+_0x44fb69+']\x20sending\x20voice_queue_channel:save\x20event:',_0x47d9f0[_0x34b5('0x45')],util[_0x34b5('0x3b')](_0x47d9f0,{'showHidden':![],'depth':null}));this[_0x34b5('0x42')](util['format'](_0x34b5('0x46'),_0x47d9f0[_0x34b5('0x47')]),'voice_queue_channel:save',_0x47d9f0);};VoiceQueueReport['prototype']['emitVoiceQueueChannelRemove']=function(_0x438e9c,_0x2c1f8d){logger['debug'](_0x34b5('0x48')+_0x2c1f8d+_0x34b5('0x49'),_0x438e9c[_0x34b5('0x45')],util[_0x34b5('0x3b')](_0x438e9c,{'showHidden':![],'depth':null}));this[_0x34b5('0x42')](util[_0x34b5('0x4a')]('voice:queue:%s',_0x438e9c[_0x34b5('0x47')]),_0x34b5('0x4b'),_0x438e9c);};VoiceQueueReport[_0x34b5('0xb')][_0x34b5('0x4c')]=function(_0x3daaf7,_0x2310f1){if(_0x3daaf7[_0x34b5('0x4d')]===_0x34b5('0x4e')){var _0x310e20={'id':_0x3daaf7['id'],'name':_0x3daaf7[_0x34b5('0x47')],'strategy':_0x3daaf7[_0x34b5('0x4f')],'answered':_0x3daaf7[_0x34b5('0x50')],'available':_0x3daaf7['available'],'loggedIn':_0x3daaf7[_0x34b5('0x51')],'pTalking':_0x3daaf7[_0x34b5('0x2c')],'sumBillable':_0x3daaf7[_0x34b5('0x52')],'sumDuration':_0x3daaf7[_0x34b5('0x53')],'sumHoldTime':_0x3daaf7[_0x34b5('0x54')]||0x0,'talking':_0x3daaf7[_0x34b5('0x55')],'total':_0x3daaf7['total'],'type':_0x3daaf7[_0x34b5('0x4d')],'unmanaged':_0x3daaf7['unmanaged'],'abandoned':_0x3daaf7['abandoned'],'waiting':_0x3daaf7[_0x34b5('0x2d')]};if(_0x3daaf7['Trunk']){_0x310e20[_0x34b5('0x56')]={'id':_0x3daaf7[_0x34b5('0x56')]['id'],'name':_0x3daaf7[_0x34b5('0x56')]['name'],'active':_0x3daaf7[_0x34b5('0x56')][_0x34b5('0x57')],'callerid':_0x3daaf7[_0x34b5('0x56')][_0x34b5('0x58')]};}if(_0x3daaf7[_0x34b5('0x59')]){_0x310e20[_0x34b5('0x59')]={'id':_0x3daaf7[_0x34b5('0x59')]['id'],'name':_0x3daaf7['Interval'][_0x34b5('0x47')]};}var _0x476273=md5(JSON[_0x34b5('0x5a')](_0x310e20));if(_0x3daaf7[_0x34b5('0x5b')]!==_0x476273){_0x3daaf7['md5']=_0x476273;logger[_0x34b5('0x44')](_0x34b5('0x5c')+_0x2310f1+']\x20sending\x20voice_queue:save\x20event:',util[_0x34b5('0x3b')](_0x310e20,{'showHidden':![],'depth':null}));this[_0x34b5('0x42')](util[_0x34b5('0x4a')](_0x34b5('0x46'),_0x310e20[_0x34b5('0x47')]),_0x34b5('0x5d'),_0x310e20);}}};VoiceQueueReport['prototype'][_0x34b5('0x5e')]=function(_0x18247b){return _0x18247b!==null&&!_[_0x34b5('0x5f')](_0x18247b);};VoiceQueueReport['prototype'][_0x34b5('0x28')]=function(){var _0x1f27d6=this;setInterval(function(){_0x1f27d6[_0x34b5('0x30')]();ami[_0x34b5('0x34')]({'action':_0x34b5('0x60')})[_0x34b5('0x37')](function(_0x440077){logger[_0x34b5('0x3c')](_0x34b5('0x61'),util[_0x34b5('0x3b')](_0x440077,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x34b5('0xb')][_0x34b5('0x27')]=function(){var _0x48dd1e=this;setInterval(function(){if(_0x48dd1e[_0x34b5('0x62')]){return ami[_0x34b5('0x34')]({'action':_0x34b5('0x63')})[_0x34b5('0x64')](function(_0x2d125f){_0x48dd1e[_0x34b5('0x62')]=![];})['catch'](function(_0x4d2115){logger[_0x34b5('0x3c')]('[voiceQueueReport][queuesummary]',util['inspect'](_0x4d2115,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0x34b5('0x15')]=function(_0x2e44f0){try{if(this[_0x34b5('0x5e')](_0x2e44f0)&&this[_0x34b5('0x5e')](_0x2e44f0[_0x34b5('0x65')])){logger[_0x34b5('0x44')](_0x34b5('0x66'),util['inspect'](_0x2e44f0,{'showHidden':![],'depth':null}));if(this[_0x34b5('0x12')][_0x2e44f0['queue']]){logger[_0x34b5('0x67')](_0x34b5('0x68'),_0x2e44f0[_0x34b5('0x65')]);var _0x3a06fe=_[_0x34b5('0x69')](this['channels'],_0x34b5('0x65'))[_0x2e44f0[_0x34b5('0x65')]]||0x0;var _0xfb4e64=_0x3a06fe-_0x2e44f0[_0x34b5('0x6a')];if(this[_0x34b5('0x12')][_0x2e44f0[_0x34b5('0x65')]][_0x34b5('0x2d')]!==_[_0x34b5('0x6b')](_0x2e44f0[_0x34b5('0x6a')])||this[_0x34b5('0x12')][_0x2e44f0[_0x34b5('0x65')]]['loggedIn']!==_['toNumber'](_0x2e44f0['loggedin'])||this[_0x34b5('0x12')][_0x2e44f0['queue']]['available']!==_[_0x34b5('0x6b')](_0x2e44f0[_0x34b5('0x6c')])||this[_0x34b5('0x12')][_0x2e44f0['queue']][_0x34b5('0x55')]!==_0xfb4e64){this[_0x34b5('0x12')][_0x2e44f0[_0x34b5('0x65')]][_0x34b5('0x2d')]=_[_0x34b5('0x6b')](_0x2e44f0[_0x34b5('0x6a')]);this[_0x34b5('0x12')][_0x2e44f0[_0x34b5('0x65')]][_0x34b5('0x51')]=_[_0x34b5('0x6b')](_0x2e44f0[_0x34b5('0x6d')]);this[_0x34b5('0x12')][_0x2e44f0[_0x34b5('0x65')]][_0x34b5('0x6c')]=_[_0x34b5('0x6b')](_0x2e44f0[_0x34b5('0x6c')]);this[_0x34b5('0x12')][_0x2e44f0[_0x34b5('0x65')]][_0x34b5('0x55')]=_0xfb4e64>0x0?_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={};_0x41e6ab0x0?_0x55adbc:0x0;this['voiceQueues'][_0x533762[_0x52c9('0x6b')]][_0x52c9('0x31')]=this['voiceQueues'][_0x533762['queue']][_0x52c9('0x31')]>_[_0x52c9('0x6e')](_0x533762['loggedin'])?_['toNumber'](_0x533762[_0x52c9('0x6f')]):this[_0x52c9('0x12')][_0x533762[_0x52c9('0x6b')]][_0x52c9('0x31')];this['emitVoiceQueueSummary'](this[_0x52c9('0x12')][_0x533762['queue']],_0x52c9('0x16'));}logger[_0x52c9('0x49')](_0x52c9('0x70'),util[_0x52c9('0x42')](this[_0x52c9('0x12')][_0x533762[_0x52c9('0x6b')]],{'showHidden':![],'depth':null}));ami[_0x52c9('0x47')](_0x52c9('0x71'),this[_0x52c9('0x12')][_0x533762['queue']]);}}}catch(_0x2aebf1){logger['error'](_0x52c9('0x69'),util[_0x52c9('0x42')](_0x2aebf1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x52c9('0xc')][_0x52c9('0x19')]=function(_0x55c399){logger[_0x52c9('0x49')](_0x52c9('0x72'),util[_0x52c9('0x42')](_0x55c399,{'showHidden':![],'depth':null}));this[_0x52c9('0x13')]=!![];};VoiceQueueReport[_0x52c9('0xc')][_0x52c9('0x1a')]=function(_0x3e223b){try{if(this[_0x52c9('0x6a')](_0x3e223b)){logger[_0x52c9('0x49')](_0x52c9('0x73'),_0x3e223b['uniqueid'],util[_0x52c9('0x42')](_0x3e223b,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x52c9('0xe')][_0x3e223b[_0x52c9('0x4b')]])){this['queueReports'][_0x3e223b[_0x52c9('0x4b')]]=[];this[_0x52c9('0x10')][_0x3e223b['uniqueid']]={};}var _0x123e8b=new QueueReport();_0x123e8b[_0x52c9('0x51')]=_0x3e223b[_0x52c9('0x6b')];_0x123e8b[_0x52c9('0x52')]=this['voiceQueues'][_0x123e8b[_0x52c9('0x51')]]&&this[_0x52c9('0x12')][_0x123e8b[_0x52c9('0x51')]]['type']?this[_0x52c9('0x12')][_0x123e8b[_0x52c9('0x51')]][_0x52c9('0x52')]||_0x52c9('0x53'):'inbound';_0x123e8b[_0x52c9('0x6b')]=_0x3e223b[_0x52c9('0x6b')];_0x123e8b[_0x52c9('0x74')]=moment()[_0x52c9('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x123e8b[_0x52c9('0x75')]=_0x3e223b['position'];_0x123e8b[_0x52c9('0x76')]=_0x3e223b[_0x52c9('0x76')];_0x123e8b['uniqueid']=_0x3e223b[_0x52c9('0x4b')];logger[_0x52c9('0x77')](_0x52c9('0x78'),_0x123e8b[_0x52c9('0x51')],_0x123e8b['type']);_['merge'](_0x123e8b,_[_0x52c9('0x79')](_0x3e223b,_['keys'](_0x123e8b)));this['queueReports'][_0x3e223b[_0x52c9('0x4b')]][_0x52c9('0x7a')](_0x123e8b);this[_0x52c9('0x10')][_0x3e223b[_0x52c9('0x4b')]]=_0x123e8b;this['emitVoiceQueueChannelSave'](_0x123e8b,'queuecallerjoin');}}catch(_0x14a7c0){logger[_0x52c9('0x40')](_0x52c9('0x73'),_0x3e223b[_0x52c9('0x4b')],util[_0x52c9('0x42')](_0x14a7c0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x52c9('0xc')]['syncQueueCallerAbandon']=function(_0x8d69cc){try{if(this[_0x52c9('0x6a')](_0x8d69cc)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x8d69cc['uniqueid'],util[_0x52c9('0x42')](_0x8d69cc,{'showHidden':![],'depth':null}));if(this[_0x52c9('0xe')][_0x8d69cc[_0x52c9('0x4b')]]){var _0x429b81=_[_0x52c9('0x7b')](this['queueReports'][_0x8d69cc[_0x52c9('0x4b')]]);_0x429b81['queuecallercomplete']=![];_0x429b81[_0x52c9('0x7c')]=null;_0x429b81['holdtime']=_0x8d69cc['holdtime'];_0x429b81[_0x52c9('0x7d')]=_0x8d69cc[_0x52c9('0x7d')];_0x429b81[_0x52c9('0x1b')]=!![];_0x429b81[_0x52c9('0x7e')]=moment()[_0x52c9('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x429b81['queuecallerexitreason']='ABANDONED';_0x429b81[_0x52c9('0x7f')]=null;logger[_0x52c9('0x77')](_0x52c9('0x80'),_0x429b81['name'],_0x429b81[_0x52c9('0x52')]);this['channels'][_0x8d69cc[_0x52c9('0x4b')]]=_0x429b81;this[_0x52c9('0x4f')](_0x429b81,'queuecallerabandon');}}}catch(_0x2ecd59){logger[_0x52c9('0x40')](_0x52c9('0x81'),_0x8d69cc[_0x52c9('0x4b')],util['inspect'](_0x2ecd59,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x52c9('0xc')][_0x52c9('0x1d')]=function(_0x491363){try{if(this[_0x52c9('0x6a')](_0x491363)){logger['debug'](_0x52c9('0x82'),_0x491363[_0x52c9('0x4b')],util[_0x52c9('0x42')](_0x491363,{'showHidden':![],'depth':null}));if(this[_0x52c9('0xe')][_0x491363[_0x52c9('0x4b')]]){var _0x5cce39=_[_0x52c9('0x7b')](this[_0x52c9('0xe')][_0x491363[_0x52c9('0x4b')]]);_0x5cce39[_0x52c9('0x83')]=moment()['format'](_0x52c9('0x84'));_0x5cce39[_0x52c9('0x85')]=_0x491363[_0x52c9('0x85')];_0x5cce39['connectedlinename']=_0x491363['connectedlinename'];logger[_0x52c9('0x77')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x5cce39['name'],_0x5cce39['type'],_0x491363[_0x52c9('0x85')],_0x491363['connectedlinename']);this['channels'][_0x491363[_0x52c9('0x4b')]]=_0x5cce39;this[_0x52c9('0x48')](_0x5cce39,_0x52c9('0x1c'));}}}catch(_0x7cb5c5){logger[_0x52c9('0x40')](_0x52c9('0x82'),_0x491363[_0x52c9('0x4b')],util[_0x52c9('0x42')](_0x7cb5c5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x52c9('0xc')]['syncAgentConnect']=function(_0x35b41b){try{if(this[_0x52c9('0x6a')](_0x35b41b)){logger[_0x52c9('0x49')]('[%s][voiceQueueReport][agentconnect]',_0x35b41b[_0x52c9('0x4b')],util[_0x52c9('0x42')](_0x35b41b,{'showHidden':![],'depth':null}));if(this[_0x52c9('0xe')][_0x35b41b[_0x52c9('0x4b')]]){var _0xcc4f47=_[_0x52c9('0x7b')](this[_0x52c9('0xe')][_0x35b41b[_0x52c9('0x4b')]]);_0xcc4f47[_0x52c9('0x86')]=!![];_0xcc4f47[_0x52c9('0x87')]=_0x52c9('0x88');logger[_0x52c9('0x77')](_0x52c9('0x89'),_0xcc4f47['name'],_0xcc4f47[_0x52c9('0x52')]);}}}catch(_0x5a4b56){logger[_0x52c9('0x40')](_0x52c9('0x8a'),_0x35b41b['uniqueid'],util[_0x52c9('0x42')](_0x5a4b56,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x52c9('0xc')][_0x52c9('0x1e')]=function(_0x44e1ff){try{if(this[_0x52c9('0x6a')](_0x44e1ff)){logger[_0x52c9('0x49')](_0x52c9('0x8b'),_0x44e1ff['uniqueid'],util['inspect'](_0x44e1ff,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x44e1ff[_0x52c9('0x4b')]]){var _0x28026d=_[_0x52c9('0x7b')](this[_0x52c9('0xe')][_0x44e1ff[_0x52c9('0x4b')]]);_0x28026d['queuecallerabandon']=![];_0x28026d['queuecallerabandonAt']=null;_0x28026d['assigned']=!![];_0x28026d[_0x52c9('0x7f')]=_0x44e1ff[_0x52c9('0x8c')];_0x28026d[_0x52c9('0x8d')]=_0x44e1ff[_0x52c9('0x8d')];_0x28026d['queuecallercomplete']=!![];_0x28026d[_0x52c9('0x8e')]=![];_0x28026d[_0x52c9('0x8f')]=null;if(!_0x28026d['transfer']){if(_0x44e1ff['reason']==_0x52c9('0x90')){_0x28026d[_0x52c9('0x87')]=_0x52c9('0x91');logger['info'](_0x52c9('0x92'),_0x28026d[_0x52c9('0x51')],_0x28026d[_0x52c9('0x52')]);}else{if(_[_0x52c9('0x93')](_0x44e1ff['channel'][_0x52c9('0x94')](),'local/')){if(this[_0x52c9('0xe')][_0x44e1ff[_0x52c9('0x95')]]){var _0x56c2b9=_[_0x52c9('0x7b')](this[_0x52c9('0xe')][_0x44e1ff[_0x52c9('0x95')]]);_0x56c2b9[_0x52c9('0x86')]=![];_0x56c2b9['queuecallerexit']=!![];_0x56c2b9[_0x52c9('0x8f')]=moment(_0x28026d['queuecallerjoinAt'])[_0x52c9('0x96')](_0x44e1ff[_0x52c9('0x8d')],_0x52c9('0x97'))[_0x52c9('0x4c')](_0x52c9('0x84'));_0x56c2b9['queuecallerexitreason']=_0x52c9('0x98');_0x56c2b9[_0x52c9('0x90')]=!![];_0x56c2b9[_0x52c9('0x99')]=_0x52c9('0x9a');_0x56c2b9[_0x52c9('0x9b')]=_0x44e1ff['destexten'];_0x56c2b9[_0x52c9('0x9c')]=_0x44e1ff['uniqueid'];logger[_0x52c9('0x77')](_0x52c9('0x9d'),_0x56c2b9['name'],_0x56c2b9['type']);var _0x2560fd=this[_0x52c9('0xe')][_0x44e1ff[_0x52c9('0x95')]];this[_0x52c9('0xe')][_0x44e1ff[_0x52c9('0x95')]]=this[_0x52c9('0xe')][_0x44e1ff[_0x52c9('0x4b')]];this['queueReports'][_0x44e1ff['uniqueid']]=_0x2560fd;}}else{_0x28026d[_0x52c9('0x87')]='COMPLETEDBY'+_0x44e1ff[_0x52c9('0x9e')][_0x52c9('0x9f')]();logger[_0x52c9('0x77')](_0x52c9('0xa0'),_0x28026d[_0x52c9('0x51')],_0x28026d['type'],_0x28026d[_0x52c9('0x87')]);}}}this[_0x52c9('0x10')][_0x44e1ff[_0x52c9('0x4b')]]=_0x28026d;this['emitVoiceQueueChannelRemove'](_0x28026d,'agentcomplete');}}}catch(_0x2d5cca){logger['error'](_0x52c9('0x8b'),_0x44e1ff[_0x52c9('0x4b')],util['inspect'](_0x2d5cca,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x52c9('0x22')]=function(_0x414d07){try{if(this[_0x52c9('0x6a')](_0x414d07)){logger[_0x52c9('0x49')](_0x52c9('0xa1'),_0x414d07['uniqueid'],util[_0x52c9('0x42')](_0x414d07,{'showHidden':![],'depth':null}));this[_0x52c9('0xa2')](_0x414d07[_0x52c9('0x4b')],_[_0x52c9('0xa3')](_0x414d07[_0x52c9('0xa4')])[0x0],_0x414d07[_0x52c9('0xa5')]);if(this[_0x52c9('0xe')][_0x414d07[_0x52c9('0x4b')]]){var _0x3bae76=_[_0x52c9('0x7b')](this[_0x52c9('0xe')][_0x414d07[_0x52c9('0x4b')]]);if(_0x3bae76){if(this[_0x52c9('0x6a')](_0x414d07[_0x52c9('0xa4')])&&this[_0x52c9('0x6a')](_0x414d07['variable'][_0x52c9('0xa6')])){switch(_0x414d07['value']){case _0x52c9('0xa7'):_0x3bae76['queuecallerexit']=![];_0x3bae76['queuecallerexitAt']=null;break;case'TIMEOUT':_0x3bae76[_0x52c9('0xa8')]=_0x52c9('0xa9');_0x3bae76[_0x52c9('0x8e')]=!![];_0x3bae76[_0x52c9('0x8f')]=moment()[_0x52c9('0x4c')](_0x52c9('0x84'));_0x3bae76[_0x52c9('0x83')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x52c9('0x49')](_0x52c9('0xaa'),_0x414d07[_0x52c9('0x4b')],util[_0x52c9('0x42')](_0x3bae76,{'showHidden':![],'depth':null}));ami[_0x52c9('0x47')](_0x52c9('0xab'),_0x3bae76);break;default:_0x3bae76[_0x52c9('0x8e')]=!![];_0x3bae76['queuecallerexitAt']=moment()[_0x52c9('0x4c')](_0x52c9('0x84'));_0x3bae76[_0x52c9('0x83')]=moment()[_0x52c9('0x4c')](_0x52c9('0x84'));}_0x3bae76[_0x52c9('0x1b')]=![];_0x3bae76['queuecallerabandonAt']=null;_0x3bae76['queuecallerexitreason']=_0x414d07[_0x52c9('0xa5')];this[_0x52c9('0x10')][_0x414d07[_0x52c9('0x4b')]]=_0x3bae76;this[_0x52c9('0x4f')](_0x3bae76,_0x52c9('0x21'));}else if(this['isNotNull'](_0x414d07[_0x52c9('0xa4')])&&this[_0x52c9('0x6a')](_0x414d07['variable'][_0x52c9('0xac')])){if(!_0x3bae76['queuecallerabandon']){_0x3bae76['queuecallerexit']=!![];_0x3bae76[_0x52c9('0x8f')]=moment()[_0x52c9('0x4c')](_0x52c9('0x84'));_0x3bae76[_0x52c9('0x87')]=_0x52c9('0xad');_0x3bae76[_0x52c9('0x83')]=moment()[_0x52c9('0x4c')](_0x52c9('0x84'));this[_0x52c9('0x10')][_0x414d07[_0x52c9('0x4b')]]=_0x3bae76;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x414d07[_0x52c9('0x4b')],_0x3bae76['name'],_0x3bae76[_0x52c9('0x52')],_[_0x52c9('0xa3')](_0x414d07['variable'])[0x0],_0x414d07[_0x52c9('0xa5')]);_0x3bae76['variables']=this[_0x52c9('0x15')][_0x414d07['uniqueid']];}}}}catch(_0x1b1af4){logger[_0x52c9('0x40')](_0x52c9('0xa1'),_0x414d07[_0x52c9('0x4b')],util[_0x52c9('0x42')](_0x1b1af4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x52c9('0xc')][_0x52c9('0xa2')]=function(_0x45801,_0x68c38e,_0x59a542){var _0x40dd55=[_0x52c9('0xae'),_0x52c9('0xaf'),_0x52c9('0xb0'),_0x52c9('0xb1'),_0x52c9('0xb2'),_0x52c9('0xb3'),_0x52c9('0xb4'),'rtpaudioqosrttbridged',_0x52c9('0xb5'),_0x52c9('0xb6'),_0x52c9('0xb7'),_0x52c9('0xb8'),_0x52c9('0xb9'),'memberdynamic','memberinterface',_0x52c9('0xba'),_0x52c9('0x8c'),_0x52c9('0xbb'),'memberrealtime'];if(!_[_0x52c9('0x39')](_0x68c38e)&&!_[_0x52c9('0xbc')](_0x40dd55,_0x68c38e)){if(_[_0x52c9('0xbd')](this['variables'][_0x45801])){this[_0x52c9('0x15')][_0x45801]={};}this[_0x52c9('0x15')][_0x45801][_0x68c38e]=_0x59a542;}};VoiceQueueReport[_0x52c9('0xc')][_0x52c9('0x24')]=function(_0x5b8965){try{if(this['isNotNull'](_0x5b8965)){logger['debug'](_0x52c9('0xbe'),_0x5b8965[_0x52c9('0x4b')],util[_0x52c9('0x42')](_0x5b8965,{'showHidden':![],'depth':null}));if(this[_0x52c9('0xe')][_0x5b8965[_0x52c9('0x4b')]]){for(var _0x1fb1bd=0x0,_0x4daa14={};_0x1fb1bd=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 +var _0x825b=['voiceDialReport','Request','voice','membername','endtime','starttime','outbound','dialstring','moment','lodash','util','../client','queuecallercompleteAt','queuecallerexitAt','lastAssignedTo','isNil','interface','format','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','CreateMemberReport'];(function(_0x2cd77c,_0x459c5d){var _0x26ea0f=function(_0x1deba6){while(--_0x1deba6){_0x2cd77c['push'](_0x2cd77c['shift']());}};_0x26ea0f(++_0x459c5d);}(_0x825b,0x1ac));var _0xb825=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x825b[_0x32b542];return _0x554d54;};'use strict';var moment=require(_0xb825('0x0'));var _=require(_0xb825('0x1'));var util=require(_0xb825('0x2'));var client=require(_0xb825('0x3'));exports['voiceQueueReport']=function(_0x11f5a8){var _0x379569=_0x11f5a8[_0xb825('0x4')]||_0x11f5a8[_0xb825('0x5')];return client['Request']('CreateMemberReport',{'body':{'channel':'voice','membername':_0x11f5a8[_0xb825('0x6')],'interface':_[_0xb825('0x7')](_0x11f5a8[_0xb825('0x8')])?util[_0xb825('0x9')]('SIP/%s',_0x11f5a8['lastAssignedTo']):_0x11f5a8[_0xb825('0x8')],'type':_0xb825('0xa'),'enterAt':_0x11f5a8[_0xb825('0xb')],'exitAt':_0x379569,'duration':moment(_0x379569)['diff'](_0x11f5a8['queuecallerleaveAt'],_0xb825('0xc')),'data1':_0xb825('0xd'),'data2':_0x11f5a8[_0xb825('0xe')],'data3':_0x11f5a8[_0xb825('0xf')],'data4':null,'data5':_0x11f5a8[_0xb825('0x10')],'role':_0xb825('0x11'),'internal':_0x11f5a8[_0xb825('0x12')]?_[_0xb825('0x13')](_0x11f5a8['accountcode']):undefined,'uniqueid':_0x11f5a8[_0xb825('0x14')]},'log':_0xb825('0x15')});};exports[_0xb825('0x16')]=function(_0x2835a8){return client[_0xb825('0x17')]('CreateMemberReport',{'body':{'channel':_0xb825('0x18'),'membername':_0x2835a8[_0xb825('0x19')],'interface':_0x2835a8[_0xb825('0x8')],'type':_0xb825('0xa'),'enterAt':_0x2835a8['starttime'],'exitAt':_0x2835a8['endtime'],'duration':moment(_0x2835a8[_0xb825('0x1a')])['diff'](_0x2835a8[_0xb825('0x1b')],'seconds')>=0x0?moment(_0x2835a8['endtime'])['diff'](_0x2835a8[_0xb825('0x1b')],_0xb825('0xc')):null,'data1':_0xb825('0x1c'),'data2':_0x2835a8[_0xb825('0x12')],'data3':_0x2835a8[_0xb825('0xf')],'data4':_0x2835a8[_0xb825('0x1d')]||null,'role':_0xb825('0x11'),'internal':_0x2835a8[_0xb825('0x12')]?_[_0xb825('0x13')](_0x2835a8[_0xb825('0x12')]):undefined,'uniqueid':_0x2835a8[_0xb825('0x14')]},'log':_0xb825('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 824a501..bae6a62 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 _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 +var _0x153f=['GetTemplate','name','../client','getTemplates','Request'];(function(_0x1788d4,_0x14a03a){var _0x203b5c=function(_0x2e411a){while(--_0x2e411a){_0x1788d4['push'](_0x1788d4['shift']());}};_0x203b5c(++_0x14a03a);}(_0x153f,0x15b));var _0xf153=function(_0x2f7c74,_0x1835a6){_0x2f7c74=_0x2f7c74-0x0;var _0x4f4af5=_0x153f[_0x2f7c74];return _0x4f4af5;};'use strict';var client=require(_0xf153('0x0'));exports[_0xf153('0x1')]=function(_0xde7eae){return function(_0x44cea3){return client[_0xf153('0x2')](_0xf153('0x3'),{'options':{'raw':!![],'attributes':['id',_0xf153('0x4'),'html']},'log':_0xf153('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index afbe707..0644e8f 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 _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 +var _0xca1d=['data2','data3','data4','data6','data7','getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','value','AnyConditions','field','Action','Actions','data1'];(function(_0x4ee355,_0x4beb49){var _0x23c901=function(_0x401ac4){while(--_0x401ac4){_0x4ee355['push'](_0x4ee355['shift']());}};_0x23c901(++_0x4beb49);}(_0xca1d,0xdd));var _0xdca1=function(_0x2c9111,_0x4a5757){_0x2c9111=_0x2c9111-0x0;var _0x590a56=_0xca1d[_0x2c9111];return _0x590a56;};'use strict';var client=require('../client');exports[_0xdca1('0x0')]=function(_0x390943){return function(_0x50bd31){return client[_0xdca1('0x1')](_0xdca1('0x2'),{'options':{'raw':![],'attributes':['id',_0xdca1('0x3'),_0xdca1('0x4'),'status'],'include':[{'model':_0xdca1('0x5'),'as':_0xdca1('0x6'),'attributes':['id','field','operator',_0xdca1('0x7')]},{'model':_0xdca1('0x5'),'as':_0xdca1('0x8'),'attributes':['id',_0xdca1('0x9'),'operator',_0xdca1('0x7')]},{'model':_0xdca1('0xa'),'as':_0xdca1('0xb'),'attributes':['id','action',_0xdca1('0xc'),_0xdca1('0xd'),_0xdca1('0xe'),_0xdca1('0xf'),'data5',_0xdca1('0x10'),_0xdca1('0x11')]}]},'log':_0xdca1('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 7439c0e..c3151ca 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 _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 +var _0xdd37=['GetTrunk','name','registry','../client'];(function(_0x47b282,_0x1b96d2){var _0xccd534=function(_0x547293){while(--_0x547293){_0x47b282['push'](_0x47b282['shift']());}};_0xccd534(++_0x1b96d2);}(_0xdd37,0xef));var _0x7dd3=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xdd37[_0x5b561d];return _0x431060;};'use strict';var client=require(_0x7dd3('0x0'));exports['getTrunks']=function(_0x975169){return function(_0x445fe3){return client['Request'](_0x7dd3('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x7dd3('0x2'),_0x7dd3('0x3')]},'log':_0x7dd3('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index d452264..8842ede 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 _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 +var _0xdbb2=['saveUnpause','UnpauseUser','ShowUser','interface','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','pauseType','lastPauseAt','voicePause','phone','mobile','getTelephones','internal','savePause','PauseUser'];(function(_0x40128d,_0x429c3a){var _0x2df122=function(_0x48d48c){while(--_0x48d48c){_0x40128d['push'](_0x40128d['shift']());}};_0x2df122(++_0x429c3a);}(_0xdbb2,0xd4));var _0x2dbb=function(_0x3a73bc,_0x550aef){_0x3a73bc=_0x3a73bc-0x0;var _0x32891b=_0xdbb2[_0x3a73bc];return _0x32891b;};'use strict';var client=require(_0x2dbb('0x0'));exports[_0x2dbb('0x1')]=function(){return function(){return client[_0x2dbb('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x2dbb('0x3')},'attributes':['id',_0x2dbb('0x4'),_0x2dbb('0x5'),_0x2dbb('0x6'),_0x2dbb('0x7'),_0x2dbb('0x8'),'lastLoginAt',_0x2dbb('0x9'),_0x2dbb('0xa'),_0x2dbb('0xb'),_0x2dbb('0xc'),_0x2dbb('0xd'),'interface']},'log':_0x2dbb('0x1')});};};exports[_0x2dbb('0xe')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x2dbb('0x4'),_0x2dbb('0x6'),_0x2dbb('0xf')]},'log':_0x2dbb('0xe')});};};exports[_0x2dbb('0x10')]=function(_0x291aea,_0x1b0672,_0x4a4814){return client['Request'](_0x2dbb('0x11'),{'body':{'type':_0x1b0672,'uniqueid':_0x4a4814},'options':{'where':{'id':_0x291aea['id']}},'log':_0x2dbb('0x10')});};exports[_0x2dbb('0x12')]=function(_0x2f5316){return client[_0x2dbb('0x2')](_0x2dbb('0x13'),{'body':{},'options':{'where':{'id':_0x2f5316['id']}},'log':_0x2dbb('0x10')});};exports['getAgent']=function(_0x371eed){return client['Request'](_0x2dbb('0x14'),{'options':{'raw':![],'where':{'role':'agent','id':_0x371eed},'attributes':['id','name',_0x2dbb('0x5'),_0x2dbb('0x6'),_0x2dbb('0x7'),_0x2dbb('0x8'),'lastLoginAt',_0x2dbb('0x9'),_0x2dbb('0xa'),_0x2dbb('0xb'),_0x2dbb('0x15')]},'log':_0x2dbb('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 8856441..bde2d76 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 _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 +var _0x0cee=['create','Request','CreateVoiceAgentReport','update','../client'];(function(_0x4cf944,_0x1d22e2){var _0x2f14fe=function(_0x5d840f){while(--_0x5d840f){_0x4cf944['push'](_0x4cf944['shift']());}};_0x2f14fe(++_0x1d22e2);}(_0x0cee,0x185));var _0xe0ce=function(_0x221936,_0x45db93){_0x221936=_0x221936-0x0;var _0xa869a5=_0x0cee[_0x221936];return _0xa869a5;};'use strict';var client=require(_0xe0ce('0x0'));exports[_0xe0ce('0x1')]=function(_0x146690){return client[_0xe0ce('0x2')](_0xe0ce('0x3'),{'body':_0x146690,'log':_0xe0ce('0x3')});};exports[_0xe0ce('0x4')]=function(_0x802261,_0x597802,_0x1e4818){return client['Request']('UpdateVoiceAgentReport',{'body':_0x802261,'options':{'where':{'uniqueid':_0x597802,'interface':_0x1e4818,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 4f6836d..5d9ef09 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 _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 +var _0xeb2d=['DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','GetVoiceCallReports','moment','lodash','Request','CreateVoiceCallReport','merge','calleridnum','callerid'];(function(_0x329f9b,_0x236f00){var _0x39059a=function(_0x4d527d){while(--_0x4d527d){_0x329f9b['push'](_0x329f9b['shift']());}};_0x39059a(++_0x236f00);}(_0xeb2d,0x13c));var _0xdeb2=function(_0x400e1c,_0x2408d3){_0x400e1c=_0x400e1c-0x0;var _0x188184=_0xeb2d[_0x400e1c];return _0x188184;};'use strict';var moment=require(_0xdeb2('0x0'));var util=require('util');var _=require(_0xdeb2('0x1'));var client=require('../client');exports['create']=function(_0x1bf09f){return client[_0xdeb2('0x2')](_0xdeb2('0x3'),{'body':_[_0xdeb2('0x4')](_0x1bf09f,{'source':_0x1bf09f[_0xdeb2('0x5')],'destinationcontext':_0x1bf09f['context'],'callerid':_0x1bf09f[_0xdeb2('0x6')],'amaflags':_0xdeb2('0x7')}),'log':_0xdeb2('0x3')});};exports[_0xdeb2('0x8')]=function(){return function(){return client[_0xdeb2('0x2')](_0xdeb2('0x9'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0xdeb2('0xa'))[_0xdeb2('0xb')](_0xdeb2('0xc')),moment()[_0xdeb2('0xd')](_0xdeb2('0xa'))[_0xdeb2('0xb')](_0xdeb2('0xc'))]}},'attributes':[_0xdeb2('0xe'),'disposition',_0xdeb2('0xf'),'billableseconds']},'log':_0xdeb2('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 04be25a..b9c398e 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 _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 +var _0x4725=['Request','CreateVoiceDialReport','../client','create'];(function(_0x552da1,_0x167baf){var _0x546470=function(_0x44fe07){while(--_0x44fe07){_0x552da1['push'](_0x552da1['shift']());}};_0x546470(++_0x167baf);}(_0x4725,0x106));var _0x5472=function(_0x5a738f,_0x299280){_0x5a738f=_0x5a738f-0x0;var _0x230c6d=_0x4725[_0x5a738f];return _0x230c6d;};'use strict';var client=require(_0x5472('0x0'));exports[_0x5472('0x1')]=function(_0x3e68ab){return client[_0x5472('0x2')](_0x5472('0x3'),{'body':_0x3e68ab,'log':_0x5472('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 17504a7..e88fa65 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 _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 +var _0xbc6f=['recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xbc6f,0x127));var _0xfbc6=function(_0x2081aa,_0x31d653){_0x2081aa=_0x2081aa-0x0;var _0x36485d=_0xbc6f[_0x2081aa];return _0x36485d;};'use strict';var client=require(_0xfbc6('0x0'));exports[_0xfbc6('0x1')]=function(){return function(){return client[_0xfbc6('0x2')](_0xfbc6('0x3'),{'options':{'raw':!![],'attributes':['id',_0xfbc6('0x4'),_0xfbc6('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xfbc6('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 0db447f..bfbe79e 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 _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 +var _0x7d73=['dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','Intervals','interval','getVoiceQueues','../client','GetVoiceQueue','name','acw','autopause','monitor_format','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x7d73,0xc5));var _0x37d7=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0x7d73[_0x41c381];return _0x427981;};'use strict';var client=require(_0x37d7('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0x37d7('0x1'),{'options':{'raw':![],'attributes':['id',_0x37d7('0x2'),_0x37d7('0x3'),'acwTimeout',_0x37d7('0x4'),_0x37d7('0x5'),'type','dialActive',_0x37d7('0x6'),_0x37d7('0x7'),_0x37d7('0x8'),_0x37d7('0x9'),_0x37d7('0xa'),_0x37d7('0xb'),_0x37d7('0xc'),_0x37d7('0xd'),_0x37d7('0xe'),_0x37d7('0xf'),_0x37d7('0x10'),_0x37d7('0x11'),_0x37d7('0x12'),_0x37d7('0x13'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x37d7('0x14'),_0x37d7('0x15'),_0x37d7('0x16'),_0x37d7('0x17'),_0x37d7('0x18'),_0x37d7('0x19'),_0x37d7('0x1a'),_0x37d7('0x1b'),_0x37d7('0x1c'),_0x37d7('0x1d'),'dialAMDGreeting',_0x37d7('0x1e'),_0x37d7('0x1f'),_0x37d7('0x20'),'dialAMDBetweenWordsSilence',_0x37d7('0x21'),_0x37d7('0x22'),_0x37d7('0x23'),'timeout',_0x37d7('0x24'),'dialRecallInQueue','dialOrderByScheduledAt',_0x37d7('0x25'),_0x37d7('0x26'),_0x37d7('0x27'),_0x37d7('0x5'),'strategy',_0x37d7('0x28'),'dialCutDigit',_0x37d7('0x29'),_0x37d7('0x2a'),_0x37d7('0x2b'),'dialDropRetryFrequency',_0x37d7('0x2c'),'dialAbandonedRetryFrequency',_0x37d7('0x2d'),_0x37d7('0x2e'),'dialAgentRejectMaxRetry',_0x37d7('0x2f'),_0x37d7('0x30'),'dialPredictiveIntervalMaxThreshold',_0x37d7('0x31')],'include':[{'model':_0x37d7('0x32'),'as':_0x37d7('0x32'),'attributes':['id',_0x37d7('0x2'),'callerid',_0x37d7('0x33')]},{'model':_0x37d7('0x34'),'as':_0x37d7('0x35'),'attributes':['id',_0x37d7('0x2')]},{'model':_0x37d7('0x32'),'as':_0x37d7('0x36'),'attributes':['id',_0x37d7('0x2'),_0x37d7('0x37'),_0x37d7('0x33')]},{'model':_0x37d7('0x38'),'as':_0x37d7('0x38'),'attributes':['id',_0x37d7('0x2')],'include':[{'model':'Interval','as':_0x37d7('0x39'),'attributes':['id','name',_0x37d7('0x3a')]}]}]},'log':_0x37d7('0x3b')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 0c59b2e..e9db92d 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 _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 +var _0xe408=['GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandonAt','GetVoiceQueueReports','moment','Request','CreateVoiceQueueReport'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0xe408,0x74));var _0x8e40=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xe408[_0x4a3898];return _0x25ceb0;};'use strict';var moment=require(_0x8e40('0x0'));var _=require('lodash');var client=require('../client');exports['create']=function(_0x294b0e){return client[_0x8e40('0x1')](_0x8e40('0x2'),{'body':_0x294b0e,'log':'CreateVoiceQueueReport'});};exports['getVoiceQueueReports']=function(){return function(){return client[_0x8e40('0x1')](_0x8e40('0x3'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x8e40('0x4')]('day')[_0x8e40('0x5')](_0x8e40('0x6')),moment()[_0x8e40('0x7')]('day')[_0x8e40('0x5')](_0x8e40('0x6'))]}},'attributes':[_0x8e40('0x8'),_0x8e40('0x9'),_0x8e40('0xa'),_0x8e40('0xb'),'queuecallercomplete',_0x8e40('0xc'),_0x8e40('0xd'),_0x8e40('0xe'),'queuecallerabandon',_0x8e40('0xf')]},'log':_0x8e40('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index a3a478a..7d4b546 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 _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 +var _0xef15=['getVoiceQueueRtPauses'];(function(_0x1e54a7,_0x4e7ea3){var _0x41d78e=function(_0xbf0801){while(--_0xbf0801){_0x1e54a7['push'](_0x1e54a7['shift']());}};_0x41d78e(++_0x4e7ea3);}(_0xef15,0x1c1));var _0x5ef1=function(_0x5497d3,_0x193adf){_0x5497d3=_0x5497d3-0x0;var _0x42f1ef=_0xef15[_0x5497d3];return _0x42f1ef;};'use strict';var client=require('../client');exports[_0x5ef1('0x0')]=function(_0x1251c0){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x1251c0,'paused':!![]},'raw':!![]},'log':_0x5ef1('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 50348b0..fb79db7 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 _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 +var _0xa1a8=['Request','CreateVoiceRecording','merge','lodash','../client'];(function(_0x23dc02,_0x55ceaf){var _0x3d4bff=function(_0x131ab5){while(--_0x131ab5){_0x23dc02['push'](_0x23dc02['shift']());}};_0x3d4bff(++_0x55ceaf);}(_0xa1a8,0x1ac));var _0x8a1a=function(_0x8bca06,_0x3ff897){_0x8bca06=_0x8bca06-0x0;var _0x3cc8a3=_0xa1a8[_0x8bca06];return _0x3cc8a3;};'use strict';var _=require(_0x8a1a('0x0'));var client=require(_0x8a1a('0x1'));exports['create']=function(_0xe95082){return client[_0x8a1a('0x2')](_0x8a1a('0x3'),{'body':_[_0x8a1a('0x4')](_0xe95082,{'value':_0xe95082['monitorFilename']}),'log':_0x8a1a('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 2b16513..5e3a131 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 _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 +var _0x41c5=['origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridname','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','Request','CreateVoiceTransferReport','transferercalleridnum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeexten','transfereelinkedid','isexternal','extension','blind','attendedTransfer','result','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename'];(function(_0x37fdd2,_0x44e51e){var _0x5c6b7c=function(_0x476757){while(--_0x476757){_0x37fdd2['push'](_0x37fdd2['shift']());}};_0x5c6b7c(++_0x44e51e);}(_0x41c5,0x1d8));var _0x541c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x41c5[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0x541c('0x0'));exports[_0x541c('0x1')]={};exports['blindTransfer']=function(_0x8036b){return client[_0x541c('0x2')](_0x541c('0x3'),{'body':{'result':_0x8036b['result'],'transfererchannel':_0x8036b['transfererchannel'],'transferercalleridnum':_0x8036b[_0x541c('0x4')],'transferercalleridname':_0x8036b['transferercalleridname'],'transfererconnectedlinenum':_0x8036b['transfererconnectedlinenum'],'transfererconnectedlinename':_0x8036b[_0x541c('0x5')],'transfereraccountcode':_0x8036b[_0x541c('0x6')],'transferercontext':_0x8036b[_0x541c('0x7')],'transfererexten':_0x8036b[_0x541c('0x8')],'transfererlinkedid':_0x8036b['transfererlinkedid'],'transfereechannel':_0x8036b[_0x541c('0x9')],'transfereecalleridnum':_0x8036b[_0x541c('0xa')],'transfereecalleridname':_0x8036b[_0x541c('0xb')],'transfereeconnectedlinenum':_0x8036b['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x8036b['transfereeconnectedlinename'],'transfereeaccountcode':_0x8036b['transfereeaccountcode'],'transfereecontext':_0x8036b['transfereecontext'],'transfereeexten':_0x8036b[_0x541c('0xc')],'transfereelinkedid':_0x8036b[_0x541c('0xd')],'isexternal':_0x8036b[_0x541c('0xe')],'context':_0x8036b['context'],'extension':_0x8036b[_0x541c('0xf')],'type':_0x541c('0x10')},'log':_0x541c('0x3')});};exports[_0x541c('0x11')]=function(_0x136ec7){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x136ec7[_0x541c('0x12')],'transfererchannel':_0x136ec7[_0x541c('0x13')],'transferercalleridnum':_0x136ec7['origtransferercalleridnum'],'transferercalleridname':_0x136ec7[_0x541c('0x14')],'transfererconnectedlinenum':_0x136ec7[_0x541c('0x15')],'transfererconnectedlinename':_0x136ec7[_0x541c('0x16')],'transfereraccountcode':_0x136ec7[_0x541c('0x17')],'transferercontext':_0x136ec7['secondtransferercontext'],'transfererexten':_0x136ec7[_0x541c('0x18')],'transfererlinkedid':_0x136ec7[_0x541c('0x19')],'transfereechannel':_0x136ec7['transfertargetchannel'],'transfereecalleridnum':_0x136ec7['transfertargetcalleridnum'],'transfereecalleridname':_0x136ec7[_0x541c('0x1a')],'transfereeconnectedlinenum':_0x136ec7['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x136ec7['transfertargetconnectedlinename'],'transfereeaccountcode':_0x136ec7['transfertargetaccountcode'],'transfereecontext':_0x136ec7[_0x541c('0x1b')],'transfereeexten':_0x136ec7[_0x541c('0x1c')],'transfereelinkedid':_0x136ec7[_0x541c('0x1d')],'isexternal':_0x136ec7['isexternal'],'context':_0x136ec7[_0x541c('0x1e')],'extension':_0x136ec7[_0x541c('0x1f')],'type':_0x541c('0x20')},'log':_0x541c('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index dfffa9d..36f6b94 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 _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 +var _0x3a4b=['telephones','trunks','campaigns','run','event','emit','custom:','faxAccounts','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','jayson/promise','bluebird','moment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','username','join','pick','keys','action','Reload','Action','message','catch','command','Command','then','content','voiceQueues','hasOwnProperty','strategy','answered','available','pTalking','sumDuration','sumHoldTime','talking','type','waiting','loggedInDb','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','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','values','ami\x20disconnected','validate','map','find','channels','%s.%s','filename','uniqueid','wav','MixMonitor','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','isConnected','resolve','StopMixMonitor','destinationchannel','status','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Hangup','voicequeuechannelredirect','context'];(function(_0x1148f8,_0x5d1b06){var _0x54f0c7=function(_0x26ebe3){while(--_0x26ebe3){_0x1148f8['push'](_0x1148f8['shift']());}};_0x54f0c7(++_0x5d1b06);}(_0x3a4b,0x1a1));var _0xb3a4=function(_0x336b71,_0x450b8e){_0x336b71=_0x336b71-0x0;var _0x417ca0=_0x3a4b[_0x336b71];return _0x417ca0;};'use strict';var _=require('lodash');var util=require(_0xb3a4('0x0'));var jayson=require(_0xb3a4('0x1'));var schema=require('validate');var BPromise=require(_0xb3a4('0x2'));var moment=require(_0xb3a4('0x3'));var config=require('../../../config/environment');var properties=require(_0xb3a4('0x4'));var ami=require(_0xb3a4('0x5'));exports[_0xb3a4('0x6')]=function(_0xfdb443,_0x36bba0,_0x341e46){return new BPromise(function(_0x2bd75f,_0x1ec4de){var _0x1c40ab={'QueuePause':function(_0x5355fc){return new Promise(function(_0x231009,_0x441fd8){var _0x568a72=util[_0xb3a4('0x7')](_0xb3a4('0x8'),_0xb3a4('0x9'),_0x5355fc[_0xb3a4('0xa')]);if(_0xfdb443[_0xb3a4('0xb')]&&_0xfdb443[_0xb3a4('0xb')][_0x568a72]&&_0xfdb443[_0xb3a4('0xb')][_0x568a72]['timer']){_0xfdb443[_0xb3a4('0xb')][_0x568a72][_0xb3a4('0xc')]();}if(_0xfdb443[_0xb3a4('0xd')][_0x568a72]){_0xfdb443[_0xb3a4('0xd')][_0x568a72][_0xb3a4('0xe')]({'statePause':_0x5355fc[_0xb3a4('0xf')]?!![]:![]});}_0x231009({'code':0xc8,'message':_0xb3a4('0x10')});});},'Reload':function(_0x39453f){var _0xc2a03c=this;return new Promise(function(_0xe2688a,_0x6d159c){if(ami['isConnected']()==![]){return _0x6d159c(_0xc2a03c[_0xb3a4('0x11')](0x1f4,[config[_0xb3a4('0x12')]['ip'],config[_0xb3a4('0x12')][_0xb3a4('0x13')],'ami\x20disconnected'][_0xb3a4('0x14')]('\x20')));}_0x39453f=_[_0xb3a4('0x15')](_0x39453f,_[_0xb3a4('0x16')](properties['module']));_0x39453f[_0xb3a4('0x17')]=_0xb3a4('0x18');return ami[_0xb3a4('0x19')](_0x39453f)['then'](function(_0x446db8){_0xe2688a({'code':0xc8,'message':_0x446db8[_0xb3a4('0x1a')]});})[_0xb3a4('0x1b')](function(_0x4d11c9){_0x6d159c(_0xc2a03c[_0xb3a4('0x11')](0x1f5,_0x4d11c9['message']));});});},'Command':function(_0x226307){var _0x480f30=this;return new Promise(function(_0x1880ff,_0x495ffd){if(ami['isConnected']()==![]){return _0x495ffd(_0x480f30[_0xb3a4('0x11')](0x1f4,[config[_0xb3a4('0x12')]['ip'],config[_0xb3a4('0x12')][_0xb3a4('0x13')],'ami\x20disconnected']['join']('\x20')));}_0x226307=_[_0xb3a4('0x15')](_0x226307,_0xb3a4('0x1c'));_0x226307['action']=_0xb3a4('0x1d');return ami[_0xb3a4('0x19')](_0x226307)[_0xb3a4('0x1e')](function(_0x3f3a80){_0x1880ff({'code':0xc8,'message':_0x3f3a80[_0xb3a4('0x1f')]});})[_0xb3a4('0x1b')](function(_0x166ac8){_0x495ffd(_0x480f30['error'](0x1f5,_0x166ac8['message']));});});},'VoiceQueues':function(_0x1a73ca){return new Promise(function(_0x4dba04,_0xba25c6){var _0x243191=[];for(var _0x274eb5 in _0xfdb443[_0xb3a4('0x20')]){if(_0xfdb443[_0xb3a4('0x20')][_0xb3a4('0x21')](_0x274eb5)){var _0x17b519=_0xfdb443[_0xb3a4('0x20')][_0x274eb5];var _0x3a55be={'id':_0x17b519['id'],'name':_0x17b519['name'],'strategy':_0x17b519[_0xb3a4('0x22')],'answered':_0x17b519[_0xb3a4('0x23')],'available':_0x17b519[_0xb3a4('0x24')],'loggedIn':_0x17b519['loggedIn'],'pTalking':_0x17b519[_0xb3a4('0x25')],'sumBillable':_0x17b519['sumBillable'],'sumDuration':_0x17b519[_0xb3a4('0x26')],'sumHoldTime':_0x17b519[_0xb3a4('0x27')]||0x0,'talking':_0x17b519[_0xb3a4('0x28')],'total':_0x17b519['total'],'type':_0x17b519[_0xb3a4('0x29')],'unmanaged':_0x17b519['unmanaged'],'abandoned':_0x17b519['abandoned'],'waiting':_0x17b519[_0xb3a4('0x2a')],'loggedInDb':_0x17b519[_0xb3a4('0x2b')]};if(_0x17b519[_0xb3a4('0x29')]===_0xb3a4('0x2c')){_0x3a55be['dialActive']=_0x17b519[_0xb3a4('0x2d')];_0x3a55be[_0xb3a4('0x2e')]=_0x17b519['dialMethod'];_0x3a55be[_0xb3a4('0x2f')]=_0x17b519[_0xb3a4('0x2f')];_0x3a55be[_0xb3a4('0x30')]=_0x17b519[_0xb3a4('0x30')];_0x3a55be[_0xb3a4('0x31')]=_0x17b519[_0xb3a4('0x31')];_0x3a55be[_0xb3a4('0x32')]=_0x17b519[_0xb3a4('0x32')];_0x3a55be[_0xb3a4('0x33')]=_0x17b519['outboundAnswerAgiCallsDay'];_0x3a55be[_0xb3a4('0x34')]=_0x17b519[_0xb3a4('0x34')];_0x3a55be[_0xb3a4('0x35')]=_0x17b519[_0xb3a4('0x35')];_0x3a55be['outboundBusyCallsDay']=_0x17b519[_0xb3a4('0x36')];_0x3a55be[_0xb3a4('0x37')]=_0x17b519[_0xb3a4('0x37')];_0x3a55be[_0xb3a4('0x38')]=_0x17b519[_0xb3a4('0x38')];_0x3a55be[_0xb3a4('0x39')]=_0x17b519[_0xb3a4('0x39')];_0x3a55be[_0xb3a4('0x3a')]=_0x17b519['outboundDropCallsDayTimeout'];_0x3a55be[_0xb3a4('0x3b')]=_0x17b519[_0xb3a4('0x3b')];_0x3a55be[_0xb3a4('0x3c')]=_0x17b519[_0xb3a4('0x3c')];_0x3a55be[_0xb3a4('0x3d')]=_0x17b519[_0xb3a4('0x3d')];_0x3a55be['outboundReCallsDay']=_0x17b519[_0xb3a4('0x3e')];_0x3a55be[_0xb3a4('0x3f')]=_0x17b519[_0xb3a4('0x3f')];_0x3a55be[_0xb3a4('0x40')]=_0x17b519[_0xb3a4('0x40')];_0x3a55be[_0xb3a4('0x41')]=_0x17b519[_0xb3a4('0x41')];_0x3a55be[_0xb3a4('0x42')]=_0x17b519[_0xb3a4('0x42')];_0x3a55be[_0xb3a4('0x43')]=_0x17b519[_0xb3a4('0x43')];_0x3a55be['predictiveIntervalDroppedCallsCallersExit']=_0x17b519[_0xb3a4('0x44')];_0x3a55be[_0xb3a4('0x45')]=_0x17b519[_0xb3a4('0x45')];_0x3a55be['predictiveIntervalErlangCalls']=_0x17b519[_0xb3a4('0x46')];_0x3a55be[_0xb3a4('0x47')]=_0x17b519[_0xb3a4('0x47')];_0x3a55be[_0xb3a4('0x48')]=_0x17b519[_0xb3a4('0x48')];_0x3a55be['predictiveIntervalMultiplicativeFactor']=_0x17b519[_0xb3a4('0x49')];_0x3a55be[_0xb3a4('0x4a')]=_0x17b519['predictiveIntervalPauses'];_0x3a55be[_0xb3a4('0x4b')]=_0x17b519[_0xb3a4('0x4b')];_0x3a55be['predictiveIntervalTotalCalls']=_0x17b519[_0xb3a4('0x4c')];_0x3a55be[_0xb3a4('0x1a')]=_0x17b519[_0xb3a4('0x1a')];_0x3a55be[_0xb3a4('0x4d')]=_0x17b519['originated'];_0x3a55be[_0xb3a4('0x4e')]=_0x17b519[_0xb3a4('0x4e')];_0x3a55be[_0xb3a4('0x4f')]=_0x17b519[_0xb3a4('0x4f')];_0x3a55be[_0xb3a4('0x50')]=_0x17b519[_0xb3a4('0x50')];_0x3a55be[_0xb3a4('0x51')]=_0x17b519['erlangBusyFactor'];_0x3a55be['startPredictive']=_0x17b519[_0xb3a4('0x52')];_0x3a55be[_0xb3a4('0x53')]=_0x17b519['startProgressive'];}if(_0x17b519[_0xb3a4('0x54')]){_0x3a55be[_0xb3a4('0x54')]={'id':_0x17b519['Trunk']['id'],'name':_0x17b519[_0xb3a4('0x54')][_0xb3a4('0xa')],'active':_0x17b519['Trunk'][_0xb3a4('0x55')],'callerid':_0x17b519[_0xb3a4('0x54')][_0xb3a4('0x56')]};}if(_0x17b519[_0xb3a4('0x57')]){_0x3a55be[_0xb3a4('0x57')]={'id':_0x17b519[_0xb3a4('0x57')]['id'],'name':_0x17b519[_0xb3a4('0x57')][_0xb3a4('0xa')]};}_0x243191[_0xb3a4('0x58')](_0x3a55be);}}_0x4dba04({'count':_0x243191[_0xb3a4('0x59')],'rows':_0x243191});});},'VoiceChannels':function(_0x3876fd){return new Promise(function(_0x479df5,_0x54c910){var _0xa41d44=_[_0xb3a4('0x5a')](_0xfdb443['channels']);_0x479df5({'count':_0xa41d44['length'],'rows':_0xa41d44});});},'VoiceChannelMixMonitor':function(_0x518f53){var _0x316415=this;return new Promise(function(_0x4f6fd5,_0x37c48a){if(ami['isConnected']()==![]){return _0x37c48a(_0x316415['error'](0x1f4,[config[_0xb3a4('0x12')]['ip'],config[_0xb3a4('0x12')][_0xb3a4('0x13')],_0xb3a4('0x5b')][_0xb3a4('0x14')]('\x20')));}var _0x58ff34=schema(properties['voicechannel'])[_0xb3a4('0x5c')](_0x518f53);if(_0x58ff34['length']>0x0){return _0x37c48a(_0x316415['error'](0x1f4,_[_0xb3a4('0x5d')](_0x58ff34,_0xb3a4('0x1a'))[_0xb3a4('0x14')](',\x20')));}var _0x58cce6=_[_0xb3a4('0x5e')](_0xfdb443[_0xb3a4('0x5f')],{'uniqueid':_0x518f53['uniqueid']});if(_0x58cce6&&_0x58cce6['channel']){var _0x5e19b5=util['format'](_0xb3a4('0x60'),_0x518f53[_0xb3a4('0x61')]||_0x518f53[_0xb3a4('0x62')],_0x518f53['format']||_0xb3a4('0x63'));return ami[_0xb3a4('0x19')]({'action':_0xb3a4('0x64'),'channel':_0x58cce6[_0xb3a4('0x65')],'file':_0x5e19b5,'options':_0xb3a4('0x66')})[_0xb3a4('0x1e')](function(_0x5387ae){var _0x13418d=_[_0xb3a4('0x5e')](_0x58cce6[_0xb3a4('0x67')],{'filename':_0xb3a4('0x68')+_0x5e19b5[_0xb3a4('0x69')]()});if(_[_0xb3a4('0x6a')](_0x13418d)){_0x58cce6['monitors'][_0xb3a4('0x58')]({'filename':_0xb3a4('0x68')+_0x5e19b5['toLowerCase'](),'createdAt':moment()[_0xb3a4('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x5387ae[_0xb3a4('0x6b')],'status':'rec'});}else{_0x13418d[_0xb3a4('0x6b')]=_0x5387ae['mixmonitorid'];_0x13418d['status']=_0xb3a4('0x6c');}_0x4f6fd5({'code':0xc8,'message':[_0x518f53[_0xb3a4('0x62')],_0xb3a4('0x6d'),_0x5387ae[_0xb3a4('0x6b')]]['join']('\x20'),'mixmonitorid':_0x5387ae[_0xb3a4('0x6b')]});})[_0xb3a4('0x1b')](function(_0x1cc9bf){_0x37c48a(_0x316415[_0xb3a4('0x11')](0x1f5,[_0x518f53[_0xb3a4('0x62')],_0x1cc9bf[_0xb3a4('0x1a')][_0xb3a4('0x69')]()]['join']('\x20')));});}else{return _0x37c48a(_0x316415[_0xb3a4('0x11')](0x1f5,_0xb3a4('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0x18f447){var _0x4e75bc=this;return new Promise(function(_0x36543b,_0x30f995){if(ami[_0xb3a4('0x6f')]()==![]){return _0x30f995(_0x4e75bc[_0xb3a4('0x11')](0x1f4,[config[_0xb3a4('0x12')]['ip'],config[_0xb3a4('0x12')][_0xb3a4('0x13')],_0xb3a4('0x5b')][_0xb3a4('0x14')]('\x20')));}var _0x468aad=schema(properties['voicechannel'])[_0xb3a4('0x5c')](_0x18f447);if(_0x468aad['length']>0x0){return _0x30f995(_0x4e75bc[_0xb3a4('0x11')](0x1f4,_[_0xb3a4('0x5d')](_0x468aad,'message')[_0xb3a4('0x14')](',\x20')));}var _0x3aef7d=_[_0xb3a4('0x5e')](_0xfdb443[_0xb3a4('0x5f')],{'uniqueid':_0x18f447[_0xb3a4('0x62')]});if(_0x3aef7d){return BPromise[_0xb3a4('0x70')]()[_0xb3a4('0x1e')](function(){if(_0x3aef7d[_0xb3a4('0x65')]){return ami[_0xb3a4('0x19')]({'action':_0xb3a4('0x71'),'channel':_0x3aef7d[_0xb3a4('0x65')],'mixmonitorid':_0x18f447[_0xb3a4('0x6b')]})[_0xb3a4('0x1b')](function(_0x3027f8){});}})['then'](function(){if(_0x3aef7d['destinationchannel']){return ami[_0xb3a4('0x19')]({'action':'StopMixMonitor','channel':_0x3aef7d[_0xb3a4('0x72')],'mixmonitorid':_0x18f447['mixmonitorid']})['catch'](function(_0x448f98){});}})[_0xb3a4('0x1e')](function(_0x5dcb76){var _0xa218e3=_['find'](_0x3aef7d[_0xb3a4('0x67')],{'mixmonitorid':_0x18f447['mixmonitorid']});if(_0xa218e3){_0xa218e3[_0xb3a4('0x73')]='stop';}})[_0xb3a4('0x1e')](function(){var _0x4cc7ff=util[_0xb3a4('0x7')](_0xb3a4('0x60'),_0x18f447['filename']||_0x18f447[_0xb3a4('0x62')],_0x18f447[_0xb3a4('0x7')]||_0xb3a4('0x63'));var _0x2a0f90=_[_0xb3a4('0x5e')](_0x3aef7d[_0xb3a4('0x67')],{'filename':_0xb3a4('0x68')+_0x4cc7ff[_0xb3a4('0x69')]()});if(_0x2a0f90){_0x2a0f90[_0xb3a4('0x73')]=_0xb3a4('0x74');}})['then'](function(){_0x36543b({'code':0xc8,'message':[_0x18f447[_0xb3a4('0x62')],_0xb3a4('0x75')][_0xb3a4('0x14')]('\x20')});})[_0xb3a4('0x1b')](function(_0x54cd59){_0x30f995(_0x4e75bc['error'](0x1f5,[_0x18f447[_0xb3a4('0x62')],_0x54cd59[_0xb3a4('0x1a')][_0xb3a4('0x69')]()][_0xb3a4('0x14')]('\x20')));});}else{return _0x30f995(_0x4e75bc[_0xb3a4('0x11')](0x1f5,_0xb3a4('0x6e')));}});},'VoiceQueuesChannels':function(_0x7e5f42){return new Promise(function(_0x456913,_0xebff0f){var _0xdaf65=_[_0xb3a4('0x5a')](_0xfdb443[_0xb3a4('0x76')]);_0x456913({'count':_0xdaf65[_0xb3a4('0x59')],'rows':_0xdaf65});});},'VoiceQueuesChannel':function(_0x4d49a5){var _0x4a6e5f=this;return new Promise(function(_0x523fdb,_0x5b567d){var _0x4bb23e=schema(properties[_0xb3a4('0x77')])[_0xb3a4('0x5c')](_0x4d49a5);if(_0x4bb23e[_0xb3a4('0x59')]>0x0){return _0x5b567d(_0x4a6e5f[_0xb3a4('0x11')](0x1f4,_[_0xb3a4('0x5d')](_0x4bb23e,_0xb3a4('0x1a'))['join'](',\x20')));}var _0x4e7124=_['find'](_0xfdb443[_0xb3a4('0x76')],{'uniqueid':_0x4d49a5[_0xb3a4('0x62')]});if(_0x4e7124){_0x523fdb(_0x4e7124);}else{return _0x5b567d(_0x4a6e5f['error'](0x1f5,_0xb3a4('0x6e')));}});},'VoiceQueuesChannelHangup':function(_0x4aaea4){var _0x69c1dd=this;return new Promise(function(_0x10782f,_0x124243){if(ami[_0xb3a4('0x6f')]()==![]){return _0x124243(_0x69c1dd[_0xb3a4('0x11')](0x1f4,[config[_0xb3a4('0x12')]['ip'],config[_0xb3a4('0x12')][_0xb3a4('0x13')],'ami\x20disconnected'][_0xb3a4('0x14')]('\x20')));}var _0x19e418=schema(properties['voicequeuechannelhangup'])[_0xb3a4('0x5c')](_0x4aaea4);if(_0x19e418['length']>0x0){return _0x124243(_0x69c1dd[_0xb3a4('0x11')](0x1f4,_[_0xb3a4('0x5d')](_0x19e418,_0xb3a4('0x1a'))[_0xb3a4('0x14')](',\x20')));}var _0x3db619=_['find'](_0xfdb443[_0xb3a4('0x76')],{'uniqueid':_0x4aaea4[_0xb3a4('0x62')]});if(_0x3db619&&_0x3db619[_0xb3a4('0x65')]){return ami[_0xb3a4('0x19')]({'action':_0xb3a4('0x78'),'channel':_0x3db619[_0xb3a4('0x65')]})[_0xb3a4('0x1e')](function(_0x39ac21){_0x10782f({'code':0xc8,'message':[_0x4aaea4[_0xb3a4('0x62')],_0x39ac21['message'][_0xb3a4('0x69')]()][_0xb3a4('0x14')]('\x20')});})['catch'](function(_0x5e76cb){_0x124243(_0x69c1dd[_0xb3a4('0x11')](0x1f5,[_0x4aaea4[_0xb3a4('0x62')],_0x5e76cb['message'][_0xb3a4('0x69')]()][_0xb3a4('0x14')]('\x20')));});}else{return _0x124243(_0x69c1dd[_0xb3a4('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0xe3988c){var _0x2b37d4=this;return new Promise(function(_0xb8a4fd,_0x15467d){if(ami[_0xb3a4('0x6f')]()==![]){return _0x15467d(_0x2b37d4['error'](0x1f4,[config['asterisk']['ip'],config[_0xb3a4('0x12')]['username'],_0xb3a4('0x5b')][_0xb3a4('0x14')]('\x20')));}var _0x59adb2=schema(properties[_0xb3a4('0x79')])[_0xb3a4('0x5c')](_0xe3988c);if(_0x59adb2['length']>0x0){return _0x15467d(_0x2b37d4[_0xb3a4('0x11')](0x1f4,_[_0xb3a4('0x5d')](_0x59adb2,'message')[_0xb3a4('0x14')](',\x20')));}var _0x3278bb=_[_0xb3a4('0x5e')](_0xfdb443[_0xb3a4('0x76')],{'uniqueid':_0xe3988c[_0xb3a4('0x62')]});if(_0x3278bb&&_0x3278bb[_0xb3a4('0x65')]){return ami[_0xb3a4('0x19')]({'action':'Redirect','channel':_0x3278bb[_0xb3a4('0x65')],'exten':_0xe3988c['exten'],'context':_0xe3988c['context']||_0x3278bb[_0xb3a4('0x7a')],'priority':0x1})[_0xb3a4('0x1e')](function(_0x97a9b2){_0xb8a4fd({'code':0xc8,'message':[_0xe3988c[_0xb3a4('0x62')],_0x97a9b2[_0xb3a4('0x1a')]['toLowerCase']()][_0xb3a4('0x14')]('\x20')});})['catch'](function(_0x20306b){_0x15467d(_0x2b37d4[_0xb3a4('0x11')](0x1f5,[_0xe3988c[_0xb3a4('0x62')],_0x20306b[_0xb3a4('0x1a')][_0xb3a4('0x69')]()]['join']('\x20')));});}else{return _0x15467d(_0x2b37d4[_0xb3a4('0x11')](0x1f5,_0xb3a4('0x6e')));}});},'Agents':function(_0x5d986f){return new Promise(function(_0x5e1b4d,_0xf6759d){var _0x3bef92=_[_0xb3a4('0x5a')](_0xfdb443[_0xb3a4('0xd')]);_0x5e1b4d({'count':_0x3bef92['length'],'rows':_0x3bef92});});},'Telephones':function(_0x12e8a2){return new Promise(function(_0x1ea599,_0x8d32e1){var _0x25bbd2=_[_0xb3a4('0x5a')](_0xfdb443[_0xb3a4('0x7b')]);_0x1ea599({'count':_0x25bbd2[_0xb3a4('0x59')],'rows':_0x25bbd2});});},'Trunks':function(_0x452d5c){return new Promise(function(_0x394f41,_0x537c03){var _0xc6666c=_[_0xb3a4('0x5a')](_0xfdb443[_0xb3a4('0x7c')]);_0x394f41({'count':_0xc6666c['length'],'rows':_0xc6666c});});},'OutboundChannels':function(_0x41b457){return new Promise(function(_0x210978,_0x29412c){var _0xb82204=_[_0xb3a4('0x5a')](_0xfdb443['outboundChannels']);_0x210978({'count':_0xb82204[_0xb3a4('0x59')],'rows':_0xb82204});});},'Outbound':function(_0x597fde){return new Promise(function(_0x51fcdd,_0x1bf7fc){_0x51fcdd(_0xfdb443['outbound']);});},'Campaigns':function(_0x2a52af){return new Promise(function(_0x3ef8dd,_0x194674){var _0x3cf149=_[_0xb3a4('0x5a')](_0xfdb443[_0xb3a4('0x7d')]);_0x3ef8dd({'count':_0x3cf149[_0xb3a4('0x59')],'rows':_0x3cf149});});},'VoiceQueuesPreview':function(_0x537c54){var _0x24f2db=this;return new Promise(function(_0x398a9f,_0x56bc20){_0x36bba0[_0xb3a4('0x7e')](_0x537c54['id'])[_0xb3a4('0x1e')](function(_0x302064){_0x398a9f({'code':0xc8,'message':_0x302064[_0xb3a4('0x1a')]});})[_0xb3a4('0x1b')](function(_0x42a898){_0x56bc20(_0x24f2db['error'](0x1f4,_0x42a898[_0xb3a4('0x1a')]));});});},'EventManager':function(_0x4703bb){var _0x5ae1fd=this;return new Promise(function(_0x4cead5,_0x43921b){if(!_0x4703bb[_0xb3a4('0x7f')]){return _0x43921b(_0x5ae1fd['error'](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xb3a4('0x80')](_0xb3a4('0x81')+_0x4703bb['event'],_0x4703bb[_0xb3a4('0x1a')]);_0x4cead5({'code':0xc8,'message':_0x4703bb});});},'FaxAccounts':function(_0x41158c){return new Promise(function(_0x589de5,_0x13b651){var _0x495b1e=_['values'](_0xfdb443[_0xb3a4('0x82')]);_0x589de5({'count':_0x495b1e[_0xb3a4('0x59')],'rows':_0x495b1e});});},'SendFax':function(_0x43835d){var _0x459a56=this;return new Promise(function(_0xd06ffe,_0x3500f3){_0x341e46['send'](_0x43835d)[_0xb3a4('0x1e')](function(_0x2ac4e4){_0xd06ffe({'code':0xc8,'message':_0x2ac4e4['message']});})[_0xb3a4('0x1b')](function(_0x29ad20){_0x3500f3(_0x459a56[_0xb3a4('0x11')](0x1f4,_0x29ad20[_0xb3a4('0x1a')]));});});},'CheckAfterSend':function(_0x8bb5a9){var _0x1496fb=this;return new Promise(function(_0x1adb11,_0xa3532c){_0x341e46['checkAfterSend'](_0x8bb5a9)['then'](function(_0x5ec097){_0x1adb11({'code':0xc8,'message':_0x5ec097['message']});})['catch'](function(_0x33b150){_0xa3532c(_0x1496fb[_0xb3a4('0x11')](0x1f4,_0x33b150['message']));});});}};var _0x3a3ad5=jayson['server'](_0x1c40ab)[_0xb3a4('0x83')]();_0x3a3ad5['on'](_0xb3a4('0x11'),function(_0x45db34){return _0x1ec4de(_0x45db34);});_0x3a3ad5[_0xb3a4('0x6')](0x232a,_0xb3a4('0x84'),function(){console[_0xb3a4('0x85')](_0xb3a4('0x86'),0x232a);return _0x2bd75f('RPC\x20listening\x20on\x20port:'+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 49dbda4..84cd38d 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 _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 +var _0x7f7b=['redis','info','[CM][%s][%s]','exec','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','routeId','firstName','lastName','fax','createdAt','scheduledAt','updatedAt','union','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridnum','destcalleridnum','calleridname','Unknown','destcalleridname','[CM][%s][%s]\x20Contact\x20created:%s','','push','format','name','trigger:%s','action','merge','lodash','bluebird','ioredis','util','../../rpc/cmContact','defaults','localhost','socket.io-emitter'];(function(_0x580c77,_0x3e6e60){var _0x3ce3d9=function(_0x37ceec){while(--_0x37ceec){_0x580c77['push'](_0x580c77['shift']());}};_0x3ce3d9(++_0x3e6e60);}(_0x7f7b,0x64));var _0xb7f7=function(_0x2e1d28,_0x19bc3a){_0x2e1d28=_0x2e1d28-0x0;var _0x2dab38=_0x7f7b[_0x2e1d28];return _0x2dab38;};'use strict';var _=require(_0xb7f7('0x0'));var BPromise=require(_0xb7f7('0x1'));var Redis=require(_0xb7f7('0x2'));var util=require(_0xb7f7('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0xb7f7('0x4'));config['redis']=_[_0xb7f7('0x5')](config['redis'],{'host':_0xb7f7('0x6'),'port':0x18eb});var io=require(_0xb7f7('0x7'))(new Redis(config[_0xb7f7('0x8')]));function emit(_0x5aaecb,_0x686dea,_0xe06beb,_0x39baa3,_0x31a31c){logger[_0xb7f7('0x9')](_0xb7f7('0xa'),_0x5aaecb,_0x686dea['id'],_0xe06beb,_0x39baa3,JSON['stringify'](_0x31a31c));io['to'](_0xe06beb)['emit'](_0x39baa3,_0x31a31c);}exports[_0xb7f7('0xb')]=function(_0x496e5f,_0x39e49a,_0x1402e3,_0xe549c5){var _0x3c4ef5,_0x1dae92;var _0x44700b={};var _0x337c1c=Number(_0x1402e3[_0xb7f7('0xc')]);var _0x18eb55=_0x1402e3['data2']?Boolean(Number(_0x1402e3[_0xb7f7('0xd')])):![];var _0x12b39f;if(_0xe549c5[_0xb7f7('0xe')]){_0x44700b['id']=_0xe549c5[_0xb7f7('0xe')];}if(!_0x44700b['id']){_0x44700b[_0xb7f7('0xf')]=_0x337c1c;_0x12b39f=_0x1402e3[_0xb7f7('0x10')]&&_0x1402e3[_0xb7f7('0x10')]!=='0'?_0x1402e3[_0xb7f7('0x10')][_0xb7f7('0x11')](','):[_0xb7f7('0x12')];_0x44700b[_0xb7f7('0x13')]=_['map'](_0x12b39f,function(_0x834aed){var _0x1940ee={};_0x1940ee[_0x834aed]=_0xe549c5[_0xb7f7('0x14')]?_0xe549c5['destcalleridnum']:_0xe549c5['calleridnum'];return _0x1940ee;});}var _0x3e75af=['id',_0xb7f7('0x15'),_0xb7f7('0x16'),_0xb7f7('0x12'),'mobile',_0xb7f7('0x17'),_0xb7f7('0xf'),_0xb7f7('0x18'),_0xb7f7('0x19'),_0xb7f7('0x1a')];var _0x1e2993=_[_0xb7f7('0x1b')](_0x3e75af,_0x12b39f);BPromise['resolve']()[_0xb7f7('0x1c')](cmContactRpc[_0xb7f7('0x1d')]({'attributes':_0x1e2993,'where':_0x44700b}))[_0xb7f7('0x1c')](function(_0x599533){_0x1dae92=_0x599533;if(!_[_0xb7f7('0x1e')](_0x1dae92)){if(_0x1dae92[_0xb7f7('0x1f')]===0x1){_0x3c4ef5=_0x1dae92[0x0];logger[_0xb7f7('0x9')](_0xb7f7('0x20'),_0xe549c5[_0xb7f7('0x21')],_0x39e49a['id'],_0x3c4ef5['id']);}else{logger[_0xb7f7('0x9')](_0xb7f7('0x22'),_0xe549c5[_0xb7f7('0x21')],_0x39e49a['id'],_[_0xb7f7('0x23')](_0x1dae92,'id')[_0xb7f7('0x24')](','));}return;}else{logger[_0xb7f7('0x9')](_0xb7f7('0x25'),_0xe549c5[_0xb7f7('0x21')],_0x39e49a['id']);var _0x3be995={'ListId':_0x337c1c};var _0x5919ba=_0x1402e3[_0xb7f7('0x26')]&&_0x1402e3['data4']!=='0'?_0x1402e3[_0xb7f7('0x26')]:_0xb7f7('0x12');if(_0x18eb55){logger['info'](_0xb7f7('0x27'),_0xe549c5[_0xb7f7('0x21')],_0x39e49a['id']);_0x3be995[_0x5919ba]=_[_0xb7f7('0x28')](_0xe549c5[_0xb7f7('0x14')])?_0xe549c5[_0xb7f7('0x29')]:_0xe549c5[_0xb7f7('0x2a')];if(_[_0xb7f7('0x28')](_0xe549c5['routeId'])){_0x3be995[_0xb7f7('0x15')]=_0xe549c5['calleridname']&&_0xe549c5[_0xb7f7('0x2b')]!==''?_0xe549c5['calleridname']:_0xb7f7('0x2c');}else{_0x3be995[_0xb7f7('0x15')]=_0xe549c5[_0xb7f7('0x2d')]&&_0xe549c5[_0xb7f7('0x2d')]!==''?_0xe549c5[_0xb7f7('0x2d')]:_0xb7f7('0x2c');}return BPromise['resolve']()[_0xb7f7('0x1c')](cmContactRpc['createContact'](_0x3be995))[_0xb7f7('0x1c')](function(_0x465b81){_0x3c4ef5=_0x465b81;_0x1dae92['push'](_0x465b81);if(_0x3c4ef5){logger['info'](_0xb7f7('0x2e'),_0xe549c5[_0xb7f7('0x21')],_0x39e49a['id'],_0x3c4ef5['id']);}return;});}else{logger[_0xb7f7('0x9')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0xe549c5[_0xb7f7('0x21')],_0x39e49a['id']);_0x3be995[_0x5919ba]=_[_0xb7f7('0x28')](_0xe549c5[_0xb7f7('0x14')])?_0xe549c5['calleridnum']:_0xe549c5[_0xb7f7('0x2a')];if(_['isNil'](_0xe549c5[_0xb7f7('0x14')])){_0x3be995[_0xb7f7('0x15')]=_0xe549c5[_0xb7f7('0x2b')]&&_0xe549c5[_0xb7f7('0x2b')]!==_0xb7f7('0x2f')?_0xe549c5[_0xb7f7('0x2b')]:_0xb7f7('0x2c');}else{_0x3be995[_0xb7f7('0x15')]=_0xe549c5[_0xb7f7('0x2d')]&&_0xe549c5['destcalleridname']!==_0xb7f7('0x2f')?_0xe549c5[_0xb7f7('0x2d')]:_0xb7f7('0x2c');}_0x3c4ef5=_0x3be995;_0x1dae92[_0xb7f7('0x30')](_0x3be995);return;}}})[_0xb7f7('0x1c')](function(){if(_0x496e5f){emit(_0xe549c5[_0xb7f7('0x21')],_0x39e49a,util[_0xb7f7('0x31')]('user:%s',_0x496e5f[_0xb7f7('0x32')]),util[_0xb7f7('0x31')](_0xb7f7('0x33'),_0x1402e3[_0xb7f7('0x34')]['toLowerCase']()),{'evt':_[_0xb7f7('0x35')](_0xe549c5,{'autoCreate':_0x18eb55}),'contact':_0x3c4ef5===undefined?{}:_0x3c4ef5,'contacts':_0x1dae92[_0xb7f7('0x1f')]===0x0?undefined:_0x1dae92});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 9ec1514..9ea342c 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 _0xa31e=['Actions','toLowerCase','motionbar','browser','data1','popup','TemplateId','html','data2','template\x20not\x20found','buildUri','isNil','data3','location','uriLocation','data5','800','data6','600','render','format','name','trigger:%s:%s','action','jscripty','user:%s','trigger:%s','exec','queue','routeId','urlforward','script','parse','query','search','replace','checkTrigger','length','every','AllConditions','channel','some','AnyConditions','checkConditions','account','chat','ChatWebsiteId','value','upperFirst','AccountId','interaction','message','event','operator','membername','lastevent','exports','util','lodash','url','mustache','ioredis','./cmContact','./script','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','syncCustomEvent','bind','custom:agentconnect','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','checkTriggers','interface','hasOwnProperty','status','merge'];(function(_0xd68027,_0x175623){var _0x4b03c9=function(_0x37f1a2){while(--_0x37f1a2){_0xd68027['push'](_0xd68027['shift']());}};_0x4b03c9(++_0x175623);}(_0xa31e,0x11f));var _0xea31=function(_0xf47605,_0x22a2f5){_0xf47605=_0xf47605-0x0;var _0x33bee8=_0xa31e[_0xf47605];return _0x33bee8;};'use strict';var util=require(_0xea31('0x0'));var _=require(_0xea31('0x1'));var url=require(_0xea31('0x2'));var Mustache=require(_0xea31('0x3'));var Redis=require(_0xea31('0x4'));var urlforward=require('./urlforward');var integration=require('./integration');var cmContact=require(_0xea31('0x5'));var script=require(_0xea31('0x6'));var config=require('../../../config/environment');var logger=require(_0xea31('0x7'))(_0xea31('0x8'));var ami=require(_0xea31('0x9'));config[_0xea31('0xa')]=_[_0xea31('0xb')](config['redis'],{'host':_0xea31('0xc'),'port':0x18eb});var io=require(_0xea31('0xd'))(new Redis(config[_0xea31('0xa')]));var operators={'equals':function(_0x373fc2,_0x423dcc){return _0x373fc2==_0x423dcc;},'not_equals':function(_0x470b8b,_0x5f3698){return _0x470b8b!=_0x5f3698;}};var barAndWebActions=['popup',_0xea31('0x2'),_0xea31('0xe')];function Trigger(_0xc5b5ac){this[_0xea31('0xf')]=_0xc5b5ac[_0xea31('0xf')];this[_0xea31('0x10')]=_0xc5b5ac[_0xea31('0x10')];this['voiceQueues']=_0xc5b5ac[_0xea31('0x11')];this[_0xea31('0x12')]=_0xc5b5ac[_0xea31('0x12')];this[_0xea31('0x13')]=_0xc5b5ac['voiceExtensions'];this[_0xea31('0x14')]=_0xc5b5ac[_0xea31('0x14')];this[_0xea31('0x15')]=_0xc5b5ac[_0xea31('0x15')];this[_0xea31('0x16')]=_0xc5b5ac['salesforceAccounts'];this[_0xea31('0x17')]=_0xc5b5ac[_0xea31('0x17')];this[_0xea31('0x18')]=_0xc5b5ac[_0xea31('0x18')];this[_0xea31('0x19')]=_0xc5b5ac[_0xea31('0x19')];this[_0xea31('0x1a')]=_0xc5b5ac['vtigerAccounts'];this['servicenowAccounts']=_0xc5b5ac[_0xea31('0x1b')];this[_0xea31('0x1c')]=_0xc5b5ac['dynamics365Accounts'];this['freshsalesAccounts']=_0xc5b5ac[_0xea31('0x1d')];this[_0xea31('0x1e')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xea31('0x16')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xea31('0x17')],'zoho':this[_0xea31('0x18')],'desk':this['deskAccounts'],'vtiger':this[_0xea31('0x1a')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xea31('0x1d')],'servicenow':this[_0xea31('0x1b')]};ami['on']('custom:agentcalled',this[_0xea31('0x1f')][_0xea31('0x20')](this));ami['on'](_0xea31('0x21'),this[_0xea31('0x1f')][_0xea31('0x20')](this));ami['on']('custom:agentringnoanswer',this[_0xea31('0x1f')][_0xea31('0x20')](this));ami['on'](_0xea31('0x22'),this[_0xea31('0x1f')]['bind'](this));ami['on'](_0xea31('0x23'),this[_0xea31('0x1f')][_0xea31('0x20')](this));ami['on'](_0xea31('0x24'),this['syncCustomEvent'][_0xea31('0x20')](this));ami['on']('custom:agentbusy',this['syncCustomEvent'][_0xea31('0x20')](this));ami['on'](_0xea31('0x25'),this[_0xea31('0x1f')][_0xea31('0x20')](this));ami['on'](_0xea31('0x26'),this[_0xea31('0x1f')][_0xea31('0x20')](this));ami['on'](_0xea31('0x27'),this[_0xea31('0x1f')][_0xea31('0x20')](this));ami['on'](_0xea31('0x28'),this[_0xea31('0x1f')][_0xea31('0x20')](this));ami['on'](_0xea31('0x29'),this[_0xea31('0x2a')][_0xea31('0x20')](this));ami['on']('custom:dialconnect',this[_0xea31('0x2a')][_0xea31('0x20')](this));ami['on'](_0xea31('0x2b'),this[_0xea31('0x2a')][_0xea31('0x20')](this));ami['on'](_0xea31('0x2c'),this[_0xea31('0x1f')][_0xea31('0x20')](this));ami['on']('custom:closedinteraction',this[_0xea31('0x1f')][_0xea31('0x20')](this));ami['on'](_0xea31('0x2d'),this['syncCustomEvent'][_0xea31('0x20')](this));ami['on'](_0xea31('0x2e'),this[_0xea31('0x1f')][_0xea31('0x20')](this));ami['on']('custom:acceptmessage',this[_0xea31('0x1f')][_0xea31('0x20')](this));ami['on'](_0xea31('0x2f'),this[_0xea31('0x1f')][_0xea31('0x20')](this));}Trigger[_0xea31('0x30')][_0xea31('0x31')]=function(_0x2132ea,_0x6ec217,_0x3a54bd){logger[_0xea31('0x32')](_0x2132ea,_0x6ec217,JSON[_0xea31('0x33')](_0x3a54bd));io['to'](_0x2132ea)[_0xea31('0x31')](_0x6ec217,_0x3a54bd);};Trigger[_0xea31('0x30')][_0xea31('0x1f')]=function(_0x550030){var _0x51a0b6=_[_0xea31('0x34')](_0x550030);this[_0xea31('0x35')](_0x51a0b6);};Trigger[_0xea31('0x30')][_0xea31('0x2a')]=function(_0x6f3ad3){if(this[_0xea31('0x10')][_0x6f3ad3[_0xea31('0x36')]]){this[_0xea31('0x1f')](_0x6f3ad3);}};Trigger[_0xea31('0x30')][_0xea31('0x35')]=function(_0x45034f){var _0x569a2a;for(var _0x4ba1df in this[_0xea31('0xf')]){if(this['triggers'][_0xea31('0x37')](_0x4ba1df)){if(this[_0xea31('0xf')][_0x4ba1df][_0xea31('0x38')]){_0x569a2a=this['checkTrigger'](this['triggers'][_0x4ba1df],_0x45034f);if(_0x569a2a){_[_0xea31('0x39')](_0x45034f,_0x45034f['variables']);for(var _0x4ee876=0x0,_0x26a242,_0x54a68e,_0x52c04a;_0x4ee8760x0){_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(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 e7f81f1..61f35f1 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 _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 +var _0xee55=[']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','clientId','remoteUri','username','password','catch','error','toUpperCase','message','4.0','then','value','isNil','validateEmail','email','userEmail',']\x20Agent\x20found\x20','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','calleridnum','POST','contacts','/systemusers(','userId','substring','lastIndexOf','enduserId','GET','contacts?$select=telephone1','Bearer\x20','length','destcalleridnum','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','type','string','nameField','customField','indexOf','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecalls','callDirection','queue','headers','odata-entityid','ticketId','format','emit','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','name'];(function(_0x42146d,_0x5daba1){var _0x354548=function(_0x4cc1bb){while(--_0x4cc1bb){_0x42146d['push'](_0x42146d['shift']());}};_0x354548(++_0x5daba1);}(_0xee55,0x1ce));var _0x5ee5=function(_0x687ddc,_0x2092fa){_0x687ddc=_0x687ddc-0x0;var _0x441991=_0xee55[_0x687ddc];return _0x441991;};'use strict';var _=require(_0x5ee5('0x0'));var BPromise=require(_0x5ee5('0x1'));var rp=require(_0x5ee5('0x2'));var util=require(_0x5ee5('0x3'));var intUtil=require('./util');var md5=require(_0x5ee5('0x4'));var Redis=require(_0x5ee5('0x5'));var logger=require('../../../../config/logger')(_0x5ee5('0x6'));var config=require(_0x5ee5('0x7'));config[_0x5ee5('0x8')]=_[_0x5ee5('0x9')](config[_0x5ee5('0x8')],{'host':_0x5ee5('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5ee5('0x8')]));function getAuthToken(_0x572b7a,_0x54efb7,_0x359efc){var _0x27e8fd={'method':'POST','uri':_0x54efb7,'form':{'client_id':_0x572b7a[_0x5ee5('0xb')],'resource':_0x572b7a[_0x5ee5('0xc')],'username':_0x572b7a[_0x5ee5('0xd')],'password':_0x572b7a['password'],'grant_type':_0x5ee5('0xe'),'client_secret':_0x572b7a['clientSecret']},'json':!![]};return rp(_0x27e8fd)['then'](function(_0x138443){return _0x138443['access_token'];})[_0x5ee5('0xf')](function(_0x38f237){logger[_0x5ee5('0x10')]('['+[_0x359efc[_0x5ee5('0x11')]()]+']\x20Wrong\x20credentials!');return _0x38f237[_0x5ee5('0x12')];});}function getUser(_0x1e97a8,_0x23ecac,_0x14e7ca,_0x39818c,_0x5451b5,_0x46c929){return new BPromise(function(_0x9bdf5e,_0xe5f542){return getAuthToken(_0x23ecac,_0x39818c,_0x46c929)['then'](function(_0x15865f){var _0x1aa125={'method':'GET','uri':_0x5451b5+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x15865f,'OData-Version':_0x5ee5('0x13')},'json':!![]};return rp(_0x1aa125);})[_0x5ee5('0x14')](function(_0x24a7be){var _0xc9d33d=_0x24a7be[_0x5ee5('0x15')];var _0x450297=![];var _0x313282=null;if(!_[_0x5ee5('0x16')](_0x14e7ca)){if(intUtil[_0x5ee5('0x17')](_0x14e7ca[_0x5ee5('0x18')])){_0x1e97a8[_0x5ee5('0x19')]=_0x14e7ca[_0x5ee5('0x18')];for(_0x313282=0x0;_0x313282<_0xc9d33d['length'];_0x313282++){if(_0xc9d33d[_0x313282]['internalemailaddress']===_0x14e7ca[_0x5ee5('0x18')]&&!_0xc9d33d[_0x313282]['isdisabled']){_0x450297=!![];logger['info']('['+[_0x46c929[_0x5ee5('0x11')]()]+_0x5ee5('0x1a')+_0xc9d33d[_0x313282][_0x5ee5('0x1b')]+'!');_0x1e97a8['userId']=_0xc9d33d[_0x313282]['systemuserid'];}}}}if(!_0x450297){logger[_0x5ee5('0x1c')]('['+[_0x46c929[_0x5ee5('0x11')]()]+_0x5ee5('0x1d'));_0x1e97a8['userEmail']=_0x23ecac[_0x5ee5('0xd')];for(_0x313282=0x0;_0x313282<_0xc9d33d['length'];_0x313282++){if(_0xc9d33d[_0x313282]['internalemailaddress']===_0x23ecac[_0x5ee5('0xd')]){_0x1e97a8['userId']=_0xc9d33d[_0x313282]['systemuserid'];}}}_0x9bdf5e(_0x1e97a8);})[_0x5ee5('0xf')](function(_0x9f8183){_0xe5f542(_0x9f8183[_0x5ee5('0x12')]);});});}function createEndUser(_0x3e45d5,_0x511d04,_0xade350,_0x790e46,_0x69cdf3,_0x166e35){return new BPromise(function(_0x528359,_0x4ecde5){return getAuthToken(_0x511d04,_0xade350,_0x166e35)['then'](function(_0x124279){var _0x3916de=_0x166e35[_0x5ee5('0x1e')]()===_0x5ee5('0x1f')?_0x69cdf3['destcalleridnum']:_0x69cdf3[_0x5ee5('0x20')];var _0xa543bb={'method':_0x5ee5('0x21'),'uri':_0x790e46+_0x5ee5('0x22'),'body':{'telephone1':_0x3916de,'fullname':_0x3916de,'firstname':_0x3916de,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5ee5('0x23')+_0x3e45d5[_0x5ee5('0x24')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x124279,'OData-Version':_0x5ee5('0x13')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xa543bb);})[_0x5ee5('0x14')](function(_0x2902d1){var _0x34f98d=_0x2902d1['headers']['odata-entityid'];var _0x3c076f=_0x34f98d[_0x5ee5('0x25')](_0x34f98d[_0x5ee5('0x26')]('(')+0x1,_0x34f98d[_0x5ee5('0x26')](')'));_0x3e45d5[_0x5ee5('0x27')]=_0x3c076f;_0x528359(_0x3e45d5);})['catch'](function(_0x3b4f95){_0x4ecde5(_0x3b4f95[_0x5ee5('0x12')]);});});}function getEndUser(_0x47f13f,_0x49f5ac,_0x445515,_0x489c40,_0x51f4fe,_0x33e211){return new BPromise(function(_0x3ca748,_0x4c433e){return getAuthToken(_0x49f5ac,_0x445515,_0x33e211)[_0x5ee5('0x14')](function(_0x54f383){var _0x17ee73={'method':_0x5ee5('0x28'),'uri':_0x489c40+_0x5ee5('0x29'),'headers':{'Authorization':_0x5ee5('0x2a')+_0x54f383,'If-None-Match':null,'OData-Version':_0x5ee5('0x13')},'json':!![]};return rp(_0x17ee73);})[_0x5ee5('0x14')](function(_0x1a89ef){var _0x1c9108=null;if(_0x1a89ef){var _0x3a80fd=_0x1a89ef[_0x5ee5('0x15')];var _0x1766e7=![];for(_0x1c9108=0x0;_0x1c9108<_0x3a80fd[_0x5ee5('0x2b')];_0x1c9108++){var _0x3c38f6=_0x33e211[_0x5ee5('0x1e')]()===_0x5ee5('0x1f')?_0x51f4fe[_0x5ee5('0x2c')]:_0x51f4fe['calleridnum'];if(_0x3a80fd[_0x1c9108][_0x5ee5('0x2d')]===_0x3c38f6){_0x1766e7=!![];_0x47f13f[_0x5ee5('0x27')]=_0x3a80fd[_0x1c9108][_0x5ee5('0x2e')];}}if(_0x1766e7){_0x3ca748(_0x47f13f);}else{return createEndUser(_0x47f13f,_0x49f5ac,_0x445515,_0x489c40,_0x51f4fe,_0x33e211)[_0x5ee5('0x14')](function(_0x450efe){logger[_0x5ee5('0x1c')]('['+[_0x33e211[_0x5ee5('0x11')]()]+_0x5ee5('0x2f'),_0x450efe[_0x5ee5('0x27')]);_0x3ca748(_0x450efe);});}}else{return createEndUser(_0x47f13f,_0x49f5ac,_0x445515,_0x489c40,_0x51f4fe,_0x33e211)[_0x5ee5('0x14')](function(_0x1f0462){logger[_0x5ee5('0x1c')]('['+[_0x33e211['toUpperCase']()]+_0x5ee5('0x30'),_0x1f0462['enduserId']);_0x3ca748(_0x1f0462);});}});});}function getCustomFields(_0x37f769,_0xc532f7,_0x400ec9){var _0x308a65={};if(_0x37f769[_0x5ee5('0x2b')]>0x0){_['forEach'](_0x37f769,function(_0x5b2bda){if(_0x5b2bda[_0x5ee5('0x31')]===_0x5ee5('0x32')&&_0x5b2bda[_0x5ee5('0x33')]&&!_0x5b2bda[_0x5ee5('0x34')]){var _0x2c2f37=_0x5b2bda['idField'][_0x5ee5('0x1e')]();var _0x565dbc=_0x2c2f37[_0x5ee5('0x25')](0x0,_0x2c2f37[_0x5ee5('0x35')]('_'));var _0x2984cb=_0x2c2f37[_0x5ee5('0x25')](_0x2c2f37['indexOf']('_')+0x1);if(_0x565dbc===_0x400ec9){_0x308a65[_0x2984cb]=_0x5b2bda['content'];}}});}return _0x308a65;}function getTicket(_0x53d3ce,_0x13f7ed,_0x5879aa,_0x53793e,_0x1e6530,_0x5228eb,_0x561a32){return new BPromise(function(_0x436357,_0xe0a942){var _0x2c1d19;return getAuthToken(_0x13f7ed,_0x5879aa,_0x561a32)[_0x5ee5('0x14')](function(_0x22ba7e){if(_0x5228eb[_0x5ee5('0x36')]===_0x5ee5('0x37')){_0x2c1d19={'method':_0x5ee5('0x21'),'uri':_0x53793e+_0x5ee5('0x38'),'body':Object[_0x5ee5('0x39')]({},{'title':intUtil[_0x5ee5('0x3a')](_0x5228eb[_0x5ee5('0x3b')],_0x1e6530,'\x20'),'description':intUtil[_0x5ee5('0x3a')](_0x5228eb[_0x5ee5('0x3c')],_0x1e6530,'\x0a'),'customerid_contact@odata.bind':_0x5ee5('0x3d')+_0x53d3ce[_0x5ee5('0x27')]+')','ownerid@odata.bind':_0x5ee5('0x23')+_0x53d3ce[_0x5ee5('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x5228eb[_0x5ee5('0x3e')],_0x1e6530,_0x5228eb[_0x5ee5('0x36')])),'headers':{'Authorization':_0x5ee5('0x2a')+_0x22ba7e,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5228eb[_0x5ee5('0x36')]==='phonecall'){_0x2c1d19={'method':'POST','uri':_0x53793e+_0x5ee5('0x3f'),'body':Object[_0x5ee5('0x39')]({},{'subject':intUtil[_0x5ee5('0x3a')](_0x5228eb['Subjects'],_0x1e6530,'\x20'),'phonenumber':String(_0x1e6530[_0x5ee5('0x20')]),'description':intUtil[_0x5ee5('0x3a')](_0x5228eb[_0x5ee5('0x3c')],_0x1e6530,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x53d3ce['enduserId']+')','ownerid@odata.bind':_0x5ee5('0x23')+_0x53d3ce[_0x5ee5('0x24')]+')','directioncode':_0x53d3ce[_0x5ee5('0x40')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x5ee5('0x23')+_0x53d3ce[_0x5ee5('0x24')]+')','participationtypemask':_0x53d3ce[_0x5ee5('0x40')]===_0x5ee5('0x41')?0x2:0x1},{'partyid_contact@odata.bind':_0x5ee5('0x3d')+_0x53d3ce[_0x5ee5('0x27')]+')','participationtypemask':_0x53d3ce[_0x5ee5('0x40')]===_0x5ee5('0x41')?0x1:0x2}]},getCustomFields(_0x5228eb[_0x5ee5('0x3e')],_0x1e6530,_0x5228eb[_0x5ee5('0x36')])),'headers':{'Authorization':_0x5ee5('0x2a')+_0x22ba7e,'OData-Version':_0x5ee5('0x13')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2c1d19);})[_0x5ee5('0x14')](function(_0x219593){var _0x3ee739=_0x219593[_0x5ee5('0x42')][_0x5ee5('0x43')];var _0x4f4a66=_0x3ee739['substring'](_0x3ee739[_0x5ee5('0x26')]('(')+0x1,_0x3ee739[_0x5ee5('0x26')](')'));_0x53d3ce[_0x5ee5('0x44')]=_0x4f4a66;_0x436357(_0x53d3ce);})['catch'](function(_0x2d97f5){_0xe0a942(_0x2d97f5[_0x5ee5('0x12')]);});});}function emit(_0x40ea46,_0x10890c,_0xf961d8,_0x27f44b){var _0x18768b={'uri':util[_0x5ee5('0x45')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x40ea46,_0xf961d8,_0x27f44b)};io['to'](util[_0x5ee5('0x45')]('user:%s',_0x10890c))[_0x5ee5('0x46')]('trigger:browser:url',_0x18768b);}exports['cs']=function(_0xb98f06,_0x2b5df4,_0x38d842,_0x50ddf6,_0x3e77c5,_0x202c4f,_0x4b74b8,_0x35ccfc){var _0x1eff53={};_0x202c4f[_0x5ee5('0xc')]=intUtil[_0x5ee5('0x47')](_0x202c4f[_0x5ee5('0xc')]);_0x202c4f[_0x5ee5('0x48')]=intUtil['stripTrailingSlash'](_0x202c4f[_0x5ee5('0x48')]);_0x1eff53[_0x5ee5('0x40')]=_0x35ccfc===_0x5ee5('0x41')||_0x35ccfc==='unmanaged'?_0x5ee5('0x41'):_0x5ee5('0x1f');var _0x29b9bc=util['format'](_0x5ee5('0x49'),_0x202c4f[_0x5ee5('0xc')]);var _0x2a4b3a=util[_0x5ee5('0x45')](_0x5ee5('0x4a'),_0x202c4f['tenantId']);var _0x5eabcd=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x202c4f[_0x5ee5('0x48')],_0x2b5df4[_0x5ee5('0x4b')],md5(_0x2b5df4['uniqueid']));if(_0x3e77c5&&_0x3e77c5[_0x5ee5('0x4c')]){logger[_0x5ee5('0x1c')](_0x5ee5('0x4d'),_0x5ee5('0x4e'));_0x2b5df4[_0x5ee5('0x4f')]=_0x5eabcd;}else if(_0x4b74b8&&_0x4b74b8[_0x5ee5('0x50')]&&_0x4b74b8[_0x5ee5('0x50')]!==_0x5ee5('0x51')){logger[_0x5ee5('0x1c')](_0x5ee5('0x52'),_0x5ee5('0x4e'));_0x2b5df4[_0x5ee5('0x4f')]=_0x5eabcd;}else{_0x2b5df4['recordingURL']='';}return getUser(_0x1eff53,_0x202c4f,_0x50ddf6,_0x2a4b3a,_0x29b9bc,_0x35ccfc)[_0x5ee5('0x14')](function(_0x26746f){logger[_0x5ee5('0x1c')]('['+_0x35ccfc[_0x5ee5('0x11')]()+']\x20The\x20User\x20ID\x20is:',_0x26746f[_0x5ee5('0x24')]);logger['info']('['+_0x35ccfc[_0x5ee5('0x11')]()+_0x5ee5('0x53'),_0x26746f[_0x5ee5('0x19')]);return getEndUser(_0x26746f,_0x202c4f,_0x2a4b3a,_0x29b9bc,_0x2b5df4,_0x35ccfc);})[_0x5ee5('0x14')](function(_0x357179){logger[_0x5ee5('0x1c')]('['+_0x35ccfc[_0x5ee5('0x11')]()+_0x5ee5('0x54'),_0x357179[_0x5ee5('0x27')]);logger[_0x5ee5('0x1c')]('['+_0x35ccfc['toUpperCase']()+_0x5ee5('0x55'),_0x2b5df4[_0x5ee5('0x20')]);return getTicket(_0x357179,_0x202c4f,_0x2a4b3a,_0x29b9bc,_0x2b5df4,_0x38d842,_0x35ccfc);})[_0x5ee5('0x14')](function(_0x31b09e){logger[_0x5ee5('0x1c')](util[_0x5ee5('0x45')]('['+_0x35ccfc[_0x5ee5('0x11')]()+_0x5ee5('0x56'),_0x38d842['ticketType'],_0x31b09e[_0x5ee5('0x44')]));logger[_0x5ee5('0x1c')](util['format']('['+_0x35ccfc[_0x5ee5('0x11')]()+_0x5ee5('0x57'),_0x35ccfc));if(_0x35ccfc!==_0x5ee5('0x58')){logger['info']('['+_0x35ccfc['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x202c4f[_0x5ee5('0xc')],_0x50ddf6[_0x5ee5('0x59')],_0x38d842[_0x5ee5('0x36')],_0x31b09e[_0x5ee5('0x44')]);}})[_0x5ee5('0xf')](function(_0x459e59){logger[_0x5ee5('0x10')]('['+_0x35ccfc[_0x5ee5('0x11')]()+_0x5ee5('0x5a'),util[_0x5ee5('0x5b')](_0x459e59,{'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 32d24ef..e469f7b 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 _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 +var _0x097c=['push','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','trigger:browser:url','catch','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','user:%s','lastevent','toUpperCase','recordingURL','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','validateEmail','then','length','Agent\x20found!','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','apiKey','toString','base64','[HTTP]','stringify','GET','map','forEach','type','string','nameField','customField','content','idField'];(function(_0x54ee2b,_0x4f882a){var _0x2dff26=function(_0x3302fe){while(--_0x3302fe){_0x54ee2b['push'](_0x54ee2b['shift']());}};_0x2dff26(++_0x4f882a);}(_0x097c,0xdb));var _0xc097=function(_0x2b26fb,_0x34a3d8){_0x2b26fb=_0x2b26fb-0x0;var _0x4d6628=_0x097c[_0x2b26fb];return _0x4d6628;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xc097('0x0'));var util=require(_0xc097('0x1'));var Redis=require(_0xc097('0x2'));var intUtil=require('./util');var config=require(_0xc097('0x3'));var logger=require(_0xc097('0x4'))(_0xc097('0x5'));config[_0xc097('0x6')]=_['defaults'](config[_0xc097('0x6')],{'host':_0xc097('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0xc097('0x8'),'Accept':'application/json'};function emit(_0x10fd2c,_0x124583,_0x15dad9){io['to'](_0x10fd2c)[_0xc097('0x9')](_0x124583,_0x15dad9);}function getTicket(_0x379382,_0x1f1e10,_0x4e734d,_0x45c617,_0x3e2513){logger[_0xc097('0xa')](_0xc097('0xb'));var _0x581795=_[_0xc097('0xc')]({'responder_id':_0x1f1e10['id'],'requester_id':_0x4e734d['id'],'name':util['format'](_0xc097('0xd'),_0x3e2513[_0xc097('0xe')]),'phone':_0x3e2513['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xc097('0xf')](_0x45c617[_0xc097('0x10')],_0x3e2513,'\x20'),'description':intUtil[_0xc097('0xf')](_0x45c617[_0xc097('0x11')],_0x3e2513,_0xc097('0x12')),'tags':getTags(_0x45c617[_0xc097('0x13')],_0xc097('0x14'))},getCustomFields(_0x45c617[_0xc097('0x15')],_0x3e2513));_0x581795[_0xc097('0x16')]=_[_0xc097('0x17')](_[_0xc097('0x18')](_0x581795['custom_fields'],'id'),_0xc097('0x19'));return request({'uri':util[_0xc097('0x1a')](_0xc097('0x1b'),_0x379382[_0xc097('0x1c')]),'method':_0xc097('0x1d'),'body':_0x581795})['then'](function(_0x4bda2d){logger[_0xc097('0xa')](_0xc097('0x1e'));return _0x4bda2d;});}function getUser(_0x497b93,_0x55270e){if(intUtil[_0xc097('0x1f')](_0x55270e)){return request({'uri':util[_0xc097('0x1a')]('%s/api/v2/agents',_0x497b93[_0xc097('0x1c')]),'qs':{'email':_0x55270e}})[_0xc097('0x20')](function(_0x4b4485){if(_0x4b4485[_0xc097('0x21')]){logger['info'](_0xc097('0x22'));return _['find'](_0x4b4485,function(_0x384946){return _0x384946[_0xc097('0x23')]['email']===_0x55270e;});}else{logger[_0xc097('0xa')](_0xc097('0x24'));return request({'uri':util[_0xc097('0x1a')](_0xc097('0x25'),_0x497b93[_0xc097('0x1c')])})[_0xc097('0x20')](function(_0x5da8ed){logger[_0xc097('0xa')](_0xc097('0x26'));return _0x5da8ed;});}});}else{logger[_0xc097('0xa')](_0xc097('0x27'));return request({'uri':util['format'](_0xc097('0x25'),_0x497b93['remoteUri'])})['then'](function(_0x24de80){logger[_0xc097('0xa')](_0xc097('0x26'));return _0x24de80;});}}function getEndUser(_0x3618d7,_0x10057b,_0x39b837){logger['info'](_0xc097('0x28'),_0x39b837);return request({'uri':util[_0xc097('0x1a')]('%s/api/v2/contacts',_0x3618d7[_0xc097('0x1c')]),'qs':{'phone':_0x39b837}})['then'](function(_0x4af70d){if(_0x4af70d['length']){logger[_0xc097('0xa')](_0xc097('0x29'));return _[_0xc097('0x2a')](_0x4af70d,{'phone':_0x39b837});}else{logger[_0xc097('0xa')](_0xc097('0x2b'));return request({'uri':util['format'](_0xc097('0x2c'),_0x3618d7[_0xc097('0x1c')]),'method':'POST','body':{'name':_0x10057b,'phone':_0x39b837}})[_0xc097('0x20')](function(_0x4c90e1){logger[_0xc097('0xa')](_0xc097('0x2d'));return _0x4c90e1;});}});}function getAuth(_0x5011f5){return util[_0xc097('0x1a')]('Basic\x20%s',new Buffer(_0x5011f5[_0xc097('0x2e')]+':X')[_0xc097('0x2f')](_0xc097('0x30')));}function request(_0x674f37){logger['debug'](_0xc097('0x31'),JSON[_0xc097('0x32')](_0x674f37));return rp(_['defaults'](_0x674f37,{'method':_0xc097('0x33'),'headers':headers,'json':!![]}));}function getTags(_0xe3272c,_0x2de90e){var _0xca009c=[];if(_0xe3272c&&_0xe3272c[_0xc097('0x21')]>0x0){_0xca009c=_[_0xc097('0x34')](_0xe3272c,_0x2de90e);}return _0xca009c;}function getCustomFields(_0x40add1,_0x57bf99){var _0x1933c6=[];var _0x187e83={'custom_fields':[]};if(_0x40add1[_0xc097('0x21')]>0x0){_[_0xc097('0x35')](_0x40add1,function(_0x424fa4){if(_0x424fa4[_0xc097('0x36')]===_0xc097('0x37')&&_0x424fa4[_0xc097('0x38')]&&!_0x424fa4[_0xc097('0x39')]){_0x187e83[_0x424fa4[_0xc097('0x38')]['toLowerCase']()]=_0x424fa4[_0xc097('0x3a')][_0xc097('0x2f')]();}else if(_0x424fa4['type']===_0xc097('0x37')&&_0x424fa4[_0xc097('0x3b')]&&_0x424fa4[_0xc097('0x39')]){_0x187e83[_0xc097('0x16')][_0xc097('0x3c')]({'id':_0x424fa4[_0xc097('0x3b')],'value':_0x424fa4[_0xc097('0x3a')][_0xc097('0x2f')]()});}else if(_0x424fa4[_0xc097('0x36')]===_0xc097('0x3d')&&_0x424fa4[_0xc097('0x3e')]&&_0x424fa4[_0xc097('0x3b')]&&_0x424fa4[_0xc097('0x39')]){_0x57bf99[_0x424fa4[_0xc097('0x3e')]]&&_0x187e83['custom_fields'][_0xc097('0x3c')]({'id':_0x424fa4[_0xc097('0x3b')],'value':_0x57bf99[_0x424fa4[_0xc097('0x3e')]][_0xc097('0x2f')]()});}else if(_0x424fa4['type']===_0xc097('0x3f')&&_0x424fa4[_0xc097('0x40')]&&_0x424fa4['Variable'][_0xc097('0x14')]&&_0x424fa4[_0xc097('0x3b')]&&_0x424fa4[_0xc097('0x39')]){_0x57bf99[_0x424fa4[_0xc097('0x40')][_0xc097('0x14')][_0xc097('0x41')]()]&&_0x187e83[_0xc097('0x16')]['push']({'id':_0x424fa4['idField'],'value':_0x57bf99[_0x424fa4[_0xc097('0x40')][_0xc097('0x14')][_0xc097('0x41')]()]['toString']()});}});}return _0x187e83;}exports[_0xc097('0x42')]=function(_0x6a5117,_0xc7181a,_0x26c08b,_0x1fbdf6,_0xf8e632,_0x36ff3e){var _0x4ac98d,_0x58169e;_0x36ff3e[_0xc097('0x1c')]=intUtil[_0xc097('0x43')](_0x36ff3e[_0xc097('0x1c')]);_0x36ff3e[_0xc097('0x44')]=intUtil['stripTrailingSlash'](_0x36ff3e[_0xc097('0x44')]);if(_0xf8e632&&_0xf8e632[_0xc097('0x45')]){logger[_0xc097('0xa')]('[QUEUE]',_0xc097('0x46'));_0xc7181a['recordingURL']=util['format'](_0xc097('0x47'),_0x36ff3e[_0xc097('0x44')],_0xc7181a[_0xc097('0x48')],md5(_0xc7181a[_0xc097('0x48')]));}else{_0xc7181a['recordingURL']='';}headers[_0xc097('0x49')]=getAuth(_0x36ff3e);return getUser(_0x36ff3e,_0x1fbdf6[_0xc097('0x4a')])[_0xc097('0x20')](function(_0xe0ce89){_0x4ac98d=_0xe0ce89;logger['info'](_0xc097('0x4b'),_0x4ac98d['id']);return getEndUser(_0x36ff3e,_0xc7181a['calleridname'],_0xc7181a[_0xc097('0x4c')]);})[_0xc097('0x20')](function(_0x3c165b){_0x58169e=_0x3c165b;logger['info'](_0xc097('0x4d'),_0x58169e['id']);return getTicket(_0x36ff3e,_0x4ac98d,_0x58169e,_0x26c08b,_0xc7181a);})['then'](function(_0x44f0ff){if(_0x44f0ff&&_0x44f0ff['id']){logger[_0xc097('0xa')](_0xc097('0x1e'));logger[_0xc097('0xa')](_0xc097('0x4e'),_0x44f0ff['id']);logger['info'](_0xc097('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc097('0x1a')]('user:%s',_0x1fbdf6[_0xc097('0x14')]),_0xc097('0x50'),{'uri':util[_0xc097('0x1a')]('%s/helpdesk/tickets/%d',_0x36ff3e[_0xc097('0x1c')],_0x44f0ff['id'])});}})[_0xc097('0x51')](function(_0x58e32b){logger[_0xc097('0x52')]('[QUEUE]',JSON[_0xc097('0x32')](_0x58e32b));});};exports[_0xc097('0x53')]=function(_0x183da8,_0x6871ce,_0x475e83,_0xc0d01f,_0x3347a1,_0x36f2e3,_0x4c7050){var _0x3ca1c6,_0x42d365;_0x36f2e3[_0xc097('0x1c')]=intUtil[_0xc097('0x43')](_0x36f2e3['remoteUri']);_0x36f2e3[_0xc097('0x44')]=intUtil[_0xc097('0x43')](_0x36f2e3[_0xc097('0x44')]);if(_0x4c7050&&_0x4c7050[_0xc097('0x54')]&&_0x4c7050['recordingFormat']!==_0xc097('0x55')){logger['info']('[OUTBOUND]',_0xc097('0x46'));_0x6871ce['recordingURL']=util[_0xc097('0x1a')](_0xc097('0x47'),_0x36f2e3['serverUrl'],_0x6871ce[_0xc097('0x48')],md5(_0x6871ce['uniqueid']));}headers[_0xc097('0x49')]=getAuth(_0x36f2e3);return getUser(_0x36f2e3,_0xc0d01f[_0xc097('0x4a')])[_0xc097('0x20')](function(_0x42dbb1){_0x3ca1c6=_0x42dbb1;logger[_0xc097('0xa')](_0xc097('0x4b'),_0x3ca1c6['id']);return getEndUser(_0x36f2e3,_0x6871ce[_0xc097('0x56')],_0x6871ce[_0xc097('0x57')]);})[_0xc097('0x20')](function(_0x208543){_0x42d365=_0x208543;logger[_0xc097('0xa')](_0xc097('0x4d'),_0x42d365['id']);return getTicket(_0x36f2e3,_0x3ca1c6,_0x42d365,_0x475e83,_0x6871ce);})[_0xc097('0x20')](function(_0x90d475){if(_0x90d475&&_0x90d475['id']){logger[_0xc097('0xa')](_0xc097('0x1e'));logger['info'](_0xc097('0x4e'),_0x90d475['id']);logger[_0xc097('0xa')](_0xc097('0x58'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc097('0x1a')](_0xc097('0x59'),_0xc0d01f[_0xc097('0x14')]),'trigger:browser:url',{'uri':util[_0xc097('0x1a')]('%s/helpdesk/tickets/%d',_0x36f2e3[_0xc097('0x1c')],_0x90d475['id'])});}})[_0xc097('0x51')](function(_0x331ed1){logger['error']('[OUTBOUND]',JSON[_0xc097('0x32')](_0x331ed1));});};exports['unmanaged']=function(_0x2d0b3c,_0x39e931,_0x33fc40,_0x54760a,_0x383cc1,_0x3d2172){var _0x5b4089,_0x4c7ffa;_0x3d2172[_0xc097('0x1c')]=intUtil[_0xc097('0x43')](_0x3d2172[_0xc097('0x1c')]);_0x3d2172[_0xc097('0x44')]=intUtil[_0xc097('0x43')](_0x3d2172[_0xc097('0x44')]);if(_0x383cc1&&_0x383cc1[_0xc097('0x45')]){logger[_0xc097('0xa')]('['+_0x39e931[_0xc097('0x5a')][_0xc097('0x5b')]()+']',_0xc097('0x46'));_0x39e931[_0xc097('0x5c')]=util[_0xc097('0x1a')](_0xc097('0x47'),_0x3d2172['serverUrl'],_0x39e931['uniqueid'],md5(_0x39e931['uniqueid']));}else{_0x39e931['recordingURL']='';}headers['Authorization']=getAuth(_0x3d2172);return getUser(_0x3d2172,'')['then'](function(_0x21cd92){_0x5b4089=_0x21cd92;logger[_0xc097('0xa')]('The\x20User\x20ID\x20is:',_0x5b4089['id']);return getEndUser(_0x3d2172,_0x39e931[_0xc097('0xe')],_0x39e931['calleridnum']);})[_0xc097('0x20')](function(_0x41dedb){_0x4c7ffa=_0x41dedb;logger['info'](_0xc097('0x4d'),_0x4c7ffa['id']);return getTicket(_0x3d2172,_0x5b4089,_0x4c7ffa,_0x33fc40,_0x39e931);})[_0xc097('0x20')](function(_0x1d226c){if(_0x1d226c){logger[_0xc097('0xa')](_0xc097('0x1e'));logger['info'](_0xc097('0x4e'),_0x1d226c['id']);}})['catch'](function(_0xdc0034){logger[_0xc097('0x52')]('['+_0x39e931[_0xc097('0x5a')][_0xc097('0x5b')]()+']',JSON[_0xc097('0x32')](_0xdc0034));});}; \ 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 43469f1..53fb792 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 _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 +var _0x7c1f=['then','users','email','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','length','userId','User\x20found:','Admin\x20selected','userEmail','adminEmail','message','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','task','Task\x20created:','user:%s','emit','Token\x20token=','apiKey','remoteUri','serverUrl','username','toLowerCase','destcalleridnum','callDirection','unmanaged','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','ticketId','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','ioredis','./util','../../../../config/environment','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information'];(function(_0x31d209,_0x2698eb){var _0xebfcbf=function(_0x399f9a){while(--_0x399f9a){_0x31d209['push'](_0x31d209['shift']());}};_0xebfcbf(++_0x2698eb);}(_0x7c1f,0x194));var _0xf7c1=function(_0x5b75ae,_0x135e49){_0x5b75ae=_0x5b75ae-0x0;var _0x4b66a7=_0x7c1f[_0x5b75ae];return _0x4b66a7;};'use strict';var _=require(_0xf7c1('0x0'));var rp=require(_0xf7c1('0x1'));var md5=require(_0xf7c1('0x2'));var util=require(_0xf7c1('0x3'));var moment=require(_0xf7c1('0x4'));var Promise=require('bluebird');var Redis=require(_0xf7c1('0x5'));var intUtil=require(_0xf7c1('0x6'));var config=require(_0xf7c1('0x7'));var logger=require('../../../../config/logger')(_0xf7c1('0x8'));config[_0xf7c1('0x9')]=_[_0xf7c1('0xa')](config[_0xf7c1('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xf7c1('0xb'))(new Redis(config[_0xf7c1('0x9')]));function getAdminId(_0x329050,_0x418f9a,_0x30be4a,_0x346575){return new Promise(function(_0x4279ea,_0x211033){var _0x118dfb=![];var _0x1a4415={'method':_0xf7c1('0xc'),'uri':_0x346575+_0xf7c1('0xd'),'json':!![]};_0x1a4415['headers']=_0x30be4a;logger[_0xf7c1('0xe')](_0xf7c1('0xf'));return rp(_0x1a4415)[_0xf7c1('0x10')](function(_0xd4d9b6){if(_0xd4d9b6){var _0xab8f8c=_0xd4d9b6[_0xf7c1('0x11')];var _0x4ffd9a=null;for(_0x4ffd9a=0x0;_0x4ffd9a<_0xab8f8c['length'];_0x4ffd9a++){if(_0xab8f8c[_0x4ffd9a][_0xf7c1('0x12')]===_0x329050['adminEmail']){_0x329050[_0xf7c1('0x13')]=_0xab8f8c[_0x4ffd9a]['id'];_0x118dfb=!![];}}if(_0x118dfb){logger[_0xf7c1('0xe')]('Admin\x20found:',_0x329050[_0xf7c1('0x13')]);_0x4279ea(_0x329050);}else{_0x211033({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x211033({'statusCode':0x194,'message':_0xf7c1('0x14')});}})[_0xf7c1('0x15')](function(_0x315424){logger[_0xf7c1('0x16')]('['+[_0x418f9a[_0xf7c1('0x17')]()]+']',_0x315424['message']);_0x211033(_0x315424);});});}function getUser(_0xcef462,_0x5b5786,_0x298d23){return function(_0x4f0a0a){return new Promise(function(_0x115010,_0x20e3f8){var _0x153861={'method':_0xf7c1('0xc'),'uri':_0x298d23+_0xf7c1('0xd'),'json':!![]};_0x153861[_0xf7c1('0x18')]=_0x5b5786;logger[_0xf7c1('0xe')](_0xf7c1('0x19'));return rp(_0x153861)['then'](function(_0x59f0d2){if(_0x59f0d2){var _0x151b11=_0x59f0d2[_0xf7c1('0x11')];var _0x4ee91e=![];var _0x16d8a1=null;if(_0x4f0a0a[_0xf7c1('0x1a')]!==null){logger['info'](_0xf7c1('0x1b'),_0x4f0a0a['agentEmail']);_0x4f0a0a['userEmail']=_0x4f0a0a['agentEmail'];for(_0x16d8a1=0x0;_0x16d8a1<_0x151b11[_0xf7c1('0x1c')];_0x16d8a1++){if(_0x151b11[_0x16d8a1][_0xf7c1('0x12')]===_0x4f0a0a['agentEmail']){_0x4ee91e=!![];_0x4f0a0a[_0xf7c1('0x1d')]=_0x151b11[_0x16d8a1]['id'];logger[_0xf7c1('0xe')](_0xf7c1('0x1e'),_0x4f0a0a[_0xf7c1('0x1d')]);}}}if(!_0x4ee91e){logger[_0xf7c1('0xe')](_0xf7c1('0x1f'));_0x4f0a0a[_0xf7c1('0x20')]=_0x4f0a0a[_0xf7c1('0x21')];_0x4f0a0a['userId']=_0x4f0a0a['adminId'];_0x4ee91e=!![];}if(_0x4ee91e){_0x115010(_0x4f0a0a);}else{_0x20e3f8({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x20e3f8({'statusCode':0x194,'message':_0xf7c1('0x14')});}})[_0xf7c1('0x15')](function(_0x14ecef){logger[_0xf7c1('0x16')]('['+[_0xcef462[_0xf7c1('0x17')]()]+']',_0x14ecef[_0xf7c1('0x22')]);_0x20e3f8(_0x14ecef);});});};}function searchContact(_0x3d83b0,_0x19af4d,_0x457212,_0x549c29){return new Promise(function(_0x6d74a1,_0x37c472){var _0x4f68c6={'method':_0xf7c1('0xc'),'headers':_0x19af4d,'uri':_0x3d83b0+_0xf7c1('0x23')+_0x549c29+_0xf7c1('0x24')+_0x457212+_0xf7c1('0x25'),'json':!![]};rp(_0x4f68c6)[_0xf7c1('0x10')](function(_0x4acfc4){var _0x1b353e=_['find'](_0x4acfc4[_0xf7c1('0x26')][_0xf7c1('0x26')],[_0x457212,_0x549c29]);_0x6d74a1(_0x1b353e);})[_0xf7c1('0x15')](function(_0x5236cb){_0x37c472(_0x5236cb);});});}function getEndUser(_0x2bd6cb,_0x22ca7a,_0x59c534){return function(_0x48e179){return new Promise(function(_0x44079a,_0x45fc44){logger[_0xf7c1('0xe')](util[_0xf7c1('0x27')](_0xf7c1('0x28'),_0x48e179['contactNumber']));searchContact(_0x59c534,_0x22ca7a,_0xf7c1('0x29'),_0x48e179[_0xf7c1('0x2a')])[_0xf7c1('0x10')](function(_0x285926){if(_0x285926){_0x48e179[_0xf7c1('0x2b')]=_0x285926['id'];logger['info']('Contact\x20found\x20mobile_number:',_0x48e179[_0xf7c1('0x2b')]);return _0x44079a(_0x48e179);}searchContact(_0x59c534,_0x22ca7a,_0xf7c1('0x2c'),_0x48e179[_0xf7c1('0x2a')])[_0xf7c1('0x10')](function(_0x3f7b56){if(_0x3f7b56){_0x48e179['endUserId']=_0x3f7b56['id'];logger['info'](_0xf7c1('0x2d'),_0x48e179[_0xf7c1('0x2b')]);return _0x44079a(_0x48e179);}createEndUser(_0x48e179,_0x2bd6cb,_0x22ca7a,_0x59c534)[_0xf7c1('0x10')](function(_0x20e94e){logger['info'](_0xf7c1('0x2e'),_0x20e94e['endUserId']);return _0x44079a(_0x20e94e);});});})[_0xf7c1('0x15')](function(_0x368e33){_0x45fc44(_0x368e33);});});};}function createEndUser(_0x1f2141,_0x1341ae,_0xcfc71e,_0x137bd7){return new Promise(function(_0x1d9472,_0x5497e4){var _0x530f2b=moment();var _0x21bed5={'method':'POST','uri':_0x137bd7+_0xf7c1('0x2f'),'body':{'contact':{'last_name':_0x1f2141[_0xf7c1('0x2a')],'work_number':_0x1f2141['contactNumber'],'mobile_number':_0x1f2141[_0xf7c1('0x2a')],'owner_id':_0x1f2141['userId'],'created_at':_0x530f2b['format'](_0xf7c1('0x30'))}},'json':!![]};_0x21bed5[_0xf7c1('0x18')]=_0xcfc71e;logger[_0xf7c1('0xe')](_0xf7c1('0x31'));return rp(_0x21bed5)['then'](function(_0x4e12e4){_0x1f2141[_0xf7c1('0x2b')]=_0x4e12e4[_0xf7c1('0x32')]['id'];_0x1d9472(_0x1f2141);})[_0xf7c1('0x15')](function(_0x3903f7){logger[_0xf7c1('0x16')]('['+[_0x1341ae[_0xf7c1('0x17')]()]+']',_0x3903f7['message']);_0x5497e4(_0x3903f7[_0xf7c1('0x22')]);});});}function getTicket(_0x1a876c,_0x538c90,_0x54eb13,_0x3d204f,_0x89897){return function(_0xa059be){logger[_0xf7c1('0xe')](_0xf7c1('0x33'));return new Promise(function(_0x5f011e,_0x50597a){var _0x4f40ed=moment();var _0x3f2204={'method':'POST','uri':_0x54eb13+_0xf7c1('0x34'),'body':{'title':intUtil[_0xf7c1('0x35')](_0x3d204f[_0xf7c1('0x36')],_0x89897,'\x20'),'description':intUtil[_0xf7c1('0x35')](_0x3d204f[_0xf7c1('0x37')],_0x89897,'\x0a'),'owner_id':_0xa059be['userId'],'creater_id':_0xa059be[_0xf7c1('0x13')],'targetable_id':_0xa059be['endUserId'],'targetable_type':'Contact','created_at':_0x4f40ed[_0xf7c1('0x27')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x4f40ed['add'](0x1e,'m')[_0xf7c1('0x27')](_0xf7c1('0x30'))},'json':!![]};_0x3f2204[_0xf7c1('0x18')]=_0x538c90;return rp(_0x3f2204)[_0xf7c1('0x10')](function(_0x35b7a4){_0xa059be['ticketId']=_0x35b7a4[_0xf7c1('0x38')]['id'];logger[_0xf7c1('0xe')](_0xf7c1('0x39'),_0xa059be['ticketId']);_0x5f011e(_0xa059be);})[_0xf7c1('0x15')](function(_0x241f37){logger[_0xf7c1('0x16')]('['+[_0x1a876c[_0xf7c1('0x17')]()]+']',_0x241f37[_0xf7c1('0x22')]);_0x50597a(_0x241f37['message']);});});};}function emit(_0x1d8dcf,_0x59082b,_0x3198e3){var _0x42b46f={'uri':_0x1d8dcf+'/contacts/'+_0x3198e3};io['to'](util[_0xf7c1('0x27')](_0xf7c1('0x3a'),_0x59082b))[_0xf7c1('0x3b')]('trigger:browser:url',_0x42b46f);}exports['cs']=function(_0x2c107a,_0x6c77d6,_0xce9bb,_0x5473df,_0x2a9d28,_0x99e4cf,_0x3d2ec5,_0x5eb40a){var _0xd08daa={};var _0x4e7bfc={'Authorization':_0xf7c1('0x3c')+_0x99e4cf[_0xf7c1('0x3d')]};_0x99e4cf['remoteUri']=intUtil['stripTrailingSlash'](_0x99e4cf[_0xf7c1('0x3e')]);_0x99e4cf['serverUrl']=intUtil['stripTrailingSlash'](_0x99e4cf[_0xf7c1('0x3f')]);var _0x4ae101=_0x99e4cf[_0xf7c1('0x3e')];_0xd08daa[_0xf7c1('0x21')]=_0x99e4cf[_0xf7c1('0x40')];_0xd08daa[_0xf7c1('0x2a')]=_0x5eb40a[_0xf7c1('0x41')]()==='outbound'?_0x6c77d6[_0xf7c1('0x42')]:_0x6c77d6['calleridnum'];_0xd08daa[_0xf7c1('0x43')]=_0x5eb40a==='queue'||_0x5eb40a===_0xf7c1('0x44')?_0xf7c1('0x45'):_0xf7c1('0x46');if(_0x5473df){_0xd08daa[_0xf7c1('0x1a')]=_0x5473df[_0xf7c1('0x12')];}var _0x4ca2da=util['format'](_0xf7c1('0x47'),_0x99e4cf[_0xf7c1('0x3f')],_0x6c77d6[_0xf7c1('0x48')],md5(_0x6c77d6[_0xf7c1('0x48')]));if(_0x2a9d28&&_0x2a9d28[_0xf7c1('0x49')]){logger[_0xf7c1('0xe')](_0xf7c1('0x4a'),_0xf7c1('0x4b'));_0x6c77d6[_0xf7c1('0x4c')]=_0x4ca2da;}else if(_0x3d2ec5&&_0x3d2ec5[_0xf7c1('0x4d')]&&_0x3d2ec5[_0xf7c1('0x4d')]!==_0xf7c1('0x4e')){logger[_0xf7c1('0xe')]('[OUTBOUND]',_0xf7c1('0x4b'));_0x6c77d6[_0xf7c1('0x4c')]=_0x4ca2da;}else{_0x6c77d6[_0xf7c1('0x4c')]='';}return getAdminId(_0xd08daa,_0x5eb40a,_0x4e7bfc,_0x4ae101)[_0xf7c1('0x10')](getUser(_0x5eb40a,_0x4e7bfc,_0x4ae101))[_0xf7c1('0x10')](getEndUser(_0x5eb40a,_0x4e7bfc,_0x4ae101))['then'](getTicket(_0x5eb40a,_0x4e7bfc,_0x4ae101,_0xce9bb,_0x6c77d6))[_0xf7c1('0x10')](function(_0x5920f3){logger[_0xf7c1('0xe')](util[_0xf7c1('0x27')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5920f3[_0xf7c1('0x4f')]));if(_0x5eb40a!==_0xf7c1('0x44')){logger[_0xf7c1('0xe')]('['+[_0x5eb40a[_0xf7c1('0x17')]()]+']',_0xf7c1('0x50'));emit(_0x4ae101,_0x5473df[_0xf7c1('0x51')],_0x5920f3[_0xf7c1('0x2b')]);}})[_0xf7c1('0x15')](function(_0x3ab98a){logger[_0xf7c1('0x16')]('['+[_0x5eb40a[_0xf7c1('0x17')]()]+_0xf7c1('0x52'),util[_0xf7c1('0x53')](_0x3ab98a,{'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 20143d5..598fce0 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 _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 +var _0x5f66=['dynamics365','freshsales','toLowerCase','data1','data2','find','Configurations','data3','queue','outbound','unmanaged','salesforce','sugarcrm','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./freshsales','zendesk','freshdesk','zoho','desk','vtiger'];(function(_0x306069,_0x1806d2){var _0x26a6b7=function(_0x2062df){while(--_0x2062df){_0x306069['push'](_0x306069['shift']());}};_0x26a6b7(++_0x1806d2);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var zendesk=require('./zendesk');var salesforce=require(_0x65f6('0x1'));var sugarcrm=require(_0x65f6('0x2'));var freshdesk=require(_0x65f6('0x3'));var zoho=require(_0x65f6('0x4'));var desk=require(_0x65f6('0x5'));var vtiger=require('./vtiger');var servicenow=require(_0x65f6('0x6'));var dynamics365=require('./dynamics365');var freshsales=require(_0x65f6('0x7'));var integrations=[_0x65f6('0x8'),'salesforce','sugarcrm',_0x65f6('0x9'),_0x65f6('0xa'),_0x65f6('0xb'),_0x65f6('0xc'),_0x65f6('0xd'),_0x65f6('0xe'),'servicenow'];exports['exec']=function(_0x18fea1,_0x2f6d5b,_0x264647,_0x25c416,_0x50d26d,_0x41a7fd){if(_0x264647){if(_['includes'](integrations,_0x18fea1['data1'][_0x65f6('0xf')]())){try{var _0x576875=null;var _0x419819='';var _0x4862a5=_0x264647[_0x18fea1[_0x65f6('0x10')][_0x65f6('0xf')]()];if(_0x4862a5){var _0x2c4ee5=_0x4862a5[_0x18fea1[_0x65f6('0x11')]];if(_0x2c4ee5){var _0x369f96=_[_0x65f6('0x12')](_0x2c4ee5[_0x65f6('0x13')],{'id':parseInt(_0x18fea1[_0x65f6('0x14')],0xa)});if(_0x369f96){if(_0x25c416){if(_0x50d26d&&_0x2f6d5b[_0x65f6('0x15')]){_0x419819=_0x65f6('0x15');}else if(_0x2f6d5b['routeId']){_0x419819=_0x65f6('0x16');}else{console['log']('EVENT\x20UNKNOWN',_0x2f6d5b);}}else{_0x419819=_0x65f6('0x17');}switch(_0x18fea1[_0x65f6('0x10')][_0x65f6('0xf')]()){case _0x65f6('0x8'):zendesk[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0x18'):salesforce[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0x19'):sugarcrm[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0x9'):freshdesk[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0xa'):zoho[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case'desk':desk[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case'vtiger':vtiger[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0xe'):freshsales['cs'](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd,_0x419819);break;case'servicenow':servicenow['cs'](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd,_0x419819);break;case'dynamics365':dynamics365['cs'](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd,_0x419819);break;default:console['log'](_0x65f6('0x1a'));}}else{_0x576875=require(_0x65f6('0x1b'))(_0x18fea1['data1'][_0x65f6('0xf')]());_0x576875[_0x65f6('0x1c')](_0x65f6('0x1d'),util[_0x65f6('0x1e')](_0x65f6('0x1f'),_0x18fea1[_0x65f6('0x10')]['toLowerCase'](),_0x18fea1[_0x65f6('0x14')]));}}else{_0x576875=require('../../../../config/logger')(_0x18fea1['data1'][_0x65f6('0xf')]());_0x576875[_0x65f6('0x1c')]('[EXEC]',util[_0x65f6('0x1e')](_0x65f6('0x20'),_0x18fea1[_0x65f6('0x10')][_0x65f6('0xf')](),_0x18fea1['data2']));}}else{}}catch(_0x9d7bb0){console[_0x65f6('0x1c')](_0x9d7bb0);}}}}; \ 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 b3e66b4..63721ca 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 _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 +var _0x7c4e=['[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','stringify','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','ticketType','Task','assign','Subjects','getString','Descriptions','WhoId','Case','ContactId','sobject','create','isNil','User','length','find','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','then','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','Contact','Lead','execute','lead','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','No\x20Company','upperFirst','forEach','type','string','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','recordingURL','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created'];(function(_0x1cb278,_0x337e36){var _0x2a414e=function(_0x1eef59){while(--_0x1eef59){_0x1cb278['push'](_0x1cb278['shift']());}};_0x2a414e(++_0x337e36);}(_0x7c4e,0x104));var _0xe7c4=function(_0x4e1ef7,_0x349fa5){_0x4e1ef7=_0x4e1ef7-0x0;var _0x20f191=_0x7c4e[_0x4e1ef7];return _0x20f191;};'use strict';var _=require(_0xe7c4('0x0'));var rp=require(_0xe7c4('0x1'));var moment=require(_0xe7c4('0x2'));var BPromise=require(_0xe7c4('0x3'));var md5=require(_0xe7c4('0x4'));var jsforce=require(_0xe7c4('0x5'));var util=require('util');var Redis=require(_0xe7c4('0x6'));var intUtil=require(_0xe7c4('0x7'));var config=require(_0xe7c4('0x8'));var logger=require(_0xe7c4('0x9'))(_0xe7c4('0xa'));config[_0xe7c4('0xb')]=_[_0xe7c4('0xc')](config[_0xe7c4('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xe7c4('0xd'))(new Redis(config[_0xe7c4('0xb')]));function emit(_0x4e8707,_0x5193a1,_0x1ac0c0){io['to'](_0x4e8707)[_0xe7c4('0xe')](_0x5193a1,_0x1ac0c0);}function getTicket(_0x3c20c6,_0x456c1b,_0x54984e,_0x2a4ee0,_0x5bacee,_0x1b73ea,_0x24f94f,_0x419d22){var _0x433d24={};if(_0x2a4ee0[_0xe7c4('0xf')]===_0xe7c4('0x10')){_0x433d24=Object[_0xe7c4('0x11')]({},{'OwnerId':_0x456c1b['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x2a4ee0[_0xe7c4('0x12')],_0x5bacee,'\x20'),'Description':intUtil[_0xe7c4('0x13')](_0x2a4ee0[_0xe7c4('0x14')],_0x5bacee,'\x0a')},getCustomFields(_0x1b73ea,_0x5bacee));if(_0x54984e){_0x433d24[_0xe7c4('0x15')]=_0x54984e['id'];}}else if(_0x2a4ee0[_0xe7c4('0xf')]===_0xe7c4('0x16')){_0x433d24=Object[_0xe7c4('0x11')]({},{'OwnerId':_0x456c1b['id'],'Subject':intUtil[_0xe7c4('0x13')](_0x2a4ee0[_0xe7c4('0x12')],_0x5bacee,'\x20'),'Description':intUtil[_0xe7c4('0x13')](_0x2a4ee0[_0xe7c4('0x14')],_0x5bacee,'\x0a')},getCustomFields(_0x1b73ea,_0x5bacee));if(_0x54984e){_0x433d24[_0xe7c4('0x17')]=_0x54984e['id'];}}return _0x24f94f[_0xe7c4('0x18')](_0x2a4ee0[_0xe7c4('0xf')])[_0xe7c4('0x19')](_0x433d24);}function getUser(_0x18037f,_0xd2a86f,_0x2b0dfb){if(!_[_0xe7c4('0x1a')](_0xd2a86f)&&intUtil['validateEmail'](_0xd2a86f)){var _0x6715b3={'Email':_0xd2a86f};var _0xbbbfe7={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2b0dfb['sobject'](_0xe7c4('0x1b'))['find'](_0x6715b3,_0xbbbfe7)['execute']()['then'](function(_0x18904a){if(_0x18904a[_0xe7c4('0x1c')]){var _0x32d242=_[_0xe7c4('0x1d')](_0x18904a,function(_0x1b494d){return _0x1b494d[_0xe7c4('0x1e')]===_0xd2a86f;});if(_0x32d242){logger[_0xe7c4('0x1f')](_0xe7c4('0x20'),_0xd2a86f);return BPromise[_0xe7c4('0x21')]({'id':_0x32d242['Id'],'name':_0x32d242[_0xe7c4('0x22')]});}}else{logger[_0xe7c4('0x1f')](_0xe7c4('0x23'),_0xd2a86f);return _0x2b0dfb['identity']()['then'](function(_0x422130){return BPromise['resolve']({'id':_0x422130[_0xe7c4('0x24')],'name':_0x422130[_0xe7c4('0x25')]});});}});}else{logger[_0xe7c4('0x1f')](_0xe7c4('0x23'),_0xd2a86f);return _0x2b0dfb[_0xe7c4('0x26')]()[_0xe7c4('0x27')](function(_0x4562da){return BPromise['resolve']({'id':_0x4562da[_0xe7c4('0x24')],'name':_0x4562da[_0xe7c4('0x25')]});});}}function getEndUser(_0x21be32,_0x4585c4,_0x9f6118,_0x5d354d,_0xf61bec){var _0x21cc70={'Phone':_0x5d354d};var _0x19d0f9={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xe7c4('0x21')]()[_0xe7c4('0x27')](function(){if(_0x4585c4[_0xe7c4('0xf')]===_0xe7c4('0x10')){logger[_0xe7c4('0x1f')](_0xe7c4('0x28'),_0x5d354d,_0x4585c4[_0xe7c4('0x29')]);switch(_0x4585c4[_0xe7c4('0x29')]){case'contact_lead':return _0xf61bec['sobject'](_0xe7c4('0x2a'))['find'](_0x21cc70,_0x19d0f9)['execute']()['then'](function(_0x558089){if(_0x558089&&_0x558089[_0xe7c4('0x1c')]){return _0x558089;}else{return _0xf61bec[_0xe7c4('0x18')](_0xe7c4('0x2b'))[_0xe7c4('0x1d')](_0x21cc70,_0x19d0f9);}});case'contact':return _0xf61bec['sobject'](_0xe7c4('0x2a'))['find'](_0x21cc70,_0x19d0f9)[_0xe7c4('0x2c')]();case _0xe7c4('0x2d'):return _0xf61bec[_0xe7c4('0x18')]('Lead')['find'](_0x21cc70,_0x19d0f9);default:return null;}}else if(_0x4585c4[_0xe7c4('0xf')]==='Case'){logger[_0xe7c4('0x1f')](_0xe7c4('0x28'),_0x5d354d,_0xe7c4('0x2e'));return _0xf61bec[_0xe7c4('0x18')](_0xe7c4('0x2a'))[_0xe7c4('0x1d')](_0x21cc70,_0x19d0f9)[_0xe7c4('0x2c')]();}})[_0xe7c4('0x27')](function(_0x43e358){if(_0x43e358&&_0x43e358[_0xe7c4('0x1c')]){var _0x4b3edc=_['find'](_0x43e358,function(_0x2eb1eb){return _0x2eb1eb[_0xe7c4('0x2f')]===_0x5d354d;});if(_0x4b3edc){return BPromise[_0xe7c4('0x21')]({'id':_0x4b3edc['Id'],'name':_0x4b3edc['Name'],'phone':_0x4b3edc['Phone']});}}})[_0xe7c4('0x27')](function(_0x3f9104){if(_0x3f9104){logger[_0xe7c4('0x1f')](_0xe7c4('0x30'),_0x5d354d);return BPromise[_0xe7c4('0x21')](_0x3f9104);}else{logger[_0xe7c4('0x1f')](_0xe7c4('0x31'),_0x5d354d);var _0x3017f5={'LastName':_0x9f6118!==''?_0x9f6118:util['format'](_0xe7c4('0x32'),_0x5d354d),'Phone':_0x5d354d};if(_0x4585c4[_0xe7c4('0x33')]){if(_0x4585c4[_0xe7c4('0x33')]===_0xe7c4('0x2e')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5d354d,_0x4585c4['moduleCreate']);}else if(_0x4585c4[_0xe7c4('0x33')]===_0xe7c4('0x2d')&&_0x4585c4['ticketType']===_0xe7c4('0x10')){logger[_0xe7c4('0x1f')](_0xe7c4('0x34'),_0x5d354d,_0x4585c4[_0xe7c4('0x33')]);_0x3017f5['Company']=_0xe7c4('0x35');}else{return null;}}return _0xf61bec[_0xe7c4('0x18')](_[_0xe7c4('0x36')](_0x4585c4[_0xe7c4('0x33')]))['create'](_0x3017f5);}});}function getCustomFields(_0x3c4386,_0x24a347){var _0x3f0792={};if(_0x3c4386[_0xe7c4('0x1c')]>0x0){_[_0xe7c4('0x37')](_0x3c4386,function(_0x312bef){if(_0x312bef[_0xe7c4('0x38')]===_0xe7c4('0x39')&&_0x312bef[_0xe7c4('0x3a')]){_0x3f0792[_0x312bef[_0xe7c4('0x3a')]]=_0x312bef[_0xe7c4('0x3b')]['toString']();}else if(_0x312bef[_0xe7c4('0x38')]===_0xe7c4('0x3c')&&_0x312bef[_0xe7c4('0x3d')]&&_0x312bef[_0xe7c4('0x3a')]){_0x24a347[_0x312bef['variableName']]&&(_0x3f0792[_0x312bef[_0xe7c4('0x3a')]]=_0x24a347[_0x312bef[_0xe7c4('0x3d')]][_0xe7c4('0x3e')]());}else if(_0x312bef[_0xe7c4('0x38')]===_0xe7c4('0x3f')&&_0x312bef[_0xe7c4('0x40')]&&_0x312bef['Variable']['name']&&_0x312bef['idField']){_0x24a347[_0x312bef[_0xe7c4('0x40')][_0xe7c4('0x41')][_0xe7c4('0x42')]()]&&(_0x3f0792[_0x312bef['idField']]=_0x24a347[_0x312bef[_0xe7c4('0x40')]['name']['toLowerCase']()][_0xe7c4('0x3e')]());}});}return _0x3f0792;}function getConnection(_0x40e4c1){var _0x3c4400=_0x40e4c1[_0xe7c4('0x43')][_0xe7c4('0x44')](_0x40e4c1[_0xe7c4('0x45')]);var _0x4155ae=new jsforce[(_0xe7c4('0x46'))]({'oauth2':{'loginUrl':_0x40e4c1['remoteUri']||_0xe7c4('0x47'),'clientId':_0x40e4c1[_0xe7c4('0x48')],'clientSecret':_0x40e4c1[_0xe7c4('0x49')]}});return _0x4155ae[_0xe7c4('0x4a')](_0x40e4c1[_0xe7c4('0x4b')],_0x3c4400)[_0xe7c4('0x27')](function(){logger[_0xe7c4('0x1f')]('Connection\x20established.');return _0x4155ae;});}exports['queue']=function(_0x4c21ad,_0x376104,_0x4648dd,_0x3514a8,_0x5e9bfa,_0x5f05aa){var _0x4b850f,_0x491276,_0x4cb462,_0x1a48b1;_0x5f05aa[_0xe7c4('0x4c')]=intUtil[_0xe7c4('0x4d')](_0x5f05aa['serverUrl']);_0x5f05aa[_0xe7c4('0x4e')]=intUtil[_0xe7c4('0x4d')](_0x5f05aa[_0xe7c4('0x4e')]);if(_0x5e9bfa&&_0x5e9bfa[_0xe7c4('0x4f')]){logger[_0xe7c4('0x1f')](_0xe7c4('0x50'),'Recording\x20is\x20enabled!');_0x376104[_0xe7c4('0x51')]=util[_0xe7c4('0x52')](_0xe7c4('0x53'),_0x5f05aa['serverUrl'],_0x376104[_0xe7c4('0x54')],md5(_0x376104[_0xe7c4('0x54')]));}else{_0x376104[_0xe7c4('0x51')]='';}return getConnection(_0x5f05aa)['then'](function(_0x44f7fb){_0x1a48b1=_0x44f7fb;return getUser(_0x5f05aa,_0x3514a8[_0xe7c4('0x55')],_0x1a48b1);})['then'](function(_0x41dec0){_0x4b850f=_0x41dec0;return getEndUser(_0x5f05aa,_0x4648dd,_0x376104[_0xe7c4('0x56')],_0x376104[_0xe7c4('0x57')],_0x1a48b1);})[_0xe7c4('0x27')](function(_0x1fd1c3){_0x491276=_0x1fd1c3;return getTicket(_0x5f05aa,_0x4b850f,_0x491276,_0x4648dd,_0x376104,_0x4648dd[_0xe7c4('0x58')],_0x1a48b1,_0xe7c4('0x59'));})[_0xe7c4('0x27')](function(_0xdce79){_0x4cb462=_0xdce79;logger['info'](_0xe7c4('0x5a'),_0x4cb462['id']);logger['info'](_0xe7c4('0x5b'),_0x4cb462['id'],_0x3514a8[_0xe7c4('0x41')],_0x5f05aa[_0xe7c4('0x38')]);switch(_0x5f05aa[_0xe7c4('0x38')]){case'integrationTab':emit(util['format'](_0xe7c4('0x5c'),_0x3514a8[_0xe7c4('0x41')]),_0xe7c4('0x5d'),{'recordId':_0x4cb462['id']});break;case _0xe7c4('0x5e'):emit(util[_0xe7c4('0x52')]('user:%s',_0x3514a8['name']),_0xe7c4('0x5f'),{'uri':util['format'](_0xe7c4('0x60'),_0x1a48b1[_0xe7c4('0x61')],_0x4cb462['id'])});break;default:logger['error'](_0xe7c4('0x62'));}})[_0xe7c4('0x63')](function(_0x33e0c4){logger[_0xe7c4('0x64')]('[QUEUE]',JSON[_0xe7c4('0x65')](_0x33e0c4));});};exports[_0xe7c4('0x66')]=function(_0x595284,_0x422b4a,_0x550bad,_0x3ed4ba,_0x2c266e,_0x4b3425,_0x5131f0){var _0x3378bf,_0x4b3d42,_0x309a01,_0x28ca8b;_0x4b3425['serverUrl']=intUtil[_0xe7c4('0x4d')](_0x4b3425[_0xe7c4('0x4c')]);_0x4b3425['remoteUri']=intUtil[_0xe7c4('0x4d')](_0x4b3425['remoteUri']);if(_0x5131f0&&_0x5131f0[_0xe7c4('0x67')]&&_0x5131f0[_0xe7c4('0x67')]!=='none'){logger[_0xe7c4('0x1f')](_0xe7c4('0x68'),_0xe7c4('0x69'));_0x422b4a[_0xe7c4('0x51')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4b3425[_0xe7c4('0x4c')],_0x422b4a[_0xe7c4('0x54')],md5(_0x422b4a[_0xe7c4('0x54')]));}return getConnection(_0x4b3425)['then'](function(_0x2c3ceb){_0x28ca8b=_0x2c3ceb;return getUser(_0x4b3425,_0x3ed4ba[_0xe7c4('0x55')],_0x28ca8b);})['then'](function(_0x1765e4){_0x3378bf=_0x1765e4;return getEndUser(_0x4b3425,_0x550bad,_0x422b4a[_0xe7c4('0x6a')],_0x422b4a[_0xe7c4('0x6b')],_0x28ca8b);})[_0xe7c4('0x27')](function(_0x3274d9){_0x4b3d42=_0x3274d9;return getTicket(_0x4b3425,_0x3378bf,_0x4b3d42,_0x550bad,_0x422b4a,_0x550bad[_0xe7c4('0x58')],_0x28ca8b,_0xe7c4('0x66'));})[_0xe7c4('0x27')](function(_0x4f41b8){_0x309a01=_0x4f41b8;logger[_0xe7c4('0x1f')](_0xe7c4('0x6c'),_0x309a01['id']);logger[_0xe7c4('0x1f')](_0xe7c4('0x6d'),_0x309a01['id'],_0x3ed4ba[_0xe7c4('0x41')],_0x4b3425[_0xe7c4('0x38')]);switch(_0x4b3425['type']){case _0xe7c4('0x6e'):emit(util['format']('user:%s',_0x3ed4ba[_0xe7c4('0x41')]),'trigger:salesforce:display',{'recordId':_0x309a01['id']});break;case _0xe7c4('0x5e'):emit(util[_0xe7c4('0x52')]('user:%s',_0x3ed4ba[_0xe7c4('0x41')]),_0xe7c4('0x5f'),{'uri':util[_0xe7c4('0x52')]('%s/%s/e',_0x28ca8b[_0xe7c4('0x61')],_0x309a01['id'])});break;default:logger['error'](_0xe7c4('0x68'),_0xe7c4('0x6f'));}})[_0xe7c4('0x63')](function(_0x350fcd){logger[_0xe7c4('0x64')]('[OUTBOUND]',JSON['stringify'](_0x350fcd));});};exports[_0xe7c4('0x70')]=function(_0xece3a7,_0x362367,_0x30e529,_0x43edf4,_0x1d4034,_0x49d253){var _0x4859c1,_0x1bd97d,_0x441805,_0x3025cd;_0x49d253[_0xe7c4('0x4c')]=intUtil['stripTrailingSlash'](_0x49d253[_0xe7c4('0x4c')]);_0x49d253['remoteUri']=intUtil[_0xe7c4('0x4d')](_0x49d253[_0xe7c4('0x4e')]);if(_0x1d4034&&_0x1d4034[_0xe7c4('0x4f')]){logger['info']('['+_0x362367[_0xe7c4('0x71')][_0xe7c4('0x72')]()+']','Recording\x20is\x20enabled!');_0x362367['recordingURL']=util['format'](_0xe7c4('0x53'),_0x49d253[_0xe7c4('0x4c')],_0x362367['uniqueid'],md5(_0x362367[_0xe7c4('0x54')]));}else{_0x362367['recordingURL']='';}return getConnection(_0x49d253)[_0xe7c4('0x27')](function(_0x1e6ca8){_0x3025cd=_0x1e6ca8;if(!_[_0xe7c4('0x1a')](_0x43edf4)){return getUser(_0x49d253,_0x43edf4['name'],_0x3025cd);}else{return getUser(_0x49d253,null,_0x3025cd);}})[_0xe7c4('0x27')](function(_0x1fdf10){_0x4859c1=_0x1fdf10;return getEndUser(_0x49d253,_0x30e529,_0x362367[_0xe7c4('0x56')],_0x362367['calleridnum'],_0x3025cd);})[_0xe7c4('0x27')](function(_0x59753d){_0x1bd97d=_0x59753d;return getTicket(_0x49d253,_0x4859c1,_0x1bd97d,_0x30e529,_0x362367,_0x30e529[_0xe7c4('0x58')],_0x3025cd);})['then'](function(_0x5eedc1){_0x441805=_0x5eedc1;logger['info']('['+_0x362367[_0xe7c4('0x71')]['toUpperCase']()+_0xe7c4('0x73'),_0x441805['id']);logger[_0xe7c4('0x1f')]('['+_0x362367[_0xe7c4('0x71')][_0xe7c4('0x72')]()+_0xe7c4('0x74'),_0x49d253[_0xe7c4('0x38')]);})[_0xe7c4('0x63')](function(_0xb87e66){logger[_0xe7c4('0x64')]('['+_0x362367[_0xe7c4('0x71')]['toUpperCase']()+']',JSON[_0xe7c4('0x65')](_0xb87e66));});}; \ 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 a96db09..5120897 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(_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 +var _0x814b=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','Variable','name','POST','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number','label','?sysparm_query=name%3D','ticketId','Incident\x20-\x20','forEach','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','unmanaged'];(function(_0x149115,_0x1c8b5e){var _0x2353af=function(_0x1fffbe){while(--_0x1fffbe){_0x149115['push'](_0x149115['shift']());}};_0x2353af(++_0x1c8b5e);}(_0x814b,0x1a2));var _0xb814=function(_0x22b39b,_0x2b7d63){_0x22b39b=_0x22b39b-0x0;var _0x280e1d=_0x814b[_0x22b39b];return _0x280e1d;};'use strict';var _=require(_0xb814('0x0'));var Promise=require(_0xb814('0x1'));var rp=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var md5=require(_0xb814('0x4'));var Redis=require(_0xb814('0x5'));var intUtil=require('./util');var config=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));config[_0xb814('0x9')]=_[_0xb814('0xa')](config[_0xb814('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xb814('0xb'))(new Redis(config[_0xb814('0x9')]));function getAdminUser(_0x5c8539,_0x271af9,_0x2913a6,_0x186d5a,_0x41166c,_0x1fea33){return new Promise(function(_0x21d4a5,_0x1086f8){var _0x19aad8={'method':_0xb814('0xc'),'uri':_0x186d5a+_0xb814('0xd')+'&'+_0x41166c+'&'+_0x1fea33,'auth':_0x271af9,'json':!![]};return rp(_0x19aad8)[_0xb814('0xe')](function(_0x4b5f14){if(_0x4b5f14[_0xb814('0xf')]['length']>0x0){_0x2913a6[_0xb814('0x10')]=_0x4b5f14[_0xb814('0xf')][0x0][_0xb814('0x11')];}logger[_0xb814('0x12')]('['+[_0x5c8539[_0xb814('0x13')]()]+_0xb814('0x14'),_0x2913a6);_0x21d4a5(_0x2913a6);})[_0xb814('0x15')](function(_0x41ed7b){logger[_0xb814('0x16')]('['+[_0x5c8539[_0xb814('0x13')]()]+']',_0x41ed7b[_0xb814('0x17')]);_0x1086f8(_0x41ed7b[_0xb814('0x17')]);});});}function getUser(_0x17f5bd,_0x39bfcf,_0x303aca,_0x3a71d6,_0x45e0d0){return function(_0x265a83){logger[_0xb814('0x12')]('['+[_0x17f5bd[_0xb814('0x13')]()]+_0xb814('0x18'),_0x265a83);return new Promise(function(_0x48c9df,_0x168a48){if(intUtil['validateEmail'](_0x265a83[_0xb814('0x19')])){var _0xfac75b={'method':'GET','uri':_0x303aca+'sys_user?sysparm_query=email%3D'+_0x265a83['userEmail']+'&'+_0x3a71d6+'&'+_0x45e0d0,'auth':_0x39bfcf,'json':!![]};logger[_0xb814('0x12')]('['+[_0x17f5bd['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0xfac75b);return rp(_0xfac75b)[_0xb814('0xe')](function(_0x24211d){logger[_0xb814('0x12')]('['+[_0x17f5bd['toUpperCase']()]+_0xb814('0x1a'),_0x24211d);if(_0x24211d['result'][_0xb814('0x1b')]>0x0&&String(_0x24211d[_0xb814('0xf')][0x0][_0xb814('0x1c')])===_0xb814('0x1d')){_0x265a83[_0xb814('0x1e')]=_0x24211d[_0xb814('0xf')][0x0][_0xb814('0x11')];}else{_0x265a83['userId']=_0x265a83[_0xb814('0x10')];_0x265a83['userEmail']=_0x265a83[_0xb814('0x1f')];}logger[_0xb814('0x12')]('['+[_0x17f5bd[_0xb814('0x13')]()]+_0xb814('0x20'),_0x265a83);_0x48c9df(_0x265a83);})[_0xb814('0x15')](function(_0xb9e57d){logger[_0xb814('0x16')]('['+[_0x17f5bd['toUpperCase']()]+']',_0xb9e57d[_0xb814('0x17')]);_0x168a48(_0xb9e57d[_0xb814('0x17')]);});}else{logger[_0xb814('0x12')]('['+[_0x17f5bd[_0xb814('0x13')]()]+_0xb814('0x21'));_0x265a83[_0xb814('0x1e')]=_0x265a83[_0xb814('0x10')];_0x265a83[_0xb814('0x19')]=_0x265a83['adminEmail'];_0x48c9df(_0x265a83);}});};}function createEndUser(_0x271aa8,_0x328a08,_0x52ed64,_0x9008b2,_0x37d24d){logger[_0xb814('0x12')]('['+[_0x271aa8['toUpperCase']()]+_0xb814('0x22'),_0x52ed64);return new Promise(function(_0x2051d0,_0x58c3ca){var _0x338a28={'method':'POST','uri':_0x9008b2+_0xb814('0x23')+_0x37d24d,'body':{'user_name':_0x52ed64['endUserNumber'],'roles':'user','first_name':_0x52ed64[_0xb814('0x24')],'active':'true','date_format':_0xb814('0x25'),'phone':_0x52ed64[_0xb814('0x24')]},'auth':_0x328a08,'json':!![]};return rp(_0x338a28)[_0xb814('0xe')](function(_0x599f9f){logger['info']('['+[_0x271aa8[_0xb814('0x13')]()]+_0xb814('0x26'),_0x599f9f['result']);_0x52ed64[_0xb814('0x27')]=_0x599f9f[_0xb814('0xf')][_0xb814('0x11')];_0x2051d0(_0x52ed64);})[_0xb814('0x15')](function(_0x1b78de){logger[_0xb814('0x16')]('['+[_0x271aa8[_0xb814('0x13')]()]+']',_0x1b78de['message']);_0x58c3ca(_0x1b78de[_0xb814('0x17')]);});});}function getEndUser(_0x2263f6,_0x30de5a,_0x424e2b,_0x14100d,_0x4ff31a){return function(_0x16ef82){logger['info']('['+[_0x2263f6[_0xb814('0x13')]()]+_0xb814('0x28'),_0x16ef82);return new Promise(function(_0xe0f509,_0x492d5e){var _0x40b885={'method':_0xb814('0xc'),'uri':_0x424e2b+'sys_user?sysparm_query=phone%3D'+_0x16ef82[_0xb814('0x24')]+'&'+_0x14100d+'&'+_0x4ff31a,'auth':_0x30de5a,'json':!![]};return rp(_0x40b885)[_0xb814('0xe')](function(_0x1a8bd0){if(_0x1a8bd0[_0xb814('0xf')][_0xb814('0x1b')]>0x0){_0x16ef82[_0xb814('0x27')]=_0x1a8bd0['result'][0x0][_0xb814('0x11')];logger['info']('['+[_0x2263f6[_0xb814('0x13')]()]+'],\x20getEndUser\x20crm',_0x16ef82);_0xe0f509(_0x16ef82);}else{return createEndUser(_0x2263f6,_0x30de5a,_0x16ef82,_0x424e2b,_0x14100d)[_0xb814('0xe')](function(_0x4b9233){logger[_0xb814('0x12')]('['+[_0x2263f6[_0xb814('0x13')]()]+'],\x20createEndUser\x20crm',_0x4b9233);_0xe0f509(_0x4b9233);});}})['catch'](function(_0x5dd6bc){logger['error']('['+[_0x2263f6[_0xb814('0x13')]()]+']',_0x5dd6bc[_0xb814('0x17')]);_0x492d5e(_0x5dd6bc[_0xb814('0x17')]);});});};}function getCustomFields(_0x42c2ed,_0x51cdba){var _0x47d782={};if(_0x42c2ed[_0xb814('0x1b')]>0x0){_['forEach'](_0x42c2ed,function(_0x2a93da){if(_0x2a93da[_0xb814('0x29')]===_0xb814('0x2a')&&_0x2a93da[_0xb814('0x2b')]&&!_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da[_0xb814('0x2d')][_0xb814('0x2e')]()]=_0x2a93da[_0xb814('0x2f')][_0xb814('0x30')]();}else if(_0x2a93da['type']==='string'&&_0x2a93da['idField']&&_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da['idField'][_0xb814('0x2e')]()]=_0x2a93da['content'][_0xb814('0x30')]();}else if(_0x2a93da[_0xb814('0x29')]===_0xb814('0x31')&&_0x2a93da[_0xb814('0x32')]&&_0x2a93da['idField']&&_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da[_0xb814('0x2d')][_0xb814('0x2e')]()]=_0x51cdba[_0x2a93da[_0xb814('0x32')]][_0xb814('0x30')]();}else if(_0x2a93da[_0xb814('0x29')]==='customVariable'&&_0x2a93da[_0xb814('0x33')]&&_0x2a93da[_0xb814('0x33')][_0xb814('0x34')]&&_0x2a93da[_0xb814('0x2d')]&&_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da[_0xb814('0x2d')][_0xb814('0x2e')]()]=_0x51cdba[_0x2a93da['Variable']['name'][_0xb814('0x2e')]()][_0xb814('0x30')]();}});}return _0x47d782;}function getTicket(_0x4c08d6,_0x2bf906,_0x43f1b,_0x40e627,_0x24b697,_0x40af85){return function(_0x2eb9b6){logger[_0xb814('0x12')]('['+[_0x4c08d6[_0xb814('0x13')]()]+']\x20getTicket\x20input\x20crm',_0x2eb9b6);return new Promise(function(_0x37800a,_0x17510c){var _0x4a76bb=_0x4c08d6[_0xb814('0x2e')]()==='outbound'?_0x2eb9b6[_0xb814('0x1e')]:_0x2eb9b6[_0xb814('0x27')];var _0xc71270={'method':_0xb814('0x35'),'uri':_0x43f1b+_0xb814('0x36')+'?'+_0x40af85,'body':Object[_0xb814('0x37')]({},{'active':_0xb814('0x1d'),'caller_id':_0x4a76bb,'assigned_to':_0x2eb9b6[_0xb814('0x1e')],'short_description':intUtil[_0xb814('0x38')](_0x40e627[_0xb814('0x39')],_0x24b697,'\x20'),'description':intUtil['getString'](_0x40e627['Descriptions'],_0x24b697,'\x0a')},getCustomFields(_0x40e627[_0xb814('0x3a')],_0x24b697)),'auth':_0x2bf906,'json':!![]};return rp(_0xc71270)[_0xb814('0xe')](function(_0x4156d8){logger[_0xb814('0x12')]('['+[_0x4c08d6[_0xb814('0x13')]()]+_0xb814('0x3b'),_0x4156d8[_0xb814('0xf')]);_0x2eb9b6['ticketId']=_0x4156d8[_0xb814('0xf')][_0xb814('0x11')];_0x2eb9b6[_0xb814('0x3c')]=_0x4156d8['result'][_0xb814('0x3d')];logger['info']('['+[_0x4c08d6[_0xb814('0x13')]()]+']\x20getTicket\x20crm',_0x2eb9b6);_0x37800a(_0x2eb9b6);})[_0xb814('0x15')](function(_0x3cf8f8){logger['error']('['+[_0x4c08d6[_0xb814('0x13')]()]+']',_0x3cf8f8[_0xb814('0x17')]);_0x17510c(_0x3cf8f8[_0xb814('0x17')]);});});};}function createRemoteTag(_0x5209d1,_0x3da050,_0x5f0e58,_0x13bdcf){return new Promise(function(_0x158893,_0x4aed78){var _0x39952d={'method':'POST','uri':_0x5f0e58+'label'+'?'+_0x13bdcf,'body':{'short_description':_0x5209d1,'global':!![],'active':!![],'name':_0x5209d1},'auth':_0x3da050,'json':!![]};return rp(_0x39952d)[_0xb814('0xe')](function(_0x35f59a){var _0x34935b=_0x35f59a['result'][_0xb814('0x11')];_0x158893(_0x34935b);});});}function getRemoteTag(_0x538b0f,_0xf88d23,_0x2174e5,_0x58d6e5,_0x2db5a6){return new Promise(function(_0x5c32c2,_0x25a607){var _0x1656ed={'method':_0xb814('0xc'),'uri':_0x2174e5+_0xb814('0x3e')+_0xb814('0x3f')+_0x538b0f+'&'+_0x58d6e5,'auth':_0xf88d23,'json':!![]};return rp(_0x1656ed)[_0xb814('0xe')](function(_0x21d3e9){if(_0x21d3e9[_0xb814('0xf')]['length']>0x0){var _0x374532=_0x21d3e9[_0xb814('0xf')][0x0]['sys_id'];_0x5c32c2(_0x374532);}else{return createRemoteTag(_0x538b0f,_0xf88d23,_0x2174e5,_0x58d6e5)[_0xb814('0xe')](function(_0xe14249){_0x5c32c2(_0xe14249);});}});});}function assignTagToIncident(_0x4d13db,_0x371000,_0x58b9a6,_0x48362c,_0x2114ca){return new Promise(function(_0x5257be,_0x3ff213){var _0xd1cd8b={'method':_0xb814('0x35'),'uri':_0x58b9a6+'label_entry'+'?'+_0x2114ca,'body':{'label':_0x4d13db,'table':_0xb814('0x36'),'id_type':'Incident','table_key':_0x48362c[_0xb814('0x40')],'title':_0xb814('0x41')+_0x48362c[_0xb814('0x3c')],'id_display':_0x48362c[_0xb814('0x3c')]},'auth':_0x371000,'json':!![]};return rp(_0xd1cd8b)[_0xb814('0xe')](function(_0x3b374b){_0x5257be();})[_0xb814('0x15')](function(){_0x5257be();});});}function manageTags(_0x113350,_0x46014f,_0x4d611d,_0x211194,_0x111884,_0x3852ae,_0x1ac6d0){return new Promise(function(_0x3b35a8,_0x3d4843){var _0x52edfa=[];_0x46014f[_0xb814('0x42')](function(_0x4ccd94){_0x52edfa[_0xb814('0x43')](getRemoteTag(_0x4ccd94,_0x4d611d,_0x211194,_0x3852ae,_0x1ac6d0));});return Promise[_0xb814('0x44')](_0x52edfa)[_0xb814('0xe')](function(_0x4c884c){if(_0x4c884c[_0xb814('0x1b')]){logger['info']('['+[_0x113350[_0xb814('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x4c884c);var _0x2f0c94=[];_0x4c884c[_0xb814('0x42')](function(_0xa03cd2){_0x2f0c94[_0xb814('0x43')](assignTagToIncident(_0xa03cd2,_0x4d611d,_0x211194,_0x111884,_0x3852ae));});return Promise[_0xb814('0x44')](_0x2f0c94)[_0xb814('0xe')](function(){_0x3b35a8();})[_0xb814('0x15')](function(){_0x3b35a8();});}else{_0x3b35a8();}});});}function getTags(_0x4d44e3,_0x44088d,_0x51ca51,_0x255047,_0x22c73f,_0x1b989d){return function(_0x3dcaeb){return new Promise(function(_0x19fa45,_0x139531){var _0x514dab=[];var _0x12882a=_0x255047[_0xb814('0x45')];if(_0x12882a&&_0x12882a['length']>0x0){_0x514dab=_[_0xb814('0x46')](_0x12882a,_0xb814('0x34'));}if(_0x514dab[_0xb814('0x1b')]>0x0){return manageTags(_0x4d44e3,_0x514dab,_0x44088d,_0x51ca51,_0x3dcaeb,_0x22c73f,_0x1b989d)[_0xb814('0xe')](function(){_0x19fa45(_0x3dcaeb);});}else{_0x19fa45(_0x3dcaeb);}});};}function emit(_0x2161eb,_0x51d834,_0x3a4d4b){var _0x5e8e8e=_0xb814('0x47')+_0xb814('0x48')+_0xb814('0x49')+_0xb814('0x4a');var _0x2e39b1={'uri':_0x2161eb+_0xb814('0x4b')+_0x3a4d4b+_0x5e8e8e};io['to'](util['format']('user:%s',_0x51d834))['emit'](_0xb814('0x4c'),_0x2e39b1);}exports['cs']=function(_0x490e5c,_0x45a8b9,_0x1d3954,_0x25db89,_0x5e966c,_0x1b76fa,_0x3e5ce8,_0xee204){var _0x5aabbe={};var _0x30f717={'user':_0x1b76fa[_0xb814('0x4d')],'pass':_0x1b76fa[_0xb814('0x4e')]};var _0x3564e0='sysparm_limit=1';var _0x5dedd7=_0xb814('0x4f');_0x1b76fa[_0xb814('0x50')]=intUtil[_0xb814('0x51')](_0x1b76fa[_0xb814('0x50')]);_0x1b76fa[_0xb814('0x52')]=intUtil[_0xb814('0x51')](_0x1b76fa[_0xb814('0x52')]);var _0xe47442=util[_0xb814('0x53')](_0xb814('0x54'),_0x1b76fa[_0xb814('0x50')]);_0x5aabbe[_0xb814('0x19')]=!_[_0xb814('0x55')](_0x25db89)?_0x25db89[_0xb814('0x56')]:null;_0x5aabbe[_0xb814('0x1f')]=_0x1b76fa['email'];_0x5aabbe[_0xb814('0x24')]=_0xee204[_0xb814('0x2e')]()===_0xb814('0x57')?_0x45a8b9[_0xb814('0x58')]:_0x45a8b9[_0xb814('0x59')];_0x5aabbe[_0xb814('0x5a')]=_0xee204==='queue'||_0xee204===_0xb814('0x5b')?'queue':_0xb814('0x57');var _0x39aa00=util[_0xb814('0x53')](_0xb814('0x5c'),_0x1b76fa[_0xb814('0x52')],_0x45a8b9['uniqueid'],md5(_0x45a8b9['uniqueid']));if(_0x5e966c&&_0x5e966c[_0xb814('0x5d')]){logger[_0xb814('0x12')](_0xb814('0x5e'),_0xb814('0x5f'));_0x45a8b9['recordingURL']=_0x39aa00;}else if(_0x3e5ce8&&_0x3e5ce8[_0xb814('0x60')]&&_0x3e5ce8['recordingFormat']!==_0xb814('0x61')){logger[_0xb814('0x12')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x45a8b9[_0xb814('0x62')]=_0x39aa00;}else{_0x45a8b9['recordingURL']='';}return getAdminUser(_0xee204,_0x30f717,_0x5aabbe,_0xe47442,_0x5dedd7,_0x3564e0)[_0xb814('0xe')](getUser(_0xee204,_0x30f717,_0xe47442,_0x5dedd7,_0x3564e0))[_0xb814('0xe')](getEndUser(_0xee204,_0x30f717,_0xe47442,_0x5dedd7,_0x3564e0))[_0xb814('0xe')](getTicket(_0xee204,_0x30f717,_0xe47442,_0x1d3954,_0x45a8b9,_0x5dedd7))[_0xb814('0xe')](function(_0x46784f){logger[_0xb814('0x12')](util[_0xb814('0x53')]('The\x20ticket\x20ID\x20is:\x20%s',_0x46784f[_0xb814('0x40')]));logger['info'](util[_0xb814('0x53')]('call\x20direction:\x20%s',_0xee204));if(_0xee204!==_0xb814('0x5b')){logger[_0xb814('0x12')]('['+[_0xee204['toUpperCase']()]+']',_0xb814('0x63'));emit(_0x1b76fa['remoteUri'],_0x25db89[_0xb814('0x34')],_0x46784f[_0xb814('0x40')]);}})['catch'](function(_0x5a0c4a){logger[_0xb814('0x16')]('['+[_0xee204[_0xb814('0x13')]()]+_0xb814('0x64'),util[_0xb814('0x65')](_0x5a0c4a,{'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 61d4401..12cc4ea 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 _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 +var _0xa664=['get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','format','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','type','string','nameField','toLowerCase','content','customField','custom_fields','variable','Variable','POST','login','password','PLAIN','sessionID','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','Outbound','monitor_format','toUpperCase','request-promise','bluebird','md5','util','./util','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','push','idField','variableName','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','base64'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0xa664,0x132));var _0x4a66=function(_0x449062,_0x5cb7d6){_0x449062=_0x449062-0x0;var _0x585486=_0xa664[_0x449062];return _0x585486;};'use strict';var _=require('lodash');var rp=require(_0x4a66('0x0'));var BPromise=require(_0x4a66('0x1'));var md5=require(_0x4a66('0x2'));var util=require(_0x4a66('0x3'));var Redis=require('ioredis');var intUtil=require(_0x4a66('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x4a66('0x5'));config[_0x4a66('0x6')]=_[_0x4a66('0x7')](config[_0x4a66('0x6')],{'host':_0x4a66('0x8'),'port':0x18eb});var io=require(_0x4a66('0x9'))(new Redis(config[_0x4a66('0x6')]));var def={'method':'POST','json':!![]};function emit(_0x4484c5,_0x3d51bf,_0x20376e){io['to'](_0x4484c5)[_0x4a66('0xa')](_0x3d51bf,_0x20376e);}function getTicket(_0x4a3c4c,_0x1f553d,_0x124ed0,_0x5b7ccd,_0x11b0b7,_0x33430f,_0x42a9fc,_0x75fd00){logger[_0x4a66('0xb')](_0x4a66('0xc'));var _0x2c2523=new Date();var _0x3f662e=[{'name':_0x4a66('0xd'),'value':intUtil[_0x4a66('0xe')](_0x5b7ccd[_0x4a66('0xf')],_0x11b0b7,'\x20')},{'name':_0x4a66('0x10'),'value':_0x1f553d['id']},{'name':_0x4a66('0x11'),'value':_0x1f553d['id']},{'name':_0x4a66('0x12'),'value':intUtil[_0x4a66('0xe')](_0x5b7ccd[_0x4a66('0x13')],_0x11b0b7,'\x0a')},{'name':_0x4a66('0x14'),'value':_0x2c2523['toISOString']()[_0x4a66('0x15')](0x0,0x13)[_0x4a66('0x16')]('T','\x20')},{'name':_0x4a66('0x17'),'value':'0'},{'name':_0x4a66('0x18'),'value':'15'},{'name':_0x4a66('0x19'),'value':_0x124ed0['id']},{'name':_0x4a66('0x1a'),'value':_0x4a66('0x1b')},{'name':_0x4a66('0x1c'),'value':_0x124ed0['name']},{'name':_0x4a66('0x1d'),'value':_0x75fd00}];if(_0x33430f[_0x4a66('0x1e')]){_[_0x4a66('0x1f')](_0x33430f,function(_0x33703f){if(_0x11b0b7[_0x33703f['variableName']]){_0x3f662e[_0x4a66('0x20')]({'name':_0x33703f[_0x4a66('0x21')],'value':_0x11b0b7[_0x33703f[_0x4a66('0x22')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x4a66('0x23'),'rest_data':JSON[_0x4a66('0x24')]({'session':_0x42a9fc['id'],'module_name':_0x4a66('0x25'),'name_value_list':_0x3f662e})}});}function getAuth(_0x4c78e1){return util['format'](_0x4a66('0x26'),new Buffer(_0x4c78e1[_0x4a66('0x27')]+':X')[_0x4a66('0x28')](_0x4a66('0x29')));}function getServerInfo(_0x18ec8e){return request({'form':{'method':_0x4a66('0x2a'),'input_type':_0x4a66('0x23'),'response_type':_0x4a66('0x23'),'rest_data':JSON[_0x4a66('0x24')]({'session':_0x18ec8e['id']})}});}function getUser(_0x2c0a0d,_0x10274a,_0x3052cc){if(!_[_0x4a66('0x2b')](_0x10274a)){logger[_0x4a66('0xb')](_0x4a66('0x2c'),_0x10274a);return request({'form':{'method':_0x4a66('0x2d'),'input_type':_0x4a66('0x23'),'response_type':'JSON','rest_data':JSON[_0x4a66('0x24')]({'session':_0x3052cc['id'],'module_name':_0x4a66('0x2e'),'query':util['format'](_0x4a66('0x2f'),_0x10274a),'order_by':'','offset':'0','select_fields':['id',_0x4a66('0xd'),_0x4a66('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4a66('0x31')](function(_0x3260d4){if(_0x3260d4['entry_list']['length']){var _0x38328d=_[_0x4a66('0x32')](_0x3260d4[_0x4a66('0x33')],function(_0x257485){return _0x257485[_0x4a66('0x34')][_0x4a66('0x30')][_0x4a66('0x35')]===_0x10274a;});if(_0x38328d){logger[_0x4a66('0xb')](_0x4a66('0x36'));return BPromise[_0x4a66('0x37')]({'id':_0x38328d[_0x4a66('0x34')]['id'][_0x4a66('0x35')],'name':_0x38328d['name_value_list']['name'][_0x4a66('0x35')]});}}logger['info'](_0x4a66('0x38'));return BPromise[_0x4a66('0x37')]({'id':_0x3052cc[_0x4a66('0x34')][_0x4a66('0x39')]['value'],'name':_0x3052cc[_0x4a66('0x34')][_0x4a66('0x30')][_0x4a66('0x35')]});});}else{logger[_0x4a66('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x3052cc[_0x4a66('0x34')][_0x4a66('0x39')][_0x4a66('0x35')],'name':_0x3052cc[_0x4a66('0x34')][_0x4a66('0x30')][_0x4a66('0x35')]});}}function getEndUser(_0x3e0b86,_0xee22c4,_0x378cdf,_0x1a8fbd){logger['info']('Searching\x20enduser\x20with\x20phone',_0x378cdf);return request({'form':{'method':'get_entry_list','input_type':_0x4a66('0x23'),'response_type':_0x4a66('0x23'),'rest_data':JSON[_0x4a66('0x24')]({'session':_0x1a8fbd['id'],'module_name':_0x4a66('0x1b'),'query':util[_0x4a66('0x3a')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x378cdf),'order_by':'','offset':'0','select_fields':['id',_0x4a66('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2be88a){if(_0x2be88a[_0x4a66('0x33')][_0x4a66('0x1e')]){var _0x3f9add=_['find'](_0x2be88a[_0x4a66('0x33')],function(_0x57ed4e){return _0x57ed4e[_0x4a66('0x34')][_0x4a66('0x3b')][_0x4a66('0x35')]===_0x378cdf;});if(_0x3f9add){logger[_0x4a66('0xb')](_0x4a66('0x3c'));return BPromise[_0x4a66('0x37')]({'id':_0x3f9add[_0x4a66('0x34')]['id'][_0x4a66('0x35')],'name':_0x3f9add[_0x4a66('0x34')][_0x4a66('0xd')][_0x4a66('0x35')],'phone':_0x3f9add[_0x4a66('0x34')][_0x4a66('0x3b')][_0x4a66('0x35')]});}}else{logger[_0x4a66('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x4a66('0x23'),'response_type':_0x4a66('0x23'),'rest_data':JSON[_0x4a66('0x24')]({'session':_0x1a8fbd['id'],'module_name':_0x4a66('0x1b'),'name_value_list':[{'name':_0x4a66('0x3d'),'value':_0xee22c4!==_0x4a66('0x3e')?_0xee22c4:util[_0x4a66('0x3a')](_0x4a66('0x3f'),_0x378cdf)},{'name':_0x4a66('0x3b'),'value':_0x378cdf}]})}})[_0x4a66('0x31')](function(_0x9178f6){logger[_0x4a66('0xb')](_0x4a66('0x40'));return BPromise[_0x4a66('0x37')]({'id':_0x9178f6['id'],'name':_0x9178f6[_0x4a66('0x33')]['first_name'][_0x4a66('0x35')],'phone':_0x9178f6[_0x4a66('0x33')]['phone_home'][_0x4a66('0x35')]});});}});}function request(_0x1ecd9e){logger[_0x4a66('0x41')]('[HTTP]',JSON[_0x4a66('0x24')](_0x1ecd9e));return rp(_[_0x4a66('0x42')](def,_0x1ecd9e));}function getTags(_0x1353ba,_0x54e5a6){var _0x3bd9f7=[];if(_0x1353ba&&_0x1353ba[_0x4a66('0x1e')]>0x0){_0x3bd9f7=_['map'](_0x1353ba,_0x54e5a6);}return _0x3bd9f7;}function getCustomFields(_0x452bf0,_0x481cd2){var _0xb1c357=[];var _0x51be62={'custom_fields':[]};if(_0x452bf0[_0x4a66('0x1e')]>0x0){_[_0x4a66('0x1f')](_0x452bf0,function(_0x2689d5){if(_0x2689d5[_0x4a66('0x43')]===_0x4a66('0x44')&&_0x2689d5['nameField']&&!_0x2689d5['customField']){_0x51be62[_0x2689d5[_0x4a66('0x45')][_0x4a66('0x46')]()]=_0x2689d5[_0x4a66('0x47')][_0x4a66('0x28')]();}else if(_0x2689d5[_0x4a66('0x43')]==='string'&&_0x2689d5['idField']&&_0x2689d5[_0x4a66('0x48')]){_0x51be62[_0x4a66('0x49')][_0x4a66('0x20')]({'id':_0x2689d5['idField'],'value':_0x2689d5[_0x4a66('0x47')]['toString']()});}else if(_0x2689d5['type']===_0x4a66('0x4a')&&_0x2689d5[_0x4a66('0x22')]&&_0x2689d5['idField']&&_0x2689d5[_0x4a66('0x48')]){_0x481cd2[_0x2689d5[_0x4a66('0x22')]]&&_0x51be62['custom_fields'][_0x4a66('0x20')]({'id':_0x2689d5[_0x4a66('0x21')],'value':_0x481cd2[_0x2689d5[_0x4a66('0x22')]][_0x4a66('0x28')]()});}else if(_0x2689d5[_0x4a66('0x43')]==='customVariable'&&_0x2689d5[_0x4a66('0x4b')]&&_0x2689d5[_0x4a66('0x4b')][_0x4a66('0xd')]&&_0x2689d5[_0x4a66('0x21')]&&_0x2689d5[_0x4a66('0x48')]){_0x481cd2[_0x2689d5[_0x4a66('0x4b')][_0x4a66('0xd')][_0x4a66('0x46')]()]&&_0x51be62[_0x4a66('0x49')][_0x4a66('0x20')]({'id':_0x2689d5[_0x4a66('0x21')],'value':_0x481cd2[_0x2689d5[_0x4a66('0x4b')][_0x4a66('0xd')]['toLowerCase']()]['toString']()});}});}return _0x51be62;}function getConnection(_0x1a7abe){return request({'method':_0x4a66('0x4c'),'form':{'method':_0x4a66('0x4d'),'input_type':_0x4a66('0x23'),'response_type':_0x4a66('0x23'),'rest_data':JSON[_0x4a66('0x24')]({'user_auth':{'user_name':_0x1a7abe['username'],'password':_0x1a7abe[_0x4a66('0x4e')],'encryption':_0x4a66('0x4f')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x4a66('0x31')](function(_0x8589b4){var _0x5ecb9d=_0x8589b4;if(_0x5ecb9d['id']){def[_0x4a66('0x50')]=_0x5ecb9d['id'];return BPromise['resolve'](_0x5ecb9d);}else{throw new Error(util[_0x4a66('0x3a')]('Account\x20%d\x20is\x20not\x20valid',_0x1a7abe['id']));}});}function setRelationship(_0x569d21,_0x150ffa,_0x7f9ab1,_0x4c83b8){return request({'form':{'method':'set_relationship','input_type':_0x4a66('0x23'),'response_type':_0x4a66('0x23'),'rest_data':JSON['stringify']({'session':_0x569d21['id'],'module_name':_0x4a66('0x25'),'module_id':_0x7f9ab1['id'],'link_field_name':_0x4c83b8,'related_ids':[_0x150ffa['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4a66('0x51')]=function(_0x2816a9,_0x29b1ab,_0x1b9f2b,_0x149b13,_0x5c2768,_0x197fde){var _0xec48df,_0x2e010e,_0x40c3e7,_0x82ebe0;_0x197fde['remoteUri']=intUtil[_0x4a66('0x52')](_0x197fde[_0x4a66('0x53')]);_0x197fde[_0x4a66('0x54')]=intUtil[_0x4a66('0x52')](_0x197fde['serverUrl']);def[_0x4a66('0x55')]=util[_0x4a66('0x3a')](_0x4a66('0x56'),_0x197fde[_0x4a66('0x53')]);if(_0x5c2768&&_0x5c2768['monitor_format']){logger[_0x4a66('0xb')](_0x4a66('0x57'),_0x4a66('0x58'));_0x29b1ab[_0x4a66('0x59')]=util[_0x4a66('0x3a')](_0x4a66('0x5a'),_0x197fde[_0x4a66('0x54')],_0x29b1ab[_0x4a66('0x5b')],md5(_0x29b1ab['uniqueid']));}else{_0x29b1ab[_0x4a66('0x59')]='';}return getConnection(_0x197fde)[_0x4a66('0x31')](function(_0x35cb93){_0x82ebe0=_0x35cb93;return getUser(_0x197fde,_0x149b13[_0x4a66('0xd')],_0x82ebe0);})[_0x4a66('0x31')](function(_0x2fb369){_0xec48df=_0x2fb369;logger['info'](_0x4a66('0x5c'),_0xec48df['id']);return getEndUser(_0x197fde,_0x29b1ab[_0x4a66('0x5d')],_0x29b1ab['calleridnum'],_0x82ebe0);})['then'](function(_0x47fba7){_0x2e010e=_0x47fba7;logger[_0x4a66('0xb')](_0x4a66('0x5e'),_0x2e010e['id']);return getTicket(_0x197fde,_0xec48df,_0x2e010e,_0x1b9f2b,_0x29b1ab,_0x1b9f2b[_0x4a66('0x5f')],_0x82ebe0,_0x4a66('0x60'));})[_0x4a66('0x31')](function(_0x5dd372){_0x40c3e7=_0x5dd372;logger[_0x4a66('0xb')](_0x4a66('0x61'));logger['info'](_0x4a66('0x62'),_0x40c3e7['id']);return setRelationship(_0x82ebe0,_0xec48df,_0x40c3e7,_0x4a66('0x63'));})[_0x4a66('0x31')](function(){return setRelationship(_0x82ebe0,_0x2e010e,_0x40c3e7,_0x4a66('0x64'));})[_0x4a66('0x31')](function(){return getServerInfo(_0x82ebe0);})['then'](function(_0xc01192){var _0xf1aad=parseInt(_0xc01192[_0x4a66('0x65')][_0x4a66('0x66')](0x0));var _0x49e248=util['format'](_0x4a66('0x67'),_0x197fde[_0x4a66('0x53')],_0x40c3e7['id']);if(_0xf1aad>0x6){_0x49e248=util[_0x4a66('0x3a')](_0x4a66('0x68'),_0x197fde[_0x4a66('0x53')],_0x40c3e7['id']);}logger['info']('[QUEUE]',_0x4a66('0x69'));emit(util[_0x4a66('0x3a')](_0x4a66('0x6a'),_0x149b13[_0x4a66('0xd')]),'trigger:browser:url',{'uri':_0x49e248});})[_0x4a66('0x6b')](function(_0x35de1c){logger[_0x4a66('0x6c')](_0x4a66('0x57'),JSON[_0x4a66('0x24')](_0x35de1c));});};exports[_0x4a66('0x6d')]=function(_0x2b9860,_0x1c256a,_0x190541,_0x17ce9d,_0x7fec46,_0x11b1fd,_0x2c8c0a){var _0x1b2571,_0x204778,_0x169123,_0x43eb7a;_0x11b1fd[_0x4a66('0x53')]=intUtil[_0x4a66('0x52')](_0x11b1fd['remoteUri']);_0x11b1fd[_0x4a66('0x54')]=intUtil[_0x4a66('0x52')](_0x11b1fd['serverUrl']);def[_0x4a66('0x55')]=util[_0x4a66('0x3a')](_0x4a66('0x56'),_0x11b1fd[_0x4a66('0x53')]);if(_0x2c8c0a&&_0x2c8c0a[_0x4a66('0x6e')]&&_0x2c8c0a[_0x4a66('0x6e')]!=='none'){logger[_0x4a66('0xb')](_0x4a66('0x6f'),_0x4a66('0x58'));_0x1c256a[_0x4a66('0x59')]=util['format'](_0x4a66('0x5a'),_0x11b1fd['serverUrl'],_0x1c256a['uniqueid'],md5(_0x1c256a[_0x4a66('0x5b')]));}return getConnection(_0x11b1fd)[_0x4a66('0x31')](function(_0x4c8a99){_0x43eb7a=_0x4c8a99;return getUser(_0x11b1fd,_0x17ce9d[_0x4a66('0xd')],_0x43eb7a);})[_0x4a66('0x31')](function(_0x4902d9){_0x1b2571=_0x4902d9;logger[_0x4a66('0xb')](_0x4a66('0x5c'),_0x1b2571['id']);return getEndUser(_0x11b1fd,_0x1c256a[_0x4a66('0x70')],_0x1c256a['destcalleridnum'],_0x43eb7a);})['then'](function(_0xb28e5f){_0x204778=_0xb28e5f;logger[_0x4a66('0xb')]('The\x20Enduser\x20ID\x20is:',_0x204778['id']);return getTicket(_0x11b1fd,_0x1b2571,_0x204778,_0x190541,_0x1c256a,_0x190541['Fields'],_0x43eb7a,_0x4a66('0x71'));})[_0x4a66('0x31')](function(_0x13e896){_0x169123=_0x13e896;logger[_0x4a66('0xb')](_0x4a66('0x61'));logger[_0x4a66('0xb')](_0x4a66('0x62'),_0x169123['id']);return setRelationship(_0x43eb7a,_0x1b2571,_0x169123,_0x4a66('0x63'));})['then'](function(){return setRelationship(_0x43eb7a,_0x204778,_0x169123,_0x4a66('0x64'));})[_0x4a66('0x31')](function(){return getServerInfo(_0x43eb7a);})['then'](function(_0x51a208){var _0x4a5e19=parseInt(_0x51a208[_0x4a66('0x65')][_0x4a66('0x66')](0x0));var _0x2f4a3a=util[_0x4a66('0x3a')](_0x4a66('0x67'),_0x11b1fd[_0x4a66('0x53')],_0x169123['id']);if(_0x4a5e19>0x6){_0x2f4a3a=util[_0x4a66('0x3a')](_0x4a66('0x68'),_0x11b1fd[_0x4a66('0x53')],_0x169123['id']);}logger[_0x4a66('0xb')]('[OUTBOUND]',_0x4a66('0x69'));emit(util[_0x4a66('0x3a')]('user:%s',_0x17ce9d['name']),'trigger:browser:url',{'uri':_0x2f4a3a});})['catch'](function(_0x2cb695){logger[_0x4a66('0x6c')]('[OUTBOUND]',JSON[_0x4a66('0x24')](_0x2cb695));});};exports['unmanaged']=function(_0xd135d0,_0x4ae6e3,_0x55c0f1,_0x333b13,_0x4916af,_0x940395){var _0x4c3d79,_0x17408a,_0x23110c,_0x58337d;_0x940395[_0x4a66('0x53')]=intUtil['stripTrailingSlash'](_0x940395['remoteUri']);_0x940395[_0x4a66('0x54')]=intUtil[_0x4a66('0x52')](_0x940395[_0x4a66('0x54')]);def['uri']=util[_0x4a66('0x3a')](_0x4a66('0x56'),_0x940395[_0x4a66('0x53')]);if(_0x4916af&&_0x4916af[_0x4a66('0x72')]){logger['info']('['+_0x4ae6e3['lastevent'][_0x4a66('0x73')]()+']',_0x4a66('0x58'));_0x4ae6e3['recordingURL']=util[_0x4a66('0x3a')](_0x4a66('0x5a'),_0x940395[_0x4a66('0x54')],_0x4ae6e3[_0x4a66('0x5b')],md5(_0x4ae6e3[_0x4a66('0x5b')]));}else{_0x4ae6e3[_0x4a66('0x59')]='';}return getConnection(_0x940395)[_0x4a66('0x31')](function(_0x353e24){_0x58337d=_0x353e24;if(!_[_0x4a66('0x2b')](_0x333b13)){return getUser(_0x940395,_0x333b13[_0x4a66('0xd')],_0x58337d);}else{return getUser(_0x940395,null,_0x58337d);}})[_0x4a66('0x31')](function(_0x4d47c3){_0x4c3d79=_0x4d47c3;logger['info'](_0x4a66('0x5c'),_0x4c3d79['id']);return getEndUser(_0x940395,_0x4ae6e3[_0x4a66('0x5d')],_0x4ae6e3['calleridnum'],_0x58337d);})[_0x4a66('0x31')](function(_0x4293ec){_0x17408a=_0x4293ec;logger[_0x4a66('0xb')](_0x4a66('0x5e'),_0x17408a['id']);return getTicket(_0x940395,_0x4c3d79,_0x17408a,_0x55c0f1,_0x4ae6e3,_0x55c0f1[_0x4a66('0x5f')],_0x58337d,'Inbound');})[_0x4a66('0x31')](function(_0x6a7a8c){_0x23110c=_0x6a7a8c;logger[_0x4a66('0xb')](_0x4a66('0x61'));logger[_0x4a66('0xb')](_0x4a66('0x62'),_0x23110c['id']);return setRelationship(_0x58337d,_0x4c3d79,_0x23110c,_0x4a66('0x63'));})['then'](function(){return setRelationship(_0x58337d,_0x17408a,_0x23110c,_0x4a66('0x64'));})['then'](function(){return getServerInfo(_0x58337d);})[_0x4a66('0x6b')](function(_0x166a18){logger[_0x4a66('0x6c')]('['+_0x4ae6e3['lastevent'][_0x4a66('0x73')]()+']',JSON[_0x4a66('0x24')](_0x166a18));});}; \ 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 fc519bc..03c95e1 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 _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 +var _0xb651=['sortBy','type','string','push','content','variable','variableName','toString','Variable','name','toLowerCase','keyType','format','%s:\x20%s','key','keyContent','customVariable','stripTrailingSlash','lastIndexOf','isNil','test','lodash','util','getString','length'];(function(_0x309d93,_0x157662){var _0x2dd61d=function(_0x25ff34){while(--_0x25ff34){_0x309d93['push'](_0x309d93['shift']());}};_0x2dd61d(++_0x157662);}(_0xb651,0x10f));var _0x1b65=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xb651[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x1b65('0x0'));var util=require(_0x1b65('0x1'));exports[_0x1b65('0x2')]=function(_0x578271,_0x4fc995,_0x33008e){var _0x1e478e=[];if(_0x578271[_0x1b65('0x3')]>0x0){var _0x3d693e=_[_0x1b65('0x4')](_0x578271,['id']);for(var _0x237b0a=0x0;_0x237b0a<_0x3d693e[_0x1b65('0x3')];_0x237b0a++){var _0x34e2c9=_0x3d693e[_0x237b0a];if(_0x34e2c9[_0x1b65('0x5')]===_0x1b65('0x6')){_0x1e478e[_0x1b65('0x7')](_0x34e2c9[_0x1b65('0x8')]);}else if(_0x34e2c9[_0x1b65('0x5')]===_0x1b65('0x9')&&_0x34e2c9[_0x1b65('0xa')]){_0x4fc995[_0x34e2c9[_0x1b65('0xa')]]&&_0x1e478e[_0x1b65('0x7')](_0x4fc995[_0x34e2c9[_0x1b65('0xa')]][_0x1b65('0xb')]());}else if(_0x34e2c9[_0x1b65('0x5')]==='customVariable'&&_0x34e2c9[_0x1b65('0xc')]&&_0x34e2c9[_0x1b65('0xc')][_0x1b65('0xd')]){_0x4fc995[_0x34e2c9[_0x1b65('0xc')][_0x1b65('0xd')][_0x1b65('0xe')]()]&&_0x1e478e[_0x1b65('0x7')](_0x4fc995[_0x34e2c9[_0x1b65('0xc')][_0x1b65('0xd')]['toLowerCase']()][_0x1b65('0xb')]());}else if(_0x34e2c9[_0x1b65('0x5')]==='keyValue'){if(_0x34e2c9[_0x1b65('0xf')]==='string'&&_0x34e2c9['key']){_0x1e478e[_0x1b65('0x7')](util[_0x1b65('0x10')](_0x1b65('0x11'),_0x34e2c9[_0x1b65('0x12')],_0x34e2c9[_0x1b65('0x13')]));}else if(_0x34e2c9['keyType']===_0x1b65('0x9')&&_0x34e2c9[_0x1b65('0xa')]&&_0x34e2c9[_0x1b65('0x12')]){_0x4fc995[_0x34e2c9[_0x1b65('0xa')]]&&_0x1e478e['push'](util[_0x1b65('0x10')](_0x1b65('0x11'),_0x34e2c9[_0x1b65('0x12')],_0x4fc995[_0x34e2c9[_0x1b65('0xa')]]));}else if(_0x34e2c9[_0x1b65('0xf')]===_0x1b65('0x14')&&_0x34e2c9[_0x1b65('0xc')]&&_0x34e2c9[_0x1b65('0xc')][_0x1b65('0xd')]&&_0x34e2c9[_0x1b65('0x12')]){_0x4fc995[_0x34e2c9[_0x1b65('0xc')][_0x1b65('0xd')][_0x1b65('0xe')]()]&&_0x1e478e[_0x1b65('0x7')](util[_0x1b65('0x10')]('%s:\x20%s',_0x34e2c9[_0x1b65('0x12')],_0x4fc995[_0x34e2c9[_0x1b65('0xc')][_0x1b65('0xd')][_0x1b65('0xe')]()]));}}}}return _0x1e478e['join'](_0x33008e);};exports[_0x1b65('0x15')]=function(_0x14ceb9){var _0x88a079=_0x14ceb9['slice'](-0x1);if(_0x88a079==='/'){_0x14ceb9=_0x14ceb9['substring'](0x0,_0x14ceb9[_0x1b65('0x16')](_0x88a079));}return _0x14ceb9;};exports['validateEmail']=function(_0x38304e){if(!_[_0x1b65('0x17')](_0x38304e)&&_0x38304e!==''){var _0x4fc3ba=/^(([^<>()\[\]\\.,;:\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 _0x4fc3ba[_0x1b65('0x18')](String(_0x38304e)[_0x1b65('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 58158e8..4d1e06e 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 _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 +var _0x2a52=['firstname','POST','Contacts','Enduser\x20created.','phone','getEndUser','getchallenge','login','token','getConnection','[HTTP]','queue','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','lastevent','toUpperCase','calleridnum','lodash','util','ioredis','./util','../../../../config/logger','redis','defaults','localhost','emit','length','forEach','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','merge','Normal','getString','Descriptions','format','%s/webservice.php','remoteUri','create','sessionName','HelpDesk','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','error','getUser','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!'];(function(_0xbe3ef8,_0x2a9242){var _0x191461=function(_0x2dcabf){while(--_0x2dcabf){_0xbe3ef8['push'](_0xbe3ef8['shift']());}};_0x191461(++_0x2a9242);}(_0x2a52,0x142));var _0x22a5=function(_0x238bd3,_0x18fff0){_0x238bd3=_0x238bd3-0x0;var _0x3dda51=_0x2a52[_0x238bd3];return _0x3dda51;};'use strict';var _=require(_0x22a5('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x22a5('0x1'));var Redis=require(_0x22a5('0x2'));var intUtil=require(_0x22a5('0x3'));var config=require('../../../../config/environment');var logger=require(_0x22a5('0x4'))('vTiger');config[_0x22a5('0x5')]=_[_0x22a5('0x6')](config['redis'],{'host':_0x22a5('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x22a5('0x5')]));function emit(_0xc4a914,_0x530720,_0x928ab8){io['to'](_0xc4a914)[_0x22a5('0x8')](_0x530720,_0x928ab8);}function getCustomFields(_0x2a7a17,_0x5ece60){var _0x36d2dc={};if(_0x2a7a17[_0x22a5('0x9')]>0x0){_[_0x22a5('0xa')](_0x2a7a17,function(_0x172073){if(_0x172073[_0x22a5('0xb')]==='string'&&_0x172073[_0x22a5('0xc')]){_0x36d2dc[_0x172073[_0x22a5('0xc')]]=_0x172073['content'][_0x22a5('0xd')]();}else if(_0x172073[_0x22a5('0xb')]===_0x22a5('0xe')&&_0x172073[_0x22a5('0xf')]&&_0x172073[_0x22a5('0xc')]&&_0x5ece60[_0x172073[_0x22a5('0xf')]]){_0x36d2dc[_0x172073['idField']]=_0x5ece60[_0x172073[_0x22a5('0xf')]][_0x22a5('0xd')]();}else if(_0x172073[_0x22a5('0xb')]===_0x22a5('0x10')&&_0x172073[_0x22a5('0x11')]&&_0x172073[_0x22a5('0x11')][_0x22a5('0x12')]&&_0x172073[_0x22a5('0xc')]&&_0x5ece60[_0x172073[_0x22a5('0x11')][_0x22a5('0x12')][_0x22a5('0x13')]()]){_0x36d2dc[_0x172073[_0x22a5('0xc')]]=_0x5ece60[_0x172073[_0x22a5('0x11')]['name'][_0x22a5('0x13')]()][_0x22a5('0xd')]();}});}return _0x36d2dc;}function createTicket(_0x5e7543,_0x724205,_0x531e1c,_0x476dd1,_0x2390bd,_0x1bdbe1,_0x34b1f8){logger[_0x22a5('0x14')]('Creating\x20new\x20ticket...');var _0x1287c8=_[_0x22a5('0x15')]({'parent_id':'','assigned_user_id':_0x724205['id'],'ticketpriorities':_0x22a5('0x16'),'ticketstatus':'Open','ticket_title':intUtil[_0x22a5('0x17')](_0x476dd1['Subjects'],_0x2390bd,'\x20'),'description':intUtil[_0x22a5('0x17')](_0x476dd1[_0x22a5('0x18')],_0x2390bd,'\x0a'),'contact_id':_0x531e1c['id']},getCustomFields(_0x1bdbe1,_0x2390bd));var _0x20463c={'method':'POST','uri':util[_0x22a5('0x19')](_0x22a5('0x1a'),_0x5e7543[_0x22a5('0x1b')]),'form':{'operation':_0x22a5('0x1c'),'username':_0x5e7543['username'],'sessionName':_0x34b1f8[_0x22a5('0x1d')],'elementType':_0x22a5('0x1e'),'element':JSON[_0x22a5('0x1f')](_0x1287c8)},'json':!![]};return request(_0x20463c)[_0x22a5('0x20')](function(_0x27cae6){if(_0x27cae6[_0x22a5('0x21')]){return BPromise[_0x22a5('0x22')]({'id':_0x27cae6[_0x22a5('0x23')]['id']});}else{throw new Error(util[_0x22a5('0x19')](_0x22a5('0x24'),JSON[_0x22a5('0x1f')](_0x27cae6['error'])));}})[_0x22a5('0x25')](function(_0x82029d){var _0xef97b8=_0x82029d['statusCode']||0x1f4;logger['error'](_0x22a5('0x26'),_0x22a5('0x27'),_0xef97b8,JSON[_0x22a5('0x1f')](_0x82029d));});}function getUser(_0x2eb6ac,_0x1496b8,_0x42695e){if(intUtil[_0x22a5('0x28')](_0x1496b8)){logger['info'](_0x22a5('0x29'),_0x1496b8);return request({'method':_0x22a5('0x2a'),'uri':util[_0x22a5('0x19')](_0x22a5('0x1a'),_0x2eb6ac[_0x22a5('0x1b')]),'qs':{'operation':_0x22a5('0x2b'),'username':_0x2eb6ac[_0x22a5('0x2c')],'sessionName':_0x42695e['sessionName'],'query':util[_0x22a5('0x19')](_0x22a5('0x2d'),_0x1496b8)},'json':!![]})['then'](function(_0x1b0ed4){if(_0x1b0ed4['success']&&_0x1b0ed4[_0x22a5('0x23')]['length']){logger[_0x22a5('0x14')]('Agent\x20found!');return BPromise['resolve']({'id':_0x1b0ed4[_0x22a5('0x23')][0x0]['id'],'email':_0x1b0ed4[_0x22a5('0x23')][0x0]['email1'],'name':_0x1b0ed4[_0x22a5('0x23')][0x0]['first_name']+'\x20'+_0x1b0ed4[_0x22a5('0x23')]['last_name']});}else{logger['info'](_0x22a5('0x2e'));return BPromise['resolve']({'id':_0x42695e[_0x22a5('0x2f')],'email':_0x2eb6ac['username'],'name':_0x22a5('0x30')});}})[_0x22a5('0x25')](function(_0x3a5be7){var _0x11d313=_0x3a5be7[_0x22a5('0x31')]||0x1f4;logger[_0x22a5('0x32')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x22a5('0x33'),_0x11d313,JSON[_0x22a5('0x1f')](_0x3a5be7));});}else{logger[_0x22a5('0x14')](_0x22a5('0x2e'));return BPromise[_0x22a5('0x22')]({'id':_0x42695e[_0x22a5('0x2f')],'email':_0x2eb6ac[_0x22a5('0x2c')],'name':_0x22a5('0x30')})['catch'](function(_0x405150){var _0x26d3dc=_0x405150[_0x22a5('0x31')]||0x1f4;logger[_0x22a5('0x32')](_0x22a5('0x26'),_0x22a5('0x33'),_0x26d3dc,JSON['stringify'](_0x405150));});}}function getEndUser(_0x2407e0,_0x4f514f,_0x18192f,_0x5b09d5){logger[_0x22a5('0x14')]('Searching\x20end\x20user\x20with\x20phone',_0x18192f);return request({'method':'GET','uri':util['format'](_0x22a5('0x1a'),_0x2407e0[_0x22a5('0x1b')]),'qs':{'operation':_0x22a5('0x2b'),'username':_0x2407e0[_0x22a5('0x2c')],'sessionName':_0x5b09d5[_0x22a5('0x1d')],'query':util['format'](_0x22a5('0x34'),_0x18192f,_0x18192f,_0x18192f,_0x18192f,_0x18192f)},'json':!![]})[_0x22a5('0x20')](function(_0x3da6d){if(_0x3da6d['success']&&_0x3da6d['result'][_0x22a5('0x9')]){logger[_0x22a5('0x14')](_0x22a5('0x35'));return BPromise[_0x22a5('0x22')]({'id':_0x3da6d[_0x22a5('0x23')][0x0]['id'],'name':_0x3da6d['result'][0x0][_0x22a5('0x36')]+'\x20'+_0x3da6d['result'][0x0]['lastname'],'phone':_0x18192f});}else{logger[_0x22a5('0x14')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x22a5('0x37'),'uri':util['format'](_0x22a5('0x1a'),_0x2407e0[_0x22a5('0x1b')]),'form':{'operation':_0x22a5('0x1c'),'sessionName':_0x5b09d5[_0x22a5('0x1d')],'elementType':_0x22a5('0x38'),'element':JSON[_0x22a5('0x1f')]({'lastname':_0x4f514f,'phone':_0x18192f,'assigned_user_id':'\x20'})},'json':!![]})[_0x22a5('0x20')](function(_0x10f8b3){logger[_0x22a5('0x14')](_0x22a5('0x39'));return BPromise[_0x22a5('0x22')]({'id':_0x10f8b3[_0x22a5('0x23')]['id'],'name':_0x10f8b3['result']['lastname'],'phone':_0x10f8b3[_0x22a5('0x23')][_0x22a5('0x3a')]});})['catch'](function(_0x33a5f7){var _0x131854=_0x33a5f7['statusCode']||0x1f4;logger[_0x22a5('0x32')](_0x22a5('0x26'),_0x22a5('0x3b'),_0x131854,JSON[_0x22a5('0x1f')](_0x33a5f7));});}});}function getConnection(_0x47a524){var _0x33fceb=_0x47a524[_0x22a5('0x2c')];var _0x5b9d3f=_0x47a524['accessKey'];return request({'method':_0x22a5('0x2a'),'uri':util[_0x22a5('0x19')](_0x22a5('0x1a'),_0x47a524[_0x22a5('0x1b')]),'qs':{'operation':_0x22a5('0x3c'),'username':_0x33fceb},'json':!![]})[_0x22a5('0x20')](function(_0x586cfd){if(_0x586cfd[_0x22a5('0x21')]){return request({'method':_0x22a5('0x37'),'uri':util['format'](_0x22a5('0x1a'),_0x47a524[_0x22a5('0x1b')]),'form':{'operation':_0x22a5('0x3d'),'username':_0x33fceb,'accessKey':md5(_0x586cfd['result'][_0x22a5('0x3e')]+_0x5b9d3f)},'json':!![]});}})['then'](function(_0x33e0d4){if(_0x33e0d4[_0x22a5('0x21')]){return BPromise[_0x22a5('0x22')](_0x33e0d4[_0x22a5('0x23')]);}else{throw new Error(util[_0x22a5('0x19')]('Account\x20%d\x20is\x20not\x20valid',_0x47a524['id']));}})[_0x22a5('0x25')](function(_0x3028f1){var _0x1742fd=_0x3028f1['statusCode']||0x1f4;logger[_0x22a5('0x32')](_0x22a5('0x26'),_0x22a5('0x3f'),_0x1742fd,JSON[_0x22a5('0x1f')](_0x3028f1));});}function request(_0x533b4d){logger[_0x22a5('0x14')](_0x22a5('0x40'),JSON[_0x22a5('0x1f')](_0x533b4d));return rp(_0x533b4d);}exports[_0x22a5('0x41')]=function(_0x1193d9,_0x4bab76,_0xd00364,_0x413d52,_0x4e2748,_0x4c7196){var _0x2b7db1,_0x3c3265,_0x9815b2,_0x5bf08e;_0x4c7196[_0x22a5('0x1b')]=intUtil['stripTrailingSlash'](_0x4c7196[_0x22a5('0x1b')]);if(_0x4e2748&&_0x4e2748[_0x22a5('0x42')]){logger[_0x22a5('0x14')](_0x22a5('0x43'),_0x22a5('0x44'));_0x4bab76[_0x22a5('0x45')]=util[_0x22a5('0x19')](_0x22a5('0x46'),_0x4c7196[_0x22a5('0x47')],_0x4bab76['uniqueid'],md5(_0x4bab76[_0x22a5('0x48')]));}else{_0x4bab76[_0x22a5('0x45')]='';}return getConnection(_0x4c7196)['then'](function(_0x61fad2){_0x5bf08e=_0x61fad2;return getUser(_0x4c7196,_0x413d52[_0x22a5('0x49')],_0x5bf08e);})['then'](function(_0x588ac8){_0x2b7db1=_0x588ac8;logger[_0x22a5('0x14')](_0x22a5('0x4a'),_0x2b7db1['id']);return getEndUser(_0x4c7196,_0x4bab76[_0x22a5('0x4b')],_0x4bab76['calleridnum'],_0x5bf08e);})[_0x22a5('0x20')](function(_0xf46d20){_0x3c3265=_0xf46d20;logger['info'](_0x22a5('0x4c'),_0x3c3265['id']);return createTicket(_0x4c7196,_0x2b7db1,_0x3c3265,_0xd00364,_0x4bab76,_0xd00364[_0x22a5('0x4d')],_0x5bf08e);})[_0x22a5('0x20')](function(_0x3efc94){_0x9815b2=_0x3efc94;logger[_0x22a5('0x14')](_0x22a5('0x4e'));logger['info'](_0x22a5('0x4f'),_0x9815b2['id']);var _0x12e20=util[_0x22a5('0x19')](_0x22a5('0x50'),_0x4c7196['remoteUri'],_[_0x22a5('0x51')](_0x9815b2['id'],'x')[0x1]);logger['info'](_0x22a5('0x43'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x22a5('0x19')](_0x22a5('0x52'),_0x413d52['name']),_0x22a5('0x53'),{'uri':_0x12e20});})[_0x22a5('0x25')](function(_0x4a1a3f){logger[_0x22a5('0x32')](_0x22a5('0x43'),JSON['stringify'](_0x4a1a3f));});};exports[_0x22a5('0x54')]=function(_0x5e3813,_0x29dea9,_0x2bb585,_0x267601,_0x4f7608,_0x1d7546,_0x4840a4){var _0x1cbb43,_0x15fd10,_0x4e4233,_0xa661d7;_0x1d7546[_0x22a5('0x1b')]=intUtil['stripTrailingSlash'](_0x1d7546[_0x22a5('0x1b')]);_0x1d7546[_0x22a5('0x47')]=intUtil[_0x22a5('0x55')](_0x1d7546[_0x22a5('0x47')]);if(_0x4840a4&&_0x4840a4[_0x22a5('0x56')]&&_0x4840a4[_0x22a5('0x56')]!==_0x22a5('0x57')){logger[_0x22a5('0x14')](_0x22a5('0x58'),_0x22a5('0x44'));_0x29dea9[_0x22a5('0x45')]=util[_0x22a5('0x19')](_0x22a5('0x46'),_0x1d7546[_0x22a5('0x47')],_0x29dea9[_0x22a5('0x48')],md5(_0x29dea9['uniqueid']));}return getConnection(_0x1d7546)[_0x22a5('0x20')](function(_0x2a24d2){_0xa661d7=_0x2a24d2;return getUser(_0x1d7546,_0x267601[_0x22a5('0x49')],_0xa661d7);})[_0x22a5('0x20')](function(_0x2c22aa){_0x1cbb43=_0x2c22aa;logger[_0x22a5('0x14')](_0x22a5('0x4a'),_0x1cbb43['id']);return getEndUser(_0x1d7546,_0x29dea9[_0x22a5('0x59')],_0x29dea9[_0x22a5('0x5a')],_0xa661d7);})[_0x22a5('0x20')](function(_0x223921){_0x15fd10=_0x223921;logger[_0x22a5('0x14')](_0x22a5('0x4c'),_0x15fd10['id']);return createTicket(_0x1d7546,_0x1cbb43,_0x15fd10,_0x2bb585,_0x29dea9,_0x2bb585[_0x22a5('0x4d')],_0xa661d7);})[_0x22a5('0x20')](function(_0x37c2a0){_0x4e4233=_0x37c2a0;logger[_0x22a5('0x14')]('Ticket\x20created!');logger[_0x22a5('0x14')](_0x22a5('0x4f'),_0x4e4233['id']);var _0x44ae0f=util[_0x22a5('0x19')](_0x22a5('0x50'),_0x1d7546['remoteUri'],_[_0x22a5('0x51')](_0x4e4233['id'],'x')[0x1]);logger[_0x22a5('0x14')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x22a5('0x19')](_0x22a5('0x52'),_0x267601[_0x22a5('0x12')]),_0x22a5('0x53'),{'uri':_0x44ae0f});})[_0x22a5('0x25')](function(_0x3da621){logger[_0x22a5('0x32')]('[OUTBOUND]',JSON[_0x22a5('0x1f')](_0x3da621));});};exports['unmanaged']=function(_0x5bb195,_0x5a0686,_0x20bc49,_0x1415cd,_0x5caeba,_0x1ec795){var _0x5dd796,_0x390216,_0x37c2c8,_0x2ffd5d;_0x1ec795['remoteUri']=intUtil[_0x22a5('0x55')](_0x1ec795[_0x22a5('0x1b')]);_0x1ec795[_0x22a5('0x47')]=intUtil[_0x22a5('0x55')](_0x1ec795[_0x22a5('0x47')]);if(_0x5caeba&&_0x5caeba['monitor_format']){logger[_0x22a5('0x14')]('['+_0x5a0686[_0x22a5('0x5b')][_0x22a5('0x5c')]()+']',_0x22a5('0x44'));_0x5a0686[_0x22a5('0x45')]=util[_0x22a5('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1ec795[_0x22a5('0x47')],_0x5a0686[_0x22a5('0x48')],md5(_0x5a0686[_0x22a5('0x48')]));}else{_0x5a0686[_0x22a5('0x45')]='';}return getConnection(_0x1ec795)[_0x22a5('0x20')](function(_0x2b40a7){_0x2ffd5d=_0x2b40a7;return getUser(_0x1ec795,'',_0x2ffd5d);})[_0x22a5('0x20')](function(_0x2627ea){_0x5dd796=_0x2627ea;logger[_0x22a5('0x14')](_0x22a5('0x4a'),_0x5dd796['id']);return getEndUser(_0x1ec795,_0x5a0686['calleridname'],_0x5a0686[_0x22a5('0x5d')],_0x2ffd5d);})[_0x22a5('0x20')](function(_0x9c07e2){_0x390216=_0x9c07e2;logger['info']('The\x20Enduser\x20ID\x20is:',_0x390216['id']);return createTicket(_0x1ec795,_0x5dd796,_0x390216,_0x20bc49,_0x5a0686,_0x20bc49[_0x22a5('0x4d')],_0x2ffd5d);})[_0x22a5('0x20')](function(_0x45768e){_0x37c2c8=_0x45768e;logger[_0x22a5('0x14')](_0x22a5('0x4e'));logger[_0x22a5('0x14')](_0x22a5('0x4f'),_0x37c2c8['id']);})[_0x22a5('0x25')](function(_0x3c3b9a){logger[_0x22a5('0x32')]('['+_0x5a0686[_0x22a5('0x5b')][_0x22a5('0x5c')]()+']',JSON['stringify'](_0x3c3b9a));});}; \ 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 14012f0..e6d8828 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 _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 +var _0x982c=['content','string','idField','customField','push','variableName','custom_fields','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','\x20Error\x20running\x20Zendesk\x20integration','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','token','%s/token:%s','username','toString','[HTTP]','GET','map','forEach','type','nameField'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x982c,0x1e1));var _0xc982=function(_0x8f33b0,_0x824f0b){_0x8f33b0=_0x8f33b0-0x0;var _0x207208=_0x982c[_0x8f33b0];return _0x207208;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xc982('0x0'));var util=require(_0xc982('0x1'));var Redis=require(_0xc982('0x2'));var intUtil=require(_0xc982('0x3'));var config=require(_0xc982('0x4'));var logger=require(_0xc982('0x5'))(_0xc982('0x6'));config['redis']=_[_0xc982('0x7')](config[_0xc982('0x8')],{'host':_0xc982('0x9'),'port':0x18eb});var io=require(_0xc982('0xa'))(new Redis(config[_0xc982('0x8')]));function emit(_0x5be803,_0x45c6f4,_0x3f0e68){io['to'](_0x5be803)[_0xc982('0xb')](_0x45c6f4,_0x3f0e68);}var headers={'Content-Type':'application/json','Accept':_0xc982('0xc')};function getTicket(_0x1a6390,_0x30110e,_0x5d5c57,_0x116111,_0x7adeb8){logger[_0xc982('0xd')](_0xc982('0xe'));return request({'uri':util[_0xc982('0xf')](_0xc982('0x10'),_0x1a6390[_0xc982('0x11')]),'method':'POST','body':{'ticket':_[_0xc982('0x12')]({'requester_id':_0x5d5c57['id'],'submitter_id':_0x30110e?_0x30110e['id']:undefined,'assignee_id':_0x30110e?_0x30110e['id']:undefined,'tags':getTags(_0x116111['Tags'],_0xc982('0x13')),'subject':intUtil[_0xc982('0x14')](_0x116111[_0xc982('0x15')],_0x7adeb8,'\x20'),'description':intUtil[_0xc982('0x14')](_0x116111[_0xc982('0x16')],_0x7adeb8,'\x0a'),'comment':{'public':![],'body':intUtil[_0xc982('0x14')](_0x116111['Descriptions'],_0x7adeb8,'\x0a')}},getCustomFields(_0x116111['Fields'],_0x7adeb8))}})[_0xc982('0x17')](function(_0x243f64){logger[_0xc982('0xd')](_0xc982('0x18'));return _0x243f64[_0xc982('0x19')];});}function getUser(_0x228c74,_0x23182f){if(intUtil[_0xc982('0x1a')](_0x23182f)){logger[_0xc982('0xd')](_0xc982('0x1b'),_0x23182f);return request({'uri':util['format'](_0xc982('0x1c'),_0x228c74[_0xc982('0x11')]),'qs':{'query':util[_0xc982('0xf')](_0xc982('0x1d'),_0x23182f)}})[_0xc982('0x17')](function(_0x389947){if(_0x389947[_0xc982('0x1e')]){logger[_0xc982('0xd')]('Agent\x20found!');return _[_0xc982('0x1f')](_0x389947[_0xc982('0x20')],{'email':_0x23182f,'role':'agent'});}else{logger[_0xc982('0xd')](_0xc982('0x21'));return request({'uri':util[_0xc982('0xf')](_0xc982('0x22'),_0x228c74[_0xc982('0x11')])})[_0xc982('0x17')](function(_0x177d90){logger[_0xc982('0xd')](_0xc982('0x23'));return _0x177d90[_0xc982('0x24')];});}});}else{logger[_0xc982('0xd')](_0xc982('0x21'));return request({'uri':util['format']('%s/users/me.json',_0x228c74[_0xc982('0x11')])})[_0xc982('0x17')](function(_0x1b785d){logger[_0xc982('0xd')](_0xc982('0x23'));return _0x1b785d[_0xc982('0x24')];});}}function getEndUser(_0x4836cd,_0xd95c24,_0x812fb1){logger[_0xc982('0xd')](_0xc982('0x25'),_0x812fb1);return request({'uri':util[_0xc982('0xf')](_0xc982('0x1c'),_0x4836cd[_0xc982('0x11')]),'qs':{'query':util['format'](_0xc982('0x26'),_0x812fb1)}})['then'](function(_0x2a488c){var _0x2b2af5;if(_0x2a488c[_0xc982('0x20')]['length']){_0x2a488c[_0xc982('0x20')]=_[_0xc982('0x27')](_0x2a488c[_0xc982('0x20')],{'suspended':![],'role':_0xc982('0x28')});if(_0x2a488c['results'][_0xc982('0x29')]){_0x2b2af5=_[_0xc982('0x2a')](_0x2a488c[_0xc982('0x20')]);}}if(_0x2b2af5){logger[_0xc982('0xd')](_0xc982('0x2b'));return _0x2b2af5;}else{logger['info'](_0xc982('0x2c'));return request({'uri':util[_0xc982('0xf')]('%s/users.json',_0x4836cd[_0xc982('0x11')]),'method':_0xc982('0x2d'),'body':{'user':{'role':_0xc982('0x28'),'name':util[_0xc982('0xf')](_0xc982('0x2e'),_0xd95c24||_0x812fb1),'phone':_0x812fb1}}})[_0xc982('0x17')](function(_0x2eac83){logger[_0xc982('0xd')](_0xc982('0x2f'));return _0x2eac83['user'];});}});}function getAuth(_0x169c61){var _0x20ea0b;if(_0x169c61[_0xc982('0x30')]==='password'){_0x20ea0b=util[_0xc982('0xf')]('%s:%s',_0x169c61['username'],_0x169c61['password']);}else if(_0x169c61[_0xc982('0x30')]===_0xc982('0x31')){_0x20ea0b=util['format'](_0xc982('0x32'),_0x169c61[_0xc982('0x33')],_0x169c61[_0xc982('0x31')]);}return util[_0xc982('0xf')]('Basic\x20%s',new Buffer(_0x20ea0b)[_0xc982('0x34')]('base64'));}function request(_0x2af520){logger['debug'](_0xc982('0x35'),JSON['stringify'](_0x2af520));return rp(_[_0xc982('0x7')](_0x2af520,{'method':_0xc982('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x1cf8fc,_0x2d7276){var _0x2db06e=[];if(_0x1cf8fc&&_0x1cf8fc[_0xc982('0x29')]>0x0){_0x2db06e=_[_0xc982('0x37')](_0x1cf8fc,_0x2d7276);}return _0x2db06e;}function getCustomFields(_0xa208e1,_0x37cfba){var _0x2a1fd6=[];var _0x2b5dd3={'custom_fields':[]};if(_0xa208e1[_0xc982('0x29')]>0x0){_[_0xc982('0x38')](_0xa208e1,function(_0x4b596c){if(_0x4b596c[_0xc982('0x39')]==='string'&&_0x4b596c[_0xc982('0x3a')]&&!_0x4b596c['customField']){_0x2b5dd3[_0x4b596c[_0xc982('0x3a')]['toLowerCase']()]=_0x4b596c[_0xc982('0x3b')][_0xc982('0x34')]();}else if(_0x4b596c[_0xc982('0x39')]===_0xc982('0x3c')&&_0x4b596c[_0xc982('0x3d')]&&_0x4b596c[_0xc982('0x3e')]){_0x2b5dd3['custom_fields'][_0xc982('0x3f')]({'id':_0x4b596c['idField'],'value':_0x4b596c[_0xc982('0x3b')][_0xc982('0x34')]()});}else if(_0x4b596c[_0xc982('0x39')]==='variable'&&_0x4b596c[_0xc982('0x40')]&&_0x4b596c[_0xc982('0x3d')]&&_0x4b596c['customField']){_0x37cfba[_0x4b596c[_0xc982('0x40')]]&&_0x2b5dd3[_0xc982('0x41')][_0xc982('0x3f')]({'id':_0x4b596c[_0xc982('0x3d')],'value':_0x37cfba[_0x4b596c['variableName']][_0xc982('0x34')]()});}else if(_0x4b596c[_0xc982('0x39')]===_0xc982('0x42')&&_0x4b596c[_0xc982('0x43')]&&_0x4b596c['Variable'][_0xc982('0x13')]&&_0x4b596c[_0xc982('0x3d')]&&_0x4b596c[_0xc982('0x3e')]){_0x37cfba[_0x4b596c[_0xc982('0x43')][_0xc982('0x13')][_0xc982('0x44')]()]&&_0x2b5dd3[_0xc982('0x41')][_0xc982('0x3f')]({'id':_0x4b596c[_0xc982('0x3d')],'value':_0x37cfba[_0x4b596c['Variable'][_0xc982('0x13')][_0xc982('0x44')]()][_0xc982('0x34')]()});}});}return _0x2b5dd3;}exports[_0xc982('0x45')]=function(_0x2cd43f,_0x5b5bcd,_0x307a42,_0x5970bd,_0x3e3142,_0x143b87){var _0x2992c5,_0x35c052;_0x143b87[_0xc982('0x11')]=intUtil['stripTrailingSlash'](_0x143b87['remoteUri']);_0x143b87['serverUrl']=intUtil[_0xc982('0x46')](_0x143b87[_0xc982('0x47')]);if(_0x3e3142&&_0x3e3142['monitor_format']){logger['info'](_0xc982('0x48'),_0xc982('0x49'));_0x5b5bcd['recordingURL']=util[_0xc982('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x143b87['serverUrl'],_0x5b5bcd[_0xc982('0x4a')],md5(_0x5b5bcd[_0xc982('0x4a')]));}else{_0x5b5bcd[_0xc982('0x4b')]='';}headers[_0xc982('0x4c')]=getAuth(_0x143b87);return getUser(_0x143b87,_0x5970bd[_0xc982('0x4d')])[_0xc982('0x17')](function(_0x527150){_0x2992c5=_0x527150;logger[_0xc982('0xd')](_0xc982('0x4e'),_0x2992c5['id']);return getEndUser(_0x143b87,_0x5b5bcd[_0xc982('0x4f')],_0x5b5bcd[_0xc982('0x50')]);})[_0xc982('0x17')](function(_0x1c7bf1){_0x35c052=_0x1c7bf1;logger[_0xc982('0xd')]('The\x20Enduser\x20ID\x20is:',_0x35c052['id']);return getTicket(_0x143b87,_0x2992c5,_0x35c052,_0x307a42,_0x5b5bcd);})[_0xc982('0x17')](function(_0x21044c){if(_0x21044c){logger[_0xc982('0xd')](_0xc982('0x51'),_0x21044c['id']);switch(_0x143b87['type']){case _0xc982('0x52'):logger[_0xc982('0xd')]('[QUEUE]',_0xc982('0x53'));return request({'uri':util[_0xc982('0xf')](_0xc982('0x54'),_0x143b87[_0xc982('0x11')],_0x2992c5['id'],_0x21044c['id']),'method':_0xc982('0x2d')});case _0xc982('0x55'):logger[_0xc982('0xd')](_0xc982('0x48'),_0xc982('0x56'));emit(util[_0xc982('0xf')]('user:%s',_0x5970bd[_0xc982('0x13')]),_0xc982('0x57'),{'uri':util[_0xc982('0xf')](_0xc982('0x58'),_0x143b87[_0xc982('0x11')][_0xc982('0x59')](_0xc982('0x5a'),''),_0x21044c['id'])});break;default:logger['error'](_0xc982('0x48'),_0xc982('0x5b'));}}})[_0xc982('0x5c')](function(_0x42c759){logger[_0xc982('0x5d')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xc982('0x5e')](_0x42c759,{'showHidden':!![],'depth':null}));});};exports[_0xc982('0x5f')]=function(_0x4dabe3,_0x4f5f29,_0x5a7bfc,_0x356134,_0x53d129,_0x249e9e,_0x25d3bf){var _0x59d8f3,_0x47994b;_0x249e9e['remoteUri']=intUtil['stripTrailingSlash'](_0x249e9e[_0xc982('0x11')]);_0x249e9e[_0xc982('0x47')]=intUtil[_0xc982('0x46')](_0x249e9e[_0xc982('0x47')]);if(_0x25d3bf&&_0x25d3bf[_0xc982('0x60')]&&_0x25d3bf[_0xc982('0x60')]!==_0xc982('0x61')){logger[_0xc982('0xd')](_0xc982('0x62'),'Recording\x20is\x20enabled!');_0x4f5f29[_0xc982('0x4b')]=util[_0xc982('0xf')](_0xc982('0x63'),_0x249e9e[_0xc982('0x47')],_0x4f5f29[_0xc982('0x4a')],md5(_0x4f5f29[_0xc982('0x4a')]));}headers['Authorization']=getAuth(_0x249e9e);return getUser(_0x249e9e,_0x356134[_0xc982('0x4d')])[_0xc982('0x17')](function(_0x1443a8){_0x59d8f3=_0x1443a8;logger['info'](_0xc982('0x4e'),_0x59d8f3['id']);return getEndUser(_0x249e9e,_0x4f5f29[_0xc982('0x64')],_0x4f5f29[_0xc982('0x65')]);})[_0xc982('0x17')](function(_0x3cd257){_0x47994b=_0x3cd257;logger[_0xc982('0xd')](_0xc982('0x66'),_0x47994b['id']);return getTicket(_0x249e9e,_0x59d8f3,_0x47994b,_0x5a7bfc,_0x4f5f29);})[_0xc982('0x17')](function(_0x298f90){if(_0x298f90){logger[_0xc982('0xd')](_0xc982('0x51'),_0x298f90['id']);switch(_0x249e9e[_0xc982('0x39')]){case _0xc982('0x52'):logger[_0xc982('0xd')]('[OUTBOUND]',_0xc982('0x53'));return request({'uri':util['format'](_0xc982('0x54'),_0x249e9e[_0xc982('0x11')],_0x59d8f3['id'],_0x298f90['id']),'method':_0xc982('0x2d')});case _0xc982('0x55'):logger['info']('[OUTBOUND]',_0xc982('0x56'));emit(util[_0xc982('0xf')]('user:%s',_0x356134[_0xc982('0x13')]),_0xc982('0x57'),{'uri':util[_0xc982('0xf')](_0xc982('0x58'),_0x249e9e[_0xc982('0x11')][_0xc982('0x59')]('/api/v2',''),_0x298f90['id'])});break;default:logger[_0xc982('0x5d')](_0xc982('0x62'),_0xc982('0x5b'));}}})[_0xc982('0x5c')](function(_0x4d55b3){logger[_0xc982('0x5d')](_0xc982('0x67'),util[_0xc982('0x5e')](_0x4d55b3,{'showHidden':!![],'depth':null}));});};exports[_0xc982('0x68')]=function(_0x2b67d1,_0x4fd182,_0x1aae01,_0xcde30b,_0x17f1fd,_0x5a5c10){var _0x28976d,_0x56e679;_0x5a5c10['remoteUri']=intUtil[_0xc982('0x46')](_0x5a5c10[_0xc982('0x11')]);_0x5a5c10[_0xc982('0x47')]=intUtil[_0xc982('0x46')](_0x5a5c10[_0xc982('0x47')]);if(_0x17f1fd&&_0x17f1fd[_0xc982('0x69')]){logger[_0xc982('0xd')]('['+_0x4fd182[_0xc982('0x6a')]['toUpperCase']()+']',_0xc982('0x49'));_0x4fd182[_0xc982('0x4b')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5a5c10[_0xc982('0x47')],_0x4fd182[_0xc982('0x4a')],md5(_0x4fd182[_0xc982('0x4a')]));}else{_0x4fd182['recordingURL']='';}headers[_0xc982('0x4c')]=getAuth(_0x5a5c10);return getUser(_0x5a5c10)[_0xc982('0x17')](function(_0x1f9e78){_0x28976d=_0x1f9e78;logger[_0xc982('0xd')](_0xc982('0x4e'),_0x28976d['id']);return getEndUser(_0x5a5c10,_0x4fd182['calleridname'],_0x4fd182[_0xc982('0x50')]);})[_0xc982('0x17')](function(_0x23d95b){_0x56e679=_0x23d95b;logger['info']('The\x20Enduser\x20ID\x20is:',_0x56e679['id']);return getTicket(_0x5a5c10,_0x28976d,_0x56e679,_0x1aae01,_0x4fd182);})['then'](function(_0x5681df){if(_0x5681df){logger[_0xc982('0xd')](_0xc982('0x51'),_0x5681df['id']);}})[_0xc982('0x5c')](function(_0x15ecef){logger[_0xc982('0x5d')]('['+_0x4fd182[_0xc982('0x6a')]['toUpperCase']()+']'+_0xc982('0x6b'),util[_0xc982('0x5e')](_0x15ecef,{'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 dea4496..b8bd5de 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 _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 +var _0x7582=['outbound','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','SUCCESS','err','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','host','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','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','none','[OUTBOUND]','uniqueid','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','unmanaged','toUpperCase','/api/voice/recordings/','request-promise','md5','util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','socket.io-emitter','emit','debug','[HTTP]','length','forEach','type','content','toString','variable','variableName','idField','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','refreshToken','clientId','clientSecret','refresh_token','then','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','profile','Administrator','user','Using\x20the\x20admin\x20account!','error','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','POST','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','data','code','details','enduserType','startCase','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','Leads','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','What_Id','First_Name','Last_Name','$se_module','Call_Duration','utc','talktime','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time'];(function(_0x15f94f,_0x146f29){var _0x13f182=function(_0x250937){while(--_0x250937){_0x15f94f['push'](_0x15f94f['shift']());}};_0x13f182(++_0x146f29);}(_0x7582,0x167));var _0x2758=function(_0x5be795,_0x1cb1b8){_0x5be795=_0x5be795-0x0;var _0x4e8a3b=_0x7582[_0x5be795];return _0x4e8a3b;};'use strict';var _=require('lodash');var rp=require(_0x2758('0x0'));var md5=require(_0x2758('0x1'));var util=require(_0x2758('0x2'));var intUtil=require('./util');var moment=require(_0x2758('0x3'));var Redis=require('ioredis');var BPromise=require(_0x2758('0x4'));var config=require(_0x2758('0x5'));var logger=require(_0x2758('0x6'))(_0x2758('0x7'));config['redis']=_[_0x2758('0x8')](config[_0x2758('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x2758('0xa'))(new Redis(config[_0x2758('0x9')]));function emit(_0x556f88,_0x32a69c,_0x17af0b){io['to'](_0x556f88)[_0x2758('0xb')](_0x32a69c,_0x17af0b);}function request(_0x505c46){logger[_0x2758('0xc')](_0x2758('0xd'),JSON['stringify'](_0x505c46));return rp(_0x505c46);}function getCustomFields(_0x51fd3c,_0x32cf1a){var _0x1a9a45={};if(_0x51fd3c[_0x2758('0xe')]>0x0){_[_0x2758('0xf')](_0x51fd3c,function(_0x36cefd){if(_0x36cefd[_0x2758('0x10')]==='string'&&_0x36cefd['idField']){_0x1a9a45[_0x36cefd['idField']]=_0x36cefd[_0x2758('0x11')][_0x2758('0x12')]();}else if(_0x36cefd[_0x2758('0x10')]===_0x2758('0x13')&&_0x36cefd[_0x2758('0x14')]&&_0x36cefd[_0x2758('0x15')]&&_0x32cf1a[_0x36cefd[_0x2758('0x14')]]){_0x1a9a45[_0x36cefd[_0x2758('0x15')]]=_0x32cf1a[_0x36cefd[_0x2758('0x14')]][_0x2758('0x12')]();}else if(_0x36cefd[_0x2758('0x10')]===_0x2758('0x16')&&_0x36cefd[_0x2758('0x17')]&&_0x36cefd[_0x2758('0x17')]['name']&&_0x36cefd['idField']&&_0x32cf1a[_0x36cefd['Variable'][_0x2758('0x18')][_0x2758('0x19')]()]){_0x1a9a45[_0x36cefd[_0x2758('0x15')]]=_0x32cf1a[_0x36cefd[_0x2758('0x17')][_0x2758('0x18')][_0x2758('0x19')]()]['toString']();}});}return _0x1a9a45;}function getName(_0x15f7b7){if(_0x15f7b7[_0x2758('0x1a')]('\x20')>0x0){var _0x596ca1=_0x15f7b7[_0x2758('0x1b')](/ (.+)/);if(_0x596ca1[0x1]){return _0x596ca1;}}return[_0x15f7b7,_0x15f7b7];}var accountsTokens={};function getAccessToken(_0x1cdc63){return new Promise(function(_0x8cfe47,_0x4100a0){if(!_['isNil'](accountsTokens[_0x1cdc63['id']])&&!_[_0x2758('0x1c')](accountsTokens[_0x1cdc63['id']]['access_token'])){if(moment()[_0x2758('0x1d')](accountsTokens[_0x1cdc63['id']][_0x2758('0x1e')])){_0x8cfe47(accountsTokens[_0x1cdc63['id']][_0x2758('0x1f')]);}}var _0x2797fe;switch(_0x1cdc63[_0x2758('0x20')]){case'US':_0x2797fe=_0x2758('0x21');break;case'AU':_0x2797fe=_0x2758('0x22');break;case'EU':_0x2797fe=_0x2758('0x23');break;case'IN':_0x2797fe=_0x2758('0x24');break;case'CN':_0x2797fe=_0x2758('0x25');break;default:_0x2797fe=_0x2758('0x23');break;}var _0x43e8ef={'method':'POST','uri':_0x2797fe+'/oauth/v2/token','qs':{'refresh_token':_0x1cdc63[_0x2758('0x26')],'client_id':_0x1cdc63[_0x2758('0x27')],'client_secret':_0x1cdc63[_0x2758('0x28')],'grant_type':_0x2758('0x29')},'json':!![]};return rp(_0x43e8ef)[_0x2758('0x2a')](function(_0x38f67d){accountsTokens[_0x1cdc63['id']]={'access_token':_0x38f67d['access_token'],'expires_in':moment()['add'](_0x38f67d[_0x2758('0x1e')],_0x2758('0x2b'))};_0x8cfe47(_0x38f67d[_0x2758('0x1f')]);})[_0x2758('0x2c')](function(_0x4d96d5){logger['error'](_0x2758('0x2d'),_0x4d96d5[_0x2758('0x2e')]);_0x4100a0(_0x4d96d5);});});}function getUser(_0x46498b,_0x5179ef,_0x1d5f88,_0x4b20ee){logger[_0x2758('0x2f')](_0x2758('0x30'));return request({'method':_0x2758('0x31'),'uri':util[_0x2758('0x32')](_0x2758('0x33'),_0x5179ef),'qs':{'type':_0x2758('0x34')},'headers':{'Authorization':_0x2758('0x35')+_0x46498b},'json':!![]})[_0x2758('0x2a')](function(_0x225f6f){if(_0x225f6f[_0x2758('0x36')]){var _0x4f48f9=-0x1;if(_[_0x2758('0x37')](_0x225f6f[_0x2758('0x36')])){if(!_[_0x2758('0x1c')](_0x4b20ee)){_0x4f48f9=_[_0x2758('0x38')](_0x225f6f['users'],function(_0x5f105f){return _0x5f105f[_0x2758('0x39')]===_0x4b20ee;});}if(_0x4f48f9>=0x0){logger[_0x2758('0x2f')]('Agent\x20found!');}else{logger[_0x2758('0x2f')]('Using\x20the\x20admin\x20account!');_0x4f48f9=_[_0x2758('0x38')](_0x225f6f['users'],function(_0x2952ad){return _0x2952ad[_0x2758('0x3a')]['name']===_0x2758('0x3b');});}return _0x225f6f[_0x2758('0x36')][_0x4f48f9];}else{if(_0x225f6f[_0x2758('0x3c')][_0x2758('0x3a')][_0x2758('0x18')]===_0x2758('0x3b')){logger[_0x2758('0x2f')](_0x2758('0x3d'));user=_0x225f6f['user'];return user;}else{logger[_0x2758('0x3e')](_0x2758('0x3f'),JSON[_0x2758('0x40')](_0x225f6f));throw new Error(_0x2758('0x41')+JSON[_0x2758('0x40')](_0x225f6f));}}}else{logger[_0x2758('0x3e')](_0x2758('0x3f'),JSON[_0x2758('0x40')](_0x225f6f));throw new Error(_0x2758('0x41')+JSON['stringify'](_0x225f6f));}})['catch'](function(_0x162244){console[_0x2758('0x3e')](_0x162244);});}function getZohoUser(_0x25d115,_0x2c3aab){return new BPromise(function(_0x40e2a5,_0x33c595){request(_0x25d115)['then'](function(_0x2c3acf){var _0x22be65=null;if(_0x2c3acf){_0x22be65=_0x2c3acf['data'][0x0];_0x22be65['enduserType']=_0x2c3aab;}_0x40e2a5(_0x22be65);})['catch'](function(_0x17fa30){_0x33c595(_0x17fa30);});});}function createEndUser(_0x30f463,_0x1c4c0d,_0x44d6e5,_0x564462,_0x345e02,_0x914b53){var _0x44d6e5=getName(_0x44d6e5);return request({'method':_0x2758('0x42'),'uri':_0x2758('0x43')+_0x1c4c0d+_0x2758('0x44')+_['startCase'](_0x914b53[_0x2758('0x45')])+'s','body':{'data':[{'Last_Name':_0x44d6e5[0x1],'First_Name':_0x44d6e5[0x0],'Phone':_0x564462,'Owner':{'name':!_[_0x2758('0x1c')](_0x345e02[_0x2758('0x46')][_0x2758('0x18')])?_0x345e02[_0x2758('0x46')][_0x2758('0x18')]:!_[_0x2758('0x1c')](_0x345e02[_0x2758('0x47')])?_0x345e02[_0x2758('0x47')]+'\x20'+_0x345e02['last_name']:_0x345e02['last_name'],'id':_0x345e02['id']}}]},'headers':{'Authorization':_0x2758('0x35')+_0x30f463},'json':!![]})[_0x2758('0x2a')](function(_0x562b0b){if(_0x562b0b&&_0x562b0b[_0x2758('0x48')][0x0][_0x2758('0x49')]==='SUCCESS'){var _0x86c3a8=_0x562b0b[_0x2758('0x48')][0x0][_0x2758('0x4a')];_0x86c3a8[_0x2758('0x4b')]=_[_0x2758('0x4c')](_0x914b53['moduleCreate'])+'s';return _0x86c3a8;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x2758('0x40')](data));throw new Error(_0x2758('0x4d')+JSON[_0x2758('0x40')](data));})[_0x2758('0x2c')](function(_0x336cf7){console[_0x2758('0x4e')](_0x2758('0x4f'),_0x336cf7);});}function getEndUser(_0x375020,_0x4da662,_0x57f265,_0xf1539c,_0x4e7365,_0xcc9538,_0x4ffcff){var _0x4f0fe5={'method':_0x2758('0x31'),'uri':'','headers':{'Authorization':_0x2758('0x35')+_0x375020},'json':!![]};switch(_0x4ffcff['moduleSearch']){case _0x2758('0x50'):_0x4f0fe5[_0x2758('0x51')]=_0x2758('0x43')+_0x4da662+_0x2758('0x52')+_0x4e7365+'))';return getZohoUser(_0x4f0fe5,_0x2758('0x53'))[_0x2758('0x2a')](function(_0x2ad215){if(_0x2ad215)return _0x2ad215;_0x4f0fe5[_0x2758('0x51')]=_0x2758('0x43')+_0x4da662+_0x2758('0x54')+_0x4e7365+'))';return getZohoUser(_0x4f0fe5,'Leads')['then'](function(_0x23e880){if(_0x23e880)return _0x23e880;if(_0x4ffcff[_0x2758('0x45')]!=_0x2758('0x55')){return createEndUser(_0x375020,_0x4da662,_0xf1539c,_0x4e7365,_0xcc9538,_0x4ffcff);}else{return{};}});});break;case _0x2758('0x56'):_0x4f0fe5[_0x2758('0x51')]='https://www.zohoapis.'+_0x4da662+_0x2758('0x52')+_0x4e7365+'))';return getZohoUser(_0x4f0fe5,'Contacts')[_0x2758('0x2a')](function(_0x264a11){if(_0x264a11)return _0x264a11;if(_0x4ffcff[_0x2758('0x45')]!=_0x2758('0x55')){return createEndUser(_0x375020,_0x4da662,_0xf1539c,_0x4e7365,_0xcc9538,_0x4ffcff);}else{return{};}});break;case _0x2758('0x57'):_0x4f0fe5['uri']=_0x2758('0x43')+_0x4da662+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4e7365+'))';return getZohoUser(_0x4f0fe5,_0x2758('0x58'))[_0x2758('0x2a')](function(_0x514e96){if(_0x514e96)return _0x514e96;if(_0x4ffcff[_0x2758('0x45')]!=_0x2758('0x55')){return createEndUser(_0x375020,_0x4da662,_0xf1539c,_0x4e7365,_0xcc9538,_0x4ffcff);}else{return{};}});break;}}function getCall(_0x1c2e2c,_0x1ff3b2,_0x20649c,_0x2b0366,_0x2496bc,_0x5ced39,_0x287f16,_0xa72f96){logger[_0x2758('0x2f')]('Creating\x20new\x20call...');var _0x5b1b01={};_0x5b1b01[_0x2758('0x59')]={'name':!_[_0x2758('0x1c')](_0x2b0366[_0x2758('0x46')]['name'])&&!_[_0x2758('0x1c')](_0x2b0366[_0x2758('0x3a')]['name'])&&_0x2b0366[_0x2758('0x3a')][_0x2758('0x18')]===_0x2758('0x5a')?_0x2b0366['role'][_0x2758('0x18')]:!_[_0x2758('0x1c')](_0x2b0366[_0x2758('0x47')])?_0x2b0366[_0x2758('0x47')]+'\x20'+_0x2b0366['last_name']:_0x2b0366['last_name'],'id':_0x2b0366['id']};_0x5b1b01[_0x2758('0x5b')]=intUtil[_0x2758('0x5c')](_0x5ced39[_0x2758('0x5d')],_0x287f16,'\x20');_0x5b1b01[_0x2758('0x5e')]=intUtil[_0x2758('0x5c')](_0x5ced39[_0x2758('0x5f')],_0x287f16,'\x0a');if(_0x2496bc[_0x2758('0x4b')]==='Contacts'){_0x5b1b01[_0x2758('0x60')]={'name':!_[_0x2758('0x1c')](_0x2496bc[_0x2758('0x61')])?_0x2496bc[_0x2758('0x61')]:!_[_0x2758('0x1c')](_0x2496bc['First_Name'])?_0x2496bc['First_Name']+'\x20'+_0x2496bc['Last_Name']:_0x2496bc['Last_Name'],'id':_0x2496bc['id']};}if(_0x2496bc['enduserType']===_0x2758('0x58')){_0x5b1b01[_0x2758('0x62')]={'name':!_['isNil'](_0x2496bc[_0x2758('0x61')])?_0x2496bc[_0x2758('0x61')]:!_[_0x2758('0x1c')](_0x2496bc['First_Name'])?_0x2496bc[_0x2758('0x63')]+'\x20'+_0x2496bc[_0x2758('0x64')]:_0x2496bc[_0x2758('0x64')],'id':_0x2496bc['id']};_0x5b1b01[_0x2758('0x65')]=_['startCase'](_0x2496bc['enduserType']);}if(_0x287f16['talktime']){_0x5b1b01[_0x2758('0x66')]=moment[_0x2758('0x67')](parseInt(_0x287f16[_0x2758('0x68')])*0x3e8)[_0x2758('0x32')]('mm:ss');}else if(_0x287f16[_0x2758('0x69')]&&_0x287f16[_0x2758('0x6a')]){_0x5b1b01[_0x2758('0x66')]=moment['utc'](moment(_0x287f16[_0x2758('0x6a')],_0x2758('0x6b'))[_0x2758('0x6c')](moment(_0x287f16[_0x2758('0x6d')],'YYYY-MM-DDTHH:mm:ss')))[_0x2758('0x32')](_0x2758('0x6e'));}switch(_0x287f16[_0x2758('0x6f')]){case _0x2758('0x70'):_0x5b1b01[_0x2758('0x71')]=_0x2758('0x72');break;case _0x2758('0x73'):case _0x2758('0x74'):_0x5b1b01[_0x2758('0x71')]=_0x2758('0x75');break;case _0x2758('0x76'):_0x5b1b01[_0x2758('0x71')]=_0x2758('0x77');break;case _0x2758('0x78'):_0x5b1b01[_0x2758('0x71')]='Abandoned';break;case _0x2758('0x79'):_0x5b1b01[_0x2758('0x71')]=_0x2758('0x7a');default:}_0x5b1b01[_0x2758('0x7b')]=(_0xa72f96===_0x2758('0x7c')?moment(_0x287f16['starttime'])[_0x2758('0x32')](_0x2758('0x6b')):moment(_0x287f16[_0x2758('0x7d')])[_0x2758('0x32')](_0x2758('0x6b')))||moment()[_0x2758('0x32')](_0x2758('0x6b'));_0x5b1b01['Call_Type']=_0xa72f96||_0x2758('0x7e');_0x5b1b01=_[_0x2758('0x7f')](_0x5b1b01,getCustomFields(_0x5ced39[_0x2758('0x80')],_0x287f16));return request({'method':_0x2758('0x42'),'uri':_0x2758('0x43')+_0x1ff3b2+_0x2758('0x81'),'headers':{'Authorization':_0x2758('0x35')+_0x1c2e2c},'body':{'data':[_0x5b1b01]},'json':!![]})[_0x2758('0x2a')](function(_0x4d739c){if(_0x4d739c&&_0x4d739c[_0x2758('0x48')][0x0][_0x2758('0x49')]===_0x2758('0x82')){logger[_0x2758('0x2f')]('Call\x20created!');return{'id':_0x4d739c[_0x2758('0x48')][0x0][_0x2758('0x4a')]['id']};}})['catch'](function(_0x7e53c3){logger[_0x2758('0x2f')]('err',_0x7e53c3[_0x2758('0x2e')]);console[_0x2758('0x4e')](_0x2758('0x83'),_0x7e53c3);});}exports[_0x2758('0x84')]=function(_0x56a84c,_0x134c04,_0x4a65ef,_0x54d466,_0x4538ed,_0x3e5f5f){var _0x1c3cc2,_0x21d601,_0x4191c3;_0x3e5f5f['host']=intUtil[_0x2758('0x85')](_0x3e5f5f['host']);_0x3e5f5f[_0x2758('0x86')]=intUtil[_0x2758('0x85')](_0x3e5f5f[_0x2758('0x86')]);if(_0x4538ed&&_0x4538ed[_0x2758('0x87')]){logger[_0x2758('0x2f')](_0x2758('0x88'),_0x2758('0x89'));_0x134c04[_0x2758('0x8a')]=_0x3e5f5f['serverUrl']+'/api/voice/recordings/'+_0x134c04['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x134c04['uniqueid']);}else{_0x134c04[_0x2758('0x8a')]='';}var _0x3f4eaf=_0x3e5f5f[_0x2758('0x8b')]===_0x2758('0x8c')?'eu':_0x2758('0x8d');return getAccessToken(_0x3e5f5f)[_0x2758('0x2a')](function(_0x3ccffc){_0x4191c3=_0x3ccffc;return getUser(_0x4191c3,_0x3f4eaf,_0x3e5f5f,_0x54d466[_0x2758('0x39')]);})['then'](function(_0x1cdb9e){_0x1c3cc2=_0x1cdb9e;logger[_0x2758('0x2f')](_0x2758('0x8e'),_0x1c3cc2['id']);return getEndUser(_0x4191c3,_0x3f4eaf,_0x3e5f5f,_0x134c04[_0x2758('0x8f')],_0x134c04[_0x2758('0x90')],_0x1c3cc2,_0x4a65ef);})[_0x2758('0x2a')](function(_0x217724){_0x21d601=_0x217724;return getCall(_0x4191c3,_0x3f4eaf,_0x3e5f5f,_0x1c3cc2,_0x21d601,_0x4a65ef,_0x134c04,_0x2758('0x7e'));})[_0x2758('0x2a')](function(_0x1b72d5){if(_0x1b72d5){logger[_0x2758('0x2f')](_0x2758('0x91'),_0x1b72d5['id']);logger[_0x2758('0x2f')]('[QUEUE]',_0x2758('0x92'));emit(util[_0x2758('0x32')](_0x2758('0x93'),_0x54d466['name']),_0x2758('0x94'),{'uri':_0x2758('0x95')+_0x3e5f5f[_0x2758('0x8b')]+_0x2758('0x96')+_0x1b72d5['id']});}})[_0x2758('0x2c')](function(_0x3363b8){logger[_0x2758('0x3e')](_0x2758('0x88'),JSON[_0x2758('0x40')](_0x3363b8));});};exports[_0x2758('0x7c')]=function(_0x33ba1c,_0xee0b0a,_0x497684,_0xb51edc,_0x37ff42,_0x31292c,_0x1517c6){var _0x4e658c,_0x472068,_0x432fff;_0x31292c['host']=intUtil[_0x2758('0x85')](_0x31292c[_0x2758('0x8b')]);_0x31292c[_0x2758('0x86')]=intUtil[_0x2758('0x85')](_0x31292c[_0x2758('0x86')]);if(_0x1517c6&&_0x1517c6[_0x2758('0x97')]&&_0x1517c6[_0x2758('0x97')]!==_0x2758('0x98')){logger[_0x2758('0x2f')](_0x2758('0x99'),_0x2758('0x89'));_0xee0b0a[_0x2758('0x8a')]=_0x31292c[_0x2758('0x86')]+'/api/voice/recordings/'+_0xee0b0a[_0x2758('0x9a')]+_0x2758('0x9b')+md5(_0xee0b0a['uniqueid']);}var _0x1a0895=_0x31292c[_0x2758('0x8b')]===_0x2758('0x8c')?'eu':_0x2758('0x8d');return getAccessToken(_0x31292c)[_0x2758('0x2a')](function(_0x3f7978){_0x432fff=_0x3f7978;return getUser(_0x432fff,_0x1a0895,_0x31292c,_0xb51edc[_0x2758('0x39')]);})[_0x2758('0x2a')](function(_0x6c2fe8){_0x4e658c=_0x6c2fe8;logger[_0x2758('0x2f')](_0x2758('0x8e'),_0x4e658c['id']);return getEndUser(_0x432fff,_0x1a0895,_0x31292c,_0xee0b0a[_0x2758('0x9c')],_0xee0b0a[_0x2758('0x9d')],_0x4e658c,_0x497684);})[_0x2758('0x2a')](function(_0x308234){_0x472068=_0x308234;return getCall(_0x432fff,_0x1a0895,_0x31292c,_0x4e658c,_0x472068,_0x497684,_0xee0b0a,'Outbound');})[_0x2758('0x2a')](function(_0xae741c){if(_0xae741c){logger[_0x2758('0x2f')](_0x2758('0x91'),_0xae741c['id']);logger[_0x2758('0x2f')](_0x2758('0x99'),_0x2758('0x92'));emit(util['format']('user:%s',_0xb51edc[_0x2758('0x18')]),_0x2758('0x94'),{'uri':_0x2758('0x95')+_0x31292c[_0x2758('0x8b')]+_0x2758('0x96')+_0xae741c['id']});}})['catch'](function(_0x1ea861){logger[_0x2758('0x3e')](_0x2758('0x99'),JSON['stringify'](_0x1ea861));});};exports[_0x2758('0x9e')]=function(_0x5ea530,_0x29cddf,_0x165b8f,_0x888e1a,_0x2fff8b,_0x8519b3){var _0x10f4e6,_0x4003ae,_0x50f743;_0x8519b3[_0x2758('0x8b')]=intUtil[_0x2758('0x85')](_0x8519b3[_0x2758('0x8b')]);_0x8519b3[_0x2758('0x86')]=intUtil['stripTrailingSlash'](_0x8519b3[_0x2758('0x86')]);if(_0x2fff8b&&_0x2fff8b[_0x2758('0x87')]){logger[_0x2758('0x2f')]('['+_0x29cddf[_0x2758('0x6f')][_0x2758('0x9f')]()+']',_0x2758('0x89'));_0x29cddf['recordingURL']=_0x8519b3[_0x2758('0x86')]+_0x2758('0xa0')+_0x29cddf['uniqueid']+_0x2758('0x9b')+md5(_0x29cddf[_0x2758('0x9a')]);}else{_0x29cddf[_0x2758('0x8a')]='';}var _0x36c849=_0x8519b3['host']===_0x2758('0x8c')?'eu':_0x2758('0x8d');return getAccessToken(_0x8519b3)['then'](function(_0x1301a2){_0x50f743=_0x1301a2;return getUser(_0x50f743,_0x36c849,_0x8519b3);})['then'](function(_0x3edb50){_0x10f4e6=_0x3edb50;logger['info'](_0x2758('0x8e'),_0x10f4e6['id']);return getEndUser(_0x50f743,_0x36c849,_0x8519b3,_0x29cddf['calleridname'],_0x29cddf[_0x2758('0x90')],_0x10f4e6,_0x165b8f);})[_0x2758('0x2a')](function(_0x41f63e){_0x4003ae=_0x41f63e;return getCall(_0x50f743,_0x36c849,_0x8519b3,_0x10f4e6,_0x4003ae,_0x165b8f,_0x29cddf,_0x2758('0x7e'));})[_0x2758('0x2a')](function(_0x43e530){if(_0x43e530){logger[_0x2758('0x2f')](_0x2758('0x91'),_0x43e530['id']);}})[_0x2758('0x2c')](function(_0x22e8bb){logger[_0x2758('0x3e')]('['+_0x29cddf[_0x2758('0x6f')][_0x2758('0x9f')]()+']',JSON['stringify'](_0x22e8bb));});}; \ 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 23f2ebd..9048bc4 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(_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 +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(_0x23ea27,_0x5c7eb4){var _0x1895f3=function(_0x472cd3){while(--_0x472cd3){_0x23ea27['push'](_0x23ea27['shift']());}};_0x1895f3(++_0x5c7eb4);}(_0x7a54,0x106));var _0x47a5=function(_0x2e8dc5,_0x3ab08e){_0x2e8dc5=_0x2e8dc5-0x0;var _0x2c4e7c=_0x7a54[_0x2e8dc5];return _0x2c4e7c;};'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 76e77dc..a12eeea 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 _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 +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(_0xf9a309,_0x1be54d){var _0x3a99d7=function(_0x2e46e6){while(--_0x2e46e6){_0xf9a309['push'](_0xf9a309['shift']());}};_0x3a99d7(++_0x1be54d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x449799,_0x2c4c3d){_0x449799=_0x449799-0x0;var _0x32f84d=_0x5f2f[_0x449799];return _0x32f84d;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 298e85b..e647f55 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 _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 +var _0x7250=['error','message','catch','exports','jayson/promise','bluebird','routing','client','http','Request','rpc'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x7250,0x1b1));var _0x0725=function(_0x5a6705,_0x1e3bbd){_0x5a6705=_0x5a6705-0x0;var _0x32f17a=_0x7250[_0x5a6705];return _0x32f17a;};'use strict';var jayson=require(_0x0725('0x0'));var BPromise=require(_0x0725('0x1'));var logger=require('../../config/logger')(_0x0725('0x2'));var client=jayson[_0x0725('0x3')][_0x0725('0x4')]({'port':0x2329});client[_0x0725('0x5')]=function(_0x425376,_0x4724ef){return new BPromise(function(_0x53cc59,_0x34a7d5){return client['request'](_0x425376,_0x4724ef)['then'](function(_0xa32c3f){logger['debug'](_0x0725('0x6'),_0x0725('0x2'),_0x425376,_0x4724ef,_0xa32c3f);if(_0xa32c3f['error']){logger[_0x0725('0x7')](_0x0725('0x6'),_0x0725('0x2'),_0x425376,_0xa32c3f[_0x0725('0x7')][_0x0725('0x8')],_0x4724ef);return _0x34a7d5(_0xa32c3f[_0x0725('0x7')][_0x0725('0x8')]);}else{return _0x53cc59(_0xa32c3f['result']);}})[_0x0725('0x9')](function(_0x10a203){logger[_0x0725('0x7')]('rpc','routing',_0x425376,_0x10a203,_0x4724ef);return _0x34a7d5(_0x10a203);});});};module[_0x0725('0xa')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 785e596..df50542 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 _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 +var _0x9b8e=['mailAccounts','listen','Setting','findOne','loginMailFrequency','log','bluebird','./realtime','./lib/email','resolve','getMailAccounts','then','refresh'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9b8e,0x158));var _0xe9b8=function(_0x4e2f56,_0x5b996c){_0x4e2f56=_0x4e2f56-0x0;var _0x4882c0=_0x9b8e[_0x4e2f56];return _0x4882c0;};'use strict';var BPromise=require(_0xe9b8('0x0'));var server=require('./server');var Realtime=require(_0xe9b8('0x1'));var EmailChannel=require(_0xe9b8('0x2'));var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0xe9b8('0x3')]()['then'](mailAccount[_0xe9b8('0x4')]())[_0xe9b8('0x5')](realtime['initMailAccounts']())[_0xe9b8('0x5')](function(){email[_0xe9b8('0x6')](realtime[_0xe9b8('0x7')]);return realtime;});}function main(){return server[_0xe9b8('0x8')](realtime,email)[_0xe9b8('0x5')](function(_0x3b67fe){return initRealtime();})['then'](function(_0x536372){return db[_0xe9b8('0x9')][_0xe9b8('0xa')]({'attributes':['id',_0xe9b8('0xb')],'raw':!![]});})[_0xe9b8('0x5')](function(_0x4aab24){return setInterval(initRealtime,_0x4aab24[_0xe9b8('0xb')]*0x3e8);})['catch'](function(_0x23244f){console[_0xe9b8('0xc')](_0x23244f);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index cfee8e1..73a6369 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 _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 +var _0x64e9=['error','handleImapError','disabled','handleImapBox','connected','messages','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','Smtp','verify','verified','moment','md5','ioredis','../../../config/environment','email','redis','localhost','socket.io-emitter','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','box','bind','handleImapEmail','end','handleImapEnd'];(function(_0x458a2e,_0x31f0d7){var _0x26590e=function(_0xf06a51){while(--_0xf06a51){_0x458a2e['push'](_0x458a2e['shift']());}};_0x26590e(++_0x31f0d7);}(_0x64e9,0x117));var _0x964e=function(_0x1aa3ce,_0x453b5a){_0x1aa3ce=_0x1aa3ce-0x0;var _0x3fb000=_0x64e9[_0x1aa3ce];return _0x3fb000;};'use strict';var _=require('lodash');var moment=require(_0x964e('0x0'));var BPromise=require('bluebird');var md5=require(_0x964e('0x1'));var Redis=require(_0x964e('0x2'));var config=require(_0x964e('0x3'));var logger=require('../../../config/logger')(_0x964e('0x4'));config[_0x964e('0x5')]=_['defaults'](config[_0x964e('0x5')],{'host':_0x964e('0x6'),'port':0x18eb});var io=require(_0x964e('0x7'))(new Redis(config['redis']));var EmailImap=require(_0x964e('0x8'));var EmailSmtp=require(_0x964e('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x2fe9c6){logger[_0x964e('0xa')](_0x964e('0xb'));this[_0x964e('0xc')]=_0x2fe9c6[_0x964e('0xc')];this[_0x964e('0xd')]={};this[_0x964e('0xe')]=new EmailSmtp();}EmailChannel[_0x964e('0xf')][_0x964e('0x10')]=function(_0x21d972){var _0x5ee80a=this['mailAccounts'][_0x21d972];var _0x16436f={'id':_0x5ee80a['id'],'name':_0x5ee80a[_0x964e('0x11')],'key':_0x5ee80a['key'],'active':_0x5ee80a[_0x964e('0x12')],'Imap':{'status':_0x5ee80a[_0x964e('0x13')][_0x964e('0x14')],'messageStatus':_0x5ee80a[_0x964e('0x13')][_0x964e('0x15')],'total':_0x5ee80a[_0x964e('0x13')][_0x964e('0x16')]}};if(_[_0x964e('0x17')](md5Accounts[_0x21d972])){md5Accounts[_0x21d972]={};}var _0x41c59f=md5(JSON[_0x964e('0x18')](_0x16436f));if(md5Accounts[_0x21d972][_0x964e('0x1')]!==_0x41c59f){md5Accounts[_0x21d972][_0x964e('0x1')]=_0x41c59f;io[_0x964e('0x10')](_0x964e('0x19'),_0x16436f);}};EmailChannel[_0x964e('0xf')][_0x964e('0x1a')]=function(_0x113dc0){for(var _0x9eb31e in _0x113dc0){if(_0x113dc0[_0x964e('0x1b')](_0x9eb31e)){if(_0x113dc0[_0x9eb31e][_0x964e('0x13')]&&_0x113dc0[_0x9eb31e]['active']){var _0xb30eb8=_0x113dc0[_0x9eb31e][_0x964e('0x13')];if(!this[_0x964e('0xd')][_0x964e('0x1b')](_0xb30eb8['id'])){this[_0x964e('0xd')][_0xb30eb8['id']]=new EmailImap(_0xb30eb8,_0x113dc0[_0x9eb31e]['email']);this[_0x964e('0xd')][_0xb30eb8['id']]['on'](_0x964e('0x1c'),this['handleImapBox'][_0x964e('0x1d')](this,_0x9eb31e));this[_0x964e('0xd')][_0xb30eb8['id']]['on'](_0x964e('0x4'),this[_0x964e('0x1e')][_0x964e('0x1d')](this,_0x9eb31e));this[_0x964e('0xd')][_0xb30eb8['id']]['on'](_0x964e('0x1f'),this[_0x964e('0x20')]['bind'](this,_0x9eb31e));this['imapAccounts'][_0xb30eb8['id']]['on'](_0x964e('0x21'),this[_0x964e('0x22')][_0x964e('0x1d')](this,_0x9eb31e));}}else{if(_[_0x964e('0x17')](this[_0x964e('0xc')][_0x9eb31e][_0x964e('0x13')])){this[_0x964e('0xc')][_0x9eb31e]['Imap']={};}this[_0x964e('0xc')][_0x9eb31e]['Imap'][_0x964e('0x14')]=_0x964e('0x23');this[_0x964e('0xc')][_0x9eb31e]['Imap']['messageStatus']='';this['emit'](_0x9eb31e);}}}};EmailChannel[_0x964e('0xf')][_0x964e('0x24')]=function(_0x38fe15,_0x57513a){if(this[_0x964e('0xc')][_0x38fe15]){this[_0x964e('0xc')][_0x38fe15][_0x964e('0x13')][_0x964e('0x14')]=_0x964e('0x25');this[_0x964e('0xc')][_0x38fe15][_0x964e('0x13')][_0x964e('0x15')]=_0x57513a[_0x964e('0x11')];if(_0x57513a[_0x964e('0x26')]){this[_0x964e('0xc')][_0x38fe15][_0x964e('0x13')][_0x964e('0x16')]=_0x57513a[_0x964e('0x26')][_0x964e('0x16')];}return this['emit'](_0x38fe15);}};EmailChannel[_0x964e('0xf')]['handleImapEmail']=function(_0x121426,_0x1b82a7){logger[_0x964e('0xa')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x1b82a7['firstName'],_0x1b82a7[_0x964e('0x27')],_0x1b82a7[_0x964e('0x28')],_0x121426);if(this[_0x964e('0xc')][_0x121426]){return mailAccount[_0x964e('0x29')](_0x121426,_0x1b82a7)[_0x964e('0x2a')](function(_0x5158f4){if(_0x5158f4){logger[_0x964e('0xa')](_0x964e('0x2b'));}})[_0x964e('0x2c')](function(_0x5b3489){logger[_0x964e('0x21')](_0x964e('0x2d'),JSON[_0x964e('0x18')](_0x5b3489));});}};EmailChannel[_0x964e('0xf')]['handleImapEnd']=function(_0x1ea678){if(this[_0x964e('0xc')][_0x1ea678]&&this[_0x964e('0xc')][_0x1ea678][_0x964e('0x13')]){if(this[_0x964e('0xd')][this[_0x964e('0xc')][_0x1ea678]['Imap']['id']]){delete this['imapAccounts'][this[_0x964e('0xc')][_0x1ea678]['Imap']['id']];}this[_0x964e('0xc')][_0x1ea678][_0x964e('0x13')][_0x964e('0x2e')]=moment();this[_0x964e('0x10')](_0x1ea678);}};EmailChannel['prototype'][_0x964e('0x22')]=function(_0x4a9b7f,_0x11c636){if(this['mailAccounts'][_0x4a9b7f]){this[_0x964e('0xc')][_0x4a9b7f][_0x964e('0x13')][_0x964e('0x14')]=_0x964e('0x21');this[_0x964e('0xc')][_0x4a9b7f][_0x964e('0x13')][_0x964e('0x15')]=_0x11c636;return this[_0x964e('0x10')](_0x4a9b7f);}};EmailChannel[_0x964e('0xf')][_0x964e('0x2f')]=function(_0x7e255,_0x4d1920){return this[_0x964e('0xe')][_0x964e('0x30')](_0x7e255,_0x4d1920);};EmailChannel[_0x964e('0xf')]['verifySmtp']=function(_0x3dbc2a){var _0x3c6c84=this;if(this[_0x964e('0xc')][_0x3dbc2a['id']]){if(_[_0x964e('0x17')](this[_0x964e('0xc')][_0x3dbc2a['id']][_0x964e('0x31')])){this[_0x964e('0xc')][_0x3dbc2a['id']]['Smtp']={};}this['mailAccounts'][_0x3dbc2a['id']]['Smtp'][_0x964e('0x2e')]=moment();return new BPromise(function(_0x46e7c5,_0x30a412){return _0x3c6c84['smtp'][_0x964e('0x32')](_0x3dbc2a)['then'](function(_0x2fcb14){_0x3c6c84[_0x964e('0xc')][_0x3dbc2a['id']]['Smtp'][_0x964e('0x14')]=_0x964e('0x33');_0x3c6c84[_0x964e('0xc')][_0x3dbc2a['id']][_0x964e('0x31')]['messageStatus']='';_0x3c6c84[_0x964e('0x10')](_0x3dbc2a['id']);_0x46e7c5(_0x2fcb14);})['catch'](function(_0x3ead93){_0x3c6c84['mailAccounts'][_0x3dbc2a['id']]['Smtp']['status']=_0x964e('0x21');_0x3c6c84[_0x964e('0xc')][_0x3dbc2a['id']][_0x964e('0x31')]['messageStatus']=_0x3ead93;_0x3c6c84[_0x964e('0x10')](_0x3dbc2a['id']);_0x30a412(_0x3ead93);});});}return this['smtp']['verify'](_0x3dbc2a);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 5fd35ce..fa2f3eb 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 _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 +var _0x1e7c=['handleCloseBox','stringify','textCode','hasOwnProperty','upperFirst','exports','path','imap','randomstring','mailparser','simpleParser','iconv','events','./utils','../../../config/logger','email','INBOX','account','ready','handleReady','bind','once','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','autotls','tls','anonymous@xcally.com','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','handleFetchError'];(function(_0x235884,_0x1c4355){var _0x211158=function(_0x3d620c){while(--_0x3d620c){_0x235884['push'](_0x235884['shift']());}};_0x211158(++_0x1c4355);}(_0x1e7c,0x132));var _0xc1e7=function(_0x147b9c,_0x258636){_0x147b9c=_0x147b9c-0x0;var _0x5b8691=_0x1e7c[_0x147b9c];return _0x5b8691;};'use strict';var fs=require('fs');var path=require(_0xc1e7('0x0'));var util=require('util');var Imap=require(_0xc1e7('0x1'));var _=require('lodash');var rs=require(_0xc1e7('0x2'));var simpleParser=require(_0xc1e7('0x3'))[_0xc1e7('0x4')];var Iconv=require(_0xc1e7('0x5'))['Iconv'];var EventEmitter=require(_0xc1e7('0x6'))['EventEmitter'];var utils=require(_0xc1e7('0x7'));var logger=require(_0xc1e7('0x8'))(_0xc1e7('0x9'));function EmailImap(_0x96cbc6,_0x588a66){this['mailbox']=_0xc1e7('0xa');this['account']=this['getAccount'](_0x96cbc6,_0x588a66);this[_0xc1e7('0x1')]=new Imap(this[_0xc1e7('0xb')]);this['imap']['once'](_0xc1e7('0xc'),this[_0xc1e7('0xd')][_0xc1e7('0xe')](this));this[_0xc1e7('0x1')][_0xc1e7('0xf')](_0xc1e7('0x10'),this[_0xc1e7('0x11')][_0xc1e7('0xe')](this));this[_0xc1e7('0x1')]['on'](_0xc1e7('0x12'),this[_0xc1e7('0x13')][_0xc1e7('0xe')](this));this[_0xc1e7('0x1')][_0xc1e7('0x14')]();}util[_0xc1e7('0x15')](EmailImap,EventEmitter);EmailImap[_0xc1e7('0x16')]['getAccount']=function(_0x4f4f15,_0x21418f){var _0x428e81={'connTimeout':_0x4f4f15[_0xc1e7('0x17')]?_0x4f4f15['connTimeout']*0x3e8:0x2710,'authTimeout':_0x4f4f15[_0xc1e7('0x18')]?_0x4f4f15[_0xc1e7('0x18')]*0x3e8:0x1388};if(_[_0xc1e7('0x19')](_0x4f4f15[_0xc1e7('0x1a')])){if(_0x4f4f15[_0xc1e7('0x1b')]){_0x428e81[_0xc1e7('0x1c')]=_0x4f4f15[_0xc1e7('0x1c')];_0x428e81[_0xc1e7('0x1d')]=_0x4f4f15[_0xc1e7('0x1d')];}_0x428e81[_0xc1e7('0x1e')]=_0x4f4f15['host'];_0x428e81[_0xc1e7('0x1f')]=_0x4f4f15[_0xc1e7('0x1f')]||0x3e1;if(_0x4f4f15['tls']){_0x428e81['tls']=!![];}else{_0x428e81['tls']=![];_0x428e81[_0xc1e7('0x20')]='required';}}else{_0x428e81['user']=_0x4f4f15[_0xc1e7('0x1c')];_0x428e81[_0xc1e7('0x1d')]=_0x4f4f15[_0xc1e7('0x1d')];_0x428e81[_0xc1e7('0x1e')]=utils['getHost'](_0x4f4f15['service']);_0x428e81[_0xc1e7('0x1f')]=0x3e1;_0x428e81[_0xc1e7('0x21')]=!![];}_0x428e81['email']=_0x21418f||_0x4f4f15[_0xc1e7('0x1c')]||_0xc1e7('0x22');return _0x428e81;};EmailImap[_0xc1e7('0x16')][_0xc1e7('0xd')]=function(){this[_0xc1e7('0x1')]['openBox'](this['mailbox'],![],this[_0xc1e7('0x23')][_0xc1e7('0xe')](this));};EmailImap[_0xc1e7('0x16')][_0xc1e7('0x23')]=function(_0x240f0,_0x548fe0){if(_0x240f0){this[_0xc1e7('0x13')](_0x240f0,!![]);}else{this[_0xc1e7('0x24')](_0xc1e7('0x25'),_0x548fe0);this[_0xc1e7('0x26')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x1b6c5e){if(_0x1b6c5e){this[_0xc1e7('0x13')](_0x1b6c5e,!![]);}else{this[_0xc1e7('0x1')][_0xc1e7('0x10')]();}};EmailImap[_0xc1e7('0x16')][_0xc1e7('0x26')]=function(){this['imap'][_0xc1e7('0x27')]([_0xc1e7('0x28')],this['handleReadUnseen'][_0xc1e7('0xe')](this));};EmailImap[_0xc1e7('0x16')][_0xc1e7('0x29')]=function(_0xce254b,_0x1fd083){if(_0xce254b){this[_0xc1e7('0x13')](_0xce254b,!![]);}else{if(_0x1fd083[_0xc1e7('0x2a')]){try{var _0xf0dba6=this[_0xc1e7('0x1')][_0xc1e7('0x2b')](_0x1fd083,{'bodies':'','markSeen':!![]});_0xf0dba6['on']('message',this[_0xc1e7('0x2c')][_0xc1e7('0xe')](this));_0xf0dba6['once']('error',this['handleFetchError'][_0xc1e7('0xe')](this));_0xf0dba6[_0xc1e7('0xf')](_0xc1e7('0x10'),this['handleFetchEnd']['bind'](this));}catch(_0x180c6c){logger['error'](_0x180c6c);}}else{this[_0xc1e7('0x1')]['closeBox'](!![],this['handleCloseBox'][_0xc1e7('0xe')](this));}}};EmailImap[_0xc1e7('0x16')][_0xc1e7('0x2c')]=function(_0x5aad83,_0x283147){_0x5aad83['on'](_0xc1e7('0x2d'),this[_0xc1e7('0x2e')][_0xc1e7('0xe')](this));_0x5aad83[_0xc1e7('0xf')](_0xc1e7('0x2f'),this[_0xc1e7('0x30')][_0xc1e7('0xe')](this));_0x5aad83[_0xc1e7('0xf')](_0xc1e7('0x10'),this[_0xc1e7('0x31')][_0xc1e7('0xe')](this));};EmailImap['prototype'][_0xc1e7('0x2e')]=function(_0x196b05,_0x360295){simpleParser(_0x196b05,{'Iconv':Iconv},this[_0xc1e7('0x32')][_0xc1e7('0xe')](this));};EmailImap['prototype'][_0xc1e7('0x30')]=function(_0xc4430e){};EmailImap[_0xc1e7('0x16')]['handleMessageEnd']=function(){};EmailImap[_0xc1e7('0x16')][_0xc1e7('0x32')]=function(_0x34e93f,_0x2bbb6c){if(_0x34e93f){logger[_0xc1e7('0x12')](_0x34e93f);}else{var _0x716099=this;utils[_0xc1e7('0x33')](this[_0xc1e7('0xb')],_0x2bbb6c,function(_0x30f8ca){_0x716099[_0xc1e7('0x24')](_0xc1e7('0x9'),_0x30f8ca);});}};EmailImap[_0xc1e7('0x16')]['handleFetchEnd']=function(){this[_0xc1e7('0x1')][_0xc1e7('0x34')](!![],this['handleCloseBox'][_0xc1e7('0xe')](this));};EmailImap[_0xc1e7('0x16')][_0xc1e7('0x35')]=function(_0x5bc843){this[_0xc1e7('0x13')](_0x5bc843);this[_0xc1e7('0x1')][_0xc1e7('0x34')](!![],this[_0xc1e7('0x36')]['bind'](this));};EmailImap[_0xc1e7('0x16')][_0xc1e7('0x11')]=function(){this['emit'](_0xc1e7('0x10'));};EmailImap[_0xc1e7('0x16')]['handleError']=function(_0x497853,_0x4d06af){logger[_0xc1e7('0x12')](_0xc1e7('0x13'),this[_0xc1e7('0xb')][_0xc1e7('0x9')],JSON[_0xc1e7('0x37')](_0x497853));var _0x24f05c='';if(_0x497853){if(_0x497853[_0xc1e7('0x38')]){_0x24f05c=_0x497853['textCode'];}else{for(var _0x3c6373 in _0x497853){if(_0x497853[_0xc1e7('0x39')](_0x3c6373)){_0x24f05c+=_[_0xc1e7('0x3a')](_0x3c6373)+':\x20'+_0x497853[_0x3c6373]+'\x0a';}}}}if(_0x4d06af){this['imap'][_0xc1e7('0x10')]();}else{this['emit']('error',_0x24f05c);this['emit']('end');}};module[_0xc1e7('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 8a089a4..af773e2 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 _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 +var _0x0d6a=['Not\x20verifired','exports','bluebird','nodemailer-plugin-inline-base64','prototype','use','compile','toString','createTransport','verify'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0d6a,0x1ba));var _0xa0d6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x0d6a[_0x5d4607];return _0x5e4a86;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0xa0d6('0x0'));var inlineBase64=require(_0xa0d6('0x1'));function EmailSmtp(){}EmailSmtp[_0xa0d6('0x2')]['send']=function(_0x5f1cae,_0x102d4c){return new BPromise(function(_0x207701,_0x44c812){var _0x324c85=nodemailer['createTransport'](_0x5f1cae);_0x324c85[_0xa0d6('0x3')](_0xa0d6('0x4'),inlineBase64());_0x324c85['sendMail'](_0x102d4c,function(_0x27c860,_0x339f77){if(_0x27c860){_0x44c812(_0x27c860[_0xa0d6('0x5')]());}else{_0x207701(_0x339f77);}});});};EmailSmtp[_0xa0d6('0x2')]['verify']=function(_0x28d672){return new BPromise(function(_0x4ca716,_0x2ef604){var _0x5dfc0a=nodemailer[_0xa0d6('0x6')](_0x28d672);_0x5dfc0a[_0xa0d6('0x7')](function(_0x762b77,_0x128a80){if(_0x762b77){_0x2ef604(_0x762b77['toString']());}else{if(_0x128a80){_0x4ca716(_0x128a80);}else{_0x2ef604(_0xa0d6('0x8'));}}});});};module[_0xa0d6('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 344e565..b3c71ee 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 _0xd494=['imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','randomstring','node-tnef','../../../config/logger','email','head','address','anonymous','generate','@xcally.com','name','length','slice','join','Anonymous','split','value','isEmpty','html','test','includes','\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 +var _0x9b4e=['test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','split','slice','join','length','isEmpty','html'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9b4e,0x117));var _0xe9b4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9b4e[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xe9b4('0x0'));var moment=require(_0xe9b4('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0xe9b4('0x2'));var util=require(_0xe9b4('0x3'));var tnef=require(_0xe9b4('0x4'));var logger=require(_0xe9b4('0x5'))(_0xe9b4('0x6'));var config=require(_0xe9b4('0x7'));function getAddress(_0x2a00ba){var _0x181954=_[_0xe9b4('0x8')](_0x2a00ba[_0xe9b4('0x9')]);return _0x181954&&_0x181954[_0xe9b4('0xa')]?_0x181954['address']:_0xe9b4('0xb')+random[_0xe9b4('0xc')](0x6)+_0xe9b4('0xd');}function getFirstName(_0xb3b4ea){var _0x1bd9be=_['head'](_0xb3b4ea[_0xe9b4('0x9')]);if(_0x1bd9be&&_0x1bd9be[_0xe9b4('0xe')]){var _0x3305c6=_0x1bd9be[_0xe9b4('0xe')][_0xe9b4('0xf')](/\s+/);return _0x3305c6['length']?_0x3305c6[_0xe9b4('0x10')](0x0,-0x1)[_0xe9b4('0x11')]('\x20'):_0x1bd9be['name'];}return'Anonymous';}function getLastName(_0x41bc3d){var _0x30c3b4=_[_0xe9b4('0x8')](_0x41bc3d[_0xe9b4('0x9')]);if(_0x30c3b4&&_0x30c3b4['name']){var _0x365ed0=_0x30c3b4[_0xe9b4('0xe')][_0xe9b4('0xf')](/\s+/);return _0x365ed0[_0xe9b4('0x12')]>0x1?_0x365ed0['pop']():'';}return'';}function getMails(_0x436357,_0x206ed6){var _0xc619d8='';for(var _0x479b54=0x0;_0x479b54<_0x206ed6['value'][_0xe9b4('0x12')];_0x479b54+=0x1){if(_0x206ed6['value'][_0x479b54]['address']!==_0x436357){if(!_[_0xe9b4('0x13')](_0xc619d8)){_0xc619d8+=',';}_0xc619d8+=_0x206ed6['value'][_0x479b54][_0xe9b4('0xe')]||_0x206ed6[_0xe9b4('0x9')][_0x479b54]['address']||'';_0xc619d8+='\x20<';_0xc619d8+=_0x206ed6['value'][_0x479b54]['address']?_0x206ed6['value'][_0x479b54][_0xe9b4('0xa')]:_0xe9b4('0xb')+random[_0xe9b4('0xc')](0x6)+'@xcally.com';_0xc619d8+='>';}}return _0xc619d8;}function parseEmail(_0x581f53,_0xe1a3e3,_0x4ed2a4){if(_0xe1a3e3[_0xe9b4('0x14')]){var _0xdd0959=/)<[^<]*)*<\/script>/gi;while(_0xdd0959[_0xe9b4('0x15')](_0xe1a3e3[_0xe9b4('0x14')])){_0xe1a3e3[_0xe9b4('0x14')]=_0xe1a3e3[_0xe9b4('0x14')][_0xe9b4('0x16')](_0xdd0959,'');}if(_0xe1a3e3['html'][_0xe9b4('0x17')](_0xe9b4('0x18'))){var _0x53aef9=[];_0xe1a3e3['attachments'][_0xe9b4('0x19')](_0x3e35d1=>{_0x53aef9[_0xe9b4('0x1a')](_0x3e35d1['filename']);});var _0x15fa16=/]+>/g;var _0x1f5c08=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x5e17f4=_0xe1a3e3[_0xe9b4('0x14')][_0xe9b4('0x16')](_0x1f5c08,_0xe9b4('0x1b'));var _0x4331d3=_0x5e17f4['replace'](_0x15fa16,_0xe9b4('0x1c'));for(let _0x50ffe0=0x0;_0x50ffe0<_0x53aef9[_0xe9b4('0x12')];_0x50ffe0++){var _0x289a21=_0x4331d3['replace'](_0xe9b4('0x1c'),_0xe9b4('0x1d')+_0x53aef9[_0x50ffe0]+_0xe9b4('0x1e'));_0x4331d3=_0x289a21;}_0xe1a3e3[_0xe9b4('0x14')]=_0x4331d3;}_0x4ed2a4['body']=_0xe1a3e3[_0xe9b4('0x14')];}else{_0x4ed2a4[_0xe9b4('0x1f')]=_0xe1a3e3[_0xe9b4('0x20')];}if(_0x4ed2a4['body']){_0x4ed2a4[_0xe9b4('0x1f')]=_0x4ed2a4['body'][_0xe9b4('0x16')](/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 +var _0xc35f=['socket.io-emitter','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','idle','mail','openchannel','fax','sms','whatsapp','length','getChannelStatus','Status','toNumber','format','online','chatStatus','mailCurrentCapacity','whatsappCurrentCapacity','user:save','lodash','moment','md5','ioredis','redis','defaults'];(function(_0x581e01,_0x241cbd){var _0x558b54=function(_0x22a370){while(--_0x22a370){_0x581e01['push'](_0x581e01['shift']());}};_0x558b54(++_0x241cbd);}(_0xc35f,0x1ca));var _0xfc35=function(_0xf3c6b6,_0x15fc11){_0xf3c6b6=_0xf3c6b6-0x0;var _0x3a02a8=_0xc35f[_0xf3c6b6];return _0x3a02a8;};'use strict';var _=require(_0xfc35('0x0'));var moment=require(_0xfc35('0x1'));var md5=require(_0xfc35('0x2'));var Redis=require(_0xfc35('0x3'));var config=require('../../../config/environment');config[_0xfc35('0x4')]=_[_0xfc35('0x5')](config[_0xfc35('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xfc35('0x6'))(new Redis(config['redis']));function Agent(_0x4bd1ea){this['id']=_0x4bd1ea['id']||0x0;this[_0xfc35('0x7')]=_0x4bd1ea[_0xfc35('0x7')]||'';this['online']=_0x4bd1ea['online']||!![];this[_0xfc35('0x8')]=_0x4bd1ea[_0xfc35('0x8')]||![];this[_0xfc35('0x9')]=_0x4bd1ea['chatPause']||![];this[_0xfc35('0xa')]=_0x4bd1ea[_0xfc35('0xa')]||![];this[_0xfc35('0xb')]=_0x4bd1ea['faxPause']||![];this[_0xfc35('0xc')]=_0x4bd1ea[_0xfc35('0xc')]||![];this[_0xfc35('0xd')]=_0x4bd1ea[_0xfc35('0xd')]||![];this['chatStatus']=_0xfc35('0xe');this[_0xfc35('0xf')]=0x0;this['chatCapacity']=_0x4bd1ea[_0xfc35('0x10')]||0x0;this[_0xfc35('0x11')]=0x0;this[_0xfc35('0x12')]='unknown';this[_0xfc35('0x13')]=0x0;this['mailCapacity']=_0x4bd1ea[_0xfc35('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xfc35('0x15')]=_0xfc35('0xe');this['faxStatusTime']=0x0;this['faxCapacity']=_0x4bd1ea[_0xfc35('0x16')]||0x0;this[_0xfc35('0x17')]=0x0;this[_0xfc35('0x18')]=_0xfc35('0xe');this[_0xfc35('0x19')]=0x0;this[_0xfc35('0x1a')]=_0x4bd1ea['smsCapacity']||0x0;this[_0xfc35('0x1b')]=0x0;this[_0xfc35('0x1c')]='unknown';this[_0xfc35('0x1d')]=0x0;this[_0xfc35('0x1e')]=_0x4bd1ea[_0xfc35('0x1e')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xfc35('0x1f')]=_0xfc35('0xe');this[_0xfc35('0x20')]=0x0;this[_0xfc35('0x21')]=_0x4bd1ea['openchannelCapacity']||0x0;this[_0xfc35('0x22')]=0x0;this[_0xfc35('0x23')]=![];this[_0xfc35('0x24')]=undefined;this['md5']='';this[_0xfc35('0x25')]();}Agent[_0xfc35('0x26')]['getChannelStatus']=function(_0x4f50ec){if(this[_0x4f50ec+_0xfc35('0x27')]>0x0){if(this[_0x4f50ec+_0xfc35('0x28')]>0x0&&this[_0x4f50ec+'CurrentCapacity']>=this[_0x4f50ec+_0xfc35('0x28')]){return _0xfc35('0x29');}else{return'working';}}else{return _0xfc35('0x2a');}};Agent[_0xfc35('0x26')][_0xfc35('0x25')]=function(){var _0x53024c=[_0xfc35('0x2b'),'chat',_0xfc35('0x2c'),_0xfc35('0x2d'),_0xfc35('0x2e'),_0xfc35('0x2f')];for(var _0x306d6f=0x0;_0x306d6f<_0x53024c[_0xfc35('0x30')];_0x306d6f+=0x1){var _0x37cfd1=this[_0xfc35('0x31')](_0x53024c[_0x306d6f]);if(this[_0x53024c[_0x306d6f]+_0xfc35('0x32')]!==_0x37cfd1){this[_0x53024c[_0x306d6f]+'StatusTime']=_[_0xfc35('0x33')](moment()[_0xfc35('0x34')]('x'));}this[_0x53024c[_0x306d6f]+_0xfc35('0x32')]=_0x37cfd1;}var _0x4bedfe={'id':this['id'],'name':this['name'],'online':this[_0xfc35('0x35')],'voicePause':this[_0xfc35('0x8')],'chatPause':this[_0xfc35('0x9')],'mailPause':this[_0xfc35('0xa')],'smsPause':this[_0xfc35('0xc')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xfc35('0x36')],'chatStatusTime':this[_0xfc35('0xf')],'chatCapacity':this[_0xfc35('0x10')],'chatCurrentCapacity':this[_0xfc35('0x11')],'mailStatus':this[_0xfc35('0x12')],'mailStatusTime':this[_0xfc35('0x13')],'mailCapacity':this[_0xfc35('0x14')],'mailCurrentCapacity':this[_0xfc35('0x37')],'faxStatus':this[_0xfc35('0x15')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xfc35('0x16')],'faxCurrentCapacity':this[_0xfc35('0x17')],'smsStatus':this[_0xfc35('0x18')],'smsStatusTime':this[_0xfc35('0x19')],'smsCapacity':this[_0xfc35('0x1a')],'smsCurrentCapacity':this[_0xfc35('0x1b')],'whatsappStatus':this[_0xfc35('0x1c')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xfc35('0x1e')],'whatsappCurrentCapacity':this[_0xfc35('0x38')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xfc35('0x20')],'openchannelCapacity':this[_0xfc35('0x21')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xfc35('0x23')],'busyQueue':this[_0xfc35('0x24')]};var _0x59f59d=md5(JSON['stringify'](_0x4bedfe));if(this[_0xfc35('0x2')]!==_0x59f59d){this[_0xfc35('0x2')]=_0x59f59d;io['emit'](_0xfc35('0x39'),_0x4bedfe);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 1738969..2136951 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 _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 +var _0xfe1a=['chatPause','available','stringify','format','emit','chat_queue:save','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','loggedIn','paused','length','online'];(function(_0x2dae1c,_0x32c3a7){var _0x31a468=function(_0x779fb){while(--_0x779fb){_0x2dae1c['push'](_0x2dae1c['shift']());}};_0x31a468(++_0x32c3a7);}(_0xfe1a,0x156));var _0xafe1=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xfe1a[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0xafe1('0x0'));var md5=require(_0xafe1('0x1'));var util=require('util');var Redis=require(_0xafe1('0x2'));var config=require(_0xafe1('0x3'));config[_0xafe1('0x4')]=_[_0xafe1('0x5')](config[_0xafe1('0x4')],{'host':_0xafe1('0x6'),'port':0x18eb});var io=require(_0xafe1('0x7'))(new Redis(config['redis']));function ChatQueue(_0x4b5964){this['id']=_0x4b5964['id']||0x0;this[_0xafe1('0x8')]=_0x4b5964[_0xafe1('0x8')]||'';this[_0xafe1('0x9')]=_0x4b5964[_0xafe1('0x9')]||0xa;this[_0xafe1('0xa')]=_0x4b5964[_0xafe1('0xa')]||'beepall';this[_0xafe1('0xb')]=_0x4b5964[_0xafe1('0xb')];this[_0xafe1('0xc')]={};this[_0xafe1('0xd')]=0x0;this['md5']='';this[_0xafe1('0xe')]();this['updateRealtime']();}ChatQueue['prototype']['updateRouting']=function(){var _0x185871=this[_0xafe1('0xc')][_0xafe1('0xf')];this[_0xafe1('0xc')]=_[_0xafe1('0x10')](this[_0xafe1('0xb')],'id');this['mapAgentsId'][_0xafe1('0xf')]=_0x185871;};ChatQueue[_0xafe1('0x11')]['updateRealtime']=function(){this[_0xafe1('0x12')]=0x0;this[_0xafe1('0x13')]=0x0;for(var _0x298f01=0x0;_0x298f01=0x0?this[_0xafe1('0x17')]:0x0;var _0x4e5e71={'id':this['id'],'available':this[_0xafe1('0x17')],'loggedIn':this['loggedIn'],'name':this[_0xafe1('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x241036=md5(JSON[_0xafe1('0x18')](_0x4e5e71));if(this[_0xafe1('0x1')]!==_0x241036){this['md5']=_0x241036;io['to'](util[_0xafe1('0x19')]('chat:queue:%s',_0x4e5e71[_0xafe1('0x8')]))[_0xafe1('0x1a')](_0xafe1('0x1b'),_0x4e5e71);}};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 992d054..3b60a5d 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(_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 +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(_0x1f6745,_0x302406){var _0x3a03ba=function(_0x551330){while(--_0x551330){_0x1f6745['push'](_0x1f6745['shift']());}};_0x3a03ba(++_0x302406);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 c552f5e..56fcdff 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 _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 +var _0xd89b=['name','exports'];(function(_0x31f095,_0x4ef11d){var _0xc7f71c=function(_0x58a5b1){while(--_0x58a5b1){_0x31f095['push'](_0x31f095['shift']());}};_0xc7f71c(++_0x4ef11d);}(_0xd89b,0x18c));var _0xbd89=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xd89b[_0x288f5e];return _0x476cc9;};'use strict';function Interval(_0x56a0f8){this['id']=_0x56a0f8['id']||0x0;this[_0xbd89('0x0')]=_0x56a0f8['name']||'';this['Intervals']=_0x56a0f8['Intervals']||{};}module[_0xbd89('0x1')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 6914345..434ef8f 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 _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 +var _0x4004=['beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','mailPause','available','format','exports','lodash','md5','util','ioredis','../../../config/environment','redis','name','timeout','strategy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4004,0x9f));var _0x4400=function(_0x172133,_0x10246b){_0x172133=_0x172133-0x0;var _0x2460e5=_0x4004[_0x172133];return _0x2460e5;};'use strict';var _=require(_0x4400('0x0'));var md5=require(_0x4400('0x1'));var util=require(_0x4400('0x2'));var Redis=require(_0x4400('0x3'));var config=require(_0x4400('0x4'));config[_0x4400('0x5')]=_['defaults'](config[_0x4400('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4400('0x5')]));function MailQueue(_0x1b9ada){this['id']=_0x1b9ada['id']||0x0;this[_0x4400('0x6')]=_0x1b9ada[_0x4400('0x6')]||'';this[_0x4400('0x7')]=_0x1b9ada[_0x4400('0x7')]||0xa;this[_0x4400('0x8')]=_0x1b9ada['strategy']||_0x4400('0x9');this[_0x4400('0xa')]=_0x1b9ada[_0x4400('0xa')];this[_0x4400('0xb')]={};this[_0x4400('0xc')]=0x0;this[_0x4400('0x1')]='';this[_0x4400('0xd')]();this[_0x4400('0xe')]();}MailQueue[_0x4400('0xf')][_0x4400('0xd')]=function(){var _0xfa66e8=this[_0x4400('0xb')]['_rr'];this[_0x4400('0xb')]=_[_0x4400('0x10')](this[_0x4400('0xa')],'id');this[_0x4400('0xb')][_0x4400('0x11')]=_0xfa66e8;};MailQueue['prototype'][_0x4400('0xe')]=function(){this[_0x4400('0x12')]=0x0;this[_0x4400('0x13')]=0x0;for(var _0x4a3886=0x0;_0x4a3886=0x0?this['available']:0x0;var _0x290de1={'id':this['id'],'available':this[_0x4400('0x15')],'loggedIn':this[_0x4400('0x12')],'name':this[_0x4400('0x6')],'paused':this['paused'],'waiting':this[_0x4400('0xc')]};var _0x4e6841=md5(JSON['stringify'](_0x290de1));if(this[_0x4400('0x1')]!==_0x4e6841){this[_0x4400('0x1')]=_0x4e6841;io['to'](util[_0x4400('0x16')]('mail:queue:%s',_0x290de1[_0x4400('0x6')]))['emit']('mail_queue:save',_0x290de1);}};module[_0x4400('0x17')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index afa00fc..13fb456 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 _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 +var _0x09ef=['stringify','openchannel:queue:%s','emit','openchannel_queue:save','lodash','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','mapAgentsId','_rr','updateRealtime','loggedIn','openchannelPause','paused','available'];(function(_0x34ea22,_0x1270b3){var _0x1ca470=function(_0xf63cf4){while(--_0xf63cf4){_0x34ea22['push'](_0x34ea22['shift']());}};_0x1ca470(++_0x1270b3);}(_0x09ef,0x1be));var _0xf09e=function(_0x3b462e,_0x5e482e){_0x3b462e=_0x3b462e-0x0;var _0x2ebe54=_0x09ef[_0x3b462e];return _0x2ebe54;};'use strict';var _=require(_0xf09e('0x0'));var md5=require('md5');var util=require(_0xf09e('0x1'));var Redis=require(_0xf09e('0x2'));var config=require(_0xf09e('0x3'));config['redis']=_['defaults'](config[_0xf09e('0x4')],{'host':_0xf09e('0x5'),'port':0x18eb});var io=require(_0xf09e('0x6'))(new Redis(config[_0xf09e('0x4')]));function OpenchannelQueue(_0x4da558){this['id']=_0x4da558['id']||0x0;this[_0xf09e('0x7')]=_0x4da558[_0xf09e('0x7')]||'';this[_0xf09e('0x8')]=_0x4da558[_0xf09e('0x8')]||0xa;this[_0xf09e('0x9')]=_0x4da558[_0xf09e('0x9')]||_0xf09e('0xa');this[_0xf09e('0xb')]=_0x4da558[_0xf09e('0xb')];this['mapAgentsId']={};this[_0xf09e('0xc')]=0x0;this[_0xf09e('0xd')]='';this[_0xf09e('0xe')]();this['updateRealtime']();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x959c28=this[_0xf09e('0xf')][_0xf09e('0x10')];this['mapAgentsId']=_['map'](this[_0xf09e('0xb')],'id');this['mapAgentsId'][_0xf09e('0x10')]=_0x959c28;};OpenchannelQueue['prototype'][_0xf09e('0x11')]=function(){this[_0xf09e('0x12')]=0x0;this['paused']=0x0;for(var _0x11e083=0x0;_0x11e083=0x0?this['available']:0x0;var _0x2385ef={'id':this['id'],'available':this[_0xf09e('0x15')],'loggedIn':this[_0xf09e('0x12')],'name':this['name'],'paused':this[_0xf09e('0x14')],'waiting':this[_0xf09e('0xc')]};var _0x5f4903=md5(JSON[_0xf09e('0x16')](_0x2385ef));if(this['md5']!==_0x5f4903){this[_0xf09e('0xd')]=_0x5f4903;io['to'](util['format'](_0xf09e('0x17'),_0x2385ef[_0xf09e('0x7')]))[_0xf09e('0x18')](_0xf09e('0x19'),_0x2385ef);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 6b95cf1..d96aeef 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 _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 +var _0xe706=['prototype','_rr','map','online','loggedIn','smsPause','available','paused','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x41b654,_0x39239c){var _0x55c219=function(_0x1f55c0){while(--_0x1f55c0){_0x41b654['push'](_0x41b654['shift']());}};_0x55c219(++_0x39239c);}(_0xe706,0xa3));var _0x6e70=function(_0x2633c7,_0x4db8b3){_0x2633c7=_0x2633c7-0x0;var _0xbb644=_0xe706[_0x2633c7];return _0xbb644;};'use strict';var _=require(_0x6e70('0x0'));var md5=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var Redis=require('ioredis');var config=require(_0x6e70('0x3'));config[_0x6e70('0x4')]=_[_0x6e70('0x5')](config[_0x6e70('0x4')],{'host':_0x6e70('0x6'),'port':0x18eb});var io=require(_0x6e70('0x7'))(new Redis(config[_0x6e70('0x4')]));function SmsQueue(_0x506db9){this['id']=_0x506db9['id']||0x0;this[_0x6e70('0x8')]=_0x506db9[_0x6e70('0x8')]||'';this[_0x6e70('0x9')]=_0x506db9[_0x6e70('0x9')]||0xa;this[_0x6e70('0xa')]=_0x506db9[_0x6e70('0xa')]||_0x6e70('0xb');this[_0x6e70('0xc')]=_0x506db9[_0x6e70('0xc')];this[_0x6e70('0xd')]={};this[_0x6e70('0xe')]=0x0;this[_0x6e70('0x1')]='';this[_0x6e70('0xf')]();this[_0x6e70('0x10')]();}SmsQueue[_0x6e70('0x11')][_0x6e70('0xf')]=function(){var _0x5b3d07=this['mapAgentsId'][_0x6e70('0x12')];this[_0x6e70('0xd')]=_[_0x6e70('0x13')](this[_0x6e70('0xc')],'id');this[_0x6e70('0xd')][_0x6e70('0x12')]=_0x5b3d07;};SmsQueue[_0x6e70('0x11')][_0x6e70('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x48bc72=0x0;_0x48bc72=0x0?this['available']:0x0;var _0x28a21f={'id':this['id'],'available':this[_0x6e70('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x6e70('0x18')],'waiting':this[_0x6e70('0xe')]};var _0x2368eb=md5(JSON[_0x6e70('0x19')](_0x28a21f));if(this[_0x6e70('0x1')]!==_0x2368eb){this[_0x6e70('0x1')]=_0x2368eb;io['to'](util[_0x6e70('0x1a')](_0x6e70('0x1b'),_0x28a21f[_0x6e70('0x8')]))[_0x6e70('0x1c')]('sms_queue:save',_0x28a21f);}};module[_0x6e70('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index b035257..cd73f0c 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 _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 +var _0x2ae3=['length','online','loggedIn','paused','available','stringify','format','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','updateRouting','_rr','Agents','prototype','updateRealtime'];(function(_0x5ba114,_0x5bf5ad){var _0x655476=function(_0x3a2305){while(--_0x3a2305){_0x5ba114['push'](_0x5ba114['shift']());}};_0x655476(++_0x5bf5ad);}(_0x2ae3,0xe9));var _0x32ae=function(_0x2ed22a,_0xec1e33){_0x2ed22a=_0x2ed22a-0x0;var _0x832116=_0x2ae3[_0x2ed22a];return _0x832116;};'use strict';var _=require(_0x32ae('0x0'));var md5=require(_0x32ae('0x1'));var util=require(_0x32ae('0x2'));var Redis=require(_0x32ae('0x3'));var config=require(_0x32ae('0x4'));config[_0x32ae('0x5')]=_[_0x32ae('0x6')](config[_0x32ae('0x5')],{'host':_0x32ae('0x7'),'port':0x18eb});var io=require(_0x32ae('0x8'))(new Redis(config['redis']));function WhatsappQueue(_0x165ad5){this['id']=_0x165ad5['id']||0x0;this[_0x32ae('0x9')]=_0x165ad5[_0x32ae('0x9')]||'';this[_0x32ae('0xa')]=_0x165ad5[_0x32ae('0xa')]||0xa;this['strategy']=_0x165ad5[_0x32ae('0xb')]||'beepall';this['Agents']=_0x165ad5['Agents'];this[_0x32ae('0xc')]={};this[_0x32ae('0xd')]=0x0;this['md5']='';this[_0x32ae('0xe')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0x32ae('0xe')]=function(){var _0x319a45=this[_0x32ae('0xc')][_0x32ae('0xf')];this[_0x32ae('0xc')]=_['map'](this[_0x32ae('0x10')],'id');this['mapAgentsId']['_rr']=_0x319a45;};WhatsappQueue[_0x32ae('0x11')][_0x32ae('0x12')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4f6b36=0x0;_0x4f6b36=0x0?this[_0x32ae('0x17')]:0x0;var _0xca8462={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x32ae('0x9')],'paused':this[_0x32ae('0x16')],'waiting':this[_0x32ae('0xd')]};var _0x15f0bb=md5(JSON[_0x32ae('0x18')](_0xca8462));if(this['md5']!==_0x15f0bb){this[_0x32ae('0x1')]=_0x15f0bb;io['to'](util[_0x32ae('0x19')]('whatsapp:queue:%s',_0xca8462['name']))['emit'](_0x32ae('0x1a'),_0xca8462);}};module[_0x32ae('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 0294530..3e7d996 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(_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 +var _0x00bb=['openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','agents','intervals','updateRealtime','initSmsQueues','updateRouting','initMailQueues','initWhatsappQueues','exports','bluebird','util','lodash','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/mailQueue','../model/faxQueue'];(function(_0xfd437d,_0x27e6e3){var _0x1ac3e1=function(_0x4596f5){while(--_0x4596f5){_0xfd437d['push'](_0xfd437d['shift']());}};_0x1ac3e1(++_0x27e6e3);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x00bb[_0x4e9628];return _0x27bc8c;};'use strict';var BPromise=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var _=require(_0xb00b('0x2'));var moment=require('moment');var Agent=require(_0xb00b('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xb00b('0x4'));var ChatQueue=require(_0xb00b('0x5'));var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0xb00b('0x6'));var FaxQueue=require(_0xb00b('0x7'));var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this['agents']={};this['intervals']={};this[_0xb00b('0x8')]={};this[_0xb00b('0x9')]={};this[_0xb00b('0xa')]={};this[_0xb00b('0xb')]={};this[_0xb00b('0xc')]={};this[_0xb00b('0xd')]={};this['chatQueuesWaitingInteractions']={};this['mailQueuesWaitingInteractions']={};this[_0xb00b('0xe')]={};this[_0xb00b('0xf')]={};this[_0xb00b('0x10')]={};this[_0xb00b('0x11')]={};};function freeIsNotKey(_0x28d3cc,_0x48e125,_0x3182db){var _0x5a63ed=_['mapKeys'](_0x28d3cc,function(_0x594075,_0x4ff792){return _0x594075[_0x3182db];});for(var _0x2d8ddf in _0x48e125){if(_0x48e125[_0xb00b('0x12')](_0x2d8ddf)){if(!_0x5a63ed[_0x2d8ddf]){delete _0x48e125[_0x2d8ddf];}}}}Realtime[_0xb00b('0x13')][_0xb00b('0x14')]=function(_0x1f1c1d,_0x4ada81){for(var _0x218de2 in _0x4ada81){if(_0x1f1c1d[_0xb00b('0x12')](_0x218de2)){_0x1f1c1d[_0x218de2]=_0x4ada81[_0x218de2];}}};Realtime['prototype'][_0xb00b('0x15')]=function(){var _0x1084a6=this;return function(_0x540b79){if(_0x540b79){freeIsNotKey(_0x540b79,_0x1084a6['agents'],'id');for(var _0x9b471e=0x0,_0x4dcd45={},_0x51d136={};_0x9b471e<_0x540b79[_0xb00b('0x16')];_0x9b471e+=0x1){_0x4dcd45=_0x540b79[_0x9b471e];if(_[_0xb00b('0x17')](_0x1084a6[_0xb00b('0x18')][_0x4dcd45['id']])){_0x1084a6[_0xb00b('0x18')][_0x4dcd45['id']]=new Agent(_0x4dcd45);}else{_0x1084a6['mergeFromDatabase'](_0x1084a6[_0xb00b('0x18')][_0x4dcd45['id']],_0x4dcd45);}}}return _0x1084a6['agents'];};};Realtime[_0xb00b('0x13')]['initIntervals']=function(){var _0x25d7a0=this;return function(_0x5e8d7b){if(_0x5e8d7b){freeIsNotKey(_0x5e8d7b,_0x25d7a0[_0xb00b('0x19')],'id');for(var _0x3355a3=0x0,_0x53ee68={},_0x55770c={};_0x3355a3<_0x5e8d7b[_0xb00b('0x16')];_0x3355a3+=0x1){_0x53ee68=_0x5e8d7b[_0x3355a3];if(_['isUndefined'](_0x25d7a0[_0xb00b('0x19')][_0x53ee68['id']])){_0x25d7a0[_0xb00b('0x19')][_0x53ee68['id']]=new Interval(_0x53ee68);}else{_0x25d7a0[_0xb00b('0x14')](_0x25d7a0[_0xb00b('0x19')][_0x53ee68['id']],_0x53ee68);}}}return _0x25d7a0['intervals'];};};Realtime[_0xb00b('0x13')]['initOpenchannelQueues']=function(){var _0x25a973=this;return function(_0x121ec7){if(_0x121ec7){freeIsNotKey(_0x121ec7,_0x25a973['openchannelQueues'],'id');for(var _0x231293=0x0,_0x2896d1={},_0x520444={};_0x231293<_0x121ec7[_0xb00b('0x16')];_0x231293+=0x1){_0x2896d1=_0x121ec7[_0x231293];if(_[_0xb00b('0x17')](_0x25a973['openchannelQueues'][_0x2896d1['id']])){_0x25a973[_0xb00b('0x8')][_0x2896d1['id']]=new OpenchannelQueue(_0x2896d1);}else{_0x25a973[_0xb00b('0x14')](_0x25a973[_0xb00b('0x8')][_0x2896d1['id']],_0x2896d1);}_0x25a973[_0xb00b('0x8')][_0x2896d1['id']]['updateRouting']();_0x25a973['openchannelQueues'][_0x2896d1['id']][_0xb00b('0x1a')]();}}return _0x25a973['openchannelQueues'];};};Realtime['prototype']['initChatQueues']=function(){var _0x16ac55=this;return function(_0x73b6b0){if(_0x73b6b0){freeIsNotKey(_0x73b6b0,_0x16ac55[_0xb00b('0x9')],'id');for(var _0x3825af=0x0,_0x1f14fa={},_0x197379={};_0x3825af<_0x73b6b0[_0xb00b('0x16')];_0x3825af+=0x1){_0x1f14fa=_0x73b6b0[_0x3825af];if(_['isUndefined'](_0x16ac55[_0xb00b('0x9')][_0x1f14fa['id']])){_0x16ac55['chatQueues'][_0x1f14fa['id']]=new ChatQueue(_0x1f14fa);}else{_0x16ac55[_0xb00b('0x14')](_0x16ac55[_0xb00b('0x9')][_0x1f14fa['id']],_0x1f14fa);}_0x16ac55[_0xb00b('0x9')][_0x1f14fa['id']]['updateRouting']();_0x16ac55[_0xb00b('0x9')][_0x1f14fa['id']][_0xb00b('0x1a')]();}}return _0x16ac55[_0xb00b('0x9')];};};Realtime[_0xb00b('0x13')][_0xb00b('0x1b')]=function(){var _0x2b9824=this;return function(_0x2e160a){if(_0x2e160a){freeIsNotKey(_0x2e160a,_0x2b9824[_0xb00b('0xa')],'id');for(var _0x149c1a=0x0,_0x54e247={},_0x2b5f41={};_0x149c1a<_0x2e160a[_0xb00b('0x16')];_0x149c1a+=0x1){_0x54e247=_0x2e160a[_0x149c1a];if(_['isUndefined'](_0x2b9824[_0xb00b('0xa')][_0x54e247['id']])){_0x2b9824[_0xb00b('0xa')][_0x54e247['id']]=new SmsQueue(_0x54e247);}else{_0x2b9824['mergeFromDatabase'](_0x2b9824[_0xb00b('0xa')][_0x54e247['id']],_0x54e247);}_0x2b9824['smsQueues'][_0x54e247['id']][_0xb00b('0x1c')]();_0x2b9824[_0xb00b('0xa')][_0x54e247['id']][_0xb00b('0x1a')]();}}return _0x2b9824[_0xb00b('0xa')];};};Realtime[_0xb00b('0x13')][_0xb00b('0x1d')]=function(){var _0x17f613=this;return function(_0x594840){if(_0x594840){freeIsNotKey(_0x594840,_0x17f613['mailQueues'],'id');for(var _0x5b04c2=0x0,_0x347e73={},_0xc21102={};_0x5b04c2<_0x594840[_0xb00b('0x16')];_0x5b04c2+=0x1){_0x347e73=_0x594840[_0x5b04c2];if(_[_0xb00b('0x17')](_0x17f613['mailQueues'][_0x347e73['id']])){_0x17f613[_0xb00b('0xb')][_0x347e73['id']]=new MailQueue(_0x347e73);}else{_0x17f613[_0xb00b('0x14')](_0x17f613[_0xb00b('0xb')][_0x347e73['id']],_0x347e73);}_0x17f613[_0xb00b('0xb')][_0x347e73['id']][_0xb00b('0x1c')]();_0x17f613[_0xb00b('0xb')][_0x347e73['id']][_0xb00b('0x1a')]();}}return _0x17f613[_0xb00b('0xb')];};};Realtime['prototype']['initFaxQueues']=function(){var _0x2ea41d=this;return function(_0x56022e){if(_0x56022e){freeIsNotKey(_0x56022e,_0x2ea41d[_0xb00b('0xc')],'id');for(var _0x1c5400=0x0,_0x29579b={},_0x45ca74={};_0x1c5400<_0x56022e[_0xb00b('0x16')];_0x1c5400+=0x1){_0x29579b=_0x56022e[_0x1c5400];if(_[_0xb00b('0x17')](_0x2ea41d[_0xb00b('0xc')][_0x29579b['id']])){_0x2ea41d['faxQueues'][_0x29579b['id']]=new FaxQueue(_0x29579b);}else{_0x2ea41d[_0xb00b('0x14')](_0x2ea41d[_0xb00b('0xc')][_0x29579b['id']],_0x29579b);}_0x2ea41d[_0xb00b('0xc')][_0x29579b['id']][_0xb00b('0x1c')]();_0x2ea41d[_0xb00b('0xc')][_0x29579b['id']][_0xb00b('0x1a')]();}}return _0x2ea41d['faxQueues'];};};Realtime[_0xb00b('0x13')][_0xb00b('0x1e')]=function(){var _0x4801e7=this;return function(_0x17ff34){if(_0x17ff34){freeIsNotKey(_0x17ff34,_0x4801e7[_0xb00b('0xd')],'id');for(var _0xa2ae04=0x0,_0x2d8620={},_0x2954e8={};_0xa2ae04<_0x17ff34['length'];_0xa2ae04+=0x1){_0x2d8620=_0x17ff34[_0xa2ae04];if(_[_0xb00b('0x17')](_0x4801e7[_0xb00b('0xd')][_0x2d8620['id']])){_0x4801e7[_0xb00b('0xd')][_0x2d8620['id']]=new WhatsappQueue(_0x2d8620);}else{_0x4801e7[_0xb00b('0x14')](_0x4801e7['whatsappQueues'][_0x2d8620['id']],_0x2d8620);}_0x4801e7['whatsappQueues'][_0x2d8620['id']][_0xb00b('0x1c')]();_0x4801e7[_0xb00b('0xd')][_0x2d8620['id']][_0xb00b('0x1a')]();}}return _0x4801e7[_0xb00b('0xd')];};};module[_0xb00b('0x1f')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 4deef9d..b94306b 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 _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 +var _0x1318=['Request','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x3d372a,_0x114db8){var _0x210a44=function(_0x1acac6){while(--_0x1acac6){_0x3d372a['push'](_0x3d372a['shift']());}};_0x210a44(++_0x114db8);}(_0x1318,0x1be));var _0x8131=function(_0x5bcf77,_0x338187){_0x5bcf77=_0x5bcf77-0x0;var _0x1f95f6=_0x1318[_0x5bcf77];return _0x1f95f6;};'use strict';var client=require(_0x8131('0x0'));exports[_0x8131('0x1')]=function(_0x15c1de,_0x3c7805){return client[_0x8131('0x2')]('UpdateChatInteraction',{'body':_0x3c7805,'options':{'where':{'id':_0x15c1de}},'log':_0x8131('0x3')});};exports[_0x8131('0x4')]=function(_0x24afda,_0x53ae98){return client[_0x8131('0x2')](_0x8131('0x5'),{'body':_0x53ae98,'options':{'where':{'id':_0x24afda}},'log':_0x8131('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index a9b2c05..622dacb 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 _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 +var _0xcb9c=['../client','create','Request','createChatMessage'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xcb9c,0xf8));var _0xccb9=function(_0x1c8f0d,_0x4fef6c){_0x1c8f0d=_0x1c8f0d-0x0;var _0x4022f0=_0xcb9c[_0x1c8f0d];return _0x4022f0;};'use strict';var client=require(_0xccb9('0x0'));exports[_0xccb9('0x1')]=function(_0x522faa){return client[_0xccb9('0x2')]('CreateChatMessage',{'body':_0x522faa,'log':_0xccb9('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 733ba2e..dd6d646 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 _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 +var _0xb0ec=['strategy','User','Agents','online','chatPause','getChatQueues','GetChatQueue','name','timeout'];(function(_0x86849d,_0x2471be){var _0x13006f=function(_0x22864d){while(--_0x22864d){_0x86849d['push'](_0x86849d['shift']());}};_0x13006f(++_0x2471be);}(_0xb0ec,0xb0));var _0xcb0e=function(_0x1730ce,_0x4fd5f3){_0x1730ce=_0x1730ce-0x0;var _0x2c7715=_0xb0ec[_0x1730ce];return _0x2c7715;};'use strict';var client=require('../client');exports[_0xcb0e('0x0')]=function(){return function(){return client['Request'](_0xcb0e('0x1'),{'options':{'raw':![],'attributes':['id',_0xcb0e('0x2'),_0xcb0e('0x3'),_0xcb0e('0x4')],'include':[{'model':_0xcb0e('0x5'),'as':_0xcb0e('0x6'),'attributes':['id',_0xcb0e('0x2'),_0xcb0e('0x7'),_0xcb0e('0x8')]}]},'log':_0xcb0e('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 2f8945a..659f0b8 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 _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 +var _0x4156=['update','UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport'];(function(_0x36dbfe,_0x37a44b){var _0xd7b914=function(_0x2c2182){while(--_0x2c2182){_0x36dbfe['push'](_0x36dbfe['shift']());}};_0xd7b914(++_0x37a44b);}(_0x4156,0xf1));var _0x6415=function(_0x358f34,_0x14355c){_0x358f34=_0x358f34-0x0;var _0x17f2b1=_0x4156[_0x358f34];return _0x17f2b1;};'use strict';var client=require(_0x6415('0x0'));exports[_0x6415('0x1')]=function(_0x283016){return client[_0x6415('0x2')](_0x6415('0x3'),{'body':_0x283016,'log':'CreateChatQueueReport'});};exports[_0x6415('0x4')]=function(_0x4d8c74,_0xfd06c2){return client[_0x6415('0x2')](_0x6415('0x5'),{'body':_0xfd06c2,'options':{'where':{'uniqueid':_0x4d8c74},'order':[['id',_0x6415('0x6')]],'limit':0x1},'log':_0x6415('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index ad11e4b..6242682 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 _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 +var _0x5d64=['Request','UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x306dcc,_0x5cb45b){var _0x85c4b4=function(_0x5590c0){while(--_0x5590c0){_0x306dcc['push'](_0x306dcc['shift']());}};_0x85c4b4(++_0x5cb45b);}(_0x5d64,0x1da));var _0x45d6=function(_0xb04a79,_0x485a98){_0xb04a79=_0xb04a79-0x0;var _0x4eb4f5=_0x5d64[_0xb04a79];return _0x4eb4f5;};'use strict';var client=require(_0x45d6('0x0'));exports[_0x45d6('0x1')]=function(_0x1759e3,_0x508d66){return client[_0x45d6('0x2')](_0x45d6('0x3'),{'body':_0x508d66,'options':{'where':{'id':_0x1759e3}},'log':_0x45d6('0x4')});};exports[_0x45d6('0x5')]=function(_0x456fd3,_0x2e3f97){return client['Request'](_0x45d6('0x6'),{'body':_0x2e3f97,'options':{'where':{'id':_0x456fd3}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 64bd8e2..bad3f11 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 _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 +var _0x0dd3=['CreateFaxMessage','../client','create','Request'];(function(_0x1e3c02,_0x5c07a2){var _0x4d26d7=function(_0x367ed9){while(--_0x367ed9){_0x1e3c02['push'](_0x1e3c02['shift']());}};_0x4d26d7(++_0x5c07a2);}(_0x0dd3,0x125));var _0x30dd=function(_0x1fb61a,_0x30c65c){_0x1fb61a=_0x1fb61a-0x0;var _0x10a10d=_0x0dd3[_0x1fb61a];return _0x10a10d;};'use strict';var client=require(_0x30dd('0x0'));exports[_0x30dd('0x1')]=function(_0x5c9b88){return client[_0x30dd('0x2')](_0x30dd('0x3'),{'body':_0x5c9b88,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index a787c53..1719b46 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 _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 +var _0x1a0e=['GetFaxQueue','name','timeout','strategy','User','online','../client','getFaxQueues','Request'];(function(_0x2f219a,_0x2c5ac0){var _0x5afcc1=function(_0x4fcdd1){while(--_0x4fcdd1){_0x2f219a['push'](_0x2f219a['shift']());}};_0x5afcc1(++_0x2c5ac0);}(_0x1a0e,0x180));var _0xe1a0=function(_0x3d368b,_0xbbc5db){_0x3d368b=_0x3d368b-0x0;var _0x579af1=_0x1a0e[_0x3d368b];return _0x579af1;};'use strict';var client=require(_0xe1a0('0x0'));exports[_0xe1a0('0x1')]=function(){return function(){return client[_0xe1a0('0x2')](_0xe1a0('0x3'),{'options':{'raw':![],'attributes':['id',_0xe1a0('0x4'),_0xe1a0('0x5'),_0xe1a0('0x6')],'include':[{'model':_0xe1a0('0x7'),'as':'Agents','attributes':['id',_0xe1a0('0x4'),_0xe1a0('0x8'),'faxPause']}]},'log':_0xe1a0('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index db7a383..2637af7 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 _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 +var _0x032f=['Request','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0x032f,0x7b));var _0xf032=function(_0x270933,_0x5da193){_0x270933=_0x270933-0x0;var _0x5c1497=_0x032f[_0x270933];return _0x5c1497;};'use strict';var client=require(_0xf032('0x0'));exports[_0xf032('0x1')]=function(_0x4dff3a){return client[_0xf032('0x2')]('CreateFaxQueueReport',{'body':_0x4dff3a,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x4556c4,_0x1881ce){return client[_0xf032('0x2')](_0xf032('0x3'),{'body':_0x1881ce,'options':{'where':{'uniqueid':_0x4556c4},'order':[['id',_0xf032('0x4')]],'limit':0x1},'log':_0xf032('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 94c6096..e34a81a 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 _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 +var _0xbaf0=['name','Interval','Intervals','interval','getIntervals','Request','GetInterval'];(function(_0x4828b1,_0x5c8cf3){var _0x1fec1b=function(_0x3f2e5a){while(--_0x3f2e5a){_0x4828b1['push'](_0x4828b1['shift']());}};_0x1fec1b(++_0x5c8cf3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var client=require('../client');exports[_0x0baf('0x0')]=function(){return function(){return client[_0x0baf('0x1')](_0x0baf('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x0baf('0x3')],'include':[{'model':_0x0baf('0x4'),'as':_0x0baf('0x5'),'attributes':['id','name',_0x0baf('0x6')]}]},'log':_0x0baf('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index dea100c..68083a4 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 _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 +var _0x6bbd=['update','updateMailInteraction','addTags','Request','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6bbd,0x15c));var _0xd6bb=function(_0x259a42,_0x2b4483){_0x259a42=_0x259a42-0x0;var _0x548d68=_0x6bbd[_0x259a42];return _0x548d68;};'use strict';var client=require('../client');exports[_0xd6bb('0x0')]=function(_0xf15d13,_0x5a03af){return client['Request']('UpdateMailInteraction',{'body':_0x5a03af,'options':{'where':{'id':_0xf15d13}},'log':_0xd6bb('0x1')});};exports[_0xd6bb('0x2')]=function(_0x2d24d3,_0x5a9bfb){return client[_0xd6bb('0x3')](_0xd6bb('0x4'),{'body':_0x5a9bfb,'options':{'where':{'id':_0x2d24d3}},'log':_0xd6bb('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index f359ecf..4700034 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 _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 +var _0x0047=['../client','create','Request','CreateMailMessage'];(function(_0x4bc6f5,_0xe1b220){var _0x2be1c8=function(_0x4ecebc){while(--_0x4ecebc){_0x4bc6f5['push'](_0x4bc6f5['shift']());}};_0x2be1c8(++_0xe1b220);}(_0x0047,0x144));var _0x7004=function(_0x2a1b33,_0x409f50){_0x2a1b33=_0x2a1b33-0x0;var _0x4c50e7=_0x0047[_0x2a1b33];return _0x4c50e7;};'use strict';var client=require(_0x7004('0x0'));exports[_0x7004('0x1')]=function(_0x434231){return client[_0x7004('0x2')](_0x7004('0x3'),{'body':_0x434231,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 9698596..b21d79d 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 _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 +var _0x08cd=['Agents','online','../client','getMailQueues','Request','GetMailQueue','name','strategy'];(function(_0x3f2cd5,_0x5bd3e7){var _0x1492b6=function(_0x2c94e8){while(--_0x2c94e8){_0x3f2cd5['push'](_0x3f2cd5['shift']());}};_0x1492b6(++_0x5bd3e7);}(_0x08cd,0x1aa));var _0xd08c=function(_0x1c2eaf,_0x118525){_0x1c2eaf=_0x1c2eaf-0x0;var _0x4865ac=_0x08cd[_0x1c2eaf];return _0x4865ac;};'use strict';var client=require(_0xd08c('0x0'));exports[_0xd08c('0x1')]=function(){return function(){return client[_0xd08c('0x2')](_0xd08c('0x3'),{'options':{'raw':![],'attributes':['id',_0xd08c('0x4'),'timeout',_0xd08c('0x5')],'include':[{'model':'User','as':_0xd08c('0x6'),'attributes':['id',_0xd08c('0x4'),_0xd08c('0x7'),'mailPause']}]},'log':_0xd08c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 5081af4..ab704c0 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 _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 +var _0x68d6=['update','UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x26bcec,_0xe13f50){var _0x1049dc=function(_0x4c0d9b){while(--_0x4c0d9b){_0x26bcec['push'](_0x26bcec['shift']());}};_0x1049dc(++_0xe13f50);}(_0x68d6,0x122));var _0x668d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x68d6[_0x4a9fb1];return _0x348672;};'use strict';var client=require(_0x668d('0x0'));exports[_0x668d('0x1')]=function(_0x40dc80){return client[_0x668d('0x2')](_0x668d('0x3'),{'body':_0x40dc80,'log':_0x668d('0x3')});};exports[_0x668d('0x4')]=function(_0x561eff,_0x48cde0){return client[_0x668d('0x2')](_0x668d('0x5'),{'body':_0x48cde0,'options':{'where':{'uniqueid':_0x561eff},'order':[['id',_0x668d('0x6')]],'limit':0x1},'log':_0x668d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index d89cf7d..4b65eaa 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 _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 +var _0x7e59=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x479f1a,_0x55e6f4){var _0x547801=function(_0x54b21d){while(--_0x54b21d){_0x479f1a['push'](_0x479f1a['shift']());}};_0x547801(++_0x55e6f4);}(_0x7e59,0xd3));var _0x97e5=function(_0x2ca247,_0x2a8dd1){_0x2ca247=_0x2ca247-0x0;var _0x26747d=_0x7e59[_0x2ca247];return _0x26747d;};'use strict';var client=require(_0x97e5('0x0'));exports[_0x97e5('0x1')]=function(_0x49a311,_0x112f0f){return client[_0x97e5('0x2')](_0x97e5('0x3'),{'body':_0x112f0f,'options':{'where':{'id':_0x49a311}},'log':'updateOpenchannelInteraction'});};exports[_0x97e5('0x4')]=function(_0x3426e1,_0xbf78aa){return client['Request'](_0x97e5('0x5'),{'body':_0xbf78aa,'options':{'where':{'id':_0x3426e1}},'log':_0x97e5('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index b13663c..24bf3bd 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 _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 +var _0x153f=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x58175c,_0x2d9373){var _0x55b88f=function(_0x13ed84){while(--_0x13ed84){_0x58175c['push'](_0x58175c['shift']());}};_0x55b88f(++_0x2d9373);}(_0x153f,0x15b));var _0xf153=function(_0x30ad3e,_0x3016f9){_0x30ad3e=_0x30ad3e-0x0;var _0x185e30=_0x153f[_0x30ad3e];return _0x185e30;};'use strict';var client=require(_0xf153('0x0'));exports[_0xf153('0x1')]=function(_0xde7eae){return client[_0xf153('0x2')](_0xf153('0x3'),{'body':_0xde7eae,'log':_0xf153('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 07fd24c..e7a9643 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 _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 +var _0x3192=['User','online','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy'];(function(_0x1a4eeb,_0x18e28f){var _0x16ef95=function(_0x5ca165){while(--_0x5ca165){_0x1a4eeb['push'](_0x1a4eeb['shift']());}};_0x16ef95(++_0x18e28f);}(_0x3192,0x122));var _0x2319=function(_0xa14fc0,_0x3d95a9){_0xa14fc0=_0xa14fc0-0x0;var _0xf3ee81=_0x3192[_0xa14fc0];return _0xf3ee81;};'use strict';var client=require(_0x2319('0x0'));exports[_0x2319('0x1')]=function(){return function(){return client[_0x2319('0x2')](_0x2319('0x3'),{'options':{'raw':![],'attributes':['id',_0x2319('0x4'),_0x2319('0x5'),_0x2319('0x6')],'include':[{'model':_0x2319('0x7'),'as':'Agents','attributes':['id','name',_0x2319('0x8'),'openchannelPause']}]},'log':_0x2319('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 2ecd5fe..5cfcdf2 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 _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 +var _0x8046=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0xf93076,_0x1acb30){var _0x33d1da=function(_0x29e6bf){while(--_0x29e6bf){_0xf93076['push'](_0xf93076['shift']());}};_0x33d1da(++_0x1acb30);}(_0x8046,0x1c5));var _0x6804=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x8046[_0x13d07a];return _0x5ee0ee;};'use strict';var client=require(_0x6804('0x0'));exports[_0x6804('0x1')]=function(_0xf04712){return client[_0x6804('0x2')](_0x6804('0x3'),{'body':_0xf04712,'log':'CreateOpenchannelQueueReport'});};exports[_0x6804('0x4')]=function(_0x402e50,_0x20f8f2){return client[_0x6804('0x2')](_0x6804('0x5'),{'body':_0x20f8f2,'options':{'where':{'uniqueid':_0x402e50},'order':[['id',_0x6804('0x6')]],'limit':0x1},'log':_0x6804('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index de034e4..0bc52ab 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 _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 +var _0x4975=['addTags','AddTagsToSmsInteraction','../client','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4975,0x86));var _0x5497=function(_0x3eab15,_0x3f4330){_0x3eab15=_0x3eab15-0x0;var _0x3b655a=_0x4975[_0x3eab15];return _0x3b655a;};'use strict';var client=require(_0x5497('0x0'));exports['update']=function(_0x474989,_0x3f9e37){return client[_0x5497('0x1')](_0x5497('0x2'),{'body':_0x3f9e37,'options':{'where':{'id':_0x474989}},'log':_0x5497('0x3')});};exports[_0x5497('0x4')]=function(_0x14cecb,_0xeb31af){return client[_0x5497('0x1')](_0x5497('0x5'),{'body':_0xeb31af,'options':{'where':{'id':_0x14cecb}},'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 3061d6d..f6dd734 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 _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 +var _0xca8e=['Request'];(function(_0xac3328,_0x23745a){var _0x33aec4=function(_0x476d1a){while(--_0x476d1a){_0xac3328['push'](_0xac3328['shift']());}};_0x33aec4(++_0x23745a);}(_0xca8e,0xbd));var _0xeca8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xca8e[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['create']=function(_0xf1f225){return client[_0xeca8('0x0')]('CreateSmsMessage',{'body':_0xf1f225,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 06cddf7..1045212 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 _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 +var _0x307e=['smsPause','../client','getSmsQueues','Request','GetSmsQueue','name','strategy','User'];(function(_0x55c06b,_0x1ab2da){var _0x12eb36=function(_0x4acd90){while(--_0x4acd90){_0x55c06b['push'](_0x55c06b['shift']());}};_0x12eb36(++_0x1ab2da);}(_0x307e,0xc9));var _0xe307=function(_0x73ded,_0x127047){_0x73ded=_0x73ded-0x0;var _0x21cc28=_0x307e[_0x73ded];return _0x21cc28;};'use strict';var client=require(_0xe307('0x0'));exports[_0xe307('0x1')]=function(){return function(){return client[_0xe307('0x2')](_0xe307('0x3'),{'options':{'raw':![],'attributes':['id',_0xe307('0x4'),'timeout',_0xe307('0x5')],'include':[{'model':_0xe307('0x6'),'as':'Agents','attributes':['id',_0xe307('0x4'),'online',_0xe307('0x7')]}]},'log':_0xe307('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index a151e32..cd7795f 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 _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 +var _0x7ebf=['update','UpdateSmsQueueReport','DESC','../client','create','Request','CreateSmsQueueReport'];(function(_0x5c6fdb,_0xeb3523){var _0x4d0f90=function(_0x3a981c){while(--_0x3a981c){_0x5c6fdb['push'](_0x5c6fdb['shift']());}};_0x4d0f90(++_0xeb3523);}(_0x7ebf,0x153));var _0xf7eb=function(_0x2f46e6,_0x1b50ec){_0x2f46e6=_0x2f46e6-0x0;var _0x51ec1d=_0x7ebf[_0x2f46e6];return _0x51ec1d;};'use strict';var client=require(_0xf7eb('0x0'));exports[_0xf7eb('0x1')]=function(_0x526b69){return client[_0xf7eb('0x2')](_0xf7eb('0x3'),{'body':_0x526b69,'log':_0xf7eb('0x3')});};exports[_0xf7eb('0x4')]=function(_0x13e0ce,_0x32a84b){return client[_0xf7eb('0x2')](_0xf7eb('0x5'),{'body':_0x32a84b,'options':{'where':{'uniqueid':_0x13e0ce},'order':[['id',_0xf7eb('0x6')]],'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 2de33cb..0b2505c 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 _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 +var _0x4ee6=['agent','name','pauseType','voicePause','chatPause','mailPause','faxPause','whatsappPause','openchannelPause','mailCapacity','faxCapacity','smsCapacity','openchannelCapacity','getAgents','../client','Request','GetUser'];(function(_0xee383f,_0x4137fc){var _0x1c048f=function(_0x2fee91){while(--_0x2fee91){_0xee383f['push'](_0xee383f['shift']());}};_0x1c048f(++_0x4137fc);}(_0x4ee6,0x1d9));var _0x64ee=function(_0x493cc9,_0x5caa65){_0x493cc9=_0x493cc9-0x0;var _0x214774=_0x4ee6[_0x493cc9];return _0x214774;};'use strict';var client=require(_0x64ee('0x0'));exports['getAgents']=function(){return function(){return client[_0x64ee('0x1')](_0x64ee('0x2'),{'options':{'raw':!![],'where':{'role':_0x64ee('0x3')},'attributes':['id',_0x64ee('0x4'),'online',_0x64ee('0x5'),'lastPauseAt',_0x64ee('0x6'),_0x64ee('0x7'),_0x64ee('0x8'),_0x64ee('0x9'),'smsPause',_0x64ee('0xa'),_0x64ee('0xb'),'chatCapacity',_0x64ee('0xc'),_0x64ee('0xd'),_0x64ee('0xe'),'whatsappCapacity',_0x64ee('0xf')]},'log':_0x64ee('0x10')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 939ed12..e82190c 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 _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 +var _0x7846=['UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request'];(function(_0x212394,_0x185eec){var _0x4c6b07=function(_0xce5652){while(--_0xce5652){_0x212394['push'](_0x212394['shift']());}};_0x4c6b07(++_0x185eec);}(_0x7846,0xf4));var _0x6784=function(_0x2df387,_0x1d3ea1){_0x2df387=_0x2df387-0x0;var _0x3b1708=_0x7846[_0x2df387];return _0x3b1708;};'use strict';var client=require('../client');exports[_0x6784('0x0')]=function(_0x2c4fd7,_0x3bc014){return client[_0x6784('0x1')](_0x6784('0x2'),{'body':_0x3bc014,'options':{'where':{'id':_0x2c4fd7}},'log':_0x6784('0x3')});};exports['addTags']=function(_0x13ba3e,_0x24c16b){return client[_0x6784('0x1')](_0x6784('0x4'),{'body':_0x24c16b,'options':{'where':{'id':_0x13ba3e}},'log':_0x6784('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 2562cfc..c1d89a0 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 _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 +var _0xbf43=['CreateWhatsappMessage','Request'];(function(_0x5960d3,_0x948e4a){var _0x233f9e=function(_0x4a1c48){while(--_0x4a1c48){_0x5960d3['push'](_0x5960d3['shift']());}};_0x233f9e(++_0x948e4a);}(_0xbf43,0x12d));var _0x3bf4=function(_0x59740a,_0x1721a9){_0x59740a=_0x59740a-0x0;var _0x771004=_0xbf43[_0x59740a];return _0x771004;};'use strict';var client=require('../client');exports['create']=function(_0x2d18d9){return client[_0x3bf4('0x0')](_0x3bf4('0x1'),{'body':_0x2d18d9,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index b02b764..5e4db54 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 _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 +var _0xa699=['GetWhatsappQueue','name','timeout','strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request'];(function(_0xd1fd13,_0x47e0ca){var _0x3590de=function(_0x5b6e7b){while(--_0x5b6e7b){_0xd1fd13['push'](_0xd1fd13['shift']());}};_0x3590de(++_0x47e0ca);}(_0xa699,0x6b));var _0x9a69=function(_0x15f3c0,_0x165a64){_0x15f3c0=_0x15f3c0-0x0;var _0x1adfe0=_0xa699[_0x15f3c0];return _0x1adfe0;};'use strict';var client=require(_0x9a69('0x0'));exports[_0x9a69('0x1')]=function(){return function(){return client[_0x9a69('0x2')](_0x9a69('0x3'),{'options':{'raw':![],'attributes':['id',_0x9a69('0x4'),_0x9a69('0x5'),_0x9a69('0x6')],'include':[{'model':_0x9a69('0x7'),'as':_0x9a69('0x8'),'attributes':['id',_0x9a69('0x4'),_0x9a69('0x9'),_0x9a69('0xa')]}]},'log':_0x9a69('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 007eed7..04939a4 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 _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 +var _0xe240=['DESC','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x243aca,_0x272cb3){var _0x4a586d=function(_0x388d8b){while(--_0x388d8b){_0x243aca['push'](_0x243aca['shift']());}};_0x4a586d(++_0x272cb3);}(_0xe240,0x13f));var _0x0e24=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xe240[_0x3d42d8];return _0x27fc41;};'use strict';var client=require('../client');exports[_0x0e24('0x0')]=function(_0x5f23bf){return client[_0x0e24('0x1')](_0x0e24('0x2'),{'body':_0x5f23bf,'log':'CreateWhatsappQueueReport'});};exports[_0x0e24('0x3')]=function(_0x1dd7f2,_0x2305f8){return client['Request'](_0x0e24('0x4'),{'body':_0x2305f8,'options':{'where':{'uniqueid':_0x1dd7f2},'order':[['id',_0x0e24('0x5')]],'limit':0x1},'log':_0x0e24('0x4')});}; \ 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 8a32690..6c1565d 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 _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 +var _0x545d=['toLowerCase','validate','length','error','map','join','find','agents','timeout','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','name'];(function(_0x21e2ea,_0x52661f){var _0x526033=function(_0x916338){while(--_0x916338){_0x21e2ea['push'](_0x21e2ea['shift']());}};_0x526033(++_0x52661f);}(_0x545d,0xe4));var _0xd545=function(_0x86231e,_0x50c1d8){_0x86231e=_0x86231e-0x0;var _0x2745e3=_0x545d[_0x86231e];return _0x2745e3;};'use strict';var schema=require('validate');var _=require(_0xd545('0x0'));var util=require(_0xd545('0x1'));var seqqueue=require(_0xd545('0x2'));var logger=require(_0xd545('0x3'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0xd545('0x4'),'required':!![],'message':_0xd545('0x5')},'timeout':{'type':_0xd545('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x2599c7,_0x47b3f4,_0x45e77c){return logger[_0xd545('0x7')](util[_0xd545('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x2599c7,_0x47b3f4[_0xd545('0x9')],_0x45e77c));}function handleFindAgent(_0x21d4cf){return function(_0x5a1687){return _0x5a1687[_0xd545('0x9')][_0xd545('0xa')]()===_0x21d4cf[_0xd545('0xa')]();};}exports['consequence']=function(_0x406126,_0xc9eb38,_0x29ba00,_0x43276){return function(_0x41b337){try{var _0x2d81a2={'name':_0xc9eb38[0x0],'timeout':_0xc9eb38[0x1]};var _0x5ebcf4=queue[_0xd545('0xb')](_0x2d81a2,{'typecast':!![]});if(_0x5ebcf4[_0xd545('0xc')]){logger[_0xd545('0xd')]('[%s][AGENT]\x20%s',_0x406126,_[_0xd545('0xe')](_0x5ebcf4,'message')[_0xd545('0xf')](',\x20'));_0x41b337['stop']();}else{var _0x5438f6=_[_0xd545('0x10')](_0x29ba00[_0xd545('0x11')],handleFindAgent(_0x2d81a2[_0xd545('0x9')]));if(_0x5438f6){var _0x439a60=(_0x2d81a2[_0xd545('0x12')]||0xa)*0x3e8;var _0x5ddc3e,_0x25f210;var _0x1f6848=seqqueue['createQueue'](_0x439a60);_0x1f6848['id']=_0x406126;_0x1f6848[_0xd545('0x13')]=_0x439a60;_0x1f6848['channel']=_0x43276[_0xd545('0x14')];writeLog(_0x406126,_0x5438f6,util[_0xd545('0x8')](_0xd545('0x15'),_0x439a60));_0x29ba00[_0xd545('0x16')][_0x406126]['on'](_0xd545('0x17'),function(){logger[_0xd545('0x7')](_0xd545('0x18'),_0x406126);clearTimeout(_0x25f210);_0x25f210=undefined;_0x1f6848[_0xd545('0x19')]();if(_0x29ba00[_0xd545('0x16')][_0x406126]){delete _0x29ba00[_0xd545('0x16')][_0x406126];}_0x41b337[_0xd545('0x1a')]();});_0x29ba00[_0xd545('0x16')][_0x406126]['on'](_0xd545('0x1b'),function(){if(_0x29ba00[_0xd545('0x16')][_0x406126]){delete _0x29ba00[_0xd545('0x16')][_0x406126];}});_0x25f210=setTimeout(function(){logger[_0xd545('0x7')](_0xd545('0x1c'),_0x406126);clearTimeout(_0x25f210);_0x1f6848['close']();_0x41b337['next']();},_0x439a60);strategy[_0xd545('0x1d')](_0x1f6848,_0x5438f6,_0x29ba00,_0x43276);}else{logger[_0xd545('0xd')](_0xd545('0x1e'),_0x406126,_0x2d81a2[_0xd545('0x9')]);_0x41b337['stop']();}}}catch(_0x3c7391){console[_0xd545('0x1f')](_0x3c7391);logger[_0xd545('0xd')](_0xd545('0x20'),_0x406126,_0x3c7391[_0xd545('0x21')]);_0x41b337['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 7486add..e81cf80 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 _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 +var _0x7e7d=['Failed','stringify','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','account','AccountId','upperFirst','InteractionId','created','isEmpty','Message','create','[%s][AMAZONLEX]\x20%s','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','body','postText','amazonlex','providerName','providerResponse','then','dialogState'];(function(_0x504a3c,_0x2bca40){var _0x6d2388=function(_0x5f2d9c){while(--_0x5f2d9c){_0x504a3c['push'](_0x504a3c['shift']());}};_0x6d2388(++_0x2bca40);}(_0x7e7d,0x66));var _0xd7e7=function(_0x3b1eee,_0x202fa6){_0x3b1eee=_0x3b1eee-0x0;var _0x293461=_0x7e7d[_0x3b1eee];return _0x293461;};'use strict';var _=require('lodash');var moment=require(_0xd7e7('0x0'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0xd7e7('0x1'))(_0xd7e7('0x2'));var rpc={'chatMessage':require(_0xd7e7('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xd7e7('0x4')),'smsMessage':require(_0xd7e7('0x5')),'faxMessage':require(_0xd7e7('0x6')),'whatsappMessage':require(_0xd7e7('0x7'))};exports[_0xd7e7('0x8')]=function(_0x52c890,_0x217d79){return function(_0x26e2b7){try{if(!_[_0xd7e7('0x9')](this[_0xd7e7('0xa')]['UserId'])){logger[_0xd7e7('0xb')]('[%s][AMAZONLEX]\x20%s',_0x52c890,_0xd7e7('0xc'));return _0x26e2b7[_0xd7e7('0xd')]();}var _0xb67482={'ContactId':this[_0xd7e7('0xe')]['id'],'sentAt':moment()[_0xd7e7('0xf')](_0xd7e7('0x10')),'direction':_0xd7e7('0x11')};if(this['channel']===_0xd7e7('0x12')||this[_0xd7e7('0x13')]===_0xd7e7('0x14')){_0xb67482[_0xd7e7('0x15')]=this[_0xd7e7('0xa')][_0xd7e7('0x15')];}var _0x88e280=this[_0xd7e7('0x13')];if(_0x88e280===_0xd7e7('0x16')){_0xb67482['ChatWebsiteId']=this[_0xd7e7('0x17')]['id'];}else{_0xb67482[_['upperFirst'](_0x88e280)+_0xd7e7('0x18')]=this[_0xd7e7('0x17')]['id'];}_0xb67482[_[_0xd7e7('0x19')](_0x88e280)+_0xd7e7('0x1a')]=this[_0xd7e7('0xa')]['id'];if(this[_0xd7e7('0xa')][_0xd7e7('0x1b')]){var _0x35c5de=_0x217d79[0x4];if(!_[_0xd7e7('0x1c')](_0x35c5de)){_0xb67482['body']=utils['getMustacheRender'](_0x35c5de,this);return rpc[_0x88e280+_0xd7e7('0x1d')][_0xd7e7('0x1e')](_0xb67482)['then'](function(_0x54cd63){logger[_0xd7e7('0xb')](_0xd7e7('0x1f'),_0x52c890,_0xb67482['body']);})[_0xd7e7('0x20')](function(_0x3faf6b){logger[_0xd7e7('0x21')]('[%s][AMAZONLEX]\x20%s',_0x52c890,JSON['stringify'](_0x3faf6b));})[_0xd7e7('0x22')](function(){logger['info'](_0xd7e7('0x23'),_0x52c890);_0x26e2b7[_0xd7e7('0x24')]();});}else{logger[_0xd7e7('0xb')](_0xd7e7('0x25'),_0x52c890);_0x26e2b7['stop']();}}else{var _0x2ff7ea=this;var _0x5e752c=new AWS[(_0xd7e7('0x26'))]({'accessKeyId':_0x217d79[0x0],'secretAccessKey':_0x217d79[0x1],'region':_0x217d79[0x2]});var _0x11b551={'botAlias':_0xd7e7('0x27'),'botName':_0x217d79[0x3],'inputText':this[_0xd7e7('0x28')][_0xd7e7('0x29')],'userId':this[_0xd7e7('0x13')]+':'+this[_0xd7e7('0xa')]['id']['toString']()};_0x5e752c[_0xd7e7('0x2a')](_0x11b551,function(_0x43faab,_0x1cd973){if(_0x43faab){logger['error'](_0xd7e7('0x1f'),_0x52c890,_0x43faab[_0xd7e7('0x28')]);_0x26e2b7[_0xd7e7('0xd')]();}else if(_0x1cd973&&_0x1cd973[_0xd7e7('0x28')]){_0x2ff7ea[_0xd7e7('0x29')][_0xd7e7('0x2b')]=_0x1cd973;_0xb67482['body']=_0x1cd973[_0xd7e7('0x28')];_0xb67482[_0xd7e7('0x2c')]=_0xd7e7('0x2b');_0xb67482[_0xd7e7('0x2d')]=JSON['stringify'](_0x1cd973);return rpc[_0x88e280+_0xd7e7('0x1d')]['create'](_0xb67482)[_0xd7e7('0x2e')](function(_0x14b652){logger[_0xd7e7('0xb')](_0xd7e7('0x1f'),_0x52c890,_0xb67482['body']);if(_0x1cd973[_0xd7e7('0x2f')]==_0xd7e7('0x30')){_0x26e2b7[_0xd7e7('0xd')]();}else{_0x26e2b7[_0xd7e7('0x24')]();}})['catch'](function(_0x5a90c0){logger[_0xd7e7('0x21')](_0xd7e7('0x1f'),_0x52c890,JSON[_0xd7e7('0x31')](_0x5a90c0));_0x26e2b7[_0xd7e7('0xd')]();});}else{_0x26e2b7[_0xd7e7('0xd')]();}});}}catch(_0x9334a8){logger['error'](_0xd7e7('0x1f'),_0x52c890,JSON['stringify'](_0x9334a8));_0x26e2b7['stop']();}};}; \ 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 1919af2..104c64c 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 _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 +var _0x1349=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','interaction','created','info','Autoreply\x20already\x20sent','next','channel','contact','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','from','mail','phone','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Smtp','service','port','secure','authentication','auth','user','pass','messageId','','replace','','headers','All','auto_reply','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','then','[%s][AUTOREPLY]\x20%s','catch','error','stringify','finally','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x37d839,_0x2cf4a5){var _0x4bb011=function(_0x2212f6){while(--_0x2212f6){_0x37d839['push'](_0x37d839['shift']());}};_0x4bb011(++_0x2cf4a5);}(_0x1349,0x1ac));var _0x9134=function(_0x8b201,_0x1c8499){_0x8b201=_0x8b201-0x0;var _0x267c7d=_0x1349[_0x8b201];return _0x267c7d;};'use strict';var _=require(_0x9134('0x0'));var moment=require(_0x9134('0x1'));var utils=require(_0x9134('0x2'));var logger=require(_0x9134('0x3'))(_0x9134('0x4'));var rpc={'chatMessage':require(_0x9134('0x5')),'openchannelMessage':require(_0x9134('0x6')),'mailMessage':require(_0x9134('0x7')),'smsMessage':require(_0x9134('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x9134('0x9'))};var mailRpc=require('../../mailRpc');exports[_0x9134('0xa')]=function(_0x16b31e,_0x23eb8e){return function(_0x51e360){try{if(_0x23eb8e[0x0]==='1'&&(_['isNil'](this[_0x9134('0xb')]['created'])||!this[_0x9134('0xb')][_0x9134('0xc')])){logger[_0x9134('0xd')]('[%s][AUTOREPLY]\x20%s',_0x16b31e,_0x9134('0xe'));return _0x51e360[_0x9134('0xf')]();}var _0x6e4a2e=this[_0x9134('0x10')];var _0x3366f7={'ContactId':this[_0x9134('0x11')]['id'],'sentAt':moment()['format'](_0x9134('0x12')),'direction':_0x9134('0x13')};if(this[_0x9134('0x10')]==='mail'){_0x3366f7[_0x9134('0x14')]=utils[_0x9134('0x15')](_0x23eb8e[0x2],this);}else{_0x3366f7[_0x9134('0x14')]=utils[_0x9134('0x15')](_0x23eb8e[0x1],this);}if(this[_0x9134('0x16')]){_0x3366f7['to']=this[_0x9134('0x16')][_0x9134('0x17')]||'';if(this[_0x9134('0x10')]===_0x9134('0x18')&&_0x23eb8e[0x1]==='1'){_0x3366f7['cc']=this[_0x9134('0x16')]['cc']||'';}_0x3366f7['from']=this['message']['to']||'';_0x3366f7[_0x9134('0x19')]=this[_0x9134('0x16')][_0x9134('0x19')]||'';_0x3366f7['read']=!![];if(this['message']['subject']){_0x3366f7[_0x9134('0x1a')]='';_0x3366f7[_0x9134('0x1a')]+=_[_0x9134('0x1b')](this[_0x9134('0x16')][_0x9134('0x1a')],_0x9134('0x1c'))?'':_0x9134('0x1d');_0x3366f7[_0x9134('0x1a')]+=this[_0x9134('0x16')][_0x9134('0x1a')];}}if(this[_0x9134('0x10')]==='chat'){_0x3366f7[_0x9134('0x1e')]=this[_0x9134('0x1f')]['id'];}else{_0x3366f7[_[_0x9134('0x20')](this['channel'])+_0x9134('0x21')]=this[_0x9134('0x1f')]['id'];}_0x3366f7[_['upperFirst'](this[_0x9134('0x10')])+_0x9134('0x22')]=this['interaction']['id'];if(rpc[this[_0x9134('0x10')]+'Message']){if(this[_0x9134('0x10')]===_0x9134('0x18')){var _0x50b0e5={'tls':{'rejectUnauthorized':![]}};if(this[_0x9134('0x1f')][_0x9134('0x23')][_0x9134('0x24')]){_0x50b0e5[_0x9134('0x24')]=this[_0x9134('0x1f')][_0x9134('0x23')]['service'];}else{_0x50b0e5['host']=this[_0x9134('0x1f')][_0x9134('0x23')]['host'];_0x50b0e5['port']=this[_0x9134('0x1f')][_0x9134('0x23')][_0x9134('0x25')];_0x50b0e5['secure']=this[_0x9134('0x1f')][_0x9134('0x23')][_0x9134('0x26')];}if(this['account'][_0x9134('0x23')][_0x9134('0x27')]){_0x50b0e5[_0x9134('0x28')]={'user':this[_0x9134('0x1f')]['Smtp'][_0x9134('0x29')],'pass':this[_0x9134('0x1f')][_0x9134('0x23')][_0x9134('0x2a')]};}_0x3366f7['inReplyTo']=this[_0x9134('0x16')][_0x9134('0x2b')];_0x3366f7['html']=_0x9134('0x2c')+_[_0x9134('0x2d')](_0x3366f7[_0x9134('0x14')],_0x9134('0x2e'),_0x9134('0x2f'))+_0x9134('0x30');_0x3366f7[_0x9134('0x31')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x9134('0x32'),'Precedence':_0x9134('0x33')};return mailRpc['sendMailMessage'](_0x50b0e5,_0x3366f7)['then'](function(_0x4517e7){logger[_0x9134('0xd')](_0x9134('0x34'),_0x16b31e);_0x3366f7[_0x9134('0x2b')]=_0x4517e7[_0x9134('0x16')][_0x9134('0x2b')];return rpc[_0x6e4a2e+_0x9134('0x35')][_0x9134('0x36')](_0x3366f7);})[_0x9134('0x37')](function(_0x3ac88a){logger[_0x9134('0xd')](_0x9134('0x38'),_0x16b31e,JSON['stringify'](_0x3ac88a));})[_0x9134('0x39')](function(_0x287d51){logger[_0x9134('0x3a')]('[RPC][%s][AUTOREPLY]\x20%s',_0x16b31e,JSON[_0x9134('0x3b')](_0x287d51));})[_0x9134('0x3c')](function(){_0x51e360[_0x9134('0xf')]();});}else{return rpc[this['channel']+_0x9134('0x35')][_0x9134('0x36')](_0x3366f7)['then'](function(_0x4ed7ba){logger[_0x9134('0xd')](_0x9134('0x38'),_0x16b31e,_0x3366f7[_0x9134('0x14')]);})[_0x9134('0x39')](function(_0x3152ca){logger[_0x9134('0x3a')](_0x9134('0x38'),_0x16b31e,JSON[_0x9134('0x3b')](_0x3152ca));})[_0x9134('0x3c')](function(){_0x51e360[_0x9134('0xf')]();});}}}catch(_0x158a86){logger[_0x9134('0x3a')](_0x9134('0x38'),_0x16b31e,JSON[_0x9134('0x3b')](_0x158a86));_0x51e360[_0x9134('0x3d')]();}};}; \ 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 0277882..139ef6c 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 _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 +var _0xfb65=['../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','error','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','routing'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xfb65,0x82));var _0x5fb6=function(_0x18caac,_0x21caf4){_0x18caac=_0x18caac-0x0;var _0x14ac14=_0xfb65[_0x18caac];return _0x14ac14;};'use strict';var moment=require('moment');var logger=require(_0x5fb6('0x0'))(_0x5fb6('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x5fb6('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x5fb6('0x3')),'faxInteraction':require(_0x5fb6('0x4')),'whatsappInteraction':require(_0x5fb6('0x5'))};exports[_0x5fb6('0x6')]=function(_0x3a3b1b,_0x1fefe3,_0x4dec8f,_0x50782b){return function(_0x238914){try{logger[_0x5fb6('0x7')](_0x5fb6('0x8'),_0x3a3b1b,_0x1fefe3[0x0]);var _0x840390={'closed':0x1,'closedAt':moment()['format'](_0x5fb6('0x9')),'closeReason':_0x5fb6('0xa'),'disposition':_0x1fefe3[0x0]};if(rpc[_0x50782b[_0x5fb6('0xb')]+_0x5fb6('0xc')]){rpc[_0x50782b['channel']+_0x5fb6('0xc')][_0x5fb6('0xd')](_0x50782b['interaction']['id'],_0x840390)[_0x5fb6('0xe')](function(_0x19387c){logger[_0x5fb6('0x7')](_0x5fb6('0xf'),_0x3a3b1b,_0x50782b[_0x5fb6('0x10')]['id']);})['catch'](function(_0x1927d0){logger[_0x5fb6('0x11')](_0x5fb6('0x12'),_0x3a3b1b,JSON[_0x5fb6('0x13')](_0x1927d0));})[_0x5fb6('0x14')](function(){_0x238914[_0x5fb6('0x15')]();});}}catch(_0x1a391f){logger[_0x5fb6('0x11')]('[%s][CLOSE]\x20%s',_0x3a3b1b,JSON['stringify'](_0x1a391f));_0x238914[_0x5fb6('0x15')]();}};}; \ 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 db71743..1519f41 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 _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 +var _0x1093=['contact','format','out','sms','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','created','body','getMustacheRender','Message','create','info','error','stringify','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','dialogflow','fulfillment','speech','providerName','providerResponse','endConversation','next','catch','moment','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1093,0xa5));var _0x3109=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x1093[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var moment=require(_0x3109('0x0'));var apiai=require('apiai-promise');var md5=require(_0x3109('0x1'));var utils=require('./utils');var logger=require(_0x3109('0x2'))(_0x3109('0x3'));var rpc={'chatMessage':require(_0x3109('0x4')),'openchannelMessage':require(_0x3109('0x5')),'mailMessage':require(_0x3109('0x6')),'smsMessage':require(_0x3109('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x3109('0x8'))};exports['consequence']=function(_0x2e9874,_0x561ac4){return function(_0x36145f){try{if(!_['isNil'](this['interaction']['UserId'])){logger['info'](_0x3109('0x9'),_0x2e9874,_0x3109('0xa'));return _0x36145f['next']();}var _0x5691c6={'ContactId':this[_0x3109('0xb')]['id'],'sentAt':moment()[_0x3109('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x3109('0xd')};if(this['channel']===_0x3109('0xe')||this[_0x3109('0xf')]==='whatsapp'){_0x5691c6[_0x3109('0x10')]=this['interaction'][_0x3109('0x10')];}var _0x4c65dc=this['channel'];if(_0x4c65dc===_0x3109('0x11')){_0x5691c6[_0x3109('0x12')]=this[_0x3109('0x13')]['id'];}else{_0x5691c6[_[_0x3109('0x14')](_0x4c65dc)+_0x3109('0x15')]=this[_0x3109('0x13')]['id'];}_0x5691c6[_[_0x3109('0x14')](_0x4c65dc)+'InteractionId']=this[_0x3109('0x16')]['id'];if(this[_0x3109('0x16')][_0x3109('0x17')]){var _0x25ccff=_0x561ac4[0x2];if(!_['isEmpty'](_0x25ccff)){_0x5691c6[_0x3109('0x18')]=utils[_0x3109('0x19')](_0x25ccff,this);return rpc[_0x4c65dc+_0x3109('0x1a')][_0x3109('0x1b')](_0x5691c6)['then'](function(_0x44da35){logger[_0x3109('0x1c')](_0x3109('0x9'),_0x2e9874,_0x5691c6[_0x3109('0x18')]);})['catch'](function(_0x171c98){logger[_0x3109('0x1d')]('[%s][DIALOGFLOW]\x20%s',_0x2e9874,JSON[_0x3109('0x1e')](_0x171c98));})['finally'](function(){logger[_0x3109('0x1c')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2e9874);_0x36145f[_0x3109('0x1f')]();});}else{logger[_0x3109('0x1c')](_0x3109('0x20'),_0x2e9874);_0x36145f['stop']();}}else{var _0x4aa1f9=this;var _0x545068=apiai(_0x561ac4[0x0],{'language':_0x561ac4[0x1]||'en'});return _0x545068[_0x3109('0x21')](this[_0x3109('0x22')][_0x3109('0x18')],{'sessionId':md5(this[_0x3109('0x16')]['id'])})[_0x3109('0x23')](function(_0x5b5d76){_0x4aa1f9[_0x3109('0x18')][_0x3109('0x24')]=_0x5b5d76;_0x5691c6[_0x3109('0x18')]=_0x5b5d76['result'][_0x3109('0x25')][_0x3109('0x26')];_0x5691c6[_0x3109('0x27')]=_0x3109('0x24');_0x5691c6[_0x3109('0x28')]=JSON[_0x3109('0x1e')](_0x5b5d76);return rpc[_0x4c65dc+_0x3109('0x1a')][_0x3109('0x1b')](_0x5691c6)['then'](function(_0x54c956){logger[_0x3109('0x1c')](_0x3109('0x9'),_0x2e9874,_0x5691c6[_0x3109('0x18')]);if(_0x5b5d76['result']['metadata'][_0x3109('0x29')]){_0x36145f[_0x3109('0x2a')]();}else{_0x36145f[_0x3109('0x1f')]();}})['catch'](function(_0x296bf7){logger[_0x3109('0x1d')]('[%s][DIALOGFLOW]\x20%s',_0x2e9874,JSON['stringify'](_0x296bf7));_0x36145f['next']();});})[_0x3109('0x2b')](function(_0xbd4fb1){logger[_0x3109('0x1d')]('[%s][DIALOGFLOW]\x20%s',_0x2e9874,_0xbd4fb1['message']);_0x36145f[_0x3109('0x2a')]();});}}catch(_0x3a184b){logger['error'](_0x3109('0x9'),_0x2e9874,JSON['stringify'](_0x3a184b));_0x36145f['stop']();}};}; \ 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 5f56771..0787901 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 _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 +var _0xf60b=['SessionsClient','sessionPath','message','detectIntent','diagnosticInfo','fields','queryResult','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','isFallback','DIALOGFLOWV2_LANGUAGECODE','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','providerResponse','length','fulfillmentText','push','all','dialogflow','md5','moment','bluebird','../../../../config/logger','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','create','then','info','catch','error','stringify','isNil','UserId','[%s][DIALOGFLOWV2]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','interaction','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','Message','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace'];(function(_0xbe2d32,_0xc7312a){var _0x770cd1=function(_0x1b44ba){while(--_0x1b44ba){_0xbe2d32['push'](_0xbe2d32['shift']());}};_0x770cd1(++_0xc7312a);}(_0xf60b,0x183));var _0xbf60=function(_0x58eec7,_0x2353db){_0x58eec7=_0x58eec7-0x0;var _0x25c5d3=_0xf60b[_0x58eec7];return _0x25c5d3;};'use strict';var _=require('lodash');var dialogflow=require(_0xbf60('0x0'));var md5=require(_0xbf60('0x1'));var moment=require(_0xbf60('0x2'));var Promise=require(_0xbf60('0x3'));var logger=require(_0xbf60('0x4'))('routing');var utils=require(_0xbf60('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xbf60('0x6')),'mailMessage':require(_0xbf60('0x7')),'smsMessage':require(_0xbf60('0x8')),'faxMessage':require(_0xbf60('0x9')),'whatsappMessage':require(_0xbf60('0xa'))};function createMessage(_0x4430e3,_0x48dfc6,_0x5980bc,_0xa71139){return new Promise(function(_0x1256b0,_0x34e7ef){var _0x28325a=_[_0xbf60('0xb')](_0x5980bc);_0x28325a[_0xbf60('0xc')]=_0xa71139;return rpc[_0x48dfc6+'Message'][_0xbf60('0xd')](_0x28325a)[_0xbf60('0xe')](function(){logger[_0xbf60('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x4430e3,_0x28325a[_0xbf60('0xc')]);_0x1256b0();})[_0xbf60('0x10')](function(_0xae772e){logger[_0xbf60('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x4430e3,JSON[_0xbf60('0x12')](_0xae772e));_0x34e7ef(_0xae772e);});});}exports['consequence']=function(_0x286108,_0x29cc8c){return function(_0x5554c1){try{if(!_[_0xbf60('0x13')](this['interaction'][_0xbf60('0x14')])){logger['info'](_0xbf60('0x15'),_0x286108,_0xbf60('0x16'));return _0x5554c1[_0xbf60('0x17')]();}var _0x22ca80={'ContactId':this['contact']['id'],'sentAt':moment()[_0xbf60('0x18')](_0xbf60('0x19')),'direction':_0xbf60('0x1a')};if(this[_0xbf60('0x1b')]===_0xbf60('0x1c')||this[_0xbf60('0x1b')]===_0xbf60('0x1d')){_0x22ca80['phone']=this[_0xbf60('0x1e')][_0xbf60('0x1f')];}var _0x317b78=this[_0xbf60('0x1b')];if(_0x317b78===_0xbf60('0x20')){_0x22ca80[_0xbf60('0x21')]=this[_0xbf60('0x22')]['id'];}else{_0x22ca80[_[_0xbf60('0x23')](_0x317b78)+_0xbf60('0x24')]=this[_0xbf60('0x22')]['id'];}_0x22ca80[_[_0xbf60('0x23')](_0x317b78)+_0xbf60('0x25')]=this[_0xbf60('0x1e')]['id'];if(this[_0xbf60('0x1e')][_0xbf60('0x26')]){var _0x24a2f6=_0x29cc8c[0x4];if(!_['isEmpty'](_0x24a2f6)){_0x22ca80[_0xbf60('0xc')]=utils[_0xbf60('0x27')](_0x24a2f6,this);return rpc[_0x317b78+_0xbf60('0x28')][_0xbf60('0xd')](_0x22ca80)['then'](function(_0x51a69f){logger[_0xbf60('0xf')](_0xbf60('0x15'),_0x286108,_0x22ca80['body']);})['catch'](function(_0x487e1e){logger[_0xbf60('0x11')](_0xbf60('0x15'),_0x286108,JSON[_0xbf60('0x12')](_0x487e1e));})['finally'](function(){logger['info'](_0xbf60('0x29'),_0x286108);_0x5554c1['stop']();});}else{logger[_0xbf60('0xf')](_0xbf60('0x2a'),_0x286108);_0x5554c1[_0xbf60('0x2b')]();}}else{var _0x1420e0=this;var _0x3184c0=_0x29cc8c[0x2][_0xbf60('0x2c')](/\\n/g,'\x0a');var _0x5bd5a8={'credentials':{'private_key':_0x3184c0,'client_email':_0x29cc8c[0x1]}};var _0xe5313=new dialogflow[(_0xbf60('0x2d'))](_0x5bd5a8);var _0x4a0f73=_0xe5313[_0xbf60('0x2e')](_0x29cc8c[0x0],md5(_0x1420e0['interaction']['id']));var _0xea2270={'session':_0x4a0f73,'queryInput':{'text':{'text':_0x1420e0[_0xbf60('0x2f')][_0xbf60('0xc')],'languageCode':_0x29cc8c[0x3]||'en'}}};return _0xe5313[_0xbf60('0x30')](_0xea2270)['then'](function(_0x5646a0){if(_0x5646a0&&_0x5646a0['length']){_0x1420e0[_0xbf60('0xc')]['dialogflowV2']=_0x5646a0;var _0x2fffbb=_0x5646a0[0x0];var _0x38904d=_0x2fffbb['queryResult'][_0xbf60('0x31')]&&_0x2fffbb['queryResult'][_0xbf60('0x31')][_0xbf60('0x32')]?_0x2fffbb[_0xbf60('0x33')][_0xbf60('0x31')][_0xbf60('0x32')][_0xbf60('0x34')][_0xbf60('0x35')]:![];_0x1420e0['body'][_0xbf60('0x36')]=_0x2fffbb['queryResult'][_0xbf60('0x37')];_0x1420e0[_0xbf60('0xc')][_0xbf60('0x38')]=_0x2fffbb['queryResult']['allRequiredParamsPresent'];_0x1420e0[_0xbf60('0xc')][_0xbf60('0x39')]=_0x2fffbb[_0xbf60('0x33')][_0xbf60('0x31')]&&_0x2fffbb[_0xbf60('0x33')]['diagnosticInfo']['fields']?_0x2fffbb[_0xbf60('0x33')][_0xbf60('0x31')][_0xbf60('0x32')][_0xbf60('0x34')][_0xbf60('0x35')]:![];_0x1420e0['body'][_0xbf60('0x3a')]=_0x2fffbb['queryResult']['intent']['name'];_0x1420e0[_0xbf60('0xc')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x2fffbb[_0xbf60('0x33')][_0xbf60('0x3b')]['displayName'];_0x1420e0['body']['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x2fffbb[_0xbf60('0x33')][_0xbf60('0x3b')][_0xbf60('0x3c')];_0x1420e0['body'][_0xbf60('0x3d')]=_0x2fffbb[_0xbf60('0x33')]['languageCode'];_0x1420e0['body']['DIALOGFLOWV2_QUERYTEXT']=_0x2fffbb[_0xbf60('0x33')][_0xbf60('0x3e')];_0x1420e0[_0xbf60('0xc')][_0xbf60('0x3f')]=_0x2fffbb[_0xbf60('0x33')][_0xbf60('0x40')];_0x22ca80[_0xbf60('0x41')]=_0xbf60('0x42');_0x22ca80[_0xbf60('0x43')]=JSON[_0xbf60('0x12')](_0x5646a0);var _0x40d08f=[];for(var _0x1910c6=0x0;_0x1910c6<_0x5646a0[_0xbf60('0x44')];_0x1910c6++){var _0x396723=_0x5646a0[_0x1910c6];if(_0x396723&&_0x396723[_0xbf60('0x33')]&&_0x396723[_0xbf60('0x33')][_0xbf60('0x45')]){_0x40d08f[_0xbf60('0x46')](createMessage(_0x286108,_0x317b78,_0x22ca80,_0x396723[_0xbf60('0x33')][_0xbf60('0x45')]));}}return Promise[_0xbf60('0x47')](_0x40d08f)[_0xbf60('0xe')](function(){if(_0x38904d){_0x5554c1[_0xbf60('0x17')]();}else{_0x5554c1[_0xbf60('0x2b')]();}})['catch'](function(_0x435f3e){logger[_0xbf60('0x11')](_0xbf60('0x15'),_0x286108,JSON[_0xbf60('0x12')](_0x435f3e));_0x5554c1[_0xbf60('0x17')]();});}})['catch'](function(_0x34ccc9){logger[_0xbf60('0x11')](_0xbf60('0x15'),_0x286108,_0x34ccc9[_0xbf60('0x2f')]);_0x5554c1[_0xbf60('0x17')]();});}}catch(_0x5f2df9){logger[_0xbf60('0x11')](_0xbf60('0x15'),_0x286108,JSON['stringify'](_0x5f2df9));_0x5554c1[_0xbf60('0x2b')]();}};}; \ 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 58d2df8..023b6db 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 _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 +var _0x90fe=['[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stop','stringify','validate','lodash','html-to-text','./utils','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','join','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x90fe,0x138));var _0xe90f=function(_0x6ea431,_0x2c15e9){_0x6ea431=_0x6ea431-0x0;var _0x2e816f=_0x90fe[_0x6ea431];return _0x2e816f;};'use strict';var schema=require(_0xe90f('0x0'));var _=require(_0xe90f('0x1'));var htmlToText=require(_0xe90f('0x2'));var utils=require(_0xe90f('0x3'));var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xe90f('0x4')},'priorityTrue':{'type':_0xe90f('0x5'),'message':_0xe90f('0x6')},'priorityFalse':{'type':'number','message':_0xe90f('0x7')}});exports[_0xe90f('0x8')]=function(_0x3a400b,_0x256fc4){return function(_0x3ddf8d){try{var _0x1569af={'condition':htmlToText[_0xe90f('0x9')](utils[_0xe90f('0xa')](_0x256fc4[0x0],this),{'wordwrap':![]})[_0xe90f('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x256fc4[0x1],'priorityFalse':_0x256fc4[0x2]};var _0x9e53e=gotoif[_0xe90f('0x0')](_0x1569af,{'typecast':!![]});if(_0x9e53e[_0xe90f('0xc')]){logger[_0xe90f('0xd')](_0xe90f('0xe'),_0x3a400b,_['map'](_0x9e53e,'message')[_0xe90f('0xf')](',\x20'));_0x3ddf8d['stop']();}else{try{var _0x3a26f3=eval('('+_0x1569af[_0xe90f('0x10')]+')');var _0xa1cd59=_0x3a26f3?_0x1569af['priorityTrue']:_0x1569af[_0xe90f('0x11')];logger[_0xe90f('0x12')](_0xe90f('0x13'),_0x3a400b,_0x1569af[_0xe90f('0x10')],_0x3a26f3,_0xa1cd59||_0xe90f('0x14'));if(_0xa1cd59){var _0x550f8a=_[_0xe90f('0x15')](_0x3ddf8d['rules'](),{'p':_0xa1cd59});if(_0x550f8a>=0x0){logger[_0xe90f('0x12')](_0xe90f('0x16'),_0x3a400b,_0xa1cd59||_0xe90f('0x14'),_0x550f8a);_0x3ddf8d[_0xe90f('0x14')](_0x550f8a);}else{logger[_0xe90f('0x12')](_0xe90f('0x17'),_0x3a400b,_0xa1cd59||_0xe90f('0x14'));_0x3ddf8d['stop']();}}else{_0x3ddf8d[_0xe90f('0x14')]();}}catch(_0x3df267){logger['error'](_0xe90f('0x18'),_0x3a400b,_0x3df267[_0xe90f('0x19')]);_0x3ddf8d[_0xe90f('0x1a')]();}}}catch(_0x15f429){logger[_0xe90f('0xd')](_0xe90f('0xe'),_0x3a400b,JSON[_0xe90f('0x1b')](_0x15f429));_0x3ddf8d['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 957d133..5ebd02a 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 _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 +var _0x8a8a=['length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence'];(function(_0x42b202,_0x424a07){var _0x1aeee7=function(_0x7c9806){while(--_0x7c9806){_0x42b202['push'](_0x42b202['shift']());}};_0x1aeee7(++_0x424a07);}(_0x8a8a,0xaf));var _0xa8a8=function(_0x5ed36e,_0x18630f){_0x5ed36e=_0x5ed36e-0x0;var _0x16d657=_0x8a8a[_0x5ed36e];return _0x16d657;};'use strict';var schema=require('validate');var _=require(_0xa8a8('0x0'));var logger=require(_0xa8a8('0x1'))('routing');var gotop=schema({'priority':{'type':_0xa8a8('0x2'),'required':!![],'message':_0xa8a8('0x3')}});exports[_0xa8a8('0x4')]=function(_0x193200,_0x107054){return function(_0x2217b3){try{var _0x2a55f1={'priority':_0x107054[0x0]};var _0x25ad80=gotop['validate'](_0x2a55f1,{'typecast':!![]});if(_0x25ad80[_0xa8a8('0x5')]){logger[_0xa8a8('0x6')](_0xa8a8('0x7'),_0x193200,_[_0xa8a8('0x8')](_0x25ad80,_0xa8a8('0x9'))[_0xa8a8('0xa')](',\x20'));_0x2217b3[_0xa8a8('0xb')]();}else{logger[_0xa8a8('0xc')](_0xa8a8('0xd'),_0x193200,_0x2a55f1[_0xa8a8('0xe')]);if(_0x2a55f1['priority']){var _0x129ad9=_[_0xa8a8('0xf')](_0x2217b3[_0xa8a8('0x10')](),{'p':_0x2a55f1[_0xa8a8('0xe')]});if(_0x129ad9>=0x0){logger[_0xa8a8('0xc')](_0xa8a8('0x11'),_0x193200,_0x2a55f1[_0xa8a8('0xe')]||'next',_0x129ad9);_0x2217b3[_0xa8a8('0x12')](_0x129ad9);}else{logger[_0xa8a8('0xc')](_0xa8a8('0x13'),_0x193200,_0x2a55f1[_0xa8a8('0xe')]||'next');_0x2217b3[_0xa8a8('0xb')]();}}else{_0x2217b3[_0xa8a8('0x12')]();}}}catch(_0xc315d3){logger[_0xa8a8('0x6')]('[%s][GOTOP]\x20%s',_0x193200,JSON['stringify'](_0xc315d3));_0x2217b3['stop']();}};}; \ 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 7e3d1f9..8bb94bd 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 _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 +var _0x3c00=['../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','chat','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','routing','../../rpc/openchannelMessage'];(function(_0x4de9e8,_0x565ffa){var _0x4db0de=function(_0x12279d){while(--_0x12279d){_0x4de9e8['push'](_0x4de9e8['shift']());}};_0x4db0de(++_0x565ffa);}(_0x3c00,0x135));var _0x03c0=function(_0x1b150a,_0x19e8b8){_0x1b150a=_0x1b150a-0x0;var _0x1cc157=_0x3c00[_0x1b150a];return _0x1cc157;};'use strict';var _=require(_0x03c0('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x03c0('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x03c0('0x2')),'mailMessage':require(_0x03c0('0x3')),'smsMessage':require(_0x03c0('0x4')),'faxMessage':require(_0x03c0('0x5')),'whatsappMessage':require(_0x03c0('0x6'))};exports[_0x03c0('0x7')]=function(_0x57afc6,_0xd7485b){return function(_0x553ccb){try{var _0x1d3119={'body':utils[_0x03c0('0x8')](_0xd7485b[0x0],this),'ContactId':this['contact']['id']};if(this[_0x03c0('0x9')]===_0x03c0('0xa')){_0x1d3119['ChatWebsiteId']=this[_0x03c0('0xb')]['id'];}else{_0x1d3119[_[_0x03c0('0xc')](this[_0x03c0('0x9')])+'AccountId']=this['account']['id'];}_0x1d3119[_[_0x03c0('0xc')](this['channel'])+_0x03c0('0xd')]=this[_0x03c0('0xe')]['id'];if(rpc[this[_0x03c0('0x9')]+_0x03c0('0xf')]){return rpc[this[_0x03c0('0x9')]+_0x03c0('0xf')][_0x03c0('0x10')](_0x1d3119)[_0x03c0('0x11')](function(_0x2216fc){logger[_0x03c0('0x12')](_0x03c0('0x13'),_0x57afc6,_0x1d3119[_0x03c0('0x14')]);_0x553ccb[_0x03c0('0x15')]();})[_0x03c0('0x16')](function(_0x2eef7e){logger[_0x03c0('0x17')](_0x03c0('0x13'),_0x57afc6,JSON[_0x03c0('0x18')](_0x2eef7e));_0x553ccb[_0x03c0('0x19')]();});}}catch(_0x5c6c6f){logger[_0x03c0('0x17')](_0x03c0('0x13'),_0x57afc6,JSON[_0x03c0('0x18')](_0x5c6c6f));_0x553ccb['stop']();}};}; \ 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 21c00b2..01717fa 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 _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 +var _0xe8b1=['info','getMustacheRender','error','[%s][NOOP]\x20%s','stringify','stop','../../../../config/logger'];(function(_0x899fda,_0x39e464){var _0x4ef383=function(_0x3a4de7){while(--_0x3a4de7){_0x899fda['push'](_0x899fda['shift']());}};_0x4ef383(++_0x39e464);}(_0xe8b1,0x18e));var _0x1e8b=function(_0x4f526c,_0x6c4dbe){_0x4f526c=_0x4f526c-0x0;var _0x38a51e=_0xe8b1[_0x4f526c];return _0x38a51e;};'use strict';var utils=require('./utils');var logger=require(_0x1e8b('0x0'))('routing');exports['consequence']=function(_0x4067b2,_0x584cb5){return function(_0x76772c){try{logger[_0x1e8b('0x1')]('[%s][NOOP]\x20%s',_0x4067b2,utils[_0x1e8b('0x2')](_0x584cb5[0x0],this));_0x76772c['next']();}catch(_0x33d0e4){logger[_0x1e8b('0x3')](_0x1e8b('0x4'),_0x4067b2,JSON[_0x1e8b('0x5')](_0x33d0e4));_0x76772c[_0x1e8b('0x6')]();}};}; \ 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 6935aa9..ad0f495 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 _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 +var _0x3e74=['beepall','log','stack','validate','util','seq-queue','moment','../../../../config/logger','./strategy','redis','defaults','localhost','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','MessageId','message','channel','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','strategy','rrmemory'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0x3e74,0x175));var _0x43e7=function(_0x173737,_0x1550d1){_0x173737=_0x173737-0x0;var _0x2cf9b0=_0x3e74[_0x173737];return _0x2cf9b0;};'use strict';var schema=require(_0x43e7('0x0'));var _=require('lodash');var util=require(_0x43e7('0x1'));var seqqueue=require(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('routing');var strategy=require(_0x43e7('0x5'));config[_0x43e7('0x6')]=_[_0x43e7('0x7')](config[_0x43e7('0x6')],{'host':_0x43e7('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43e7('0x6')]));var attributes=['id',_0x43e7('0x9'),_0x43e7('0xa'),_0x43e7('0xb'),_0x43e7('0xc'),'joinAt'];function emit(_0x212c6c,_0x554d44,_0x54948c){io['to'](_0x212c6c)[_0x43e7('0xd')](_0x554d44,_0x54948c);}function emitChannelQueueInteraction(_0x4139c9,_0x5c34f4,_0x2803d9,_0x513707,_0xf7c520,_0x37302c,_0x4ebc8e,_0x3eb206){var _0xc960ea=_[_0x43e7('0xe')](_0x2803d9);_0xc960ea[_0x43e7('0x9')]=_0x3eb206;_0xc960ea['queue']=_0x5c34f4;_0xc960ea['account']=_0x513707;_0xc960ea['id']=_0xf7c520;if(_0x37302c){_0x4ebc8e[util[_0x43e7('0xf')](_0x43e7('0x10'),_0x4139c9)][_0xf7c520]=_[_0x43e7('0x11')](_0xc960ea,attributes);}else{delete _0x4ebc8e[util['format']('%sQueuesWaitingInteractions',_0x4139c9)][_0xf7c520];}emit(util[_0x43e7('0xf')](_0x43e7('0x12'),_0x4139c9,_0x5c34f4),util[_0x43e7('0xf')](_0x43e7('0x13'),_0x4139c9,_0x37302c?'save':'remove'),_[_0x43e7('0x11')](_0xc960ea,attributes));}var rpc={'openchannelQueueReport':require(_0x43e7('0x14')),'mailQueueReport':require(_0x43e7('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x43e7('0x16')),'whatsappQueueReport':require(_0x43e7('0x17'))};var queue=schema({'name':{'type':_0x43e7('0x18'),'required':!![],'message':_0x43e7('0x19')},'timeout':{'type':_0x43e7('0x1a'),'message':_0x43e7('0x1b')}});function startRouting(_0x619236,_0x1441ef,_0x2377a3,_0xab63cf){if(_0x619236&&_0x1441ef&&_0x2377a3){_0x1441ef[_0x43e7('0x1c')]+=0x1;var _0x177ee1={'uniqueid':_0x619236,'from':_0x2377a3['body']?_0x2377a3[_0x43e7('0x1d')][_0x43e7('0xc')]:'','joinAt':moment()['format'](_0x43e7('0x1e')),'ContactId':_0x2377a3[_0x43e7('0x1f')]?_0x2377a3[_0x43e7('0x1f')]['id']:null,'ListId':_0x2377a3[_0x43e7('0x20')]?_0x2377a3[_0x43e7('0x20')]['id']:null};_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x22')]=_0x1441ef['id']||null;_0x177ee1[_['upperFirst'](_0x2377a3['channel'])+_0x43e7('0x23')]=_0x2377a3[_0x43e7('0x24')]?_0x2377a3['interaction']['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x25')]=_0x2377a3['message']?_0x2377a3[_0x43e7('0x26')]['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3[_0x43e7('0x27')])+(_0x2377a3[_0x43e7('0x27')]!=='chat'?'AccountId':_0x43e7('0x28'))]=_0x2377a3['account']?_0x2377a3[_0x43e7('0xa')]['id']:null;logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x2a'),_0x619236,_0x1441ef['name']));emitChannelQueueInteraction(_0x2377a3[_0x43e7('0x27')],_0x1441ef[_0x43e7('0x2b')],_0x177ee1,_0x2377a3[_0x43e7('0xa')][_0x43e7('0x2b')],_0x2377a3[_0x43e7('0x26')]['id'],!![],_0xab63cf,_0x1441ef['id']);if(rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')]){return rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x2d')](_0x177ee1)[_0x43e7('0x2e')](function(_0x19725a){logger[_0x43e7('0x2f')](_0x43e7('0x30'));});}}}function stopRouting(_0x4bdb17,_0x238321,_0x44f6b0,_0x3b8f78){if(_0x4bdb17&&_0x238321){_0x238321[_0x43e7('0x1c')]-=0x1;var _0x4251c8={'leaveAt':moment()['format'](_0x43e7('0x1e')),'acceptAt':moment()[_0x43e7('0xf')](_0x43e7('0x1e')),'reason':_0x43e7('0x31')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x4bdb17,_0x238321[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x44f6b0[_0x43e7('0x27')],_0x238321[_0x43e7('0x2b')],_0x44f6b0[_0x43e7('0x1d')],_0x44f6b0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x44f6b0['message']['id'],![],_0x3b8f78,_0x238321['id']);if(rpc[_0x44f6b0['channel']+'QueueReport']){return rpc[_0x44f6b0['channel']+'QueueReport']['update'](_0x4bdb17,_0x4251c8)['catch'](function(_0x14d888){logger['error'](_0x43e7('0x32'));});}}}function endRouting(_0x8e9f40,_0x31bc78,_0x50a2d0,_0x40f72f){if(_0x8e9f40&&_0x31bc78){_0x31bc78[_0x43e7('0x1c')]-=0x1;var _0x101d45={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x43e7('0x1e')),'reason':_0x43e7('0x33')};logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x34'),_0x8e9f40,_0x31bc78[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x50a2d0[_0x43e7('0x27')],_0x31bc78[_0x43e7('0x2b')],_0x50a2d0['body'],_0x50a2d0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x50a2d0['message']['id'],![],_0x40f72f);if(rpc[_0x50a2d0[_0x43e7('0x27')]+'QueueReport']){return rpc[_0x50a2d0[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x35')](_0x8e9f40,_0x101d45)[_0x43e7('0x2e')](function(_0x35ac85){logger[_0x43e7('0x2f')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x574a93){return function(_0x30dfa9){return _0x30dfa9[_0x43e7('0x2b')][_0x43e7('0x36')]()===_0x574a93[_0x43e7('0x36')]();};}exports[_0x43e7('0x37')]=function(_0x4a4a85,_0x32a451,_0x4227c4,_0x575439){return function(_0x3628e0){try{var _0x51a69c={'name':_0x32a451[0x0],'timeout':_0x32a451[0x1]};var _0x2ad8ef=queue['validate'](_0x51a69c,{'typecast':!![]});if(_0x2ad8ef[_0x43e7('0x38')]){logger[_0x43e7('0x2f')](_0x43e7('0x39'),_0x4a4a85,_[_0x43e7('0x3a')](_0x2ad8ef,'message')['join'](',\x20'));_0x3628e0[_0x43e7('0x3b')]();}else{var _0x40c509=_[_0x43e7('0x3c')](_0x4227c4[_0x575439[_0x43e7('0x27')]+'Queues'],handleFindQueue(_0x51a69c['name']));if(_0x40c509){startRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);var _0x5dd988=(_0x40c509[_0x43e7('0x33')]||0xa)*0x3e8;var _0x57f5d0=(_0x51a69c[_0x43e7('0x33')]||0x14)*0x3e8;var _0x4b3a59,_0x5b28db;if(_0x5dd988>_0x57f5d0){_0x57f5d0=_0x5dd988;}var _0x46b2e6=seqqueue['createQueue'](_0x5dd988);_0x46b2e6['id']=_0x4a4a85;_0x46b2e6[_0x43e7('0x3d')]=_0x5dd988;_0x46b2e6[_0x43e7('0x3e')]=_0x57f5d0;_0x46b2e6[_0x43e7('0x27')]=_0x575439[_0x43e7('0x27')];_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x3f'),function(){logger[_0x43e7('0x29')](_0x43e7('0x40'),_0x4a4a85);stopRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x4b3a59=undefined;_0x46b2e6[_0x43e7('0x41')](!![]);if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}_0x3628e0['stop']();});_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x43'),function(){if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}});_0x4b3a59=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x4a4a85);endRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x46b2e6['close'](!![]);_0x3628e0[_0x43e7('0x44')]();},_0x57f5d0);switch(_0x40c509[_0x43e7('0x45')]){case'rrmemory':strategy[_0x43e7('0x46')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);break;default:strategy[_0x43e7('0x47')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);}}else{logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4a4a85,_0x51a69c['name']);_0x3628e0['stop']();}}}catch(_0x4de644){console[_0x43e7('0x48')](_0x4de644);logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20%s',_0x4a4a85,_0x4de644[_0x43e7('0x49')]);_0x3628e0[_0x43e7('0x3b')]();}};}; \ 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 bf8c141..8196569 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 _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 +var _0xcc66=['agents','forcedOwnership','isAgentAvailable','channel','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','busy','busyQueue','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','push','handleRun','handleTimeout','bind','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil'];(function(_0x389569,_0x53297b){var _0xde2b5b=function(_0x52c9a1){while(--_0x52c9a1){_0x389569['push'](_0x389569['shift']());}};_0xde2b5b(++_0x53297b);}(_0xcc66,0x163));var _0x6cc6=function(_0x1c56b1,_0x12b079){_0x1c56b1=_0x1c56b1-0x0;var _0x137e84=_0xcc66[_0x1c56b1];return _0x137e84;};'use strict';var _=require(_0x6cc6('0x0'));var uuid=require(_0x6cc6('0x1'));var util=require(_0x6cc6('0x2'));var logger=require(_0x6cc6('0x3'))(_0x6cc6('0x4'));var Agent=function(_0x221f22,_0x3b5d6a,_0xfd5ed,_0x144747){this[_0x6cc6('0x5')]=uuid['v4']();this['squeue']=_0x221f22;this[_0x6cc6('0x6')]=_0x3b5d6a;this[_0x6cc6('0x7')]=_0xfd5ed;this[_0x6cc6('0x4')]=_0x144747;this[_0x6cc6('0x8')][_0x6cc6('0x9')](this[_0x6cc6('0xa')]['bind'](this),this[_0x6cc6('0xb')][_0x6cc6('0xc')](this));this[_0x6cc6('0x8')]['on']('timeout',this['handleTimeout']['bind'](this));this[_0x6cc6('0x8')]['on'](_0x6cc6('0xd'),this[_0x6cc6('0xe')]['bind'](this));};Agent[_0x6cc6('0xf')]['push']=function(){this[_0x6cc6('0x8')][_0x6cc6('0x9')](this[_0x6cc6('0xa')][_0x6cc6('0xc')](this),this[_0x6cc6('0xb')][_0x6cc6('0xc')](this));};Agent['prototype'][_0x6cc6('0xe')]=function(){this[_0x6cc6('0xb')](!![]);};Agent[_0x6cc6('0xf')][_0x6cc6('0xa')]=function(_0x44513d){logger[_0x6cc6('0x10')](_0x6cc6('0x11'),this['squeue']['id'],this['agent']['id']);if(_[_0x6cc6('0x12')](this[_0x6cc6('0x7')][_0x6cc6('0x13')][this[_0x6cc6('0x6')]['id']])){logger[_0x6cc6('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x6cc6('0x6')]['id']);setTimeout(this[_0x6cc6('0x9')]['bind'](this),0x3e8);}else{if(this['routing'][_0x6cc6('0x14')]||util[_0x6cc6('0x15')](this[_0x6cc6('0x8')]['id'],this[_0x6cc6('0x7')]['agents'][this['agent']['id']],this['squeue'][_0x6cc6('0x16')],![])){this[_0x6cc6('0x7')][_0x6cc6('0x13')][this[_0x6cc6('0x6')]['id']]['busy']=!![];this[_0x6cc6('0x7')][_0x6cc6('0x13')][this[_0x6cc6('0x6')]['id']]['busyQueue']=undefined;util['showNotification'](this['notificationId'],this['squeue']['id'],this[_0x6cc6('0x7')][_0x6cc6('0x13')][this[_0x6cc6('0x6')]['id']],null,this[_0x6cc6('0x4')]);util[_0x6cc6('0x17')](this['squeue']['id'],this[_0x6cc6('0x7')][_0x6cc6('0x13')][this['agent']['id']],_0x6cc6('0x18')+(this[_0x6cc6('0x4')]['forcedOwnership']?_0x6cc6('0x19'):''));}else{logger['info'](_0x6cc6('0x1a'),this[_0x6cc6('0x8')]['id'],this[_0x6cc6('0x6')]['id']);setTimeout(this[_0x6cc6('0x9')][_0x6cc6('0xc')](this),0x3e8);}}};Agent[_0x6cc6('0xf')][_0x6cc6('0xb')]=function(_0x4f9234){if(_[_0x6cc6('0x12')](this[_0x6cc6('0x7')][_0x6cc6('0x13')][this[_0x6cc6('0x6')]['id']])){return logger[_0x6cc6('0x10')](_0x6cc6('0x1b'),this['squeue']['id'],this[_0x6cc6('0x6')]['id']);}else{logger[_0x6cc6('0x10')](_0x6cc6('0x1c'),this[_0x6cc6('0x8')]['id'],this[_0x6cc6('0x6')]['id']);util['hideNotification'](this[_0x6cc6('0x5')],this[_0x6cc6('0x8')]['id'],this[_0x6cc6('0x7')]['agents'][this[_0x6cc6('0x6')]['id']],null,this['routing']);this['realtime']['agents'][this['agent']['id']][_0x6cc6('0x1d')]=![];this[_0x6cc6('0x7')][_0x6cc6('0x13')][this['agent']['id']][_0x6cc6('0x1e')]=undefined;util[_0x6cc6('0x17')](this[_0x6cc6('0x8')]['id'],this[_0x6cc6('0x7')][_0x6cc6('0x13')][this[_0x6cc6('0x6')]['id']],_0x4f9234?_0x6cc6('0x1f'):_0x6cc6('0x20'));}if(!_0x4f9234){setTimeout(this[_0x6cc6('0x9')]['bind'](this),0x3e8);}};function agent(_0xf1746,_0x41d3f8,_0x26d7d2,_0x20d2a0){return new Agent(_0xf1746,_0x41d3f8,_0x26d7d2,_0x20d2a0);}module[_0x6cc6('0x21')]=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 526202a..4aa3157 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 _0xd7e8=['showNotification','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','busyQueue','exports','lodash','uuid','../../../../../config/logger','routing','squeue','queue','handleTimeout','bind','drained','handleDrained','prototype','push','handleRun','isNil','Agents','length','realtime','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','busy'];(function(_0x279b1a,_0x350dd9){var _0x3c656b=function(_0x869811){while(--_0x869811){_0x279b1a['push'](_0x279b1a['shift']());}};_0x3c656b(++_0x350dd9);}(_0xd7e8,0xbd));var _0x8d7e=function(_0x4139a3,_0x371b3f){_0x4139a3=_0x4139a3-0x0;var _0x5ea460=_0xd7e8[_0x4139a3];return _0x5ea460;};'use strict';var _=require(_0x8d7e('0x0'));var uuid=require(_0x8d7e('0x1'));var util=require('./util');var logger=require(_0x8d7e('0x2'))(_0x8d7e('0x3'));var Beepall=function(_0x3b38d4,_0x430f3a,_0x95a830,_0xc8cbe3){this['notificationId']=uuid['v4']();this[_0x8d7e('0x4')]=_0x3b38d4;this[_0x8d7e('0x5')]=_0x430f3a;this['realtime']=_0x95a830;this[_0x8d7e('0x3')]=_0xc8cbe3;this[_0x8d7e('0x4')]['push'](this['handleRun']['bind'](this),this['handleTimeout']['bind'](this));this[_0x8d7e('0x4')]['on']('timeout',this[_0x8d7e('0x6')][_0x8d7e('0x7')](this));this[_0x8d7e('0x4')]['on'](_0x8d7e('0x8'),this[_0x8d7e('0x9')][_0x8d7e('0x7')](this));};Beepall[_0x8d7e('0xa')][_0x8d7e('0xb')]=function(){this[_0x8d7e('0x4')]['push'](this[_0x8d7e('0xc')][_0x8d7e('0x7')](this),this[_0x8d7e('0x6')][_0x8d7e('0x7')](this));};Beepall['prototype'][_0x8d7e('0x9')]=function(_0x5ac463){this[_0x8d7e('0x6')](!![]);};Beepall['prototype'][_0x8d7e('0xc')]=function(_0x3306ec){var _0x10875f=!![];if(!_[_0x8d7e('0xd')](this['queue'])&&!_['isNil'](this[_0x8d7e('0x5')][_0x8d7e('0xe')])&&this[_0x8d7e('0x5')]['Agents'][_0x8d7e('0xf')]>0x0){for(var _0x5b3363=0x0,_0x20dee6;_0x5b33630x0){for(var _0x71b001=0x0,_0x501e0e;_0x71b0010x0&&_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 +var _0x5829=['notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','user:%s','user:save','\x20interaction','name','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','message','format'];(function(_0xdd0313,_0x251c2b){var _0x2bd7e8=function(_0x340f1f){while(--_0x340f1f){_0xdd0313['push'](_0xdd0313['shift']());}};_0x2bd7e8(++_0x251c2b);}(_0x5829,0xf4));var _0x9582=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x5829[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x9582('0x0'));var util=require(_0x9582('0x1'));var utils=require(_0x9582('0x2'));var Mustache=require('mustache');var Redis=require(_0x9582('0x3'));var config=require('../../../../../config/environment');var logger=require(_0x9582('0x4'))('routing');config[_0x9582('0x5')]=_[_0x9582('0x6')](config[_0x9582('0x5')],{'host':_0x9582('0x7'),'port':0x18eb});var io=require(_0x9582('0x8'))(new Redis(config[_0x9582('0x5')]));function emit(_0xba229f,_0x108adb,_0x2a68b0){io['to'](_0xba229f)[_0x9582('0x9')](_0x108adb,_0x2a68b0);}function sendNotification(_0x3bf9ab,_0x4a1395,_0x379555,_0x54b101,_0x1e61f3,_0x551e0d){io['to'](util['format'](_0x9582('0xa'),_0x54b101['name']))[_0x9582('0x9')](_0x9582('0xb'),_0x54b101);var _0x205ca1=_0x551e0d||{};var _0x54566c=_0x379555['split']('.');var _0x3315d9={'uniqueid':_0x4a1395,'channel':_0x54566c[0x0],'id':_0x54566c[0x1],'title':_0x54566c[0x0]+_0x9582('0xc'),'interactionId':_0x54566c[0x2],'queue':_0x1e61f3?_0x1e61f3[_0x9582('0xd')]:null,'sound':_0x205ca1[_0x9582('0xe')][_0x9582('0xf')],'shake':_0x205ca1[_0x9582('0xe')][_0x9582('0x10')]};try{if(!_0x205ca1[_0x9582('0x11')]){_0x205ca1[_0x9582('0x11')]={};}if(_0x1e61f3){_0x205ca1[_0x9582('0x11')][_0x9582('0x12')]=_0x1e61f3;}else if(_0x205ca1[_0x9582('0x11')][_0x9582('0x12')]){delete _0x205ca1[_0x9582('0x11')]['queue'];}_0x3315d9[_0x9582('0x13')]=utils[_0x9582('0x14')](_0x205ca1[_0x9582('0xe')][_0x9582('0x15')],_0x205ca1);}catch(_0x597a19){_0x3315d9[_0x9582('0x13')]=_0x9582('0x16');logger['error'](util['format'](_0x9582('0x17'),_0x4a1395,_0x597a19[_0x9582('0x18')]));}io['to'](util[_0x9582('0x19')](_0x9582('0xa'),_0x54b101['name']))[_0x9582('0x9')](util[_0x9582('0x19')](_0x9582('0x1a'),_0x3bf9ab?_0x9582('0x1b'):_0x9582('0x1c')),_0x3315d9);}function writeLog(_0x521f7f,_0x2e956d,_0x3587cc){return logger[_0x9582('0x1d')](util[_0x9582('0x19')](_0x9582('0x1e'),_0x521f7f,_0x2e956d['name'],_0x3587cc));}exports[_0x9582('0x1f')]=function(_0x331c26,_0x2a5e50,_0x41af22,_0x33b3e5){if(_0x2a5e50[_0x9582('0x20')]){writeLog(_0x331c26,_0x2a5e50,_0x9582('0x21'));return![];}if(!_0x2a5e50['online']){writeLog(_0x331c26,_0x2a5e50,_0x9582('0x22'));return![];}if(_0x2a5e50[_0x41af22+_0x9582('0x23')]){writeLog(_0x331c26,_0x2a5e50,_0x9582('0x24'));return![];}if(_0x33b3e5&&_0x2a5e50[_0x9582('0x25')](_0x41af22+_0x9582('0x26'))&&_0x2a5e50[_0x9582('0x25')](_0x41af22+_0x9582('0x27'))){if(_0x2a5e50[_0x41af22+_0x9582('0x26')]>0x0&&_0x2a5e50[_0x41af22+_0x9582('0x27')]>=_0x2a5e50[_0x41af22+'Capacity']){writeLog(_0x331c26,_0x2a5e50,_0x41af22[_0x9582('0x28')]()+_0x9582('0x29'));return![];}}return!![];};exports[_0x9582('0x2a')]=function(_0x577cca,_0x5a0824,_0x10d2cd,_0x6b31ef,_0x4d1710){return sendNotification(!![],_0x577cca,_0x5a0824,_0x10d2cd,_0x6b31ef,_0x4d1710);};exports[_0x9582('0x2b')]=function(_0x588841,_0x354eec,_0x3d1c5a,_0x8c5c40,_0x5f409a){return sendNotification(![],_0x588841,_0x354eec,_0x3d1c5a,_0x8c5c40,_0x5f409a);};exports[_0x9582('0x2c')]=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 cd3c8b4..ff39fd6 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 _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 +var _0x87de=['string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','\x20cris\x20consequence','log','cris\x20in\x20function','length','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','trim','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing'];(function(_0x3c7d86,_0x386b47){var _0x6874f0=function(_0x4b6949){while(--_0x4b6949){_0x3c7d86['push'](_0x3c7d86['shift']());}};_0x6874f0(++_0x386b47);}(_0x87de,0x1f2));var _0xe87d=function(_0x50e121,_0x365047){_0x50e121=_0x50e121-0x0;var _0x458811=_0x87de[_0x50e121];return _0x458811;};'use strict';var schema=require(_0xe87d('0x0'));var sh=require(_0xe87d('0x1'));var _=require(_0xe87d('0x2'));var utils=require(_0xe87d('0x3'));var logger=require(_0xe87d('0x4'))(_0xe87d('0x5'));var system=schema({'command':{'type':_0xe87d('0x6'),'required':!![],'message':_0xe87d('0x7')}});exports[_0xe87d('0x8')]=function(_0x1677a4,_0x422ae2){console['log'](_0xe87d('0x9'),_0x422ae2);return function(_0x3a9074){try{var _0x28bf81={'command':_0x422ae2[0x0]};console[_0xe87d('0xa')](_0xe87d('0xb'),_0x28bf81);var _0x4303e3=system[_0xe87d('0x0')](_0x28bf81,{'typecast':!![]});if(_0x4303e3[_0xe87d('0xc')]){logger[_0xe87d('0xd')](_0xe87d('0xe'),_0x1677a4,_['map'](_0x4303e3,_0xe87d('0xf'))[_0xe87d('0x10')](',\x20'));logger[_0xe87d('0x11')](_0xe87d('0x12'),_0x1677a4);_0x3a9074[_0xe87d('0x13')]();}else{var _0x1f274a=this;var _0x3563f7=utils[_0xe87d('0x14')](_0x422ae2[0x0],this);logger[_0xe87d('0x11')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x1677a4,_0x3563f7);sh['exec'](_[_0xe87d('0x15')](_0x3563f7),function(_0xb6fb58,_0x167af7){logger[_0xe87d('0x11')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x1677a4,_0xb6fb58);if(_0xb6fb58==0x0){var _0x3a1b64=_0x167af7['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xe87d('0x16')](_0x422ae2[0x1])||_['isEmpty'](_0x422ae2[0x1])){logger[_0xe87d('0x11')](_0xe87d('0x17'),_0x1677a4);_0x1f274a[_0xe87d('0x18')][_0x422ae2[0x1]]=_0x3a1b64;}else{logger[_0xe87d('0x11')](_0xe87d('0x19'),_0x1677a4,_0x422ae2[0x1],_0x3a1b64);_0x1f274a[_0xe87d('0x18')][_0x422ae2[0x1]]=_0x3a1b64;}}_0x3a9074[_0xe87d('0x13')]();});}}catch(_0x2033ec){logger[_0xe87d('0xd')](_0xe87d('0xe'),_0x1677a4,_[_0xe87d('0x1a')](_0x2033ec)?JSON[_0xe87d('0x1b')](_0x2033ec):_0x2033ec);logger[_0xe87d('0x11')](_0xe87d('0x12'),_0x1677a4);_0x3a9074[_0xe87d('0x13')]();}};}; \ 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 9125375..76c6dfd 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 _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 +var _0xe115=['message','join','info','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map'];(function(_0x442390,_0x45a437){var _0x23078c=function(_0x97e8f8){while(--_0x97e8f8){_0x442390['push'](_0x442390['shift']());}};_0x23078c(++_0x45a437);}(_0xe115,0x151));var _0x5e11=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xe115[_0x92c450];return _0x2a9599;};'use strict';var schema=require(_0x5e11('0x0'));var _=require(_0x5e11('0x1'));var rpc={'chatInteraction':require(_0x5e11('0x2')),'openchannelInteraction':require(_0x5e11('0x3')),'smsInteraction':require(_0x5e11('0x4')),'mailInteraction':require(_0x5e11('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x5e11('0x6'))};var logger=require('../../../../config/logger')(_0x5e11('0x7'));var tag=schema({'tag':{'type':_0x5e11('0x8'),'required':!![],'message':_0x5e11('0x9')}});exports[_0x5e11('0xa')]=function(_0x45cffe,_0x1fc422,_0x8f0119,_0x46402b){return function(_0x37e214){try{var _0x24355a={'tag':_0x1fc422[0x0]};var _0x3e7c59=tag[_0x5e11('0x0')](_0x24355a,{'typecast':!![]});if(_0x3e7c59['length']){logger[_0x5e11('0xb')](_0x5e11('0xc'),_0x45cffe,_[_0x5e11('0xd')](_0x3e7c59,_0x5e11('0xe'))[_0x5e11('0xf')](',\x20'));logger[_0x5e11('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x45cffe);_0x37e214['next']();}else{var _0x5320bc={'ids':[_0x1fc422[0x0]]};if(rpc[_0x46402b[_0x5e11('0x11')]+'Interaction']){rpc[_0x46402b[_0x5e11('0x11')]+_0x5e11('0x12')][_0x5e11('0x13')](_0x46402b[_0x5e11('0x14')]['id'],_0x5320bc)[_0x5e11('0x15')](function(_0x101162){logger[_0x5e11('0x10')](_0x5e11('0x16'),_0x45cffe,_0x1fc422[0x1],_0x46402b[_0x5e11('0x11')],_0x46402b[_0x5e11('0x14')]['id']);})[_0x5e11('0x17')](function(_0x3ed84a){logger[_0x5e11('0xb')](_0x5e11('0xc'),_0x45cffe,JSON[_0x5e11('0x18')](_0x3ed84a));logger[_0x5e11('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x45cffe);})[_0x5e11('0x19')](function(){_0x37e214['next']();});}}}catch(_0x494d73){logger[_0x5e11('0xb')](_0x5e11('0xc'),_0x45cffe,_[_0x5e11('0x1a')](_0x494d73)?JSON[_0x5e11('0x18')](_0x494d73):_0x494d73);logger[_0x5e11('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x45cffe);_0x37e214['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 e9594fc..8b3dddc 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 _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 +var _0x0b40=['merge','body','contact','message','interaction','list','lodash','exports','render'];(function(_0x497d6d,_0xff7558){var _0x4a1d9a=function(_0x2d2fdf){while(--_0x2d2fdf){_0x497d6d['push'](_0x497d6d['shift']());}};_0x4a1d9a(++_0xff7558);}(_0x0b40,0xba));var _0x00b4=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0x0b40[_0x209fcd];return _0x501d5e;};'use strict';var Mustache=require('mustache');var _=require(_0x00b4('0x0'));module[_0x00b4('0x1')]={'getMustacheRender':function(_0x53b8fd,_0x2a5a0f){return Mustache[_0x00b4('0x2')](_0x53b8fd,_[_0x00b4('0x3')](_0x2a5a0f[_0x00b4('0x4')],{'contact':_0x2a5a0f[_0x00b4('0x5')],'message':_0x2a5a0f[_0x00b4('0x6')],'account':_0x2a5a0f['account'],'interaction':_0x2a5a0f[_0x00b4('0x7')],'list':_0x2a5a0f[_0x00b4('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 177dbc9..b9ef663 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 _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 +var _0x98d3=['applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','mail','push','slice','dialogflow','appdata','dialogflowv2','split','amazonlex','tag','TagId','%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','busy','busyQueue','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','available','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','lodash','util','jayson/promise','uuid','../../../config/logger','routing','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x98d3,0x173));var _0x398d=function(_0x12efc7,_0x855855){_0x12efc7=_0x12efc7-0x0;var _0x50803f=_0x98d3[_0x12efc7];return _0x50803f;};'use strict';var _=require(_0x398d('0x0'));var util=require(_0x398d('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x398d('0x2'));var BPromise=require('bluebird');var uuid=require(_0x398d('0x3'));var config=require('../../../config/environment');var logger=require(_0x398d('0x4'))(_0x398d('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x398d('0x6')),'smsQueueReport':require(_0x398d('0x7')),'faxQueueReport':require(_0x398d('0x8')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x398d('0x9'));function getId(_0x391d99,_0x3029f3,_0x399598){return util[_0x398d('0xa')]('%s.%s.%s',_0x391d99,_0x3029f3||0x0,_0x399598||0x0);}function getIntervals(_0x3a1934,_0x147aec){var _0x45d5e3=[];if(!_[_0x398d('0xb')](_0x147aec[_0x398d('0xc')])&&!_[_0x398d('0xb')](_0x3a1934[_0x147aec[_0x398d('0xc')]])&&!_[_0x398d('0xb')](_0x3a1934[_0x147aec['IntervalId']][_0x398d('0xd')])){_0x45d5e3=_[_0x398d('0xe')](_0x3a1934[_0x147aec[_0x398d('0xc')]][_0x398d('0xd')],_0x398d('0xf'));}else if(!_[_0x398d('0xb')](_0x147aec[_0x398d('0xf')])){_0x45d5e3=[_0x147aec[_0x398d('0xf')]];}return _0x45d5e3;}exports[_0x398d('0x10')]=function(_0x396015){_0x396015[_0x398d('0x11')]={};return new BPromise(function(_0x537bb6,_0x50a3f9){var _0x3d424f={'Start':function(_0x36cde2){var _0x347508=this;return new Promise(function(_0x2197b4,_0x278004){if(_0x36cde2){try{var _0x4099a5=[];var _0x3ff03c=getId(_0x36cde2[_0x398d('0x12')],_0x36cde2['message']?_0x36cde2[_0x398d('0x13')]['id']:0x0,_0x36cde2['interaction']?_0x36cde2[_0x398d('0x14')]['id']:0x0);if(_0x36cde2[_0x398d('0x15')]&&_[_0x398d('0x16')](_0x36cde2['applications'])&&_0x36cde2['applications']['length']){for(var _0x28b124=0x0;_0x28b124<_0x36cde2[_0x398d('0x15')][_0x398d('0x17')];_0x28b124+=0x1){var _0x1c526f=_0x36cde2[_0x398d('0x15')][_0x28b124];if(fs[_0x398d('0x18')](path[_0x398d('0x19')](__dirname,'applications',_0x1c526f['app']+'.js'))){var _0x16e580=[];switch(_0x1c526f[_0x398d('0x1a')][_0x398d('0x1b')]()){case _0x398d('0x1c'):var _0x19fa69=_0x1c526f['appdata']['split'](',');if(_0x36cde2[_0x398d('0x12')]===_0x398d('0x1d')){_0x16e580['push'](_0x19fa69[0x0]);_0x16e580[_0x398d('0x1e')](_0x19fa69[0x1]);_0x16e580[_0x398d('0x1e')](_0x19fa69['slice'](0x2,_0x19fa69['length'])['join'](','));}else{_0x16e580[_0x398d('0x1e')](_0x19fa69[0x0]);_0x16e580[_0x398d('0x1e')](_0x19fa69[_0x398d('0x1f')](0x1,_0x19fa69[_0x398d('0x17')])[_0x398d('0x19')](','));}break;case _0x398d('0x20'):var _0xc9c9b7=_0x1c526f[_0x398d('0x21')]['split'](',');_0x16e580[_0x398d('0x1e')](_0xc9c9b7[0x0]);_0x16e580['push'](_0xc9c9b7[0x1]);_0x16e580['push'](_0xc9c9b7[_0x398d('0x1f')](0x2,_0xc9c9b7[_0x398d('0x17')])['join'](','));break;case _0x398d('0x22'):var _0x558249=_0x1c526f[_0x398d('0x21')][_0x398d('0x23')](',');_0x16e580['push'](_0x558249[0x0]);_0x16e580['push'](_0x558249[0x1]);_0x16e580[_0x398d('0x1e')](_0x558249[0x2]);_0x16e580[_0x398d('0x1e')](_0x558249[0x3]);_0x16e580['push'](_0x558249[_0x398d('0x1f')](0x4,_0x558249[_0x398d('0x17')])[_0x398d('0x19')](','));break;case _0x398d('0x24'):var _0x1e84ac=_0x1c526f[_0x398d('0x21')]['split'](',');_0x16e580['push'](_0x1e84ac[0x0]);_0x16e580[_0x398d('0x1e')](_0x1e84ac[0x1]);_0x16e580[_0x398d('0x1e')](_0x1e84ac[0x2]);_0x16e580[_0x398d('0x1e')](_0x1e84ac[0x3]);_0x16e580[_0x398d('0x1e')](_0x1e84ac[_0x398d('0x1f')](0x4,_0x1e84ac[_0x398d('0x17')])[_0x398d('0x19')](','));break;case _0x398d('0x13'):_0x16e580[_0x398d('0x1e')](_0x1c526f['appdata']);break;case _0x398d('0x25'):_0x16e580[_0x398d('0x1e')](_0x1c526f[_0x398d('0x26')]);_0x16e580['push'](_0x1c526f['appdata']);break;default:_0x16e580=_[_0x398d('0xb')](_0x1c526f[_0x398d('0x21')])?[]:_0x1c526f[_0x398d('0x21')][_0x398d('0x23')](',');}var _0x20fe0d={'id':util[_0x398d('0xa')](_0x398d('0x27'),_0x3ff03c,_0x1c526f['id'],_0x1c526f[_0x398d('0x1a')]),'condition':require(_0x398d('0x28'))[_0x398d('0x29')](_0x3ff03c,getIntervals(_0x396015[_0x398d('0x2a')],_0x1c526f),_0x396015),'consequence':require(_0x398d('0x2b')+_0x1c526f[_0x398d('0x1a')])[_0x398d('0x2c')](_0x3ff03c,_0x16e580,_0x396015,_0x36cde2),'p':_0x1c526f[_0x398d('0x2d')]||0x0};logger[_0x398d('0x2e')](_0x398d('0x2f'),_0x20fe0d['id'],_0x398d('0x30'),getIntervals(_0x396015[_0x398d('0x2a')],_0x1c526f)['join'](_0x398d('0x31')));_0x4099a5[_0x398d('0x1e')](_0x20fe0d);}else{logger[_0x398d('0x32')](_0x398d('0x33'),path[_0x398d('0x19')](__dirname,_0x398d('0x15'),_0x1c526f[_0x398d('0x1a')]+'.js'));}}_0x396015[_0x398d('0x11')][_0x3ff03c]=new RuleEngine(_0x4099a5);_0x396015[_0x398d('0x11')][_0x3ff03c][_0x398d('0x34')](_0x36cde2,function(_0x3b7acc){logger[_0x398d('0x2e')](_0x398d('0x35'),JSON[_0x398d('0x36')](_0x3b7acc[_0x398d('0x37')]));if(_0x396015['rules'][_0x3ff03c]){_0x396015[_0x398d('0x11')][_0x3ff03c][_0x398d('0x38')](_0x398d('0x39'));}});return _0x2197b4({'code':0xc8,'message':_0x36cde2});}else{logger[_0x398d('0x2e')](_0x398d('0x3a'));return _0x2197b4({'code':0xc8,'message':_0x36cde2});}}catch(_0x5229c2){logger[_0x398d('0x32')](_0x5229c2[_0x398d('0x3b')]);return _0x278004(_0x347508['error'](0x1f4,_0x5229c2));}}return _0x278004(_0x398d('0x3c'));});},'AcceptMessage':function(_0x8707f4){var _0x3d72ee=this;return new Promise(function(_0x24a9eb,_0x217fc0){if(_0x8707f4[_0x398d('0x3d')]&&_0x8707f4[_0x398d('0x3d')]['id']){if(_0x396015[_0x398d('0x3e')][_0x8707f4[_0x398d('0x3d')]['id']]){_0x396015['agents'][_0x8707f4[_0x398d('0x3d')]['id']][_0x398d('0x3f')]=![];_0x396015[_0x398d('0x3e')][_0x8707f4[_0x398d('0x3d')]['id']][_0x398d('0x40')]=undefined;}}if(_0x8707f4[_0x398d('0x13')]&&_0x8707f4['message']['id']){try{var _0x26b0c6=getId(_0x8707f4[_0x398d('0x12')],_0x8707f4['message']?_0x8707f4[_0x398d('0x13')]['id']:0x0,_0x8707f4[_0x398d('0x14')]?_0x8707f4[_0x398d('0x14')]['id']:0x0);if(_0x396015['rules'][_0x26b0c6]){_0x396015[_0x398d('0x11')][_0x26b0c6][_0x398d('0x38')](_0x398d('0x41'));if(rpc[_0x8707f4[_0x398d('0x12')]+_0x398d('0x42')]){rpc[_0x8707f4['channel']+_0x398d('0x42')][_0x398d('0x43')](_0x26b0c6,{'UserId':_0x8707f4[_0x398d('0x13')]['UserId']})[_0x398d('0x44')](function(_0x3f9fb2){logger['error'](_0x398d('0x45'));});}}return _0x24a9eb({'code':0xc8,'message':_0x8707f4});}catch(_0x28240b){logger[_0x398d('0x32')](_0x28240b[_0x398d('0x3b')]);return _0x217fc0(_0x3d72ee[_0x398d('0x32')](0x1f4,_0x28240b));}}logger[_0x398d('0x32')](_0x398d('0x46'));return _0x217fc0(_0x3d72ee[_0x398d('0x32')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x34c0fc){var _0x3f146c=this;return new Promise(function(_0x4d16ef,_0x5f4aef){if(_0x34c0fc[_0x398d('0x3d')]&&_0x34c0fc[_0x398d('0x3d')]['id']){try{if(_0x396015[_0x398d('0x3e')][_0x34c0fc[_0x398d('0x3d')]['id']]){_0x396015['agents'][_0x34c0fc[_0x398d('0x3d')]['id']]['busy']=![];_0x396015[_0x398d('0x3e')][_0x34c0fc['agent']['id']][_0x398d('0x40')]=undefined;}return _0x4d16ef({'code':0xc8,'message':_0x34c0fc});}catch(_0x588548){logger['error'](_0x588548['stack']);return _0x5f4aef(_0x3f146c[_0x398d('0x32')](0x1f4,_0x588548));}}logger[_0x398d('0x32')](_0x398d('0x46'));return _0x5f4aef(_0x3f146c[_0x398d('0x32')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x5d864a){var _0x339f55=this;return new Promise(function(_0x12613c,_0x1615ee){if(_0x5d864a['channel']&&_0x5d864a[_0x398d('0x14')]&&_0x5d864a[_0x398d('0x14')]['id']){try{var _0x2376c3=getId(_0x5d864a[_0x398d('0x12')],_0x5d864a[_0x398d('0x13')]?_0x5d864a[_0x398d('0x13')]['id']:0x0,_0x5d864a['interaction']?_0x5d864a[_0x398d('0x14')]['id']:0x0);if(_0x396015[_0x398d('0x11')][_0x2376c3]){_0x396015[_0x398d('0x11')][_0x2376c3][_0x398d('0x38')]('end');}return _0x12613c({'code':0xc8,'message':_0x5d864a});}catch(_0x3bbd2e){logger[_0x398d('0x32')](_0x3bbd2e[_0x398d('0x3b')]);return _0x1615ee(_0x339f55[_0x398d('0x32')](0x1f4,_0x3bbd2e));}}logger['error']('message\x20is\x20empty');return _0x1615ee(_0x339f55[_0x398d('0x32')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0xc7b543){var _0x2de5cc=this;return new Promise(function(_0x4887fd,_0x86b133){if(_0x396015['agents'][_0x398d('0x47')](_0xc7b543['id'])){for(var _0x185df4 in _0xc7b543[_0x398d('0x48')]){if(_0xc7b543[_0x398d('0x48')][_0x398d('0x47')](_0x185df4)){if(_0x396015[_0x398d('0x3e')][_0xc7b543['id']][_0x398d('0x47')](_0x185df4+_0x398d('0x49'))){_0x396015[_0x398d('0x3e')][_0xc7b543['id']][_0x185df4+_0x398d('0x49')]=parseInt(_0xc7b543[_0x398d('0x48')][_0x185df4],0xa);}}}_0x396015[_0x398d('0x3e')][_0xc7b543['id']][_0x398d('0x4a')]();return _0x4887fd({'code':0xc8,'message':_0x396015[_0x398d('0x3e')][_0xc7b543['id']]});}else{return _0x86b133(_0x2de5cc[_0x398d('0x32')](0x1f4,_0x398d('0x4b')));}});},'Agents':function(_0x20b5e1){return new Promise(function(_0x31e977,_0x4717cf){var _0xb25709=_[_0x398d('0x4c')](_0x396015[_0x398d('0x3e')]);_0x31e977({'count':_0xb25709['length'],'rows':_0xb25709});});},'ChatQueues':function(_0x12ef87){return new Promise(function(_0x26d6f8,_0x2e51b1){var _0x10ca36=[];for(var _0x1dda79 in _0x396015[_0x398d('0x4d')]){if(_0x396015[_0x398d('0x4d')][_0x398d('0x47')](_0x1dda79)){var _0xe6cf33=_0x396015[_0x398d('0x4d')][_0x1dda79];var _0x363097={'id':_0xe6cf33['id'],'available':_0xe6cf33['available'],'loggedIn':_0xe6cf33[_0x398d('0x4e')],'name':_0xe6cf33[_0x398d('0x4f')],'paused':_0xe6cf33['paused'],'waiting':_0xe6cf33[_0x398d('0x50')]};_0x10ca36['push'](_0x363097);}}_0x26d6f8({'count':_0x10ca36['length'],'rows':_0x10ca36});});},'MailQueues':function(_0x4ae456){return new Promise(function(_0x37646f,_0x38970c){var _0x4fc42f=[];for(var _0x17c11e in _0x396015[_0x398d('0x51')]){if(_0x396015[_0x398d('0x51')]['hasOwnProperty'](_0x17c11e)){var _0x2c8f2d=_0x396015[_0x398d('0x51')][_0x17c11e];var _0xf582f2={'id':_0x2c8f2d['id'],'available':_0x2c8f2d['available'],'loggedIn':_0x2c8f2d[_0x398d('0x4e')],'name':_0x2c8f2d['name'],'paused':_0x2c8f2d[_0x398d('0x52')],'waiting':_0x2c8f2d['waiting']};_0x4fc42f[_0x398d('0x1e')](_0xf582f2);}}_0x37646f({'count':_0x4fc42f['length'],'rows':_0x4fc42f});});},'OpenchannelQueues':function(_0x35c204){return new Promise(function(_0x1b5929,_0x318e5b){var _0x322eec=[];for(var _0x2938d7 in _0x396015['openchannelQueues']){if(_0x396015[_0x398d('0x53')][_0x398d('0x47')](_0x2938d7)){var _0x1e150f=_0x396015[_0x398d('0x53')][_0x2938d7];var _0x21026={'id':_0x1e150f['id'],'available':_0x1e150f[_0x398d('0x54')],'loggedIn':_0x1e150f[_0x398d('0x4e')],'name':_0x1e150f['name'],'paused':_0x1e150f[_0x398d('0x52')],'waiting':_0x1e150f[_0x398d('0x50')]};_0x322eec[_0x398d('0x1e')](_0x21026);}}_0x1b5929({'count':_0x322eec['length'],'rows':_0x322eec});});},'SmsQueues':function(_0x47e2db){return new Promise(function(_0x1e5e84,_0x26ed40){var _0x540121=[];for(var _0x5272b3 in _0x396015[_0x398d('0x55')]){if(_0x396015['smsQueues'][_0x398d('0x47')](_0x5272b3)){var _0x575f13=_0x396015[_0x398d('0x55')][_0x5272b3];var _0x557799={'id':_0x575f13['id'],'available':_0x575f13['available'],'loggedIn':_0x575f13['loggedIn'],'name':_0x575f13[_0x398d('0x4f')],'paused':_0x575f13[_0x398d('0x52')],'waiting':_0x575f13[_0x398d('0x50')]};_0x540121[_0x398d('0x1e')](_0x557799);}}_0x1e5e84({'count':_0x540121[_0x398d('0x17')],'rows':_0x540121});});},'FaxQueues':function(_0x496796){return new Promise(function(_0x4d0a11,_0x5b0ec5){var _0x57267a=[];for(var _0x423232 in _0x396015['faxQueues']){if(_0x396015[_0x398d('0x56')][_0x398d('0x47')](_0x423232)){var _0x6fc4e3=_0x396015[_0x398d('0x56')][_0x423232];var _0x5312bf={'id':_0x6fc4e3['id'],'available':_0x6fc4e3[_0x398d('0x54')],'loggedIn':_0x6fc4e3['loggedIn'],'name':_0x6fc4e3['name'],'paused':_0x6fc4e3[_0x398d('0x52')],'waiting':_0x6fc4e3[_0x398d('0x50')]};_0x57267a['push'](_0x5312bf);}}_0x4d0a11({'count':_0x57267a[_0x398d('0x17')],'rows':_0x57267a});});},'WhatsappQueues':function(_0x4fbf02){return new Promise(function(_0x1491d0,_0x101d87){var _0x17075f=[];for(var _0xaa4021 in _0x396015['whatsappQueues']){if(_0x396015[_0x398d('0x57')][_0x398d('0x47')](_0xaa4021)){var _0x2ed343=_0x396015[_0x398d('0x57')][_0xaa4021];var _0x18e1de={'id':_0x2ed343['id'],'available':_0x2ed343['available'],'loggedIn':_0x2ed343[_0x398d('0x4e')],'name':_0x2ed343['name'],'paused':_0x2ed343[_0x398d('0x52')],'waiting':_0x2ed343[_0x398d('0x50')]};_0x17075f[_0x398d('0x1e')](_0x18e1de);}}_0x1491d0({'count':_0x17075f['length'],'rows':_0x17075f});});},'ChatQueuesWaitingInteractions':function(_0x135d5d){return new Promise(function(_0x15be8d,_0x5492b6){var _0x37c9e2=_[_0x398d('0x4c')](_0x396015[_0x398d('0x58')]);_0x15be8d({'count':_0x37c9e2['length'],'rows':_0x37c9e2});});},'MailQueuesWaitingInteractions':function(_0x57af50){return new Promise(function(_0x4b1d15,_0x4bc424){var _0x441f3b=_['values'](_0x396015[_0x398d('0x59')]);_0x4b1d15({'count':_0x441f3b[_0x398d('0x17')],'rows':_0x441f3b});});},'OpenchannelQueuesWaitingInteractions':function(_0x352bf3){return new Promise(function(_0x1ccd23,_0x19f1c6){var _0x1ea377=_['values'](_0x396015[_0x398d('0x5a')]);_0x1ccd23({'count':_0x1ea377[_0x398d('0x17')],'rows':_0x1ea377});});},'SmsQueuesWaitingInteractions':function(_0x5881f7){return new Promise(function(_0x1b6175,_0x2d8aad){var _0x24debd=_[_0x398d('0x4c')](_0x396015[_0x398d('0x5b')]);_0x1b6175({'count':_0x24debd[_0x398d('0x17')],'rows':_0x24debd});});},'FaxQueuesWaitingInteractions':function(_0x460617){return new Promise(function(_0x37f224,_0xcf117b){var _0x1721aa=_['values'](_0x396015[_0x398d('0x5c')]);_0x37f224({'count':_0x1721aa[_0x398d('0x17')],'rows':_0x1721aa});});},'WhatsappQueuesWaitingInteractions':function(_0x6076ea){return new Promise(function(_0x5bd2cf,_0x356a2d){var _0x2ab8a6=_[_0x398d('0x4c')](_0x396015[_0x398d('0x5d')]);_0x5bd2cf({'count':_0x2ab8a6[_0x398d('0x17')],'rows':_0x2ab8a6});});}};var _0x2ba660=jayson[_0x398d('0x5e')](_0x3d424f)[_0x398d('0x5f')]();_0x2ba660['on']('error',function(_0x30394c){logger[_0x398d('0x32')](JSON[_0x398d('0x36')](_0x30394c));return _0x50a3f9(_0x30394c);});_0x2ba660[_0x398d('0x10')](0x232c,_0x398d('0x60'),function(){console[_0x398d('0x61')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x537bb6('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 27648ff..88aa2ee 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 _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 +var _0x65ac=['Command','format','iftime\x20%s','then','indexOf','catch','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','client','http','request','error','message','result','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','push'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0x65ac,0x82));var _0xc65a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x65ac[_0x1d1779];return _0x2377e9;};'use strict';var util=require(_0xc65a('0x0'));var BPromise=require(_0xc65a('0x1'));var jayson=require(_0xc65a('0x2'));var _=require(_0xc65a('0x3'));var logger=require(_0xc65a('0x4'))('routing');var client=jayson[_0xc65a('0x5')][_0xc65a('0x6')]({'port':0x232a});function request(_0x1de178,_0x3c9fd0){return new BPromise(function(_0x1149d8,_0x7d63a8){return client[_0xc65a('0x7')](_0x1de178,_0x3c9fd0)['then'](function(_0x2d5e12){if(_0x2d5e12[_0xc65a('0x8')]){return _0x7d63a8(_0x2d5e12[_0xc65a('0x8')][_0xc65a('0x9')]);}else{return _0x1149d8(_0x2d5e12[_0xc65a('0xa')]);}})['catch'](function(_0x4cfc47){return _0x7d63a8(_0x4cfc47);});});}exports['condition']=function(_0x1ccc6f,_0x44185c,_0x233fcb){return function(_0x3949ee){if(_0x233fcb[_0xc65a('0xb')]&&!_0x233fcb[_0xc65a('0xb')][_0x1ccc6f]){logger[_0xc65a('0xc')](_0xc65a('0xd'),_0x1ccc6f);return _0x3949ee['stop']();}var _0x2e4ad2=[];for(var _0x31471e=0x0;_0x31471e<_0x44185c['length'];_0x31471e+=0x1){_0x2e4ad2[_0xc65a('0xe')](request(_0xc65a('0xf'),{'command':util[_0xc65a('0x10')](_0xc65a('0x11'),_0x44185c[_0x31471e])})[_0xc65a('0x12')](function(_0x401600){return _0x401600&&_0x401600[_0xc65a('0x9')]&&_0x401600['message'][_0xc65a('0x13')]('true')>=0x0?!![]:![];})[_0xc65a('0x14')](function(_0x252e09){logger[_0xc65a('0x8')](_0xc65a('0x15'),_0x1ccc6f,_0x44185c[_0x31471e]);}));}BPromise['all'](_0x2e4ad2)[_0xc65a('0x12')](function(_0x5d4c39){var _0x20d2dd=_[_0xc65a('0x16')](_0x5d4c39);logger['info'](_0xc65a('0x17'),_0x1ccc6f,_0x44185c[_0xc65a('0x18')]('\x20|\x20'),_0x20d2dd);_0x3949ee[_0xc65a('0x19')](_0x20d2dd);})[_0xc65a('0x14')](function(_0x124a18){console[_0xc65a('0x1a')](_0x124a18);logger[_0xc65a('0x8')](_0xc65a('0x17'),_0x1ccc6f,_0x44185c[_0xc65a('0x18')](_0xc65a('0x1b')),_0x124a18['stack']);_0x3949ee[_0xc65a('0x1c')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 78476ac..38b13f1 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 _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 +var _0x4ff4=['secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agentcompleteAt','agent','lodash','util','./utils','[%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','agentcomplete','acw','acwtime','acwTimeout','request','destuniqueid','agentcalled','debug','format','[%s][agents][agentcalled]','now','lastevent','called','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnectAt','connectedlinename','connect','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','calleridname','agentcalledAt','secondtransfererlinkedid','ATTENDED'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x4ff4,0x64));var _0x44ff=function(_0x19d24c,_0x62bc50){_0x19d24c=_0x19d24c-0x0;var _0x2fae8d=_0x4ff4[_0x19d24c];return _0x2fae8d;};'use strict';var _=require(_0x44ff('0x0'));var util=require(_0x44ff('0x1'));var utils=require(_0x44ff('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x58aef1,_0xe5165b){utils['info'](util['format'](_0x44ff('0x3'),_0x58aef1[_0x44ff('0x4')],_0x58aef1['channel'],_0x58aef1[_0x44ff('0x5')],_0x58aef1[_0x44ff('0x6')],_0x58aef1['interface'],_0x58aef1[_0x44ff('0x7')],_0x58aef1[_0x44ff('0x8')],_0x58aef1['lastevent']));if(_0x58aef1[_0x44ff('0x5')]){utils[_0x44ff('0x9')](_0x58aef1[_0x44ff('0x5')])[_0x44ff('0xa')](function(_0x3c86e8){if(_0x3c86e8){_0x58aef1[_0x44ff('0xb')]=_0x3c86e8[_0x44ff('0xb')];_0x58aef1['agentacw']=_0x58aef1[_0x44ff('0xc')]?_0x3c86e8[_0x44ff('0xd')]:![];_0x58aef1[_0x44ff('0xe')]=_0x58aef1['agentacw']?_0x3c86e8[_0x44ff('0xf')]:0x0;}utils[_0x44ff('0x10')]('CreateVoiceAgentReport',_0x58aef1);});}else{utils[_0x44ff('0x10')]('CreateVoiceAgentReport',_0x58aef1);}if(_0xe5165b){delete transfers[_0x58aef1['uniqueid']];}else{delete agents[_0x58aef1[_0x44ff('0x11')]];}}exports[_0x44ff('0x12')]=function(_0x4b18c3){try{utils[_0x44ff('0x13')](util[_0x44ff('0x14')](_0x44ff('0x15'),_0x4b18c3[_0x44ff('0x4')]),_0x4b18c3);agents[_0x4b18c3['destuniqueid']]=_0x4b18c3;agents[_0x4b18c3[_0x44ff('0x11')]]['agentcalledAt']=utils[_0x44ff('0x16')]();agents[_0x4b18c3['destuniqueid']][_0x44ff('0x17')]=_0x44ff('0x18');agents[_0x4b18c3[_0x44ff('0x11')]][_0x44ff('0x8')]=null;agents[_0x4b18c3[_0x44ff('0x11')]]['connectedlinename']=null;utils[_0x44ff('0x19')](util[_0x44ff('0x14')](_0x44ff('0x1a'),_0x4b18c3['uniqueid'],agents[_0x4b18c3[_0x44ff('0x11')]]['membername'],_0x4b18c3[_0x44ff('0x11')]));}catch(_0x27cfa1){utils[_0x44ff('0x1b')](util[_0x44ff('0x14')](_0x44ff('0x15'),_0x4b18c3[_0x44ff('0x4')]),_0x27cfa1);}};exports[_0x44ff('0x1c')]=function(_0xbf4580){try{if(!_['isNil'](agents[_0xbf4580[_0x44ff('0x11')]])){utils['debug'](util[_0x44ff('0x14')](_0x44ff('0x1d'),_0xbf4580[_0x44ff('0x4')]),_0xbf4580);utils['info'](util['format'](_0x44ff('0x1e'),_0xbf4580[_0x44ff('0x4')],agents[_0xbf4580[_0x44ff('0x11')]]['membername'],_0xbf4580[_0x44ff('0x11')]));agents[_0xbf4580['destuniqueid']][_0x44ff('0x1c')]=!![];agents[_0xbf4580[_0x44ff('0x11')]][_0x44ff('0x1f')]=utils[_0x44ff('0x16')]();agents[_0xbf4580[_0x44ff('0x11')]][_0x44ff('0x17')]=_0x44ff('0x20');agents[_0xbf4580['destuniqueid']][_0x44ff('0x21')]=_0x44ff('0x20');agents[_0xbf4580[_0x44ff('0x11')]][_0x44ff('0x22')]=_0xbf4580['ringtime']?parseInt(_0xbf4580[_0x44ff('0x23')])/0x3e8:0x0;agents[_0xbf4580[_0x44ff('0x11')]][_0x44ff('0x24')]=0x0;unanswered[_0x44ff('0x25')](_0xbf4580['destuniqueid']);}}catch(_0x26b5f0){utils[_0x44ff('0x1b')](util['format']('[%s][agents][agentringnoanswer]',_0xbf4580[_0x44ff('0x4')]),_0x26b5f0);}};exports[_0x44ff('0x26')]=function(_0x261096){try{_['forIn'](agents,function(_0x3a0d61,_0x26dc71){if(_0x3a0d61[_0x44ff('0x4')]==_0x261096[_0x44ff('0x4')]&&!_['includes'](unanswered,_0x3a0d61[_0x44ff('0x11')])){utils['debug'](util[_0x44ff('0x14')](_0x44ff('0x27'),_0x261096[_0x44ff('0x4')]),_0x261096);utils[_0x44ff('0x19')](util['format'](_0x44ff('0x28'),_0x261096['uniqueid'],_0x3a0d61['membername'],_0x3a0d61[_0x44ff('0x11')]));_0x3a0d61[_0x44ff('0x1c')]=!![];_0x3a0d61[_0x44ff('0x1f')]=utils[_0x44ff('0x16')]();_0x3a0d61[_0x44ff('0x17')]=_0x44ff('0x29');_0x3a0d61[_0x44ff('0x21')]='abandoned';_0x3a0d61['holdtime']=_0x261096[_0x44ff('0x22')];_0x3a0d61['talktime']=0x0;writeDB(_0x3a0d61);}});}catch(_0x26049d){utils[_0x44ff('0x1b')](util[_0x44ff('0x14')](_0x44ff('0x27'),_0x261096[_0x44ff('0x4')]),_0x26049d);}};exports['agentconnect']=function(_0x2f2270){try{if(agents[_0x2f2270[_0x44ff('0x11')]]){utils['debug'](util[_0x44ff('0x14')]('[%s][agents][agentconnect]',_0x2f2270[_0x44ff('0x4')]),_0x2f2270);utils[_0x44ff('0x19')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2f2270[_0x44ff('0x4')],agents[_0x2f2270[_0x44ff('0x11')]]['membername'],_0x2f2270['destuniqueid']));agents[_0x2f2270[_0x44ff('0x11')]][_0x44ff('0x2a')]=utils[_0x44ff('0x16')]();agents[_0x2f2270[_0x44ff('0x11')]][_0x44ff('0x8')]=_0x2f2270[_0x44ff('0x8')];agents[_0x2f2270[_0x44ff('0x11')]][_0x44ff('0x2b')]=_0x2f2270[_0x44ff('0x2b')];agents[_0x2f2270[_0x44ff('0x11')]][_0x44ff('0x22')]=_0x2f2270[_0x44ff('0x23')];agents[_0x2f2270['destuniqueid']][_0x44ff('0x17')]=_0x44ff('0x2c');_[_0x44ff('0x2d')](agents,function(_0x5d37bd,_0xd1ceef){if(_0x5d37bd[_0x44ff('0x11')]!=_0x2f2270[_0x44ff('0x11')]&&_0x5d37bd['uniqueid']==_0x2f2270[_0x44ff('0x4')]){_0x5d37bd[_0x44ff('0x24')]=0x0;_0x5d37bd['holdtime']=_0x2f2270[_0x44ff('0x23')];_0x5d37bd['agentringnoanswer']=!![];_0x5d37bd[_0x44ff('0x1f')]=utils[_0x44ff('0x16')]();_0x5d37bd[_0x44ff('0x17')]='answered_elsewhere';_0x5d37bd[_0x44ff('0x21')]=_0x44ff('0x2e');_0x5d37bd[_0x44ff('0x2f')]=_0x2f2270[_0x44ff('0x11')];_0x5d37bd[_0x44ff('0x30')]=_0x2f2270[_0x44ff('0x6')];writeDB(_0x5d37bd);}});}}catch(_0x591bb9){utils[_0x44ff('0x1b')](util['format'](_0x44ff('0x31'),_0x2f2270['uniqueid']),_0x591bb9);}};exports[_0x44ff('0xc')]=function(_0x298712){try{if(!_[_0x44ff('0x32')](agents[_0x298712['destuniqueid']])){utils[_0x44ff('0x13')](util[_0x44ff('0x14')](_0x44ff('0x33'),_0x298712[_0x44ff('0x4')]),_0x298712);utils['info'](util[_0x44ff('0x14')](_0x44ff('0x34'),_0x298712['uniqueid'],agents[_0x298712[_0x44ff('0x11')]][_0x44ff('0x6')],_0x298712[_0x44ff('0x11')]));agents[_0x298712[_0x44ff('0x11')]]['agentcomplete']=!![];agents[_0x298712[_0x44ff('0x11')]]['agentcompleteAt']=utils[_0x44ff('0x16')]();agents[_0x298712[_0x44ff('0x11')]][_0x44ff('0x24')]=utils['diffTime'](agents[_0x298712['destuniqueid']]['agentcompleteAt'],agents[_0x298712['destuniqueid']]['agentconnectAt']);agents[_0x298712['destuniqueid']][_0x44ff('0x21')]=_0x298712[_0x44ff('0x21')];agents[_0x298712[_0x44ff('0x11')]][_0x44ff('0x17')]=_0x44ff('0x35');writeDB(agents[_0x298712[_0x44ff('0x11')]]);}}catch(_0x7d0a39){utils[_0x44ff('0x1b')](util[_0x44ff('0x14')](_0x44ff('0x33'),_0x298712[_0x44ff('0x4')]),_0x7d0a39);}};exports[_0x44ff('0x36')]=function(_0x436274){try{if(!_[_0x44ff('0x32')](agents[_0x436274[_0x44ff('0x37')]])){utils[_0x44ff('0x13')](util[_0x44ff('0x14')]('[%s][agents][blindtransfer]',_0x436274['uniqueid']),_0x436274);utils[_0x44ff('0x19')](util[_0x44ff('0x14')](_0x44ff('0x38'),_0x436274['uniqueid'],agents[_0x436274[_0x44ff('0x37')]][_0x44ff('0x6')],agents[_0x436274[_0x44ff('0x37')]]['uniqueid']));agents[_0x436274[_0x44ff('0x37')]][_0x44ff('0x39')]=!![];agents[_0x436274[_0x44ff('0x37')]][_0x44ff('0x3a')]=_0x44ff('0x3b');agents[_0x436274['transfereruniqueid']][_0x44ff('0x3c')]=_0x436274[_0x44ff('0x3d')];agents[_0x436274[_0x44ff('0x37')]]['transferuniqueid']=agents[_0x436274[_0x44ff('0x37')]][_0x44ff('0x4')];}}catch(_0x13bc0e){utils[_0x44ff('0x1b')](util[_0x44ff('0x14')](_0x44ff('0x3e'),_0x436274[_0x44ff('0x4')]),_0x13bc0e);}};exports[_0x44ff('0x3f')]=function(_0x30fee4){try{utils['debug'](util[_0x44ff('0x14')](_0x44ff('0x40'),_0x30fee4[_0x44ff('0x41')]),_0x30fee4);if(_0x30fee4[_0x44ff('0x41')]==_0x30fee4['origtransfererlinkedid']){if(!_['isNil'](agents[_0x30fee4[_0x44ff('0x42')]])){utils[_0x44ff('0x19')](util[_0x44ff('0x14')](_0x44ff('0x43'),_0x30fee4[_0x44ff('0x41')],agents[_0x30fee4['secondtransfereruniqueid']]['membername']));agents[_0x30fee4[_0x44ff('0x42')]][_0x44ff('0x39')]=!![];agents[_0x30fee4[_0x44ff('0x42')]][_0x44ff('0x3a')]='ATTENDED';agents[_0x30fee4[_0x44ff('0x42')]][_0x44ff('0x3c')]=_0x30fee4[_0x44ff('0x44')];agents[_0x30fee4[_0x44ff('0x42')]][_0x44ff('0x45')]=_0x30fee4[_0x44ff('0x41')];}if(_0x30fee4[_0x44ff('0x46')]&&agents[_0x30fee4[_0x44ff('0x46')]]){agents[_0x30fee4[_0x44ff('0x46')]][_0x44ff('0x47')]=0x1;transfers[_0x30fee4['transfereeuniqueid']]=_['clone'](agents[_0x30fee4[_0x44ff('0x46')]]);transfers[_0x30fee4[_0x44ff('0x46')]][_0x44ff('0x7')]=agents[_0x30fee4['secondtransfereruniqueid']][_0x44ff('0x7')];transfers[_0x30fee4[_0x44ff('0x46')]][_0x44ff('0x48')]=agents[_0x30fee4[_0x44ff('0x42')]][_0x44ff('0x48')];transfers[_0x30fee4['transfereeuniqueid']][_0x44ff('0x49')]=utils[_0x44ff('0x16')]();transfers[_0x30fee4[_0x44ff('0x46')]]['agentconnectAt']=utils[_0x44ff('0x16')]();transfers[_0x30fee4[_0x44ff('0x46')]][_0x44ff('0x22')]=0x0;transfers[_0x30fee4[_0x44ff('0x46')]]['agententerreason']=0x2;}}else if(_0x30fee4[_0x44ff('0x42')]==_0x30fee4[_0x44ff('0x4a')]){if(!_['isNil'](agents[_0x30fee4[_0x44ff('0x41')]])){utils['info'](util[_0x44ff('0x14')](_0x44ff('0x43'),_0x30fee4[_0x44ff('0x41')],agents[_0x30fee4[_0x44ff('0x41')]]['membername']));agents[_0x30fee4[_0x44ff('0x41')]][_0x44ff('0x39')]=!![];agents[_0x30fee4[_0x44ff('0x41')]][_0x44ff('0x3a')]=_0x44ff('0x4b');agents[_0x30fee4['origtransfereruniqueid']]['transferexten']=_0x30fee4[_0x44ff('0x4c')];agents[_0x30fee4[_0x44ff('0x41')]]['transferuniqueid']=_0x30fee4[_0x44ff('0x42')];}if(_0x30fee4['transfertargetuniqueid']&&agents[_0x30fee4[_0x44ff('0x4d')]]){agents[_0x30fee4[_0x44ff('0x4d')]][_0x44ff('0x47')]=0x1;transfers[_0x30fee4[_0x44ff('0x4d')]]=_['clone'](agents[_0x30fee4[_0x44ff('0x4d')]]);transfers[_0x30fee4[_0x44ff('0x4d')]][_0x44ff('0x7')]=agents[_0x30fee4['origtransfereruniqueid']][_0x44ff('0x7')];transfers[_0x30fee4['transfertargetuniqueid']][_0x44ff('0x48')]=agents[_0x30fee4[_0x44ff('0x41')]][_0x44ff('0x48')];transfers[_0x30fee4[_0x44ff('0x4d')]][_0x44ff('0x49')]=utils[_0x44ff('0x16')]();transfers[_0x30fee4[_0x44ff('0x4d')]][_0x44ff('0x2a')]=utils[_0x44ff('0x16')]();transfers[_0x30fee4[_0x44ff('0x4d')]][_0x44ff('0x22')]=0x0;transfers[_0x30fee4[_0x44ff('0x4d')]][_0x44ff('0x47')]=0x2;}}}catch(_0x2a1b04){utils[_0x44ff('0x1b')](util['format']('[%s][agents][attendedtransfer]',_0x30fee4[_0x44ff('0x41')]),_0x2a1b04);}};exports[_0x44ff('0x4e')]=function(_0x35aaae){try{utils[_0x44ff('0x13')](util[_0x44ff('0x14')](_0x44ff('0x4f'),_0x35aaae[_0x44ff('0x4')]),_0x35aaae);if(agents[_0x35aaae['uniqueid']]&&agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x21')]==='timeout'){if(_0x35aaae[_0x44ff('0x50')]==='21'){agents[_0x35aaae[_0x44ff('0x4')]]['reason']=_0x44ff('0x51');agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x17')]=_0x44ff('0x51');}utils[_0x44ff('0x19')](util[_0x44ff('0x14')](_0x44ff('0x52'),_0x35aaae[_0x44ff('0x4')],agents[_0x35aaae['uniqueid']][_0x44ff('0x6')],agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x21')],agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x17')]));writeDB(agents[_0x35aaae[_0x44ff('0x4')]]);var _0x5ace85=unanswered[_0x44ff('0x53')](_0x35aaae[_0x44ff('0x4')]);if(_0x5ace85>-0x1){unanswered[_0x44ff('0x54')](_0x5ace85,0x1);}}if(transfers[_0x35aaae[_0x44ff('0x4')]]){transfers[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0xc')]=!![];transfers[_0x35aaae[_0x44ff('0x4')]]['agentcompleteAt']=utils[_0x44ff('0x16')]();transfers[_0x35aaae[_0x44ff('0x4')]]['talktime']=utils[_0x44ff('0x55')](transfers[_0x35aaae[_0x44ff('0x4')]]['agentcompleteAt'],transfers[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x2a')]);transfers[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x21')]='agent';transfers[_0x35aaae[_0x44ff('0x4')]]['lastevent']=_0x44ff('0x35');utils[_0x44ff('0x19')](util[_0x44ff('0x14')](_0x44ff('0x52'),_0x35aaae[_0x44ff('0x4')],transfers[_0x35aaae['uniqueid']][_0x44ff('0x6')],transfers[_0x35aaae['uniqueid']][_0x44ff('0x21')],transfers[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x17')]));writeDB(transfers[_0x35aaae[_0x44ff('0x4')]],!![]);}if(agents[_0x35aaae[_0x44ff('0x4')]]&&agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x2a')]){agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0xc')]=!![];agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x56')]=utils[_0x44ff('0x16')]();agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x24')]=utils['diffTime'](agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x56')],agents[_0x35aaae[_0x44ff('0x4')]]['agentconnectAt']);agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x21')]=agents[_0x35aaae[_0x44ff('0x4')]]['transfer']?_0x44ff('0x39'):_0x44ff('0x57');agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x17')]=_0x44ff('0x35');utils['info'](util[_0x44ff('0x14')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x35aaae[_0x44ff('0x4')],agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x6')],agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x21')],agents[_0x35aaae[_0x44ff('0x4')]]['lastevent']));writeDB(agents[_0x35aaae[_0x44ff('0x4')]]);}}catch(_0xc20ed1){utils[_0x44ff('0x1b')](util[_0x44ff('0x14')](_0x44ff('0x4f'),_0x35aaae[_0x44ff('0x4')]),_0xc20ed1);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 0d645ea..5713261 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 _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 +var _0xf5c3=['xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','lastapplication','[%s][calls][newexten]','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','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','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','context','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','debug','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','destinationchannel','secondtransfererchannel','_attended','transfertargetchannel','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','variable','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-callerid'];(function(_0x28578d,_0xcf5cf0){var _0x524826=function(_0x4a51b7){while(--_0x4a51b7){_0x28578d['push'](_0x28578d['shift']());}};_0x524826(++_0xcf5cf0);}(_0xf5c3,0x8a));var _0x3f5c=function(_0x4c56af,_0x462937){_0x4c56af=_0x4c56af-0x0;var _0x56658d=_0xf5c3[_0x4c56af];return _0x56658d;};'use strict';var _=require(_0x3f5c('0x0'));var util=require('util');var utils=require(_0x3f5c('0x1'));var dispositions=[_0x3f5c('0x2'),_0x3f5c('0x3'),'FAILED',_0x3f5c('0x2'),_0x3f5c('0x2'),_0x3f5c('0x2'),_0x3f5c('0x4'),_0x3f5c('0x5'),_0x3f5c('0x3'),_0x3f5c('0x3'),'FAILED'];var channels={};function writeDB(_0x380ee6){utils[_0x3f5c('0x6')](util[_0x3f5c('0x7')](_0x3f5c('0x8'),_0x380ee6[_0x3f5c('0x9')],_0x380ee6[_0x3f5c('0xa')],_0x380ee6[_0x3f5c('0xb')],_0x380ee6[_0x3f5c('0xc')],_0x380ee6[_0x3f5c('0xd')],_0x380ee6[_0x3f5c('0xe')],_0x380ee6[_0x3f5c('0xf')],_0x380ee6[_0x3f5c('0x10')]));if(_0x380ee6[_0x3f5c('0x11')]){utils[_0x3f5c('0x12')](_0x380ee6[_0x3f5c('0x11')])[_0x3f5c('0x13')](function(_0x1c0488){if(_0x1c0488){_0x380ee6[_0x3f5c('0x14')]=_0x1c0488['id'];}utils[_0x3f5c('0x15')](_0x3f5c('0x16'),_0x380ee6);});}else{utils[_0x3f5c('0x15')](_0x3f5c('0x16'),_0x380ee6);}if(channels[_0x380ee6[_0x3f5c('0x9')]]){delete channels[_0x380ee6[_0x3f5c('0x9')]];}}exports[_0x3f5c('0x17')]=function(_0x3d3985){try{utils['debug'](util[_0x3f5c('0x7')](_0x3f5c('0x18'),_0x3d3985['uniqueid']),_0x3d3985);if(_0x3d3985['uniqueid']==_0x3d3985[_0x3f5c('0x19')]&&_0x3d3985[_0x3f5c('0xa')]!=_0x3f5c('0x1a')){utils[_0x3f5c('0x6')](util['format'](_0x3f5c('0x1b'),_0x3d3985[_0x3f5c('0x9')],_0x3d3985['context'],_0x3d3985[_0x3f5c('0x1c')]));channels[_0x3d3985[_0x3f5c('0x9')]]={'uniqueid':_0x3d3985['uniqueid'],'accountcode':_0x3d3985[_0x3f5c('0x11')],'source':_0x3d3985[_0x3f5c('0xe')],'destination':_0x3d3985[_0x3f5c('0x1c')],'destinationcontext':_0x3d3985['context'],'channel':_0x3d3985['channel'],'starttime':utils[_0x3f5c('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x3f5c('0x2'),'amaflags':_0x3f5c('0x1e')};}}catch(_0x201827){utils[_0x3f5c('0x1f')](util[_0x3f5c('0x7')]('[%s][calls][newchannel]',_0x3d3985[_0x3f5c('0x9')]),_0x201827);}};exports[_0x3f5c('0x20')]=function(_0x2971b0){try{utils['debug'](util[_0x3f5c('0x7')](_0x3f5c('0x21'),_0x2971b0[_0x3f5c('0x9')]),_0x2971b0);if(!_[_0x3f5c('0x22')](channels[_0x2971b0['uniqueid']])&&_0x2971b0[_0x3f5c('0x23')]==0x6){utils['info'](util[_0x3f5c('0x7')](_0x3f5c('0x24'),_0x2971b0['uniqueid'],_0x2971b0['context'],_0x2971b0[_0x3f5c('0xa')]));if(_['isNil'](channels[_0x2971b0[_0x3f5c('0x9')]][_0x3f5c('0x25')])){channels[_0x2971b0['uniqueid']]['systemanswertime']=utils[_0x3f5c('0x1d')]();}}else if(!_[_0x3f5c('0x22')](channels[_0x2971b0[_0x3f5c('0x19')]])&&_0x2971b0['channelstate']==0x6&&_0x2971b0[_0x3f5c('0x26')]!=_0x3f5c('0x27')){utils[_0x3f5c('0x6')](util['format'](_0x3f5c('0x28'),_0x2971b0[_0x3f5c('0x9')],_0x2971b0['linkedid'],_0x2971b0['context'],_0x2971b0[_0x3f5c('0xa')]));channels[_0x2971b0['linkedid']][_0x3f5c('0x11')]=_0x2971b0['accountcode'];channels[_0x2971b0[_0x3f5c('0x19')]]['destinationchannel']=_0x2971b0[_0x3f5c('0xa')];if(_[_0x3f5c('0x22')](channels[_0x2971b0[_0x3f5c('0x19')]][_0x3f5c('0x29')])){channels[_0x2971b0[_0x3f5c('0x19')]][_0x3f5c('0x29')]=utils[_0x3f5c('0x1d')]();}channels[_0x2971b0['linkedid']][_0x3f5c('0x2a')]=dispositions[_['toNumber'](_0x2971b0[_0x3f5c('0x23')])]||'ANSWERED';}}catch(_0x491f32){utils[_0x3f5c('0x1f')](util[_0x3f5c('0x7')](_0x3f5c('0x21'),_0x2971b0[_0x3f5c('0x9')]),_0x491f32);}};exports['hangup']=function(_0x5e1eb2){try{if(!_[_0x3f5c('0x22')](channels[_0x5e1eb2[_0x3f5c('0x9')]])){utils['debug'](util[_0x3f5c('0x7')](_0x3f5c('0x2b'),_0x5e1eb2['uniqueid']),_0x5e1eb2);if(_[_0x3f5c('0x22')](channels[_0x5e1eb2[_0x3f5c('0x9')]][_0x3f5c('0x2c')])){channels[_0x5e1eb2['uniqueid']]['callerid']=_0x5e1eb2[_0x3f5c('0x2d')]+'\x20<'+_0x5e1eb2[_0x3f5c('0xe')]+'>';}utils[_0x3f5c('0x6')](util[_0x3f5c('0x7')](_0x3f5c('0x2e'),_0x5e1eb2['uniqueid'],channels[_0x5e1eb2[_0x3f5c('0x9')]][_0x3f5c('0x2c')],_0x5e1eb2[_0x3f5c('0x2f')]));channels[_0x5e1eb2[_0x3f5c('0x9')]][_0x3f5c('0x30')]=utils[_0x3f5c('0x1d')]();channels[_0x5e1eb2[_0x3f5c('0x9')]][_0x3f5c('0x31')]=utils[_0x3f5c('0x32')](channels[_0x5e1eb2[_0x3f5c('0x9')]][_0x3f5c('0x30')],channels[_0x5e1eb2[_0x3f5c('0x9')]][_0x3f5c('0x33')]);channels[_0x5e1eb2[_0x3f5c('0x9')]][_0x3f5c('0x34')]=channels[_0x5e1eb2[_0x3f5c('0x9')]][_0x3f5c('0x29')]?utils['diffTime'](channels[_0x5e1eb2[_0x3f5c('0x9')]]['endtime'],channels[_0x5e1eb2['uniqueid']][_0x3f5c('0x29')]):0x0;writeDB(channels[_0x5e1eb2[_0x3f5c('0x9')]]);}}catch(_0x11aa01){utils[_0x3f5c('0x1f')](util['format'](_0x3f5c('0x2b'),_0x5e1eb2[_0x3f5c('0x9')]),_0x11aa01);}};exports[_0x3f5c('0x35')]=function(_0x18126b){try{if(!_[_0x3f5c('0x22')](channels[_0x18126b[_0x3f5c('0x36')]])){utils[_0x3f5c('0x37')](util['format'](_0x3f5c('0x38'),_0x18126b[_0x3f5c('0x39')]),_0x18126b);if(channels[_0x18126b[_0x3f5c('0x36')]]['channel']==_0x18126b[_0x3f5c('0x3a')]){utils['info'](util[_0x3f5c('0x7')](_0x3f5c('0x3b'),_0x18126b['origtransfereruniqueid'],_0x18126b['localtwolinkedid'],_0x18126b['secondtransfererchannel']));channels[_0x18126b['localtwolinkedid']][_0x3f5c('0x3c')]=_0x18126b[_0x3f5c('0x3d')];channels[_0x18126b[_0x3f5c('0x36')]]['userfield']=_0x3f5c('0x3e');}else if(channels[_0x18126b['localtwolinkedid']]['channel']=_0x18126b[_0x3f5c('0x3f')]){utils['info'](util[_0x3f5c('0x7')](_0x3f5c('0x3b'),_0x18126b[_0x3f5c('0x39')],_0x18126b[_0x3f5c('0x36')],_0x18126b['origtransfererchannel']));channels[_0x18126b[_0x3f5c('0x36')]][_0x3f5c('0x3c')]=_0x18126b['origtransfererchannel'];channels[_0x18126b[_0x3f5c('0x36')]]['userfield']=_0x3f5c('0x3e');}}}catch(_0x30b600){utils[_0x3f5c('0x1f')](util[_0x3f5c('0x7')](_0x3f5c('0x38'),_0x18126b[_0x3f5c('0x39')]),_0x30b600);}};exports['musiconholdstart']=function(_0x57f168){try{if(!_['isNil'](channels[_0x57f168[_0x3f5c('0x9')]])){utils[_0x3f5c('0x37')](util['format'](_0x3f5c('0x40'),_0x57f168[_0x3f5c('0x9')]),_0x57f168);channels[_0x57f168[_0x3f5c('0x9')]]['musiconholdstartAt']=utils[_0x3f5c('0x1d')]();utils[_0x3f5c('0x6')](util['format'](_0x3f5c('0x41'),_0x57f168[_0x3f5c('0x9')],channels[_0x57f168[_0x3f5c('0x9')]][_0x3f5c('0x42')]));}}catch(_0xe7a6f0){utils[_0x3f5c('0x1f')](util['format'](_0x3f5c('0x40'),_0x57f168[_0x3f5c('0x9')]),_0xe7a6f0);}};exports[_0x3f5c('0x43')]=function(_0x5824b2){try{if(!_[_0x3f5c('0x22')](channels[_0x5824b2[_0x3f5c('0x9')]])){utils[_0x3f5c('0x37')](util['format'](_0x3f5c('0x44'),_0x5824b2[_0x3f5c('0x9')]),_0x5824b2);if(!_[_0x3f5c('0x22')](channels[_0x5824b2['uniqueid']]['musiconholdstartAt'])){channels[_0x5824b2[_0x3f5c('0x9')]][_0x3f5c('0x45')]+=utils['diffTime'](utils[_0x3f5c('0x1d')](),channels[_0x5824b2[_0x3f5c('0x9')]][_0x3f5c('0x42')]);utils[_0x3f5c('0x6')](util[_0x3f5c('0x7')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x5824b2[_0x3f5c('0x9')],channels[_0x5824b2[_0x3f5c('0x9')]]['mohtime']));delete channels[_0x5824b2[_0x3f5c('0x9')]][_0x3f5c('0x42')];}}}catch(_0x35f92f){utils[_0x3f5c('0x1f')](util['format'](_0x3f5c('0x44'),_0x5824b2['uniqueid']),_0x35f92f);}};exports[_0x3f5c('0x46')]=function(_0x1fafc5){try{if(!_[_0x3f5c('0x22')](channels[_0x1fafc5[_0x3f5c('0x9')]])){utils['debug'](util[_0x3f5c('0x7')]('[%s][calls][varset]',_0x1fafc5[_0x3f5c('0x9')]),_0x1fafc5);if(!_['isNil'](_0x1fafc5[_0x3f5c('0x47')]['xmd-originatecalleridnum'])){utils['info'](util[_0x3f5c('0x7')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x1fafc5[_0x3f5c('0x9')],_0x1fafc5[_0x3f5c('0x48')]));channels[_0x1fafc5[_0x3f5c('0x9')]][_0x3f5c('0x49')]=_0x1fafc5['value'];}if(!_['isNil'](_0x1fafc5['variable'][_0x3f5c('0x4a')])){utils['info'](util['format'](_0x3f5c('0x4b'),_0x1fafc5[_0x3f5c('0x9')],_0x1fafc5[_0x3f5c('0x48')]));channels[_0x1fafc5['uniqueid']]['destination']=_0x1fafc5[_0x3f5c('0x48')];channels[_0x1fafc5[_0x3f5c('0x9')]][_0x3f5c('0x2c')]='\x22'+_0x1fafc5['value']+_0x3f5c('0x4c')+_0x1fafc5[_0x3f5c('0x48')]+'>';}if(!_[_0x3f5c('0x22')](_0x1fafc5[_0x3f5c('0x47')]['xmd-callerid-preview'])||!_[_0x3f5c('0x22')](_0x1fafc5[_0x3f5c('0x47')]['xmd-callerid'])){utils['info'](util[_0x3f5c('0x7')](_0x3f5c('0x4d'),_0x1fafc5['uniqueid'],!_[_0x3f5c('0x22')](_0x1fafc5['variable'][_0x3f5c('0x4e')])?_0x3f5c('0x4e'):_0x3f5c('0x4f'),_0x1fafc5['value']));channels[_0x1fafc5[_0x3f5c('0x9')]][_0x3f5c('0x2c')]=_0x1fafc5[_0x3f5c('0x48')];}if(!_[_0x3f5c('0x22')](_0x1fafc5['variable'][_0x3f5c('0x50')])||!_[_0x3f5c('0x22')](_0x1fafc5['variable'][_0x3f5c('0x51')])){utils[_0x3f5c('0x6')](util[_0x3f5c('0x7')](_0x3f5c('0x4d'),_0x1fafc5[_0x3f5c('0x9')],!_[_0x3f5c('0x22')](_0x1fafc5[_0x3f5c('0x47')][_0x3f5c('0x50')])?'xmd-queue':_0x3f5c('0x51'),_0x1fafc5[_0x3f5c('0x48')]));channels[_0x1fafc5[_0x3f5c('0x9')]]['lastapplication']=_0x3f5c('0x52');channels[_0x1fafc5[_0x3f5c('0x9')]][_0x3f5c('0x53')]=_0x1fafc5[_0x3f5c('0x48')];channels[_0x1fafc5['uniqueid']][_0x3f5c('0xb')]=!![];}if(!_[_0x3f5c('0x22')](_0x1fafc5[_0x3f5c('0x47')][_0x3f5c('0x54')])){utils[_0x3f5c('0x6')](util['format'](_0x3f5c('0x55'),_0x1fafc5[_0x3f5c('0x9')],_0x1fafc5[_0x3f5c('0x48')]));channels[_0x1fafc5[_0x3f5c('0x9')]][_0x3f5c('0x56')]=_0x1fafc5[_0x3f5c('0x48')];}if(!_[_0x3f5c('0x22')](_0x1fafc5[_0x3f5c('0x47')][_0x3f5c('0x57')])){utils[_0x3f5c('0x6')](util[_0x3f5c('0x7')](_0x3f5c('0x58'),_0x1fafc5['uniqueid'],_0x1fafc5[_0x3f5c('0x48')]));channels[_0x1fafc5[_0x3f5c('0x9')]]['type']=_0x1fafc5[_0x3f5c('0x48')];}if(!_['isNil'](_0x1fafc5[_0x3f5c('0x47')]['outboundrouteid'])){utils[_0x3f5c('0x6')](util[_0x3f5c('0x7')](_0x3f5c('0x59'),_0x1fafc5[_0x3f5c('0x9')],_0x1fafc5['value']));channels[_0x1fafc5[_0x3f5c('0x9')]][_0x3f5c('0x5a')]=_0x1fafc5['value'];}if(!_[_0x3f5c('0x22')](_0x1fafc5['variable'][_0x3f5c('0x5b')])){utils[_0x3f5c('0x6')](util['format'](_0x3f5c('0x5c'),_0x1fafc5['uniqueid'],_0x1fafc5[_0x3f5c('0x48')]));channels[_0x1fafc5['uniqueid']][_0x3f5c('0x5b')]=_0x1fafc5[_0x3f5c('0x48')];}}}catch(_0x3017fa){utils[_0x3f5c('0x1f')](util[_0x3f5c('0x7')]('[%s][calls][varset]',_0x1fafc5[_0x3f5c('0x9')]),_0x3017fa);}};exports['newexten']=function(_0x4755bd){try{if(!_[_0x3f5c('0x22')](channels[_0x4755bd['uniqueid']])){utils['debug'](util[_0x3f5c('0x7')]('[%s][calls][newexten]',_0x4755bd['uniqueid']),_0x4755bd);utils['info'](util[_0x3f5c('0x7')](_0x3f5c('0x5d'),_0x4755bd[_0x3f5c('0x9')],_0x4755bd[_0x3f5c('0x5e')],_0x4755bd[_0x3f5c('0x5f')]));if(_0x4755bd[_0x3f5c('0x5e')][_0x3f5c('0x60')]()==_0x3f5c('0x61')&&_[_0x3f5c('0x62')](_0x4755bd[_0x3f5c('0x5f')]['toLowerCase'](),'cdr')){var _0x35190e=_0x4755bd[_0x3f5c('0x5f')][_0x3f5c('0x63')]('=');var _0x3fc1fd=_0x35190e[0x0][_0x3f5c('0x64')](_0x35190e[0x0][_0x3f5c('0x65')]('(')+0x1,_0x35190e[0x0]['lastIndexOf'](')'));var _0x4721ac=_0x35190e[0x1];channels[_0x4755bd['uniqueid']][_0x3fc1fd]=_0x4721ac;}if(!_[_0x3f5c('0x66')]([_0x3f5c('0x67'),_0x3f5c('0x68'),_0x3f5c('0x69'),_0x3f5c('0x61'),_0x3f5c('0x6a')],_0x4755bd[_0x3f5c('0x5e')][_0x3f5c('0x60')]())){channels[_0x4755bd[_0x3f5c('0x9')]][_0x3f5c('0x6b')]=_0x4755bd[_0x3f5c('0x5e')];channels[_0x4755bd[_0x3f5c('0x9')]][_0x3f5c('0x53')]=_0x4755bd[_0x3f5c('0x5f')];}}}catch(_0x59c9c5){utils[_0x3f5c('0x1f')](util[_0x3f5c('0x7')](_0x3f5c('0x6c'),_0x4755bd['uniqueid']),_0x59c9c5);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 1d31c78..3e41182 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 _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 +var _0x9473=['connect','info','shutdown','[core]\x20shutdown','error','[core]\x20close','managerevent','./utils'];(function(_0x272d90,_0x5e70ff){var _0x2bf4a2=function(_0x544da6){while(--_0x544da6){_0x272d90['push'](_0x272d90['shift']());}};_0x2bf4a2(++_0x5e70ff);}(_0x9473,0xbf));var _0x3947=function(_0x1187f4,_0x1a92cd){_0x1187f4=_0x1187f4-0x0;var _0x176f78=_0x9473[_0x1187f4];return _0x176f78;};'use strict';var utils=require(_0x3947('0x0'));exports[_0x3947('0x1')]=function(){utils[_0x3947('0x2')]('[core]\x20connected');};exports[_0x3947('0x3')]=function(){utils[_0x3947('0x2')](_0x3947('0x4'));};exports['fullybooted']=function(){utils[_0x3947('0x2')]('[core]\x20fullybooted');};exports[_0x3947('0x5')]=function(_0x5edafa){utils[_0x3947('0x5')]('[core]\x20error',_0x5edafa);};exports['close']=function(){utils[_0x3947('0x2')](_0x3947('0x6'));};exports[_0x3947('0x7')]=function(_0x4fc264){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 54e2631..164576f 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 _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 +var _0xa9de=['endtime','holdtime','billableseconds','lodash','util','./utils','format','uniqueid','channel','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','info','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','now','[%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','calleridname','cause-txt','complete','duration','diffTime'];(function(_0x331846,_0x2b8675){var _0x183f6c=function(_0x19aabc){while(--_0x19aabc){_0x331846['push'](_0x331846['shift']());}};_0x183f6c(++_0x2b8675);}(_0xa9de,0xa5));var _0xea9d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa9de[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xea9d('0x0'));var util=require(_0xea9d('0x1'));var utils=require(_0xea9d('0x2'));var dials={};function writeDB(_0x58589b){utils['info'](util[_0xea9d('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x58589b[_0xea9d('0x4')],_0x58589b[_0xea9d('0x5')],_0x58589b['dialstring'],_0x58589b[_0xea9d('0x6')],_0x58589b[_0xea9d('0x7')],_0x58589b['dialstatus']));utils[_0xea9d('0x8')](_0xea9d('0x9'),_0x58589b);delete dials[_0x58589b[_0xea9d('0x4')]];}exports[_0xea9d('0xa')]=function(_0x50d635){try{utils[_0xea9d('0xb')](util[_0xea9d('0x3')](_0xea9d('0xc'),_0x50d635[_0xea9d('0x4')]),_0x50d635);utils['info'](util[_0xea9d('0x3')](_0xea9d('0xd'),_0x50d635['uniqueid'],_0x50d635[_0xea9d('0xe')],_0x50d635[_0xea9d('0xf')]));if(_0x50d635[_0xea9d('0xe')][_0xea9d('0x10')]()==_0xea9d('0x11')&&_[_0xea9d('0x12')](_0x50d635[_0xea9d('0xf')][_0xea9d('0x10')](),_0xea9d('0x13'))){var _0x167d50=_0x50d635[_0xea9d('0xf')][_0xea9d('0x14')]('=');dials[_0x50d635[_0xea9d('0x4')]]={'routeId':_0x167d50[0x1]};}}catch(_0xcc233){utils[_0xea9d('0x15')](util['format'](_0xea9d('0xc'),_0x50d635['uniqueid']),_0xcc233);}};exports[_0xea9d('0x16')]=function(_0x1782da){try{utils[_0xea9d('0xb')](util[_0xea9d('0x3')](_0xea9d('0x17'),_0x1782da[_0xea9d('0x4')]),_0x1782da);if(!_[_0xea9d('0x18')](_0x1782da[_0xea9d('0x19')]['outboundrouteid'])){utils[_0xea9d('0x1a')](util['format'](_0xea9d('0x1b'),_0x1782da['uniqueid'],_0x1782da[_0xea9d('0x1c')]));dials[_0x1782da[_0xea9d('0x4')]]={'routeId':_0x1782da[_0xea9d('0x1c')]};}}catch(_0x3209be){utils[_0xea9d('0x15')](util[_0xea9d('0x3')]('[%s][dials][varset]',_0x1782da[_0xea9d('0x4')]),_0x3209be);}};exports[_0xea9d('0x1d')]=function(_0x70000){try{if(!_[_0xea9d('0x18')](dials[_0x70000[_0xea9d('0x4')]])){utils[_0xea9d('0xb')](util[_0xea9d('0x3')]('[%s][dials][dialbegin]',_0x70000[_0xea9d('0x4')]),_0x70000);dials[_0x70000[_0xea9d('0x4')]]=_[_0xea9d('0x1e')](dials[_0x70000[_0xea9d('0x4')]],_0x70000);dials[_0x70000['uniqueid']][_0xea9d('0x1f')]=utils['now']();dials[_0x70000[_0xea9d('0x4')]][_0xea9d('0x20')]='called';utils['info'](util[_0xea9d('0x3')](_0xea9d('0x21'),_0x70000['uniqueid'],dials[_0x70000[_0xea9d('0x4')]][_0xea9d('0x1f')]));}}catch(_0xcd8aa3){utils[_0xea9d('0x15')](util[_0xea9d('0x3')](_0xea9d('0x22'),_0x70000[_0xea9d('0x4')]),_0xcd8aa3);}};exports[_0xea9d('0x23')]=function(_0x2cdb89){try{if(!_[_0xea9d('0x18')](dials[_0x2cdb89[_0xea9d('0x4')]])){utils[_0xea9d('0xb')](util[_0xea9d('0x3')](_0xea9d('0x24'),_0x2cdb89['uniqueid']),_0x2cdb89);dials[_0x2cdb89[_0xea9d('0x4')]][_0xea9d('0x25')]=_0x2cdb89[_0xea9d('0x25')];if(_0x2cdb89[_0xea9d('0x25')]==_0xea9d('0x26')){dials[_0x2cdb89[_0xea9d('0x4')]]=_['assign'](dials[_0x2cdb89[_0xea9d('0x4')]],_0x2cdb89);dials[_0x2cdb89['uniqueid']][_0xea9d('0x27')]=utils[_0xea9d('0x28')]();dials[_0x2cdb89[_0xea9d('0x4')]][_0xea9d('0x20')]='connect';utils[_0xea9d('0x1a')](util[_0xea9d('0x3')](_0xea9d('0x29'),_0x2cdb89[_0xea9d('0x4')],_0x2cdb89[_0xea9d('0x25')],dials[_0x2cdb89[_0xea9d('0x4')]][_0xea9d('0x27')]));}else{utils[_0xea9d('0x1a')](util[_0xea9d('0x3')](_0xea9d('0x2a'),_0x2cdb89[_0xea9d('0x4')],_0x2cdb89['dialstatus']));}}}catch(_0x275e53){utils[_0xea9d('0x15')](util['format'](_0xea9d('0x24'),_0x2cdb89[_0xea9d('0x4')]),_0x275e53);}};exports[_0xea9d('0x2b')]=function(_0x29600f){try{if(!_[_0xea9d('0x18')](dials[_0x29600f[_0xea9d('0x4')]])){utils[_0xea9d('0xb')](util['format'](_0xea9d('0x2c'),_0x29600f['uniqueid']),_0x29600f);utils[_0xea9d('0x1a')](util[_0xea9d('0x3')](_0xea9d('0x2d'),_0x29600f['uniqueid'],_0x29600f['calleridnum'],_0x29600f[_0xea9d('0x2e')],_0x29600f[_0xea9d('0x2f')]));dials[_0x29600f['uniqueid']]=_['assign'](dials[_0x29600f[_0xea9d('0x4')]],{'endtime':utils['now'](),'lastevent':_0xea9d('0x30')});dials[_0x29600f[_0xea9d('0x4')]][_0xea9d('0x31')]=utils[_0xea9d('0x32')](dials[_0x29600f['uniqueid']][_0xea9d('0x33')],dials[_0x29600f[_0xea9d('0x4')]][_0xea9d('0x1f')]);dials[_0x29600f[_0xea9d('0x4')]][_0xea9d('0x34')]=utils[_0xea9d('0x32')](dials[_0x29600f[_0xea9d('0x4')]][_0xea9d('0x27')]||dials[_0x29600f[_0xea9d('0x4')]][_0xea9d('0x33')],dials[_0x29600f[_0xea9d('0x4')]]['starttime']);dials[_0x29600f[_0xea9d('0x4')]][_0xea9d('0x35')]=dials[_0x29600f[_0xea9d('0x4')]][_0xea9d('0x27')]?utils['diffTime'](dials[_0x29600f[_0xea9d('0x4')]][_0xea9d('0x33')],dials[_0x29600f[_0xea9d('0x4')]][_0xea9d('0x27')]):0x0;writeDB(dials[_0x29600f[_0xea9d('0x4')]]);}}catch(_0x1ac52e){utils[_0xea9d('0x15')](util[_0xea9d('0x3')](_0xea9d('0x2c'),_0x29600f[_0xea9d('0x4')]),_0x1ac52e);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 9bc4f3e..7880e62 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 _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 +var _0xb1e0=['password','xdr','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk','port','username'];(function(_0xf5809,_0x262f82){var _0x3a65f3=function(_0x48f8ca){while(--_0x48f8ca){_0xf5809['push'](_0xf5809['shift']());}};_0x3a65f3(++_0x262f82);}(_0xb1e0,0x1ce));var _0x0b1e=function(_0x4c70cb,_0x35a5cb){_0x4c70cb=_0x4c70cb-0x0;var _0x470faa=_0xb1e0[_0x4c70cb];return _0x470faa;};var AsteriskManager=require(_0x0b1e('0x0'));var config=require(_0x0b1e('0x1'));var utils=require(_0x0b1e('0x2'));var util=require(_0x0b1e('0x3'));var ami=new AsteriskManager(config[_0x0b1e('0x4')][_0x0b1e('0x5')],config[_0x0b1e('0x4')]['ip'],config[_0x0b1e('0x4')][_0x0b1e('0x6')],config['asterisk'][_0x0b1e('0x7')],!![]);ami['keepConnected']();if(config[_0x0b1e('0x8')]&&config[_0x0b1e('0x8')]['disabled']){utils['info']('XDR\x20DISABLED');}else{var agents=require(_0x0b1e('0x9'));var calls=require(_0x0b1e('0xa'));var queues=require(_0x0b1e('0xb'));var recordings=require(_0x0b1e('0xc'));var members=require('./members.controller');var dials=require(_0x0b1e('0xd'));var transfers=require(_0x0b1e('0xe'));var core=require(_0x0b1e('0xf'));ami['on'](_0x0b1e('0x10'),core[_0x0b1e('0x10')]);ami['on'](_0x0b1e('0x11'),core[_0x0b1e('0x11')]);ami['on']('fullybooted',core[_0x0b1e('0x12')]);ami['on'](_0x0b1e('0x13'),core[_0x0b1e('0x13')]);ami['on'](_0x0b1e('0x14'),core[_0x0b1e('0x14')]);ami['on'](_0x0b1e('0x15'),core['managerevent']);ami['on'](_0x0b1e('0x16'),function(_0x58b44f){try{utils['debug'](util[_0x0b1e('0x17')](_0x0b1e('0x18'),_0x58b44f['device']),_0x58b44f);members[_0x0b1e('0x16')](_0x58b44f);}catch(_0x1a306f){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')](_0x0b1e('0x18'),_0x58b44f[_0x0b1e('0x19')]),_0x1a306f);}});ami['on'](_0x0b1e('0x1a'),function(_0x4208d0){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')](_0x0b1e('0x1c'),_0x4208d0[_0x0b1e('0x1d')]),_0x4208d0);agents['agentcalled'](_0x4208d0);}catch(_0x5b069b){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')]('[%s][index][agentcalled]',_0x4208d0['uniqueid']),_0x5b069b);}});ami['on'](_0x0b1e('0x1e'),function(_0x19466c){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')](_0x0b1e('0x1f'),_0x19466c[_0x0b1e('0x1d')]),_0x19466c);agents[_0x0b1e('0x1e')](_0x19466c);}catch(_0x4f67f3){utils['error'](util[_0x0b1e('0x17')]('[%s][index][agentringnoanswer]',_0x19466c[_0x0b1e('0x1d')]),_0x4f67f3);}});ami['on'](_0x0b1e('0x20'),function(_0x24e7ee){try{utils['debug'](util[_0x0b1e('0x17')](_0x0b1e('0x21'),_0x24e7ee[_0x0b1e('0x1d')]),_0x24e7ee);agents[_0x0b1e('0x20')](_0x24e7ee);queues[_0x0b1e('0x20')](_0x24e7ee);}catch(_0x3584a5){utils['error'](util[_0x0b1e('0x17')](_0x0b1e('0x21'),_0x24e7ee[_0x0b1e('0x1d')]),_0x3584a5);}});ami['on'](_0x0b1e('0x22'),function(_0x55a510){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')](_0x0b1e('0x23'),_0x55a510[_0x0b1e('0x1d')]),_0x55a510);agents[_0x0b1e('0x22')](_0x55a510);queues[_0x0b1e('0x22')](_0x55a510);members[_0x0b1e('0x22')](_0x55a510);}catch(_0x1e75cb){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')](_0x0b1e('0x23'),_0x55a510[_0x0b1e('0x1d')]),_0x1e75cb);}});ami['on'](_0x0b1e('0x24'),function(_0x1f9736){try{utils[_0x0b1e('0x1b')](util['format'](_0x0b1e('0x25'),_0x1f9736[_0x0b1e('0x1d')]),_0x1f9736);agents[_0x0b1e('0x24')](_0x1f9736);queues[_0x0b1e('0x24')](_0x1f9736);}catch(_0x246cf9){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')](_0x0b1e('0x25'),_0x1f9736[_0x0b1e('0x1d')]),_0x246cf9);}});ami['on'](_0x0b1e('0x26'),function(_0x4e29ab){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')](_0x0b1e('0x27'),_0x4e29ab[_0x0b1e('0x1d')]),_0x4e29ab);queues[_0x0b1e('0x26')](_0x4e29ab);recordings['queuecallerjoin'](_0x4e29ab);}catch(_0x4781a1){utils['error'](util['format'](_0x0b1e('0x27'),_0x4e29ab['uniqueid']),_0x4781a1);}});ami['on'](_0x0b1e('0x28'),function(_0xf4411f){try{utils[_0x0b1e('0x1b')](util['format']('[%s][index][queuecallerleave]',_0xf4411f[_0x0b1e('0x1d')]),_0xf4411f);queues['queuecallerleave'](_0xf4411f);}catch(_0x31006e){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')](_0x0b1e('0x29'),_0xf4411f[_0x0b1e('0x1d')]),_0x31006e);}});ami['on'](_0x0b1e('0x2a'),function(_0x231350){try{utils['debug'](util[_0x0b1e('0x17')](_0x0b1e('0x2b'),_0x231350[_0x0b1e('0x1d')]),_0x231350);queues[_0x0b1e('0x2a')](_0x231350);calls[_0x0b1e('0x2a')](_0x231350);}catch(_0x21e5bd){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')](_0x0b1e('0x2b'),_0x231350[_0x0b1e('0x1d')]),_0x21e5bd);}});ami['on']('musiconholdstop',function(_0x50fc6b){try{utils[_0x0b1e('0x1b')](util['format'](_0x0b1e('0x2c'),_0x50fc6b[_0x0b1e('0x1d')]),_0x50fc6b);queues['musiconholdstop'](_0x50fc6b);calls[_0x0b1e('0x2d')](_0x50fc6b);}catch(_0x4259bb){utils['error'](util['format'](_0x0b1e('0x2c'),_0x50fc6b[_0x0b1e('0x1d')]),_0x4259bb);}});ami['on'](_0x0b1e('0x2e'),function(_0x52cb18){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')](_0x0b1e('0x2f'),_0x52cb18[_0x0b1e('0x1d')]),_0x52cb18);calls['newstate'](_0x52cb18);recordings[_0x0b1e('0x2e')](_0x52cb18);}catch(_0x576763){utils[_0x0b1e('0x13')](util['format']('[%s][index][newstate]',_0x52cb18['uniqueid']),_0x576763);}});ami['on'](_0x0b1e('0x30'),function(_0x14aab5){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')](_0x0b1e('0x31'),_0x14aab5[_0x0b1e('0x1d')]),_0x14aab5);calls[_0x0b1e('0x30')](_0x14aab5);recordings['hangup'](_0x14aab5);dials[_0x0b1e('0x30')](_0x14aab5);agents[_0x0b1e('0x30')](_0x14aab5);queues[_0x0b1e('0x30')](_0x14aab5);}catch(_0x5ab822){utils['error'](util[_0x0b1e('0x17')](_0x0b1e('0x31'),_0x14aab5[_0x0b1e('0x1d')]),_0x5ab822);}});ami['on'](_0x0b1e('0x32'),function(_0x251dba){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')](_0x0b1e('0x33'),_0x251dba[_0x0b1e('0x1d')]),_0x251dba);members[_0x0b1e('0x32')](_0x251dba);}catch(_0x5d13f4){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')]('[%s][index][cdr]',_0x251dba[_0x0b1e('0x1d')]),_0x5d13f4);}});ami['on']('blindtransfer',function(_0x594ecb){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')](_0x0b1e('0x34'),_0x594ecb['uniqueid']),_0x594ecb);queues[_0x0b1e('0x35')](_0x594ecb);agents['blindtransfer'](_0x594ecb);transfers[_0x0b1e('0x35')](_0x594ecb);}catch(_0x380c39){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')](_0x0b1e('0x34'),_0x594ecb[_0x0b1e('0x1d')]),_0x380c39);}});ami['on'](_0x0b1e('0x36'),function(_0xc6075c){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')](_0x0b1e('0x37'),_0xc6075c[_0x0b1e('0x38')]),_0xc6075c);queues[_0x0b1e('0x36')](_0xc6075c);transfers['attendedtransfer'](_0xc6075c);agents[_0x0b1e('0x36')](_0xc6075c);calls['attendedtransfer'](_0xc6075c);}catch(_0x216e26){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')](_0x0b1e('0x37'),_0xc6075c['origtransfereruniqueid']),_0x216e26);}});ami['on'](_0x0b1e('0x39'),function(_0x3759df){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')](_0x0b1e('0x3a'),_0x3759df[_0x0b1e('0x1d')]),_0x3759df);queues[_0x0b1e('0x39')](_0x3759df);recordings[_0x0b1e('0x39')](_0x3759df);calls[_0x0b1e('0x39')](_0x3759df);dials[_0x0b1e('0x39')](_0x3759df);}catch(_0x5bf5fb){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')]('[%s][index][varset]',_0x3759df[_0x0b1e('0x1d')]),_0x5bf5fb);}});ami['on'](_0x0b1e('0x3b'),function(_0x4d0ceb){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')]('[%s][index][newexten]',_0x4d0ceb[_0x0b1e('0x1d')]),_0x4d0ceb);calls[_0x0b1e('0x3b')](_0x4d0ceb);recordings[_0x0b1e('0x3b')](_0x4d0ceb);dials[_0x0b1e('0x3b')](_0x4d0ceb);}catch(_0x415a90){utils['error'](util[_0x0b1e('0x17')](_0x0b1e('0x3c'),_0x4d0ceb[_0x0b1e('0x1d')]),_0x415a90);}});ami['on'](_0x0b1e('0x3d'),function(_0x47c0db){try{utils['debug'](util[_0x0b1e('0x17')]('[%s][index][newchannel]',_0x47c0db[_0x0b1e('0x1d')]),_0x47c0db);calls[_0x0b1e('0x3d')](_0x47c0db);recordings[_0x0b1e('0x3d')](_0x47c0db);}catch(_0x125a69){utils['error'](util[_0x0b1e('0x17')](_0x0b1e('0x3e'),_0x47c0db[_0x0b1e('0x1d')]),_0x125a69);}});ami['on'](_0x0b1e('0x3f'),function(_0x31a33a){try{utils['debug'](util[_0x0b1e('0x17')](_0x0b1e('0x40'),_0x31a33a[_0x0b1e('0x1d')]),_0x31a33a);dials[_0x0b1e('0x3f')](_0x31a33a);}catch(_0x1d0f86){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')]('[%s]dialbegin',_0x31a33a[_0x0b1e('0x1d')]),_0x1d0f86);}});ami['on']('dialend',function(_0x373f07){try{utils['debug'](util['format']('[%s][index][dialend]',_0x373f07[_0x0b1e('0x1d')]),_0x373f07);dials[_0x0b1e('0x41')](_0x373f07);}catch(_0x2c76a0){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')](_0x0b1e('0x42'),_0x373f07[_0x0b1e('0x1d')]),_0x2c76a0);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 3adf7b8..eb27244 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 _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 +var _0x6503=['assign','error','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','data3','destinationchannel','lodash','util','./utils','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','then','internal','request','getUserByName','split','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','uniqueid','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','isNil','exitAt','diffTime','enterAt','agentcomplete','queue'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x6503,0x71));var _0x3650=function(_0xa6e865,_0x227d6b){_0xa6e865=_0xa6e865-0x0;var _0x47b757=_0x6503[_0xa6e865];return _0x47b757;};'use strict';var _=require(_0x3650('0x0'));var util=require(_0x3650('0x1'));var utils=require(_0x3650('0x2'));var members={};var exclude=[_0x3650('0x3'),'Queue:'];function writeDB(_0x4acb41){utils[_0x3650('0x4')](util[_0x3650('0x5')](_0x3650('0x6'),_0x4acb41['uniqueid'],_0x4acb41[_0x3650('0x7')],_0x4acb41[_0x3650('0x8')],_0x4acb41[_0x3650('0x9')],_0x4acb41[_0x3650('0xa')],_0x4acb41[_0x3650('0xb')]));if(_0x4acb41[_0x3650('0x7')]){utils[_0x3650('0xc')](_0x4acb41['interface'])[_0x3650('0xd')](function(_0x126a1d){if(_0x126a1d){_0x4acb41['membername']=_0x126a1d['name'];_0x4acb41['internal']=_0x126a1d[_0x3650('0xe')];utils[_0x3650('0xf')]('CreateMemberReport',_0x4acb41);}else{utils[_0x3650('0x10')](_0x4acb41[_0x3650('0x7')][_0x3650('0x11')]('/')[0x1])[_0x3650('0xd')](function(_0x38619b){if(_0x38619b){_0x4acb41['membername']=_0x38619b['name'];_0x4acb41[_0x3650('0xe')]=_0x38619b[_0x3650('0xe')];utils[_0x3650('0xf')]('CreateMemberReport',_0x4acb41);}});}})['catch'](function(_0x5ee86d){utils['error'](util[_0x3650('0x5')](_0x3650('0x12'),_0x4acb41['uniqueid']),_0x5ee86d);});}delete members[_0x4acb41[_0x3650('0x7')]];}function startsWith(_0x3d75a6,_0x3b6304){return _[_0x3650('0x13')](_0x3d75a6,function(_0x5eab65){return _[_0x3650('0x14')](_0x3b6304,_0x5eab65);});}exports[_0x3650('0x15')]=function(_0x2b6df0){try{utils[_0x3650('0x16')](util[_0x3650('0x5')](_0x3650('0x17'),members[_0x2b6df0['device']]?members[_0x2b6df0['device']][_0x3650('0x18')]:_0x2b6df0[_0x3650('0x19')]),_0x2b6df0);utils[_0x3650('0x4')](util['format'](_0x3650('0x1a'),members[_0x2b6df0[_0x3650('0x19')]]?members[_0x2b6df0[_0x3650('0x19')]][_0x3650('0x18')]:_0x2b6df0[_0x3650('0x19')],_0x2b6df0[_0x3650('0x1b')],_0x2b6df0[_0x3650('0x19')]));switch(_0x2b6df0[_0x3650('0x1b')]){case _0x3650('0x1c'):case _0x3650('0x1d'):if(!startsWith(exclude,_0x2b6df0[_0x3650('0x19')])){members[_0x2b6df0[_0x3650('0x19')]]={'channel':_0x3650('0x1e'),'interface':_0x2b6df0[_0x3650('0x19')],'type':_0x3650('0x1f'),'enterAt':utils[_0x3650('0x20')](),'role':'agent'};}break;case _0x3650('0x21'):if(!_[_0x3650('0x22')](members[_0x2b6df0[_0x3650('0x19')]])){members[_0x2b6df0[_0x3650('0x19')]][_0x3650('0x23')]=utils[_0x3650('0x20')]();members[_0x2b6df0[_0x3650('0x19')]]['duration']=utils[_0x3650('0x24')](members[_0x2b6df0['device']][_0x3650('0x23')],members[_0x2b6df0[_0x3650('0x19')]][_0x3650('0x25')]);if(members[_0x2b6df0[_0x3650('0x19')]]['uniqueid']){writeDB(members[_0x2b6df0['device']]);}}break;default:break;}}catch(_0x3999fc){utils['error'](util[_0x3650('0x5')]('[%s][members][devicestatechange]',members[_0x2b6df0[_0x3650('0x19')]]?members[_0x2b6df0[_0x3650('0x19')]]['uniqueid']:_0x2b6df0[_0x3650('0x19')]),_0x3999fc);}};exports[_0x3650('0x26')]=function(_0x32fa8a){try{if(!_['isNil'](members[_0x32fa8a[_0x3650('0x7')]])){utils[_0x3650('0x16')](util[_0x3650('0x5')]('[%s][members][agentcomplete]',_0x32fa8a[_0x3650('0x18')]),_0x32fa8a);utils[_0x3650('0x4')](util[_0x3650('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x32fa8a[_0x3650('0x18')],_0x32fa8a[_0x3650('0x7')],_0x32fa8a[_0x3650('0x27')]));members[_0x32fa8a[_0x3650('0x7')]]=_[_0x3650('0x28')](members[_0x32fa8a[_0x3650('0x7')]],{'data4':_0x32fa8a[_0x3650('0x27')],'uniqueid':_0x32fa8a['uniqueid']});}}catch(_0x3106e3){utils[_0x3650('0x29')](util[_0x3650('0x5')](_0x3650('0x2a'),_0x32fa8a[_0x3650('0x18')]),_0x3106e3);}};exports[_0x3650('0x2b')]=function(_0x1fbcfd){try{utils['debug'](util[_0x3650('0x5')](_0x3650('0x2c'),_0x1fbcfd[_0x3650('0x18')]),_0x1fbcfd);if(_0x1fbcfd[_0x3650('0x8')]){var _0x38ffdf=_0x1fbcfd['channel'][_0x3650('0x11')]('-')[0x0];if(!_[_0x3650('0x22')](members[_0x38ffdf])){members[_0x38ffdf]=_[_0x3650('0x28')](members[_0x38ffdf],{'data1':members[_0x38ffdf]['data1']||_0x1fbcfd['type'],'data2':members[_0x38ffdf][_0x3650('0x9')]||_0x1fbcfd[_0x3650('0x2d')],'data3':members[_0x38ffdf]['data3']||_0x1fbcfd[_0x3650('0x2e')],'uniqueid':members[_0x38ffdf][_0x3650('0x18')]||_0x1fbcfd[_0x3650('0x18')]});utils[_0x3650('0x4')](util[_0x3650('0x5')](_0x3650('0x2f'),_0x1fbcfd['uniqueid'],members[_0x38ffdf][_0x3650('0x30')],members[_0x38ffdf]['data2'],members[_0x38ffdf][_0x3650('0x31')]));if(members[_0x38ffdf][_0x3650('0x23')]){writeDB(members[_0x38ffdf]);}}}if(_0x1fbcfd[_0x3650('0x32')]){var _0x34c88c=_0x1fbcfd[_0x3650('0x32')][_0x3650('0x11')]('-')[0x0];if(!_[_0x3650('0x22')](members[_0x34c88c])){members[_0x34c88c]=_[_0x3650('0x28')](members[_0x34c88c],{'data1':members[_0x34c88c]['data1']||_0x1fbcfd[_0x3650('0xb')],'data2':members[_0x34c88c][_0x3650('0x9')]||_0x1fbcfd[_0x3650('0x2d')],'data3':members[_0x34c88c]['data3']||_0x1fbcfd[_0x3650('0x2e')],'uniqueid':members[_0x34c88c][_0x3650('0x18')]||_0x1fbcfd[_0x3650('0x18')]});utils[_0x3650('0x4')](util['format'](_0x3650('0x2f'),_0x1fbcfd[_0x3650('0x18')],members[_0x34c88c][_0x3650('0x30')],members[_0x34c88c][_0x3650('0x9')],members[_0x34c88c][_0x3650('0x31')]));if(members[_0x34c88c][_0x3650('0x23')]){writeDB(members[_0x34c88c]);}}}}catch(_0x61e685){utils[_0x3650('0x29')](util[_0x3650('0x5')](_0x3650('0x2c'),_0x1fbcfd[_0x3650('0x18')]),_0x61e685);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 74073ce..f97b94a 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 _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 +var _0xcac2=['[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','[%s][queues][agentcomplete]','assigned','queuecallercompleteAt','reason','transfer','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDED','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','uniqueid','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name'];(function(_0x367ab4,_0x4c87ec){var _0x228ae9=function(_0x2a91cc){while(--_0x2a91cc){_0x367ab4['push'](_0x367ab4['shift']());}};_0x228ae9(++_0x4c87ec);}(_0xcac2,0x1e8));var _0x2cac=function(_0x11098b,_0x3c8e40){_0x11098b=_0x11098b-0x0;var _0x4a6da6=_0xcac2[_0x11098b];return _0x4a6da6;};'use strict';var _=require(_0x2cac('0x0'));var util=require(_0x2cac('0x1'));var utils=require(_0x2cac('0x2'));var queues={};function writeDB(_0x50026e){utils[_0x2cac('0x3')](util[_0x2cac('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x50026e['uniqueid'],_0x50026e['channel'],_0x50026e['queue'],_0x50026e[_0x2cac('0x5')],_0x50026e[_0x2cac('0x6')],_0x50026e[_0x2cac('0x7')],_0x50026e[_0x2cac('0x8')]));if(_0x50026e[_0x2cac('0x9')]){utils[_0x2cac('0xa')](_0x50026e[_0x2cac('0x9')])['then'](function(_0x5df249){if(_0x5df249){_0x50026e[_0x2cac('0xb')]=_0x5df249['type'];}utils[_0x2cac('0xc')](_0x2cac('0xd'),_0x50026e);});}else{utils['request']('CreateVoiceQueueReport',_0x50026e);}if(_0x50026e[_0x2cac('0xe')]){delete queues[_0x50026e[_0x2cac('0xe')]];}else{delete queues[_0x50026e['uniqueid']];}}exports[_0x2cac('0xf')]=function(_0x54599e){try{utils[_0x2cac('0x10')](util[_0x2cac('0x4')](_0x2cac('0x11'),_0x54599e[_0x2cac('0x12')]),_0x54599e);utils[_0x2cac('0x3')](util['format'](_0x2cac('0x13'),_0x54599e[_0x2cac('0x12')],_0x54599e['queue'],_0x54599e[_0x2cac('0x14')]));queues[_0x54599e[_0x2cac('0x12')]]=_[_0x2cac('0x15')](_0x54599e,{'originalposition':_0x54599e['position'],'queuecallerjoinAt':utils[_0x2cac('0x16')](),'mohtime':0x0});}catch(_0x354ab7){utils[_0x2cac('0x17')](util['format'](_0x2cac('0x11'),_0x54599e[_0x2cac('0x12')]),_0x354ab7);}};exports[_0x2cac('0x18')]=function(_0x4d4646){try{if(!_['isNil'](queues[_0x4d4646[_0x2cac('0x12')]])){utils[_0x2cac('0x10')](util[_0x2cac('0x4')](_0x2cac('0x19'),_0x4d4646[_0x2cac('0x12')]),_0x4d4646);if(queues[_0x4d4646['uniqueid']][_0x2cac('0x1a')]){if(!queues[_0x4d4646[_0x2cac('0x12')]][_0x2cac('0x1b')]&&!queues[_0x4d4646[_0x2cac('0x12')]][_0x2cac('0x1c')]){queues[_0x4d4646[_0x2cac('0x12')]][_0x2cac('0x1d')]=!![];queues[_0x4d4646[_0x2cac('0x12')]]['queuecallercompleteAt']=utils[_0x2cac('0x16')]();queues[_0x4d4646[_0x2cac('0x12')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0x2cac('0x3')](util['format'](_0x2cac('0x1e'),_0x4d4646[_0x2cac('0x12')],queues[_0x4d4646['uniqueid']][_0x2cac('0x1f')],queues[_0x4d4646['uniqueid']][_0x2cac('0x8')]));writeDB(queues[_0x4d4646[_0x2cac('0x12')]]);}else if(queues[_0x4d4646[_0x2cac('0x12')]][_0x2cac('0xe')]){utils['info'](util[_0x2cac('0x4')](_0x2cac('0x20'),_0x4d4646[_0x2cac('0x12')],queues[_0x4d4646[_0x2cac('0x12')]][_0x2cac('0x1f')],queues[_0x4d4646[_0x2cac('0x12')]]['transfereduniqueid']));queues[queues[_0x4d4646[_0x2cac('0x12')]][_0x2cac('0xe')]]=queues[_0x4d4646['uniqueid']];queues[queues[_0x4d4646[_0x2cac('0x12')]]['transfereduniqueid']][_0x2cac('0x21')]=0x2;delete queues[_0x4d4646[_0x2cac('0x12')]];}}}catch(_0x5d70a7){utils['error'](util[_0x2cac('0x4')](_0x2cac('0x19'),_0x4d4646[_0x2cac('0x12')]),_0x5d70a7);}};exports['varset']=function(_0x1657c5){try{utils[_0x2cac('0x10')](util[_0x2cac('0x4')]('[%s][queues][varset]',_0x1657c5[_0x2cac('0x12')]),_0x1657c5);if(!_[_0x2cac('0x22')](_0x1657c5[_0x2cac('0x23')][_0x2cac('0x24')])&&_0x1657c5[_0x2cac('0x25')][_0x2cac('0x26')]()!==_0x2cac('0x27')){if(!_['isNil'](queues[_0x1657c5[_0x2cac('0x12')]])){queues[_0x1657c5[_0x2cac('0x12')]][_0x2cac('0x1b')]=![];queues[_0x1657c5['uniqueid']][_0x2cac('0x28')]=null;queues[_0x1657c5[_0x2cac('0x12')]][_0x2cac('0x1c')]=!![];queues[_0x1657c5[_0x2cac('0x12')]][_0x2cac('0x29')]=utils[_0x2cac('0x16')]();queues[_0x1657c5[_0x2cac('0x12')]][_0x2cac('0x8')]=_0x1657c5[_0x2cac('0x25')]['toUpperCase']();utils['info'](util['format'](_0x2cac('0x2a'),_0x1657c5[_0x2cac('0x12')],queues[_0x1657c5['uniqueid']]['name'],_0x1657c5['value'],queues[_0x1657c5['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x1657c5[_0x2cac('0x12')]]);}}else if(!_['isNil'](_0x1657c5[_0x2cac('0x23')][_0x2cac('0x2b')])){if(!_[_0x2cac('0x22')](queues[_0x1657c5[_0x2cac('0x12')]])&&!queues[_0x1657c5[_0x2cac('0x12')]][_0x2cac('0x1b')]){queues[_0x1657c5[_0x2cac('0x12')]][_0x2cac('0x1b')]=![];queues[_0x1657c5[_0x2cac('0x12')]][_0x2cac('0x28')]=null;queues[_0x1657c5['uniqueid']][_0x2cac('0x1c')]=!![];queues[_0x1657c5[_0x2cac('0x12')]]['queuecallerexitAt']=utils['now']();queues[_0x1657c5[_0x2cac('0x12')]][_0x2cac('0x8')]=_0x2cac('0x2c');utils[_0x2cac('0x3')](util[_0x2cac('0x4')](_0x2cac('0x2d'),_0x1657c5[_0x2cac('0x12')],queues[_0x1657c5[_0x2cac('0x12')]][_0x2cac('0x1f')],_0x1657c5[_0x2cac('0x25')],queues[_0x1657c5['uniqueid']]['queuecallerexitreason']));}}}catch(_0x2124e1){utils[_0x2cac('0x17')](util[_0x2cac('0x4')](_0x2cac('0x2e'),_0x1657c5[_0x2cac('0x12')]),_0x2124e1);}};exports[_0x2cac('0x1b')]=function(_0x467b6b){try{if(!_[_0x2cac('0x22')](queues[_0x467b6b[_0x2cac('0x12')]])){utils[_0x2cac('0x10')](util['format'](_0x2cac('0x2f'),_0x467b6b[_0x2cac('0x12')]),_0x467b6b);queues[_0x467b6b[_0x2cac('0x12')]][_0x2cac('0x1c')]=![];queues[_0x467b6b[_0x2cac('0x12')]]['queuecallerexitAt']=null;queues[_0x467b6b[_0x2cac('0x12')]][_0x2cac('0x1b')]=!![];queues[_0x467b6b['uniqueid']][_0x2cac('0x28')]=utils[_0x2cac('0x16')]();queues[_0x467b6b[_0x2cac('0x12')]][_0x2cac('0x8')]=_0x2cac('0x30');utils[_0x2cac('0x3')](util['format'](_0x2cac('0x31'),_0x467b6b[_0x2cac('0x12')],queues[_0x467b6b['uniqueid']][_0x2cac('0x1f')],queues[_0x467b6b[_0x2cac('0x12')]][_0x2cac('0x8')]));}}catch(_0x48f174){utils[_0x2cac('0x17')](util['format']('[%s][queues][queuecallerabandon]',_0x467b6b['uniqueid']),_0x48f174);}};exports[_0x2cac('0x32')]=function(_0x2fdff6){try{if(!_['isNil'](queues[_0x2fdff6['uniqueid']])){utils[_0x2cac('0x10')](util[_0x2cac('0x4')](_0x2cac('0x33'),_0x2fdff6[_0x2cac('0x12')]),_0x2fdff6);utils[_0x2cac('0x3')](util['format'](_0x2cac('0x34'),_0x2fdff6[_0x2cac('0x12')],queues[_0x2fdff6[_0x2cac('0x12')]][_0x2cac('0x1f')],_0x2fdff6['connectedlinenum'],_0x2fdff6[_0x2cac('0x35')]));queues[_0x2fdff6[_0x2cac('0x12')]][_0x2cac('0x32')]=!![];queues[_0x2fdff6[_0x2cac('0x12')]][_0x2cac('0x1a')]=utils['now']();queues[_0x2fdff6[_0x2cac('0x12')]]['holdtime']=utils[_0x2cac('0x36')](queues[_0x2fdff6[_0x2cac('0x12')]][_0x2cac('0x1a')],queues[_0x2fdff6[_0x2cac('0x12')]][_0x2cac('0x37')]);queues[_0x2fdff6[_0x2cac('0x12')]][_0x2cac('0x14')]=_0x2fdff6[_0x2cac('0x14')];queues[_0x2fdff6[_0x2cac('0x12')]][_0x2cac('0x38')]=_0x2fdff6[_0x2cac('0x38')];queues[_0x2fdff6[_0x2cac('0x12')]][_0x2cac('0x39')]=_0x2fdff6[_0x2cac('0x39')];queues[_0x2fdff6[_0x2cac('0x12')]][_0x2cac('0x35')]=_0x2fdff6[_0x2cac('0x35')];}}catch(_0x1f9653){utils[_0x2cac('0x17')](util['format'](_0x2cac('0x33'),_0x2fdff6[_0x2cac('0x12')]),_0x1f9653);}};exports[_0x2cac('0x3a')]=function(_0x5975cc){try{if(!_['isNil'](queues[_0x5975cc[_0x2cac('0x12')]])){utils[_0x2cac('0x10')](util[_0x2cac('0x4')](_0x2cac('0x3b'),_0x5975cc[_0x2cac('0x12')]),_0x5975cc);utils[_0x2cac('0x3')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x5975cc['uniqueid'],queues[_0x5975cc[_0x2cac('0x12')]]['name'],_0x5975cc[_0x2cac('0x3c')],_0x5975cc[_0x2cac('0x3d')]));queues[_0x5975cc[_0x2cac('0x12')]][_0x2cac('0x1b')]=![];queues[_0x5975cc[_0x2cac('0x12')]][_0x2cac('0x1b')]=![];queues[_0x5975cc[_0x2cac('0x12')]]['queuecallerabandonAt']=null;queues[_0x5975cc['uniqueid']]['queuecallerexit']=![];queues[_0x5975cc[_0x2cac('0x12')]][_0x2cac('0x8')]=null;queues[_0x5975cc[_0x2cac('0x12')]][_0x2cac('0x29')]=null;queues[_0x5975cc['uniqueid']]['assigned']=!![];queues[_0x5975cc['uniqueid']][_0x2cac('0x7')]=_0x5975cc['destaccountcode'];queues[_0x5975cc[_0x2cac('0x12')]][_0x2cac('0x5')]=_0x5975cc[_0x2cac('0x3c')];}}catch(_0x2ec788){utils[_0x2cac('0x17')](util[_0x2cac('0x4')](_0x2cac('0x3b'),_0x5975cc['uniqueid']),_0x2ec788);}};exports['agentcomplete']=function(_0x31a443){try{if(!_[_0x2cac('0x22')](queues[_0x31a443[_0x2cac('0x12')]])){if(queues[_0x31a443['uniqueid']][_0x2cac('0x1a')]){utils[_0x2cac('0x10')](util[_0x2cac('0x4')](_0x2cac('0x3e'),_0x31a443['uniqueid']),_0x31a443);queues[_0x31a443[_0x2cac('0x12')]][_0x2cac('0x1b')]=![];queues[_0x31a443['uniqueid']]['queuecallerabandon']=![];queues[_0x31a443[_0x2cac('0x12')]]['queuecallerabandonAt']=null;queues[_0x31a443['uniqueid']][_0x2cac('0x1c')]=![];queues[_0x31a443[_0x2cac('0x12')]][_0x2cac('0x29')]=null;queues[_0x31a443[_0x2cac('0x12')]][_0x2cac('0x3f')]=!![];queues[_0x31a443[_0x2cac('0x12')]][_0x2cac('0x5')]=_0x31a443[_0x2cac('0x3c')];queues[_0x31a443[_0x2cac('0x12')]]['queuecallercomplete']=!![];queues[_0x31a443[_0x2cac('0x12')]][_0x2cac('0x40')]=utils[_0x2cac('0x16')]();if(_0x31a443[_0x2cac('0x41')]==_0x2cac('0x42')){if(!queues[_0x31a443['uniqueid']]['transfer']){queues[_0x31a443[_0x2cac('0x12')]][_0x2cac('0x8')]='TRANSFER';}}else{queues[_0x31a443[_0x2cac('0x12')]][_0x2cac('0x8')]='COMPLETEDBY'+_0x31a443[_0x2cac('0x41')][_0x2cac('0x26')]();}utils['info'](util[_0x2cac('0x4')](_0x2cac('0x43'),_0x31a443[_0x2cac('0x12')],queues[_0x31a443[_0x2cac('0x12')]]['name'],_0x31a443[_0x2cac('0x3c')],queues[_0x31a443['uniqueid']][_0x2cac('0x8')]));writeDB(queues[_0x31a443[_0x2cac('0x12')]]);}}}catch(_0x316bf2){utils['error'](util[_0x2cac('0x4')](_0x2cac('0x3e'),_0x31a443[_0x2cac('0x12')]),_0x316bf2);}};exports[_0x2cac('0x44')]=function(_0x314ed0){try{if(!_[_0x2cac('0x22')](queues[_0x314ed0[_0x2cac('0x45')]])){utils[_0x2cac('0x10')](util['format']('[%s][queues][blindtransfer]',_0x314ed0[_0x2cac('0x12')]),_0x314ed0);queues[_0x314ed0[_0x2cac('0x45')]]['transfer']=!![];queues[_0x314ed0['transfereeuniqueid']]['transfertype']=_0x2cac('0x46');queues[_0x314ed0[_0x2cac('0x45')]][_0x2cac('0x47')]=_0x314ed0[_0x2cac('0x48')];queues[_0x314ed0[_0x2cac('0x45')]][_0x2cac('0x49')]=_0x314ed0['transfereeuniqueid'];queues[_0x314ed0[_0x2cac('0x45')]][_0x2cac('0x8')]=_0x2cac('0x4a');utils[_0x2cac('0x3')](util['format'](_0x2cac('0x4b'),_0x314ed0[_0x2cac('0x12')],queues[_0x314ed0[_0x2cac('0x45')]][_0x2cac('0x1f')],_0x314ed0[_0x2cac('0x45')],_0x314ed0[_0x2cac('0x48')]));}}catch(_0x49b542){utils[_0x2cac('0x17')](util['format'](_0x2cac('0x4c'),_0x314ed0[_0x2cac('0x12')]),_0x49b542);}};exports[_0x2cac('0x4d')]=function(_0x551a2d){try{utils[_0x2cac('0x10')](util['format'](_0x2cac('0x4e'),_0x551a2d[_0x2cac('0x4f')]),_0x551a2d);if(_0x551a2d[_0x2cac('0x4f')]==_0x551a2d[_0x2cac('0x50')]){if(!_[_0x2cac('0x22')](queues[_0x551a2d[_0x2cac('0x51')]])){utils[_0x2cac('0x3')](util[_0x2cac('0x4')](_0x2cac('0x52'),_0x551a2d[_0x2cac('0x4f')],queues[_0x551a2d[_0x2cac('0x51')]][_0x2cac('0x1f')],_0x551a2d[_0x2cac('0x53')]));queues[_0x551a2d['secondtransfererlinkedid']][_0x2cac('0x42')]=!![];queues[_0x551a2d[_0x2cac('0x51')]][_0x2cac('0x54')]='ATTENDED';queues[_0x551a2d[_0x2cac('0x51')]][_0x2cac('0x47')]=_0x551a2d[_0x2cac('0x53')];queues[_0x551a2d[_0x2cac('0x51')]]['transferuniqueid']=_0x551a2d[_0x2cac('0x4f')];queues[_0x551a2d[_0x2cac('0x51')]][_0x2cac('0x8')]=_0x2cac('0x55');}if(!_[_0x2cac('0x22')](queues[_0x551a2d[_0x2cac('0x50')]])){if(_0x551a2d[_0x2cac('0x56')]&&queues[_0x551a2d[_0x2cac('0x56')]]){queues[_0x551a2d[_0x2cac('0x56')]]['queuecallerenterreason']=0x1;queues[_0x551a2d[_0x2cac('0x45')]]=_['clone'](queues[_0x551a2d[_0x2cac('0x56')]]);queues[_0x551a2d[_0x2cac('0x45')]][_0x2cac('0xe')]=_0x551a2d[_0x2cac('0x57')];queues[_0x551a2d[_0x2cac('0x45')]][_0x2cac('0x21')]=0x2;queues[_0x551a2d[_0x2cac('0x45')]][_0x2cac('0x6')]=queues[_0x551a2d[_0x2cac('0x51')]][_0x2cac('0x6')];queues[_0x551a2d['transfereeuniqueid']]['calleridname']=queues[_0x551a2d[_0x2cac('0x51')]][_0x2cac('0x58')];queues[_0x551a2d['transfereeuniqueid']][_0x2cac('0x37')]=utils[_0x2cac('0x16')]();queues[_0x551a2d[_0x2cac('0x45')]]['queuecallerleaveAt']=utils[_0x2cac('0x16')]();queues[_0x551a2d[_0x2cac('0x45')]][_0x2cac('0x59')]=0x0;queues[_0x551a2d[_0x2cac('0x45')]][_0x2cac('0x5a')]=0x0;utils[_0x2cac('0x3')](util['format'](_0x2cac('0x5b'),_0x551a2d[_0x2cac('0x4f')],queues[_0x551a2d[_0x2cac('0x45')]][_0x2cac('0x1f')],queues[_0x551a2d[_0x2cac('0x45')]][_0x2cac('0x6')],queues[_0x551a2d['transfereeuniqueid']][_0x2cac('0x58')]));}else{utils['info'](util['format'](_0x2cac('0x5c'),_0x551a2d[_0x2cac('0x4f')],queues[_0x551a2d[_0x2cac('0x50')]][_0x2cac('0x1f')],_0x551a2d['secondtransfererlinkedid']));queues[_0x551a2d[_0x2cac('0x50')]][_0x2cac('0xe')]=_0x551a2d[_0x2cac('0x51')];}}}else if(_0x551a2d[_0x2cac('0x5d')]==_0x551a2d[_0x2cac('0x51')]){if(!_[_0x2cac('0x22')](queues[_0x551a2d[_0x2cac('0x50')]])){utils[_0x2cac('0x3')](util[_0x2cac('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x551a2d[_0x2cac('0x4f')],queues[_0x551a2d['origtransfererlinkedid']][_0x2cac('0x1f')],_0x551a2d[_0x2cac('0x5d')],_0x551a2d[_0x2cac('0x5e')]));queues[_0x551a2d[_0x2cac('0x50')]][_0x2cac('0x42')]=!![];queues[_0x551a2d[_0x2cac('0x50')]][_0x2cac('0x54')]=_0x2cac('0x5f');queues[_0x551a2d[_0x2cac('0x50')]][_0x2cac('0x47')]=_0x551a2d['secondtransfererexten'];queues[_0x551a2d[_0x2cac('0x50')]]['transferuniqueid']=_0x551a2d[_0x2cac('0x5d')];queues[_0x551a2d[_0x2cac('0x50')]][_0x2cac('0x8')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x551a2d[_0x2cac('0x51')]])){if(_0x551a2d[_0x2cac('0x60')]&&queues[_0x551a2d[_0x2cac('0x60')]]){queues[_0x551a2d[_0x2cac('0x60')]][_0x2cac('0x21')]=0x1;queues[_0x551a2d['transfertargetuniqueid']]=_[_0x2cac('0x61')](queues[_0x551a2d[_0x2cac('0x60')]]);queues[_0x551a2d[_0x2cac('0x57')]][_0x2cac('0xe')]=_0x551a2d[_0x2cac('0x57')];queues[_0x551a2d[_0x2cac('0x57')]]['queuecallerenterreason']=0x2;queues[_0x551a2d[_0x2cac('0x57')]][_0x2cac('0x6')]=queues[_0x551a2d['origtransfererlinkedid']]['calleridnum'];queues[_0x551a2d['transfertargetuniqueid']][_0x2cac('0x58')]=queues[_0x551a2d[_0x2cac('0x50')]]['calleridname'];queues[_0x551a2d[_0x2cac('0x57')]][_0x2cac('0x37')]=utils['now']();queues[_0x551a2d[_0x2cac('0x57')]][_0x2cac('0x1a')]=utils[_0x2cac('0x16')]();queues[_0x551a2d[_0x2cac('0x57')]]['holdtime']=0x0;queues[_0x551a2d[_0x2cac('0x57')]][_0x2cac('0x5a')]=0x0;utils['info'](util['format'](_0x2cac('0x62'),_0x551a2d[_0x2cac('0x4f')],queues[_0x551a2d[_0x2cac('0x57')]]['name'],queues[_0x551a2d[_0x2cac('0x57')]][_0x2cac('0xe')],queues[_0x551a2d[_0x2cac('0x57')]][_0x2cac('0x6')],queues[_0x551a2d[_0x2cac('0x57')]]['calleridname']));}else{utils['info'](util[_0x2cac('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x551a2d[_0x2cac('0x4f')],queues[_0x551a2d[_0x2cac('0x51')]][_0x2cac('0x1f')],_0x551a2d[_0x2cac('0x50')]));queues[_0x551a2d[_0x2cac('0x51')]][_0x2cac('0xe')]=_0x551a2d[_0x2cac('0x50')];}}}}catch(_0x1b5778){utils['error'](util[_0x2cac('0x4')](_0x2cac('0x4e'),_0x551a2d[_0x2cac('0x4f')]),_0x1b5778);}};exports['musiconholdstart']=function(_0x438b6e){try{if(!_[_0x2cac('0x22')](queues[_0x438b6e['uniqueid']])){utils['debug'](util['format'](_0x2cac('0x63'),_0x438b6e['uniqueid']),_0x438b6e);queues[_0x438b6e['uniqueid']][_0x2cac('0x64')]=utils[_0x2cac('0x16')]();utils['info'](util[_0x2cac('0x4')](_0x2cac('0x65'),_0x438b6e[_0x2cac('0x12')],queues[_0x438b6e['uniqueid']][_0x2cac('0x1f')],queues[_0x438b6e[_0x2cac('0x12')]]['musiconholdstartAt']));}}catch(_0x6c7c50){utils[_0x2cac('0x17')](util[_0x2cac('0x4')](_0x2cac('0x63'),_0x438b6e[_0x2cac('0x12')]),_0x6c7c50);}};exports['musiconholdstop']=function(_0x3e611e){try{if(!_[_0x2cac('0x22')](queues[_0x3e611e['uniqueid']])){if(!_['isNil'](queues[_0x3e611e[_0x2cac('0x12')]]['musiconholdstartAt'])){utils[_0x2cac('0x10')](util['format']('[%s][queues][musiconholdstop]',_0x3e611e['uniqueid']),_0x3e611e);queues[_0x3e611e[_0x2cac('0x12')]][_0x2cac('0x5a')]+=utils['diffTime'](utils['now'](),queues[_0x3e611e[_0x2cac('0x12')]][_0x2cac('0x64')]);utils[_0x2cac('0x3')](util[_0x2cac('0x4')](_0x2cac('0x66'),_0x3e611e[_0x2cac('0x12')],queues[_0x3e611e[_0x2cac('0x12')]][_0x2cac('0x1f')],queues[_0x3e611e[_0x2cac('0x12')]][_0x2cac('0x5a')]));delete queues[_0x3e611e[_0x2cac('0x12')]][_0x2cac('0x64')];}}}catch(_0xc6e300){utils[_0x2cac('0x17')](util['format'](_0x2cac('0x67'),_0x3e611e[_0x2cac('0x12')]),_0xc6e300);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 40322de..c272d00 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 _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 +var _0xa508=['outbound','monitors','forEach','clone','[%s][recordings][hangup]','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util','info','uniqueid','accountcode','getUserByInternal','then','membername','UserId','request','CreateVoiceRecording','newchannel','debug','format','linkedid','exten','context','channel','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','channelstate','transfer','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','find','push','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename'];(function(_0x202f1d,_0x4863d1){var _0x22ad04=function(_0x214e9a){while(--_0x214e9a){_0x202f1d['push'](_0x202f1d['shift']());}};_0x22ad04(++_0x4863d1);}(_0xa508,0x187));var _0x8a50=function(_0x4c1327,_0xd2183e){_0x4c1327=_0x4c1327-0x0;var _0x436f33=_0xa508[_0x4c1327];return _0x436f33;};'use strict';var _=require(_0x8a50('0x0'));var util=require(_0x8a50('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x428d67){utils[_0x8a50('0x2')](util['format']('[%s][recordings][writeDB]',_0x428d67[_0x8a50('0x3')]));if(_0x428d67[_0x8a50('0x4')]){utils[_0x8a50('0x5')](_0x428d67['accountcode'])[_0x8a50('0x6')](function(_0x297214){if(_0x297214){_0x428d67[_0x8a50('0x7')]=_0x297214['name'];_0x428d67[_0x8a50('0x8')]=_0x297214['id'];}utils[_0x8a50('0x9')](_0x8a50('0xa'),_0x428d67);});}else{utils['request'](_0x8a50('0xa'),_0x428d67);}}exports[_0x8a50('0xb')]=function(_0x21ef6f){try{utils[_0x8a50('0xc')](util[_0x8a50('0xd')]('[%s][recordings][newchannel]',_0x21ef6f[_0x8a50('0x3')]),_0x21ef6f);if(_0x21ef6f[_0x8a50('0x3')]==_0x21ef6f[_0x8a50('0xe')]){utils[_0x8a50('0x2')](util[_0x8a50('0xd')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x21ef6f[_0x8a50('0x3')],_0x21ef6f['context'],_0x21ef6f[_0x8a50('0xf')]));recordings[_0x21ef6f[_0x8a50('0x3')]]={'uniqueid':_0x21ef6f[_0x8a50('0x3')],'accountcode':_0x21ef6f[_0x8a50('0x4')],'exten':_0x21ef6f['exten'],'context':_0x21ef6f[_0x8a50('0x10')],'channel':_0x21ef6f[_0x8a50('0x11')],'monitors':[]};}}catch(_0x4276b7){utils['error'](util[_0x8a50('0xd')](_0x8a50('0x12'),_0x21ef6f[_0x8a50('0x3')]),_0x4276b7);}};exports[_0x8a50('0x13')]=function(_0x280f06){try{utils[_0x8a50('0xc')](util[_0x8a50('0xd')](_0x8a50('0x14'),_0x280f06[_0x8a50('0x3')]),_0x280f06);if(!_['isNil'](recordings[_0x280f06[_0x8a50('0x3')]])&&_0x280f06['channelstate']==0x6){utils[_0x8a50('0x2')](util[_0x8a50('0xd')](_0x8a50('0x15'),_0x280f06[_0x8a50('0x3')],_0x280f06['context'],_0x280f06['channel']));}else if(!_[_0x8a50('0x16')](recordings[_0x280f06[_0x8a50('0xe')]])&&_0x280f06[_0x8a50('0x17')]==0x6&&_0x280f06[_0x8a50('0x10')]!=_0x8a50('0x18')){utils[_0x8a50('0x2')](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x280f06[_0x8a50('0x3')],_0x280f06[_0x8a50('0xe')],_0x280f06[_0x8a50('0x10')],_0x280f06['channel']));recordings[_0x280f06[_0x8a50('0xe')]]['accountcode']=_0x280f06[_0x8a50('0x4')];}}catch(_0x52a026){utils[_0x8a50('0x19')](util[_0x8a50('0xd')](_0x8a50('0x14'),_0x280f06['uniqueid']),_0x52a026);}};exports[_0x8a50('0x1a')]=function(_0x5424a1){try{if(!_[_0x8a50('0x16')](_0x5424a1['variable'])&&!_['isNil'](_0x5424a1[_0x8a50('0x1b')][_0x8a50('0x1c')])){utils['debug'](util[_0x8a50('0xd')](_0x8a50('0x1d'),_0x5424a1[_0x8a50('0x3')]),_0x5424a1);utils[_0x8a50('0x2')](util[_0x8a50('0xd')](_0x8a50('0x1e'),_0x5424a1[_0x8a50('0x3')],_0x5424a1[_0x8a50('0x1b')],_0x5424a1[_0x8a50('0x1f')]));if(_['endsWith'](_0x5424a1[_0x8a50('0x1f')],_0x8a50('0x20'))){_0x5424a1[_0x8a50('0x1f')]=_0x5424a1[_0x8a50('0x1f')][_0x8a50('0x21')]('.wav49',_0x8a50('0x22'));}if(recordings[_0x5424a1['linkedid']]){var _0x34acf0=_[_0x8a50('0x23')](recordings[_0x5424a1['linkedid']]['monitors'],{'value':_0x5424a1['value']});if(_[_0x8a50('0x16')](_0x34acf0)){recordings[_0x5424a1[_0x8a50('0xe')]]['monitors'][_0x8a50('0x24')]({'value':_0x5424a1[_0x8a50('0x1f')]});}}}}catch(_0x3730ab){utils[_0x8a50('0x19')](util[_0x8a50('0xd')](_0x8a50('0x1d'),_0x5424a1[_0x8a50('0x3')]),_0x3730ab);}};exports['hangup']=function(_0x3ff553){try{if(!_[_0x8a50('0x16')](recordings[_0x3ff553['uniqueid']])){utils['debug'](util[_0x8a50('0xd')]('[%s][recordings][hangup]',_0x3ff553[_0x8a50('0x3')]),_0x3ff553);utils[_0x8a50('0x2')](util[_0x8a50('0xd')](_0x8a50('0x25'),_0x3ff553[_0x8a50('0x3')],_0x3ff553[_0x8a50('0x26')],_0x3ff553[_0x8a50('0x27')],_0x3ff553[_0x8a50('0x28')]));recordings[_0x3ff553[_0x8a50('0x3')]]['calleridnum']=_0x3ff553[_0x8a50('0x26')];recordings[_0x3ff553[_0x8a50('0x3')]]['calleridname']=_0x3ff553[_0x8a50('0x27')];recordings[_0x3ff553[_0x8a50('0x3')]][_0x8a50('0x29')]=_0x3ff553[_0x8a50('0x29')];recordings[_0x3ff553[_0x8a50('0x3')]][_0x8a50('0x2a')]=_0x3ff553['connectedlinename'];if(recordings[_0x3ff553['uniqueid']]['type']==_0x8a50('0x2b')&&recordings[_0x3ff553[_0x8a50('0x3')]][_0x8a50('0x4')]){recordings[_0x3ff553[_0x8a50('0x3')]]['connectedlinenum']=recordings[_0x3ff553['uniqueid']][_0x8a50('0x4')];recordings[_0x3ff553[_0x8a50('0x3')]][_0x8a50('0x2a')]='';}recordings[_0x3ff553[_0x8a50('0x3')]][_0x8a50('0x2c')][_0x8a50('0x2d')](function(_0x3a4c81){var _0x4859c9=_[_0x8a50('0x2e')](recordings[_0x3ff553[_0x8a50('0x3')]]);_0x4859c9[_0x8a50('0x1f')]=_0x3a4c81['value'];writeDB(_0x4859c9);});delete recordings[_0x3ff553['uniqueid']];}}catch(_0x3e69d2){utils[_0x8a50('0x19')](util[_0x8a50('0xd')](_0x8a50('0x2f'),_0x3ff553[_0x8a50('0x3')]),_0x3e69d2);}};exports['newexten']=function(_0x25b754){try{if(!_[_0x8a50('0x16')](recordings[_0x25b754[_0x8a50('0x3')]])){utils[_0x8a50('0xc')](util['format'](_0x8a50('0x30'),_0x25b754[_0x8a50('0x3')]),_0x25b754);utils[_0x8a50('0x2')](util[_0x8a50('0xd')](_0x8a50('0x31'),_0x25b754['uniqueid'],_0x25b754[_0x8a50('0x32')],_0x25b754[_0x8a50('0x33')]));if(_0x25b754[_0x8a50('0x32')][_0x8a50('0x34')]()==_0x8a50('0x35')&&_[_0x8a50('0x36')](_0x25b754[_0x8a50('0x33')]['toLowerCase'](),_0x8a50('0x37'))){var _0x5a7a48=_0x25b754[_0x8a50('0x33')][_0x8a50('0x38')]('=');var _0x6e2068=_0x5a7a48[0x0][_0x8a50('0x39')](_0x5a7a48[0x0][_0x8a50('0x3a')]('(')+0x1,_0x5a7a48[0x0][_0x8a50('0x3a')](')'));var _0x5de047=_0x5a7a48[0x1];recordings[_0x25b754[_0x8a50('0x3')]][_0x6e2068]=_0x5de047;}}}catch(_0x4d4a54){utils[_0x8a50('0x19')](util[_0x8a50('0xd')](_0x8a50('0x30'),_0x25b754[_0x8a50('0x3')]),_0x4d4a54);}};exports[_0x8a50('0x3b')]=function(_0x5d4348){try{if(!_[_0x8a50('0x16')](recordings[_0x5d4348['uniqueid']])){utils[_0x8a50('0xc')](util[_0x8a50('0xd')](_0x8a50('0x3c'),_0x5d4348['uniqueid']),_0x5d4348);utils[_0x8a50('0x2')](util[_0x8a50('0xd')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x5d4348[_0x8a50('0x3')],_0x5d4348[_0x8a50('0x3d')]));recordings[_0x5d4348[_0x8a50('0x3')]][_0x8a50('0x3d')]=_0x5d4348[_0x8a50('0x3d')];}}catch(_0x4eed08){utils['error'](util[_0x8a50('0xd')](_0x8a50('0x3c'),_0x5d4348[_0x8a50('0x3')]),_0x4eed08);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index cdc0dda..ed62780 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 _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 +var _0x7abc=['transfereechannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','request','CreateVoiceTransferReport','blindtransfer','debug','format','uniqueid','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','error','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','origtransfererexten','attended'];(function(_0x44e00a,_0x248bbc){var _0x2bdfba=function(_0x5e66c4){while(--_0x5e66c4){_0x44e00a['push'](_0x44e00a['shift']());}};_0x2bdfba(++_0x248bbc);}(_0x7abc,0x182));var _0xc7ab=function(_0x29cc6b,_0x118c25){_0x29cc6b=_0x29cc6b-0x0;var _0x5a5af0=_0x7abc[_0x29cc6b];return _0x5a5af0;};'use strict';var _=require(_0xc7ab('0x0'));var util=require(_0xc7ab('0x1'));var utils=require(_0xc7ab('0x2'));function writeDB(_0x2d8c84){utils[_0xc7ab('0x3')](util['format'](_0xc7ab('0x4'),_0x2d8c84[_0xc7ab('0x5')]==='attended'?_0x2d8c84['origtransfereruniqueid']:_0x2d8c84['uniqueid'],_0x2d8c84['type']));utils[_0xc7ab('0x6')](_0xc7ab('0x7'),_0x2d8c84);}exports[_0xc7ab('0x8')]=function(_0x35c11e){try{utils[_0xc7ab('0x9')](util[_0xc7ab('0xa')]('[%s][transfers][blindtransfer]',_0x35c11e[_0xc7ab('0xb')]),_0x35c11e);utils['info'](util[_0xc7ab('0xa')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x35c11e['uniqueid'],_0x35c11e[_0xc7ab('0xc')],_0x35c11e[_0xc7ab('0xd')],_0x35c11e[_0xc7ab('0xe')],_0x35c11e[_0xc7ab('0xf')]));_0x35c11e[_0xc7ab('0x5')]='blind';writeDB(_0x35c11e);}catch(_0x182647){utils[_0xc7ab('0x10')](util[_0xc7ab('0xa')](_0xc7ab('0x11'),_0x35c11e[_0xc7ab('0xb')]),_0x182647);}};exports[_0xc7ab('0x12')]=function(_0x3edbff){try{utils['debug'](util['format'](_0xc7ab('0x13'),_0x3edbff[_0xc7ab('0x14')]),_0x3edbff);utils[_0xc7ab('0x3')](util[_0xc7ab('0xa')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3edbff[_0xc7ab('0x14')],_0x3edbff[_0xc7ab('0x15')],_0x3edbff[_0xc7ab('0x16')],_0x3edbff[_0xc7ab('0x17')],_0x3edbff[_0xc7ab('0x18')]));_0x3edbff=_[_0xc7ab('0x19')](_0x3edbff,{'transfererchannel':_0x3edbff[_0xc7ab('0x1a')],'transferercalleridnum':_0x3edbff[_0xc7ab('0x15')],'transferercalleridname':_0x3edbff[_0xc7ab('0x16')],'transfererconnectedlinenum':_0x3edbff[_0xc7ab('0x1b')],'transfererconnectedlinename':_0x3edbff['secondtransfererconnectedlinename'],'transfereraccountcode':_0x3edbff['origtransfereraccountcode'],'transferercontext':_0x3edbff[_0xc7ab('0x1c')],'transfererexten':_0x3edbff[_0xc7ab('0x1d')],'transfererlinkedid':_0x3edbff['origtransfererlinkedid'],'context':_0x3edbff['origtransferercontext'],'extension':_0x3edbff[_0xc7ab('0x1e')],'type':_0xc7ab('0x1f')});if(_['isNil'](_0x3edbff[_0xc7ab('0x20')])){_0x3edbff=_[_0xc7ab('0x19')](_0x3edbff,{'transfereechannel':_0x3edbff['transfertargetchannel'],'transfereecalleridnum':_0x3edbff[_0xc7ab('0x17')],'transfereecalleridname':_0x3edbff[_0xc7ab('0x18')],'transfereeconnectedlinenum':_0x3edbff[_0xc7ab('0x21')],'transfereeconnectedlinename':_0x3edbff[_0xc7ab('0x22')],'transfereeaccountcode':_0x3edbff[_0xc7ab('0x23')],'transfereecontext':_0x3edbff['transfertargetcontext'],'transfereeexten':_0x3edbff[_0xc7ab('0x24')],'transfereelinkedid':_0x3edbff[_0xc7ab('0x25')]});}writeDB(_0x3edbff);}catch(_0x55d4bd){utils['error'](util[_0xc7ab('0xa')](_0xc7ab('0x13'),_0x3edbff['origtransfereruniqueid']),_0x55d4bd);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index afc458d..906a14d 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(_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 +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(_0x130339,_0x1cf3e0){var _0x1bbcc6=function(_0x45a33b){while(--_0x45a33b){_0x130339['push'](_0x130339['shift']());}};_0x1bbcc6(++_0x1cf3e0);}(_0x7a54,0x106));var _0x47a5=function(_0x4d36f0,_0x25950c){_0x4d36f0=_0x4d36f0-0x0;var _0x5a485d=_0x7a54[_0x4d36f0];return _0x5a485d;};'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